/* BLU — futuristic pixel train.
   Sections: tokens · base · loader & intro · stage · panels · map · projects · skills · contact · nav · debug · phone */

/* ── Tokens ─────────────────────────────────────────── */
/* Colour names match blu.yaml → theme, which overrides them at runtime. */
:root {
  --void: #000814;    /* page background, deepest shadow */
  --night: #011f4b;   /* panel backgrounds */
  --blu: #03396c;     /* the train's body colour */
  --mid: #005b96;     /* borders, inactive lines */
  --soft: #6497b1;    /* secondary text, frames */
  --pale: #b3cde0;    /* main text */
  --amber: #ffb347;   /* accent: lights, buttons, highlights */

  --font-heading: 'Press Start 2P', ui-monospace, monospace;
  --font-body: 'VT323', ui-monospace, monospace;

  --nav-height: 60px;
  --gap: 16px;
  --panel-width: 680px;
  --press-shadow: 4px 4px 0 var(--void);   /* chunky pixel drop shadow on buttons */
}

/* ── Base ───────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--void); }
body { color: var(--pale); font: 22px/1.2 var(--font-body); overflow-x: hidden; }
a { color: var(--amber); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

/* Shared look for amber buttons: pressing nudges them into their shadow. */
.btn, .close, .carousel-btn {
  color: var(--void); background: var(--amber); box-shadow: var(--press-shadow);
}
.btn:active, .close:active, .carousel-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--void); }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 10px 14px;
  font: 11px var(--font-heading); text-decoration: none;
}
.icon { width: 18px; height: 18px; flex: none; }

/* ── Loader & title screen ──────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-content: center; gap: 24px; text-align: center;
  background: var(--void);
  transition: opacity .6s, visibility .6s;
}
#loader.gone { opacity: 0; visibility: hidden; }
#loader .small { font-size: 18px; color: var(--soft); max-width: 36ch; margin: 12px auto 0; }
#loader .detail { font-size: 16px; opacity: .7; }

/* Shown only when JavaScript is off; sits above the loader. */
.noscript {
  position: fixed; inset: 0; z-index: 60; margin: auto;
  width: min(90vw, 520px); height: fit-content; padding: 28px; text-align: center;
}
.noscript h1 { font: 16px/1.5 var(--font-heading); color: var(--amber); margin-bottom: 12px; }

/* 404 page */
.not-found { min-height: 100vh; display: grid; place-items: center; padding: var(--gap); }
.not-found-card { padding: 32px; text-align: center; max-width: 480px; }
.not-found-card h1 { font: 16px/1.5 var(--font-heading); color: var(--amber); margin: 16px 0 8px; }

.brand-big {
  font: 400 clamp(48px, 12vw, 120px)/1 var(--font-heading);
  color: var(--amber);
  text-shadow: 6px 6px 0 var(--blu), 12px 12px 0 var(--night);
  letter-spacing: .05em;
}
.blink { font: 12px var(--font-heading); animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

#intro {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: calc(var(--nav-height) + 6vh) var(--gap) 0; text-align: center;
  pointer-events: none;
}
#intro > * { text-shadow: 0 2px 0 var(--void), 0 0 12px var(--void); }
#intro-name { font: 14px/1.6 var(--font-heading); margin-top: 12px; }
#intro-tagline { font-size: 24px; color: var(--soft); }
#intro-hint { margin-top: auto; margin-bottom: calc(var(--nav-height) + 4vh); }

/* ── Stage: scenes and their cameras ────────────────── */
/* The stage is fixed to the screen; scrolling only drives the animation. */
#stage { position: fixed; inset: 0; overflow: hidden; }
#scenes, .scene { position: absolute; inset: 0; }
.scene { overflow: hidden; visibility: hidden; }
.scene::after {   /* soft vignette for depth */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 8, 20, .55) 100%);
}
.camera { position: absolute; left: 0; top: 0; }   /* size and transform set in JS. No will-change: 8 huge layers can exhaust phone GPU memory */
.camera img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  image-rendering: pixelated; user-select: none; -webkit-user-drag: none;
}

/* An empty, very tall element: it only exists to make the page scrollable. */
#scroller { width: 1px; pointer-events: none; }

/* ── Panels ─────────────────────────────────────────── */
#overlays { position: fixed; inset: 0; z-index: 5; pointer-events: none; }

/* The pixel "window" frame used by panels and cards. */
.framed {
  background: color-mix(in srgb, var(--night) 94%, transparent);
  border: 4px solid var(--soft);
  box-shadow: 0 0 0 4px var(--night), 0 0 0 8px var(--blu), 10px 10px 0 8px rgba(0, 0, 0, .45);
}

/* Centred between the nav and the bottom of the screen; scrolls inside if too tall. */
.panel {
  position: absolute; left: 0; right: 0;
  top: calc(var(--nav-height) + 12px); bottom: 20px;
  margin: auto;
  width: min(calc(100vw - 2 * var(--gap) - 16px), var(--panel-width));
  height: fit-content;
  max-height: calc(100% - var(--nav-height) - 40px);
  overflow: auto;
  padding: 28px;
  pointer-events: auto;
  visibility: hidden;   /* GSAP's autoAlpha shows it */
}
.close {
  position: sticky; top: 0; z-index: 3;   /* stays visible while the panel scrolls */
  float: right; margin: -14px -14px 8px 12px;
  width: 40px; height: 40px; display: grid; place-items: center;
}
.close .icon { width: 16px; height: 16px; }
.close:hover { background: var(--pale); }

.eyebrow {
  font: 10px/1.6 var(--font-heading); color: var(--soft);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px;
}
.panel h2 { font: 400 clamp(15px, 2.4vw, 22px)/1.4 var(--font-heading); color: var(--amber); }
.panel h3 { font: 400 13px/1.5 var(--font-heading); color: var(--amber); }
.panel p + p { margin-top: 10px; }
.subtitle { font-size: 24px; margin-top: 6px; }
.meta { color: var(--soft); font-size: 20px; }
.counter { font: 10px var(--font-heading); color: var(--soft); }
.empty { color: var(--soft); margin-top: 12px; }
.map-empty { position: absolute; left: 0; right: 0; bottom: 24px; text-align: center; }
.panel:focus { outline: none; }   /* focus is moved here by the nav for screen readers; no visible ring needed */
.divider { height: 4px; margin: 18px 0; background: repeating-linear-gradient(90deg, var(--mid) 0 8px, transparent 8px 14px); }

.bullets { list-style: none; margin-top: 14px; display: grid; gap: 8px; }
.bullets li { position: relative; padding-left: 22px; }
.bullets li::before { content: ''; position: absolute; left: 4px; top: .45em; width: 8px; height: 8px; background: var(--amber); }

/* Profile */
.profile-head { display: flex; gap: 20px; align-items: center; margin-bottom: 16px; }
.avatar {
  width: 112px; height: 112px; flex: none;
  image-rendering: pixelated;
  border: 4px solid var(--amber); background: var(--blu);
  box-shadow: 6px 6px 0 var(--void);
}
.interests { margin-top: 14px; }

/* ── Map (experience) ───────────────────────────────── */
.map-panel {
  inset: calc(var(--nav-height) + 8px) var(--gap) var(--gap);
  width: auto; height: auto; max-height: none; margin: 0;
  padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.map-panel > .eyebrow { padding: 14px 18px 0; }
.map-panel > .close { position: absolute; top: 10px; right: 10px; margin: 0; }
.map-view {
  position: relative; flex: 1; overflow: hidden;
  background: radial-gradient(ellipse at center, var(--night), var(--void));
}
/* The world is laid out at 1000px wide and moved/zoomed by GSAP, like a camera.
   --counter-zoom is 1/zoom, so pins and the route stay the same size on screen. */
.map-world { position: absolute; left: 0; top: 0; width: 1000px; transform-origin: 0 0; --counter-zoom: 1; }
.map-world > img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.route polyline {
  fill: none; stroke: var(--amber); stroke-linejoin: round;
  stroke-width: calc(3px * var(--counter-zoom));
  filter: drop-shadow(0 0 2px var(--amber));
}
.pin { position: absolute; width: 0; height: 0; transform: scale(var(--counter-zoom)); }
.pin-dot {
  position: absolute; left: -10px; top: -10px; width: 20px; height: 20px;
  background: var(--amber); border: 4px solid var(--void);
  box-shadow: 0 0 0 3px var(--amber), 0 0 18px 4px var(--amber);
}
.pin-dot::after {   /* radar ping */
  content: ''; position: absolute; inset: -10px; border: 3px solid var(--amber);
  animation: ping 1.6s steps(6) infinite;
}
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

.card { padding: 20px; }
.job-card {
  position: absolute; right: 24px; top: 56px; bottom: 24px; margin: auto 0;
  width: min(44%, 460px); height: fit-content; max-height: calc(100% - 80px);
  overflow: auto;
  visibility: hidden;
}
.dates { color: var(--amber); font-size: 20px; }

/* ── Projects ───────────────────────────────────────── */
.projects-panel { --panel-width: 760px; }
.project-stack { display: grid; }
.project-card { grid-area: 1 / 1; visibility: hidden; }   /* all cards share one cell; GSAP swaps them */
.project-body { margin-top: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag { font-size: 18px; padding: 0 8px; border: 2px solid var(--mid); color: var(--soft); }

.carousel {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border: 4px solid var(--mid); background: var(--void);
  touch-action: pan-y;   /* vertical swipes still scroll the page */
}
.carousel-track { display: flex; height: 100%; transition: transform .35s steps(6); }
.carousel-track img { flex: none; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; user-select: none; -webkit-user-drag: none; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; display: grid; place-items: center;
  font: 14px var(--font-heading);
}
.carousel-btn:active { transform: translate(2px, calc(-50% + 2px)); }
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }
.carousel-dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 8px; }
.carousel-dot { width: 10px; height: 10px; background: var(--soft); }
.carousel-dot.active { background: var(--amber); }

/* ── Skills ─────────────────────────────────────────── */
.skills-panel { --panel-width: 940px; }
.consoles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 8px; }
.console { padding: 14px; border: 3px solid var(--mid); background: var(--blu); }
.console h3 { margin-bottom: 12px; font-size: 10px; }
.console ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
/* --lit goes 0 → 1 as GSAP "switches the button on". */
.skill {
  --lit: 0;
  padding: 2px 10px; font-size: 20px; background: var(--night);
  border: 2px solid color-mix(in srgb, var(--amber) calc(var(--lit) * 100%), var(--soft));
  opacity: calc(.3 + .7 * var(--lit));
  box-shadow: 0 0 calc(var(--lit) * 14px) color-mix(in srgb, var(--amber) 70%, transparent), inset 0 -3px 0 rgba(0, 0, 0, .4);
}

/* ── Contact ────────────────────────────────────────── */
.contact-panel { text-align: center; }
.board {
  font: 400 clamp(14px, 2.6vw, 22px)/1.4 var(--font-heading); color: var(--amber); letter-spacing: .08em;
  background: var(--void); padding: 14px; border: 4px solid var(--mid); margin-bottom: 16px;
}
.contact-links { list-style: none; display: grid; gap: 10px; margin-top: 18px; }
.contact-links a {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; font: 11px/1.4 var(--font-heading); word-break: break-word;
  color: var(--pale); background: var(--blu); border: 3px solid var(--mid); text-decoration: none;
}
.contact-links a:hover, .contact-links a:focus-visible { border-color: var(--amber); color: var(--amber); }
.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.socials .btn { margin-top: 0; }
.socials .icon { width: 20px; height: 20px; }

/* ── Journey nav ────────────────────────────────────── */
#route {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10;
  height: var(--nav-height);
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px 0 20px;
  background: linear-gradient(var(--void) 30%, transparent);
}
.brand { font: 14px var(--font-heading); color: var(--amber); text-shadow: 3px 3px 0 var(--blu); }
.nav-current { display: none; }   /* phone only: name of the current stop */
.line { position: relative; flex: 1; height: 4px; margin: 0 24px; background: var(--mid); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--amber); }
.train {   /* the little train riding the end of the fill */
  position: absolute; right: -10px; top: -6px; width: 20px; height: 16px;
  background: var(--amber); border: 3px solid var(--void); box-shadow: 0 0 10px var(--amber);
}
.stops { position: absolute; inset: 0; list-style: none; }
.stops li { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.stop-btn { display: grid; justify-items: center; padding: 6px; }
.stop-btn .dot { width: 12px; height: 12px; background: var(--night); border: 3px solid var(--soft); }
.stop-label { position: absolute; top: 24px; white-space: nowrap; font: 8px var(--font-heading); color: var(--soft); }
.stop-btn.passed .dot { background: var(--amber); border-color: var(--amber); }
.stop-btn.current .dot { background: var(--amber); border-color: var(--pale); box-shadow: 0 0 10px var(--amber); }
.stop-btn.current .stop-label { color: var(--amber); }

/* ── Debug mode (?debug) ────────────────────────────── */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60;
  padding: 10px 14px; font: 11px var(--font-heading); color: var(--void); background: var(--amber);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
#toast.show { opacity: 1; }
.debug #stage { cursor: crosshair; }

/* ── Phone ──────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --nav-height: 56px; --gap: 12px; }
  body { font-size: 20px; }

  /* Nav moves to the bottom, within thumb reach. */
  #route {
    top: auto; bottom: 0; gap: 10px;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding: 0 16px env(safe-area-inset-bottom) 12px;
    background: linear-gradient(transparent, var(--void) 45%);
  }
  .nav-current { display: block; width: 92px; font: 8px/1.4 var(--font-heading); color: var(--amber); }
  .line { margin: 0 8px; }
  .stop-label { display: none; }

  .panel {
    top: 16px; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 8px);
    padding: 20px;
  }
  .map-panel { inset: 12px 12px calc(var(--nav-height) + env(safe-area-inset-bottom) + 8px); }
  .job-card { left: 10px; right: 10px; bottom: 10px; top: auto; margin: 0; width: auto; max-height: 56%; }
  .avatar { width: 80px; height: 80px; }
  #intro { padding-top: 12vh; }
  #intro-hint { margin-bottom: calc(var(--nav-height) + 6vh); }
}

@media (prefers-reduced-motion: reduce) {
  .blink, .pin-dot::after { animation: none; }
  .carousel-track { transition: none; }
}
