/* Beyond 40 — Ghost theme
   Layout: stencilled cylinder-label identity; sticky nav; section homepage;
   debate blocks show competing positions side by side. */

:root {
  --bg: #edf2f2; --surface: #f9fbfb; --ink: #0e2130; --muted: #4b5f6a; --line: #c7d5d9;
  --accent: #c4461a; --accent-soft: #f6e1d6;
  --deep: #0c2f40; --deep-2: #061a25; --on-deep: #e4eef1; --on-deep-muted: #9db6c1;
  --ok: #23724a; --warn: #946400; --bad: #b0271f;
  --f-display: var(--gh-font-heading, "Saira Stencil One", "Arial Narrow", Impact, sans-serif);
  --f-body: var(--gh-font-body, "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif);
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 6px; --wrap: 72rem; --canvas: 44rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07141c; --surface: #0d202b; --ink: #e2ecef; --muted: #93a9b3; --line: #1e3947;
    --accent: #ff8a4c; --accent-soft: #3a1f12;
    --deep: #051a25; --deep-2: #020b11;
    --ok: #5cc98a; --warn: #e2b04a; --bad: #ff6d62;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 1.0625rem; line-height: 1.6; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
h1, h2 { font-family: var(--f-display); font-weight: 400; letter-spacing: .02em; }
p { margin: 0; }
code { font-family: var(--f-mono); font-size: .9em; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 700px) { .wrap { padding-inline: 2rem; } }
.label { font-family: var(--f-mono); font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.label.on-deep { color: var(--on-deep-muted); }
.mono { font-family: var(--f-mono); font-size: .8rem; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; }
.empty { color: var(--muted); padding: 1.25rem; border: 1px dashed var(--line); border-radius: var(--r); }

/* ---------- Nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 20; background: var(--deep-2); color: var(--on-deep); border-bottom: 1px solid rgba(255,255,255,.08); }
.nav-inner { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; }
.brand { font-family: var(--f-display); font-size: 1.35rem; color: var(--on-deep); text-decoration: none; white-space: nowrap; letter-spacing: .03em; }
.brand img { max-height: 2rem; width: auto; }
.site-nav ul.nav { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; overflow-x: auto; min-width: 0; flex: 1; scrollbar-width: none; }
.site-nav ul.nav a { display: block; padding: .4rem .7rem; border-radius: var(--r); color: var(--on-deep-muted); text-decoration: none; font-size: .95rem; white-space: nowrap; }
.site-nav ul.nav a:hover, .site-nav ul.nav .nav-current a { color: var(--on-deep); background: rgba(255,255,255,.08); }
.nav-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.icon-btn { background: none; border: 0; color: var(--on-deep); padding: .5rem; cursor: pointer; border-radius: var(--r); display: grid; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.nav-cta { background: var(--accent); color: var(--deep-2); font-weight: 700; text-decoration: none; padding: .4rem .85rem; border-radius: var(--r); font-size: .9rem; white-space: nowrap; }
.nav-link { color: var(--on-deep-muted); text-decoration: none; font-size: .9rem; }
@media (max-width: 600px) { .brand { font-size: 1.1rem; } .nav-cta { display: none; } }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(180deg, var(--deep) 0%, var(--deep-2) 100%); color: var(--on-deep); }
.hero-inner { display: grid; gap: 2.5rem; padding-block: 3.5rem 3rem; }
@media (min-width: 880px) { .hero-inner { grid-template-columns: 1.35fr 1fr; align-items: end; padding-block: 5rem 4rem; } }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.4rem); line-height: 1.05; margin-top: .75rem; color: var(--on-deep); }
.hero .lede { font-size: 1.2rem; color: var(--on-deep-muted); max-width: 42ch; margin-top: 1.25rem; }
.cyl-tag { border: 2px solid var(--on-deep); border-radius: 4px; padding: 1.1rem 1.25rem; font-family: var(--f-mono); display: grid; gap: .75rem; max-width: 24rem; background: rgba(255,255,255,.03); }
.cyl-tag .big { font-family: var(--f-display); font-size: 2.4rem; line-height: 1; letter-spacing: .04em; }
.cyl-tag dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0; font-size: .9rem; }
.cyl-tag dt { color: var(--on-deep-muted); }
.cyl-tag dd { margin: 0; }
.cyl-tag .note { font-size: .78rem; color: var(--on-deep-muted); border-top: 1px dashed rgba(255,255,255,.25); padding-top: .6rem; font-family: var(--f-body); }

.notice { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.notice .wrap { padding-block: .9rem; font-size: .95rem; display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.notice strong { color: var(--accent); font-family: var(--f-mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Forms ---------- */
.subscribe-form { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; max-width: 30rem; }
.subscribe-form input { flex: 1 1 14rem; min-width: 0; font: inherit; padding: .65rem .8rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.hero .subscribe-form input, .site-foot .subscribe-form input { background: var(--deep-2); color: var(--on-deep); border-color: rgba(255,255,255,.25); }
.subscribe-form button { font: 700 1rem var(--f-body); padding: .65rem 1.1rem; border-radius: var(--r); border: 0; background: var(--accent); color: var(--deep-2); cursor: pointer; }
.subscribe-form.loading button { opacity: .6; }
.form-msg { display: none; flex-basis: 100%; font-size: .9rem; }
.subscribe-form.success .form-success { display: block; color: var(--ok); }
.subscribe-form.error .form-error { display: block; color: var(--bad); }
.hero .form-success, .site-foot .form-success { color: #5cc98a !important; }

/* ---------- Home sections & cards ---------- */
.home-body { display: grid; gap: 4rem; padding-block: 3.5rem 4rem; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-top: .4rem; max-width: 22ch; }
.more-link { font-weight: 700; text-decoration: none; white-space: nowrap; }
.more-link:hover { text-decoration: underline; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; min-width: 0; }
.card[hidden] { display: none !important; }
.card-link { display: grid; grid-template-rows: auto 1fr; height: 100%; color: inherit; text-decoration: none; }
.card-link:hover h3 { color: var(--accent); }
.card-img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.card-body { padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: .5rem; align-content: start; }
.card h3 { font-size: 1.2rem; line-height: 1.3; }
.card-excerpt { color: var(--muted); font-size: .95rem; }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }
.eyebrow { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); text-decoration: none; }

.badges { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.badge { font: 600 .68rem var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; }
.badge-cave { border-color: var(--ok); color: var(--ok); }
.badge-wreck { border-color: var(--accent); color: var(--accent); }
.badge-deep { border-color: var(--ink); color: var(--ink); }
.badge-ccr { border-color: var(--warn); color: var(--warn); }

.featured-link { display: grid; gap: 1.5rem; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: .75rem; }
@media (min-width: 800px) { .featured-link { grid-template-columns: 1.2fr 1fr; align-items: center; } }
.featured-link img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.featured-link > div { padding: 1.5rem; display: grid; gap: .6rem; }
.featured-link h2 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
.featured-link p { color: var(--muted); }
.featured-link:hover h2 { color: var(--accent); }

/* ---------- Archives ---------- */
.archive-head { background: var(--deep); color: var(--on-deep); }
.archive-head .wrap { padding-block: 3rem 2.5rem; display: grid; gap: .6rem; }
.archive-head .label { color: var(--on-deep-muted); }
.archive-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.archive-head .lede-muted { color: var(--on-deep-muted); max-width: 60ch; }
.archive-head a { color: var(--accent); }
.author-head { display: flex !important; gap: 1.25rem; align-items: center; }
.avatar { width: 5rem; height: 5rem; border-radius: 50%; object-fit: cover; }
.archive-body { padding-block: 2rem 4rem; display: grid; gap: 1.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.fchip { font: 600 .85rem var(--f-mono); padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-family: var(--f-mono); font-size: .9rem; color: var(--muted); }
.pagination a { text-decoration: none; font-weight: 600; }

/* ---------- Articles ---------- */
.article { padding-bottom: 3rem; }
.article-head { display: grid; gap: .9rem; padding-block: 3rem 2rem; max-width: 52rem; }
.article-head h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.08; }
.lede-muted { color: var(--muted); font-size: 1.2rem; max-width: 60ch; }
.article-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; font-size: .9rem; color: var(--muted); }
.article-meta a { color: inherit; }
.article-image { margin-block: 0 2rem; }
.article-image img { width: 100%; border-radius: var(--r); }
.article-image figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; }

.gh-canvas { display: grid; grid-template-columns: [full-start] minmax(1rem, 1fr) [wide-start] minmax(0, 8rem) [main-start] minmax(0, var(--canvas)) [main-end] minmax(0, 8rem) [wide-end] minmax(1rem, 1fr) [full-end]; }
.gh-canvas > * { grid-column: main-start / main-end; min-width: 0; }
.gh-canvas > .kg-width-wide { grid-column: wide-start / wide-end; }
.gh-canvas > .kg-width-full { grid-column: full-start / full-end; }
.kg-width-full img { width: 100%; }

.disclaimer { background: var(--accent-soft); border-radius: var(--r); padding: .8rem 1rem; font-size: .95rem; margin-bottom: 2rem; }
.disclaimer strong { color: var(--accent); font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; margin-right: .5rem; }

.gh-content > * + * { margin-top: 1.4rem; }
.gh-content > h2 { font-size: clamp(1.7rem, 4vw, 2.2rem); margin-top: 3rem; }
.gh-content > h3 { font-size: 1.35rem; margin-top: 2.2rem; font-family: var(--f-body); }
.gh-content > h2 + *, .gh-content > h3 + * { margin-top: .8rem; }
.gh-content ul, .gh-content ol { padding-left: 1.3rem; }
.gh-content li + li { margin-top: .4rem; }
.gh-content blockquote { margin-inline: 0; padding-left: 1.2rem; border-left: 3px solid var(--accent); font-size: 1.15rem; }
.gh-content hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5rem; }
.gh-content table { border-collapse: collapse; width: 100%; font-size: .95rem; display: block; overflow-x: auto; }
.gh-content th, .gh-content td { border-bottom: 1px solid var(--line); padding: .5rem .75rem; text-align: left; }
.gh-content th { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.gh-content pre { background: var(--deep-2); color: var(--on-deep); padding: 1rem; border-radius: var(--r); overflow-x: auto; }
.gh-content figcaption { font-size: .85rem; color: var(--muted); margin-top: .5rem; text-align: center; }
.kg-callout-card { border-radius: var(--r); }

.post-subscribe { margin-top: 3rem; }
.post-subscribe > * { grid-column: main-start / main-end; }
.post-subscribe { padding-block: 1.5rem; border-top: 3px solid var(--ink); }
.post-subscribe p:not(.label):not(.form-msg) { font-size: 1.15rem; font-weight: 700; margin-top: .3rem; }
.post-comments { margin-top: 3rem; }
.related { padding-block: 3rem; border-top: 1px solid var(--line); display: grid; gap: 1rem; }

/* ---------- Debate block (HTML card) ---------- */
.debate { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.gh-content > .debate { grid-column: wide-start / wide-end; }
.debate > header { padding: 1.25rem 1.25rem 1rem; display: grid; gap: .4rem; border-bottom: 1px solid var(--line); }
.debate > header h3 { font-size: 1.3rem; }
.debate > header p:not(.label) { color: var(--muted); }
.positions { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.pos { padding: 1.25rem; display: grid; gap: .7rem; align-content: start; min-width: 0; border-top: 1px solid var(--line); }
@media (min-width: 600px) { .pos { border-top: 0; } .pos + .pos { border-left: 1px solid var(--line); } }
.pos h4 { font-size: 1.1rem; }
.pos p { font-size: .97rem; }
.pos .why, .pos .watch { display: grid; gap: .15rem; }
.pos .why span, .pos .watch span { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.pos .why span { color: var(--ok); }
.pos .watch span { color: var(--bad); }
.debate > footer { padding: .9rem 1.25rem; background: var(--bg); font-size: .95rem; border-top: 1px solid var(--line); }
.debate > footer b { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-right: .4rem; }

/* ---------- Common ground grid ---------- */
.ground { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.gh-content > .ground { grid-column: wide-start / wide-end; }
.ground > div { border-top: 3px solid var(--ink); padding-top: .75rem; display: grid; gap: .3rem; min-width: 0; align-content: start; }
.ground b { font-size: 1.05rem; }
.ground p { color: var(--muted); font-size: .95rem; }

/* ---------- Site fact box ---------- */
.site-facts { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--r); padding: 1.1rem 1.25rem; display: grid; gap: .6rem; }
.site-facts dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1.25rem; margin: 0; }
.site-facts dt { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: .2rem; }
.site-facts dd { margin: 0; min-width: 0; }
.site-facts .caveat { font-size: .9rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: .6rem; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0 !important; margin-inline: 0; }
.timeline li { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 1.25rem; padding-block: 1rem; border-top: 1px solid var(--line); margin: 0 !important; }
.timeline .yr { font: 600 1.25rem var(--f-mono); color: var(--accent); }
.timeline h4 { font-size: 1.08rem; }
.timeline p { color: var(--muted); font-size: .97rem; margin-top: .25rem; }

/* ---------- Mix check ---------- */
.mixcheck { background: var(--deep); color: var(--on-deep); border-radius: var(--r); padding: 1.5rem; display: grid; gap: 1.5rem; }
.gh-content > [data-mix-check] { grid-column: wide-start / wide-end; }
@media (min-width: 880px) { .mixcheck { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); padding: 2rem; } }
.mixcheck h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; letter-spacing: .03em; }
.mixcheck .hint { color: var(--on-deep-muted); font-size: .95rem; }
.mc-col { display: grid; gap: 1rem; align-content: start; }
.mc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.mc-field { display: grid; gap: .3rem; min-width: 0; }
.mc-field label { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--on-deep-muted); }
.mc-field input, .mc-field select { font: 600 1.1rem var(--f-mono); width: 100%; padding: .5rem .6rem; border-radius: 4px; border: 1px solid rgba(255,255,255,.2); background: var(--deep-2); color: var(--on-deep); }
.mc-presets { display: flex; flex-wrap: wrap; gap: .4rem; }
.mc-chip { font: 600 .8rem var(--f-mono); padding: .35rem .65rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: var(--on-deep); cursor: pointer; }
.mc-chip:hover { border-color: var(--accent); }
.mc-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--deep-2); }
.mc-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; align-content: start; }
.mc-ro { background: var(--deep-2); border-radius: 4px; padding: .85rem 1rem; display: grid; gap: .2rem; border-left: 4px solid var(--on-deep-muted); min-width: 0; }
.mc-ro .k { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--on-deep-muted); }
.mc-ro .v { font: 600 1.5rem var(--f-mono); line-height: 1.2; }
.mc-ro .s { font-size: .8rem; color: var(--on-deep-muted); }
.mc-ro[data-state="ok"] { border-left-color: #5cc98a; }
.mc-ro[data-state="warn"] { border-left-color: #e2b04a; }
.mc-ro[data-state="bad"] { border-left-color: #ff6d62; }
.mc-err { color: #ff6d62; font-size: .9rem; min-height: 1.2em; }
.mc-foot { grid-column: 1 / -1; font-size: .8rem; color: var(--on-deep-muted); border-top: 1px dashed rgba(255,255,255,.25); padding-top: .9rem; }

/* ---------- Footer ---------- */
.site-foot { background: var(--deep-2); color: var(--on-deep-muted); font-size: .95rem; }
.foot-grid { display: grid; gap: 2rem; padding-block: 3rem; }
@media (min-width: 880px) { .foot-grid { grid-template-columns: 1.2fr 1.2fr 1fr; } }
.brand-foot { font-family: var(--f-display); font-size: 1.5rem; color: var(--on-deep); margin-bottom: .5rem; }
.foot-about { display: grid; gap: .5rem; align-content: start; }
.foot-disclaimer { font-size: .85rem; }
.site-foot .subscribe-form { margin-top: .75rem; }
.foot-nav ul { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .3rem; }
.foot-nav a { color: var(--on-deep-muted); text-decoration: none; }
.foot-nav a:hover { color: var(--on-deep); }
.copyright { font-size: .8rem; }
