/* ============================================
   hod.app — Personal site + Apple II text adventure
   ============================================ */

/* --- Custom Properties --- */
:root {
  /* CRT */
  --crt-screen-bg: #0a0a0a;
  --crt-green: #33ff33;
  --crt-green-dim: #1a8c1a;
  --crt-amber: #ffaa00;

  /* Phosphor */
  --phosphor-glow: rgba(51, 255, 51, 0.15);

  /* Site */
  --site-bg: #0b0b0b;
  --site-text: #b8b8b8;
  --site-text-bright: #d4d4d4;
  --site-heading: #e0e0e0;
  --site-link: #b8b8b8;
  --site-link-hover: #ffffff;
  --site-divider: #252525;

  /* Calibrated for apple-ii.png (1440x1213).
     Screen = black + scanlines fill, extends under bezel.
     Safe = text content area, inset from screen edges. */
  --screen-top: 8.5%;
  --screen-left: 19.6%;
  --screen-width: 54.2%;
  --screen-height: 47.4%;
  --safe-top: 10.1%;
  --safe-left: 21.3%;
  --safe-width: 50.0%;
  --safe-height: 43.5%;

  /* Content scale — set by JS ResizeObserver.
     1 = full size (~1800px scene), shrinks proportionally below that.
     Overridden in media queries below to prevent first-frame flash. */
  --crt-scale: 1;
}

/* --- Apple II Fonts --- */
@font-face {
  font-family: 'PrintChar21';
  src: url('PrintChar21.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'PRNumber3';
  src: url('PRNumber3.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Polymath';
  src: url('Polymath.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Polymath';
  src: url('Polymath-Bold.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  /* Warm radial glow centered behind the computer + film grain overlay. */
  background:
    radial-gradient(ellipse 120% 80% at 50% 15%, #2e2217 0%, #181208 35%, #0a0a0a 70%);
  background-color: #0a0a0a;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  color: var(--site-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scattered dice + sprites background — float like stars in a galaxy. */
#dice-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
#dice-bg .bg-die {
  position: absolute;
  font-family: 'Polymath', monospace;
  color: #142a14;
  will-change: transform;
  transition: color 0.8s ease-out;
}
#dice-bg .bg-sprite {
  position: absolute;
  will-change: transform;
}
.bg-die.twinkle {
  color: #3a7a3a !important;
  transition: color 0.15s ease-in;
}

/* Film grain — covers the entire page including hero. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* ============================================
   HERO — Apple II monitor, max screen real estate
   ============================================ */
.hero {
  position: relative;
  /* No background — body gradient shows through around the Apple II. */
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
}

/* ============================================
   BIO — polaroid + name + intro + icons, below scene
   ============================================ */
.bio {
  /* No background — body gradient shows through. */
  padding: 32px 24px 64px;
}

.bio__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: clamp(20px, 4vw, 48px);
}

.bio__polaroid {
  position: relative;
  flex-shrink: 0;
  width: clamp(120px, 18vw, 200px);
  aspect-ratio: 576 / 683;
  transform: rotate(-6deg);
  filter: drop-shadow(3px 4px 10px rgba(0, 0, 0, 0.7));
}

.bio__headshot {
  position: absolute;
  top: 5.3%;
  left: 6.2%;
  width: 87.2%;
  height: 73.6%;
  object-fit: cover;
  object-position: center 20%;
}

.bio__polaroid-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.bio__text {
  flex: 1;
  min-width: 0;
  padding-top: 8px;
}

.bio__name {
  font-family: 'PrintChar21', 'Courier New', monospace;
  font-size: clamp(24px, 3vw, 40px);
  font-weight: normal;
  color: var(--crt-green);
  text-shadow: 0 0 10px rgba(51, 255, 51, 0.4),
               0 0 20px rgba(51, 255, 51, 0.15);
  line-height: 1.1;
  margin-bottom: 8px;
}

.bio__subtitle {
  font-size: 13px;
  color: #777;
  line-height: 1.4;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}

.bio__intro {
  font-size: 15px;
  color: #b8b8b8;
  line-height: 1.55;
  margin-bottom: 20px;
}

.bio__links {
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: center;
}

.bio__icon {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.bio__links a:hover .bio__icon {
  opacity: 1;
}

/* ============================================
   SCENE — Apple II frame over CRT terminal
   ============================================ */
.scene {
  position: relative;
  /* apple-ii.png aspect: 1440/1213 */
  aspect-ratio: 1440 / 1213;
  /* Width = smaller of viewport width OR what 100vh allows. */
  width: min(100%, calc(96vh * 1440 / 1213));
  max-height: 96vh;
  overflow: hidden;
  /* No background — body gradient shows through the transparent Apple II PNG. */
}

/* Frame — desktop and mobile variants */
.scene__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* Desktop: full desk scene. Mobile: monitor only. */
.scene__frame--mobile { display: none; }
.scene__frame--desktop { display: block; }

/* CRT screen — black area, extends under the bezel cutout. */
.crt-screen {
  position: absolute;
  top: var(--screen-top);
  left: var(--screen-left);
  width: var(--screen-width);
  height: var(--screen-height);
  background: var(--crt-screen-bg);
  border-radius: 3% / 4%;
  overflow: hidden;
  z-index: 2;
}

/* Vignette / curved-glass overlay — sized to the full screen cutout so it
   covers consistently across both desktop and monitor-only frames. The
   parts that extend under the bezel are hidden by the apple-ii.png frame
   so only the visible-cutout portion of the inset shadow shows up. */
.crt-vignette {
  position: absolute;
  top:    var(--screen-top);
  left:   var(--screen-left);
  width:  var(--screen-width);
  height: var(--screen-height);
  pointer-events: none;
  z-index: 7;
  border-radius: 3% / 4%;
  box-shadow:
    inset 0 0 40px 10px rgba(0, 0, 0, 0.55),
    inset 0 0 100px 25px rgba(0, 0, 0, 0.3),
    inset 0 0 6px 1px rgba(51, 255, 51, 0.22);
}

/* ============================================
   CRT SCREEN EFFECTS
   ============================================ */

/* Alec Lownes scanlines: horizontal lines + vertical RGB sub-pixels */
.crt-scanlines {
  position: absolute;
  top: var(--screen-top);
  left: var(--screen-left);
  width: var(--screen-width);
  height: var(--screen-height);
  pointer-events: none;
  z-index: 6;
  border-radius: 3% / 4%;
  overflow: hidden;
}

.crt-scanlines::before {
  content: " ";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background:
    linear-gradient(
      rgba(18, 16, 16, 0) 50%,
      rgba(0, 0, 0, 0.25) 50%
    ),
    linear-gradient(
      90deg,
      rgba(255, 0, 0, 0.06),
      rgba(0, 255, 0, 0.02),
      rgba(0, 0, 255, 0.06)
    );
  background-size: 100% 2px, 3px 100%;
  z-index: 2;
  pointer-events: none;
}

/* Very subtle flicker — barely perceptible brightness variation */
.crt-scanlines::after {
  content: " ";
  display: block;
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: rgba(18, 16, 16, 0.1);
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  animation: crt-flicker 0.15s infinite;
}

@keyframes crt-flicker {
  0%   { opacity: 0.02; }
  10%  { opacity: 0.03; }
  20%  { opacity: 0.01; }
  30%  { opacity: 0.05; }
  40%  { opacity: 0.02; }
  50%  { opacity: 0.07; }
  60%  { opacity: 0.01; }
  70%  { opacity: 0.04; }
  80%  { opacity: 0.05; }
  90%  { opacity: 0.03; }
  100% { opacity: 0.02; }
}

/* --- Screen jitter --- */
@keyframes screen-jitter {
  0%, 95%, 100% { transform: translate(0, 0); }
  96% { transform: translate(-1px, 0); }
  97% { transform: translate(1px, -1px); }
  98% { transform: translate(0, 1px); }
  99% { transform: translate(-1px, 0); }
}

/* Jitter disabled — too distracting with the frame overlay */
/* .crt-screen { animation: screen-jitter 8s infinite; } */

/* --- Phosphor flicker on boot --- */
@keyframes phosphor-flicker {
  0% { opacity: 0; background: var(--crt-screen-bg); }
  10% { opacity: 1; background: #003300; }
  20% { opacity: 0.5; background: var(--crt-screen-bg); }
  35% { opacity: 1; background: #002200; }
  50% { opacity: 0.7; background: var(--crt-screen-bg); }
  70% { opacity: 1; background: #001a00; }
  100% { opacity: 1; background: var(--crt-screen-bg); }
}

.crt-screen--flicker {
  animation: phosphor-flicker 0.4s ease-out forwards;
}

/* --- CRT Power-On --- */
@keyframes crt-power-on {
  0% {
    transform: scaleY(0.002) scaleX(1);
    filter: brightness(10);
    background: white;
  }
  30% {
    transform: scaleY(0.005) scaleX(0.8);
    filter: brightness(5);
  }
  50% {
    transform: scaleY(0.3) scaleX(1);
    filter: brightness(2);
    background: #004400;
  }
  70% {
    transform: scaleY(0.8) scaleX(1);
    filter: brightness(1.2);
  }
  100% {
    transform: scaleY(1) scaleX(1);
    filter: brightness(1);
    background: var(--crt-screen-bg);
  }
}

.crt-screen--off {
  background: #000;
  transform: scaleY(0.002);
}

.crt-screen--power-on {
  animation: crt-power-on 0.6s ease-out forwards;
}

/* Text emphasis classes */
.text-amber { color: var(--crt-amber); }
.text-dim { color: var(--crt-green-dim); }
.text-bright { color: #66ff66; text-shadow: 0 0 4px var(--crt-green); }
.text-red { color: #ff4444; }
.text-bold { font-weight: bold; }
.text-80col { font-family: 'PRNumber3', 'Courier New', monospace; }

/* --- Input line (hidden — choice engine only) --- */
.crt-input-line { display: none !important; }

.crt-input-line,
.crt-prompt,
.crt-input,
.crt-cursor {
  color: var(--crt-green);
  font-family: 'PrintChar21', 'Courier New', Courier, monospace;
  font-size: clamp(11px, 1.2vw, 16px);
}

/* Blinking cursor */
@keyframes cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.crt-cursor {
  animation: cursor-blink 1s step-end infinite;
  margin-left: -2px;
}

/* ============================================
   CONTENT SECTIONS — below the fold
   ============================================ */
/* ============================================
   BELOW-FOLD CONTENT — two-column grid + compact typography
   ============================================ */
.below-fold {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 24px;
}

.content-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 640px;
  margin: 0 auto;
}

.content-grid .crt-container {
  background: var(--site-bg);
  padding: 1.2rem 1.6rem;
}

.content-lead {
  font-family: 'PrintChar21', monospace;
  font-size: 16px;
  color: var(--crt-green);
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.3);
  margin-bottom: 14px;
  line-height: 1.3;
}

.content-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: #999;
  line-height: 1.65;
  margin-bottom: 12px;
  text-shadow: none;
}
.content-body:last-child { margin-bottom: 0; }

.content-body strong {
  color: #ccc;
  font-weight: 600;
}

.content-divider {
  border-top: 1px solid var(--crt-green-dim);
  margin: 16px 0;
  opacity: 0.4;
}

/* Contact links row */
.contact-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'PrintChar21', monospace;
  font-size: 14px;
  color: var(--crt-green-dim);
  text-decoration: none;
  text-shadow: none;
  transition: color 0.2s;
  cursor: pointer;
}
.contact-link:hover {
  color: var(--crt-green);
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.4);
}
.contact-link img {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.contact-link:hover img { opacity: 1; }

/* ============================================
   SITE FOOTER
   ============================================ */
.site-footer {
  padding: 40px 24px;
  text-align: center;
  font-size: 12px;
  color: #444;
  border-top: 1px solid var(--site-divider);
}

/* ============================================
   SCROLL INDICATOR
   ============================================ */
.scroll-indicator {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  animation: bounce-indicator 2s ease-in-out infinite;
}

.scroll-indicator__chevron {
  color: rgba(255,255,255,0.4);
  font-size: 28px;
}

@keyframes bounce-indicator {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ============================================
   PAGE LAYOUT — CRT choice engine
   ============================================ */
.crt-output,
.crt-output * {
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
}

.crt-output {
  position: absolute;
  top: var(--safe-top);
  left: var(--safe-left);
  /* Inverse-scale dimensions so that after transform: scale(),
     the visible content fills the original safe zone exactly. */
  width: calc(var(--safe-width) / var(--crt-scale, 1));
  height: calc(var(--safe-height) / var(--crt-scale, 1));
  transform: scale(var(--crt-scale, 1));
  transform-origin: 0 0;
  /* contain: strict tells the browser this element is a fully
     independent formatting context. This prevents Mobile Safari
     from applying text inflation to content inside the transform:scale
     container (Safari sees the 640px pre-transform width and inflates
     16px→21px without this). */
  contain: strict;
  display: flex;
  flex-direction: column;
  font-family: 'PrintChar21', 'PRNumber3', 'Courier New', monospace;
  font-size: 16px;
  line-height: 1.3;
  color: var(--crt-green);
  text-shadow: 0 0 5px rgba(51, 255, 51, 0.55);
  white-space: normal;
  overflow: hidden;
  /* Tiny inner gutter so content doesn't crowd the curved-glass edges. */
  padding: 6px 10px;
  z-index: 5;
}

.page-title {
  font-weight: bold;
  text-decoration: underline;
  margin-bottom: 4px;
  text-align: center;
}

.page-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 0;
  flex: 0 0 auto;
}

.page-flavor {
  font-style: italic;
  opacity: 0.8;
  margin-bottom: 4px;
}

.page-banter {
  color: var(--crt-amber);
  margin-bottom: 6px;
  white-space: pre-wrap;
}

.page-choices {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
}

.page-choice {
  background: transparent;
  border: none;
  color: var(--crt-green);
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  padding: 1px 0;
  cursor: pointer;
  white-space: pre;
}

.page-choice:hover,
.page-choice--highlight {
  color: #66ff66;
  text-shadow: 0 0 4px var(--crt-green);
}

.page-choice--highlight {
  background: rgba(51, 255, 51, 0.05);
}

.page-choice-desc {
  color: var(--crt-green-dim);
  font-style: italic;
  font-size: 0.9em;
  min-height: 1.2em;
  margin-top: 2px;
  opacity: 0.8;
}

.passive-content {
  margin-bottom: 4px;
}

/* Passive-unlocked choices — subtly brighter */
.page-choice--passive {
  color: #66ff66;
  text-shadow: 0 0 3px rgba(51, 255, 51, 0.4);
}

.page-status {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--crt-green-dim);
  color: var(--crt-green-dim);
  font-size: 0.85em;
}

.title-art {
  color: var(--crt-green);
  text-shadow: 0 0 4px var(--crt-green);
  font-family: 'PRNumber3', monospace;
}

/* ============================================
   STAT GRID — 3x2 grid for stat roll screen
   ============================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 0;
  margin: 6px 0;
  width: 100%;
  white-space: normal;
  overflow: hidden;
}

.stat-box {
  border: 1px solid var(--crt-green-dim);
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
  overflow: hidden;
  min-width: 0;
}

.stat-box--empty {
  opacity: 0.3;
}

.stat-box--empty .stat-box-dice,
.stat-box--empty .stat-box-value,
.stat-box--empty .stat-box-header span:not(.stat-box-label) {
  visibility: hidden;
}

.stat-box--rolling {
  border-color: var(--crt-green);
  box-shadow: 0 0 6px rgba(51, 255, 51, 0.3);
}

.stat-box--done {
  border-color: var(--crt-green);
}

.stat-box-header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 2px;
}

.stat-box-label,
.stat-box-value {
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 1px;
}

.stat-box-value {
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.6);
}

.stat-box-dice {
  font-family: 'Polymath', monospace;
  font-weight: bold;
  font-size: 64px;
  line-height: 1.0;
  margin: 2px 0;
  font-feature-settings: "liga" 1, "clig" 1, "dlig" 1;
  font-variant-ligatures: common-ligatures discretionary-ligatures;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

.stat-box-dice .stat-die {
  display: inline-block;
  margin: 0 1px;
}

.stat-box-dice .dice-dim {
  opacity: 0.25;
}

/* ============================================
   BOOT SCREENS — fake Apple IIc power-on
   ============================================ */
.boot-screen {
  font-family: inherit;
  font-size: inherit;
  color: var(--crt-green);
  white-space: pre;
  line-height: 1.0;
  margin: 0;
  padding: 0;
  clip-path: inset(0 0 1em 0);
}

.boot-screen-dim {
  opacity: 0.45;
}

.boot-screen-text {
  line-height: 1.15;
}

.check-result {
  text-align: center;
  font-weight: bold;
  text-shadow: 0 0 6px var(--crt-green);
}

.game-over pre {
  color: #ff4444;
  text-shadow: 0 0 6px #ff4444;
}

.game-over button {
  background: transparent;
  border: 1px solid var(--crt-green);
  color: var(--crt-green);
  padding: 6px 12px;
  margin: 4px;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

.game-over button:hover {
  background: var(--crt-green);
  color: #000;
}

/* ============================================
   SPRITES — Roguelike 1-Bit sheet
   ============================================ */
.sprite {
  display: inline-block;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: brightness(0) saturate(100%)
          invert(80%) sepia(50%) saturate(500%)
          hue-rotate(70deg) brightness(1.1);
  vertical-align: middle;
}

.sprite-scene {
  margin: 4px auto;
  overflow: hidden;
}

.passive-icon {
  display: inline-block;
  margin-right: 4px;
  opacity: 0.6;
}

/* ============================================
   DICE POPUP — DOS-style overlay
   ============================================ */
.dice-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.65);
}

.dice-popup {
  background: #060606;
  border: 2px solid var(--crt-green);
  box-shadow: 0 0 8px rgba(51, 255, 51, 0.3);
  padding: 12px 20px;
  font-family: 'PrintChar21', monospace;
  font-size: inherit;
  color: var(--crt-green);
  text-shadow: 0 0 5px rgba(51, 255, 51, 0.55);
  line-height: 1.4;
  pointer-events: none;
  text-align: center;
  min-width: 160px;
}

.dice-popup .dice-glyphs {
  font-family: 'Polymath', monospace;
  font-weight: bold;
  font-size: 64px;
  line-height: 1.1;
  margin: 8px 0;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
  font-feature-settings: "liga" 1, "clig" 1, "dlig" 1;
  font-variant-ligatures: common-ligatures discretionary-ligatures;
  text-rendering: optimizeLegibility;
}

.dice-popup .dice-label {
  font-family: 'PrintChar21', monospace;
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.dice-popup .dice-glyph {
  display: inline-block;
  margin: 0 4px;
}

.dice-popup .dice-dim {
  opacity: 0.3;
}

.dice-popup .dice-result {
  font-family: 'PrintChar21', monospace;
  font-weight: bold;
  margin-top: 6px;
}

.dice-popup .dice-verdict {
  margin-top: 4px;
}

.dice-popup .dice-success {
  color: #66ff66;
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.8);
}

.dice-popup .dice-failure {
  color: var(--crt-green-dim);
  text-shadow: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet/mobile — swap to monitor-only frame */
@media (max-width: 1024px) {
  :root {
    /* apple-ii-monitor.png (1080x851) calibration */
    --screen-top: 13.1%;
    --screen-left: 10.1%;
    --screen-width: 79.9%;
    --screen-height: 74.7%;
    --safe-top: 16.1%;
    --safe-left: 13.1%;
    --safe-width: 73.1%;
    --safe-height: 67.4%;
  }

  .scene__frame--desktop { display: none; }
  .scene__frame--mobile { display: block; }

  .scene {
    aspect-ratio: 1080 / 851;
    width: min(100%, calc(85vh * 1080 / 851));
    max-height: 85vh;
  }

  .bio__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .bio__links {
    justify-content: center;
  }

  .content-section {
    padding: 56px 16px;
  }
}

/* Small mobile */
@media (max-width: 768px) {
  .hero { padding: 16px 12px; }
  .bio { padding: 24px 16px 48px; }
}

/* Very narrow viewports — scene stops shrinking at a minimum size so the
   CRT + a bit of bezel stays visible all the way around. Below the minimum
   the bezel just overflows the viewport horizontally; the hero clips it. */
@media (max-width: 500px) {
  .hero {
    overflow-x: hidden;
    padding: 0;
    display: flex;
    justify-content: center;
  }
  .scene {
    width: 500px;
    flex-shrink: 0;
    max-width: none;
    max-height: none;
    margin: 0 auto;
    --crt-scale: 0.571;
  }
}

/* Accessibility — disable animations for users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .crt-scanlines,
  body::before { display: none; }
  .crt-vignette { animation: none; }
  #dice-bg { display: none; }
  .tw-cursor { animation: none; }
  .bg-die, .bg-sprite { animation: none; }
  .title-btn.is-lit { animation: none; }
}
