/* ════════════════════════════════════════════════════════════
   TOLTI LABS — identity: night-green ink, warm bone, ember light
   Display face: Trickster (Velvetyne, SIL OFL) — self-hosted
   ════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Trickster';
  src: url('../fonts/trickster-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink:        #0b0f09;
  --ink-panel:  #12170d;
  --bone:       #ede4ce;
  --bone-dim:   #9ba08c;
  --bone-faint: #6b705f;
  --ember:      #f2b64e;
  --ember-deep: #e2652a;
  --rule:       rgba(237, 228, 206, 0.09);

  --display: 'Trickster', 'Iowan Old Style', Georgia, serif;
  --body:    system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono:    ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --gutter: clamp(1.375rem, 5vw, 5rem);
  --sect-gap: clamp(6.5rem, 15vh, 11rem);
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

html {
  background: var(--ink);
}

body {
  /* one continuous surface, with a long imperceptible tonal drift so the
     page never reads as flat fill; grain above breaks any banding */
  background: linear-gradient(
    180deg,
    #0b0f09 0%,
    #0d120a 30%,
    #111606 52%,
    #0d110a 76%,
    #0b0f09 100%
  );
  color: var(--bone);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--ember); color: var(--ink); }

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

.mono { font-family: var(--mono); }

/* ── substrate layers: bg < grain < embers < content ─────────── */

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

main section,
.site-footer,
.site-nav { position: relative; z-index: 1; }

main section { padding-inline: var(--gutter); }

main section, .site-footer { scroll-margin-top: 4rem; }

/* ── nav ─────────────────────────────────────────────────────── */

.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem var(--gutter);
  transition: background-color 0.45s ease, border-color 0.45s ease;
  border-bottom: 1px solid transparent;
}

.site-nav.scrolled {
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
  border-bottom-color: var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--bone);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.brand-spark {
  color: var(--ember);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

.brand:hover .brand-spark { transform: rotate(40deg); }

.site-links { display: flex; gap: clamp(1.1rem, 2.5vw, 1.9rem); }

.site-links a {
  color: var(--bone-dim);
  text-decoration: none;
  font-size: 0.86rem;
  transition: color 0.25s ease;
}

.site-links a:hover { color: var(--bone); }

/* ── hero ────────────────────────────────────────────────────── */

.hero {
  min-height: 100svh;
  overflow: hidden;
  padding: 0 var(--gutter);
}

.hero .embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.hero-note,
.hero-tag,
.hero-scroll,
.hero-word { position: relative; z-index: 2; }

.hero-note {
  padding-top: clamp(5rem, 12vh, 8rem);
  color: var(--bone-dim);
  font-size: 0.95rem;
}

.hero-tag {
  position: absolute;
  right: var(--gutter);
  top: clamp(6.5rem, 21vh, 13.5rem);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.1rem, 4.6vw, 4.3rem);
  line-height: 1.06;
  letter-spacing: 0.002em;
  text-align: left;
}

.tag-rest { padding-left: clamp(1.6rem, 4vw, 3.4rem); }

.hero-scroll {
  position: absolute;
  right: var(--gutter);
  bottom: 2.2rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--bone-faint);
}

.hero-scroll .-down { color: var(--bone-dim); }

.hero-word {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 0;
  display: flex;
  align-items: baseline;
  gap: clamp(0.2rem, 2vw, 1.6rem);
  pointer-events: none;
}

.hero-wordmark {
  font-family: var(--display);
  font-size: clamp(4.5rem, 23.5vw, 30rem);
  line-height: 0.96;
  letter-spacing: -0.015em;
  display: inline-block;
  transform: translateY(0.055em);
  white-space: nowrap;
}

.hero-labs {
  font-family: var(--display);
  font-size: clamp(0.9rem, 2.6vw, 3.1rem);
  color: var(--bone-dim);
  letter-spacing: 0.14em;
  transform: translateY(-0.35em);
  display: inline-block;
  white-space: nowrap;
}

/* ── marginal notes (section side-markers) ───────────────────── */

.marginal {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--bone-faint);
  letter-spacing: 0.02em;
  grid-column: 1;
}

.manifesto, .principles, .catalogue, .field, .method {
  display: grid;
  grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding-top: var(--sect-gap);
}

.marginal { padding-top: 0.45em; }

/* ── 01 · manifesto ──────────────────────────────────────────── */

.manifesto-body { max-width: 54rem; }

.lede {
  font-size: clamp(1.15rem, 1.9vw, 1.45rem);
  line-height: 1.55;
  color: var(--bone);
  max-width: 46ch;
}

.lede::first-letter {
  font-family: var(--display);
  font-size: 3.4em;
  line-height: 0.78;
  float: left;
  padding: 0.12em 0.14em 0 0;
  color: var(--ember);
}

.bigline {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 1.12;
  margin-top: clamp(3rem, 7vh, 5rem);
  letter-spacing: 0.002em;
}

.bigline .dim { color: var(--bone-dim); }

.support {
  margin-top: clamp(2rem, 5vh, 3.4rem);
  color: var(--bone-dim);
  max-width: 46ch;
  font-size: clamp(1rem, 1.4vw, 1.15rem);
}

.mission {
  margin-top: clamp(3rem, 7vh, 5rem);
  color: var(--bone-dim);
  max-width: 52ch;
}

.mission-key {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  line-height: 1.18;
  color: var(--bone);
}

/* ── 02 · principles ─────────────────────────────────────────── */

.question { grid-column: 2; }

.q-dead, .q-live {
  font-family: var(--display);
  line-height: 1.14;
}

.q-dead {
  color: var(--bone-faint);
  font-size: clamp(1.5rem, 3.4vw, 3rem);
}

.q-dead s {
  text-decoration-line: line-through;
  text-decoration-color: var(--ember-deep);
  text-decoration-thickness: 0.055em;
  text-decoration-skip-ink: none;
}

.q-live {
  color: var(--bone);
  font-size: clamp(2.2rem, 5.4vw, 4.8rem);
  margin-top: clamp(0.6rem, 1.6vh, 1.2rem);
  padding-left: clamp(1.2rem, 3.4vw, 3rem);
}

.q-note {
  margin-top: clamp(1.6rem, 3.5vh, 2.4rem);
  color: var(--bone-dim);
  max-width: 40ch;
  font-size: 1rem;
}

.principle-grid {
  grid-column: 2;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.2rem, 2.5vw, 2rem);
  margin-top: clamp(3.5rem, 8vh, 6rem);
}

.principle-grid li {
  background: var(--ink-panel);
  padding: clamp(1.6rem, 3vw, 2.6rem);
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(237, 228, 206, 0.045);
}

.pnum {
  display: block;
  font-family: var(--display);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1;
  color: var(--bone-dim);
}

.principle-grid h3 {
  font-family: var(--body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin-top: 1.1rem;
  color: var(--bone);
}

.principle-grid p {
  margin-top: 0.5rem;
  color: var(--bone-dim);
  font-size: 0.95rem;
  max-width: 34ch;
}

/* ── 03 · catalogue ──────────────────────────────────────────── */

.section-line {
  grid-column: 2;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.3rem, 5.6vw, 5rem);
  line-height: 1.06;
  letter-spacing: 0.002em;
}

.flagship {
  grid-column: 2;
  margin-top: clamp(3rem, 7vh, 5rem);
  background:
    linear-gradient(155deg, rgba(237, 228, 206, 0.035), rgba(237, 228, 206, 0) 42%),
    var(--ink-panel);
  padding: clamp(2rem, 4.5vw, 3.8rem);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 30px), calc(100% - 30px) 100%, 0 100%);
}

.flagship-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.flagship-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: 0.002em;
}

.flagship-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.78rem;
  color: var(--bone-dim);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ember);
  flex: none;
}

.flagship-desc {
  margin-top: 1.6rem;
  color: var(--bone-dim);
  max-width: 56ch;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
}

.cap-ledger {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.55rem 1.8rem;
  margin-top: clamp(2rem, 4.5vh, 3rem);
  padding-top: clamp(1.4rem, 3vh, 2rem);
  border-top: 1px solid var(--rule);
  font-size: 0.8rem;
  color: var(--bone-dim);
}

.cap-ledger li::before {
  content: '—';
  color: var(--bone-faint);
  margin-right: 0.5em;
}

.ledger {
  grid-column: 2;
  list-style: none;
  margin-top: clamp(3rem, 7vh, 5rem);
  border-bottom: 1px solid var(--rule);
}

.ledger-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(7rem, 15rem) 1fr auto;
  align-items: baseline;
  gap: 1.2rem;
  padding: 1.05rem 0.6rem;
  border-top: 1px solid var(--rule);
  border-radius: 2px;
  transition: background-color 0.25s ease;
}

.ledger-row:hover { background: rgba(237, 228, 206, 0.025); }

.lr-idx { font-size: 0.78rem; color: var(--bone-faint); }

.lr-name {
  font-family: var(--display);
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.1;
  color: var(--bone);
}

.lr-what {
  color: var(--bone-dim);
  font-size: 0.94rem;
  max-width: 52ch;
}

.lr-status { font-size: 0.78rem; color: var(--bone-dim); }

/* ── 04 · field ──────────────────────────────────────────────── */

.constellation {
  grid-column: 2;
  position: relative;
  height: clamp(22rem, 58vh, 34rem);
  margin-top: clamp(2.5rem, 6vh, 4rem);
}

.cw {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  white-space: nowrap;
  cursor: default;
  transition: color 0.3s ease;
}

.cw:hover { color: var(--ember); }

.cw-d {
  font-family: var(--display);
  color: var(--bone);
  line-height: 1;
}

.cw-lg { font-size: clamp(1.9rem, 3.6vw, 3.2rem); }
.cw-md { font-size: clamp(1.4rem, 2.6vw, 2.2rem); }
.cw-sm { font-size: clamp(1.1rem, 2vw, 1.7rem); }

.cw-s {
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  color: var(--bone-dim);
}

.field-note {
  grid-column: 2;
  color: var(--bone-dim);
  margin-top: clamp(2.5rem, 6vh, 4rem);
  max-width: 44ch;
}

/* ── 05 · method ─────────────────────────────────────────────── */

.method { padding-bottom: var(--sect-gap); }

.motto {
  grid-column: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(1rem, 2.6vw, 2.2rem);
}

.motto-line {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3.6vw, 3rem);
  line-height: 1.1;
  color: var(--bone);
}

.motto-spark {
  color: var(--ember-deep);
  flex: none;
}

.method-support {
  grid-column: 2;
  margin-top: clamp(2.4rem, 5.5vh, 3.8rem);
  color: var(--bone-dim);
  max-width: 46ch;
}

.values {
  grid-column: 2;
  margin-top: clamp(2rem, 4.5vh, 3rem);
  color: var(--bone);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  letter-spacing: 0.01em;
}

.stack {
  grid-column: 2;
  margin-top: clamp(1.2rem, 2.6vh, 1.8rem);
  font-size: 0.78rem;
  color: var(--bone-faint);
}

/* ── footer ──────────────────────────────────────────────────── */

.site-footer {
  overflow: hidden;
  padding-top: clamp(5rem, 12vh, 9rem);
  margin-top: clamp(3rem, 8vh, 6rem);
}

.site-footer .embers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.footer-inner {
  position: relative;
  z-index: 2;
  padding-inline: var(--gutter);
  padding-bottom: clamp(5rem, 12vh, 8rem);
}

.hello-lead {
  color: var(--bone-dim);
  font-size: 1rem;
}

.hello-mail {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 1.1rem;
  font-family: var(--display);
  font-size: clamp(1.9rem, 5vw, 4rem);
  line-height: 1.1;
  color: var(--bone);
  text-decoration: none;
}

.mail-arrow {
  color: var(--ember);
  align-self: center;
  width: 0.55em;
  height: 0.55em;
  transition: transform 0.3s ease;
}

.hello-mail:hover .mail-arrow { transform: translate(4px, -4px); }

.footer-meta {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: clamp(2.6rem, 6vh, 4rem);
  color: var(--bone-faint);
  font-size: 0.85rem;
}

.footer-word {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: clamp(5rem, 26vw, 34rem);
  line-height: 0.8;
  letter-spacing: -0.015em;
  text-align: center;
  color: #242e16;
  transform: translateY(0.05em);
  user-select: none;
  pointer-events: none;
}

/* ── responsive ──────────────────────────────────────────────── */

@media (max-width: 56rem) {
  .manifesto, .principles, .catalogue, .field, .method {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
  }
  .marginal, .question, .principle-grid, .section-line,
  .flagship, .ledger, .constellation, .field-note,
  .motto, .method-support, .values, .stack { grid-column: 1; }

  .marginal { padding-top: 0; }

  .hero-tag {
    position: relative;
    right: auto;
    top: auto;
    margin-top: clamp(4rem, 14vh, 7rem);
  }

  .q-live { padding-left: clamp(0.9rem, 4vw, 1.6rem); }

  .principle-grid { grid-template-columns: minmax(0, 1fr); }

  .constellation {
    height: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 1.1rem 1.9rem;
    align-items: baseline;
  }
  .cw { position: static; }

  .ledger-row {
    grid-template-columns: 2.4rem 1fr auto;
    grid-template-areas:
      'idx name status'
      'idx what what';
    row-gap: 0.35rem;
  }
  .lr-idx { grid-area: idx; }
  .lr-name { grid-area: name; }
  .lr-what { grid-area: what; }
  .lr-status { grid-area: status; }

  .hero-scroll { display: none; }
}

@media (max-width: 34rem) {
  .site-links a { font-size: 0.8rem; }
  .flagship { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%); }
  .footer-meta { flex-direction: column; gap: 0.4rem; }
}

/* ── reduced motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
