/*
  Quiet Gazette — shared chrome + document pages
  Tokens match website/index.html (v6 / D-114)
*/

:root {
  --paper: #EDEEE7;
  --paper-warm: #E7E8DF;
  --ink: #101210;
  --ink-soft: rgba(16, 18, 16, 0.78);
  --muted: #62645F;
  --line: rgba(16, 18, 16, 0.15);
  --brand: #2F6A58;
  --brand-bright: #3d8a72;
  --forest: #121914;
  --forest-line: rgba(237, 238, 231, 0.18);
  --forest-soft: rgba(237, 238, 231, 0.62);

  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --t-micro: 140ms;
  --t-small: 250ms;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  background: var(--paper);
  color: var(--ink);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--brand); color: var(--paper); }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  padding: 10px 14px;
  z-index: 100;
  text-decoration: none;
}
.skip:focus { left: 0; }

:where(a, button, summary):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

/* —— Masthead —— */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.wordmark img { width: 20px; height: 20px; }
.masthead nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.masthead nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  min-height: 44px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  transition: color var(--t-micro) var(--ease);
}
.masthead nav a.is-active { color: var(--brand); }
.masthead nav .cta {
  margin-left: 8px;
  color: var(--paper);
  background: var(--brand);
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  transition:
    background var(--t-micro) var(--ease),
    transform var(--t-micro) var(--ease);
}
.masthead nav .cta:active { transform: scale(0.97); }

.mobile-menu { display: none; }
.mobile-menu summary {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu nav {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  padding: 10px 16px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: grid;
}
.mobile-menu nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 560px) {
  .masthead-inner { padding: 0 16px; }
}
@media (max-width: 430px) {
  .wordmark span { display: none; }
}
@media (max-width: 640px) {
  .masthead-inner > nav { display: none; }
  .mobile-menu { display: block; }
}

/* —— Document layout —— */
.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}
@media (max-width: 560px) {
  .doc { padding: 48px 16px 72px; }
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 18px;
}
.kicker::before { content: "— "; color: var(--muted); }

.doc-title {
  margin: 0 0 16px;
  font-size: clamp(2.2rem, 5.2vw, 3.2rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.doc-meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: var(--muted);
  margin: 0 0 32px;
  text-transform: uppercase;
}
.doc-meta strong {
  color: var(--ink-soft);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.02em;
}

.doc-lead {
  margin: 0 0 40px;
  font-size: 20px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 36em;
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 40px;
}

/* Pull-quote / note — gazette box */
.note {
  border: 1px solid var(--line);
  background: var(--paper-warm);
  padding: 20px 22px;
  margin: 0 0 40px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.note strong { color: var(--ink); font-weight: 500; }
.note-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 10px;
}

/* Section heads */
.doc h2 {
  margin: 2.4em 0 0.65em;
  padding-top: 0.4em;
  border-top: 1px solid var(--line);
  font-size: clamp(1.35rem, 2.8vw, 1.65rem);
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.25;
}
.doc h2[id] { scroll-margin-top: 76px; }
.doc h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.doc h3 {
  margin: 1.6em 0 0.45em;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

.doc p { margin: 0.7em 0; color: var(--ink-soft); }
.doc p strong { color: var(--ink); font-weight: 500; }
.doc ul, .doc ol {
  margin: 0.7em 0 1em;
  padding-left: 1.25em;
  color: var(--ink-soft);
}
.doc li { margin: 0.4em 0; }
.doc li strong { color: var(--ink); font-weight: 500; }
.doc a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  transition: border-color var(--t-micro) var(--ease), color var(--t-micro) var(--ease);
}

/* Tables */
.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  margin: 1em 0 1.4em;
}
.doc th, .doc td {
  border: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}
.doc th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--paper-warm);
  color: var(--brand);
}
.doc td { color: var(--ink-soft); }
.doc td strong { color: var(--ink); font-weight: 500; }

/* Support cards — flat hairline panels */
.panel {
  border: 1px solid var(--line);
  background: transparent;
  padding: 22px 24px;
  margin: 20px 0;
}
.panel p:last-child,
.panel ol:last-child,
.panel ul:last-child { margin-bottom: 0; }
.panel-hint {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}

.quick-links,
.doc-toc {
  border: 1px solid var(--line);
  background: var(--paper-warm);
  padding: 18px 20px;
  margin: 0 0 40px;
}
.quick-links strong,
.doc-toc summary {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}
.quick-links nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
}
.quick-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 16px;
}
.doc-toc summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.doc-toc ol {
  columns: 2;
  column-gap: 32px;
  margin-bottom: 0;
  font-size: 15px;
}
@media (max-width: 560px) {
  .doc-toc ol { columns: 1; }
}

/* Buttons */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--brand);
  color: var(--paper);
  border-radius: 999px;
  padding: 14px 26px;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 0;
  min-height: 48px;
  transition:
    background var(--t-micro) var(--ease),
    transform var(--t-micro) var(--ease);
}
.btn-pill:active { transform: scale(0.97); }
.btn-pill .apple { width: 13px; height: 16px; flex-shrink: 0; }
/* Beat .doc a { color: brand } — otherwise label/icon vanish on brand fill */
.doc a.btn-pill,
.doc a.btn-pill:hover {
  color: var(--paper);
  border-bottom: 0;
  text-decoration: none;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  margin: 8px 0 40px;
}

.link-mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: color var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease);
}
.link-mono::after { content: " →"; }
.doc .link-mono { border-bottom-color: var(--line); }

/* —— Footer —— */
footer {
  border-top: 1px solid var(--line);
  padding: 36px 0 56px;
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
footer a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--t-micro) var(--ease);
}
.fine {
  width: 100%;
  margin-top: 10px;
  letter-spacing: 0.1em;
  text-transform: none;
  line-height: 1.7;
}

.back-to-top { margin-top: 48px; }

@media (hover: hover) and (pointer: fine) {
  .masthead nav a:hover { color: var(--brand); }
  .masthead nav a.cta:hover { background: var(--brand-bright); color: var(--paper); }
  .btn-pill:hover { background: var(--brand-bright); color: var(--paper); }
  .doc a.btn-pill:hover { background: var(--brand-bright); }
  .doc a:hover { color: var(--brand-bright); border-bottom-color: var(--brand-bright); }
  .doc .link-mono:hover { border-bottom-color: var(--brand); }
  .link-mono:hover { color: var(--brand); border-color: var(--brand); }
  footer a:hover { color: var(--brand); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121512;
    --paper-warm: #1A1E1A;
    --ink: #F0F1EA;
    --ink-soft: rgba(240, 241, 234, 0.82);
    --muted: #B2B5AD;
    --line: rgba(240, 241, 234, 0.18);
    --brand: #7CC2A8;
    --brand-bright: #9DD4C0;
    --forest: #0C100D;
    --forest-line: rgba(240, 241, 234, 0.18);
    --forest-soft: rgba(240, 241, 234, 0.72);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .masthead nav a, .btn-pill, .link-mono, footer a, .doc a {
    transition: none;
  }
}
