/* ============================================================================
   Sibyl, the protective coordination layer.
   v2 "night canopy" theme. Extends design/sibyl-design-system.md (earth-grounded)
   into the cosmos register read from Sibyl-images/0_0.png (the mind-tree mosaic).
   Six-colour schema: Night Indigo / Parchment / Sand Ochre / Slate / Oracle Gold
   / Starlight, on Midnight + Ink neutrals. House style: no em or en dashes.
   ========================================================================== */

:root {
  /* --- the six colours (read from 0_0.png) --- */
  --indigo:    #16223d;   /* 1. deep cosmos ground, the night sky */
  --parchment: #ede4cf;   /* 2. the lit face, marble light, default canvas */
  --sand:      #c9ae82;   /* 3. the mosaic facets, warm structure */
  --slate:     #5e6b7c;   /* 4. the tree, the connective network */
  --gold:      #a8842f;   /* 5. light caught on a facet, the one CTA */
  --starlight: #f4f1e9;   /* 6. star points, light on the night */

  /* tonal neutrals (shades of the six, not new hues) */
  --midnight:   #0d1525;  /* deepest shadow, footer */
  --indigo-2:   #1d2c4a;  /* raised panels on night */
  --slate-deep: #394454;  /* slate band that stays AA with starlight */
  --sand-deep:  #b08a52;  /* deeper facet, dividers */
  --gold-bright:#c39a3a;  /* gold on dark, hover */
  --ink:        #14110d;  /* text on light */
  --muted:      #6b6456;  /* captions on light */
  --muted-dark: #9aa6b6;  /* captions on night */
  --hairline:   #d8cfba;  /* hairline on light */
  --hairline-d: rgba(244,241,233,.14); /* hairline on night */

  --display: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --maxw: 74rem;
  --measure: 38rem;
  --pad: clamp(1.25rem, 5vw, 4rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
.narrow { max-width: 54rem; }
a { color: inherit; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--indigo); color: var(--starlight); padding: .75rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

/* ----------------------------------------------------------------- type --- */
.eyebrow {
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .24em; text-transform: uppercase; color: var(--sand);
  margin: 0 0 1.25rem; display: flex; align-items: center; gap: .7rem;
}
.eyebrow::before {
  content: ""; width: 1.6rem; height: 1px; background: currentColor; opacity: .7;
}
.eyebrow-dark { color: var(--sand-deep); }

h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.6rem, 6.4vw, 5rem); line-height: 1.02;
  letter-spacing: -.012em; margin: 0 0 1.5rem;
}
h2 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.1;
  letter-spacing: -.006em; margin: 0 0 1.5rem; max-width: 24ch;
}
h3 { font-family: var(--display); font-weight: 600; font-size: 1.55rem; line-height: 1.2; margin: .25rem 0 .5rem; }
.section-no {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .2em;
  color: var(--slate); text-transform: uppercase;
}

.lede { font-size: clamp(1.08rem, 1.6vw, 1.3rem); color: var(--ink); opacity: .86; max-width: var(--measure); margin: 0 0 2rem; }
.prose p { max-width: var(--measure); }
.prose p + p { margin-top: 1.1rem; }
.pull {
  font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.28; letter-spacing: -.005em;
  max-width: 24ch; margin: 0;
}
.cite { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 1rem; }

/* --------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  font-family: var(--mono); font-size: .78rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  padding: .9rem 1.5rem; border-radius: 2px; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transition: background-color .25s ease, color .25s ease, border-color .25s ease, transform .2s ease;
}
.btn-gold { background: var(--gold); color: var(--midnight); border-color: var(--gold); }
.btn-gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn-quiet { color: var(--starlight); border-color: var(--hairline-d); }
.btn-quiet:hover { border-color: var(--starlight); }
.btn-ghost { color: var(--starlight); border-color: rgba(244,241,233,.28); padding: .6rem 1.1rem; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); }
@media (prefers-reduced-motion: no-preference) { .btn:active { transform: translateY(1px); } }

/* ------------------------------------------------------------------ nav --- */
.nav {
  position: absolute; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; gap: 1.4rem;
  max-width: var(--maxw); margin: 0 auto; padding: 1.4rem var(--pad);
}
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.5rem; color: var(--starlight); text-decoration: none; letter-spacing: .02em; }
.wordmark .sys { font-family: var(--mono); font-size: .58rem; font-weight: 500; letter-spacing: .34em; text-transform: uppercase; color: var(--sand); margin-left: .55rem; vertical-align: middle; }
.nav-links { display: flex; gap: 1.15rem; margin-left: auto; }
.nav-links a { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: rgba(244,241,233,.72); text-decoration: none; transition: color .2s ease; }
.nav-links a:hover { color: var(--starlight); }

/* ------------------------------------------------- texture: grain + facets --- */
.grain {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* faint triangulated facets, echoing the 0_0.png mosaic */
.facets {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='%23f4f1e9' stroke-opacity='0.05' stroke-width='1'%3E%3Cpath d='M0 0L80 60L0 130M80 60L160 20M80 60L120 160M80 60L20 160M80 60L160 110'/%3E%3C/g%3E%3C/svg%3E");
}

/* ----------------------------------------------------------------- hero --- */
.hero {
  position: relative; background: var(--indigo); color: var(--starlight);
  min-height: 94vh; min-height: 94dvh; display: flex; align-items: center;
  padding: 9rem var(--pad) 5rem; overflow: hidden;
}
.hero-grid {
  position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; width: 100%;
  display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center;
  grid-template-columns: 1fr;
}
@media (min-width: 940px) { .hero-grid { grid-template-columns: 1.05fr .95fr; } }
.hero .lede { color: rgba(244,241,233,.82); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; }
.hero-figure { position: relative; justify-self: center; }
.hero-figure img {
  display: block; width: min(34rem, 80vw); height: auto; border-radius: 3px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.7); border: 1px solid var(--hairline-d);
}
.hero-figure figcaption {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-dark); margin-top: 1rem; max-width: 30ch;
}
@media (max-width: 939px) { .hero-figure { display: none; } }

/* ---------------------------------------------------------------- bands --- */
.band { padding: clamp(4.5rem, 10vw, 8.5rem) 0; position: relative; overflow: hidden; }
.band-parchment { background: var(--parchment); color: var(--ink); }
.band-sand { background: linear-gradient(180deg, #efe7d3, #e6d8ba); color: var(--ink); }
.band-indigo { background: var(--indigo); color: var(--starlight); }
.band-slate { background: var(--slate-deep); color: var(--starlight); }
.band-midnight { background: var(--midnight); color: var(--starlight); }
.band-indigo .lede, .band-slate .lede, .band-midnight .lede { color: rgba(244,241,233,.82); }
.band-indigo h2, .band-slate h2, .band-midnight h2 { color: var(--starlight); }
.band + .band { border-top: 1px solid var(--hairline); }
.band-indigo + .band, .band + .band-indigo,
.band-slate + .band, .band + .band-slate,
.band-midnight + .band, .band + .band-midnight { border-top: none; }

.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem; }
.section-head .section-no { white-space: nowrap; }

/* the recurring forest line: a thin canopy rule */
.canopy { display: flex; align-items: center; gap: 1.1rem; margin: 0 0 2.5rem; font-family: var(--mono); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--slate); }
.canopy::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .35; }
.band-indigo .canopy, .band-slate .canopy, .band-midnight .canopy { color: var(--sand); }

/* ----------------------------------------------------- frame: questions --- */
.questions { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--hairline-d); border: 1px solid var(--hairline-d); }
@media (min-width: 760px) { .questions { grid-template-columns: repeat(2, 1fr); } }
.questions li { background: var(--indigo); padding: 1.6rem 1.5rem; }
.q-no { font-family: var(--mono); font-size: .7rem; letter-spacing: .18em; color: var(--gold-bright); }
.questions p { margin: .6rem 0 0; font-family: var(--display); font-size: 1.35rem; line-height: 1.25; color: var(--starlight); max-width: 26ch; }

/* ------------------------------------------------------- core: triad --- */
.triad { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 1.5rem; }
@media (min-width: 860px) { .triad { grid-template-columns: repeat(3, 1fr); } }
.triad li { border-top: 2px solid var(--gold); padding-top: 1.2rem; }
.triad .t-k { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--slate); }
.triad h3 { margin-top: .35rem; }
.triad p { color: var(--ink); opacity: .82; margin: .4rem 0 0; max-width: 34ch; }

/* --------------------------------------------- principals: observer note --- */
.observer { display: grid; gap: 2.5rem; align-items: start; }
@media (min-width: 880px) { .observer { grid-template-columns: 1.1fr .9fr; } }
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }
.principles li { display: flex; gap: .9rem; align-items: flex-start; font-size: 1.08rem; }
.principles .b-mark { flex: 0 0 auto; width: .6rem; height: .6rem; margin-top: .55rem; background: var(--gold); border-radius: 50%; box-shadow: 0 0 0 4px rgba(168,132,47,.16); }

/* -------------------------------------------------- society: ladder/forest --- */
.ladder { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 1px; background: var(--hairline-d); border: 1px solid var(--hairline-d); }
.ladder li { background: var(--slate-deep); display: grid; grid-template-columns: 8rem 1fr; gap: 1.25rem; padding: 1.5rem; align-items: baseline; }
@media (max-width: 620px) { .ladder li { grid-template-columns: 1fr; gap: .4rem; } }
.ladder .lvl { font-family: var(--mono); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--sand); }
.ladder .lvl small { display: block; color: var(--muted-dark); letter-spacing: .1em; margin-top: .3rem; }
.ladder p { margin: 0; color: rgba(244,241,233,.86); max-width: 52ch; }

/* ---------------------------------------------------- build: phases/rails --- */
.rail { list-style: none; margin: 2.5rem 0 0; padding: 0; position: relative; display: grid; gap: 0; }
.rail::before { content: ""; position: absolute; left: 7px; top: .4rem; bottom: .4rem; width: 2px; background: linear-gradient(180deg, var(--gold), var(--sand-deep)); opacity: .6; }
.rail li { position: relative; padding: 0 0 2rem 2.4rem; }
.rail li:last-child { padding-bottom: 0; }
.rail .dot { position: absolute; left: 0; top: .25rem; width: 16px; height: 16px; border-radius: 50%; background: var(--indigo); border: 2px solid var(--gold); }
.rail .ph { font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-bright); }
.rail h3 { margin: .3rem 0 .35rem; color: var(--starlight); }
.rail p { margin: 0; color: rgba(244,241,233,.8); max-width: 46ch; }

/* ----------------------------------------------- architecture: the stack --- */
.stack { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.stack li { background: var(--parchment); display: grid; grid-template-columns: 3rem 1fr; gap: 1.25rem; padding: 1.4rem 1.5rem; align-items: baseline; }
.stack .n { font-family: var(--display); font-style: italic; font-size: 1.7rem; color: var(--slate); }
.stack .s-k { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.stack p { margin: .35rem 0 0; color: var(--ink); opacity: .8; max-width: 60ch; }
.agents { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2.2rem; }
.agent-chip { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; padding: .45rem .8rem; border: 1px solid var(--hairline); border-radius: 2px; color: var(--ink); background: #f3ecdb; }
.agent-chip b { color: var(--gold); font-weight: 500; }

/* ------------------------------------------------------------- invocation --- */
.invocation { position: relative; background: var(--midnight); color: var(--starlight); padding: clamp(5rem, 12vw, 9rem) 0; overflow: hidden; }
.invocation .lede { color: rgba(244,241,233,.82); }
.invocation .ren { border-left: 2px solid var(--gold); padding-left: 1.4rem; margin: 0 0 2.5rem; }

/* ------------------------------------------------------------------ footer --- */
.footer { background: var(--indigo); color: var(--starlight); border-top: 1px solid var(--hairline-d); padding: 3rem 0 2.5rem; }
.footer-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.wordmark-sm { color: var(--starlight); font-size: 1.2rem; }
.foot-meta { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-dark); }
.footer .foot-line { margin-top: 1.5rem; font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; color: var(--muted-dark); max-width: 60ch; }

/* ------------------------------------------------------------- reveal motion --- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------------------------------------------- mobile nav toggle --- */
.nav-toggle {
  display: none; appearance: none; margin-left: auto;
  width: 44px; height: 44px; padding: 0; background: transparent;
  border: 1px solid var(--hairline-d); border-radius: 2px; color: var(--starlight);
  cursor: pointer; align-items: center; justify-content: center; transition: border-color .2s ease;
}
.nav-toggle:hover { border-color: var(--starlight); }
.nav-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
  display: block; position: relative; width: 22px; height: 2px; background: currentColor; border-radius: 2px;
}
.nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle .bars::before { top: -7px; }
.nav-toggle .bars::after  { top:  7px; }

/* Collapse the long nav into the hamburger BEFORE the crowded row (nav + 2 CTAs
   + language switch) can overflow and clip the switcher. Longer NL/DE labels
   need this to trigger well above phone width. */
@media (max-width: 1160px) {
  .nav { position: absolute; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: 100%; right: var(--pad); left: var(--pad);
    flex-direction: column; gap: 0; margin: .4rem 0 0; padding: .4rem 0;
    background: var(--indigo-2); border: 1px solid var(--hairline-d); border-radius: 3px;
    box-shadow: 0 18px 50px -22px rgba(0,0,0,.75); z-index: 20;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .9rem 1.2rem; border-bottom: 1px solid var(--hairline-d); }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a.active::after { display: none; }
  .nav .btn-ghost { padding: .8rem 1rem; }
}
/* Phones: drop the two secondary CTAs from the top bar so the wordmark, menu
   button and language switch always fit (the CTAs remain in the hero + menu). */
@media (max-width: 680px) {
  .nav .btn-ghost { display: none; }
}
@media (prefers-reduced-motion: reduce) { .nav-toggle { transition: none; } }

/* ======================================================= MULTI-PAGE === */
.nav-links a.active { color: var(--starlight); }
.nav-links a.active::after { content: ""; display: block; height: 1px; background: var(--gold); margin-top: .3rem; }

/* per-page hero: title + the page's own image */
.page-hero { position: relative; background: var(--indigo); color: var(--starlight); overflow: hidden; padding: 8.5rem var(--pad) 3.5rem; }
.page-hero .facets, .page-hero .grain { z-index: 1; }
.page-hero-grid { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .page-hero-grid { grid-template-columns: 1.1fr .9fr; } }
.page-hero .section-no { color: var(--sand); }
.page-hero h1 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); margin: .6rem 0 1.1rem; }
.page-hero .lede { color: rgba(244,241,233,.84); margin-bottom: 0; }
.page-figure { position: relative; justify-self: center; }
.page-figure img { display: block; width: min(28rem, 82vw); height: auto; border-radius: 3px; border: 1px solid var(--hairline-d); box-shadow: 0 26px 70px -28px rgba(0,0,0,.7); }
.page-figure figcaption { font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-dark); margin-top: .9rem; max-width: 32ch; }
@media (max-width: 899px) { .page-figure { display: none; } }

.page-body { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.page-body.alt { background: var(--cream, #f3ecdb); }

/* home hub: the six-section spine as cards */
.hub { list-style: none; margin: 3rem 0 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 680px) { .hub { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .hub { grid-template-columns: repeat(3, 1fr); } }
.hub-card { position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: #f3ecdb; border: 1px solid var(--hairline); border-radius: 3px; overflow: hidden; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.hub-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgba(20,17,13,.5); border-color: var(--sand-deep); }
.hub-card .thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--indigo); }
.hub-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hub-card .card-body { padding: 1.2rem 1.3rem 1.4rem; }
.hub-card .section-no { color: var(--slate); }
.hub-card h3 { margin: .35rem 0 .4rem; }
.hub-card p { margin: 0; color: var(--ink); opacity: .78; font-size: .96rem; max-width: 36ch; }
.hub-card .go { margin-top: .9rem; font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }

/* prev / next pager */
.pager { border-top: 1px solid var(--hairline); margin-top: 1rem; }
.pager-row { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0; flex-wrap: wrap; }
.pager a { text-decoration: none; font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); display: flex; flex-direction: column; gap: .25rem; }
.pager a small { color: var(--muted); letter-spacing: .14em; }
.pager a.next { text-align: right; margin-left: auto; }
.pager a:hover { color: var(--gold); }

/* ------------------------------------------------------ language switch --- */
.lang-switch { display: inline-flex; align-items: center; margin-left: .6rem;
  border: 1px solid rgba(244,241,233,.22); border-radius: 3px; overflow: hidden; }
.lang-switch .lang-opt {
  font-family: var(--mono); font-size: .7rem; font-weight: 500; line-height: 1;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  color: rgba(244,241,233,.75); padding: .4rem .6rem;
  transition: color .2s ease, background-color .2s ease;
}
.lang-switch .lang-opt + .lang-opt { border-left: 1px solid rgba(244,241,233,.18); }
.lang-switch .lang-opt:hover { color: var(--starlight); background: rgba(244,241,233,.06); }
.lang-switch .lang-opt.is-active { color: var(--midnight); background: var(--gold); }
@media (max-width: 720px) { .lang-switch { margin-left: auto; } }
