@font-face {
  font-family: Newsreader;
  src: url("fonts/newsreader-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Inter;
  src: url("fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fcfdfd;
  --surface: #f6f7f9;
  --surface-elevated: #ffffff;
  --border: #e4e7ec;
  --border-subtle: #eef0f3;
  --ink: #111318;
  --prose: #252a33;
  --muted: #4b5262;
  --cobalt: #1d4ed8;
  --cobalt-hover: #1e40af;
  --cobalt-soft: #eef3ff;
  --amber: #b45309;
  --focus: #1d4ed8;

  --serif: Newsreader, Georgia, Cambria, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Strict 3-size body scale below hero (hero h1 and wordmark exempt) */
  --text-heading: clamp(2rem, 3.6vw, 2.9rem);
  --text-body: 1.0625rem;
  --text-sm: 0.875rem;

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --section-pad: clamp(4rem, 7vw, 6.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
  font: 400 100%/1.6 var(--sans);
  color: var(--prose);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, figure, fieldset, dl, dd, ul, ol { margin: 0; }
body { overflow-x: clip; background: var(--paper); color: var(--prose); }
h1, h2, .wordmark { font-family: var(--serif); font-weight: 500; font-optical-sizing: auto; color: var(--ink); }
h1, h2 { text-wrap: balance; }
h2 { font-size: var(--text-heading); line-height: 1.08; letter-spacing: -0.03em; }
h3 { font-family: var(--sans); font-size: var(--text-body); font-weight: 600; line-height: 1.4; color: var(--ink); }
p, dd, li { font-size: var(--text-body); line-height: 1.6; text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.24em; transition: color 160ms var(--ease); }
a:hover { color: var(--cobalt); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 3px; }
::selection { color: #ffffff; background: var(--cobalt); }
img { display: block; max-width: 100%; height: auto; }
[id] { scroll-margin-top: 5.5rem; }

.wrap { width: min(calc(100% - var(--gutter) * 2), 74rem); margin-inline: auto; }
.icon { display: inline-block; width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.14em; }
.visually-hidden, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip:focus { position: fixed; z-index: 50; top: 0.75rem; left: 0.75rem; padding: 0.65rem 1rem; border-radius: 0.5rem; color: #ffffff; background: var(--ink); font-size: var(--text-sm); font-weight: 500; }

/* Sticky single-line header */
.mast {
  position: sticky;
  top: 0;
  z-index: 30;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.mast[data-scrolled="true"] {
  background: rgba(252, 253, 253, 0.9);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
  box-shadow: 0 1px 12px rgba(17, 19, 24, 0.04);
}
body:has(.guide) .mast { border-bottom-color: var(--border); background: rgba(252, 253, 253, 0.94); }
.mast-inner, .colophon-line, .mast nav, .colophon nav, .wordmark, .button { display: flex; align-items: center; }
.mast-inner, .colophon-line { justify-content: space-between; gap: 1rem; }
.mast-inner { min-height: 4.5rem; }
.wordmark { width: fit-content; gap: 0.4rem; color: var(--ink); text-decoration: none; font-size: 1.7rem; font-weight: 560; line-height: 1; letter-spacing: -0.035em; }
.wordmark:hover { color: var(--ink); }
.mark { width: 0.96em; height: 0.96em; color: var(--cobalt); margin-top: -0.06em; }
.mast nav, .colophon nav { gap: clamp(0.85rem, 2.2vw, 1.85rem); }
.mast nav a, .colophon nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.mast nav a .icon { margin-left: 0.25rem; }
.mast nav a:hover, .mast nav a[aria-current="page"], .colophon nav a:hover { color: var(--ink); }
.mast nav a[aria-current="page"] { color: var(--cobalt); }

/* Opening hero bleeding cleanly to y = 0 behind borderless header */
.hero {
  margin-top: -4.5rem;
  padding-top: calc(4.5rem + clamp(2.25rem, 4.5vw, 3.75rem));
  padding-bottom: var(--section-pad);
  background: radial-gradient(75% 42rem at 50% 0%, #eef3ff 0%, #f6f8fc 44%, var(--paper) 100%);
}
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero h1 {
  max-width: 20ch;
  font-size: clamp(2.65rem, 5.4vw, 4.65rem);
  line-height: 1.01;
  letter-spacing: -0.038em;
}
.hero-copy {
  margin-top: 1.15rem;
  max-width: 54ch;
  color: var(--muted);
}
.hero-actions {
  margin-top: 1.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.4rem;
}

.button {
  justify-content: center;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.72rem 1.25rem;
  width: fit-content;
  border-radius: 0.55rem;
  background: var(--cobalt);
  color: #ffffff;
  font-size: var(--text-body);
  font-weight: 550;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(17, 19, 24, 0.08);
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.button:hover { color: #ffffff; background: var(--cobalt-hover); }
.button:active { transform: translateY(1px); }
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 0.3em;
}
.text-link:hover { color: var(--cobalt); text-decoration-color: currentColor; }

.hero-stage {
  margin-top: clamp(2.2rem, 4vw, 3.1rem);
  width: 100%;
  text-align: left;
}
.screen-frame {
  display: block;
  overflow: hidden;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  box-shadow: 0 24px 60px -28px rgba(17, 19, 24, 0.22), 0 4px 16px -4px rgba(17, 19, 24, 0.07);
  cursor: zoom-in;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), border-color 200ms var(--ease);
}
.screen-frame:hover {
  border-color: #cfd6e2;
  box-shadow: 0 28px 68px -28px rgba(17, 19, 24, 0.26), 0 8px 20px -6px rgba(17, 19, 24, 0.09);
}
.screen-frame img { width: 100%; }

.hero-stage figcaption, .shot figcaption, .phone-stage figcaption {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-size: var(--text-sm);
  color: var(--muted);
}
.shot figcaption p { max-width: 66ch; font-size: var(--text-sm); line-height: 1.55; color: var(--muted); }
.shot figcaption strong { color: var(--ink); font-weight: 600; }
.hero-stage figcaption a, .shot figcaption a, .phone-stage figcaption a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  font-weight: 500;
  color: var(--cobalt);
  text-decoration: none;
}
.hero-stage figcaption a:hover, .shot figcaption a:hover, .phone-stage figcaption a:hover { text-decoration: underline; }

/* Alternating editorial bands */
.band { padding-block: var(--section-pad); }
.band-surface {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.5rem 3.5rem;
  align-items: end;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section-head p { max-width: 52ch; color: var(--muted); }

/* 6-view connected segmented tour (works without JS via :has()) */
.gallery { padding: 0; border: 0; min-width: 0; }
.view-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.25rem;
  margin-bottom: 1.4rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--paper);
}
.view-switch label {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.42rem 0.9rem;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  transition: background-color 160ms var(--ease), color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.view-switch label:hover { color: var(--ink); }
.view-switch input:checked + label {
  background: var(--cobalt-soft);
  color: var(--cobalt);
  font-weight: 600;
}

.shot { display: none; }
#shot-story { display: block; }
.gallery:has(input:not(#view-story):checked) #shot-story { display: none; }
.gallery:has(#view-front:checked) #shot-front,
.gallery:has(#view-source:checked) #shot-source,
.gallery:has(#view-topics:checked) #shot-topics,
.gallery:has(#view-saved:checked) #shot-saved,
.gallery:has(#view-feeds:checked) #shot-feeds { display: block; }

/* Ranking, soft-dimming, and keyboard split */
.split-editorial {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2.25rem, 6vw, 5.5rem);
  align-items: start;
}
.editorial-column h2 { max-width: 18ch; }
.point-list { margin-top: 2rem; border-top: 1px solid var(--border); }
.point { padding-block: 1.35rem; border-bottom: 1px solid var(--border-subtle); }
.point p { margin-top: 0.4rem; max-width: 54ch; color: var(--muted); }

.shortcut-panel {
  padding: 1.65rem 1.75rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.shortcut-panel h3 { padding-bottom: 0.9rem; border-bottom: 1px solid var(--border); }
.shortcut-list { margin-top: 0.35rem; }
.shortcut-list > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding-block: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}
.shortcut-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.shortcut-list dt { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.shortcut-list dd { font-size: var(--text-sm); line-height: 1.45; color: var(--muted); }
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65em;
  padding: 0.14em 0.42em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 0.35rem;
  background: var(--surface-elevated);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* Mobile and offline PWA chapter */
.split-mobile {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2.25rem, 6vw, 5.5rem);
  align-items: center;
}
.phone-stage { display: flex; flex-direction: column; align-items: center; }
.phone-frame {
  display: block;
  width: min(100%, 19rem);
  border: 7px solid var(--ink);
  border-radius: 2.1rem;
  overflow: hidden;
  background: var(--surface-elevated);
  box-shadow: 0 24px 56px -24px rgba(17, 19, 24, 0.28);
  cursor: zoom-in;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.phone-frame:hover { transform: translateY(-2px); box-shadow: 0 28px 64px -24px rgba(17, 19, 24, 0.34); }
.phone-stage figcaption { justify-content: center; text-align: center; }

/* Self-hosting 2x2 hairline typographic grid */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}
.pillar {
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--border);
}
.pillar:nth-child(odd) { padding-right: clamp(1.5rem, 4vw, 3.25rem); border-right: 1px solid var(--border); }
.pillar:nth-child(even) { padding-left: clamp(1.5rem, 4vw, 3.25rem); }
.pillar p { margin-top: 0.5rem; max-width: 48ch; color: var(--muted); }
.pillar code, .guide-prose :not(pre) > code {
  padding: 0.08em 0.32em;
  border-radius: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

/* Closing dark ink install band */
.install-band {
  background: var(--ink);
  color: var(--paper);
  padding-block: clamp(3.75rem, 6.5vw, 5.5rem);
}
.install-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.75rem 3.5rem;
  align-items: center;
}
.install-copy h2 { color: var(--paper); }
.install-copy p { margin-top: 0.85rem; max-width: 48ch; color: #c7ceda; }
.install-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.5rem;
  justify-content: flex-start;
}
.button-light { background: var(--paper); color: var(--ink); }
.button-light:hover { background: #e8edf6; color: var(--ink); }
.text-link-light { color: #dbe4f5; text-decoration-color: rgba(219, 228, 245, 0.45); }
.text-link-light:hover { color: #ffffff; }

/* Footer */
.colophon { border-top: 1px solid var(--border); background: var(--paper); padding-block: 2.25rem; }
.colophon .wordmark { font-size: 1.45rem; }
.credit { margin-top: 0.9rem; max-width: 68ch; font-size: var(--text-sm); color: var(--muted); }
.credit a { color: var(--prose); }
.credit a:hover { color: var(--cobalt); }

/* Lightbox dialog */
.lightbox {
  width: min(94vw, 86rem);
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: 0 32px 84px rgba(17, 19, 24, 0.35);
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(17, 19, 24, 0.72); backdrop-filter: blur(4px); }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.lightbox-caption { font-size: var(--text-sm); color: var(--prose); max-width: 68ch; }
.lightbox-controls { display: flex; align-items: center; gap: 0.85rem; }
.lightbox-open { font-size: var(--text-sm); font-weight: 500; color: var(--cobalt); text-decoration: none; white-space: nowrap; }
.lightbox-open:hover { text-decoration: underline; }
.lightbox-close {
  min-height: 36px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-elevated);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease);
}
.lightbox-close:hover { background: var(--surface); }
.lightbox-body { overflow: auto; padding: 1rem; background: var(--paper); display: flex; justify-content: center; }
.lightbox-body img { max-height: calc(92vh - 6.5rem); width: auto; height: auto; border-radius: 0.4rem; border: 1px solid var(--border); }

/* Setup guide page */
.guide {
  display: grid;
  grid-template-columns: minmax(0, 44rem) minmax(13rem, 18rem);
  justify-content: space-between;
  gap: clamp(2rem, 6vw, 6.5rem);
  padding-block: clamp(2.5rem, 5vw, 4.5rem) var(--section-pad);
}
.step-menu { display: none; }
.guide-prose h1 { font-size: clamp(2.4rem, 4.8vw, 3.75rem); line-height: 1.04; letter-spacing: -0.035em; margin-bottom: 1.35rem; }
.guide-prose h2 { margin-block: 2.75rem 0.9rem; font-size: var(--text-heading); }
.guide-prose p, .guide-prose li { max-width: 62ch; color: var(--prose); }
.guide-prose p + p, .guide-prose ol + p, .guide-prose ul + p { margin-top: 1rem; }
.guide-prose ol, .guide-prose ul { margin-top: 0.9rem; padding-left: 1.35rem; }
.guide-prose li + li { margin-top: 0.45rem; }
.guide-prose a, .guide-files a { color: var(--cobalt); }
.guide-prose strong { color: var(--ink); font-weight: 600; }

.code-block { position: relative; margin: 1.15rem 0; }
.guide-prose pre {
  max-width: 100%;
  overflow: auto;
  margin: 1.15rem 0;
  padding: 1.05rem 1.2rem;
  border-radius: 0.6rem;
  background: var(--ink);
  color: #edf1f8;
  font-family: var(--mono);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.code-block pre { margin: 0; padding-right: 4.8rem; }
.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  min-height: 32px;
  padding: 0.25rem 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  color: #edf1f8;
  font-family: var(--sans);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.34); }
.copy-btn[data-copied="true"] { background: var(--cobalt); border-color: var(--cobalt); color: #ffffff; }

.rail-inner { position: sticky; top: 6rem; padding-left: 1.5rem; border-left: 1px solid var(--border); }
.guide-rail h2 { font-family: var(--sans); font-size: var(--text-sm); font-weight: 600; letter-spacing: normal; color: var(--ink); }
.guide-rail ol { padding-left: 1.25rem; margin-block: 0.75rem 1.5rem; }
.guide-rail li { font-size: var(--text-sm); line-height: 1.5; padding-left: 0.2rem; margin: 0.42rem 0; }
.guide-rail li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.guide-rail li a { color: var(--muted); text-decoration: none; }
.guide-rail li a:hover { color: var(--cobalt); text-decoration: underline; }
.guide-files { padding-top: 1.2rem; border-top: 1px solid var(--border); }
.guide-files h2 { margin-bottom: 0.55rem; }
.guide-files a { display: flex; align-items: center; gap: 0.35rem; width: fit-content; font-size: var(--text-sm); font-weight: 500; padding-block: 0.3rem; text-decoration: none; }
.guide-files a:hover { text-decoration: underline; }

@media (max-width: 960px) {
  .mast nav a.nav-wide { display: none; }
  .section-head, .split-editorial, .split-mobile, .install-inner, .guide { grid-template-columns: minmax(0, 1fr); }
  .section-head { gap: 0.9rem; }
  .pillar-grid { grid-template-columns: minmax(0, 1fr); }
  .pillar:nth-child(odd), .pillar:nth-child(even) { padding-inline: 0; border-right: 0; }
  .guide-rail nav { display: none; }
  .rail-inner { position: static; padding: 1.4rem 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .guide-files { padding-top: 0; border-top: 0; }
  .step-menu { display: block; margin-bottom: 1.5rem; border: 1px solid var(--border); border-radius: 0.6rem; background: var(--surface); padding: 0.35rem 0.95rem; }
  .step-menu summary { padding: 0.55rem 0; cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
  .step-menu ol { margin: 0.25rem 0 0.75rem; padding-left: 1.25rem; }
  .step-menu li { font-size: var(--text-sm); margin-block: 0.45rem; }
  .step-menu a { color: var(--cobalt); text-decoration: none; }
}

@media (max-width: 600px) {
  .mast-inner { min-height: 4rem; }
  .hero { margin-top: -4rem; padding-top: calc(4rem + 2.1rem); }
  .hero-inner { align-items: flex-start; text-align: left; }
  .hero-actions { justify-content: flex-start; }
  .wordmark { font-size: 1.5rem; }
  .mast nav { gap: 0.85rem; }
  .mast nav .nav-detail { display: none; }
  .mast nav a { text-transform: capitalize; }
  .view-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .view-switch label { justify-content: center; text-align: center; padding: 0.45rem 0.5rem; }
  .shortcut-panel { padding: 1.25rem 1.15rem; }
  .shortcut-list > div { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .colophon-line { flex-direction: column; align-items: flex-start; }
  .colophon nav { flex-wrap: wrap; gap: 0.25rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
