/* Navigating the Exit — book identity, Edition 1.0
   Derived from the Meranti system (IBM Plex Sans body, IBM Plex Mono labels,
   1px rules, 2px radius, no shadows) with a display serif and a dusk-navy /
   lamp-gold palette taken from the book cover.
   Layout: one editorial column at a 68ch measure inside an 1120px frame,
   with a mono label rail that stacks above the column below 900px. */

:root {
  --paper:      #FFFFFF;
  --paper-sunk: #F4F3EF;
  --ink:        #16202E;
  --muted:      #4C5A6E;
  --rule:       #DCDCD6;
  --harbor:     #15294B;
  --harbor-ink: #F4F1E8;
  --lamp:       #E0A94A;
  --lamp-ink:   #8A5A14;

  --display: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --body:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0D131E;
    --paper-sunk: #141C2A;
    --ink:        #E9E6DD;
    --muted:      #A2AEBF;
    --rule:       #263040;
    --harbor:     #16283F;
    --harbor-ink: #E9E6DD;
    --lamp:       #E0A94A;
    --lamp-ink:   #E0A94A;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper:      #0D131E;
  --paper-sunk: #141C2A;
  --ink:        #E9E6DD;
  --muted:      #A2AEBF;
  --rule:       #263040;
  --harbor:     #16283F;
  --harbor-ink: #E9E6DD;
  --lamp:       #E0A94A;
  --lamp-ink:   #E0A94A;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute;
  left: -9999px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 10;
}
.skip:focus { left: 12px; top: 12px; }

/* ---- frame ---------------------------------------------------------- */

.frame { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }
.measure { max-width: 68ch; }

/* ---- type ----------------------------------------------------------- */

h1, h2, h3, h4 { text-wrap: balance; margin: 0; }

h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.4rem, 1.3rem + 4.2vw, 4rem);
  line-height: 1.04;
  letter-spacing: 0.005em;
}

h1.caps {
  text-transform: uppercase;
  letter-spacing: 0.045em;
  font-weight: 500;
}

h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2.1rem);
  line-height: 1.2;
}

h3 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.4;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.deck {
  font-family: var(--display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.7rem);
  line-height: 1.3;
  color: var(--muted);
  margin: 0;
}

.lede { font-size: 1.12rem; line-height: 1.6; }
.meta { font-size: 0.875rem; line-height: 1.55; color: var(--muted); }

a { color: inherit; text-decoration-color: var(--lamp-ink); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--lamp-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- masthead ------------------------------------------------------- */

.masthead { border-bottom: 1px solid var(--rule); }

.masthead .frame {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
  padding-block: 20px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -1px 0 var(--lamp-ink); }

/* ---- bands ---------------------------------------------------------- */

.band { padding-block: clamp(46px, 6.5vw, 84px); }
.band + .band { border-top: 1px solid var(--rule); }
.band--sunk { background: var(--paper-sunk); border-top: 1px solid var(--rule); }

.band--harbor {
  background: var(--harbor);
  color: var(--harbor-ink);
  border-top: 0;
}
.band--harbor .kicker { color: var(--lamp); }
.band--harbor .deck { color: var(--harbor-ink); opacity: 0.84; }
.band--harbor a { text-decoration-color: var(--lamp); }

/* ---- hero ----------------------------------------------------------- */

.hero { padding-block: clamp(44px, 6vw, 80px); }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: start;
}

@media (min-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; }
}

.hero h1 { margin-block: 16px 16px; }

.cover {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.cover-note { margin-top: 12px; }

/* ---- label rail ----------------------------------------------------- */

.railed { display: grid; grid-template-columns: 1fr; gap: 14px 40px; }

@media (min-width: 900px) {
  .railed { grid-template-columns: 148px minmax(0, 1fr); }
  .railed > .kicker { padding-top: 0.5em; }
}

/* ---- register ------------------------------------------------------- */

.register { margin: 0; border-top: 1px solid var(--rule); }

.register > div {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px 32px;
  padding-block: 18px;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 640px) {
  .register > div { grid-template-columns: 200px minmax(0, 1fr); gap: 0 32px; }
}

.register dt {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.3em;
}

.register dd { margin: 0; min-width: 0; }

.band--harbor .register,
.band--harbor .register > div { border-color: rgba(224, 169, 74, 0.34); }
.band--harbor .register dt { color: var(--lamp); }

/* ---- facts table ---------------------------------------------------- */

.table-wrap { overflow-x: auto; }

.facts {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.facts th, .facts td {
  border-bottom: 1px solid var(--rule);
  padding: 13px 18px 13px 0;
  vertical-align: top;
}

.facts th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.facts td { font-family: var(--mono); font-size: 0.875rem; }

/* ---- answer pages --------------------------------------------------- */

.answer h2 { margin-top: 2.3em; }
.answer > h2:first-child { margin-top: 0; }

.answer-first {
  border-left: 2px solid var(--lamp-ink);
  padding-left: 22px;
  font-size: 1.12rem;
  line-height: 1.6;
}

.terms { margin: 1.3em 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.terms li { padding-block: 13px; border-bottom: 1px solid var(--rule); }
.terms b { font-weight: 600; }

/* ---- byline & sources ----------------------------------------------- */

.byline {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding-block: 14px;
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.byline a { color: inherit; }

.sources { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.sources li { padding-block: 12px; border-bottom: 1px solid var(--rule); font-size: 0.9rem; line-height: 1.5; }

.worked {
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 22px 24px;
  margin: 1.4em 0;
  background: var(--paper-sunk);
}

.band--harbor .worked { background: rgba(0,0,0,0.18); border-color: rgba(224,169,74,0.34); }

.worked .kicker { margin-bottom: 12px; }

.worked table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.worked td { padding: 7px 0; border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 0.875rem; }
.worked td:last-child { text-align: right; white-space: nowrap; }
.worked tr:last-child td { border-bottom: 0; font-weight: 600; }

/* ---- score bands ---------------------------------------------------- */

.bands { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }

.bands li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px 28px;
  padding-block: 18px;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 680px) {
  .bands li { grid-template-columns: 90px 190px minmax(0, 1fr); gap: 0 28px; align-items: baseline; }
}

.bands .score {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bands .name { font-weight: 600; }
.bands p { margin: 0; min-width: 0; }

.band--harbor .bands,
.band--harbor .bands li { border-color: rgba(224,169,74,0.34); }
.band--harbor .bands .score { color: var(--lamp); }

/* ---- legal ---------------------------------------------------------- */

.legal h2 { margin-top: 2.1em; margin-bottom: 0.5em; }
.legal > h2:first-child { margin-top: 0; }
.legal ul { margin: 0 0 1.1em; padding-left: 1.25em; }
.legal li { margin-bottom: 0.45em; }
.legal address { font-style: normal; line-height: 1.75; margin-top: 0.4em; }

/* ---- lists of pages ------------------------------------------------- */

.index-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.index-list li { border-bottom: 1px solid var(--rule); padding-block: 22px; }
.index-list h3 { margin-bottom: 6px; }
.index-list a { text-decoration: none; }
.index-list a:hover { text-decoration: underline; }

.status {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

/* ---- endorsements --------------------------------------------------- */

.quotes { margin: 0; padding: 0; list-style: none; display: grid; gap: 30px; }

@media (min-width: 760px) { .quotes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 44px; } }

.quotes blockquote {
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid var(--rule);
  font-family: var(--display);
  font-size: 1.1rem;
  line-height: 1.45;
}

.quotes figcaption { margin-top: 10px; padding-left: 21px; }

/* ---- authors -------------------------------------------------------- */

.bio { border-top: 1px solid var(--rule); padding-block: 34px; }
.bio h2 { margin-bottom: 4px; }
.bio .kicker { margin-bottom: 18px; }

/* ---- buttons -------------------------------------------------------- */

.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 13px 22px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  text-decoration: none;
  background: var(--ink);
  color: var(--paper);
}
.btn:hover { background: var(--harbor); border-color: var(--harbor); color: var(--harbor-ink); }

.btn--quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--quiet:hover { background: transparent; color: var(--ink); border-color: var(--ink); }

.band--harbor .btn { background: var(--harbor-ink); color: var(--harbor); border-color: var(--harbor-ink); }
.band--harbor .btn:hover { background: var(--lamp); border-color: var(--lamp); color: var(--harbor); }
.band--harbor .btn--quiet { background: transparent; color: var(--harbor-ink); border-color: rgba(224,169,74,0.5); }
.band--harbor .btn--quiet:hover { background: transparent; color: var(--harbor-ink); border-color: var(--lamp); }

/* ---- editorial note (prototype scaffolding) ------------------------- */

.editnote { border: 1px dashed var(--lamp-ink); border-radius: 2px; padding: 18px 20px; margin-top: 22px; }
.editnote p { font-size: 0.9rem; line-height: 1.55; color: var(--muted); }
.editnote .kicker { color: var(--lamp-ink); margin-bottom: 8px; }

/* ---- footer --------------------------------------------------------- */

.foot { border-top: 1px solid var(--rule); padding-block: 36px 48px; }

.foot .frame {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 40px;
  justify-content: space-between;
  align-items: baseline;
}

.foot .nav { margin-left: 0; }

.disclaim { font-size: 0.8rem; line-height: 1.55; color: var(--muted); max-width: 60ch; margin-top: 24px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
