:root {
  color-scheme: dark;
  --screen: #0d0c11; /* matches the ground of the ASCII export, so it melts in */
  --fg: #f4f2f8;
  --muted: #9a97a8;
  --gold: #ffc46a;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --bezel: 6px;
  /* phosphor: a soft glow plus a hair of red/blue convergence error */
  --phosphor: 0 0 10px #ffffff2e, -0.6px 0 #ff3b5c66, 0.6px 0 #4fa3ff66;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { background: #050506; }

/* The set: dark plastic, lit faintly from above. */
body {
  min-height: 100vh; min-height: 100dvh;
  /* the bezel, widened where a notch or home bar would cover the glass */
  padding: max(var(--bezel), env(safe-area-inset-top)) max(var(--bezel), env(safe-area-inset-right))
           max(var(--bezel), env(safe-area-inset-bottom)) max(var(--bezel), env(safe-area-inset-left));
  background: radial-gradient(120% 80% at 50% 0%, #1a1920 0%, #0b0a0e 60%, #050506 100%);
  color: var(--fg); font-family: var(--mono); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
::selection { background: #ffc46a55; }

/* The glass: pillowed corners and a chamfered lip where it meets the set. */
.stage {
  position: relative; overflow: hidden; isolation: isolate;
  height: calc(100vh - 2 * var(--bezel)); height: calc(100dvh - 2 * var(--bezel)); min-height: 540px;
  height: calc(100dvh - max(var(--bezel), env(safe-area-inset-top)) - max(var(--bezel), env(safe-area-inset-bottom)));
  border-radius: 10px;
  background: #000;
  box-shadow: 0 0 0 1px #000, 0 0 0 2px #ffffff12;
}

/* Everything on screen. It is what powers on, while the set stays put. */
.tube {
  position: absolute; inset: 0; background: var(--screen); overflow: hidden; border-radius: inherit;
  animation: power-on 1.25s cubic-bezier(.2, .7, .1, 1) backwards;
}

/* -- the picture ----------------------------------------------------------- */

/* The ASCII mark, lightened onto the screen so its own dark ground
   disappears and only the glyphs remain; its edges fade into the tube. */
.feed {
  position: absolute; z-index: 1; pointer-events: none;
  top: -14%; right: 2%; height: 116%; aspect-ratio: 2080 / 2852;
  mix-blend-mode: lighten;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 18%), linear-gradient(to top, transparent 0%, #000 6%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0%, #000 18%), linear-gradient(to top, transparent 0%, #000 6%);
  mask-composite: intersect;
}
.feed video, .feed canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The export carries a thin black border; crop it off. */
.feed video { object-fit: cover; transform: scale(1.04); filter: saturate(1.2) contrast(1.06); }
/* With WebGL the shader draws the picture (already cropped and graded) and
   the video only feeds it. */
.feed .gl { display: none; }
.feed.gl-on .gl { display: block; }
.feed.gl-on video { opacity: 0; }
/* Phosphor bloom: a tiny copy of each frame, blurred into a halo. */
.feed .bloom { filter: blur(18px) saturate(1.5); opacity: .5; mix-blend-mode: screen; transform: scale(1.04); }

/* -- type ------------------------------------------------------------------ */

.intro { position: absolute; z-index: 3; text-shadow: var(--phosphor); }

.intro { left: 36px; bottom: 44px; display: flex; flex-direction: column; gap: 24px; max-width: min(52ch, 40vw); }
.copy { display: flex; flex-direction: column; gap: 12px; }
.copy h1 { font-size: clamp(20px, 2.2vw, 44px); font-weight: 600; line-height: 1.3; letter-spacing: -.01em; color: #fff; }
.copy p { font-size: 15px; line-height: 1.7; color: #c3c0cf; text-wrap: pretty; }

.links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; font-size: 15px; }
.links a { color: var(--fg); text-decoration: underline; text-decoration-color: #ffffff55; text-underline-offset: 5px; transition: text-decoration-color 160ms, color 160ms; }
.links a:hover, .links a:focus-visible { color: var(--gold); text-decoration-color: var(--gold); }
.links a:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.links .sep { color: var(--muted); }
.cta span { display: inline-block; text-decoration: none; transition: transform 160ms; }
.cta:hover span { transform: translate(2px, -2px); }


/* -- the glass over it all -------------------------------------------------- */

/* Live grain. */
.static {
  position: absolute; inset: -50%; z-index: 4; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .5s steps(5) infinite;
}

/* Scanlines, an aperture-grille shimmer, the curve's falloff, and the sheen
   of a lamp on the glass; a faint bar rolls slowly down the tube. */
.glass { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.glass::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(60% 40% at 22% 10%, #ffffff10 0%, transparent 70%),
    repeating-linear-gradient(to bottom, #00000066 0 1px, transparent 1px 3px),
    repeating-linear-gradient(to right, #ff00000a 0 1px, #00ff000a 1px 2px, #0000ff0a 2px 3px),
    radial-gradient(110% 95% at 50% 50%, transparent 50%, #000000d8 100%);
  box-shadow: inset 0 0 0 1px #ffffff12, inset 0 0 140px 20px #000000c8, inset 0 2px 6px #ffffff0e;
  animation: flicker 5s steps(1) infinite;
}
.glass::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 25%;
  background: linear-gradient(to bottom, transparent, #ffffff08 50%, transparent);
  transform: translateY(-100%);
  animation: roll 9s linear infinite;
}

@keyframes power-on {
  0%   { transform: scale(1, .003); filter: brightness(8); opacity: 0; }
  12%  { transform: scale(1, .003); filter: brightness(8); opacity: 0; }
  13%  { transform: scale(1, .003); filter: brightness(8); opacity: 1; }
  30%  { transform: scale(1, .003); filter: brightness(6); }
  60%  { transform: scale(1, 1.015); filter: brightness(1.6); }
  100% { transform: scale(1, 1); filter: brightness(1); }
}
@keyframes flicker { 0%, 100% { opacity: 1; } 41% { opacity: .9; } 42% { opacity: 1; } 77% { opacity: .95; } }
@keyframes roll { from { transform: translateY(-100%); } to { transform: translateY(400%); } }
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-7%, 4%); } 40% { transform: translate(5%, -6%); }
  60% { transform: translate(-3%, 8%); } 80% { transform: translate(8%, 2%); } 100% { transform: translate(0, 0); }
}

/* Narrow or tall screens: the mark rides along the top, the copy below. */
@media (max-width: 760px), (max-aspect-ratio: 3/4) {
  :root { --bezel: 4px; }
  .stage { border-radius: 8px; }
  .feed {
    top: 3%; right: -4%; height: 60%; width: auto;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 22%), linear-gradient(to top, transparent 0%, #000 35%);
    mask-image: linear-gradient(to right, transparent 0%, #000 22%), linear-gradient(to top, transparent 0%, #000 35%);
  }
  /* a pool of shade so the copy stays legible if the art reaches it */
  .intro::before { content: ""; position: absolute; inset: -60px -22px -30px; z-index: -1; background: linear-gradient(transparent, #0d0c11e6 45%); }
  .intro { left: 22px; right: 22px; bottom: 30px; gap: 18px; max-width: none; }
  .copy h1 { font-size: 20px; }
  .copy p, .links { font-size: 14px; }
  .stage { min-height: 460px; }
}

/* Phones on their side: a short, wide screen. Keep it all on one screen,
   copy on the left, the mark on the right. */
@media (max-height: 560px) and (min-aspect-ratio: 4/3) {
  :root { --bezel: 4px; }
  .stage { min-height: 0; border-radius: 8px; }
  .feed {
    top: -10%; right: 0; height: 120%;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 18%), linear-gradient(to top, transparent 0%, #000 6%);
    mask-image: linear-gradient(to right, transparent 0%, #000 18%), linear-gradient(to top, transparent 0%, #000 6%);
  }
  .intro::before { content: none; }
  .intro { left: 24px; right: auto; bottom: 22px; gap: 14px; max-width: min(48ch, 50vw); }
  .copy { gap: 8px; }
  .copy h1 { font-size: 19px; }
  .copy p { font-size: 13px; line-height: 1.6; }
  .links { font-size: 14px; }
}

/* Fingers, not cursors: give each link a comfortable target. */
@media (pointer: coarse) {
  .links { gap: 4px 6px; }
  .links a { padding: 10px 4px; margin: -10px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tube, .static, .glass::before, .glass::after { animation: none; }
}

/* -- the about page --------------------------------------------------------- */

/* The same tube with no picture: the copy scrolls behind the glass. */
.scroller { position: absolute; inset: 0; z-index: 3; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.about { max-width: 64ch; padding: 72px 36px 64px; display: flex; flex-direction: column; gap: 44px; text-shadow: var(--phosphor); }
.about .back { color: var(--muted); font-size: 14px; text-decoration: none; align-self: flex-start; transition: color 160ms; }
.about .back:hover, .about .back:focus-visible { color: var(--gold); }
.about .back:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }
.about h1 { font-size: clamp(22px, 2.6vw, 44px); font-weight: 600; line-height: 1.25; letter-spacing: -.01em; color: #fff; }
.about h2 { font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.about p { font-size: 15px; line-height: 1.75; color: #c3c0cf; text-wrap: pretty; }
.about p + p { margin-top: 12px; }
.about .portfolio { list-style: none; display: flex; flex-direction: column; gap: 18px; }
.about .portfolio strong { color: var(--fg); font-weight: 600; }
.about p a { color: var(--fg); text-decoration: underline; text-decoration-color: #ffffff55; text-underline-offset: 5px; }
.about p a:hover, .about p a:focus-visible { color: var(--gold); text-decoration-color: var(--gold); }
.about .tag { color: var(--muted); font-size: 13px; }

@media (max-width: 760px), (max-aspect-ratio: 3/4) {
  .about { padding: 44px 22px 48px; gap: 36px; }
  .about p { font-size: 14px; }
}
