/* ------------------------------------------------------------------
   Shah Baig / shahs.ai
   The Warrant edition. Dark, Swiss, one red.
   The site treats every visitor the way agent systems should be
   treated: identified, scoped, and audited. No frameworks.
------------------------------------------------------------------- */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #0d0d0b;
  --bg-raised: #151512;
  --ink: #ece9e1;
  --ink-dim: #a5a196;
  --ink-faint: #757168;
  --line: rgba(236, 233, 225, 0.13);
  --line-strong: rgba(236, 233, 225, 0.3);
  --red: #e8362a;
  --red-soft: #ff6b5c;
  --red-deep: #c22417;
  --sans: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Reset ---- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  background: var(--bg);
}

body {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "cv05" 1, "ss01" 1;
}

img,
svg,
iframe,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--red);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

/* ---- Film grain (decorative, fixed, never intercepts input) ---- */

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  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'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

main,
.site-header,
.site-footer,
.marquee {
  position: relative;
  z-index: 2;
}

/* ---- Layout primitives ---- */

.wrap {
  width: min(1240px, 100% - 3rem);
  margin-inline: auto;
}

.band {
  border-top: 1px solid var(--line-strong);
  padding: 4rem 0 6rem;
}

/* Registration marks, like a filed document */

.band > .wrap {
  position: relative;
}

.band > .wrap::before,
.band > .wrap::after {
  content: "+";
  position: absolute;
  top: -2.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.band > .wrap::before {
  left: 0;
}

.band > .wrap::after {
  right: 0;
}

.band-head {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: 3.25rem;
}

.band-head .idx {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
}

/* ---- Type ---- */

.kicker {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--red-soft);
}

/* Tracking settles as the section arrives */

html.js .kicker.reveal,
html.js .band-head.reveal .kicker {
  letter-spacing: 0.38em;
}

html.js .kicker.reveal.in,
html.js .band-head.reveal.in .kicker {
  letter-spacing: 0.16em;
  transition: letter-spacing 1.1s var(--ease-out);
}

.display {
  font-size: clamp(2.6rem, 7.6vw, 7rem);
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  line-height: 0.92;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.display > .l:last-child::after,
.display:not(:has(.l))::after {
  content: "";
  display: inline-block;
  width: 0.13em;
  height: 0.13em;
  background: var(--red);
  margin-left: 0.1em;
}

.display .l {
  display: block;
  overflow: hidden;
}

/* Film-credit line rise: each masked line climbs into place */

html.js .display .l .lw {
  display: inline-block;
  transform: translateY(118%);
}

html.js .display.reveal.in .l .lw {
  transform: translateY(0);
  transition: transform 0.9s var(--ease-out);
}

html.js .display.reveal.in .l:nth-child(2) .lw {
  transition-delay: 0.08s;
}

html.js .display.reveal.in .l:nth-child(3) .lw {
  transition-delay: 0.16s;
}

html.js .display.reveal.in .l:nth-child(4) .lw {
  transition-delay: 0.24s;
}

.ghost {
  color: transparent;
  -webkit-text-stroke: 2px var(--red);
}

@supports not (-webkit-text-stroke: 2px red) {
  .ghost {
    color: var(--red);
  }
}

.display-2 {
  font-size: clamp(2rem, 4.8vw, 4.25rem);
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  line-height: 0.94;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.display-2::after {
  content: "";
  display: inline-block;
  width: 0.13em;
  height: 0.13em;
  background: var(--red);
  margin-left: 0.1em;
}

.plate .display-2::after {
  background: #16100e;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 800;
  font-stretch: 110%;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.lede {
  font-size: clamp(1.125rem, 1.8vw, 1.4375rem);
  line-height: 1.45;
  max-width: 33em;
  color: var(--ink-dim);
  text-wrap: pretty;
}

/* ---- Links ---- */

.link {
  position: relative;
  font-weight: 700;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 2px;
  transition: color 0.2s var(--ease-out);
}

.link:hover {
  color: var(--red-soft);
  background-image: linear-gradient(var(--red-soft), var(--red-soft));
  animation: relink 0.5s var(--ease-out);
}

@keyframes relink {
  0% {
    background-size: 0 2px;
  }
  100% {
    background-size: 100% 2px;
  }
}

.link-quiet {
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.link-quiet:hover {
  color: var(--red-soft);
  border-color: var(--red-soft);
}

.ext::after {
  content: "\2197";
  display: inline-block;
  margin-left: 0.3em;
  font-family: var(--mono);
  font-size: 0.8em;
  font-weight: 500;
  transition: transform 0.2s var(--ease-out);
}

.ext:hover::after {
  transform: translate(0.12em, -0.12em);
}

/* ---- Vertical rail (JS-injected, desktop only) ---- */

.rail {
  display: none;
  position: fixed;
  right: 1.15rem;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-faint);
  z-index: 5;
  pointer-events: none;
}

@media (min-width: 1360px) {
  .rail {
    display: block;
  }
}

/* ---- Header ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 13, 11, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-strong);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand .chop {
  width: 1.5em;
  height: 1.5em;
  transition: transform 0.25s var(--ease-out);
}

.brand:hover .chop {
  transform: rotate(-6deg) scale(0.95);
}

.header-clock {
  display: none;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 980px) {
  .header-clock {
    display: block;
  }
}

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

.site-nav a {
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--red-soft);
}

.site-nav a[aria-current="page"] {
  border-color: var(--red);
}

.nav-toggle {
  display: none;
  appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0.5rem 0;
  width: 2rem;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  margin: 5px 0;
  transition: transform 0.25s var(--ease-out), opacity 0.2s ease;
}

@media (max-width: 719px) {
  html.js .nav-toggle {
    display: block;
  }

  /* Without JS the toggle is inert, so show the nav inline instead. */
  html:not(.js) .site-nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 0 1.5rem;
    padding-bottom: 0.75rem;
  }

  html.js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line-strong);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.5rem 1.25rem;
  }

  html.js .site-nav a {
    padding: 0.75rem 0;
    font-size: 0.9375rem;
    width: 100%;
  }

  html.js .nav-open .site-nav {
    display: flex;
  }

  .nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  .nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ---- Skip link ---- */

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  z-index: 400;
}

.skip:focus {
  left: 0;
}

/* ---- Identification overlay (JS-injected, first visit per session) ---- */

.ident {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

.ident.done {
  opacity: 0;
  pointer-events: none;
}

.ident-inner {
  margin-left: clamp(1.5rem, 12vw, 12rem);
}

.ident-seal {
  width: clamp(88px, 13vw, 150px);
  aspect-ratio: 1;
  margin-bottom: 2rem;
}

.ident-log {
  font-family: var(--mono);
  font-size: clamp(0.875rem, 1.6vw, 1.0625rem);
  line-height: 2.1;
}

.ident-log div {
  opacity: 0;
}

.ident-log div.on {
  opacity: 1;
  transition: opacity 0.18s ease;
}

.ident-log .p {
  color: var(--red-soft);
  margin-right: 0.75em;
}

.ident-log .ok {
  color: var(--ink-dim);
}

.ident-skip {
  position: absolute;
  bottom: 1.5rem;
  right: 1.75rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---- Visitor warrant card ---- */

.warrant {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 90;
  width: 17.5rem;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  font-family: var(--mono);
  font-size: 0.71875rem;
}

.warrant-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-align: left;
}

.warrant-head .wid {
  color: var(--red-deep);
}

.warrant-body {
  padding: 0.45rem 0 0.55rem;
}

.warrant-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.32rem 0.85rem;
  color: var(--ink-faint);
}

.warrant-row b {
  font-weight: 500;
  color: var(--ink-dim);
  text-align: right;
}

.warrant-row .grant {
  color: var(--ink);
}

.warrant-row .ask {
  color: var(--ink-dim);
}

.warrant-row .deny {
  color: var(--red-soft);
  font-weight: 700;
}

.warrant-foot {
  padding: 0.45rem 0.85rem 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

.warrant.folded .warrant-body,
.warrant.folded .warrant-foot {
  display: none;
}

@media (max-width: 719px) {
  .warrant {
    right: 0.9rem;
    bottom: 0.9rem;
    width: min(17.5rem, calc(100vw - 1.8rem));
  }
}

@media print {
  .warrant,
  .grain,
  .rail {
    display: none;
  }
}

/* ---- Hero ---- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3.5rem, 7vw, 5.5rem);
}

.hero > .wrap {
  position: relative;
  z-index: 3;
}

/* The warrant seal: hand-rolled WebGL, sits behind the content layer */

.seal {
  position: absolute;
  top: 44%;
  left: 31%;
  transform: translateY(-50%);
  width: min(46vw, 660px);
  aspect-ratio: 1;
  z-index: 1;
}

@media (max-width: 979px) {
  .seal {
    top: 30%;
    left: auto;
    right: -34%;
    width: 100vw;
    opacity: 0.3;
  }
}

html:not(.js) .seal {
  display: none;
}

.hero-grid {
  display: grid;
  gap: 3.5rem;
}

@media (min-width: 980px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 21.5rem;
    gap: 5rem;
    align-items: start;
  }
}

.hero .kicker {
  margin-bottom: 2rem;
}

.hero .lede {
  margin-top: 2.25rem;
}

.proof {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  margin-top: 2.75rem;
  font-size: 1.0625rem;
}

/* ---- Spec sheet ---- */

.spec {
  border: 1px solid var(--line-strong);
  background: var(--bg-raised);
  align-self: start;
}

.spec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.65rem 1rem;
}

.spec-head .sq {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--red);
}

.spec-row {
  display: grid;
  grid-template-columns: 6.25rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

.spec-head + .spec-row {
  border-top: 0;
}

.spec-row .spec-k {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.spec-row .spec-v {
  font-weight: 500;
  letter-spacing: -0.01em;
}

.spec-row .spec-v.mono-val {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  background: var(--red);
  margin-right: 0.55em;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

/* ---- Marquee ---- */

.tape-wrap {
  overflow: hidden;
  padding: 1.4rem 0;
}

.marquee {
  overflow: hidden;
  background: var(--red);
  margin-inline: -2%;
  transform: rotate(-1.1deg);
  padding: 0.7rem 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 42s linear infinite;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-group {
  display: flex;
  align-items: center;
}

.marquee-group span {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #16100e;
}

.marquee-group span::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  background: #16100e;
  margin: 0 1.6rem;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* ---- Highlights ---- */

.grid-3 {
  display: grid;
  border-top: 1px solid var(--line-strong);
}

@media (min-width: 861px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hl {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  padding: 2rem 0 0.5rem;
}

@media (min-width: 861px) {
  .hl {
    padding: 2.25rem 2.5rem 0.75rem;
    border-left: 1px solid var(--line);
  }

  .hl:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .hl:last-child {
    padding-right: 0;
  }
}

@media (max-width: 860px) {
  .hl + .hl {
    border-top: 1px solid var(--line);
  }
}

.hl .idx {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--red-soft);
  letter-spacing: 0.1em;
}

.hl .stat {
  font-size: clamp(3rem, 5.4vw, 4.75rem);
  font-weight: 900;
  font-stretch: 122%;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.hl .stat small {
  font-size: 0.38em;
  font-weight: 500;
  font-stretch: 100%;
  letter-spacing: -0.01em;
  color: var(--ink-dim);
  margin-left: 0.4em;
  white-space: nowrap;
}

.hl p {
  flex: 1;
  color: var(--ink-dim);
  text-wrap: pretty;
}

.hl .link {
  font-size: 0.9375rem;
}

/* ---- Patent figure ---- */

.patent {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  padding: clamp(1rem, 3.5vw, 3rem);
  overflow-x: auto;
}

.patent svg {
  width: 100%;
  min-width: 640px;
  height: auto;
  color: var(--ink);
}

.patent .ps {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}

.patent .psd {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-dasharray: 7 5;
}

.patent .psl {
  stroke: var(--ink-faint);
  fill: none;
  stroke-width: 1;
}

.patent .pt {
  fill: var(--ink-dim);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.patent .ptb {
  fill: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.patent .ptf {
  fill: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.patent .pr {
  stroke: var(--red-soft);
  fill: none;
  stroke-width: 1.5;
}

.patent .prt {
  fill: var(--red-soft);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.patent-caption {
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.78125rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.patent-caption a {
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line-strong);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.patent-caption a:hover {
  color: var(--red-soft);
  border-color: var(--red-soft);
}

/* ---- Footer terminal ---- */

html:not(.js) .cli {
  display: none;
}

.cli {
  margin-top: 3rem;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.cli-out {
  padding: 0.85rem 1rem 0;
  color: var(--ink-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 11rem;
  overflow-y: auto;
}

.cli-out:empty {
  display: none;
}

.cli-line {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.8rem 1rem;
}

.cli-ps1 {
  color: var(--red-soft);
  white-space: nowrap;
}

.cli-in {
  flex: 1;
  min-width: 8rem;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.cli-in::placeholder {
  color: var(--ink-faint);
}

/* ---- Asymmetry: spec card overlaps the tape ---- */

@media (min-width: 980px) {
  .hero-grid .spec {
    position: relative;
    z-index: 6;
    transform: translateY(2.5rem);
  }

  .tape-wrap {
    margin-top: -2.75rem;
    position: relative;
    z-index: 2;
  }
}

/* ---- The letter ---- */

.letter {
  max-width: 46ch;
  font-size: 1.1875rem;
  line-height: 1.65;
  color: var(--ink-dim);
}

.letter p + p {
  margin-top: 1.4rem;
}

.letter-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.letter-sign {
  margin-top: 2.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.75rem;
  font-weight: 800;
  font-stretch: 112%;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.letter-sign .chop-stamp {
  width: 1.15em;
  height: 1.15em;
  transform: rotate(-7deg);
}

/* ---- Colophon ---- */

.colophon {
  font-family: var(--mono);
  font-size: 0.71875rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding-bottom: 1.5rem;
}

/* ---- Red plate (the Now band) ---- */

.plate {
  background: var(--red);
  color: #16100e;
  padding: clamp(4.5rem, 9vw, 8rem) 0;
}

/* The red curtain wipes down as the plate enters: a page-colored
   overlay shrinks toward the bottom, revealing the red from the top.
   (Clipping the section itself would zero its intersection ratio
   and the observer would never fire.) */

.plate {
  position: relative;
}

.plate > .wrap {
  position: relative;
  z-index: 2;
}

html.js .plate.reveal {
  transform: none;
}

html.js .plate.reveal::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  transform-origin: bottom;
  z-index: 1;
}

html.js .plate.reveal.in::after {
  transform: scaleY(0);
  transition: transform 1.05s var(--ease-out);
}

.plate .kicker {
  color: #16100e;
  margin-bottom: 2rem;
}

.plate .display-2 .dot {
  color: #16100e;
}

.plate .lede {
  margin-top: 2rem;
  color: rgba(22, 16, 14, 0.82);
}

.plate .proof .link {
  background-image: linear-gradient(#16100e, #16100e);
}

.plate .proof .link:hover {
  color: #fff;
  background-image: linear-gradient(#fff, #fff);
}

/* ---- Terminal / artifact windows ---- */

.term {
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.75;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  overflow: hidden;
}

.term-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.term-bar .sq {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--red);
}

.term-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-x: auto;
  white-space: pre;
}

.term .dim {
  color: var(--ink-faint);
}

.term .red {
  color: var(--red-soft);
}

.term .key {
  color: var(--ink-dim);
}

.term .caret {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  background: var(--ink);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* YAML artifact lines: hidden until typed in (JS). No-JS shows all. */

html.js .yfile .yline {
  visibility: hidden;
}

html.js .yfile.played .yline,
html.js .yfile .yline.on {
  visibility: visible;
}

.artifact-caption {
  margin-top: 1.25rem;
  font-family: var(--mono);
  font-size: 0.78125rem;
  color: var(--ink-faint);
  max-width: 48em;
}

/* ---- Story chapters ---- */

.chapter {
  display: grid;
  gap: 1.5rem 3.5rem;
  border-top: 1px solid var(--line);
  padding: 3rem 0 3.5rem;
}

@media (min-width: 900px) {
  .chapter {
    grid-template-columns: 10.5rem minmax(0, 58ch) 1fr;
  }
}

.chapter .label {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--red-soft);
  padding-top: 0.4rem;
}

.chapter .prose > * + * {
  margin-top: 1.1rem;
}

.chapter .prose h2 {
  margin-bottom: 1.25rem;
}

.chapter .prose p {
  color: var(--ink-dim);
  text-wrap: pretty;
}

.facts {
  display: grid;
  gap: 1.75rem;
  align-content: start;
}

@media (max-width: 899px) {
  .facts {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }
}

.fact {
  border-top: 2px solid var(--ink);
  padding-top: 0.65rem;
}

.fact b {
  display: block;
  font-size: 2.4rem;
  font-weight: 900;
  font-stretch: 118%;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.fact span {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--mono);
  font-size: 0.71875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

/* ---- User-dots scene (2,000 users, drawn on canvas) ---- */

.dots-scene {
  align-self: start;
}

.dots-scene canvas {
  width: 100%;
  height: auto;
}

html:not(.js) .dots-scene canvas {
  display: none;
}

.dots-caption {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.71875rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

.dots-caption .n {
  color: var(--ink);
  font-weight: 700;
}

/* ---- Kill list (the product that refused to die), poster scale ---- */

.kill-wrap {
  grid-column: 1 / -1;
  margin-top: 1.5rem;
}

.kill-list {
  list-style: none;
  font-family: var(--sans);
  font-size: clamp(1.6rem, 7vw, 5.5rem);
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  line-height: 1.06;
  letter-spacing: -0.015em;
  display: grid;
  gap: 0.35rem;
}

.kill-list li {
  position: relative;
  color: var(--ink-dim);
  width: fit-content;
}

.kill-list li::after {
  content: "";
  position: absolute;
  left: -1.5%;
  top: 50%;
  width: 103%;
  height: 0.09em;
  margin-top: -0.045em;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
}

html.js .kill-list li.struck::after {
  transform: scaleX(1);
  transition: transform 0.35s var(--ease-out);
}

html:not(.js) .kill-list li::after {
  transform: scaleX(1);
}

.stamp {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.7rem 1.4rem;
  border: 3px solid var(--red);
  color: var(--red-soft);
  font-family: var(--mono);
  font-size: clamp(0.9375rem, 1.6vw, 1.25rem);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  transform: rotate(-4deg);
}

html.js .stamp {
  opacity: 0;
}

html.js .stamp.in {
  animation: stamp 0.35s var(--ease-out) forwards;
}

html:not(.js) .stamp {
  opacity: 1;
}

@keyframes stamp {
  0% {
    transform: rotate(-4deg) scale(1.7);
    opacity: 0;
  }
  100% {
    transform: rotate(-4deg) scale(1);
    opacity: 1;
  }
}

/* ---- Shout: one rule, poster scale ---- */

.shout {
  border-top: 1px solid var(--line);
  padding: 3.5rem 0 4rem;
  font-size: clamp(1.9rem, 4.6vw, 4rem);
  font-weight: 900;
  font-stretch: 125%;
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--ink-dim);
  text-wrap: balance;
}

.shout b {
  color: var(--ink);
  font-weight: inherit;
  -webkit-text-stroke: 0;
}

@supports not (-webkit-text-stroke: 1px red) {
  .shout {
    color: var(--ink-dim);
  }
}

/* ---- Credentials ---- */

.creds {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

@media (max-width: 860px) {
  .creds {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .creds {
    grid-template-columns: 1fr;
  }
}

.cred {
  border-top: 2px solid var(--ink);
  padding-top: 1.1rem;
}

.cred h3 {
  font-size: 1.0625rem;
}

.cred p {
  margin-top: 0.4rem;
  font-size: 0.9375rem;
  color: var(--ink-dim);
}

/* ---- Projects ---- */

.project {
  display: grid;
  gap: 1.25rem 3.5rem;
  border-top: 1px solid var(--line-strong);
  padding: 2.5rem 0 3rem;
}

@media (min-width: 860px) {
  .project {
    grid-template-columns: 4rem minmax(0, 22rem) 1fr;
  }
}

.project .num {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--ink-faint);
  padding-top: 0.55rem;
  transition: color 0.2s ease;
}

.project:hover .num {
  color: var(--red-soft);
}

.project h2 {
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
}

.project h2 a {
  transition: color 0.15s ease;
}

.project h2 a:hover {
  color: var(--red-soft);
}

.project .meta {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.78125rem;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
  line-height: 1.8;
}

.project .tagline {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.project .body > p + p {
  margin-top: 0.85rem;
}

.project .body p {
  color: var(--ink-dim);
  text-wrap: pretty;
}

.project .body .tagline {
  color: var(--ink);
}

.project .detail {
  color: var(--ink-faint);
}

/* Copy-to-clipboard chip */

html:not(.js) .chip {
  display: none;
}

.chip {
  appearance: none;
  background: none;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.78125rem;
  padding: 0.45rem 0.85rem;
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip::before {
  content: "$";
  color: var(--red-soft);
}

.chip::after {
  content: "copy";
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  transition: color 0.15s ease;
}

.chip:hover {
  border-color: var(--ink);
}

.chip:hover::after {
  color: var(--ink);
}

.chip.copied {
  border-color: var(--red);
  color: var(--red-soft);
}

.chip.copied::after {
  content: "copied";
  color: var(--red-soft);
}

.gh {
  white-space: nowrap;
}

/* ---- Writing ---- */

.cta-sub {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  font-size: 1.0625rem;
  padding: 1.05rem 1.9rem;
  margin-top: 2.5rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.cta-sub:hover {
  background: var(--red);
  color: #fff;
}

.series {
  display: grid;
  border-top: 1px solid var(--line-strong);
}

@media (min-width: 861px) {
  .series {
    grid-template-columns: repeat(3, 1fr);
  }
}

.serie {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 2.25rem 0 0.5rem;
}

@media (min-width: 861px) {
  .serie {
    padding: 2.25rem 2.5rem 0.75rem;
    border-left: 1px solid var(--line);
  }

  .serie:first-child {
    border-left: 0;
    padding-left: 0;
  }

  .serie:last-child {
    padding-right: 0;
  }
}

@media (max-width: 860px) {
  .serie + .serie {
    border-top: 1px solid var(--line);
  }
}

.serie .tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--red-soft);
}

.serie p {
  flex: 1;
  color: var(--ink-dim);
  text-wrap: pretty;
}

.posts {
  list-style: none;
}

.posts li {
  border-top: 1px solid var(--line);
}

.posts li:last-child {
  border-bottom: 1px solid var(--line);
}

.posts a {
  display: grid;
  gap: 0.25rem 2.5rem;
  padding: 1.5rem 0;
  transition: color 0.15s ease;
}

@media (min-width: 720px) {
  .posts a {
    grid-template-columns: 10rem 1fr auto;
    align-items: baseline;
  }
}

.posts a:hover {
  color: var(--red-soft);
}

.posts .date {
  font-family: var(--mono);
  font-size: 0.78125rem;
  color: var(--ink-faint);
}

.posts .name {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.875rem;
}

.posts a:hover .name {
  color: var(--red-soft);
}

.posts .title {
  font-weight: 700;
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  letter-spacing: -0.015em;
}

.posts .go {
  font-family: var(--mono);
  font-size: 0.78125rem;
  color: var(--ink-faint);
}

.posts .go::after {
  content: "\2197";
  display: inline-block;
  margin-left: 0.35em;
  transition: transform 0.2s var(--ease-out);
}

.posts a:hover .go {
  color: var(--red-soft);
}

.posts a:hover .go::after {
  transform: translate(0.12em, -0.12em);
}

/* Subscribe form: native, hands the email to Substack's confirm page */

.sub-form {
  max-width: 34rem;
}

.sub-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  align-items: flex-end;
}

.sub-field {
  flex: 1 1 16rem;
}

.sub-field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.71875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

.sub-field input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  padding: 0.4rem 0 0.6rem;
  border-radius: 0;
}

.sub-field input::placeholder {
  color: var(--ink-faint);
}

.sub-field input:focus {
  outline: none;
  border-bottom: 2px solid var(--red);
}

.sub-form button {
  background: var(--red);
  color: #fff;
  border: 0;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.95rem 2.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sub-form button:hover {
  background: var(--red-deep);
}

.sub-note {
  margin-top: 1.25rem;
  font-family: var(--mono);
  font-size: 0.71875rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* ---- Footer ---- */

.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--line-strong);
}

.email-display {
  padding: clamp(3.5rem, 7vw, 6rem) 0 0;
}

.email-display .kicker {
  display: block;
  margin-bottom: 1.5rem;
}

.email-display a {
  font-weight: 900;
  font-stretch: 108%;
  font-size: clamp(1.4rem, 4.2vw, 3.9rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  border-bottom: 3px solid var(--line-strong);
  overflow-wrap: anywhere;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.email-display a:hover {
  color: var(--red-soft);
  border-color: var(--red-soft);
}

.footer-grid {
  display: grid;
  gap: 3.5rem;
  padding: clamp(3rem, 6vw, 5rem) 0 4rem;
}

@media (min-width: 860px) {
  .footer-grid {
    grid-template-columns: 1.1fr 1fr;
    gap: 5rem;
  }
}

.footer-head {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.footer-intro {
  margin-top: 1rem;
  max-width: 30em;
  color: var(--ink-dim);
  text-wrap: pretty;
}

.footer-links {
  list-style: none;
  margin-top: 2.25rem;
  display: grid;
  gap: 0.9rem;
}

.footer-links .k {
  display: inline-block;
  width: 6.5rem;
  font-family: var(--mono);
  font-size: 0.71875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.footer-links a {
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  overflow-wrap: anywhere;
}

.footer-links a:hover {
  color: var(--red-soft);
  border-color: var(--red-soft);
}

/* Netlify form */

.contact-form {
  display: grid;
  gap: 1.75rem;
  align-content: start;
}

.form-title {
  font-family: var(--mono);
  font-size: 0.71875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

.contact-form label {
  display: block;
  font-family: var(--mono);
  font-size: 0.71875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  padding: 0.4rem 0 0.6rem;
  border-radius: 0;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-bottom: 2px solid var(--red);
}

.contact-form textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.contact-form button {
  justify-self: start;
  background: var(--red);
  color: #fff;
  border: 0;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.95rem 2.5rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.contact-form button:hover {
  background: var(--red-deep);
}

.hidden {
  display: none;
}

/* Audit record */

.audit {
  border-top: 1px solid var(--line);
  padding: 2.25rem 0 2.5rem;
}

.audit-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  font-family: var(--mono);
  font-size: 0.71875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.25rem;
}

.audit-head .k {
  color: var(--red-soft);
}

.audit-list {
  list-style: none;
  font-family: var(--mono);
  font-size: 0.71875rem;
  color: var(--ink-dim);
  display: grid;
  gap: 0.45rem;
  font-variant-numeric: tabular-nums;
}

.audit-list .t {
  color: var(--ink-faint);
  margin-right: 1.25em;
}

.audit-list .h {
  color: var(--ink-faint);
  float: right;
}

.audit-empty {
  font-family: var(--mono);
  font-size: 0.71875rem;
  color: var(--ink-faint);
}

.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.71875rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ---- Utility pages ---- */

.solo {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 0;
}

.solo .display {
  margin-bottom: 1.5rem;
}

.solo .mono-note {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--ink-faint);
  margin-bottom: 1.5rem;
}

.solo .mono-note .red {
  color: var(--red-soft);
}

/* ---- Reveal on scroll ---- */

html.js .reveal {
  opacity: 0;
  transform: translateY(10px);
}

html.js .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
  transition-delay: var(--d, 0s);
}

/* ---- Motion preferences ---- */

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

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  html.js .reveal {
    opacity: 1;
    transform: none;
  }

  html.js .display .l .lw {
    transform: none;
  }

  html.js .kicker.reveal,
  html.js .band-head.reveal .kicker {
    letter-spacing: 0.16em;
  }

  html.js .plate.reveal::after {
    display: none;
  }

  html.js .yfile .yline {
    visibility: visible;
  }

  html.js .kill-list li::after {
    transform: scaleX(1);
  }

  html.js .stamp {
    opacity: 1;
  }

  .marquee-track {
    flex-wrap: wrap;
    width: auto;
  }

  .marquee-group {
    flex-wrap: wrap;
    row-gap: 0.6rem;
  }

  .marquee-group + .marquee-group {
    display: none;
  }
}
