/* WorrySorted — site.css
   Dark-mode-first (3am audience). Light "paper" variant under
   prefers-color-scheme: light. Two type families only: Fraunces (display,
   "the book") and JetBrains Mono (structural, "the chart" — labels + hints).
   No external requests: fonts + everything below are same-origin. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/Fraunces-Variable.woff2") format("woff2-variations"),
       url("/fonts/Fraunces-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Variable.woff2") format("woff2-variations"),
       url("/fonts/JetBrainsMono-Variable.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Dark palette (primary — brand-system.md §2.1) */
  --bg: #17140F;
  --bg-2: #241E16;
  --text: #F4ECDC;
  --text-secondary: #B4A58C;
  --accent-emphasis: #E3A542;
  --accent-emphasis-soft: #C98B4A;
  --accent-cta: #4FA085;
  --accent-cta-ink: #17140F;
  --accent-escalation: #E2725B;
  --border: #3a3225;
  --focus: #E3A542;

  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --content-max: 40rem;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    /* Light "paper" palette (secondary — brand-system.md §2.2), text-safe inks */
    --bg: #F6F1E6;
    --bg-2: #EAE1CE;
    --text: #221C14;
    --text-secondary: #6B5F4C;
    --accent-emphasis: #8A5A16;
    --accent-emphasis-soft: #8A5A16;
    --accent-cta: #1F6E58;
    --accent-cta-ink: #F6F1E6;
    --accent-escalation: #A83E27;
    --border: #d9cdb0;
    --focus: #1F6E58;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  font-variation-settings: "opsz" 20, "WONK" 0, "SOFT" 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-emphasis);
  color: var(--bg);
}

a {
  color: var(--accent-cta);
  text-underline-offset: 0.15em;
}

a:not(.wordmark):not(.btn) {
  text-decoration-thickness: from-font;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--accent-emphasis);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  z-index: 100;
  transition: top 0.15s ease-out;
}
.skip-link:focus {
  top: 1rem;
}

/* Layout shell */
.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.site-header {
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  display: inline-flex;
  color: var(--text);
  text-decoration: none;
}
.wordmark svg {
  width: 132px;
  height: auto;
  display: block;
}
.wordmark .wm-ink { fill: currentColor; }
.wordmark .wm-accent { fill: var(--accent-emphasis); }

main {
  padding-block: 2.25rem 3rem;
}

h1 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 72, "WONK" 1, "SOFT" 0;
  font-weight: 560;
  font-size: clamp(1.9rem, 6vw + 0.4rem, 2.75rem);
  line-height: 1.12;
  margin: 0 0 1rem;
  max-width: 18ch;
}

h2 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 40, "WONK" 0;
  font-weight: 560;
  font-size: 1.25rem;
  margin: 2.25rem 0 0.75rem;
}

h3 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  color: var(--accent-emphasis);
  margin: 1.5rem 0 0.5rem;
}

p { margin: 0 0 1rem; }

.lede {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

strong { color: var(--text); font-weight: 700; }

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Form */
form.subscribe {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  margin-block: 1.75rem;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.field input[type="email"] {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  font-family: var(--font-display);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.field input[type="email"]::placeholder {
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Honeypot — visually hidden, still in the tab order removed via tabindex=-1 */
.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent-cta);
  color: var(--accent-cta-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }

.form-hint {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.9rem;
  margin-bottom: 0;
}

.form-error {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-escalation);
  margin-top: 0.9rem;
  margin-bottom: 0;
}

/* Device-clock line */
.device-clock {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.device-clock time {
  color: var(--text);
  font-weight: 600;
}

/* Ladder — the one original element on / */
.ladder-wrap {
  position: relative;
  margin: 1.75rem 0 0.5rem;
}

.ladder-rule {
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5rem;
  height: 100%;
  color: var(--border);
  pointer-events: none;
}

.ladder {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.75rem;
  position: relative;
}

.ladder-item {
  position: relative;
  margin-bottom: 1.5rem;
}
.ladder-item:last-child { margin-bottom: 0; }

.ladder-item p {
  margin: 0;
  line-height: 1.3;
}

.ladder-label {
  display: inline-block;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin-right: 0.5ch;
}

.ladder-1 { font-size: clamp(1.6rem, 7vw, 2.4rem); font-variation-settings: "opsz" 144, "WONK" 1; }
.ladder-1 .ladder-label { color: var(--accent-escalation); font-size: 0.42em; vertical-align: 0.32em; }

.ladder-2 { font-size: clamp(1.2rem, 5vw, 1.7rem); font-variation-settings: "opsz" 70, "WONK" 1; }
.ladder-2 .ladder-label { color: var(--accent-emphasis); font-size: 0.5em; vertical-align: 0.28em; }

.ladder-3 { font-size: clamp(1rem, 3.6vw, 1.2rem); font-variation-settings: "opsz" 30, "WONK" 0; }
.ladder-3 .ladder-label { color: var(--text-secondary); font-size: 0.7em; vertical-align: 0.12em; }

@media (prefers-reduced-motion: no-preference) {
  .ladder-item {
    animation: ladder-in 0.3s ease-out both;
  }
  .ladder-item:nth-child(1) { animation-delay: 0s; }
  .ladder-item:nth-child(2) { animation-delay: 0.06s; }
  .ladder-item:nth-child(3) { animation-delay: 0.12s; }

  @keyframes ladder-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* Tables (routing card) — real <table> at >=768px; stacked per-country
   blocks below that so a 3-column table never has to shrink columns or
   scroll sideways on a phone (B3.1). */
.table-wrap { display: none; margin: 0 0 1.25rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
th, td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-emphasis);
  background: var(--bg-2);
}

/* Per-country stacked blocks (default — phones) */
.country-stack {
  margin: 0 0 1.25rem;
  border-top: 1px solid var(--border);
}
.country {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1rem;
}
.country-name {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 30, "WONK" 0;
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.6rem;
}
.country-facts { margin: 0; }
.country-facts .fact { margin: 0 0 0.65rem; }
.country-facts .fact:last-child { margin-bottom: 0; }
.country-facts dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 0.2rem;
}
.country-facts dd { margin: 0; }

/* Jump nav — two variants, toggled with the same breakpoint as the
   stack/table swap, because the two layouts put the country anchors on
   different (non-duplicate-id) elements. */
.jump-nav {
  margin: 0 0 1.5rem;
}
.jump-nav-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}
.jump-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  padding: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.jump-nav.table-jump { display: none; }

@media (min-width: 48rem) {
  .country-stack { display: none; }
  .table-wrap { display: block; overflow-x: auto; }
  th[scope="col"] { scroll-margin-top: 1rem; }
  .jump-nav.stack-jump { display: none; }
  .jump-nav.table-jump { display: block; }
}

/* Callouts */
.callout {
  border-left: 3px solid var(--accent-escalation);
  background: var(--bg-2);
  padding: 0.9rem 1rem;
  margin: 1.25rem 0;
  border-radius: 0 4px 4px 0;
}

ul.plain { padding-left: 1.2rem; }
ul.plain li { margin-bottom: 0.5rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  margin-top: 2rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.footer-nav a {
  color: var(--text);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-block: 0.5rem;
}
.footer-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

@media (min-width: 48rem) {
  :root { --content-max: 44rem; }
  body { font-size: 1.1rem; }
  .wordmark svg { width: 150px; }
}

@media (min-width: 90rem) {
  :root { --content-max: 50rem; }
}

/* ==========================================================================
   Night Shift — the subpages (how-we-work, routing, privacy, check-your-inbox,
   youre-in). Same tokens and type as night.css, no scroll motion: these are
   reading pages. Grain from the index, display headings, ladder ticks on the
   routing verbs, and the paper dawn band as the footer.
   design-studio · macro: storyboard · paper: dark · display: serif · accent: warm
   ========================================================================== */
:root {
  --paper: #E6DCC8;
  --ink-on-paper: #221C14;
  --ink-2-on-paper: #6B5F4C;
  --teal-on-paper: #1F6E58;
  --grain-opacity: 0.07;
  --gutter: max(1.25rem, env(safe-area-inset-left, 0px));
  --gutter-r: max(1.25rem, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: light) {
  :root { --paper: #FBF8F1; --grain-opacity: 0.05; }
}

/* html paints the canvas; body stays transparent so the grain layer shows.
   Flex column so the dawn footer always reaches the bottom on short pages. */
body { background: transparent; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.9 0 0 0 0 0.82 0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.wrap { padding-left: var(--gutter); padding-right: var(--gutter-r); }

/* Header: matches the index bar. Sticky and solid on phones. */
.site-header {
  position: sticky; top: 0; z-index: 10;
  padding-block: 0.7rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.wordmark { min-height: 44px; align-items: center; }
.wordmark svg { --wm: 124px; width: var(--wm); margin-left: calc(var(--wm) * -0.046); }

main { padding-block: 2.4rem 4.5rem; }

h1 {
  font-weight: 480;
  font-size: clamp(2.1rem, 6.4vw + 0.4rem, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.005em;
  font-variation-settings: "opsz" 48, "WONK" 0, "SOFT" 50;
  max-width: 20ch;
  margin: 0 0 1.3rem;
  text-wrap: balance;
}
h2 {
  font-weight: 480;
  font-size: clamp(1.4rem, 2.4vw + 0.8rem, 1.8rem);
  line-height: 1.18;
  letter-spacing: -0.008em;
  font-variation-settings: "opsz" 28, "WONK" 0, "SOFT" 30;
  margin: 3rem 0 0.9rem;
  text-wrap: balance;
}
.lede { font-size: 1.2rem; line-height: 1.5; color: var(--text); }

/* Routing verbs carry the index ladder's tick: rust, amber, muted, rule. */
h2[id="go-now"], h2[id="call-now"], h2[id="call-today"], h2[id="mention-at-next-visit"] { scroll-margin-top: 5rem; }
h2[id="go-now"]::before, h2[id="call-now"]::before,
h2[id="call-today"]::before, h2[id="mention-at-next-visit"]::before {
  content: ""; display: block; width: 2.25rem; height: 2px; margin-bottom: 0.9rem;
  background: var(--text-secondary);
}
h2[id="go-now"]::before { background: var(--accent-escalation); }
h2[id="call-now"]::before { background: var(--accent-emphasis); }
h2[id="mention-at-next-visit"]::before { background: var(--border); }

.country-name { font-variation-settings: "opsz" 20, "WONK" 0; font-weight: 560; font-size: 1.2rem; }
.country { scroll-margin-top: 5rem; }
th { background: transparent; }
th[scope="col"] { border-bottom-color: var(--text-secondary); }
th, td { border-left: 0; border-right: 0; }

.callout { border-left: 0; border-radius: 3px; padding: 1rem 1.1rem; }
.callout::before {
  content: ""; display: block; width: 2.25rem; height: 2px; margin-bottom: 0.8rem;
  background: var(--accent-escalation);
}
.callout p:last-child { margin-bottom: 0; }

.btn {
  min-height: 52px; border-radius: 3px;
  font-variation-settings: "opsz" 24, "WONK" 0;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), filter 160ms ease;
}
.btn:active { transform: scale(0.97); }

/* Footer: the dawn band, same paper as the end of the index. */
.site-footer {
  --bg: var(--paper);
  --bg-2: #EAE1CE;
  --text: var(--ink-on-paper);
  --text-secondary: var(--ink-2-on-paper);
  --accent-cta: var(--teal-on-paper);
  --accent-emphasis: #8A5A16;
  --accent-escalation: #A83E27;
  --border: #D3C6AA;
  --focus: #1F6E58;
  background: var(--bg); color: var(--text);
  border-top: 0; margin-top: 0;
  padding-block: 2rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
}
.site-footer .callout { background: rgba(34, 28, 20, 0.05); }
@media (prefers-color-scheme: light) { .site-footer { --bg-2: #E0D5BE; } }

@media (min-width: 64rem) {
  .site-header { position: static; background: transparent; border-bottom: 0; padding-block: 1.6rem; }
  .wordmark svg { --wm: 150px; }
  main { padding-block: 3.5rem 7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

/* Page-to-page: a short crossfade, the wordmark carries across (pairs with night.css). */
@view-transition { navigation: auto; }
.wordmark { view-transition-name: wordmark; }
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 240ms; animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none; }
}
