/* =============================================================================
   MyFace Biometric Sovereignty Standard — Shared Stylesheet
   ============================================================================= */

/* === VARIABLES ============================================================= */
:root {
  --ink: #0e0e0e;
  --paper: #f5f2ed;
  --accent: #117aa8;
  --accent-tint: rgba(17, 122, 168, 0.06);
  --mid: #32312f;
  --rule: #d8d3cc;
  --code-bg: #1a1a1a;
  --code-text: #e8e4de;
  --mono: 'DM Mono', monospace;
  --serif: 'Jost', sans-serif;
  --sans: 'Jost', sans-serif;
}

/* === RESET ================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* === FOCUS (keyboard navigation) =========================================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* === BASE ================================================================== */
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
}

/* === HEADER ================================================================ */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1.2rem 2.5rem;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper); border-bottom: 1px solid transparent;
}

.logo {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.logo span { color: var(--accent); }

nav { display: flex; gap: 2rem; align-items: center; }

nav a {
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s;
}

nav a:hover, nav a.active { color: var(--accent); }

/* Burger menu (CSS-only checkbox hack) */
.nav-toggle { display: none; }

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
}

.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

/* Animate burger → X when checked */
.nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Full-screen mobile nav and hero share this animation */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === FOOTER ================================================================ */
footer {
  border-top: 1px solid var(--rule);
  padding: 2.5rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}

.footer-copy { font-family: var(--sans); font-size: 0.85rem; color: var(--mid); letter-spacing: 0.05em; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.footer-copy a { color: var(--accent); text-decoration: none; }
.footer-cc { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.footer-cc img { display: block; height: 20px; width: 20px; transition: opacity 0.2s; }
.footer-cc:hover img { opacity: 0.7; }
.footer-tagline { font-family: var(--serif); font-size: 0.95rem; font-style: italic; color: var(--mid); }

/* === SHARED TYPOGRAPHY ===================================================== */
.doc-type {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.doc-subtitle {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--mid);
  margin-bottom: 2rem;
}

.doc-meta {
  display: flex; gap: 2rem; flex-wrap: wrap;
  padding-bottom: 2rem;
}

.doc-meta span {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--mid);
}

ul { margin: 1rem 0 1.5rem 1.5rem; }
ul li { font-size: 0.95rem; line-height: 1.8; margin-bottom: 0.4rem; color: var(--ink); }
ul li strong { font-weight: 500; }

.licence-note {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.62rem;
  color: var(--mid);
  letter-spacing: 0.04em;
  line-height: 1.8;
}

.licence-note a { color: var(--accent); text-decoration: none; }

/* === SIDEBAR + LAYOUT (proposal, specification) ============================ */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  padding-top: 80px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 3rem 1.5rem;
  border-right: 1px solid var(--rule);
}

.sidebar-label {
  text-transform: uppercase;
  font-family: var(--sans);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--mid);
  margin-bottom: 1.5rem;
}

.toc-item {
  display: block;
  padding: 0.4rem 0 0.4rem 0.75rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: var(--mid);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.2s;
  line-height: 1.5;
}

.toc-item:hover { color: var(--ink); border-left-color: var(--accent); }
.toc-item.sub { padding-left: 1.5rem; font-size: 0.75rem; }

.content { padding: 4rem 4rem 7rem; max-width: 800px; min-width: 0; overflow-wrap: break-word; }

/* === DOCUMENT SECTIONS (proposal, specification) =========================== */
.doc-section { margin-bottom: 3.5rem; }

.doc-section h2 {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 100px;
}

.doc-section h3 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  margin: 2rem 0 0.75rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  scroll-margin-top: 100px;
}

.doc-section p { font-size: 0.95rem; line-height: 1.9; margin-bottom: 1.2rem; }

/* === WHY PAGE ============================================================== */
.doc-hero {
  padding: 10rem 2.5rem 0rem;
  max-width: 800px;
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
}

.doc-hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.doc-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 5rem 2.5rem 7rem;
}

/* Why page overrides .doc-section to use small mono h2 style */
.page-why .doc-type { margin-bottom: 1.5rem; }

.page-why .doc-section { margin-bottom: 4rem; }

.page-why .doc-section h2 {
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  padding-top: 0;
  border-top: none;
  border-bottom: 1px solid var(--rule);
}

.page-why .doc-section p { font-size: 1.05rem; line-height: 1.9; margin-bottom: 1.5rem; color: var(--ink); }
.page-why .doc-section p:last-child { margin-bottom: 0; }

.page-why .licence-note { margin-top: 3rem; font-size: 0.65rem; letter-spacing: 0.05em; }

.closing {
  margin-top: 5rem;
  padding: 3rem;
  background: var(--ink);
  color: var(--paper);
  text-align: center;
}

.closing p {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-style: italic;
  line-height: 2;
  color: var(--paper) !important;
}

.closing p span { display: block; }
.closing p span:nth-child(2) { color: var(--accent); }

/* === ABOUT PAGE ============================================================ */
.page {
  padding: 10rem 2.5rem 7rem;
  max-width: 780px;
  margin: 0 auto;
}

.page-about h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.about-section { margin-bottom: 4rem; }

.about-section h2 {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.about-section p { font-size: 1rem; line-height: 1.9; margin-bottom: 1.2rem; color: var(--ink); }
.about-section p:last-child { margin-bottom: 0; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--rule);
  margin-top: 2rem;
}

.page-about .meta-item {
  padding: 1.2rem 1.5rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.page-about .meta-item:nth-child(2n) { border-right: none; }
.page-about .meta-item:nth-last-child(-n+2) { border-bottom: none; }

.page-about .meta-label {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--mid);
  margin-bottom: 0.4rem;
}

.page-about .meta-value { font-size: 0.9rem; color: var(--ink); }
.page-about .meta-value a { color: var(--accent); text-decoration: none; }

.ai-note {
  border: 1px solid var(--rule);
  padding: 2rem;
  margin-top: 1.5rem;
  background: rgba(0,0,0,0.02);
}

.ai-note p { font-size: 0.9rem; color: var(--mid); line-height: 1.8; margin-bottom: 0.8rem; }
.ai-note p:last-child { margin-bottom: 0; }
.ai-note p strong { color: var(--ink); font-weight: 500; }

.contact-block { margin-top: 1.5rem; padding: 1.5rem; border: 1px solid var(--rule); }
.contact-block p { font-size: 0.9rem; color: var(--mid); margin-bottom: 0.5rem; }
.contact-block a { color: var(--accent); text-decoration: none; font-family: var(--mono); font-size: 0.85rem; }

/* === HOME PAGE ============================================================= */
.page-home h1 {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  line-height: 1.1;
  font-weight: 400;
  margin-bottom: 2rem;
}

h1 em { font-style: italic; color: var(--accent); }

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 80px;
  border-bottom: 1px solid var(--rule);
}

.hero-left {
  padding: 2rem 2.5rem;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.hero-body { font-size: 1.05rem; color: var(--mid); max-width: 560px; margin-bottom: 3rem; line-height: 1.8; text-align: left; }
.hero-body p + p { margin-top: 1rem; }

.cta-group { display: flex; gap: 1rem; flex-wrap: wrap; }

.btn-primary, .btn-secondary {
  border-radius: 0.5rem;
  display: inline-block;
  padding: 0.85rem 2rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  transition: background 0.2s, border-color 0.2s;
}

.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-secondary {
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}

.btn-secondary:hover { background: var(--ink); color: var(--paper); }

/* Stat strip — 3 horizontal panels below hero */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--rule);
}

.stat-block {
  padding: 3rem 2.5rem;
  border-right: 1px solid var(--rule);
  text-align: center;
}
.stat-block:last-child { border-right: none; }

.stat-number { font-family: var(--serif); font-size: 3.5rem; line-height: 1; color: var(--accent); margin-bottom: 0.5rem; font-weight: 400; }

.stat-label {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--mid);
  margin-bottom: 0.75rem;
}

.stat-desc { font-size: 0.9rem; color: var(--mid); line-height: 1.6; }

.tagline-band { background: var(--ink); color: var(--paper); padding: 3rem 2.5rem; text-align: center; }

.tagline-band p {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.tagline-band span { display: inline-block; padding: 0 1.5rem; color: var(--accent); }

.principles { padding: 7rem 2.5rem; max-width: 1100px; margin: 0 auto; }

.section-header {
  display: flex; align-items: baseline; gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.section-number {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.section-title { font-family: var(--serif); font-size: 2.2rem; font-weight: 400; }

.principles-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }

.principle { padding: 2.5rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.principle:nth-child(3n) { border-right: none; }
.principle:nth-child(4), .principle:nth-child(5), .principle:nth-child(6) { border-bottom: none; }

.principle-num {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.principle h3 { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; margin-bottom: 0.75rem; line-height: 1.3; }
.principle p { font-size: 0.9rem; color: var(--mid); line-height: 1.7; }

.documents { background: var(--ink); color: var(--paper); padding: 7rem 2.5rem; }
.documents-inner { max-width: 1100px; margin: 0 auto; }
.documents .section-header { border-bottom-color: #2a2a2a; }
.documents .section-title { color: var(--paper); }
.documents .section-number { color: var(--accent); }

.docs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }

.doc-card {
  padding: 2.5rem;
  border-right: 1px solid #2a2a2a;
  display: flex; flex-direction: column;
  text-decoration: none;
  color: var(--paper);
  transition: background 0.2s;
}

.doc-card:last-child { border-right: none; }
.doc-card:hover { background: #1a1a1a; }

.doc-card .doc-type { font-size: 0.65rem; margin-bottom: 1.5rem; }

.doc-card h3 { font-family: var(--serif); font-size: 1.6rem; font-weight: 400; margin-bottom: 1rem; line-height: 1.2; }
.doc-card p { font-size: 0.88rem; color: #999; line-height: 1.7; flex: 1; }

.doc-link { margin-top: 2rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--accent); }
.doc-link::after { content: ' →'; }

.about {
  padding: 7rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6rem;
  align-items: start;
}

.about h2 { font-family: var(--serif); font-size: 2.2rem; font-weight: 400; margin-bottom: 1.5rem; line-height: 1.2; }
.about p { font-size: 0.95rem; color: var(--mid); line-height: 1.8; margin-bottom: 1rem; }

.about-meta { padding: 2.5rem; border: 1px solid var(--rule); }

.page-home .meta-item {
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: baseline;
}

.page-home .meta-item:last-child { border-bottom: none; }

.page-home .meta-label {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--mid);
}

.page-home .meta-value { font-family: var(--mono); font-size: 0.75rem; color: var(--ink); text-align: right; overflow-wrap: break-word; word-break: break-all; }
.page-home .meta-value a { color: var(--accent); text-decoration: none; }

/* Hero load animations */
.hero-left > * { animation: fadeUp 0.7s ease forwards; opacity: 0; }
.eyebrow { animation-delay: 0.1s; }
.page-home h1 { animation-delay: 0.25s; }
.hero-body { animation-delay: 0.4s; }
.cta-group { animation-delay: 0.55s; }

/* === SCROLL-DRIVEN ANIMATIONS ============================================== */
@supports (animation-timeline: view()) {
  .stat-block,
  .principle,
  .doc-card,
  .phase-block,
  .principle-block,
  .doc-section {
    animation: fadeUp 1s linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }

  @keyframes header-border-in {
    from { border-color: transparent; }
    to   { border-color: var(--rule); }
  }

  header {
    animation: header-border-in linear both;
    animation-timeline: scroll(root);
    animation-range: 0px 80px;
  }
}

/* === PROPOSAL PAGE ========================================================= */
.page-proposal h1, .page-spec h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.page-proposal .doc-subtitle { margin-bottom: 1.5rem; }

.principle-block {
  padding: 1.5rem;
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  background: var(--accent-tint);
}

.principle-block p { font-style: italic; font-size: 1rem; margin: 0; }

.phase-block { border: 1px solid var(--rule); padding: 1.5rem; margin: 1.5rem 0; }
.phase-label { text-transform: uppercase; font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.15em; color: var(--accent); margin-bottom: 0.5rem; }
.phase-block h4 { font-family: var(--serif); font-size: 1.2rem; font-weight: 400; margin-bottom: 1rem; }

.closing-band { background: var(--ink); color: var(--paper); padding: 3rem; text-align: center; margin-top: 4rem; }
.closing-band p { font-family: var(--serif); font-size: 1.5rem; font-style: italic; line-height: 2; }
.closing-band span { display: block; }
.closing-band span:nth-child(2) { color: var(--accent); }

/* === SPECIFICATION PAGE ==================================================== */
.version-badge {
  text-transform: uppercase;
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  background: var(--accent);
  color: white;
  padding: 0.2rem 0.6rem;
  margin-bottom: 1.5rem;
}

.endpoint-block { border: 1px solid var(--rule); margin: 1.5rem 0; }

.endpoint-header {
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  border-bottom: 1px solid var(--rule);
  background: rgba(0,0,0,0.02);
}

.method {
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
}

.method.post { background: var(--accent); color: white; }
.method.get { background: #2563eb; color: white; }
.endpoint-path { font-family: var(--mono); font-size: 0.85rem; color: var(--ink); }
.endpoint-desc { padding: 1rem 1.25rem; font-size: 0.88rem; color: var(--mid); border-bottom: 1px solid var(--rule); }
.endpoint-auth { padding: 0.6rem 1.25rem; font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.08em; color: var(--mid); border-bottom: 1px solid var(--rule); }
.endpoint-auth span { color: var(--accent); }

pre {
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 1.25rem;
  overflow-x: auto;
  max-width: 100%;
  margin: 0;
}

.pre-label {
  text-transform: uppercase;
  padding: 0.4rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--mid);
  background: rgba(0,0,0,0.03);
  border-bottom: 1px solid var(--rule);
}

.code-inline { font-family: var(--mono); font-size: 0.82em; background: rgba(0,0,0,0.06); padding: 0.1em 0.35em; color: var(--accent); overflow-wrap: break-word; word-break: break-all; }

.status-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.88rem; }
.status-table th { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; color: var(--mid); text-align: left; padding: 0.6rem 1rem; border-bottom: 2px solid var(--rule); }
.status-table td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.status-table td:first-child { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); white-space: nowrap; }

.note-block { border-left: 3px solid var(--accent); padding: 1rem 1.25rem; margin: 1.5rem 0; background: var(--accent-tint); font-size: 0.9rem; }
.note-block strong { font-weight: 500; }

/* === RESPONSIVE ============================================================ */

/* --- Tablet: 768px -------------------------------------------------------- */
@media (max-width: 900px) {

  /* Header */
  header { padding: 1rem 1.5rem; }
  nav a { font-size: 0.9rem; letter-spacing: 0.04em; }

  /* Sidebar layouts */
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 3rem 1.5rem 5rem; min-width: 0; }

  /* Home — hero */
  .hero { min-height: auto; }
  .hero-left { padding: 2rem 1.5rem; align-items: flex-start; text-align: left; }
  .hero-body { max-width: 100%; }
  .cta-group { flex-direction: column; align-items: flex-start; }

  /* Home — stat strip */
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-block:nth-child(2) { border-right: none; }
  .stat-block:nth-child(1), .stat-block:nth-child(2) { border-bottom: 1px solid var(--rule); }

  /* Home — principles */
  .principles { padding: 4rem 1.5rem; }
  .principles-grid { grid-template-columns: 1fr 1fr; }
  .principle:nth-child(2n) { border-right: none !important; }
  .principle:nth-child(5), .principle:nth-child(6) { border-bottom: none; }
  .principle:nth-child(1), .principle:nth-child(2),
  .principle:nth-child(3), .principle:nth-child(4) { border-bottom: 1px solid var(--rule); }

  /* Home — documents */
  .documents { padding: 4rem 1.5rem; }
  .docs-grid { grid-template-columns: 1fr 1fr; }
  .docs-grid .doc-card:last-child { border-right: none; grid-column: 1 / -1; border-top: 1px solid #2a2a2a; }

  /* Home — about strip */
  .about { grid-template-columns: 1fr; gap: 2.5rem; padding: 4rem 1.5rem; }

  /* Tagline band */
  .tagline-band { padding: 2rem 1.5rem; }
  .tagline-band span { display: block; padding: 0; }

  /* Why / doc pages */
  .doc-hero { padding: 7rem 1.5rem 3rem; }
  .doc-body { padding: 3rem 1.5rem 5rem; }

  /* About page */
  .page { padding: 7rem 1.5rem 5rem; }
}

/* --- Mobile: 600px -------------------------------------------------------- */
@media (max-width: 600px) {

  /* Header — burger menu */
  header { padding: 0.9rem 1.25rem; }
  .nav-burger { display: flex; flex-shrink: 0; position: relative; z-index: 101; }

  /* Full-screen nav overlay */
  nav {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--paper);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
  }

  /* Nav links — hidden by default, ready to animate in */
  nav a {
    font-family: var(--sans);
    font-size: 2.2rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    padding: 0.75rem 2rem;
    border-bottom: none;
    color: var(--ink);
    opacity: 0;
    transform: translateY(20px);
    transition: color 0.2s;
  }
  nav a:hover, nav a.active { color: var(--accent); }

  /* Open state */
  .nav-toggle:checked ~ nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Staggered link animations on open */
  .nav-toggle:checked ~ nav a:nth-child(1) { animation: fadeUp 0.4s ease forwards 0.15s; }
  .nav-toggle:checked ~ nav a:nth-child(2) { animation: fadeUp 0.4s ease forwards 0.25s; }
  .nav-toggle:checked ~ nav a:nth-child(3) { animation: fadeUp 0.4s ease forwards 0.35s; }
  .nav-toggle:checked ~ nav a:nth-child(4) { animation: fadeUp 0.4s ease forwards 0.45s; }

  /* Home — hero */
  .hero-left { padding: 1.5rem 1.25rem; align-items: center; text-align: center; }
  .hero-body { text-align: center; }
  .page-home h1 { font-size: clamp(2.8rem, 11vw, 3.6rem); }

  /* Home — stat strip: single column */
  .stat-strip { grid-template-columns: 1fr; }
  .stat-block { border-right: none !important; border-bottom: 1px solid var(--rule); }
  .stat-block:last-child { border-bottom: none; }

  /* Home — principles: single column */
  .principles { padding: 3rem 1.25rem; }
  .principles-grid { grid-template-columns: 1fr; }
  .principle { border-right: none !important; border-bottom: 1px solid var(--rule); }
  .principle:last-child { border-bottom: none; }

  /* Home — documents: single column */
  .documents { padding: 3rem 1.25rem; }
  .docs-grid { grid-template-columns: 1fr; }
  .doc-card { border-right: none !important; border-top: 1px solid #2a2a2a; }
  .docs-grid .doc-card:first-child { border-top: none; }
  .docs-grid .doc-card:last-child { grid-column: auto; }

  /* Home — about strip */
  .about { padding: 3rem 1.25rem; }

  /* About page meta grid */
  .page { padding: 7rem 1.25rem 4rem; }
  .meta-grid { grid-template-columns: 1fr; }
  .page-about .meta-item { border-right: none !important; }
  .page-about .meta-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .page-about .meta-item:last-child { border-bottom: none; }

  /* Scrollable tables and code blocks */
  .status-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  pre { font-size: 0.72rem; }

  /* Proposal / spec pages */
  .layout { padding-top: 48px; }
  .content { padding: 2.5rem 1.25rem 4rem; min-width: 0; }
  .phase-block, .principle-block, .note-block { padding: 1rem; }
  .endpoint-header { flex-wrap: wrap; }

  /* Closing bands */
  .closing-band { padding: 2rem 1.25rem; }
  .closing { padding: 2rem 1.25rem; }

  /* Buttons full-width on very small screens */
  .btn-primary, .btn-secondary { width: 100%; text-align: center; }

  /* Center all text on mobile */
  body { text-align: center; }
  .cta-group { justify-content: center; align-items: center; }
  /* Keep left-aligned where centering looks wrong */
  pre, .status-table, .licence-note,
  .note-block, .principle-block, .phase-block,
  .endpoint-block, .endpoint-desc, .endpoint-auth,
  .doc-section p, .page-why .doc-section p,
  .about-section p, .about p, footer,
  ul, ol, li { text-align: left; }
}

/* === REDUCED MOTION ======================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  /* Disable scroll-driven animations entirely */
  .stat-block,
  .principle,
  .doc-card,
  .phase-block,
  .principle-block,
  .doc-section {
    animation: none !important;
  }
}
