/* ctpo.io personal site styles */
:root {
    --bg: #fbfaf7;
    --ink: #1d1d1b;
    --muted: #5f5d57;
    --rule: #e3e0d8;
    --accent: #0f766e;
    --card: #ffffff;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #161614; --ink: #ecebe6; --muted: #a8a59c;
      --rule: #2e2d29; --accent: #2dd4bf; --card: #1d1d1a;
    }
  }
  * { box-sizing: border-box; }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
    font-size: 19px; line-height: 1.6;
  }
  .wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }
  header { border-bottom: 1px solid var(--rule); }
  header .wrap, header .wrap-wide { display: flex; align-items: center; justify-content: space-between; height: 72px; }
  .mark { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-weight: 700; letter-spacing: .08em; color: var(--ink); text-decoration: none; font-size: 18px; }
  nav a { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 15px; color: var(--muted); text-decoration: none; margin-left: 22px; }
  nav a:hover, .mark:hover { color: var(--accent); }
  .hero { padding: 72px 0 40px; }
  .hero h1 { font-size: 38px; line-height: 1.2; margin: 0 0 20px; font-weight: 600; }
  .hero p { color: var(--muted); margin: 0; }
  main.wrap h2 { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 56px 0 18px; }
  .lead { color: var(--muted); margin: 0 0 20px; }
  .strand { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 22px 24px; margin-bottom: 16px; }
  .strand h3 { margin: 0 0 8px; font-size: 21px; }
  .strand p { margin: 0; color: var(--muted); }
  .strand .status { margin-top: 12px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 13px; color: var(--muted); }
  .about p { margin: 0 0 16px; }
  .note { font-size: 16px; color: var(--muted); border-left: 3px solid var(--rule); padding-left: 16px; }
  a { color: var(--accent); }
  footer { border-top: 1px solid var(--rule); margin-top: 72px; padding: 28px 0 48px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--muted); }
  footer a { color: var(--muted); margin-right: 16px; }
  @media (max-width: 520px) {
    body { font-size: 18px; }
    .hero { padding-top: 48px; }
    .hero h1 { font-size: 30px; }
    nav a { margin-left: 14px; }
  }

/* Post pages */
  .layout { max-width:1040px; margin:0 auto; padding:48px 20px 72px; display:grid; grid-template-columns:minmax(0,680px) 260px; gap:56px; }
  .kicker { font-family:-apple-system,"Helvetica Neue",Arial,sans-serif; font-size:13px; letter-spacing:.14em; text-transform:uppercase; color:var(--accent); margin:0 0 10px; }
  h1 { font-size:38px; line-height:1.2; margin:0 0 32px; font-weight:600; }
  article h2 { font-size:24px; margin:44px 0 12px; }
  article p { margin:0 0 18px; }
  figure { margin:28px 0; }
  figure img { width:100%; height:auto; border:1px solid var(--rule); border-radius:6px; background:#fbfaf7; }
  .disclosure { font-size:16px; color:var(--muted); border-top:1px solid var(--rule); padding-top:18px; margin-top:40px; }
  aside { font-family:-apple-system,"Helvetica Neue",Arial,sans-serif; font-size:15px; line-height:1.5; }
  aside .box { position:sticky; top:24px; display:grid; gap:18px; }
  aside section { background:var(--card); border:1px solid var(--rule); border-radius:8px; padding:16px 18px; }
  aside h3 { font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--accent); margin:0 0 8px; }
  aside p { margin:0; color:var(--muted); }
  aside strong { color:var(--ink); font-weight:600; }
  aside ol { margin:0; padding-left:20px; color:var(--muted); }
  aside li.now { color:var(--ink); font-weight:600; }
  @media (max-width:900px) { .layout { grid-template-columns:1fr; gap:24px; } aside .box { position:static; } h1 { font-size:30px; } body { font-size:18px; } }

/* Wide wrapper for post pages (header and footer match the two-column layout) */
.wrap-wide { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* Legal pages */
.legal { padding-top: 32px; min-height: 60vh; }

/* Email subscribe */
.subscribe { margin: 48px 0 8px; padding: 22px 24px; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; }
.subscribe h3 { margin: 0 0 6px; font-size: 18px; }
.subscribe p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.subscribe-form { display: flex; gap: 8px; flex-wrap: wrap; }
.subscribe-form input[type=email] { flex: 1 1 220px; padding: 10px 12px; font-size: 16px; border: 1px solid var(--rule); border-radius: 6px; background: var(--bg); color: var(--ink); }
.subscribe-form button { padding: 10px 18px; font-size: 15px; font-weight: 600; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.subscribe-form button:hover { opacity: .9; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Brand logo */
.mark img { display: block; height: 44px; width: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark img { filter: invert(1) brightness(1.6); } }
@media (max-width: 520px) { .mark img { height: 36px; } }
.subscribe-form button { background: var(--accent); }

/* Homepage tension diagram */
.tension-wrap { max-width: 1040px; margin: 8px auto 0; padding: 0 20px; }
.tension-wrap .tension { display: block; width: 100%; height: auto; }
.tension-wrap .tension text { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; }
.hero.hero-tight { padding-top: 24px; }
@media (max-width: 640px) { .tension-wrap { display: none; } }

/* Section bands: full-width color behind alternating sections */
body { overflow-x: hidden; }
.band { position: relative; padding: 8px 0 40px; margin-top: 48px; }
.band::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); z-index: -1; }
.band-tint::before { background: var(--band-tint); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.band-paper::before { background: var(--band-paper); }
main.wrap .band h2 { margin-top: 40px; }
:root { --band-tint: #eef5f2; --band-paper: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --band-tint: #18201e; --band-paper: #1b1b19; } }

/* Expanders */
details.more { margin: 10px 0 0; }
details.more summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; font-weight: 600; color: var(--accent); }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; display: inline-block; width: 14px; text-align: center; font-weight: 700; }
details.more[open] summary::before { content: "\2013"; }
details.more[open] summary { margin-bottom: 8px; }
.strand details.more p { margin: 0; color: var(--muted); }

.band + .band { margin-top: 0; }

/* Clickable "Coming up" cards */
a.strand-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s ease, transform .15s ease; }
a.strand-link:hover, a.strand-link:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
a.strand-link h3 { color: var(--ink); }
a.strand-link .go { color: var(--accent); font-weight: 600; }

/* Placeholder pages for pieces still being written */
.placeholder { padding-top: 48px; }
.placeholder .kicker { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.placeholder h1 { font-size: 36px; line-height: 1.2; margin: 0 0 24px; font-weight: 600; }
.placeholder-note { margin-top: 28px; padding: 16px 18px; background: var(--card); border: 1px dashed var(--rule); border-radius: 8px; font-size: 17px; color: var(--muted); }

/* Ad-style open invitation (slides in bottom-right) */
.offer { position: fixed; right: 20px; bottom: 20px; z-index: 50; width: 360px; max-width: calc(100vw - 40px); display: flex; background: var(--card); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); overflow: hidden; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; transform: translateY(140%); opacity: 0; transition: transform .45s ease, opacity .45s ease; }
.offer.is-in { transform: none; opacity: 1; }
.offer-stub { writing-mode: vertical-rl; transform: rotate(180deg); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; padding: 14px 8px; text-align: center; border-left: 2px dashed rgba(255,255,255,.55); }
.offer-body { padding: 14px 40px 16px 16px; }
.offer-label { margin: 0 0 6px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.offer-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.offer-price { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.offer-cta { display: inline-block; padding: 7px 14px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; }
.offer-cta:hover { opacity: .9; }
.offer-close { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.offer-close:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .offer { transition: none; } }

/* Calls to action */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; padding: 11px 18px; border-radius: 8px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 15px; font-weight: 600; text-decoration: none; transition: opacity .15s ease, border-color .15s ease; }
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* Series */
.series-tag { margin: 0 0 6px !important; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent) !important; }
.series-parts { margin: 12px 0 0; padding-left: 22px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--muted); columns: 2; column-gap: 28px; }
.series-parts li { margin: 0 0 4px; break-inside: avoid; }
.series-parts li.up { color: var(--ink); font-weight: 600; }
.series-parts-page { columns: 1; font-family: Georgia, "Iowan Old Style", serif; font-size: 18px; color: var(--ink); }
.series-parts-page li { margin-bottom: 12px; }
@media (max-width: 520px) { .series-parts { columns: 1; } }

.where { display: inline-block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; margin-right: 8px; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); }
.raw-note { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--muted); margin: -4px 0 24px; }
.preface { border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin: 0 0 32px; color: var(--muted); font-size: .92em; }
.preface p { margin: 0 0 10px; }
.preface p:last-child { margin-bottom: 0; }
.offer-pill { position: fixed; right: 20px; bottom: 20px; z-index: 49; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 6px 18px rgba(0,0,0,.18); cursor: pointer; }
.offer-pill:hover { opacity: .92; }
.offer-pill[hidden] { display: none; }
.consent { position: fixed; left: 20px; bottom: 20px; z-index: 60; width: 380px; max-width: calc(100vw - 40px); background: var(--card); color: var(--ink); border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 14px 16px; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; line-height: 1.45; }
.consent[hidden] { display: none; }
.consent p { margin: 0 0 12px; color: var(--muted); }
.consent strong { color: var(--ink); }
.consent-actions { display: flex; gap: 8px; }
.consent-actions button { font: inherit; font-weight: 600; padding: 7px 14px; border-radius: 6px; cursor: pointer; }
.consent-yes { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.consent-no { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.legal h1 { font-size: 34px; margin: 0 0 6px; }
.legal .updated { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; color: var(--muted); margin: 0 0 28px; }
.legal h2 { margin-top: 36px; }
.legal table { width: 100%; border-collapse: collapse; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 14px; margin: 8px 0 20px; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.legal th { color: var(--muted); font-weight: 600; }
@media (max-width: 640px) { .legal table { font-size: 13px; } .legal th, .legal td { padding: 6px 6px; } }
.offer[hidden] { display: none; }
