@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/JetBrainsMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("assets/VT323-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ar: 1.784387;          /* photo aspect ratio (2400 / 1345) */
  --zoom: 1.0;             /* >1 crops the photo edges to enlarge the CRT */
  --cx: 0.480;             /* focal point of the photo (the CRT), as a fraction */
  --cy: 0.385;

  /* CRT glass rectangle, as fractions of the photo */
  --sx: 0.352;
  --sy: 0.228;
  --sw: 0.258;
  --sh: 0.299;

  --g: #38ff6a;            /* phosphor */
  --g-dim: #1fa84a;
  --g-hi: #c9ffd9;
  --bg: #0b0907;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); overflow: hidden; }
body { min-height: 100svh; }

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

/* The stage is the photo, scaled to cover the viewport and centred on the CRT. */
.stage {
  --W: max(calc(100vw * var(--zoom)), calc(100svh * var(--ar) * var(--zoom)));
  --H: calc(var(--W) / var(--ar));
  position: absolute;
  width: var(--W);
  height: var(--H);
  left: clamp(calc(100vw - var(--W)), calc(50vw - var(--W) * var(--cx)), 0px);
  top:  clamp(calc(100svh - var(--H)), calc(50svh - var(--H) * var(--cy)), 0px);
}
.photo { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }

/* ---- the screen ---- */
.screen {
  position: absolute;
  left:  calc(var(--sx) * 100%);
  top:   calc(var(--sy) * 100%);
  width: calc(var(--sw) * 100%);
  height: calc(var(--sh) * 100%);
  border-radius: 9% / 11%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 46%, #0b3a1b 0%, #04180b 55%, #010703 100%);
  container-type: size;
  box-shadow: inset 0 0 6cqw 1cqw rgba(0,0,0,.85);
}
/* the real photo's scratches and dust bleed through the glass */
.glass {
  position: absolute;
  width:  calc(100% / var(--sw));
  height: auto;
  max-width: none;
  left: calc(var(--sx) / var(--sw) * -100%);
  top:  calc(var(--sy) / var(--sh) * -100%);
  mix-blend-mode: soft-light;
  opacity: .55;
  filter: grayscale(1) contrast(1.4);
  pointer-events: none;
}

.phosphor {
  position: absolute; inset: 0;
  padding: 5cqh 6cqw;
  font-family: "VT323", ui-monospace, "DejaVu Sans Mono", monospace;
  color: var(--g);
  font-size: 8.4cqh;       /* ~12 rows */
  line-height: 1.05;
  text-shadow: 0 0 .5cqh rgba(56,255,106,.9), 0 0 2.2cqh rgba(56,255,106,.45);
  animation: flicker 5.5s infinite steps(1);
  white-space: pre-wrap;
  overflow: hidden;
}
.lines { display: flex; flex-direction: column; }
.line { min-height: 1.05em; }
.line.big   { font-size: 2.1em; line-height: .95; letter-spacing: .02em; color: var(--g-hi); }
.line.hi    { color: var(--g-hi); }
.line.dim   { color: var(--g-dim); text-shadow: 0 0 1cqh rgba(56,255,106,.35); }
.line.center{ text-align: center; }
.cursor {
  display: inline-block; width: .55em; height: .85em; margin-left: .08em;
  background: var(--g); vertical-align: -.08em;
  box-shadow: 0 0 1.4cqh rgba(56,255,106,.8);
  animation: blink 1.05s infinite steps(1);
}

.scanlines {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.28) 3px, rgba(0,0,0,0) 4px);
  mix-blend-mode: multiply;
}
.scanlines::after {          /* slow rolling bar */
  content: ""; position: absolute; left: 0; right: 0; height: 22%;
  background: linear-gradient(to bottom, rgba(56,255,106,0), rgba(56,255,106,.05), rgba(56,255,106,0));
  animation: roll 7s linear infinite;
}
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,.55) 100%);
}
.glare {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,0) 28%);
}

/* Page heading: sits above the photo, readable on any crop */
.masthead {
  position: fixed; z-index: 5; top: 0; left: 0; right: 0;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
  text-align: center; pointer-events: none;
}
.masthead::before {          /* soft dark pool behind the type, no hard band */
  content: ""; position: absolute; inset: 0 0 -28px 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(8,6,4,.72), rgba(8,6,4,0));
}
.masthead h1 {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, "DejaVu Sans Mono", monospace;
  font-weight: 700;
  font-size: clamp(26px, 4.2vw, 56px);
  letter-spacing: .04em;
  line-height: 1.1;
  color: #fff4dc;
  -webkit-text-stroke: 1px rgba(10, 6, 2, .85);
  paint-order: stroke fill;
  text-shadow:
    0 2px 0 rgba(0,0,0,.65),
    0 4px 14px rgba(0,0,0,.8),
    0 0 26px rgba(56,255,106,.28);   /* faint phosphor halo ties it to the screen */
}

.foot {
  position: fixed; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom));
  text-align: center; pointer-events: none;
  font-family: "VT323", ui-monospace, monospace; font-size: 18px; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255, 240, 210, .7); text-shadow: 0 1px 6px rgba(0,0,0,.9);
}

@keyframes blink  { 50% { opacity: 0; } }
@keyframes roll   { from { top: -25%; } to { top: 105%; } }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  91% { opacity: .96; } 92% { opacity: 1; }
  96% { opacity: .93; } 96.6% { opacity: 1; }
}

@media (min-width: 900px) { :root { --zoom: 1.28; } }
@media (prefers-reduced-motion: reduce) {
  .phosphor, .scanlines::after, .cursor { animation: none; }
}
