/* ==========================================================================
   EREN ALSAN PORTFOLIO — STYLE.CSS
   Concept: "Inference mode" — the page is seen through a vision model.
   Palette: Ultramarine #2d3fe0, Signal #ffd23f, Fog #e9ebef, Ink #14213d, Slate #566079
   Type: San Francisco via the system stack (SF Pro / SF Mono on Apple devices, Inter elsewhere).
   ========================================================================== */

:root {
  /* SF can't be self-hosted (Apple licence), so ask for the system font: genuine SF on Apple, Inter elsewhere */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font-pixel: "Press Start 2P", var(--font-mono);
  /* Side padding that also caps content at 80rem, so ultra-wide screens don't stretch the layout */
  --gutter: max(clamp(1rem, 4vw, 3rem), (100% - 80rem) / 2);
  --header-h: 3.5rem;
  /* Vertical rhythm that shrinks on short screens so every page fits without scrolling */
  --vpad: clamp(1rem, 3.2vh, 2.5rem);
}

:root,
:root[data-theme="light"] {
  --bg: #e9ebef;          /* Fog */
  --surface: #f6f7f9;
  --ink: #14213d;         /* Navy ink */
  --muted: #566079;       /* Slate */
  --line: #c9ced9;
  --accent: #2d3fe0;      /* Ultramarine: links, hover titles */
  --hero: #2d3fe0;
  --on-hero: #ffffff;
  --signal: #ffd23f;      /* Annotation yellow */
  --box: #2d3fe0;         /* Detector colour on page sections */
  --box-ink: #ffffff;
  --shadow: 0 1.875rem 3.75rem -1.875rem rgba(20, 33, 61, 0.45);
}

:root[data-theme="dark"] {
  --bg: #0e1430;
  --surface: #161e44;
  --ink: #eceef5;
  --muted: #a0a8c3;
  --line: #2a3466;
  --accent: #8c9bff;
  --hero: #2433c4;
  --on-hero: #ffffff;
  --signal: #ffd23f;
  --box: #ffd23f;
  --box-ink: #14213d;
  --shadow: 0 1.875rem 3.75rem -1.875rem rgba(0, 0, 0, 0.8);
}

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

/* Root size grows from 100% to 125% above ~1700px, so rem-based layout scales up on 2K/4K screens */
html {
  font-size: clamp(100%, 0.55rem + 0.42vw, 125%);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(0.9375rem, 0.9rem + 0.15vw, 1.0625rem);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, p, ol, dl, dd, figure { margin: 0; }
ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

::selection { background: var(--signal); color: #14213d; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0.1875rem;
}
.on-blue :focus-visible { outline-color: var(--signal); }

.hidden { display: none !important; }

/* --- Detector (global hover/focus box) --- */
.detector {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 45; /* above the header, below popups */
  width: 0;
  height: 0;
  border: 2px solid var(--box);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              width 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              height 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.2s ease;
}
.detector.is-visible { opacity: 1; }
.detector.is-snapping { transition: opacity 0.2s ease; }
.detector-label {
  position: absolute;
  bottom: 100%;
  left: -2px;
  padding: 2px 0.4375rem;
  background: var(--box);
  color: var(--box-ink);
  font: 600 0.6875rem/1.5 var(--font-mono);
  white-space: nowrap;
}
.detector.on-blue { border-color: var(--signal); }
.detector.on-blue .detector-label { background: var(--signal); color: #14213d; }
.detector.label-below .detector-label { bottom: auto; top: 100%; }

/* --- Nav: sticky header with tab triggers --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(0.625rem);
  -webkit-backdrop-filter: blur(0.625rem);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.tabs {
  display: flex;
  flex: 1;
  min-width: 0;
  align-self: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
/* Centred with auto margins rather than justify-content, so overflow scrolls instead of spilling left over the name */
.tab:first-child { margin-left: auto; }
.tab:last-child { margin-right: auto; }
.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0 0.625rem;
  border-bottom: 0.1875rem solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-num { font: 0.5rem/1 var(--font-pixel); color: var(--accent); }
.nav-tools {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
}
.nav-cv {
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.nav-cv:hover { background: var(--signal); color: #14213d; }

/* Player HUD: level + XP bar, links to the quest log */
.xp-hud {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  padding: 0.3125rem 0.4375rem;
  border: 2px solid currentColor;
  font: 0.5rem/1 var(--font-pixel);
  text-decoration: none;
  white-space: nowrap;
}
.xp-hud:hover { color: var(--accent); }
.xp-hud.is-bump { animation: hudBump 0.36s steps(3); }
@keyframes hudBump { 50% { transform: scale(1.15); background: var(--signal); color: #14213d; } }
.xp-bar {
  display: inline-block;
  width: 3rem;
  height: 0.4375rem;
  background: var(--line);
}
.xp-fill {
  display: block;
  width: var(--xp, 0%);
  height: 100%;
  background: var(--signal);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: width 0.4s steps(6);
}
.theme-toggle {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  opacity: 0.8;
}
.theme-toggle:hover { opacity: 1; }
.theme-toggle svg { width: 0.9375rem; height: 0.9375rem; }
:root[data-theme="light"] .icon-sun,
:root[data-theme="dark"] .icon-moon { display: none; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 1.125rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-light { background: var(--on-hero); color: #14213d; }
.btn-light:hover { background: var(--signal); }
.btn-ghost { background: transparent; color: var(--on-hero); border-color: currentColor; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-accent { min-height: 2.25rem; background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--signal); color: #14213d; }
.btn-quiet { min-height: 2rem; padding: 0 0.875rem; font-size: 0.8125rem; border-color: var(--line); background: transparent; color: var(--ink); }
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }

/* --- Views (tabs) --- */
html.js .view:not(.is-active) { display: none; }
.view.is-active { animation: viewIn 80ms ease-out; }
@keyframes viewIn { from { opacity: 0; } }
/* Reveals already on screen when a tab opens appear at once, so the switch stays instant */
.is-instant [data-reveal],
.is-instant .path::before { transition: none !important; }

/* --- Hero --- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: calc(100svh - var(--header-h));
  padding: var(--vpad) var(--gutter);
  background: var(--hero);
  color: var(--on-hero);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
  grid-template-rows: 1fr auto;
  grid-template-areas: "text portrait" "text np";
  align-items: end;
  gap: 1.25rem clamp(2rem, 5vw, 5rem);
}
.hero-text { grid-area: text; }
/* 8-bit seafront canvas: one art pixel = a whole number of device pixels, so it stays sharp at any DPR */
.hero-scene {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  image-rendering: pixelated;
}
/* Scrim keeps the white text readable over the brighter parts of the scene */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(14, 20, 48, 0.42), rgba(14, 20, 48, 0) 62%);
}
.hero-text { text-shadow: 0 1px 0.1875rem rgba(10, 14, 40, 0.45); }
/* SF Pro Display tracks tight at large sizes, Apple-style */
.hero-name {
  font-size: clamp(3rem, 6.5vw, 6rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.055em;
  margin-bottom: clamp(0.75rem, 2vh, 1.25rem);
}
.hero-lede {
  max-width: 32em;
  font-size: clamp(0.9375rem, 1.1vw, 1.0625rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin-bottom: clamp(0.75rem, 2vh, 1.25rem);
}
/* Recruiter quick facts */
.hero-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem 1.5rem;
  max-width: 36em;
  padding: clamp(0.5rem, 1.6vh, 0.875rem) 0;
  margin-bottom: clamp(0.75rem, 2vh, 1.25rem);
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
}
.hero-facts dt {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-bottom: 1px;
}
.hero-facts dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.status-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0.25rem rgba(255, 210, 63, 0.25);
  position: relative;
}
/* "Live" ring: availability is the first thing a recruiter checks */
.status-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--signal);
  animation: statusPing 2.4s var(--ease-out) infinite;
}
@keyframes statusPing {
  0%        { transform: scale(1); opacity: 0.7; }
  70%, 100% { transform: scale(3); opacity: 0; }
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 1.125rem;
}
.hero-link {
  font-weight: 600;
  font-size: 0.9375rem;
  text-underline-offset: 0.3125rem;
}
.hero-hint {
  margin-top: clamp(0.75rem, 2vh, 1.25rem);
  font-size: 0.8125rem;
  opacity: 0.8;
}
.hint-touch { display: none; }
@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

/* Portrait as an 8-bit framed picture hanging on the castle tower (the tower is drawn around it in script.js).
   Frame sizes stay in px so the pixel bevel stays crisp. */
.portrait {
  grid-area: portrait;
  position: relative;
  width: min(100%, 15rem);
  aspect-ratio: 4 / 5;
  justify-self: end;
  padding: 4px;
  background: #5c3a0a;
  border: 6px solid;
  border-color: #f6d365 #b37a14 #b37a14 #f6d365;
  box-shadow: 0 0 0 3px #2a1a05, 8px 8px 0 3px rgba(10, 14, 40, 0.45);
}
/* The nail it hangs from */
.portrait::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -22px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  background: #2a1a05;
  box-shadow: -6px 6px 0 #2a1a05, 6px 6px 0 #2a1a05;
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.12) contrast(1.04);
}
.portrait-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  font-weight: 800;
}
.portrait-fallback[hidden] { display: none; }

/* Now playing (Last.fm): an 8-bit framed "cartridge" in the same gold frame as the portrait.
   A plaque under the portrait on desktop, beside it on mobile. */
.np {
  grid-area: np;
  justify-self: end;
  width: min(100%, calc(15rem + 12px));
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem 0.5rem 0.5rem;
  background: #14213d;
  border: 4px solid;
  border-color: #f6d365 #b37a14 #b37a14 #f6d365;
  box-shadow: 0 0 0 2px #2a1a05, 6px 6px 0 2px rgba(10, 14, 40, 0.45);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.4s steps(4);
}
/* Invisible but still taking its space, so the portrait (and the tower drawn around it) never jumps */
.np:not(.is-ready) { visibility: hidden; opacity: 0; }
.np:hover .np-title { color: var(--signal); }
.np:active { transform: translate(2px, 2px); box-shadow: 0 0 0 2px #2a1a05, 4px 4px 0 2px rgba(10, 14, 40, 0.45); }
/* Frame flashes yellow when a new song comes in */
.np.is-new { animation: npFlash 0.5s steps(1) 3; }
@keyframes npFlash { 50% { border-color: var(--signal); } }
.np-cover {
  flex: none;
  width: 4.25rem;
  height: 4.25rem;
  object-fit: cover;
  background: #2a1a05;
  box-shadow: 0 0 0 2px #2a1a05;
}
.np-text { min-width: 0; display: flex; flex-direction: column; }
.np-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.375rem;
  font: 0.5rem/1.4 var(--font-pixel);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.np.is-live .np-status { color: var(--signal); }
.np-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-title {
  margin-bottom: 0.25rem;
  font: 0.5625rem/1.6 var(--font-pixel);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.np-artist { font-size: 0.8125rem; line-height: 1.3; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-eq { display: none; align-items: flex-end; gap: 2px; height: 0.5rem; }
.np.is-live .np-eq { display: inline-flex; }
.np-eq i { width: 3px; height: 100%; background: currentColor; transform-origin: bottom; animation: npEq 0.6s steps(3) infinite alternate; }
.np-eq i:nth-child(2) { animation-delay: -0.2s; }
.np-eq i:nth-child(3) { animation-delay: -0.4s; }
@keyframes npEq {
  from { transform: scaleY(0.25); }
  to   { transform: scaleY(1); }
}

.det {
  position: absolute;
  border: 2px solid var(--signal);
  opacity: 0;
  animation: lockOn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.det-1 { animation-delay: 0.5s; }
.det-2 { animation-delay: 1.1s; }
.det-3 { animation-delay: 1.7s; }
.det-tag {
  position: absolute;
  bottom: 100%;
  left: -2px;
  padding: 1px 0.375rem;
  background: var(--signal);
  color: #14213d;
  font: 600 0.625rem/1.5 var(--font-mono);
  white-space: nowrap;
}
@keyframes lockOn {
  0%   { opacity: 0; transform: scale(1.18); }
  60%  { opacity: 1; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

/* --- Sections --- */
.section { padding: var(--vpad) var(--gutter); }
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.375rem 1.5rem;
  align-items: end;
  margin-bottom: clamp(0.875rem, 2.6vh, 1.75rem);
}
.section-title {
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.section-intro {
  max-width: 32em;
  color: var(--muted);
  font-size: 0.875rem;
  justify-self: end;
}

/* Two sections side by side (Vision Lab + quest log, experience + skills) */
.view-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  /* Same 80rem content width as the other pages; the 3rem is the sections' own gutter */
  padding-inline: max(0px, (100% - 80rem) / 2 - 3rem);
}
.view-split > .section:first-child { padding-right: clamp(1rem, 2vw, 2rem); }
.view-split > .section + .section { padding-left: clamp(1rem, 2vw, 2rem); }
.view-split .section-head { grid-template-columns: 1fr; }
.view-split .section-intro { justify-self: start; }

/* --- Work list --- */
.work-list { border-bottom: 1px solid var(--line); }
.work-row {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 16rem);
  gap: 0.5rem 2.5rem;
  align-items: center;
  padding: clamp(0.625rem, 1.7vh, 1.125rem) 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.work-row:focus-visible { outline-offset: -2px; }
.row-main, .row-meta { position: relative; z-index: 1; }
.row-title {
  font-size: clamp(1.125rem, 1.8vw, 1.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
  transition: color 0.2s ease;
}
.work-row:hover .row-title,
.work-row:focus-visible .row-title { color: var(--accent); }
.row-desc { max-width: 46em; color: var(--muted); font-size: 0.875rem; }
.row-kind { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.125rem; }
.row-stack { color: var(--muted); font-size: 0.8125rem; }
.badge {
  display: inline-block;
  padding: 1px 0.5rem;
  border-radius: 999px;
  background: var(--signal);
  color: #14213d;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Domain watermark per project */
.row-mark {
  position: absolute;
  top: 50%;
  right: 17.5rem;
  width: 5rem;
  height: 5rem;
  z-index: -1;
  color: var(--accent);
  opacity: 0.08;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.work-row:hover .row-mark {
  opacity: 0.2;
  transform: translateY(-50%) scale(1.08) rotate(-4deg);
}
/* SVG user units, so this stays in px */
.radar-sweep {
  transform-origin: 75px 75px;
  animation: radarSweep 4s linear infinite;
}
@keyframes radarSweep { to { transform: rotate(360deg); } }

/* Cursor followers (GÖKBAĞ drone, Pişti card, Minimalframe polaroid) */
.tracker {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.work-row:hover .tracker { opacity: 1; }
.follower {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  color: var(--accent);
}
.drone-svg { width: 2rem; height: 2rem; }
.drone-hud {
  position: absolute;
  right: 0;
  bottom: 0.375rem;
  font: 400 0.625rem/1 var(--font-mono);
  color: var(--muted);
}
.rotor-spin {
  animation: rotorSpin 0.3s linear infinite;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
@keyframes rotorSpin { to { transform: rotate(360deg); } }
.playing-card { width: 1.625rem; height: 2.25rem; }
.polaroid { width: 1.875rem; height: 2.25rem; }
.card-follower-inner {
  animation: cardWobble 3s ease-in-out infinite alternate;
  filter: drop-shadow(0 0.375rem 0.625rem rgba(0, 0, 0, 0.25));
}
@keyframes cardWobble {
  from { transform: rotate(-12deg); }
  to   { transform: rotate(12deg); }
}

/* --- Beyond the code: pursuits beside the photos --- */
.beyond-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  gap: clamp(1rem, 2.5vw, 2.5rem);
}
.pursuits { display: grid; align-content: start; gap: 1.25rem; }
.pursuit {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.pursuit-title { font-size: 1rem; letter-spacing: -0.01em; margin-bottom: 0.25rem; }
.pursuit p { color: var(--muted); font-size: 0.875rem; }
/* Most-played songs this month, from Last.fm: cover in a mini portrait frame, then name and artist */
.tracks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; margin-top: 0.75rem; padding: 3px; }
.tracks li { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.tracks img {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  background: var(--surface);
  border: 3px solid;
  border-color: #f6d365 #b37a14 #b37a14 #f6d365;
  box-shadow: 0 0 0 1px #2a1a05, 3px 3px 0 1px rgba(10, 14, 40, 0.3);
}
.tr-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tr-name, .tr-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-name { font-size: 0.8125rem; font-weight: 600; }
.tr-artist { font-size: 0.75rem; color: var(--muted); }
/* Top artists this month as an arcade high-score table, in the same gold frame */
.hiscore {
  margin-top: 1rem;
  padding: 0.625rem 0.75rem;
  background: #14213d;
  color: #fff;
  border: 4px solid;
  border-color: #f6d365 #b37a14 #b37a14 #f6d365;
  box-shadow: 0 0 0 2px #2a1a05, 5px 5px 0 2px rgba(10, 14, 40, 0.3);
  font: 0.5rem/1.8 var(--font-pixel);
  text-transform: uppercase;
}
.hiscore .hiscore-title { margin-bottom: 0.5rem; text-align: center; color: var(--signal); font-size: 0.625rem; letter-spacing: 0.1em; } /* beats .pursuit p */
.hiscore-list li { display: flex; gap: 0.75rem; padding: 0.125rem 0; }
.hiscore-list li:first-child { color: var(--signal); }
.hs-rank { flex: none; width: 2.25rem; }
.hs-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hs-score { flex: none; }

/* --- Photos --- */
.photo-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: auto auto;
  gap: clamp(0.5rem, 1.2vw, 1rem);
}
/* Large photo stretches to the combined height of the two stacked ones */
.photo-a { grid-row: span 2; display: flex; flex-direction: column; }
.photo-a .photo-btn { flex: 1; min-height: 12rem; position: relative; }
.photo-a .photo-btn img { position: absolute; inset: 0; }
.photo-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--surface);
  cursor: zoom-in;
  overflow: hidden;
}
.photo-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.photo-b .photo-btn,
.photo-c .photo-btn { aspect-ratio: 3 / 2; }
.photo-c .photo-btn img { object-position: center 75%; } /* keeps the cat in frame */
.photo-btn:hover img { transform: scale(1.03); }
.photo-missing {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.photo figcaption {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* --- Experience --- */
.cv-link {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-underline-offset: 0.3125rem;
}
.path { position: relative; padding-left: 2px; }
.path::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--line);
  transform-origin: top;
  transition: transform 1.4s var(--ease-in-out);
}
html.js .path:not(.is-visible)::before { transform: scaleY(0); }
.path li {
  position: relative;
  padding: 0 0 clamp(0.75rem, 2.2vh, 1.375rem) 1.25rem;
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  grid-template-areas: "year what" "year where" "year desc";
  column-gap: 1rem;
  align-content: start;
}
.path-year { grid-area: year; }
.path-what { grid-area: what; }
.path-where { grid-area: where; }
.path li p { grid-area: desc; }
.path li::before {
  content: '';
  position: absolute;
  left: -0.3125rem;
  top: 0.3125rem;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.path li::before { transition: transform 0.2s var(--ease-out), background 0.2s ease; }
.path li > * { transition: transform 0.25s var(--ease-out); }
.path li:hover::before { background: var(--signal); transform: scale(1.4); }
.path li:hover > * { transform: translateX(0.25rem); }
/* Ongoing entries: filled dot with a ping, like a live signal */
.path li.is-now::before { background: var(--accent); animation: nowPing 2s ease-out infinite; }
@keyframes nowPing {
  0%   { box-shadow: 0 0 0 0 var(--accent); }
  70%, 100% { box-shadow: 0 0 0 0.5rem transparent; }
}
.path-year { display: block; font-size: 0.8125rem; color: var(--accent); font-weight: 600; }
.path-what { display: block; font-size: 1rem; }
.path-where { display: block; color: var(--muted); font-size: 0.8125rem; margin-bottom: 0.25rem; }
.path p { color: var(--muted); font-size: 0.875rem; max-width: 40em; }

/* --- Skills --- */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(0.625rem, 1.8vh, 1rem);
}
/* Each category is an inventory slot: lifts on hover, gets a check once inspected */
.skills-grid > div {
  position: relative;
  padding: 0.625rem 0.75rem 0.75rem;
  border: 1.5px solid var(--line);
  background: var(--surface);
  box-shadow: 0 0 0 transparent;
  /* opacity kept so the data-reveal fade still works */
  transition: opacity 0.6s var(--ease-out), transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s ease;
}
.skills-grid > div:hover {
  transform: translate(-3px, -3px);
  border-color: var(--accent);
  box-shadow: 3px 3px 0 var(--accent);
}
.skills-grid > div.is-inspected::after {
  content: '✓';
  position: absolute;
  top: 0.5rem;
  right: 0.625rem;
  font: 0.5rem/1 var(--font-pixel);
  color: var(--accent);
}
.skills-grid dt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: 0.625rem/1.6 var(--font-pixel);
  margin-bottom: 0.5rem;
}
.slot-icon {
  display: grid;
  place-items: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.25rem;
  background: var(--accent);
  color: var(--surface);
  font: 600 0.75rem/1 var(--font-mono);
}
.skills-grid dd { display: flex; flex-wrap: wrap; gap: 0.3125rem; margin: 0; }
.skill {
  padding: 0.125rem 0.4375rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  transition: transform 0.15s var(--ease-out), background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.skill:hover {
  transform: translateY(-2px) rotate(-2deg);
  background: var(--signal);
  border-color: var(--signal);
  color: #14213d;
}

/* --- Contact (page 06) --- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 20rem);
  align-items: center;
  gap: 2rem clamp(2rem, 5vw, 5rem);
  min-height: calc(100svh - var(--header-h));
  padding: var(--vpad) var(--gutter);
  background: var(--bg);
  color: var(--ink);
}
.contact-title {
  font-size: clamp(2.75rem, 7.5vw, 6.5rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.05em;
  margin-bottom: 1.25rem;
}
.contact-intro {
  max-width: 34em;
  font-size: 1rem;
  margin-bottom: 1.75rem;
  color: var(--muted);
}
.contact-email {
  align-self: flex-start;
  font-size: clamp(1.375rem, 4.5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  overflow-wrap: anywhere;
  text-decoration-thickness: 0.1875rem;
  text-underline-offset: 0.5rem;
  margin-bottom: 1.75rem;
}
.contact-email { color: var(--accent); }
.contact-email:hover { color: var(--ink); }
/* Same page colours as the other tabs, so the buttons switch to their on-page variants */
.contact .btn-light { background: var(--accent); color: #fff; }
.contact .btn-light:hover { background: var(--signal); color: #14213d; }
.contact .btn-ghost { color: var(--ink); }
.contact .btn-ghost:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
}
.icon-link {
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1.5px solid currentColor;
  border-radius: 999px;
}
.icon-link:hover { color: var(--accent); }
.icon-link svg { width: 1rem; height: 1rem; }
.contact-main { display: flex; flex-direction: column; min-width: 0; }
.chips-label { color: var(--muted); font-size: 0.8125rem; margin-bottom: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.chip {
  padding: 0.375rem 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.local-time { margin-top: 1rem; color: var(--muted); font-size: 0.8125rem; }

/* End-of-run card: the arcade "game over" screen, in the same gold frame as the high scores */
.endcard {
  padding: 1rem 1.125rem 1.125rem;
  background: #14213d;
  color: #fff;
  border: 4px solid;
  border-color: #f6d365 #b37a14 #b37a14 #f6d365;
  box-shadow: 0 0 0 2px #2a1a05, 6px 6px 0 2px rgba(10, 14, 40, 0.3);
  font: 0.5625rem/1.8 var(--font-pixel);
  text-transform: uppercase;
}
.end-kicker { color: var(--signal); margin-bottom: 0.25rem; }
.end-title { font-size: 0.875rem; line-height: 1.3; margin-bottom: 0.875rem; }
.end-stats div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.1875rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
}
.end-stats dd { margin: 0; color: var(--signal); text-align: right; }
.endcard .end-bar { display: block; width: 100%; height: 0.5rem; margin: 0.875rem 0; background: rgba(255, 255, 255, 0.18); }
.end-continue {
  display: block;
  padding: 0.625rem 0.75rem;
  background: var(--signal);
  color: #14213d;
  font-size: 0.625rem;
  text-align: center;
  text-decoration: none;
}
.end-continue:hover { background: #fff; }
.end-continue.is-over { animation: endBlink 1s steps(1) infinite; }
@keyframes endBlink { 50% { background: #fff; } }
.end-link { display: inline-block; margin-top: 0.625rem; color: rgba(255, 255, 255, 0.7); font-size: 0.5rem; }
.end-link:hover { color: #fff; }

/* --- Footer --- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 1rem var(--gutter);
  font-size: 0.8125rem;
  color: var(--muted);
}
.next-level {
  font: 0.5625rem/1.6 var(--font-pixel);
  color: var(--accent);
  text-decoration: none;
}
.next-level:hover { text-decoration: underline; text-underline-offset: 0.25rem; }

/* --- Overlays (modal + lightbox) --- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 60ms ease-in;
}
.overlay.is-open { opacity: 1; transition: opacity 80ms cubic-bezier(0.16, 1, 0.3, 1); }
.modal-dialog,
.lightbox-frame {
  transform: scale(0.98) translateY(0.25rem);
  transition: transform 60ms ease-in;
  will-change: transform;
}
.overlay.is-open .modal-dialog,
.overlay.is-open .lightbox-frame { transform: none; transition: transform 80ms cubic-bezier(0.16, 1, 0.3, 1); }
.modal-backdrop,
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 48, 0.72);
  backdrop-filter: blur(0.25rem);
}
/* Tint lives on the overlay so the lightbox's white text has a real dark ancestor */
.lightbox { background: rgba(6, 9, 22, 0.94); }
.lightbox-backdrop { background: transparent; }
.modal-dialog {
  position: relative;
  width: 90vw;
  max-width: 42.5rem;
  max-height: 85vh;
  overflow-y: auto;
  scrollbar-width: none;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.modal-dialog::-webkit-scrollbar { display: none; }
.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.close-btn svg { width: 1.125rem; height: 1.125rem; }
.modal-kind { color: var(--muted); font-size: 0.9375rem; margin-bottom: 0.5rem; padding-right: 3rem; }
.modal-status { display: inline-block; margin-left: 0.625rem; }
.modal-title {
  font-size: clamp(1.875rem, 4.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin-bottom: 0.5rem;
}
.modal-sub { color: var(--accent); font-weight: 600; margin-bottom: 1.125rem; }
.modal-text { margin-bottom: 1.5rem; max-width: 38em; }
.modal-figure { margin-bottom: 1.5rem; }
/* Reserved box so the screenshot loading in doesn't push content down */
.modal-figure img { width: 100%; aspect-ratio: 16 / 9; max-height: 18.75rem; object-fit: cover; }
.modal-h { font-size: 1.125rem; letter-spacing: -0.01em; margin: 1.5rem 0 0.625rem; }
.modal-list { margin: 0; padding-left: 1.2em; display: grid; gap: 0.625rem; }
.modal-list li { color: var(--muted); max-width: 40em; }
.modal-list li::marker { color: var(--accent); }
.modal-list strong { color: var(--ink); }
.pipeline { list-style: none; margin: 0; padding: 0; counter-reset: stage; }
.pipe-stage {
  counter-increment: stage;
  position: relative;
  padding: 0 0 1.25rem 2.5rem;
  border-left: 1px solid var(--line);
  margin-left: 0.75rem;
}
.pipe-stage:last-child { border-left-color: transparent; padding-bottom: 0; }
.pipe-stage::before {
  content: counter(stage);
  position: absolute;
  left: -0.8125rem;
  top: -2px;
  width: 1.625rem;
  height: 1.625rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
  font: 700 0.8125rem var(--font-mono);
}
.pipe-layer { font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.5rem; }
.pipe-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.pipe-node {
  display: inline-flex;
  flex-direction: column;
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 0.875rem;
  font-weight: 600;
}
.pipe-node small { font: 400 0.75rem var(--font-mono); color: var(--muted); }
.pipe-edge { color: var(--accent); font-weight: 700; }
.pipe-note { color: var(--muted); font-size: 0.8125rem; margin-top: 0.375rem; }
.modal-stack { color: var(--muted); }
.modal-actions { margin-top: 2rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.modal-actions .btn-light { background: var(--accent); color: #fff; }
.modal-actions .btn-light:hover { background: var(--ink); color: var(--surface); }

.lightbox-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(68.75rem, 100%);
  color: #fff;
}
.lightbox-close { position: static; align-self: flex-end; margin-bottom: 0.75rem; border-color: rgba(255, 255, 255, 0.4); }
/* Fixed stage so the frame doesn't resize while the photo loads */
.lightbox-img { width: 100%; height: 76vh; object-fit: contain; }
.lightbox-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 76vh;
  white-space: pre-line;
  padding: 5rem 2.5rem;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.4);
}
.lightbox-bar {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  text-align: center;
}
.lightbox-caption { font-weight: 600; }
.lightbox-counter { font-size: 0.875rem; opacity: 0.7; }
.lightbox-nav {
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.12); }

/* --- Retro toasts --- */
.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.625rem;
  width: min(20rem, calc(100vw - 2rem));
  pointer-events: none;
}
/* Notched corners for the 8-bit window look */
.toast {
  --notch: 0.375rem;
  position: relative;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  width: 100%;
  padding: 0.75rem 0.875rem 0.875rem;
  background: #14213d;
  color: #fff;
  border: 0.1875rem solid var(--signal);
  clip-path: polygon(0 var(--notch), var(--notch) var(--notch), var(--notch) 0, calc(100% - var(--notch)) 0, calc(100% - var(--notch)) var(--notch), 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, var(--notch) calc(100% - var(--notch)), 0 calc(100% - var(--notch)));
  cursor: pointer;
  pointer-events: auto;
  animation: toastIn 240ms steps(4) both;
}
.toast.is-leaving { animation: toastOut 200ms steps(4) forwards; }
.toast.is-level { border-color: #7cf29a; }
.toast.is-info { border-color: #fff; }
@keyframes toastIn { from { transform: translateX(110%); } }
@keyframes toastOut { to { transform: translateX(110%); opacity: 0; } }
.toast-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.875rem;
  height: 1.875rem;
  background: var(--signal);
  color: #14213d;
  font-size: 0.9375rem;
  line-height: 1;
}
.is-level .toast-icon { background: #7cf29a; }
.is-info .toast-icon { background: #fff; }
.toast-kicker {
  margin-bottom: 0.375rem;
  font: 0.5rem/1.4 var(--font-pixel);
  text-transform: uppercase;
  color: var(--signal);
}
.is-level .toast-kicker { color: #7cf29a; }
.is-info .toast-kicker { color: #fff; }
.toast-kicker:empty { display: none; }
.toast-title { margin-bottom: 0.25rem; font: 0.625rem/1.5 var(--font-pixel); }
.toast-text { font-size: 0.8125rem; line-height: 1.45; opacity: 0.85; }
.toast-text:empty { display: none; }
.toast-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0.1875rem;
  background: currentColor;
  opacity: 0.4;
  transform-origin: left;
  animation: toastTimer var(--life, 4s) linear forwards;
}
@keyframes toastTimer { to { transform: scaleX(0); } }

/* Pixel confetti for the big moments */
.confetti {
  position: fixed;
  z-index: 80;
  width: 0.5rem;
  height: 0.5rem;
  pointer-events: none;
  animation: confetti 1.1s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }

/* --- Vision Lab --- */
.lab-main { display: flex; flex-direction: column; }
.lab-card {
  display: flex;
  flex-direction: column;
  padding: clamp(0.75rem, 1.4vw, 1.125rem);
  border: 1px solid var(--line);
  background: var(--surface);
}
.lab-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
}
.seg { display: inline-flex; border: 2px solid var(--ink); }
.seg button {
  padding: 0.375rem 0.75rem;
  border: 0;
  background: transparent;
  font-weight: 600;
  font-size: 0.8125rem;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.lab-thresh {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font: 0.75rem var(--font-mono);
}
.lab-thresh input { width: 8.5rem; accent-color: var(--accent); }
.lab-stats {
  margin-left: auto;
  font: 0.6875rem/1.5 var(--font-mono);
  color: var(--muted);
  text-align: right;
}
.lab-arena {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b1030;
  cursor: crosshair;
  touch-action: manipulation;
}
.lab-note { margin-top: 0.5rem; color: var(--muted); font-size: 0.8125rem; }

/* --- Quest log (compact list beside the lab) --- */
.quest-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
  font: 0.5625rem/1.6 var(--font-pixel);
}
.quest-progress .xp-bar { flex: 1; min-width: 3rem; height: 0.5rem; }
.quest-progress .btn { min-height: 1.75rem; padding: 0 0.625rem; font: 600 0.75rem var(--font-sans); }
.quest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.3125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.quest {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  padding: 0.1875rem 0.4375rem;
  border: 1.5px solid var(--line);
  background: var(--surface);
}
.quest > div { min-width: 0; }
.quest.is-done { border-color: var(--accent); }
.quest-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  background: var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1;
}
.quest.is-done .quest-icon { background: var(--signal); color: #14213d; }
.quest-title {
  margin-bottom: 0.125rem;
  font: 0.5rem/1.5 var(--font-pixel);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quest:not(.is-done) .quest-title { color: var(--muted); }
/* One line each; the full text is in the item's tooltip */
.quest-desc {
  color: var(--muted);
  font-size: 0.6875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quest-xp { color: var(--accent); font-family: var(--font-mono); }

/* --- Konami 8-bit mode --- */
html.retro h1, html.retro h2, html.retro h3, html.retro .tab, html.retro .nav-brand {
  font-family: var(--font-pixel);
  font-weight: 400;
  letter-spacing: 0;
}
html.retro .hero-name { font-size: clamp(1.75rem, 4.5vw, 4rem); line-height: 1.15; }
html.retro .section-title, html.retro .contact-title { font-size: clamp(1.125rem, 2.4vw, 2rem); line-height: 1.25; }
html.retro .row-title { font-size: clamp(0.75rem, 1.2vw, 1rem); line-height: 1.4; }
html.retro body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.08) 0 1px, transparent 1px 0.1875rem);
}

/* --- Entrance & reveal (gated on html.js so no-JS visitors see everything) --- */
html.js .hero-text > * { animation: riseIn 0.7s var(--ease-out) both; }
html.js .hero-text > :nth-child(2) { animation-delay: 80ms; }
html.js .hero-text > :nth-child(3) { animation-delay: 160ms; }
html.js .hero-text > :nth-child(4) { animation-delay: 240ms; }
html.js .hero-text > :nth-child(5) { animation-delay: 320ms; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(1rem); }
}

[data-reveal] { transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
html.js [data-reveal]:not(.is-visible) { opacity: 0; transform: translateY(1.5rem); }

/* After the portrait detections, lock onto the CV button once */
.cv-lock { position: relative; }
.cv-lock::before,
.cv-lock::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cv-lock::before {
  content: '';
  inset: -0.4375rem;
  border: 2px solid var(--signal);
}
.cv-lock::after {
  content: 'resume 0.99';
  bottom: calc(100% + 0.4375rem);
  left: -0.4375rem;
  padding: 2px 0.4375rem;
  background: var(--signal);
  color: #14213d;
  font: 600 0.6875rem/1.5 var(--font-mono);
  white-space: nowrap;
}
html.js .cv-lock::before { animation: ctaLock 4s var(--ease-out) 2.4s both; }
html.js .cv-lock::after  { animation: ctaTag 4s var(--ease-out) 2.4s both; }
@keyframes ctaLock {
  0%   { opacity: 0; transform: scale(1.18); }
  10%  { opacity: 1; transform: scale(1); }
  85%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes ctaTag {
  0%, 8%   { opacity: 0; }
  12%, 85% { opacity: 1; }
  100%     { opacity: 0; }
}

/* --- One screen per page on laptops and up: header, page, footer; the page never scrolls --- */
@media (min-width: 900px) {
  html, body { height: 100%; overflow: hidden; }
  body { display: flex; flex-direction: column; }
  .nav { flex: none; }
  main { flex: 1; min-height: 0; }
  .footer { flex: none; padding-block: 0.5rem; }
  /* Safety net for very short windows: the page can still be scrolled, but shows no scrollbar */
  .view { height: 100%; overflow-y: auto; scrollbar-width: none; }
  .view::-webkit-scrollbar { display: none; }
  /* Chrome makes scroll containers focusable; a page isn't a control, so no focus ring on it */
  .view:focus { outline: none; }
  .view:not(.view-split) { display: flex; flex-direction: column; }
  .view > .section, .hero, .contact { flex: 1; min-height: 0; }
  .hero, .contact { min-height: 100%; }
  /* Footer floats over the bottom of the scene on the overview */
  body[data-view="overview"] .footer { position: fixed; inset: auto 0 0 0; }
  body[data-view="overview"] .hero { padding-bottom: calc(var(--foot-real, 2.5rem) + var(--vpad)); }
  .portrait { width: auto; height: min(44vh, 20rem); }
  .np { width: calc(min(44vh, 20rem) * 0.8); } /* same width as the 4:5 frame above it */

  /* Lab: arena takes the height that's left */
  .lab-card { flex: 1; min-height: 0; }
  .lab-arena { flex: 1 1 0; min-height: 8rem; aspect-ratio: auto; }

  /* Beyond: photos fill the height that's left */
  .view > .section:has(.beyond-split) { display: flex; flex-direction: column; }
  .beyond-split { flex: 1; min-height: 0; }
  .photo-grid { min-height: 0; grid-template-rows: 1fr 1fr; }
  .photo-b, .photo-c { display: flex; flex-direction: column; min-height: 0; }
  .photo-b .photo-btn, .photo-c .photo-btn { flex: 1; min-height: 0; aspect-ratio: auto; }
  .photo-a .photo-btn { min-height: 0; }
}

/* --- Overview: the scene runs edge to edge, under a glass header and footer --- */
body[data-view="overview"] { background-color: var(--hero); }
body[data-view="overview"] .nav,
body[data-view="overview"] .footer {
  background: rgba(10, 16, 48, 0.28);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
body[data-view="overview"] .nav { position: fixed; inset: 0 0 auto 0; }
body[data-view="overview"] .tabs { border-color: rgba(255, 255, 255, 0.16); }
body[data-view="overview"] .tab { color: rgba(255, 255, 255, 0.75); }
body[data-view="overview"] .tab:hover,
body[data-view="overview"] .tab[aria-current="page"] { color: #fff; }
body[data-view="overview"] .tab[aria-current="page"] { border-bottom-color: var(--signal); }
body[data-view="overview"] .tab-num,
body[data-view="overview"] .next-level { color: var(--signal); }
body[data-view="overview"] .nav-cv { background: #fff; color: #14213d; }
body[data-view="overview"] .nav-cv:hover { background: var(--signal); }
body[data-view="overview"] .xp-hud:hover { color: var(--signal); }
body[data-view="overview"] .hero {
  min-height: 100svh;
  padding-top: calc(var(--nav-real, var(--header-h)) + var(--vpad));
}

/* --- Responsive --- */
@media (max-width: 1320px) {
  :root { --header-h: 6.25rem; }
  .nav { padding-top: 0.5rem; }
  .nav-brand { margin-right: auto; }
  .tabs {
    order: 3;
    flex-basis: 100%;
    margin-top: 0.5rem;
    border-top: 1px solid var(--line);
  }
  .tab:first-child, .tab:last-child { margin: 0; }
  .tab { padding: 0.625rem 0.5rem; }
}
@media (max-width: 899px) {
  .hero {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: none;
    align-items: start;
    align-content: start;
    gap: 0 1.25rem;
  }
  /* Text children join the hero grid so the now-playing strip can sit beside the name */
  .hero-text { display: contents; }
  .hero-text > *, .portrait { grid-column: 1 / -1; }
  .portrait { grid-row: 1; }
  .hero-name { grid-column: 1; grid-row: 2; }
  .np { grid-area: auto; grid-column: 2; grid-row: 2; align-self: center; justify-self: end; width: auto; max-width: 100%; }
  /* Room above the frame for the tower's battlements */
  .portrait { justify-self: start; width: min(44vw, 12rem); margin: 4.5rem 0 1.25rem 1.25rem; }
  .section-head { grid-template-columns: 1fr; }
  .section-intro { justify-self: start; }
  .view-split { display: block; }
  .view-split > .section:first-child { padding-right: var(--gutter); }
  .view-split > .section + .section { padding-left: var(--gutter); padding-top: 0; }
  .beyond-split { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; align-content: center; }
  .work-row { grid-template-columns: 1fr; }
  .row-mark { right: 0; top: 1rem; transform: none; width: 4rem; height: 4rem; }
  .work-row:hover .row-mark { transform: scale(1.08) rotate(-4deg); }
}
@media (max-width: 560px) {
  .nav-brand { display: none; }
  .nav-tools { margin-left: auto; }
  .xp-hud .xp-bar { width: 2rem; }
  .lab-stats { margin-left: 0; text-align: left; }
  .hero-facts { grid-template-columns: 1fr; }
  /* Slim one-line strip beside the name */
  .np { gap: 0.5rem; padding: 0.25rem 0.5rem 0.25rem 0.25rem; border-width: 3px; box-shadow: 0 0 0 2px #2a1a05, 4px 4px 0 2px rgba(10, 14, 40, 0.45); }
  .np-cover { width: 2.25rem; height: 2.25rem; }
  .np-status { font-size: 0.4375rem; margin-bottom: 0.1875rem; }
  .np-title { font-size: 0.5rem; -webkit-line-clamp: 1; line-clamp: 1; margin-bottom: 0.125rem; }
  .np-artist { font-size: 0.6875rem; }
  .photo-grid { grid-template-columns: 1fr; }
  .photo-a { grid-row: auto; }
  .photo-a .photo-btn { flex: none; min-height: 0; aspect-ratio: 4 / 5; }
  .path li { grid-template-columns: 1fr; grid-template-areas: "year" "what" "where" "desc"; }
  .footer { flex-direction: column; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .overlay.is-open .modal-dialog, .overlay.is-open .lightbox-frame, .modal-dialog, .lightbox-frame { transform: none; }
  .det { animation: none; opacity: 1; }
  .view.is-active { animation: none; }
  .toast { animation-name: fadeIn; animation-timing-function: ease; }
  .toast.is-leaving { animation: fadeIn 200ms ease reverse forwards; }
  .detector { transition: opacity 0.2s ease; }
  .rotor-spin, .radar-sweep, .card-follower-inner, .path li.is-now::before { animation: none; }
  .skills-grid > div:hover, .skill:hover, .path li:hover > * { transform: none; }
  .photo-btn img, .row-mark { transition: none; }
  .status-dot::after { animation: none; opacity: 0; }
  .np-eq i, .np.is-new, .end-continue.is-over { animation: none; }
  .np-eq i:nth-child(2) { transform: scaleY(0.6); }
  html.js .hero-text > * { animation-name: fadeIn; }
  [data-reveal] { transition: opacity 0.4s ease; }
  html.js [data-reveal]:not(.is-visible) { transform: none; }
  .path::before { transition: none; }
  html.js .path:not(.is-visible)::before { transform: none; }
  html.js .cv-lock::before { animation-name: ctaTag; }
}
@keyframes fadeIn { from { opacity: 0; } }

/* Dark accent is light periwinkle, so filled accent buttons need dark text */
:root[data-theme="dark"] .nav-cv,
:root[data-theme="dark"] .btn-accent,
:root[data-theme="dark"] .contact .btn-light,
:root[data-theme="dark"] .modal-actions .btn-light { color: #14213d; }
