@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/montserrat-latin.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

/* "Ink, paper and brass", built from the Proxylith logo:
   navy ink #0c2e51 / #0f4166 for the hero and bars; teal #187179 / sea #3eaca1 for citations
   and data; gold #d5b149 (the shield outline) as the single warm accent; warm paper for reading.
   Dark mode: desaturated slate surfaces, softened teal and gold, off-white text. */
:root {
  --bg: #f7f5f0;
  --band: #efebe2;
  --surface: #ffffff;
  --surface-2: #eef4f3;
  --border: #e2ddd1;
  --text: #1f2a37;
  --heading: #0c2e51;
  --muted: #56606d;
  --accent: #187179;
  --accent-strong: #0f5c63;
  --gold: #d5b149;
  --chip-bg: #e4f1ef;
  --chip-text: #0f5c63;
  --chip-border: #b3d9d3;
  --quote-bar: #d5b149;
  --focus: #187179;
  --hero-bg: #0c2e51;
  --hero-bg-2: #0f4166;
  --hero-text: #f3f6f8;
  --hero-muted: #bccbd8;
  --bar-bg: #0c2e51;
  --bar-text: #f3f6f8;
  --bar-muted: #b4c4d2;
  --btn-primary-bg: #d5b149;
  --btn-primary-text: #0c2e51;
  --shadow: 0 1px 2px rgb(12 46 81 / 6%), 0 12px 32px rgb(12 46 81 / 10%);
  color-scheme: light dark;
}
/* Dark tokens apply when the system asks for dark (unless the visitor picked light),
   or when the visitor picked dark with the toggle. The two blocks must stay identical. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d141c;
  --band: #111a24;
  --surface: #152230;
  --surface-2: #1a2a3a;
  --border: #263749;
  --text: #dde3ea;
  --heading: #eef2f5;
  --muted: #9eabba;
  --accent: #6cc0b5;
  --accent-strong: #94d3ca;
  --gold: #d9bc6c;
  --chip-bg: #16343a;
  --chip-text: #a3d8d0;
  --chip-border: #2d5d61;
  --quote-bar: #c9ad5f;
  --focus: #d9bc6c;
  --hero-bg: #0b2440;
  --hero-bg-2: #0e3556;
  --bar-bg: #0f2a46;
  --btn-primary-bg: #d9bc6c;
  --btn-primary-text: #0b1a2b;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 12px 32px rgb(0 0 0 / 30%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d141c;
    --band: #111a24;
    --surface: #152230;
    --surface-2: #1a2a3a;
    --border: #263749;
    --text: #dde3ea;
    --heading: #eef2f5;
    --muted: #9eabba;
    --accent: #6cc0b5;
    --accent-strong: #94d3ca;
    --gold: #d9bc6c;
    --chip-bg: #16343a;
    --chip-text: #a3d8d0;
    --chip-border: #2d5d61;
    --quote-bar: #c9ad5f;
    --focus: #d9bc6c;
    --hero-bg: #0b2440;
    --hero-bg-2: #0e3556;
    --bar-bg: #0f2a46;
    --btn-primary-bg: #d9bc6c;
    --btn-primary-text: #0b1a2b;
    --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 12px 32px rgb(0 0 0 / 30%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { font-family: "Montserrat", "Inter", system-ui, sans-serif; color: var(--heading); line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.75rem); font-weight: 700; margin: 1.5rem 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.85rem); font-weight: 700; margin: 0 0 1.25rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin: 1.5rem 0 0.6rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-strong); }
img { max-width: 100%; height: auto; }

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

.wrap { max-width: 52rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--surface); padding: 0.5rem 0.75rem; z-index: 10; }
.skip:focus { top: 1rem; }

/* Hero */
.hero {
  position: relative; overflow: hidden;
  padding: 2.5rem 0 3rem;
  color: var(--hero-text);
  background:
    url("/assets/img/facets.svg") right -140px center / auto 115% no-repeat,
    radial-gradient(60rem 30rem at 85% 10%, rgb(62 172 161 / 18%), transparent 60%),
    linear-gradient(160deg, var(--hero-bg) 0%, var(--hero-bg-2) 100%);
  border-bottom: 4px solid var(--gold);
}
/* Phones: the facets sit behind the text, so veil them to a faint texture. */
@media (max-width: 720px) {
  .hero {
    background:
      linear-gradient(rgb(12 46 81 / 78%), rgb(15 65 102 / 78%)),
      url("/assets/img/facets.svg") right -260px top 30% / auto 90% no-repeat,
      linear-gradient(160deg, var(--hero-bg) 0%, var(--hero-bg-2) 100%);
  }
}
.hero h1 { color: var(--hero-text); max-width: 40rem; }
.hero .hl { color: var(--gold); }
.logo { display: block; width: 230px; height: auto; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem; flex: none;
  min-height: 40px; padding: 0.35rem 0.8rem;
  font: 600 0.85rem/1 "Inter", system-ui, sans-serif; color: var(--hero-text);
  background: var(--hero-bg); border: 1px solid rgb(255 255 255 / 28%); border-radius: 999px;
  cursor: pointer;
}
.hero-top .logo { min-width: 0; flex: 0 1 230px; }
/* Phones: icon only; the text stays for screen readers. */
@media (max-width: 420px) {
  .theme-toggle { padding: 0.35rem 0.7rem; }
  .theme-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.theme-toggle:hover { border-color: var(--gold); }
.theme-toggle svg { width: 1rem; height: 1rem; fill: var(--gold); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle[data-dark="true"] .icon-sun { display: block; }
.theme-toggle[data-dark="true"] .icon-moon { display: none; }
.theme-toggle[hidden] { display: none; }
.lede { font-size: 1.15rem; color: var(--hero-muted); max-width: 38rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.hero .btn:not(.btn-primary) { background: rgb(255 255 255 / 6%); color: var(--hero-text); border-color: rgb(255 255 255 / 28%); }
.hero .btn:not(.btn-primary):hover { border-color: var(--gold); }
.hero :focus-visible, .demo-head :focus-visible, .footer :focus-visible { outline-color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0.55rem 1.1rem;
  font: 600 0.95rem/1.2 "Inter", system-ui, sans-serif;
  color: var(--heading); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--heading); }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); border-color: var(--btn-primary-bg); }
.btn-primary { box-shadow: 0 6px 18px rgb(213 177 73 / 25%); }
.btn-primary:hover { color: var(--btn-primary-text); filter: brightness(1.08); }
.btn-small { min-height: 36px; padding: 0.35rem 0.8rem; font-size: 0.875rem; }

.section { padding: 3rem 0; }
#how, #contact { background: var(--band); }
h2::after { content: ""; display: block; width: 2.5rem; height: 3px; margin-top: 0.6rem; background: var(--gold); border-radius: 2px; }

/* Demo card: a navy title bar over a white reading surface */
.demo {
  --pad: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0 var(--pad) 1.25rem;
  overflow: hidden;
}
@media (min-width: 640px) { .demo { --pad: 1.75rem; padding-bottom: 1.75rem; } }
.demo-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 0.75rem;
  margin: 0 calc(-1 * var(--pad)) 1.25rem; padding: 0.8rem var(--pad);
  background: var(--bar-bg); color: var(--bar-text);
  border-bottom: 2px solid var(--gold);
}
.replay-label { flex: 1 1 18rem; margin: 0; font-size: 0.875rem; color: var(--bar-muted); }
.replay-label strong { display: flex; align-items: center; gap: 0.45rem; color: var(--bar-text); }
.replay-label strong::before {
  content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 0 3px rgb(213 177 73 / 25%);
}
.demo-head .btn { background: transparent; color: var(--bar-text); border-color: rgb(255 255 255 / 30%); }
.demo-head .btn:hover { border-color: var(--gold); color: var(--bar-text); }
.replay-label time, .nw { white-space: nowrap; }
.demo-control { flex: none; }

.tag {
  display: block; margin-bottom: 0.35rem;
  font: 600 0.72rem/1.2 "Inter", system-ui, sans-serif; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.q { background: var(--surface-2); border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 1.25rem; }
.q p { margin: 0; font-weight: 600; color: var(--heading); }

.steps-wrap { margin-bottom: 1.25rem; }
.steps { list-style: none; margin: 0; padding: 0; font-size: 0.875rem; color: var(--muted); }
.steps li { position: relative; padding: 0.15rem 0 0.15rem 1.6rem; }
.steps li::before {
  content: ""; position: absolute; left: 0.2rem; top: 0.5rem;
  width: 0.8rem; height: 0.8rem; border-radius: 50%;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.4 11.2 3.2 8l-1.1 1.1 4.3 4.3 7.5-7.5-1.1-1.1z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.4 11.2 3.2 8l-1.1 1.1 4.3 4.3 7.5-7.5-1.1-1.1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.answer { border-top: 1px solid var(--border); padding-top: 1rem; }
.answer h3:first-of-type { margin-top: 1rem; }
.small { font-size: 0.85rem; color: var(--muted); }
.reasons { padding-left: 1.25rem; margin: 0; }
.reasons > li { margin-bottom: 1rem; padding-left: 0.25rem; }
.reasons > li::marker { font-weight: 700; color: var(--heading); }
.reasons ul { padding-left: 1.1rem; margin: 0 0 0.5rem; }
.reasons ul li { margin-bottom: 0.35rem; }
blockquote {
  margin: 0.75rem 0 0; padding: 0.6rem 0 0.6rem 1rem;
  border-left: 4px solid var(--quote-bar);
  font-style: italic;
}
blockquote p { margin-bottom: 0.4rem; }
.aside { background: var(--surface-2); border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.95rem; }

.table-scroll { overflow-x: auto; margin: 0 0 0.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); }
thead th { font-weight: 700; color: var(--heading); white-space: nowrap; }
thead th .chip { margin-top: 0.3rem; }
tbody th { font-weight: 600; color: var(--heading); width: 1%; white-space: nowrap; }
.th-sub { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.sub { display: block; font-size: 0.82rem; color: var(--muted); }
@media (max-width: 480px) {
  .demo { --pad: 0.8rem; padding-bottom: 1.1rem; }
  table { font-size: 0.85rem; table-layout: fixed; }
  thead td:first-child { width: 4.6rem; }
  th, td { padding: 0.5rem 0.3rem; }
  thead th { white-space: normal; }
  thead th .chip { font-size: 0.72rem; padding: 0.05rem 0.4rem; }
}

/* Citation chips */
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.55rem; margin: 0 0.1rem;
  font: 600 0.78rem/1.6 "Inter", system-ui, sans-serif; font-style: normal;
  color: var(--chip-text); background: var(--chip-bg);
  border: 1px solid var(--chip-border); border-radius: 999px;
  text-decoration: none; white-space: nowrap; cursor: zoom-in;
  vertical-align: 0.05em;
}
.chip::before {
  content: ""; width: 0.7rem; height: 0.85rem; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M1 0h6.5L12 4.5V13a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1zm6 1v4h4M2.5 7.5h7v1h-7zm0 2.5h7v1h-7z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M1 0h6.5L12 4.5V13a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1V1a1 1 0 0 1 1-1zm6 1v4h4M2.5 7.5h7v1h-7zm0 2.5h7v1h-7z' fill-rule='evenodd'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip:hover { color: var(--chip-text); border-color: var(--accent); }
.chip-hint { margin: 0.75rem 0 0; font-size: 0.85rem; color: var(--muted); }

/* Replay states. Without JS (or under reduced motion) none of these apply: the finished answer shows. */
.demo.is-armed [data-demo-question] p .tok,
.demo.is-armed .steps li,
.demo.is-armed .answer .blk,
.demo.is-armed .answer .tag,
.demo.is-armed .answer .tok { visibility: hidden; }
.demo.is-armed .on { visibility: visible !important; }
.demo.is-armed .steps li.on::before { animation: none; }
.demo.is-armed .steps li.is-running::before {
  -webkit-mask: none; mask: none;
  background: transparent; border: 2px solid var(--accent); border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.demo.is-armed .steps li.is-running { color: var(--heading); }
.demo.is-armed .steps li.is-running .step-text::after { content: "…"; }
.caret::after {
  content: ""; display: inline-block; width: 2px; height: 1.1em; margin-left: 1px;
  background: var(--accent); vertical-align: -0.2em; animation: blink 1s steps(1) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }

/* How it works */
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; counter-reset: how; }
@media (min-width: 720px) { .how { grid-template-columns: repeat(3, 1fr); } }
.how li {
  counter-increment: how;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.1rem;
}
.how h3 { margin-top: 0; }
.how h3::before {
  content: counter(how); display: grid; place-items: center;
  width: 2rem; height: 2rem; margin-bottom: 0.6rem; border-radius: 50%;
  background: var(--bar-bg); color: var(--gold); border: 2px solid var(--gold);
  font-size: 0.95rem; font-weight: 800;
}
.how li { border-top: 3px solid var(--accent); }
.how p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* About */
.about { display: flex; gap: 1rem; align-items: flex-start; }
.about-icon { flex: none; width: 56px; height: 56px; }
.about-lead { font: 700 1.2rem/1.4 "Montserrat", system-ui, sans-serif; color: var(--heading); margin: 0.2rem 0 0.75rem; }
.about p:last-child { margin-bottom: 0; }
@media (max-width: 480px) { .about { flex-direction: column; gap: 0.5rem; } .about-icon { width: 48px; height: 48px; } }

/* Contact */
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.email {
  font: 600 1.15rem/1.4 "Inter", system-ui, sans-serif; color: var(--heading);
  user-select: all; -webkit-user-select: all; word-break: break-all;
}
.copy-status { font-size: 0.875rem; color: var(--muted); min-width: 4rem; }

.footer { padding: 1.5rem 0 2rem; background: var(--hero-bg); border-top: 4px solid var(--gold); font-size: 0.875rem; color: var(--hero-muted); }
.footer p { margin: 0; }

/* Crop viewer */
.crop-dialog {
  width: min(960px, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem);
  padding: 1rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.crop-dialog::backdrop { background: rgb(8 24 43 / 60%); }
.crop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
.crop-title { margin: 0; font-weight: 600; color: var(--heading); }
.crop-frame { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; overflow: auto; }
.crop-frame img { display: block; margin: 0 auto; }
/* On phones keep the page text legible: show the crop near print size and let it scroll sideways. */
@media (max-width: 640px) { .crop-frame img { max-width: none; width: 640px; } }
.crop-note { margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--muted); }

/* Page cards: the cited excerpt re-set in the site's type and colours */
.doc-card {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 1rem 1.1rem; font-size: 0.95rem; line-height: 1.6;
}
.doc-card p { margin: 0 0 0.75rem; }
.doc-card > :last-child { margin-bottom: 0; }
.doc-caption { font-weight: 700; color: var(--heading); margin-top: 0.25rem; }
.doc-scroll { overflow-x: auto; margin: 0 0 0.75rem; }
.doc-table { width: 100%; min-width: 30rem; border-collapse: collapse; font-size: 0.875rem; background: var(--surface); }
.doc-table th, .doc-table td { padding: 0.4rem 0.6rem; border: 1px solid var(--border); text-align: center; vertical-align: middle; }
.doc-table thead th { background: var(--bar-bg); color: var(--bar-text); font-weight: 600; white-space: nowrap; }
.doc-table tbody th { text-align: left; font-weight: 600; color: var(--heading); }
.doc-table .doc-group th { background: var(--surface-2); font-weight: 700; text-align: left; }
.doc-table-c { min-width: 24rem; }
@media (max-width: 480px) {
  .doc-card { padding: 0.8rem 0.7rem; }
  .crop-dialog { padding: 0.75rem; }
  .doc-table, .doc-table-c { min-width: 0; font-size: 0.72rem; table-layout: auto; }
  .doc-table th, .doc-table td { padding: 0.3rem 0.2rem; }
  .doc-table thead th { white-space: normal; overflow-wrap: anywhere; hyphens: auto; }
  .doc-table tbody th { padding-left: 0.3rem; }
}
.doc-fn { font-size: 0.82rem; color: var(--muted); }
.doc-cut { color: var(--muted); }
.crop-dialog mark {
  background: rgb(213 177 73 / 30%); color: inherit; padding: 0 0.1em; border-radius: 2px;
  box-shadow: inset 0 -2px 0 var(--gold);
}
.doc-legend { margin: 0.6rem 0 0; font-size: 0.82rem; color: var(--muted); }
.orig { margin-top: 0.75rem; }
.orig > summary {
  cursor: pointer; width: fit-content; font-size: 0.875rem; font-weight: 600; color: var(--accent);
  padding: 0.25rem 0; border-radius: 4px;
}
.orig > .crop-frame { margin-top: 0.5rem; }
.orig.is-bare > summary { display: none; }
.orig.is-bare > .crop-frame { margin-top: 0; }
.crop-note:empty { display: none; }

/* 404 */
.notfound { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; border-bottom: 0; }
