:root {
  --ink: #121212;
  --paper: #f4f1ea;
  --paper-2: #ebe6dc;
  --muted: #5c5a55;
  --line: #2a2a2a;
  --green: #2f9e44;
  --blue: #1c7ed6;
  --warn: #e67700;
  --error: #e03131;
  --crt-bg: #0d120f;
  --crt-fg: #7dffa3;
  --crt-dim: #3d7a52;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --stamp: 'Special Elite', 'IBM Plex Mono', serif;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, rgba(18, 18, 18, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(18, 18, 18, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  line-height: 1.55;
  overflow-x: hidden;
}

.grain,
.scan {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
}

.grain {
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.scan {
  opacity: 0.06;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.35) 3px
  );
  animation: scan-drift 8s linear infinite;
}

@keyframes scan-drift {
  from { transform: translateY(0); }
  to { transform: translateY(4px); }
}

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.25rem 3.5rem;
  position: relative;
}

.boot {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 92vw);
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-align: left;
  min-height: 1.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo {
  width: min(340px, 72vw);
  height: auto;
  animation: stamp-in 900ms cubic-bezier(0.2, 0.9, 0.2, 1.2) both;
  filter: drop-shadow(3px 4px 0 rgba(18, 18, 18, 0.08));
}

@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: scale(1.12) rotate(-2deg);
    filter: brightness(1.4);
  }
  60% {
    opacity: 1;
    transform: scale(0.98) rotate(0.4deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  letter-spacing: 0.02em;
  min-height: 1.6em;
}

.lede {
  max-width: 28rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  animation: fade-up 700ms 500ms both;
}

.byline {
  margin: 0.75rem 0 0;
  font-family: var(--stamp);
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  animation: fade-up 700ms 600ms both;
}

.lede code {
  color: var(--ink);
  background: var(--paper-2);
  padding: 0.05rem 0.3rem;
  border: 1px solid rgba(18, 18, 18, 0.15);
}

.cta-row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 1.75rem 0 0;
  animation: fade-up 700ms 700ms both;
}

.cta {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border: 2px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.cta:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.cta:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.cta.ghost {
  background: transparent;
  box-shadow: 2px 2px 0 var(--ink);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.caret {
  display: inline-block;
  width: 0.55ch;
  height: 1.05em;
  margin-left: 1px;
  background: var(--ink);
  vertical-align: text-bottom;
  animation: blink 1.05s steps(1) infinite;
}

.caret.blink-slow {
  animation-duration: 1.35s;
}

@keyframes blink {
  0%,
  45% { opacity: 1; }
  50%,
  100% { opacity: 0; }
}

main {
  width: min(780px, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 4rem;
}

.section {
  margin: 0 0 3.5rem;
  padding-top: 0.5rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.section.in {
  opacity: 1;
  transform: none;
}

.section h2 {
  font-family: var(--stamp);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.num {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--muted);
  padding: 0.1rem 0.35rem;
}

.section-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -0.35rem 0 1rem;
}

.section-note kbd,
.section-note code {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(18, 18, 18, 0.2);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
}

.terminal {
  border: 2px solid var(--ink);
  background: #1a1a1a;
  color: #e8e4d9;
  box-shadow: 4px 4px 0 var(--ink);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  background: #2a2a2a;
  border-bottom: 1px solid #3a3a3a;
  font-size: 0.72rem;
  color: #a8a29a;
}

.terminal-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #555;
  border: 1px solid #222;
}

.terminal-bar span:nth-child(1) { background: #e03131; }
.terminal-bar span:nth-child(2) { background: #f08c00; }
.terminal-bar span:nth-child(3) { background: #2f9e44; }

.terminal-bar em {
  margin-left: 0.55rem;
  font-style: normal;
}

.terminal-body {
  margin: 0;
  padding: 1rem 1.1rem 1.15rem;
  font-size: 0.82rem;
  line-height: 1.65;
  min-height: 7.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-body.static {
  min-height: 0;
}

.terminal-body .kw { color: #74c0fc; }
.terminal-body .str { color: #8ce99a; }
.terminal-body .cm { color: #868e96; }
.terminal-body .fn { color: #ffd43b; }

.steps {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.85rem;
  padding: 0.85rem 1rem;
  border: 1.5px dashed var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  grid-row: span 2;
  align-self: center;
  font-size: 0.75rem;
  color: var(--blue);
  border: 1px solid var(--blue);
  padding: 0.2rem 0.35rem;
}

.steps strong {
  font-weight: 600;
}

.steps span {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.85rem;
}

.crt {
  border: 3px solid var(--ink);
  background: var(--crt-bg);
  box-shadow:
    5px 5px 0 var(--ink),
    inset 0 0 40px rgba(0, 0, 0, 0.45);
  position: relative;
  overflow: hidden;
}

.crt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
  pointer-events: none;
}

.crt-header {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--crt-dim);
  color: var(--crt-dim);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.crt-body {
  padding: 1rem 1rem 1.35rem;
  min-height: 18rem;
  max-height: 26rem;
  overflow-y: auto;
  font-size: 0.8rem;
  color: var(--crt-fg);
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.crt-line {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0.85rem 0 0.15rem;
  opacity: 0;
  animation: crt-in 350ms ease forwards;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 1px solid rgba(61, 122, 82, 0.18);
}

.crt-line:first-child {
  padding-top: 0.35rem;
}

.crt-line:last-child {
  border-bottom: none;
  padding-bottom: 0.35rem;
}

@keyframes crt-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.crt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0;
  line-height: 1.4;
}

.crt-time {
  color: var(--crt-dim);
  letter-spacing: 0.04em;
  margin-right: 0.55rem;
}

.crt-mark {
  color: var(--crt-dim);
  font-weight: 700;
  margin-right: 0.45rem;
}

.crt-badge {
  display: inline-block;
  padding: 0.18rem 0.5rem;
  margin: 0 0.55rem 0 0;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #04140a;
}

.crt-badge.name {
  background: #111827;
  color: #f9fafb;
}

.crt-badge.debug { background: #4b5563; color: #f9fafb; }
.crt-badge.log { background: #2563eb; color: #fff; }
.crt-badge.info { background: #16a34a; color: #fff; }
.crt-badge.warn { background: #d97706; color: #111827; }
.crt-badge.error { background: #dc2626; color: #fff; }

.crt-msg {
  color: var(--crt-fg);
  line-height: 1.55;
  padding-left: 0.05rem;
  opacity: 0.95;
}

.sample-grid {
  display: grid;
  gap: 0.85rem;
}

.sample-grid button {
  appearance: none;
  width: 100%;
  text-align: left;
  font: 500 0.82rem/1.45 var(--mono);
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  padding: 0.9rem 1rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.sample-grid button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.sample-grid button:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.badge {
  display: inline-block;
  min-width: 3.5rem;
  margin-right: 0.5rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-align: center;
  color: #fff;
}

.badge.debug { background: #868e96; }
.badge.log { background: var(--blue); }
.badge.info { background: var(--green); }
.badge.warn { background: var(--warn); color: #111; }
.badge.error { background: var(--error); }
.badge.name { background: var(--ink); }

.dom-stage {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1.5px dashed var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

.dom-stage p {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

#demo-target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 8rem;
  min-height: 2.4rem;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--ink);
  background: #e6fcf5;
  font-size: 0.82rem;
}

.compare-row {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 700px) {
  .compare-row {
    grid-template-columns: 1fr 1fr;
  }
}

.compare-col {
  border: 2px solid var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
}

.compare-col h3 {
  margin: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--ink);
  background: var(--paper-2);
}

.compare-col.after h3 {
  background: #d3f9d8;
}

.compare-col pre {
  margin: 0;
  padding: 0.85rem 0.9rem;
  font-size: 0.75rem;
  line-height: 1.55;
  overflow-x: auto;
}

.footer {
  text-align: center;
  padding: 2.5rem 1rem 3.5rem;
  border-top: 2px solid rgba(18, 18, 18, 0.15);
  background: rgba(255, 255, 255, 0.35);
}

.footer img {
  width: 96px;
  height: auto;
  opacity: 0.95;
}

.footer-tag {
  font-family: var(--stamp);
  font-size: 1.15rem;
  margin: 0.5rem 0 0;
}

.footer .byline {
  margin: 0.35rem 0 0.85rem;
  animation: none;
}

.footer-copy {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .section {
    opacity: 1;
    transform: none;
  }

  .scan,
  .grain {
    display: none;
  }
}
