/* ================================================================
   kad.me - base.css
   Reset, shared scaffolding, HUD, boot, terminal, toast.
   Era-specific theming lives in eras.css.
   ================================================================ */

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

:root {
  --f-crt: 'VT323', monospace;
  --f-pixel: 'Press Start 2P', monospace;
  --f-mono: 'JetBrains Mono', Consolas, monospace;
  --f-ui: 'Inter', system-ui, sans-serif;
  --f-xp: Tahoma, 'Segoe UI', sans-serif;

  /* morphing vars - overridden per body[data-era] */
  --bg: #050805;
  --fg: #c8ffc8;
  --accent: #33ff66;
  --hud-bg: rgba(5, 12, 5, .85);
  --hud-border: rgba(51, 255, 102, .35);
  --hud-font: var(--f-crt);
  --hud-size: 1.15rem;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-ui);
  overflow-x: hidden;
  transition: background 1s ease, color 1s ease;
}

a { color: var(--accent); }
::selection { background: var(--accent); color: var(--bg); }

/* ---------------- Era section scaffolding ---------------- */
.era { position: relative; min-height: 100vh; padding: 16vh 24px 14vh; overflow: hidden; }
.era-inner { max-width: 960px; margin: 0 auto; position: relative; z-index: 2; }
.era-kicker { font-family: var(--f-mono); font-size: .8rem; letter-spacing: .25em; opacity: .7; margin-bottom: 1.2rem; }
.era-lede { font-size: 1.15rem; line-height: 1.7; max-width: 42rem; margin: 1.4rem 0 2.4rem; white-space: pre-line; }
.era-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.scroll-hint { margin-top: 4rem; text-align: center; opacity: .55; animation: bob 2.2s ease-in-out infinite; font-family: var(--f-crt); font-size: 1.2rem; }
@keyframes bob { 0%,100% { transform: translateY(0);} 50% { transform: translateY(8px);} }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; inset: 0 0 auto 0; z-index: 900;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
  background: var(--hud-bg);
  border-bottom: 1px solid var(--hud-border);
  backdrop-filter: blur(8px);
  font-family: var(--hud-font); font-size: var(--hud-size);
  transition: background 1s ease, border-color 1s ease;
}
.hud-logo { text-decoration: none; color: var(--fg); font-weight: 700; letter-spacing: .08em; }
.hud-logo span { color: var(--accent); }
.hud-year { margin-left: 6px; }
.odo {
  display: inline-block; min-width: 4ch; text-align: center;
  color: var(--accent);
  border: 1px solid var(--hud-border); border-radius: 4px;
  padding: 1px 10px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px currentColor;
}
.hud-nav { margin-left: auto; display: flex; gap: 14px; }
.hud-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--fg); opacity: .45; transition: opacity .3s; }
.hud-nav a:hover { opacity: .9; }
.hud-nav a.active { opacity: 1; }
.hud-nav i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: block; }
.hud-nav a.active i { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.hud-nav b { font-size: .55rem; font-family: var(--f-mono); letter-spacing: .12em; font-weight: 600; }
#term-btn {
  background: transparent; color: var(--accent); border: 1px solid var(--hud-border);
  border-radius: 4px; padding: 4px 10px; cursor: pointer;
  font-family: var(--f-mono); font-size: .85rem;
}
#term-btn:hover { background: var(--accent); color: var(--bg); }

/* ---------------- Boot overlay ---------------- */
#boot {
  position: fixed; inset: 0; z-index: 2000;
  background: #000; color: #aaa;
  padding: 4vh 5vw;
  font-family: var(--f-crt); font-size: clamp(15px, 2.2vmin, 22px);
}
#boot.hidden, #crt-flash.hidden { display: none; }
#boot-text { white-space: pre-wrap; line-height: 1.35; }
#boot-text .b-ok { color: #33ff66; }
#boot-text .b-val { color: #ffd75f; }
#boot-skip {
  position: absolute; bottom: 3vh; right: 4vw;
  background: none; border: 1px solid #444; color: #888;
  font-family: var(--f-crt); font-size: 1rem; padding: 4px 12px; cursor: pointer;
}
#boot-skip:hover { color: #fff; border-color: #fff; }
#crt-flash { position: fixed; inset: 0; z-index: 1999; background: #fff; opacity: 0; pointer-events: none; }
#crt-flash.zap { animation: crtzap .45s ease-out forwards; }
@keyframes crtzap {
  0% { opacity: .95; transform: scaleY(.004); }
  40% { opacity: .8; transform: scaleY(1.02); }
  100% { opacity: 0; transform: scaleY(1); }
}

/* ---------------- FX overlay (scanlines on metal era) ---------------- */
#fx-overlay { position: fixed; inset: 0; z-index: 800; pointer-events: none; opacity: 0; transition: opacity 1s ease; }
body[data-era="metal"] #fx-overlay {
  opacity: 1;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.5) 100%);
}

/* ---------------- Plaque (context label above showcased artifacts) ---------------- */
.plaque {
  display: flex; gap: 14px; align-items: flex-start;
  max-width: 640px; margin: 2.4rem 0 1rem;
}
.plaque-tag {
  flex: none; margin-top: 3px;
  font-family: var(--f-mono); font-size: .6rem; font-weight: 700;
  letter-spacing: .15em; white-space: nowrap;
  padding: 4px 10px; border-radius: 3px;
  background: var(--accent); color: var(--bg);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.plaque p { font-size: .95rem; line-height: 1.65; opacity: .92; }
.plaque p b { color: var(--accent); }
@media (max-width: 600px) {
  .plaque { flex-direction: column; gap: 8px; }
}

/* ---------------- Career log (same signature look in every era) ---------------- */
.career {
  margin-top: 2.6rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg) 86%, var(--accent) 6%);
  padding: 16px 18px 18px;
}
.career-head {
  font-family: var(--f-mono); font-size: .7rem; letter-spacing: .3em;
  color: var(--accent); margin-bottom: 16px; font-weight: 600;
}
.career-row { display: flex; flex-wrap: wrap; gap: 14px; }
.job {
  position: relative; display: flex; align-items: center; gap: 12px;
  flex: 1 1 240px; max-width: 340px; min-width: 240px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--fg) 25%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 90%, var(--fg) 6%);
}
.job-logo {
  width: 40px; height: 40px; flex: none;
  border-radius: 8px; object-fit: contain;
  background: #fff; padding: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.job-fb {
  display: grid; place-items: center;
  font-family: var(--f-mono); font-weight: 700; font-size: .8rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  padding: 0;
}
.job-info { min-width: 0; }
.job-info b { display: block; font-size: .98rem; line-height: 1.25; }
.job-info span { display: block; font-family: var(--f-mono); font-size: .72rem; opacity: .8; margin-top: 2px; }
.job-info em { display: block; font-style: normal; font-family: var(--f-mono); font-size: .66rem; opacity: .55; margin-top: 3px; }
.job-tag {
  position: absolute; top: -9px; right: 12px;
  font-family: var(--f-mono); font-size: .56rem; letter-spacing: .18em;
  padding: 2px 9px; border-radius: 3px;
  background: var(--bg); border: 1px solid color-mix(in srgb, var(--fg) 45%, transparent);
  color: var(--fg); opacity: .95;
}
.job-founder { border-color: var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 22%, transparent); }
.job-founder .job-tag { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }

/* ---------------- Vertical timeline rail ---------------- */
#timeline {
  position: fixed; left: 20px; top: 50%; transform: translateY(-50%);
  height: 60vh; z-index: 850;
  display: flex; flex-direction: column; justify-content: space-between;
}
.tl-track {
  position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px;
  background: color-mix(in srgb, var(--fg) 18%, transparent);
  transition: background 1s ease;
}
.tl-fill {
  width: 100%; height: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: background 1s ease;
}
#timeline a {
  position: relative; display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg); opacity: .45;
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .1em;
  transition: opacity .3s, color .3s;
}
#timeline a:hover { opacity: 1; }
#timeline a i {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; background: var(--bg);
  display: block; flex: none; transition: background .3s, border-color .3s;
}
#timeline a.passed { opacity: .75; }
#timeline a.passed i { background: var(--accent); border-color: var(--accent); }
#timeline a.active { opacity: 1; color: var(--accent); }
#timeline a.active i {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
#timeline a.active span { text-shadow: 0 0 8px currentColor; }

/* ---------------- Scroll cue blink (used by .now-hint) ---------------- */
@keyframes cue-blink { 0%, 20% { opacity: 1; } 60%, 100% { opacity: .1; } }

/* ---------------- Toast (era unlocked) ---------------- */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 140%);
  z-index: 950;
  background: var(--hud-bg); border: 1px solid var(--accent); color: var(--fg);
  font-family: var(--f-pixel); font-size: .6rem; letter-spacing: .06em;
  padding: 14px 22px; border-radius: 6px;
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .35s cubic-bezier(.2,1.4,.4,1);
  text-align: center; line-height: 1.8; max-width: 90vw;
}
#toast.show { transform: translate(-50%, 0); }
#toast b { color: var(--accent); }

/* ---------------- Terminal palette ---------------- */
#terminal {
  position: fixed; inset: 0; z-index: 1500;
  display: none; align-items: flex-start; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
  padding: 10vh 16px 0;
}
#terminal.open { display: flex; }
.t-window {
  width: min(720px, 100%); background: #0a0f0a; border: 1px solid #2f5a2f;
  border-radius: 8px; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.7);
  font-family: var(--f-mono); font-size: .9rem;
}
.t-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: #10180f; color: #7fbf7f; border-bottom: 1px solid #2f5a2f; }
#term-close { background: none; border: none; color: #7fbf7f; cursor: pointer; font-size: 1rem; }
.t-log { max-height: 46vh; overflow-y: auto; padding: 14px; color: #b8e6b8; line-height: 1.55; white-space: pre-wrap; }
.t-log .t-cmd { color: #fff; }
.t-log .t-err { color: #ff7b72; }
.t-log a { color: #58d68d; }
#t-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid #2f5a2f; }
.t-prompt { color: #58d68d; white-space: nowrap; }
#t-input { flex: 1; background: none; border: none; outline: none; color: #fff; font: inherit; }

/* ---------------- Reduced motion / mobile ---------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .1s !important; }
}
@media (max-width: 1120px) {
  #timeline { display: none; }
}
@media (max-width: 760px) {
  .hud-nav b { display: none; }
  .hud-nav { gap: 10px; }
  #hud { padding: 8px 12px; gap: 10px; }
  .era { padding: 12vh 16px 10vh; }
  .era-lede { font-size: 1rem; }
}
