/* Self-hosted fonts (SIL OFL 1.1, see /fonts/OFL-*.txt). Latin subset only. */
@font-face {
  font-family: "Open Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/fonts/open-sans-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/courier-prime-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Courier Prime"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/courier-prime-latin-700.woff2") format("woff2");
}

/* Layout: a 1984 software-company catalog typeset on an amber terminal. Dark by default, a light
   "printed brochure" mode on request. One column, Z-machine status line pinned to the top,
   products as a catalog table. The lamp is the only color. */
:root {
  --paper: #0e1116;
  --ink: #e6dfcf;
  --ink-2: #9a9688;
  --rule: #2a2f38;
  --panel: #151a21;
  --lamp: #f2a33a;
  --lamp-text: #f2a33a;
  --lamp-glow: rgba(242, 163, 58, .16);
  --status-bg: #e6dfcf;
  --status-fg: #0e1116;
  --scan: .07;
  --display: "Segoe UI Variable Display", "Segoe UI", "Open Sans", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --paper: #f3f1ea; --ink: #17202a; --ink-2: #4b5563; --rule: #c9c6bb; --panel: #e8e5da;
  --lamp: #d98b1e; --lamp-text: #8a5208; --lamp-glow: rgba(217, 139, 30, .18);
  --status-bg: #17202a; --status-fg: #f3f1ea;
  --scan: 0;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 48px); }
img { max-width: 100%; }
body {
  margin: 0;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--status-bg);
}
/* Faint scanlines; off in light mode via the token */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 8;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.35) 2px 3px);
  opacity: var(--scan);
}
a { color: inherit; text-decoration-color: var(--lamp); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--lamp-text); }
:focus-visible { outline: 3px solid var(--lamp); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: -100px; z-index: 11;
  background: var(--lamp); color: var(--paper); font-family: var(--mono); padding: 8px 12px; }
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 48px); }
@media (max-width: 560px) { .hero { padding-block: 44px 36px; } .section { padding-block: 36px 0; } }

/* Status line, Z-machine style */
.status {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9;
  background: var(--status-bg); color: var(--status-fg);
  font-family: var(--mono); font-size: 15px; line-height: 1;
  padding-block: 6px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  white-space: nowrap; overflow: hidden;
}
.status span { font-variant-numeric: tabular-nums; }
.status .right { display: flex; align-items: center; gap: 2.2em; }
.status button {
  font: inherit; color: inherit; background: none; border: 1px solid currentColor;
  padding: 7px 12px; min-height: 32px; cursor: pointer; letter-spacing: .04em;
}
.status button:hover { background: var(--lamp); border-color: var(--lamp); color: var(--status-bg); }
@media (max-width: 560px) { .status .score { display: none; } }

.wrap {
  max-width: 880px; margin: 0 auto;
  padding-block: 0 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Hero */
.hero { padding-block: 72px 48px; border-bottom: 2px solid var(--ink); }
.eyebrow {
  font-family: var(--mono); font-size: 14px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2); margin: 0 0 20px;
}
.wordmark {
  margin: 0; font-weight: 900;
  font-size: clamp(40px, 10.5vw, 120px); line-height: 1; letter-spacing: -.025em;
  white-space: nowrap; padding-left: .06em;
}
.wordmark em { font-style: normal; color: var(--lamp-text); text-shadow: 0 0 24px var(--lamp-glow); }
.tagline {
  margin: 28px 0 0; max-width: 36ch;
  font-size: clamp(22px, 3.2vw, 30px); line-height: 1.25; font-weight: 500; text-wrap: balance;
}
.lede { margin: 20px 0 0; color: var(--ink-2); font-size: 17px; }

/* Transcript */
.transcript-wrap { margin: 40px 0 0; }
.transcript {
  margin: 0;
  font-family: var(--mono); font-size: 16px; line-height: 1.5;
  background: var(--panel); border: 1px solid var(--rule);
  padding: 20px 22px; white-space: pre-wrap; overflow-x: auto;
  box-shadow: 0 0 0 6px var(--lamp-glow);
}
.transcript .cmd { font-weight: 700; }
.transcript .lit { color: var(--lamp-text); font-weight: 700; }
.cursor { display: inline-block; width: .6em; height: 1.05em; vertical-align: -.15em; background: var(--lamp); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }

/* Section heads */
.section { padding-block: 48px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 8px;
}
.section-head h2 {
  margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.section-head .note { font-family: var(--mono); font-size: 14px; color: var(--ink-2); }

/* Catalog */
.catalog { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 220px 1fr auto; grid-template-rows: auto auto 1fr;
  gap: 6px 24px; align-items: baseline;
  padding-block: 26px; border-bottom: 1px solid var(--rule);
}
.item .thumb {
  grid-column: 1; grid-row: 1 / -1; align-self: start;
  width: 100%; max-width: 100%; aspect-ratio: 1200 / 630; height: auto; display: block;
  border: 1px solid var(--rule); background: var(--panel); object-fit: cover;
}
.item .thumb-empty {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
  border-style: dashed; font-family: var(--mono); font-size: 13px; color: var(--ink-2); text-align: center; padding: 8px;
}
.item .thumb-empty span:first-child { font-weight: 700; color: var(--ink); }
.item .thumb-note { letter-spacing: .06em; text-transform: uppercase; font-size: 11px; }
.item:last-child { border-bottom: 0; }
.item { position: relative; }
/* The frotz glow: a layer behind the card that fades up slowly, then breathes. */
.item.linked { z-index: 0; }
.item.linked::before {
  content: ""; position: absolute; inset: -12px; z-index: -1; pointer-events: none;
  background: var(--panel); border: 1px solid var(--lamp);
  box-shadow: 0 0 28px 10px var(--lamp-glow), 0 0 90px 24px var(--lamp-glow);
  opacity: 0; transition: opacity 1.6s ease-out;
}
.item.linked:hover::before, .item:has(.name a:focus-visible)::before {
  opacity: 1; animation: breathe 2.8s ease-in-out 1.6s infinite alternate;
}
.item.linked:hover .name a, .item:has(.name a:focus-visible) .name a { color: var(--lamp-text); text-shadow: 0 0 18px var(--lamp-glow); transition: color 1.2s ease, text-shadow 1.2s ease; }
.item.linked .name a { transition: color .5s ease, text-shadow .5s ease; }
.item.linked:hover .sku::after { content: "  (providing light)"; }
@keyframes breathe {
  from { box-shadow: 0 0 28px 10px var(--lamp-glow), 0 0 90px 24px var(--lamp-glow); }
  to   { box-shadow: 0 0 44px 16px var(--lamp-glow), 0 0 130px 36px var(--lamp-glow); }
}
@media (prefers-reduced-motion: reduce) {
  .item.linked::before { transition: none; }
  .item.linked:hover::before, .item:has(.name a:focus-visible)::before { animation: none; }
}
.item .name a::after { content: ""; position: absolute; inset: 0; }
.item .name a:focus-visible { outline: none; }
.item .name a::before { content: " \2197"; float: right; font-weight: 400; color: var(--ink-2); font-size: .7em; margin-left: .4em; }
.item .sku { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.item .name { grid-column: 2; grid-row: 2; }
.item .badge { grid-column: 3; grid-row: 2; }
.item .name { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.item .name a { text-decoration: none; }
.item .name a:hover { text-decoration: underline; text-decoration-color: var(--lamp); }
.item .desc { margin: 6px 0 0; grid-column: 2 / -1; grid-row: 3; color: var(--ink-2); max-width: 56ch; min-width: 0; }
.badge {
  font-family: var(--mono); font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 9px; border: 1px solid currentColor; white-space: nowrap; justify-self: end;
}
.badge.live { color: var(--lamp-text); border-color: var(--lamp); background: var(--lamp-glow); }
.badge.dev { color: var(--ink); }
.badge.plan { color: var(--ink-2); border-style: dashed; }
@media (max-width: 720px) {
  .item { grid-template-columns: 1fr auto; grid-template-rows: auto auto auto auto; gap: 8px 16px; }
  .item .thumb { grid-column: 1 / -1; grid-row: 1; margin-bottom: 6px; }
  .item .sku { grid-column: 1 / -1; grid-row: 2; }
  .item .name { grid-column: 1; grid-row: 3; }
  .item .badge { grid-column: 2; grid-row: 3; }
  .item .desc { grid-column: 1 / -1; grid-row: 4; }
}

/* About */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.about p { margin: 0 0 14px; max-width: 54ch; }
.about code { font-family: var(--mono); color: var(--lamp-text); }
.about .facts { font-family: var(--mono); font-size: 15px; border-left: 3px solid var(--lamp); padding-left: 18px; align-self: start; }
.about .facts dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.about .facts dt { color: var(--ink-2); }
.about .facts dd { margin: 0; }
@media (max-width: 680px) { .about { grid-template-columns: 1fr; } }

/* Footer */
footer {
  margin-top: 64px; padding-top: 20px; border-top: 2px solid var(--ink);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 14px; color: var(--ink-2);
}
footer .links { display: flex; gap: 20px; flex-wrap: wrap; }
footer a { text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Typed commands in prose */
.lede kbd { font-family: var(--mono); font-size: .95em; color: var(--ink); white-space: nowrap; }
.lede + .lede { margin-top: 14px; }

/* Field guide */
.glossary dl { margin: 0; display: grid; grid-template-columns: 12rem 1fr; }
.glossary dt, .glossary dd { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.glossary dt { font-family: var(--mono); font-weight: 700; color: var(--lamp-text); padding-right: 20px; }
.glossary dd { margin: 0; color: var(--ink-2); max-width: 60ch; }
.glossary dt:last-of-type, .glossary dd:last-of-type { border-bottom: 0; }
.glossary code { font-family: var(--mono); color: var(--ink); }
@media (max-width: 560px) {
  .glossary dl { grid-template-columns: 1fr; }
  .glossary dt { border-bottom: 0; padding-bottom: 2px; }
  .glossary dd { padding-top: 0; }
}

/* 404 page */
.lost .hero { border-bottom: 0; padding-bottom: 0; }
.lost .actions { margin: 32px 0 0; font-family: var(--mono); }
.lost .actions a { color: var(--lamp-text); }
