:root {
  color-scheme: light;
  --ink: #edf0e6;
  --paper: #17241d;
  --muted: #667267;
  --signal: #526d00;
  --line: rgba(56, 76, 54, 0.22);
  --edge: 2px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  letter-spacing: 0;
}

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

#scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  touch-action: pan-y;
}


.phosphor,
.scanlines,
.noise,
.vignette {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.phosphor {
  background: rgba(198, 211, 149, 0.055);
  mix-blend-mode: multiply;
}

.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(45, 62, 48, 0.035) 0,
    rgba(45, 62, 48, 0.035) 1px,
    rgba(255, 255, 255, 0.08) 2px,
    rgba(255, 255, 255, 0.08) 4px
  );
  opacity: 0.48;
  background-size: 100% 4px;
}

.noise {
  inset: -70%;
  width: 240%;
  height: 240%;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.85'/%3E%3C/svg%3E");
}

.vignette {
  box-shadow: inset 0 0 12vw rgba(45, 58, 48, 0.18), inset 0 0 3vw rgba(45, 58, 48, 0.08);
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  background: var(--ink);
  transition: opacity 700ms ease, visibility 700ms;
}

.boot.done { opacity: 0; visibility: hidden; }

.boot p {
  margin: 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.boot-mark {
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid var(--signal);
  animation: boot 1.4s steps(7) infinite;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 clamp(20px, 4vw, 68px);
  border-bottom: 1px solid rgba(56, 76, 54, 0.14);
  background: linear-gradient(to bottom, rgba(237, 240, 230, 0.9), transparent);
}

.brand,
.enter {
  color: var(--paper);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  font-weight: 700;
}

.brand-logo {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.5vw, 38px);
}

.primary-nav a {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  text-decoration: none;
  transition: color 200ms ease, background-color 200ms ease;
}

.primary-nav a:hover { color: var(--paper); }
.primary-nav a:focus-visible { outline: 2px solid var(--signal); outline-offset: 5px; }
.primary-nav .nav-console { padding: 9px 14px; background: var(--paper); color: var(--ink); }
.primary-nav .nav-console:hover { background: var(--signal); color: var(--ink); }

main { position: relative; z-index: 10; }

.hero,
.system,
.archive,
.projects,
.papers,
.organizations,
.closing {
  min-height: 100dvh;
  padding-inline: clamp(20px, 7vw, 150px);
}

.archive,
.projects,
.papers,
.organizations {
  position: relative;
  background: rgba(237, 240, 230, 0.9);
}

.papers {
  padding-block: clamp(110px, 14vw, 220px);
  border-top: 1px solid var(--line);
}

.papers-heading {
  max-width: 980px;
  margin-bottom: clamp(70px, 9vw, 140px);
}

.papers-heading h2 {
  margin: 0;
  font-size: clamp(46px, 7vw, 106px);
  font-weight: 400;
  line-height: 0.9;
}

.papers-heading > p:last-child {
  max-width: 40rem;
  margin: 28px 0 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.75;
}

.paper-timeline {
  position: relative;
  margin-left: clamp(0px, 5vw, 90px);
  border-left: 1px solid var(--signal);
}

.paper {
  display: grid;
  grid-template-columns: 38px 68px minmax(0, 1fr) minmax(130px, 0.35fr);
  align-items: baseline;
  gap: clamp(14px, 2.5vw, 42px);
  position: relative;
  padding: clamp(20px, 2.4vw, 34px) 0 clamp(20px, 2.4vw, 34px) clamp(22px, 3vw, 52px);
  border-bottom: 1px solid var(--line);
}

.paper::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -4px;
  width: 7px;
  aspect-ratio: 1;
  background: var(--ink);
  border: 1px solid var(--signal);
  transform: translateY(-50%) rotate(45deg);
}

.paper-index,
.paper time {
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.paper h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(18px, 1.65vw, 27px);
  font-weight: 400;
  line-height: 1.15;
}

.paper p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.55;
}

.paper:hover h3 { color: var(--signal); }

.archive {
  padding-block: clamp(110px, 14vw, 220px);
  border-top: 1px solid var(--line);
}

.archive-heading,
.projects-heading,
.organizations-heading {
  max-width: 900px;
  margin-bottom: clamp(70px, 9vw, 140px);
}

.archive-heading h2,
.projects-heading h2,
.organizations-heading h2 {
  margin: 0;
  font-size: clamp(46px, 7vw, 106px);
  font-weight: 400;
  line-height: 0.9;
}

.archive-heading > p:last-child,
.organizations-heading > p:last-child {
  max-width: 38rem;
  margin: 28px 0 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.75;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.person {
  appearance: none;
  width: 100%;
  min-height: 154px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  text-align: left;
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease;
}

.person:hover { background: rgba(82, 109, 0, 0.1); }
.person:active { transform: translateY(1px); }
.person:focus-visible { position: relative; z-index: 2; outline: 2px solid var(--signal); outline-offset: -3px; }

.person span,
.project span,
.organization span {
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.person h3 {
  margin: 34px 0 8px;
  font-size: clamp(16px, 1.35vw, 21px);
  font-weight: 500;
  line-height: 1.05;
}

.person p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.5;
}

.profile-dialog {
  width: min(680px, calc(100vw - 40px));
  max-height: min(720px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--signal);
  border-radius: 0;
  background: rgba(237, 240, 230, 0.98);
  color: var(--paper);
  box-shadow: 18px 18px 0 rgba(82, 109, 0, 0.16);
}

.profile-dialog::backdrop {
  background: rgba(23, 36, 29, 0.34);
  backdrop-filter: blur(8px);
}

.profile-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding-left: 22px;
  border-bottom: 1px solid var(--line);
}

.profile-dialog__header > span {
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.profile-close {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--paper);
  font-family: Arial, sans-serif;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.profile-close:hover { background: var(--signal); color: var(--ink); }
.profile-close:focus-visible { outline: 2px solid var(--signal); outline-offset: -4px; }

.profile-dialog__body { padding: clamp(28px, 6vw, 72px); }

.profile-dialog__body > p:first-child {
  margin: 0 0 20px;
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.profile-dialog__body h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(44px, 8vw, 86px);
  font-weight: 400;
  line-height: 0.88;
}

.profile-dialog__body h3 {
  margin: 28px 0 0;
  color: var(--signal);
  font-family: system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
}

.profile-dialog__body > p:last-child {
  max-width: 48rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.8;
}

.projects {
  padding-block: clamp(110px, 14vw, 220px);
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.project-stream {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(36px, 8vw, 150px);
}

.project {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(100px, 0.55fr);
  align-items: baseline;
  gap: 18px;
  min-width: 0;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.project:nth-child(4n + 2),
.project:nth-child(4n + 3) { transform: translateX(clamp(0px, 2.2vw, 34px)); }

.project.visible:nth-child(4n + 2),
.project.visible:nth-child(4n + 3) { transform: translateX(clamp(0px, 2.2vw, 34px)) translateY(0); }

.project h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(17px, 1.55vw, 25px);
  font-weight: 400;
  line-height: 1.05;
}

.project p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.5;
}

.organizations {
  padding-block: clamp(110px, 14vw, 220px);
  border-top: 1px solid var(--line);
}

.organization-list { border-top: 1px solid var(--line); }

.organization {
  display: grid;
  grid-template-columns: 48px minmax(220px, 0.8fr) minmax(260px, 1fr);
  align-items: center;
  gap: clamp(20px, 5vw, 90px);
  padding: clamp(22px, 3.2vw, 48px) 0;
  border-bottom: 1px solid var(--line);
}

.organization h3 {
  margin: 0;
  font-size: clamp(34px, 5vw, 78px);
  font-weight: 400;
  line-height: 0.9;
  transition: color 220ms ease, transform 220ms ease;
}

.organization p {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.6;
}

.organization:hover h3 { color: var(--signal); transform: translateX(8px); }

.hero {
  display: grid;
  align-items: center;
  position: relative;
  padding-top: 68px;
}

.hero-copy {
  width: min(640px, 48vw);
  margin-top: 7vh;
}

.eyebrow,
.section-kicker {
  margin: 0 0 18px;
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(9px, 0.7vw, 11px);
}

h1,
h2,
h3,
p { letter-spacing: 0; }

h1 {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  color: var(--paper);
  font-size: clamp(68px, 9vw, 142px);
  font-weight: 700;
  line-height: 0.84;
  text-shadow:
    4px 0 rgba(255, 52, 92, 0.34),
    -4px 0 rgba(0, 174, 208, 0.34),
    0 0 12px rgba(82, 109, 0, 0.18);
}

h1 span { color: var(--signal); font-weight: 400; }

.hero-statement {
  margin: 24px 0 0;
  font-size: clamp(24px, 2.5vw, 39px);
  font-weight: 500;
  line-height: 1.12;
  text-wrap: balance;
}

.lead {
  max-width: 31rem;
  margin: 22px 0 28px;
  color: rgba(23, 36, 29, 0.72);
  font-family: system-ui, sans-serif;
  font-size: clamp(14px, 1.2vw, 18px);
  line-height: 1.75;
}

.hero-actions { display: flex; align-items: center; gap: 24px; }

.primary-action,
.text-action { font-family: system-ui, sans-serif; font-size: 13px; text-decoration: none; }

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-width: 154px;
  padding: 13px 16px;
  background: var(--paper);
  color: var(--ink);
  transition: transform 220ms ease, background-color 220ms ease;
}

.primary-action:hover { transform: translateY(-3px); background: var(--signal); }
.primary-action:active { transform: translateY(-1px); }
.text-action { color: var(--paper); border-bottom: 1px solid var(--line); padding-block: 12px; }
.primary-action:focus-visible, .text-action:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }

.enter {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 168px;
  padding: 12px 0;
  border-bottom: 1px solid var(--signal);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  transition: color 220ms ease, transform 220ms ease;
}

.enter:hover { color: var(--signal); transform: translateX(5px); }
.enter:active { transform: translateX(5px) translateY(1px); }
.enter:focus-visible { outline: 2px solid var(--signal); outline-offset: 6px; }

.coordinates {
  position: absolute;
  right: clamp(20px, 4vw, 68px);
  bottom: 34px;
  display: grid;
  gap: 5px;
  text-align: right;
  color: rgba(183, 199, 109, 0.65);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.relativity-equation {
  position: absolute;
  top: 108px;
  right: clamp(20px, 5vw, 86px);
  color: rgba(23, 36, 29, 0.48);
  font-family: "Times New Roman", serif;
  font-size: clamp(14px, 1.35vw, 22px);
  letter-spacing: 0;
}

.relativity-equation sub,
.relativity-equation sup { font-size: 0.62em; }

.system {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(560px, 1.28fr);
  align-items: center;
  gap: clamp(42px, 6vw, 110px);
  min-height: 100dvh;
  padding-block: clamp(100px, 10vw, 150px);
  background: linear-gradient(90deg, rgba(237, 240, 230, 0.98) 0%, rgba(237, 240, 230, 0.9) 58%, rgba(237, 240, 230, 0.7) 100%);
}

.integration-copy h2,
.closing h2 {
  margin: 0;
  font-size: clamp(48px, 7vw, 110px);
  font-weight: 400;
  line-height: 0.9;
}

.integration-lead {
  max-width: 28rem;
  margin: 28px 0 0;
  color: rgba(23, 36, 29, 0.66);
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

.service-promises {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: clamp(54px, 7vw, 92px);
  border-top: 1px solid var(--line);
}

.service-promises div {
  display: grid;
  gap: 14px;
  padding: 22px 18px 8px 0;
}

.service-promises div + div {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.service-promises span {
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.service-promises strong {
  font-size: clamp(22px, 2.5vw, 38px);
  font-weight: 400;
  white-space: nowrap;
}

.supported-models {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 14px 20px;
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.supported-models span { grid-column: 1 / -1; color: var(--signal); font-size: 9px; }
.supported-models strong { font-size: clamp(18px, 2vw, 28px); font-weight: 500; }

.integration-stage {
  position: relative;
  min-height: 590px;
  isolation: isolate;
}

.orbit {
  position: absolute;
  z-index: -1;
  inset: 50% auto auto 50%;
  border: 1px solid rgba(82, 109, 0, 0.28);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-11deg);
  transition: transform 700ms cubic-bezier(0.16, 1, 0.3, 1), border-color 300ms ease;
}

.orbit::before,
.orbit::after {
  content: "";
  position: absolute;
  width: 9px;
  aspect-ratio: 1;
  border: 1px solid var(--signal);
  border-radius: 50%;
  background: var(--ink);
}

.orbit::before { top: 8%; left: 18%; }
.orbit::after { right: 13%; bottom: 12%; }
.orbit--outer { width: min(100%, 760px); aspect-ratio: 1.45; }
.orbit--inner { width: min(68%, 500px); aspect-ratio: 1.35; transform: translate(-50%, -50%) rotate(17deg); }
.integration-stage:has(.tool-node:hover) .orbit--outer { border-color: rgba(82, 109, 0, 0.62); transform: translate(-50%, -50%) rotate(-4deg) scale(1.02); }
.integration-stage:has(.tool-node:hover) .orbit--inner { border-color: rgba(82, 109, 0, 0.62); transform: translate(-50%, -50%) rotate(9deg) scale(0.97); }

.ccs-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-content: center;
  justify-items: center;
  width: 158px;
  aspect-ratio: 1;
  border: 1px solid var(--signal);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(237, 240, 230, 0.98) 0 16%, rgba(183, 199, 109, 0.76) 42%, rgba(82, 109, 0, 0.84) 100%);
  box-shadow: inset -16px -18px 30px rgba(23, 36, 29, 0.22), 0 0 0 12px rgba(82, 109, 0, 0.045);
  transform: translate(-50%, -50%);
}

.ccs-core::before,
.ccs-core::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.ccs-core::before {
  inset: 20%;
  border: 1px solid rgba(237, 240, 230, 0.44);
}

.ccs-core::after {
  top: 50%;
  left: 50%;
  width: 9px;
  aspect-ratio: 1;
  background: rgba(237, 240, 230, 0.82);
  box-shadow: 0 0 0 8px rgba(237, 240, 230, 0.12), 0 0 24px rgba(237, 240, 230, 0.54);
  transform: translate(-50%, -50%);
}

.planet {
  position: absolute;
  display: block;
  border: 1px solid var(--signal);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--ink) 0 15%, #a6b564 42%, #526d00 100%);
  box-shadow: inset -4px -5px 8px rgba(23, 36, 29, 0.28);
}

.planet--terra { right: 7%; bottom: 12%; width: 24px; aspect-ratio: 1; }
.planet--inner { top: 5%; left: 18%; width: 16px; aspect-ratio: 1; }

.moon-orbit {
  position: absolute;
  inset: -11px;
  border: 1px solid rgba(82, 109, 0, 0.34);
  border-radius: 50%;
}

.moon-orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 6px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  transform: translateY(-50%);
}

.tool-node {
  position: absolute;
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 10px 0;
  color: var(--paper);
  text-decoration: none;
  transform-origin: center;
  transition: color 220ms ease, transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-node::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -18px;
  width: 8px;
  aspect-ratio: 1;
  border: 1px solid var(--signal);
  opacity: 0;
  transform: translateY(-50%) rotate(45deg) scale(0.25);
  transition: opacity 220ms ease, transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-node::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 1px;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.tool-node:hover { color: var(--signal); transform: translateY(-5px) scale(1.08); }
.tool-node:hover::before { opacity: 1; transform: translateY(-50%) rotate(135deg) scale(1); }
.tool-node:hover::after { transform: scaleX(1); }
.tool-node:active { transform: translateY(-1px); }
.tool-node:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }
.tool-node span { color: var(--signal); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; }
.tool-node strong { font-family: system-ui, sans-serif; font-size: clamp(18px, 1.55vw, 24px); font-weight: 600; white-space: nowrap; }
.tool-node:nth-of-type(1) { top: 7%; left: 13%; }
.tool-node:nth-of-type(2) { top: 6%; right: 7%; }
.tool-node:nth-of-type(3) { top: 31%; left: 0; }
.tool-node:nth-of-type(4) { top: 31%; right: 0; }
.tool-node:nth-of-type(5) { bottom: 27%; left: 2%; }
.tool-node:nth-of-type(6) { right: 4%; bottom: 27%; }
.tool-node:nth-of-type(7) { bottom: 5%; left: 15%; }
.tool-node:nth-of-type(8) { right: 11%; bottom: 5%; }

.signal-readout { border-top: 1px solid var(--line); }

.signal-readout article {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 5px 20px;
  padding: 25px 0;
  border-bottom: 1px solid var(--line);
}

.signal-readout span {
  grid-row: 1 / 3;
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.signal-readout h3 { margin: 0; font-size: 21px; font-weight: 400; }

.signal-readout p {
  margin: 0;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

.closing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  background: linear-gradient(to top, rgba(237, 240, 230, 0.98), rgba(237, 240, 230, 0.62));
}

.closing > p {
  margin: 0 0 22px;
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.closing h2 { margin-bottom: 38px; }

.closing-line {
  position: absolute;
  left: 7vw;
  top: 22%;
  width: min(42vw, 600px);
  height: 1px;
  background: var(--signal);
  transform-origin: left;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 900ms cubic-bezier(0.16, 1, 0.3, 1), transform 900ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible { opacity: 1; transform: translateY(0); }

@keyframes boot {
  0% { opacity: 0.2; transform: scale(0.2) rotate(0deg); }
  45% { opacity: 1; transform: scale(1) rotate(180deg); }
  100% { opacity: 0; transform: scale(1.25) rotate(360deg); }
}

@keyframes noise-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(2%, -3%); }
  50% { transform: translate(-3%, 2%); }
  75% { transform: translate(3%, 3%); }
  100% { transform: translate(-2%, -2%); }
}

@keyframes title-glitch {
  0%, 89%, 100% { transform: translate(0); filter: none; }
  90% { transform: translate(4px, -1px) skewX(-2deg); filter: contrast(1.35); }
  92% { transform: translate(-5px, 1px) skewX(2deg); }
  94% { transform: translate(2px, 0); filter: contrast(1.1); }
  96% { transform: translate(0); filter: none; }
}

@keyframes scan-drift {
  to { background-position: 0 4px; }
}

@media (prefers-reduced-motion: no-preference) {
  .noise { animation: noise-shift 180ms steps(2) infinite; }
  .scanlines { animation: scan-drift 220ms linear infinite; }
  h1 { animation: title-glitch 4.6s steps(1) infinite; }
  .orbit--outer { animation: orbit-spin-outer 42s linear infinite; }
  .orbit--inner { animation: orbit-spin-inner 27s linear infinite; }
  .moon-orbit { animation: moon-spin 4.8s linear infinite; }
}

@keyframes orbit-spin-outer {
  from { transform: translate(-50%, -50%) rotate(-11deg); }
  to { transform: translate(-50%, -50%) rotate(349deg); }
}

@keyframes orbit-spin-inner {
  from { transform: translate(-50%, -50%) rotate(17deg); }
  to { transform: translate(-50%, -50%) rotate(-343deg); }
}

@keyframes moon-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
  .primary-nav a:not(.nav-console) { display: none; }
  .primary-nav .nav-console { padding: 8px 11px; font-size: 10px; }
  .hero, .system, .archive, .projects, .papers, .organizations, .closing { padding-inline: 20px; }
  .hero-copy { width: 100%; margin-top: 27vh; }
  h1 { font-size: clamp(44px, 15vw, 72px); line-height: 0.86; }
  .hero-statement { margin-top: 18px; font-size: clamp(22px, 7vw, 31px); }
  .lead { max-width: 92%; margin-block: 16px 22px; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 5px; }
  .system { grid-template-columns: 1fr; align-content: center; gap: 54px; padding-block: 100px; }
  .integration-copy h2, .archive-heading h2, .projects-heading h2, .papers-heading h2, .organizations-heading h2, .closing h2 { font-size: clamp(44px, 13vw, 68px); }
  .integration-lead { margin-top: 20px; }
  .service-promises { margin-top: 42px; }
  .service-promises strong { font-size: clamp(22px, 7vw, 30px); }
  .supported-models { margin-top: 28px; }
  .integration-stage {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }
  .orbit, .ccs-core { display: none; }
  .tool-node:nth-of-type(n) {
    position: relative;
    inset: auto;
    min-width: 0;
    min-height: 64px;
    padding: 14px 12px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .tool-node strong { overflow-wrap: anywhere; white-space: normal; font-size: clamp(15px, 4.4vw, 18px); }
  .archive-heading, .projects-heading, .papers-heading, .organizations-heading { margin-bottom: 64px; }
  .people-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person { min-height: 148px; padding: 14px; touch-action: manipulation; }
  .person h3 { margin-top: 26px; overflow-wrap: anywhere; font-size: 16px; }
  .project-stream { grid-template-columns: 1fr; }
  .project { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
  .project p { grid-column: 2; }
  .project:nth-child(4n + 2), .project:nth-child(4n + 3),
  .project.visible:nth-child(4n + 2), .project.visible:nth-child(4n + 3) { transform: translateY(0); }
  .organization { grid-template-columns: 28px minmax(0, 1fr); gap: 12px; }
  .organization h3 { font-size: clamp(31px, 10vw, 48px); }
  .organization p { grid-column: 2; }
  .paper-timeline { margin-left: 4px; }
  .paper { grid-template-columns: 30px 54px minmax(0, 1fr); gap: 10px; padding-left: 20px; }
  .paper h3 { grid-column: 3; font-size: 17px; }
  .paper p { grid-column: 3; }
  .profile-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    box-shadow: 8px 8px 0 rgba(82, 109, 0, 0.16);
  }
  .profile-dialog__body { padding: 28px 20px 34px; }
  .profile-dialog__body h2 { font-size: clamp(40px, 13vw, 58px); line-height: 0.92; }
  .profile-dialog__body h3 { margin-top: 22px; font-size: 15px; }
  .profile-dialog__body > p:last-child { font-size: 13px; line-height: 1.7; }
  .coordinates { right: 20px; }
  .relativity-equation { top: 82px; right: 20px; font-size: 13px; }
  .closing-line { left: 20px; width: calc(100% - 40px); }
}

@media (max-width: 420px) {
  .topbar { height: 60px; padding-inline: 14px; }
  .brand { gap: 8px; font-size: 12px; }
  .hero { padding-top: 60px; }
  .hero-copy { margin-top: 30vh; }
  .hero-statement { font-size: clamp(20px, 7vw, 27px); }
  .primary-action { min-width: 146px; }
  .lead { max-width: 25rem; font-size: 13px; line-height: 1.65; }
  .coordinates { right: 14px; bottom: 20px; }
  .relativity-equation { top: 74px; right: 14px; font-size: 11px; }
  .people-grid { grid-template-columns: 1fr; }
  .person { min-height: 122px; }
  .person h3 { margin-top: 18px; font-size: 18px; }
  .project { padding-block: 16px; }
  .paper { grid-template-columns: 26px 48px minmax(0, 1fr); padding-left: 16px; }
  .paper h3 { font-size: 16px; }
  .organization { padding-block: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

.docs-page { background: var(--ink); }
.docs-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(56, 76, 54, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 76, 54, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
}
.docs-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 860px);
  gap: clamp(50px, 8vw, 130px);
  max-width: 1240px;
  margin: 0 auto;
  padding: 128px 32px 120px;
}
.docs-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
  display: grid;
  border-top: 1px solid var(--line);
}
.docs-sidebar p { margin: 0; padding: 18px 0; color: var(--signal); font-family: ui-monospace, monospace; font-size: 9px; }
.docs-sidebar a { padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-family: system-ui, sans-serif; font-size: 13px; text-decoration: none; }
.docs-sidebar a:hover { color: var(--signal); }
.docs-hero { padding-bottom: 80px; border-bottom: 1px solid var(--line); }
.docs-hero p { margin: 0 0 20px; color: var(--signal); font-family: ui-monospace, monospace; font-size: 9px; }
.docs-hero h1 { margin: 0 0 24px; font-size: clamp(50px, 8vw, 96px); text-shadow: none; }
.docs-hero span { color: var(--muted); font-family: system-ui, sans-serif; font-size: 15px; }
.docs-common { padding-block: 72px; border-bottom: 1px solid var(--line); }
.docs-common h2, .tool-doc h2 { margin: 0; font-weight: 400; }
.docs-common h2 { font-size: clamp(32px, 5vw, 56px); }
.docs-common ol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin: 44px 0 0; padding: 0; list-style: none; }
.docs-common li { display: grid; gap: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.docs-common li > span, .tool-doc > span { color: var(--signal); font-family: ui-monospace, monospace; font-size: 9px; }
.docs-common strong { font-family: system-ui, sans-serif; font-size: 15px; }
.docs-common p, .tool-doc p { color: var(--muted); font-family: system-ui, sans-serif; line-height: 1.7; }
.docs-common p { margin: 8px 0 0; font-size: 12px; }
.docs-common .ccs-note {
  max-width: 52rem;
  margin-top: 34px;
  padding: 16px 18px;
  border-left: 2px solid var(--signal);
  background: rgba(82, 109, 0, 0.08);
  color: var(--paper);
  font-size: 13px;
}
.ccs-steps {
  margin-top: 30px;
}
.tool-doc { scroll-margin-top: 90px; padding: 70px 0; border-bottom: 1px solid var(--line); }
.tool-doc h2 { margin-top: 13px; font-size: clamp(40px, 6vw, 72px); }
.tool-doc p { max-width: 36rem; margin: 22px 0; font-size: 14px; }
.tool-doc code { display: block; padding: 16px 18px; background: var(--paper); color: var(--ink); font-family: ui-monospace, monospace; font-size: 11px; }
.endpoint-copy {
  display: flex;
  align-items: stretch;
  width: min(100%, 560px);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(23, 36, 29, 0.1);
}
.endpoint-label {
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-right: 1px solid rgba(237, 240, 230, 0.18);
  color: rgba(237, 240, 230, 0.68);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  white-space: nowrap;
}
.endpoint-copy code {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  border: 0;
  background: transparent;
}
.inline-endpoint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  vertical-align: middle;
}
.inline-endpoint > span {
  color: var(--paper);
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.copy-endpoint {
  appearance: none;
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid rgba(237, 240, 230, 0.22);
  background: var(--signal);
  color: var(--ink);
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  padding: 0 18px;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.inline-endpoint .copy-endpoint {
  min-height: 26px;
  border: 1px solid var(--signal);
  background: transparent;
  color: var(--signal);
  padding: 2px 10px;
}
.copy-endpoint:hover,
.copy-endpoint.copied {
  background: var(--paper);
  color: var(--ink);
}
.endpoint-copy .copy-endpoint:hover,
.endpoint-copy .copy-endpoint.copied {
  background: var(--ink);
  color: var(--paper);
}
.copy-endpoint:active { transform: translateY(1px); }
.copy-endpoint:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.key-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 16px;
  padding: 0 14px;
  border: 1px solid var(--signal);
  background: transparent;
  color: var(--signal);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}
.key-link:hover {
  background: var(--signal);
  color: var(--ink);
}
.key-link:active { transform: translateY(1px); }
.key-link:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.tool-steps {
  display: grid;
  gap: 30px;
  margin: 34px 0 28px;
}
.tool-steps--notice {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.tool-step {
  display: grid;
  gap: 13px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.tool-step strong {
  color: var(--paper);
  font-family: system-ui, sans-serif;
  font-size: 15px;
}
.tool-step p {
  margin: 0;
}
.tool-step img {
  display: block;
  width: 100%;
  max-width: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 18px 46px rgba(23, 36, 29, 0.16), 0 2px 0 rgba(255, 255, 255, 0.72) inset;
}

@media (max-width: 767px) {
  .docs-shell { grid-template-columns: 1fr; gap: 48px; padding: 98px 20px 80px; }
  .docs-sidebar { position: static; grid-template-columns: repeat(2, 1fr); }
  .docs-sidebar p { grid-column: 1 / -1; }
  .docs-sidebar a:nth-child(even) { border-right: 1px solid var(--line); }
  .docs-sidebar a { padding-inline: 10px; }
  .docs-hero { padding-bottom: 52px; }
  .docs-common { padding-block: 52px; }
  .docs-common ol { grid-template-columns: 1fr; }
  .tool-doc { padding-block: 52px; }
  .endpoint-copy { width: 100%; }
  .endpoint-label { padding-inline: 12px; font-size: 11px; }
  .endpoint-copy code { padding: 14px 13px; font-size: 10px; }
  .endpoint-copy .copy-endpoint { padding-inline: 13px; }
  .inline-endpoint { display: inline-grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; margin-top: 8px; }
  .key-link { width: 100%; }
  .tool-steps { gap: 24px; margin-top: 28px; }
  .tool-step { padding-bottom: 22px; }
}

.purchase-page {
  min-height: 100dvh;
  background:
    linear-gradient(rgba(56, 76, 54, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 76, 54, 0.045) 1px, transparent 1px),
    var(--ink);
  background-size: 48px 48px;
  color: var(--paper);
}

.purchase-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(237, 240, 230, 0.92), rgba(237, 240, 230, 0.64));
}

.purchase-page main,
.purchase-topbar {
  position: relative;
}

.purchase-shell {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 118px 0 80px;
}

.purchase-hero {
  max-width: 720px;
  margin-bottom: 42px;
}

.purchase-hero p,
.panel-heading p,
.order-summary > p {
  margin: 0;
  color: var(--signal);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.purchase-hero h1 {
  margin: 12px 0 16px;
  font-size: clamp(52px, 8vw, 112px);
  font-weight: 400;
  line-height: 0.9;
}

.purchase-hero span {
  display: block;
  max-width: 34rem;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.8;
}

.billing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 32px;
  align-items: start;
}

.billing-main {
  display: grid;
  gap: 22px;
}

.billing-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.36);
}

.billing-tabs button {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.billing-tabs .active {
  background: var(--paper);
  color: var(--ink);
}

.billing-panel,
.order-summary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.44);
  box-shadow: 0 18px 48px rgba(23, 36, 29, 0.08);
}

.billing-panel {
  padding: clamp(22px, 3vw, 34px);
}

.account-panel {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 18px;
}

.account-panel p {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

.account-panel strong {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: 0;
}

.account-panel .balance,
#after-balance {
  color: var(--signal);
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.panel-heading h2,
.order-summary h2 {
  margin: 7px 0 0;
  font-family: system-ui, sans-serif;
  font-size: 21px;
}

.panel-heading > span {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.amount-grid button {
  position: relative;
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  background: rgba(237, 240, 230, 0.72);
  color: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.amount-grid button:hover {
  border-color: var(--signal);
  transform: translateY(-2px);
}

.amount-grid button.active {
  border-color: var(--signal);
  background: rgba(82, 109, 0, 0.11);
  box-shadow: inset 0 0 0 1px var(--signal);
}

.amount-grid strong {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 27px;
}

.amount-grid span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

.amount-grid em {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 7px;
  background: var(--signal);
  color: var(--ink);
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.custom-amount {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  color: var(--paper);
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.custom-amount input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--paper);
  font: inherit;
}

.custom-amount input:focus {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.payment-method {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 2px 14px;
  width: 100%;
  min-height: 82px;
  padding: 18px;
  border: 1px solid var(--signal);
  background: rgba(82, 109, 0, 0.08);
  color: var(--paper);
  text-align: left;
}

.alipay-mark {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 42px;
  aspect-ratio: 1;
  background: #1778ff;
  color: white;
  font-family: system-ui, sans-serif;
  font-weight: 800;
}

.payment-method strong,
.payment-method small {
  font-family: system-ui, sans-serif;
}

.payment-method strong {
  font-size: 18px;
}

.payment-method small {
  color: var(--muted);
  font-size: 12px;
}

.order-summary {
  position: sticky;
  top: 94px;
  padding: 28px;
}

.order-summary dl {
  display: grid;
  gap: 0;
  margin: 28px 0;
  border-top: 1px solid var(--line);
}

.order-summary dl div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-family: system-ui, sans-serif;
}

.order-summary dt {
  color: var(--muted);
}

.order-summary dd {
  margin: 0;
  color: var(--paper);
  font-weight: 700;
  text-align: right;
}

.pay-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 15px;
  font-weight: 800;
  transition: background-color 180ms ease, transform 180ms ease, opacity 180ms ease;
}

.pay-button:not(:disabled):hover {
  background: var(--signal);
  transform: translateY(-1px);
}

.pay-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.billing-promises {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.billing-promises li {
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  line-height: 1.55;
}

.billing-promises li::before {
  content: "";
  display: inline-block;
  width: 7px;
  aspect-ratio: 1;
  margin-right: 9px;
  border: 1px solid var(--signal);
  transform: rotate(45deg);
}

.receipt-dialog {
  width: min(440px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  border: 0;
  background: transparent;
  color: #17201a;
  overflow: auto;
}

.receipt-dialog::backdrop {
  background: rgba(18, 28, 22, 0.68);
  backdrop-filter: blur(8px);
}

.receipt-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: 14px;
  color: #f4f7ef;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.receipt-success span {
  position: relative;
  display: block;
  width: 22px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #7a9a18;
}

.receipt-success span::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 5px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.receipt {
  position: relative;
  padding: 34px 32px 28px;
  background:
    radial-gradient(circle at 20% 18%, rgba(92, 67, 35, 0.055) 0 0.7px, transparent 1px),
    radial-gradient(circle at 72% 62%, rgba(92, 67, 35, 0.04) 0 0.8px, transparent 1.1px),
    #f4f1e8;
  background-size: 9px 11px, 13px 15px, auto;
  color: #17201a;
  box-shadow:
    0 28px 80px rgba(10, 18, 13, 0.32),
    inset 0 0 36px rgba(70, 65, 50, 0.055);
  filter: contrast(1.01);
}

.receipt::before,
.receipt::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 8px;
  background: linear-gradient(135deg, transparent 5px, #f4f1e8 0) 0 0 / 10px 10px repeat-x;
}

.receipt::before {
  top: -7px;
}

.receipt::after {
  bottom: -7px;
  transform: rotate(180deg);
}

.receipt-header {
  text-align: center;
}

.receipt-brand-mark {
  display: block;
  width: 24px;
  aspect-ratio: 1;
  margin: 0 auto 10px;
  border: 2px solid #526d00;
  box-shadow: inset 0 0 0 4px #f4f1e8, inset 0 0 0 5px #526d00;
  transform: rotate(45deg);
}

.receipt-header p,
.receipt-header h2,
.receipt-header small,
.receipt-footer p,
.receipt-footer small {
  margin: 0;
}

.receipt-header p {
  color: #526d00;
  font-family: "Courier New", Courier, monospace;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
}

.receipt-header h2 {
  margin-top: 7px;
  font-family: system-ui, sans-serif;
  font-size: 27px;
  font-weight: 850;
  letter-spacing: 2px;
  text-shadow: none;
}

.receipt-header small {
  display: block;
  margin-top: 8px;
  color: #69675f;
  font-family: "Courier New", Courier, monospace;
  font-size: 8px;
  letter-spacing: 0.8px;
}

.receipt-divider {
  height: 1px;
  margin: 24px 0;
  background: repeating-linear-gradient(90deg, #77746a 0 5px, transparent 5px 9px);
}

.receipt-divider--double {
  height: 5px;
  border-block: 1px solid #77746a;
  background: none;
}

.receipt-details,
.receipt-totals {
  display: grid;
  gap: 13px;
  margin: 0;
}

.receipt-details div,
.receipt-totals div {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  font-weight: 700;
}

.receipt-details dt,
.receipt-totals dt {
  color: #69675f;
}

.receipt-details dd,
.receipt-totals dd {
  margin: 0;
  text-align: right;
}

.ration-core {
  padding: 18px 12px;
  border: 1px solid #526d00;
  text-align: center;
}

.ration-core p,
.ration-core span {
  margin: 0;
  color: #526d00;
  font-family: "Courier New", Courier, monospace;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.4px;
}

.ration-core strong {
  display: block;
  margin: 5px 0 2px;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(31px, 10vw, 42px);
  line-height: 1;
  letter-spacing: -2px;
}

.receipt-rations {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.receipt-rations div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: "Courier New", Courier, monospace;
  font-size: 10px;
  font-weight: 700;
}

.receipt-rations dt {
  color: #69675f;
}

.receipt-rations dd {
  margin: 0;
}

.ration-allocation {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.ration-allocation p {
  display: grid;
  grid-template-columns: 88px 1fr 28px;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 8px;
}

.ration-allocation i {
  display: block;
  height: 6px;
  background:
    linear-gradient(90deg, #526d00 var(--ration), transparent var(--ration)),
    repeating-linear-gradient(90deg, #b8bcad 0 2px, transparent 2px 4px);
}

.ration-allocation b {
  text-align: right;
}

.receipt-totals div:first-child {
  align-items: baseline;
}

.receipt-totals div:first-child dd {
  color: #17201a;
  font-family: "Courier New", Courier, monospace;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -1px;
}

.receipt-stamp {
  width: 126px;
  aspect-ratio: auto;
  margin: 24px 0 8px auto;
  padding: 7px 8px;
  border: 2px solid rgba(82, 109, 0, 0.82);
  color: rgba(82, 109, 0, 0.9);
  font-family: "Courier New", Courier, monospace;
  font-size: 8px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  transform: rotate(-3deg);
  mix-blend-mode: multiply;
}

.receipt-stamp span {
  display: inline;
  margin-right: 5px;
  font-size: 16px;
  line-height: 1;
}

.receipt-footer {
  margin-top: 28px;
  text-align: center;
}

.receipt-footer p {
  font-family: system-ui, sans-serif;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2px;
}

.receipt-footer small {
  display: block;
  margin-top: 7px;
  color: #69675f;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 8px;
  line-height: 1.75;
}

.receipt-footer span {
  display: block;
  margin-top: 8px;
  color: #69675f;
  font-family: "Courier New", Courier, monospace;
  font-size: 8px;
  letter-spacing: 1px;
}

.receipt-fingerprint {
  width: 92px;
  aspect-ratio: 1;
  margin: 18px auto 0;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 52%, transparent 0 3px, #526d00 3px 4px, transparent 4px 7px),
    linear-gradient(90deg, transparent 47%, #f4f1e8 47% 53%, transparent 53%);
  opacity: 0.72;
}

.receipt-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.receipt-actions button {
  min-height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.receipt-print {
  background: #edf0e6;
  color: #17201a;
}

.receipt-close {
  background: #526d00;
  color: white;
}

.receipt-actions button:hover {
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .purchase-shell { width: min(100% - 32px, 680px); padding-top: 96px; }
  .billing-layout { grid-template-columns: 1fr; }
  .order-summary { position: static; }
  .account-panel { grid-template-columns: 1fr; }
  .amount-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .purchase-shell { width: calc(100% - 28px); }
  .purchase-hero h1 { font-size: 54px; }
  .panel-heading { align-items: start; flex-direction: column; gap: 8px; }
  .amount-grid { grid-template-columns: 1fr; }
  .billing-panel, .order-summary { padding: 20px; }
  .receipt { padding: 30px 22px 24px; }
  .receipt-details div, .receipt-totals div { font-size: 10px; }
  .receipt-actions { grid-template-columns: 1fr; }
}

@media print {
  @page {
    size: 80mm auto;
    margin: 0;
  }

  body.purchase-page {
    min-height: auto;
    background: white;
  }

  .purchase-page > :not(.receipt-dialog),
  .receipt-success,
  .receipt-actions {
    display: none !important;
  }

  .receipt-dialog[open] {
    position: static;
    display: block;
    width: 80mm;
    max-height: none;
    margin: 0;
    overflow: visible;
  }

  .receipt {
    width: 80mm;
    padding: 8mm 6mm;
    box-shadow: none;
  }

  .receipt::before,
  .receipt::after {
    display: none;
  }
}
