/* ACIDENIA — base layer: reset, type, shared components */

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

html {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  scrollbar-color: var(--ink-500) var(--void);
  scrollbar-width: thin;
}

body { margin: 0; min-height: 100vh; background: var(--void); overflow-x: hidden; }

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
canvas { display: block; }
::selection { background: var(--stage); color: var(--stage-ink); }

:focus-visible { outline: 2px solid var(--stage); outline-offset: 3px; border-radius: 4px; }

/* ── type ─────────────────────────────────────────────── */

.display {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--text-dim); }
.mute { color: var(--text-mute); }
.stage-ink { color: var(--stage); }

/* ── the 3D canvas sits behind everything ─────────────── */

.world {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  outline: none;
}

/* Film grain. On 3D pages the grain is done inside the lens shader (in lock-step with the frame).
   This DOM version is for flat pages only and is deliberately STATIC with NO blend mode:
   an animated mix-blend layer over a live canvas forces a full-page re-blend every frame and tears. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ── glass panel (HUD over the 3D world) ──────────────── */

.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--petal);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
/* a hairline of stage colour along the leading edge */
.glass::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--stage) 75%, transparent), transparent 32%, transparent 70%, color-mix(in srgb, var(--stage-2) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  opacity: 0.8;
}

/* ── buttons ──────────────────────────────────────────── */

.btn {
  --btn-bg: var(--stage);
  --btn-fg: var(--stage-ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 1.05em 1.7em;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border-radius: var(--petal);
  isolation: isolate;
  transition: transform var(--t-med) var(--ease-bloom), border-radius var(--t-med) var(--ease-bloom), box-shadow var(--t-med) var(--ease-bloom);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--btn-bg) 60%, transparent), 0 14px 40px -14px color-mix(in srgb, var(--btn-bg) 80%, transparent);
}
.btn:hover {
  transform: translateY(-2px);
  border-radius: var(--petal-flip);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--btn-bg) 16%, transparent), 0 22px 60px -14px color-mix(in srgb, var(--btn-bg) 90%, transparent);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn .arrow { transition: transform var(--t-med) var(--ease-bloom); }
.btn:hover .arrow { transform: translateX(5px); }

.btn--ghost {
  --btn-fg: var(--text);
  background: rgba(10, 8, 20, 0.55);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn--ghost:hover { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.05); border-color: var(--stage); color: var(--stage); }
.btn--sm { padding: 0.7em 1.1em; font-size: 0.66rem; border-radius: var(--petal-sm); }

/* ── chips / pills ────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.42em 0.85em;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(8, 6, 15, 0.62);   /* solid-ish, no backdrop-filter: chips live inside fading groups */
  white-space: nowrap;
}
.chip--stage { color: var(--stage); border-color: color-mix(in srgb, var(--stage) 55%, transparent); }
.chip--solid { color: var(--stage-ink); background: var(--stage); border-color: transparent; font-weight: 700; }

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--stage);
  box-shadow: 0 0 0 0 var(--stage);
  animation: live 1.6s ease-out infinite;
  flex: none;
}
.live-dot--red { background: var(--danger); box-shadow: 0 0 0 0 var(--danger); animation-name: live-red; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--stage) 80%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@keyframes live-red { 0% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.8); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* ── header ───────────────────────────────────────────── */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.wordmark__glyph {
  width: 30px; height: 30px; flex: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--void) 0 9%, var(--stage) 10% 34%, transparent 35%),
    repeating-radial-gradient(circle at 50% 50%, #15121f 0 1px, #05040a 1px 2.4px);
  box-shadow: 0 0 22px -2px color-mix(in srgb, var(--stage) 70%, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  animation: spin 1.8s linear infinite;
  position: relative;
}
.wordmark__glyph::after { /* the sheen on the record */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 20deg, transparent 0 8%, rgba(255,255,255,0.35) 12%, transparent 18% 58%, rgba(255,255,255,0.22) 62%, transparent 68%);
  animation: spin 1.8s linear infinite reverse; /* sheen stays still while the disc turns */
}
@keyframes spin { to { transform: rotate(360deg); } }

.site-nav { display: flex; align-items: center; gap: 30px; font-size: 0.82rem; font-weight: 500; color: var(--text-dim); }
.site-nav a { position: relative; padding: 6px 0; transition: color var(--t-fast); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--stage); transform: scaleX(0); transform-origin: left;
  transition: transform var(--t-med) var(--ease-bloom);
}
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }

.header-right { display: flex; align-items: center; gap: 14px; }
/* who is signed in (only drawn when a server is behind the page) */
.acct { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); white-space: nowrap; }
.acct[hidden] { display: none; }
.acct b { color: var(--text); font-weight: 500; }
.acct button, .acct a { text-transform: inherit; letter-spacing: inherit; text-decoration: underline; text-underline-offset: 3px; transition: color var(--t-fast); }
.acct button:hover, .acct a:hover { color: var(--stage); }
@media (max-width: 900px) { .acct b { display: none; } }

/* ── ticker ───────────────────────────────────────────── */

.ticker {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  height: 38px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4, 3, 8, 0.2), rgba(4, 3, 8, 0.85));
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}
.ticker__track { display: inline-flex; gap: 0; animation: ticker 60s linear infinite; will-change: transform; }
.ticker__item { display: inline-flex; align-items: center; gap: 14px; padding: 0 28px; }
.ticker__item b { color: var(--text); font-weight: 700; }
.ticker__item i { font-style: normal; color: var(--c, var(--stage)); }
.ticker__sep { color: var(--text-mute); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ── custom cursor ────────────────────────────────────── */

.cursor, .cursor-dot { position: fixed; top: 0; left: 0; z-index: 100; pointer-events: none; border-radius: 50%; will-change: transform; }
.cursor {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  border: 1px solid color-mix(in srgb, var(--stage) 80%, transparent);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.55rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: transparent;
  transition: width var(--t-med) var(--ease-bloom), height var(--t-med) var(--ease-bloom), margin var(--t-med) var(--ease-bloom), background var(--t-med), color var(--t-med), border-color var(--t-med);
  mix-blend-mode: normal;
}
.cursor-dot { width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; background: var(--stage); box-shadow: 0 0 12px var(--stage); }
.cursor.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: color-mix(in srgb, var(--stage) 14%, transparent); }
.cursor.is-label { width: 92px; height: 92px; margin: -46px 0 0 -46px; background: var(--stage); color: var(--stage-ink); border-color: transparent; }
.cursor.is-down { transform-origin: center; filter: brightness(1.4); }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-dot { display: none; } }
@media (hover: hover) and (pointer: fine) { html.has-cursor, html.has-cursor * { cursor: none !important; } }

/* ── 3D tilt cards ────────────────────────────────────── */

[data-tilt] { transform-style: preserve-3d; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform var(--t-med) var(--ease-bloom); will-change: transform; }
[data-tilt].is-tilting { transition: none; }
[data-tilt] .tilt-glare {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; overflow: hidden;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 0%), rgba(255, 255, 255, 0.13), transparent 45%);
  opacity: var(--go, 0); transition: opacity var(--t-med);
}
[data-tilt] .tilt-pop { transform: translateZ(38px); }
[data-tilt] .tilt-pop-2 { transform: translateZ(70px); }

/* ── reveal on scroll ─────────────────────────────────── */

.reveal { opacity: 0; transform: translateY(34px) scale(0.985); filter: blur(8px); transition: opacity var(--t-slow) var(--ease-bloom), transform var(--t-slow) var(--ease-bloom), filter var(--t-slow) var(--ease-bloom); transition-delay: var(--d, 0ms); }
.reveal.is-in { opacity: 1; transform: none; filter: none; }

/* ── page transition: the iris is a petal-coloured bloom ─ */

.iris {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background: radial-gradient(circle at var(--ix, 50%) var(--iy, 50%), var(--stage) 0, var(--stage) var(--ir, 0%), transparent calc(var(--ir, 0%) + 0.5%));
  opacity: 1;
}
.iris.is-open { --ir: 150%; transition: --ir 900ms var(--ease-snap); }
@property --ir { syntax: "<percentage>"; inherits: true; initial-value: 0%; }

/* boot veil: fades out when the world has rendered its first frame */
.veil { position: fixed; inset: 0; z-index: 150; background: var(--void); display: grid; place-items: center; transition: opacity 1200ms var(--ease-bloom), visibility 0s 1200ms; }
.veil.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.veil__disc { width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle, var(--void) 0 8%, var(--stage) 9% 30%, transparent 31%), repeating-radial-gradient(circle, #1a162b 0 1px, #05040a 1px 3px);
  animation: spin 1.2s linear infinite; box-shadow: 0 0 60px -6px var(--stage); }

@media (prefers-reduced-motion: reduce) {
  .ticker__track, .wordmark__glyph, .wordmark__glyph::after { animation: none; }
  .reveal { transition-duration: 1ms; }
}
