/* ------------------------------------------------------------------
   lagstyr — page styles. References tokens.css only (no colour literals).
------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.025em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
em { font-style: normal; color: var(--ink); }
strong { font-weight: 600; color: var(--ink); }

.shell { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* --- accessibility helpers --- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 50%; top: -60px; transform: translateX(-50%);
  background: var(--indigo); color: var(--void); padding: 10px 18px;
  border-radius: var(--radius-sm); font-weight: 600; z-index: 200; transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* --- shared bits --- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--indigo);
  margin: 0 0 var(--s-5);
}
.eyebrow .sep { color: var(--mist-2); margin-inline: 4px; }

.grad {
  background: linear-gradient(105deg, var(--indigo-bright), var(--indigo) 55%, var(--indigo-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ============================ BUTTONS ============================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  padding: 13px 22px; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn-primary { background: var(--indigo); color: #060810; }
.btn-primary:hover { background: var(--indigo-bright); transform: translateY(-2px); }
.btn-ghost { border-color: var(--spine-2); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--indigo); color: var(--indigo-bright); }
.btn-quiet { color: var(--mist); padding-inline: 6px; }
.btn-quiet:hover { color: var(--ink); }

/* ============================ NAV ============================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--void) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--spine); }
.nav-inner { display: flex; align-items: center; gap: var(--s-6); height: 66px; }

.wordmark {
  font-family: var(--font-display); font-weight: 600; font-size: 1.28rem;
  letter-spacing: -0.03em; color: var(--ink);
}
.wordmark .dot { color: var(--indigo); }
.nav-links { display: flex; gap: var(--s-6); margin-left: auto; }
.nav-links a {
  font-size: 0.92rem; color: var(--mist); position: relative; transition: color .2s var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-cta { padding: 9px 18px; }

/* ============================ HERO ============================ */
.hero { position: relative; padding: clamp(64px, 12vh, 132px) 0 var(--s-10); overflow: hidden; }
.hero-grid {
  position: absolute; inset: -1px 0 auto 0; height: 130%;
  background-image:
    linear-gradient(to right, var(--spine) 1px, transparent 1px),
    linear-gradient(to bottom, var(--spine) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(120% 80% at 72% 12%, #000 0%, transparent 68%);
          mask-image: radial-gradient(120% 80% at 72% 12%, #000 0%, transparent 68%);
  opacity: 0.38; pointer-events: none;
}
.hero-glow {
  position: absolute; top: -18%; right: -8%; width: 780px; height: 780px; max-width: 90vw;
  background: radial-gradient(circle at center, var(--indigo-glow), transparent 62%);
  pointer-events: none;
}
.hero-inner {
  position: relative; display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 72px); align-items: center;
}
.hero-copy { max-width: 40ch; }
.hero-title { font-size: var(--t-display); line-height: 1.02; font-weight: 700; margin-bottom: var(--s-5); }
.lead { font-size: var(--t-lead); color: var(--ink-dim); line-height: 1.55; max-width: 42ch; }
.hero-actions { display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-7); flex-wrap: wrap; }

/* ---- SIGNATURE: live governed action log ---- */
.log {
  background: linear-gradient(180deg, var(--substrate), var(--void-2));
  border: 1px solid var(--spine); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  font-family: var(--font-mono); font-size: var(--t-mono);
}
.log-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--spine);
  background: color-mix(in srgb, var(--substrate-2) 60%, transparent);
}
.log-title { color: var(--mist); letter-spacing: 0.04em; }
.log-title .log-dot { color: var(--indigo); margin-inline: 3px; }
.log-status { display: inline-flex; align-items: center; gap: 7px; color: var(--tier-read); letter-spacing: 0.05em; }
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--tier-read);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--tier-read) 70%, transparent);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tier-read) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.log-body {
  padding: 6px 0; height: 288px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 42px);
          mask-image: linear-gradient(to bottom, transparent, #000 42px);
}
.log-line {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center;
  gap: 10px; padding: 7px 16px; white-space: nowrap;
  border-left: 2px solid transparent;
}
.log-line.enter { animation: logIn .5s var(--ease-out) both; }
@keyframes logIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.log-id { color: var(--indigo); }
.log-actor { color: var(--ink-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.log-msg { color: var(--mist); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.log-line .log-tier {
  font-size: 0.66rem; letter-spacing: 0.05em; padding: 2px 8px; border-radius: var(--radius-pill);
  border: 1px solid currentColor;
}
.log-legend {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--spine); background: color-mix(in srgb, var(--substrate-2) 40%, transparent);
}

/* risk-tier chips (shared) */
.tier {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid currentColor;
  display: inline-block; white-space: nowrap;
}
.tier-read { color: var(--tier-read); }
.tier-safe { color: var(--tier-safe); }
.tier-governed { color: var(--tier-governed); }
.tier-kernel { color: var(--tier-kernel); }
.log-line.t-read { border-left-color: var(--tier-read); }
.log-line.t-safe { border-left-color: var(--tier-safe); }
.log-line.t-governed { border-left-color: var(--tier-governed); }
.log-line.t-kernel { border-left-color: var(--tier-kernel); }

/* ============================ BANDS ============================ */
.band { padding: clamp(72px, 11vh, 132px) 0; position: relative; }
.band-alt { background: var(--void-2); border-block: 1px solid var(--spine); }

.section-head { max-width: 46ch; margin-bottom: var(--s-8); }
.section-title { font-size: var(--t-h2); line-height: 1.08; }
.section-lead { font-size: var(--t-lead); color: var(--ink-dim); margin-top: var(--s-5); max-width: 54ch; }

/* --- problem split --- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.card {
  background: var(--substrate); border: 1px solid var(--spine); border-radius: var(--radius);
  padding: var(--s-7); transition: border-color .25s var(--ease), transform .25s var(--ease);
}
.card:hover { border-color: var(--spine-2); transform: translateY(-3px); }
.card-tag {
  font-family: var(--font-mono); font-size: var(--t-mono); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--mist-2); margin-bottom: var(--s-4);
}
.card h3 { font-size: var(--t-h3); margin-bottom: var(--s-3); }
.card p:last-child { color: var(--ink-dim); }
.band-note {
  margin-top: var(--s-7); font-size: var(--t-lead); color: var(--mist);
  max-width: 60ch;
}
.band-note strong { color: var(--indigo-bright); }

/* --- tenets --- */
.tenets { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--spine); border: 1px solid var(--spine); border-radius: var(--radius); overflow: hidden; }
.tenet { background: var(--void); padding: var(--s-7); }
.band-alt .tenet { background: var(--void-2); }
.tenet-key {
  font-family: var(--font-mono); font-size: 0.82rem; letter-spacing: 0.02em;
  color: var(--indigo); display: block; margin-bottom: var(--s-3);
}
.tenet p { color: var(--ink-dim); font-size: 1rem; }

/* --- governed loop --- */
.loop { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: var(--s-4); margin-bottom: var(--s-8); }
.loop-step {
  background: var(--substrate); border: 1px solid var(--spine); border-radius: var(--radius);
  padding: var(--s-6);
}
.loop-n {
  font-family: var(--font-mono); font-size: 0.9rem; color: var(--indigo);
  letter-spacing: 0.04em; display: block; margin-bottom: var(--s-3);
}
.loop-step p { color: var(--ink-dim); font-size: 0.98rem; }
.loop-arrow { align-self: center; color: var(--mist-2); font-size: 1.4rem; font-family: var(--font-mono); }

/* --- risk tiers list --- */
.tiers { display: grid; gap: 1px; background: var(--spine); border: 1px solid var(--spine); border-radius: var(--radius); overflow: hidden; }
.tier-row { display: grid; grid-template-columns: 160px 1fr; gap: var(--s-5); align-items: center; padding: var(--s-5) var(--s-6); background: var(--void); }
.band .tier-row { background: var(--void); }
.tier-row p { color: var(--ink-dim); font-size: 1rem; }

.pull {
  margin-top: var(--s-8); font-family: var(--font-display); font-weight: 500;
  font-size: var(--t-h3); line-height: 1.4; color: var(--ink); max-width: 44ch;
  letter-spacing: -0.01em;
}
.pull strong { color: var(--indigo-bright); }

/* --- byoc facts --- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.fact {
  background: var(--substrate); border: 1px solid var(--spine); border-radius: var(--radius);
  padding: var(--s-6); position: relative; overflow: hidden;
}
.fact::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--indigo), transparent);
}
.fact-lead { font-family: var(--font-display); font-weight: 600; font-size: 1.22rem; letter-spacing: -0.02em; margin-bottom: var(--s-3); }
.fact-sub { color: var(--ink-dim); font-size: 0.98rem; }

/* ============================ SIGNUP ============================ */
.signup { position: relative; padding: clamp(88px, 14vh, 152px) 0; text-align: center; overflow: hidden; border-top: 1px solid var(--spine); }
.signup-glow {
  position: absolute; inset: auto 0 -40% 0; height: 620px; margin-inline: auto; width: 900px; max-width: 100%;
  background: radial-gradient(circle at 50% 90%, var(--indigo-glow), transparent 60%);
  pointer-events: none;
}
.signup-inner { position: relative; max-width: 660px; }
.signup .eyebrow { display: block; }
.signup-title { font-size: var(--t-h2); line-height: 1.1; margin-bottom: var(--s-5); }
.signup-lead { color: var(--ink-dim); font-size: var(--t-lead); margin-bottom: var(--s-7); }

#subscribe-form { max-width: 520px; margin-inline: auto; }
.field-row {
  display: flex; gap: var(--s-3); background: var(--substrate-2);
  border: 1px solid var(--spine-2); border-radius: var(--radius-pill);
  padding: 6px 6px 6px 8px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field-row:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 4px var(--indigo-glow); }
#subscribe-form input[type=email] {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: none;
  color: var(--ink); font-family: var(--font-body); font-size: 1rem; padding: 12px 12px;
}
#subscribe-form input[type=email]::placeholder { color: var(--mist-2); }
#subscribe-form .btn-primary { flex-shrink: 0; }
.field-row[hidden] { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note { min-height: 1.4em; margin-top: var(--s-4); font-size: 0.95rem; color: var(--mist); }
.form-note.is-error { color: var(--danger); }
.form-note.is-success { color: var(--ok); }

/* ============================ FOOTER ============================ */
.foot { border-top: 1px solid var(--spine); padding: var(--s-7) 0; }
.foot-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s-5); flex-wrap: wrap; }
.wordmark-sm { font-size: 1.1rem; }
.foot-note { color: var(--mist-2); font-size: var(--t-small); max-width: 52ch; }

/* ============================ REVEAL ============================ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ============================ RESPONSIVE ============================ */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-copy { max-width: 100%; }
  .log { max-width: 520px; }
  .loop { grid-template-columns: 1fr; }
  .loop-arrow { transform: rotate(90deg); justify-self: start; }
  .facts { grid-template-columns: 1fr; }
  .tenets { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .nav-links { display: none; }
  .split { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; border-radius: var(--radius); padding: var(--s-3); }
  #subscribe-form .btn-primary { justify-content: center; }
  .tier-row { grid-template-columns: 1fr; gap: var(--s-2); }
  .hero-title br { display: none; }
}
