/* THE INSIDOOR — 1-bit terminal system. Three colors, ever. See docs/DESIGN.md. */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700;800&display=swap');
/* Berkeley Mono is licensed. It's already first in the font stack, so a system
   install wins automatically. To self-host the webfont, drop BerkeleyMono-Regular.woff2
   into public/fonts/ and uncomment:
@font-face { font-family: 'Berkeley Mono'; src: url('/fonts/BerkeleyMono-Regular.woff2') format('woff2'); font-display: swap; } */

:root {
  --bg: #FAFAF7;
  --ink: #0A0A0A;
  --live: #C6FF00;
  --dim: .5;
  --cell: 1ch;
}
html[data-theme="dark"] { --bg: #000000; --ink: #FAFAF7; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { --bg: #000000; --ink: #FAFAF7; } }

* { margin: 0; padding: 0; box-sizing: border-box; border-radius: 0 !important; }
::selection { background: var(--ink); color: var(--bg); }

html { font-size: 14px; }
body {
  background: var(--bg); color: var(--ink);
  font-family: 'Berkeley Mono', 'JetBrains Mono', 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-variant-numeric: tabular-nums; line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover, button:hover { background: var(--ink); color: var(--bg); }
button { font: inherit; background: var(--bg); color: var(--ink); border: 1px solid var(--ink); padding: 2px 8px; cursor: pointer; text-transform: uppercase; letter-spacing: .08em; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; }

h1, h2, h3, .caps { text-transform: uppercase; letter-spacing: .08em; line-height: 1.1; }
h1 { font-size: 42px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 12px; font-weight: 700; }
small, .small { font-size: 12px; }
.dim { opacity: var(--dim); }
.mark { background: var(--ink); color: var(--bg); padding: 0 .5ch; }

/* ---- grain: faint animated fractal noise over everything ---- */
.grain {
  position: fixed; inset: -50px; pointer-events: none; z-index: 9; opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .6s steps(3) infinite;
}
html[data-theme="dark"] .grain, body .grain { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .grain { mix-blend-mode: screen; } }
html[data-theme="dark"] .grain { mix-blend-mode: screen; }
@keyframes grain { 0% { transform: translate(0,0) } 34% { transform: translate(-14px,9px) } 67% { transform: translate(11px,-7px) } 100% { transform: translate(0,0) } }
@media (prefers-reduced-motion: reduce) { .grain, .cursor, .ticker-strip, .live-dot { animation: none !important; } }

/* ---- layout ---- */
.wrap { max-width: 104ch; margin: 0 auto; padding: 0 2ch 6ch; }
.rule { border: 0; border-top: 1px solid var(--ink); margin: 0; }
.rule2 { border: 0; border-top: 2px solid var(--ink); margin: 0; }
.ascii-divider { overflow: hidden; white-space: nowrap; opacity: var(--dim); font-size: 12px; user-select: none; }

/* ---- ticker ---- */
.ticker { border-bottom: 2px solid var(--ink); overflow: hidden; white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.ticker-strip { display: inline-block; padding: 3px 0; animation: tick 40s linear infinite; }
.ticker:hover .ticker-strip { animation-play-state: paused; }
@keyframes tick { from { transform: translateX(0) } to { transform: translateX(-50%) } }
.ticker b { font-weight: 700; }

/* ---- masthead ---- */
.masthead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2ch; padding: 12px 0 8px; }
.masthead .spacer { flex: 1; }
.statusline { display: flex; flex-wrap: wrap; gap: 2ch; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 0 10px; }
.live-dot { display: inline-block; width: 8px; height: 8px; background: var(--ink); opacity: .35; vertical-align: baseline; }
.live-dot.on { background: var(--live); opacity: 1; animation: blink 2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25 } }

/* ---- panels: bordered, labeled, dense ---- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2ch; margin-top: 2ch; }
.panel { border: 2px solid var(--ink); position: relative; background: var(--bg); min-width: 0; }
.panel > .plabel {
  position: absolute; top: -9px; left: 1.5ch; background: var(--bg); padding: 0 1ch;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
}
.panel > .pbody { padding: 14px 1.5ch 10px; }
.c12 { grid-column: span 12 } .c8 { grid-column: span 8 } .c7 { grid-column: span 7 }
.c6 { grid-column: span 6 } .c5 { grid-column: span 5 } .c4 { grid-column: span 4 }
@media (max-width: 860px) { .grid > * { grid-column: span 12 } h1 { font-size: 28px } }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; border-bottom: 1px solid var(--ink); padding: 3px 1ch 3px 0; }
td { padding: 4px 1ch 4px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); vertical-align: top; }
tr:hover td { background: var(--ink); color: var(--bg); }
td.num, th.num { text-align: right; }

/* ---- the tape ---- */
.tape { font-size: 13px; max-height: 46ch; overflow-y: auto; scrollbar-width: thin; }
.tape-line { display: flex; gap: 1ch; padding: 2px 0; border-bottom: 1px solid color-mix(in srgb, var(--ink) 10%, transparent); }
.tape-line .t { opacity: var(--dim); flex: 0 0 9ch; }
.tape-line .k { flex: 0 0 9ch; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; padding-top: 1px; }
.tape-line .m { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tape-line.fill .k, .tape-line.breaker .k { background: var(--ink); color: var(--bg); padding: 0 .5ch; align-self: flex-start; }
.tape-line.fees .k { outline: 1px solid var(--ink); }
.tape-line.new .m::after { content: ''; display: inline-block; width: 7px; height: 12px; background: var(--live); margin-left: 1ch; vertical-align: -1px; }
.cursor { display: inline-block; width: .9ch; background: var(--ink); animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0 } }

/* ---- scoreboard ---- */
.bignum { font-size: 28px; font-weight: 800; letter-spacing: 0; }
.statrow { display: flex; justify-content: space-between; gap: 2ch; border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); padding: 4px 0; font-size: 13px; }
.statrow b { font-weight: 700; }
canvas.chart { width: 100%; height: 110px; display: block; image-rendering: pixelated; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 8px 0 4px; }
.chart-cap { display: flex; justify-content: space-between; font-size: 11px; opacity: var(--dim); }

/* ---- journal / posts ---- */
.entry { border-bottom: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); padding: 6px 0; font-size: 13px; }
.entry .t { font-size: 11px; opacity: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.entry .body { overflow-wrap: anywhere; }

/* ---- 1-bit artwork ----
   Dither must never be resampled smoothly or it turns to mush: nearest-neighbour only.
   The LOGO is line art, so it inverts cleanly to sit on either ground. The EYE is a
   photographic plate — it keeps its polarity in both themes (a negative eye reads wrong)
   and is framed like a printed plate instead. */
.bw { display: block; max-width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; }
/* The mark ships as two real assets, not one inverted: on paper it's line art (open head,
   black outline); on black it's the filled white head. A naive invert would turn the head
   into a black silhouette on black, which is not the logo. */
.bw-mark { content: url('/img/mark.png'); }
html[data-theme="dark"] .bw-mark { content: url('/img/mark-dark.png'); }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) .bw-mark { content: url('/img/mark-dark.png'); } }
.plate { border: 2px solid var(--ink); margin-top: 3ch; background: #000; }
.plate img { width: 100%; }
.plate figcaption {
  border-top: 2px solid var(--ink); background: var(--bg); color: var(--ink);
  padding: 5px 1.5ch; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  display: flex; justify-content: space-between; gap: 2ch; flex-wrap: wrap;
}
.masthead-mark { width: 26px; height: 26px; flex: 0 0 auto; align-self: center; }

/* ---- nav items (CA + handle) ---- */
.navitem {
  font: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg); color: var(--ink); border: 1px solid var(--ink);
  padding: 2px 8px; cursor: pointer; text-decoration: none; white-space: nowrap;
  align-self: center;
}
.navitem:hover { background: var(--ink); color: var(--bg); }
#ca[data-state="soon"] { opacity: var(--dim); cursor: default; }
#ca[data-state="soon"]:hover { background: var(--bg); color: var(--ink); }
#ca[data-state="copied"] { background: var(--ink); color: var(--bg); }

/* ---- landing ---- */
.hero { padding: 6ch 0 3ch; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4ch; align-items: end; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero .door { justify-self: end; }
.tagline { font-size: 16px; max-width: 62ch; margin-top: 2ch; }
.pitch { max-width: 66ch; }
pre.diagram { font-size: 12px; line-height: 1.35; overflow-x: auto; padding: 12px 1.5ch; }
.bayer-band { height: 56px; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 3ch; font-size: 13px; }
.kv dt { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; opacity: var(--dim); padding-top: 2px; }
.kv dd { overflow-wrap: anywhere; }
.btnrow { display: flex; gap: 2ch; flex-wrap: wrap; margin-top: 2ch; }
.btnrow a { border: 2px solid var(--ink); padding: 8px 2ch; text-decoration: none; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 13px; }

footer { margin-top: 4ch; border-top: 2px solid var(--ink); padding-top: 1.5ch; font-size: 11px; }
footer p { max-width: 90ch; opacity: var(--dim); margin-bottom: 6px; }
.addr { overflow-wrap: anywhere; }
