/* ── Castellan — castellan.nz ─────────────────────────────────────────
   The identity is committed: navy, ink, amber. One look, no themes.
   Wordmark = tracked heavy caps + the amber trace (flat → QRS → T → flat,
   no P) — geometry locked 3 Sep 2026, same path as brand/kit. */

:root {
  /* ground lifted from #0C1220 (read as black) toward legible navy — 4 Sep */
  --bg: #0F1D38;
  --bg-deep: #0A142B;
  --panel: #152645;
  --panel-2: #1B2F55;
  --ink: #E9EEF6;
  --muted: #8B98AC;
  --line: rgba(233, 238, 246, 0.10);
  --line-strong: rgba(233, 238, 246, 0.22);
  --amber: #FFC85C;
  --amber-dim: rgba(255, 200, 92, 0.13);
  --navy-brand: #16335B;
  --max: 1120px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

* { margin: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  background: var(--bg); color: var(--ink);
  font: 16.5px/1.68 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* the lockup trace deliberately overhangs its box; it must never scroll the page */
}
img, svg { max-width: 100%; }
a { color: inherit; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ── The lockup: word + trace, one object ── */
.lockup { position: relative; display: inline-block; line-height: 1; }
.lockup-word {
  display: block; font-size: var(--lw, 22px); font-weight: 800;
  letter-spacing: .22em; text-transform: uppercase; white-space: nowrap;
  margin-right: calc(var(--lw, 22px) * -0.22); color: var(--ink);
}
.lockup-trace {
  /* anchor to the WORD's bottom (1em at line-height 1), NOT the container
     bottom — the ::after spacer made top:100% sit 0.5em too low, which is
     what every "why is the gap huge" round tonight was actually fighting */
  position: absolute; left: 0; top: var(--lw, 22px); width: 128%; max-width: none;
  height: calc(var(--lw, 22px) * 1.15);
  /* trace-to-word gap, LOCKED to Brendan's ruling on the original kit
     render: line-centre 0.198em below the baseline. In this formula:
     gap ≈ (1.0961 + value) em, DOM-verified via the baseline probe. */
  margin-top: calc(var(--lw, 22px) * -0.825);
  display: block; overflow: visible; pointer-events: none;
}
.lockup-trace path {
  stroke: var(--amber); fill: none;
  stroke-width: max(2px, calc(var(--lw, 22px) * 0.075));
  stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
/* room for the trace below the word */
.lockup::after { content: ''; display: block; height: calc(var(--lw, 22px) * 0.5); }

/* Hero trace writes itself in like an ECG pen: a reveal edge sweeps
   left→right at CONSTANT speed (paper doesn't decelerate — the brief:
   "start on the left and go all the way through, no clunkiness").
   clip-path, not stroke dashes: Chrome's dash handling on
   non-scaling strokes is viewport-dependent and left the tail covered.
   Base state carries no clip, so the resting logo is always complete;
   `backwards` keeps it hidden through the delay. */
.hero .lockup-trace path {
  animation: trace-in 1.9s linear .2s backwards;
}
@keyframes trace-in {
  from { clip-path: inset(-30% 102% -30% 0); }
  to   { clip-path: inset(-30% -3% -30% 0); }
}
/* any lockup can carry the pen sweep with the .sweep class */
.lockup.sweep { display: inline-block; }
.lockup.sweep .lockup-trace path { animation: trace-in 1.9s linear .3s backwards; }
@media (prefers-reduced-motion: reduce) {
  .hero .lockup-trace path, .lockup.sweep .lockup-trace path { animation: none; }
}

/* ── Opening splash (index only) ── */
#splash {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: grid; place-content: center;
}
#splash.off { display: none; }
#splash .lockup { --lw: clamp(30px, 9vw, 96px); will-change: transform; }
#splash .lockup-trace path { animation: trace-in 1.9s linear .35s backwards; }
body.splashing { overflow: hidden; }
/* the hero logo sits complete beneath the veil, so the glide lands on
   an identical twin and the crossfade is invisible */
body.splashing .hero .lockup-trace path { animation: none; }

/* ── Nav ── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15, 29, 56, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-in {
  max-width: var(--max); margin: 0 auto; padding: 15px 24px 10px;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.nav-brand { display: flex; align-items: center; gap: 13px; text-decoration: none; margin-right: auto; }
.nav-brand svg.shield { width: 26px; height: 26px; flex: none; }
.nav-links { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.nav-links a {
  text-decoration: none; font-size: 13.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 4px 0;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current] { color: var(--amber); }

/* ── Hero ── */
.hero { padding: clamp(64px, 11vh, 130px) 0 clamp(48px, 8vh, 90px); }
/* min sized so word + the trace's 28% overhang clears a 375px phone */
.hero .lockup { --lw: clamp(26px, 7.2vw, 82px); }
.hero h1 {
  margin-top: clamp(30px, 5vh, 54px);
  font-size: clamp(38px, 6.4vw, 68px); font-weight: 900;
  letter-spacing: -0.022em; line-height: 1.06;
}
.hero .sub {
  margin-top: 22px; max-width: 38em;
  font-size: clamp(17px, 2.4vw, 20px); color: var(--muted);
}
.cta-row { display: flex; gap: 14px; margin-top: 38px; flex-wrap: wrap; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 800;
  font-size: 15px; letter-spacing: .02em; border-radius: 12px;
  padding: 14px 26px; transition: transform .14s ease, border-color .14s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-amber { background: var(--amber); color: #131A28; }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--amber); }

/* ── Sections ── */
section { padding: clamp(56px, 9vh, 104px) 0; }
.eyebrow {
  font-size: 12.5px; font-weight: 800; letter-spacing: .24em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 14px;
}
h2 { font-size: clamp(28px, 4.4vw, 44px); font-weight: 800; letter-spacing: -0.018em; line-height: 1.12; }
.lede { margin-top: 16px; color: var(--muted); max-width: 44em; font-size: 17.5px; }

/* pulse divider — flat lines flex to fill the page; the complex itself
   is fixed-size and uniform so the QRS never broadens */
.pulse { display: flex; align-items: flex-start; height: 42.5px; opacity: .9; }
.pulse-line { flex: 1; border-top: 2px solid var(--amber); margin-top: 29px; }
.pulse svg { flex: none; display: block; width: 73px; height: 42.5px; }
.pulse path {
  stroke: var(--amber); stroke-width: 2; fill: none;
  stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke;
}

/* ── Pillars ── */
.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 44px; }
.pillar {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 26px 30px; display: flex; flex-direction: column; gap: 14px;
  transition: border-color .16s ease, transform .16s ease;
}
.pillar:hover { border-color: rgba(255, 200, 92, .45); transform: translateY(-3px); }
.pillar .imp { margin: -4px -6px 6px; }
.pillar .who { font-size: 11.5px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.pillar h3 { font-size: 24px; font-weight: 800; letter-spacing: .02em; }
.pillar h3 .dot { color: var(--amber); }
.pillar .role { font-weight: 700; color: var(--amber); font-size: 14px; letter-spacing: .04em; margin-top: -6px; }
.pillar p { color: var(--muted); font-size: 15.5px; }

/* product impressions — abstract on purpose; silhouettes, not screenshots */
.imp svg { display: block; width: 100%; height: auto; }
.imp .f-frame { fill: var(--bg-deep); stroke: var(--line-strong); stroke-width: 1.5; }
.imp .f-panel { fill: var(--panel-2); }
.imp .f-bar { fill: rgba(233, 238, 246, .16); }
.imp .f-dim { fill: rgba(233, 238, 246, .07); }
.imp .f-amber { fill: var(--amber); }
.imp .f-amberdim { fill: var(--amber-dim); }
.imp .s-amber { stroke: var(--amber); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.imp .s-line { stroke: var(--line-strong); fill: none; }

/* ── Capability grid ── */
.caps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 44px; }
.cap {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px;
}
.cap .k {
  display: flex; align-items: center; gap: 11px;
  font-size: 16.5px; font-weight: 800; letter-spacing: .01em;
}
.cap .k svg { width: 21px; height: 21px; flex: none; }
.cap .k .ico { stroke: var(--amber); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cap p { margin-top: 10px; color: var(--muted); font-size: 14.8px; }

/* ── Principles band ── */
.principles { background: var(--bg-deep); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(28px, 5vw, 64px); margin-top: 46px; }
.rule .big {
  font-size: clamp(23px, 2.9vw, 30px); font-weight: 900; line-height: 1.15;
  letter-spacing: -0.015em;
}
.rule .big em { font-style: normal; color: var(--amber); }
.rule p { margin-top: 12px; color: var(--muted); font-size: 15px; }

/* ── Founder band ── */
.founder { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(30px, 6vw, 80px); align-items: center; }
.founder blockquote {
  font-size: clamp(20px, 2.8vw, 27px); font-weight: 700; line-height: 1.4;
  letter-spacing: -0.01em;
}
.founder blockquote .amber { color: var(--amber); }
.founder .att { margin-top: 18px; color: var(--muted); font-size: 15px; }
.founder .att b { color: var(--ink); }

/* shield watermark */
.shield-wm { position: relative; overflow: hidden; }
.shield-wm .wm {
  position: absolute; right: -60px; bottom: -80px; width: 380px; opacity: .05;
  pointer-events: none;
}

/* ── CTA band ── */
.cta-band { text-align: center; }
.cta-band h2 { font-size: clamp(30px, 5vw, 50px); }
.cta-band .lede { margin-left: auto; margin-right: auto; }
.cta-band .cta-row { justify-content: center; }

/* ── Long-form pages (platform / trust / about) ── */
.page-head { padding: clamp(52px, 9vh, 96px) 0 clamp(20px, 4vh, 40px); }
.prose { max-width: 46em; }
.prose p { margin-top: 16px; color: var(--muted); }
.prose p b, .prose li b { color: var(--ink); }
.prose h2 { margin-top: 54px; font-size: clamp(24px, 3.6vw, 34px); }
.prose h3 { margin-top: 34px; font-size: 19px; font-weight: 800; }
.prose ul { margin: 16px 0 0 1.2em; padding: 0; color: var(--muted); }
.prose li { margin-top: 9px; }
.prose .rule-line { color: var(--ink); font-weight: 800; }
.tag-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
/* metadata labels, deliberately NOT button-shaped — square corners, soft
   fill, no border: chips that looked clickable were lying */
.tag {
  font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  background: rgba(233, 238, 246, .06); color: var(--muted);
  border-radius: 6px; padding: 6px 12px;
}
.tag.amber { background: var(--amber-dim); color: var(--amber); }

/* dictionary line (About head) */
.dict-line {
  margin-top: 18px; font-size: clamp(17px, 2.4vw, 20px);
  color: var(--muted); max-width: 42em; font-style: italic;
}
.dict-line b { color: var(--ink); font-weight: 800; letter-spacing: .03em; font-style: normal; }
.dict-line i { color: var(--amber); }

/* product blocks on platform page */
.prod { display: grid; grid-template-columns: 1fr 340px; gap: clamp(28px, 5vw, 64px); align-items: start; margin-top: 56px; }
.prod .imp { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.prod h2 { margin-top: 0; }
.prod .who { font-size: 12px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--amber); margin-bottom: 10px; }

/* contact cards */
.mail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 40px; }
.mail {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 24px; text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.mail:hover { border-color: rgba(255, 200, 92, .5); transform: translateY(-2px); }
.mail .addr { font-weight: 800; font-size: 17px; color: var(--amber); }
.mail p { margin-top: 8px; color: var(--muted); font-size: 14.5px; }

/* ── Footer ── */
footer { background: var(--bg-deep); border-top: 1px solid var(--line); padding: 44px 0 54px; }
.foot { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.foot .brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
/* direct child only — the lockup's trace svg lives deeper and must not be caught */
.foot .brand > svg { width: 30px; height: 30px; }
.foot .cols { display: flex; gap: clamp(28px, 6vw, 70px); flex-wrap: wrap; }
.foot h4 { font-size: 12px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.foot a { display: block; color: var(--muted); text-decoration: none; font-size: 14.5px; padding: 3px 0; }
.foot a:hover { color: var(--ink); }
.foot-legal { margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .caps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 940px) {
  .pillars { grid-template-columns: 1fr 1fr; }
  .rules { grid-template-columns: 1fr; }
  .founder { grid-template-columns: 1fr; }
  .prod { grid-template-columns: 1fr; }
  .prod .imp { max-width: 420px; }
}
@media (max-width: 620px) {
  .pillars, .caps, .mail-grid { grid-template-columns: 1fr; }
  .nav-in { gap: 12px; padding: 13px 18px 9px; }
  .nav-links { gap: 15px; }
  .nav-links a { font-size: 12.5px; letter-spacing: .08em; }
}
