/* ============ Design tokens ============ */
:root {
  --bg: #fafaf8;
  --bg-raised: #ffffff;
  --text: #1a1a18;
  --text-soft: #55554f;
  --text-faint: #8a8a82;
  --accent: #1f6f54;
  --accent-2: #ad6c1f;
  --accent-3: #34699c;
  --accent-4: #b14d62;
  --accent-soft: #e7f1ec;
  --border: #e4e4de;
  --shadow: 0 1px 3px rgba(20, 20, 16, 0.06), 0 8px 24px rgba(20, 20, 16, 0.05);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #131312;
  --bg-raised: #1c1c1a;
  --text: #ececea;
  --text-soft: #b0b0a8;
  --text-faint: #7a7a72;
  --accent: #5fbf97;
  --accent-2: #e3a857;
  --accent-3: #74aede;
  --accent-4: #e08aa0;
  --accent-soft: #1d2e27;
  --border: #2b2b28;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

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

/* ============ Nav ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  margin-right: 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-soft);
  font-size: 0.92rem;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--accent); }

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-soft);
  transition: border-color 0.15s, color 0.15s;
}

#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.icon-moon { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: none; }

/* ============ Layout ============ */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section { padding: 5rem 0 1rem; }

.section h2 {
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.section-num {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

.section-intro {
  color: var(--text-soft);
  max-width: 600px;
  margin: -1rem 0 2.5rem;
}

/* ============ Hero ============ */
.hero { padding: 6rem 0 4rem; }

.hero-kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.2rem;
}

.hero h1 {
  text-wrap: balance;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 750;
  margin-bottom: 1.4rem;
  background: linear-gradient(95deg, var(--text) 25%, var(--accent) 70%, var(--accent-3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 640px;
  margin-bottom: 2.2rem;
}

.hero-actions { display: flex; gap: 0.9rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { opacity: 0.9; }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Stats ============ */
.stat-num {
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.hero-contact {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2.5rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.hero-contact a,
.hero-contact span:not(.hero-contact-div) {
  font-size: 0.88rem;
  color: var(--text-soft);
  text-decoration: none;
}

.hero-contact a:hover { color: var(--accent); }

.hero-contact-div {
  width: 1px;
  height: 0.9rem;
  background: var(--border);
  display: inline-block;
}

/* ============ About ============ */
.about-text { max-width: 72ch; }

.about-text p { margin-bottom: 1.2rem; color: var(--text-soft); }
.about-text strong { color: var(--text); }

/* ============ Experience ============ */
.competency-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}

.competency {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}

.competency h3 { font-size: 0.95rem; letter-spacing: -0.01em; margin-bottom: 0.25rem; }

.competency p { font-size: 0.82rem; color: var(--text-soft); }

.timeline { display: flex; flex-direction: column; gap: 1.6rem; }

.role {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem;
}

.role-logo {
  display: block;
  height: 32px;
  width: auto;
  object-fit: contain;
  margin-bottom: 0.8rem;
}

.role-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.4rem 0 1.1rem;
}

.role-skills span {
  font-size: 0.76rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.role-links {
  margin-top: 0.9rem;
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

.role-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-top: 0.2rem;
}

.role-dates {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

.role-loc { font-size: 0.82rem; color: var(--text-faint); }

.role-body h3 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.role-tag {
  font-size: 0.88rem;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}

.role-body ul { list-style: none; }

.role-body li {
  padding-left: 1.2rem;
  position: relative;
  margin-bottom: 0.7rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.role-body li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.6;
}

/* ============ Projects ============ */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.4rem;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.card-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.card-metric {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-faint);
}

.card h3 { font-size: 1.15rem; letter-spacing: -0.01em; }

.card p { font-size: 0.93rem; color: var(--text-soft); flex-grow: 1; }

.card-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.card-tags span {
  font-size: 0.76rem;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* ============ Skills ============ */
.skills-cats {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.skills-cat h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.7rem;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.skill-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.4rem 1.5rem;
}

.skill-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.1rem;
}

.skill-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.skill-list li {
  font-size: 0.9rem;
  color: var(--text);
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chips span {
  font-size: 0.84rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  color: var(--text-soft);
}

.chips span.primary {
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--text);
}

.edu-block {
  margin-top: 2.8rem;
  border-top: 1px solid var(--border);
  padding-top: 1.8rem;
}

.edu-block h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.edu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.edu { font-size: 0.9rem; color: var(--text-soft); margin-bottom: 1rem; }
.edu strong { color: var(--text); }

/* ============ Contact ============ */
.contact { padding-bottom: 4rem; }

.contact-lead {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 640px;
  margin-bottom: 2rem;
}

.contact-links {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.contact-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.contact-links a:hover { border-bottom-color: var(--accent); }

.contact-links span { color: var(--text-faint); }

.contact-aside {
  font-size: 0.9rem;
  color: var(--text-faint);
  max-width: 560px;
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.footer p {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ============ Reveal animation ============ */
.section, .hero {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible, .hero.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .section, .hero { opacity: 1; transform: none; transition: none; }
  .journey-node-pulse.lit { animation: none; }
}

/* ============ Responsive ============ */
@media (max-width: 800px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .competency-grid, .edu-grid { grid-template-columns: 1fr; }
  .skill-grid { grid-template-columns: 1fr; }
  .role { grid-template-columns: 1fr; gap: 0.5rem; }
  .role-meta { flex-direction: row; gap: 1rem; align-items: baseline; }
  .nav-links {
    overflow-x: auto;
    white-space: nowrap;
    gap: 1.1rem;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  #theme-toggle {
    position: sticky;
    right: 0;
    flex-shrink: 0;
    background: var(--bg);
  }
  .hero { padding-top: 4rem; }
}

/* ============ Hero canvas ============ */
.hero { position: relative; }

#hero-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.75;
  z-index: -1;
}

.hero-content { position: relative; z-index: 1; }

/* ============ Nav extras ============ */
.kbd-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  color: var(--text-faint);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.kbd-hint:hover { color: var(--accent); border-color: var(--accent); }

.card-link {
  display: inline-block;
  margin-top: 0.4rem;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.card-link:hover { text-decoration: underline; }

/* ============ Journey ============ */
.journey-wrap {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 1.25rem;
  align-items: start;
  /* Escape main's 1.5rem side padding so the map can use the full container width */
  margin-left: -1.5rem;
  margin-right: -1.5rem;
}

/* The card takes its shape from the SVG (2:1 viewBox set in journey.js) —
   the map artwork bleeds to the card edges, so the ocean fill is the card
   background. No min-height: that's what made the map a strip in a tall box. */
.journey-map {
  position: sticky;
  top: 5rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.journey-map svg { display: block; width: 100%; height: auto; }

.journey-ocean { fill: color-mix(in srgb, var(--bg-raised) 88%, var(--accent-3) 12%); }

.journey-land { fill: color-mix(in srgb, var(--text-faint) 55%, var(--border) 45%); stroke: none; }

.journey-grid {
  stroke: var(--border);
  stroke-width: calc(0.5px * var(--cam-scale, 1));
  stroke-dasharray: 1 5;
  opacity: 0.7;
}

/* Stroke widths, radii, and dash patterns are in user space, so journey.js
   sets --cam-scale (viewBox width ÷ full-view width) to counter-scale them
   as the camera zooms — they stay visually constant at any zoom level.
   Do NOT use vector-effect: non-scaling-stroke here: it makes browsers
   measure dash patterns in screen space, which desyncs the dash-based
   route reveal from getPointAtLength (user space). */
.journey-route {
  fill: none;
  stroke-linecap: round;
}

.journey-route-ghost {
  stroke: var(--text-faint);
  stroke-width: calc(1.1px * var(--cam-scale, 1));
  opacity: 0.28;
}

.journey-route-sas {
  stroke: var(--accent-3);
  stroke-width: calc(1.5px * var(--cam-scale, 1));
  opacity: 0.32;
  transition: opacity 0.5s ease;
}

.journey-route-sas.sas-active { opacity: 0.75; }

.journey-legend {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  display: flex;
  gap: 1.2rem;
  padding: 0.3rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-faint);
  background: color-mix(in srgb, var(--bg-raised) 80%, transparent);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.journey-legend i {
  display: inline-block;
  width: 16px;
  vertical-align: middle;
  margin-right: 0.3rem;
}

.journey-legend .legend-main { border-top: 2px solid var(--accent); }

.journey-legend .legend-sas { border-top: 2px dashed var(--accent-3); opacity: 0.7; }

.journey-route-drawn {
  stroke: url(#route-grad);
  stroke-width: calc(2.8px * var(--cam-scale, 1));
}

.route-grad-east { stop-color: var(--accent-2); }
.route-grad-mid  { stop-color: var(--accent-3); }
.route-grad-west { stop-color: var(--accent); }

.journey-hitbox {
  fill: transparent;
  cursor: pointer;
  r: calc(14px * var(--cam-scale, 1));
}

.journey-arrow {
  fill: var(--text-faint);
  opacity: 0.5;
  transition: fill 0.3s, opacity 0.3s;
}

.journey-arrow.lit { fill: var(--accent); opacity: 0.95; }

.journey-marker {
  fill: var(--accent);
  r: calc(3.2px * var(--cam-scale, 1));
  opacity: 0;
  transition: opacity 0.3s;
}

.journey-marker-halo {
  fill: var(--accent);
  r: calc(7px * var(--cam-scale, 1));
  opacity: 0;
  transition: opacity 0.3s;
}

.journey-node {
  r: calc(3.6px * var(--cam-scale, 1));
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.3s ease, opacity 0.3s ease, filter 0.25s ease;
  opacity: 0.25;
}
.journey-node.lit { opacity: 1; }
.journey-node.active { transform: scale(1.45); opacity: 1; }
.journey-node.hover { transform: scale(1.6); }

.journey-node-pulse {
  fill: none;
  r: calc(4px * var(--cam-scale, 1));
  stroke-width: calc(1.2px * var(--cam-scale, 1));
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
}

.journey-node-pulse.lit { animation: pulse 2.4s ease-out infinite; }
.journey-node-pulse.active { animation: pulse-strong 1.6s ease-out infinite; }

/* Pulses animate transform (not r) so the camera counter-scaling on r
   keeps working while the animation runs. */
@keyframes pulse {
  0%   { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.75); }
}

@keyframes pulse-strong {
  0%   { opacity: 0.85; transform: scale(1.25); }
  100% { opacity: 0; transform: scale(4); }
}

.journey-label {
  font-family: var(--mono);
  font-size: 8.5px;
  fill: var(--text-soft);
  opacity: 0;
  transition: opacity 0.3s ease, fill 0.25s ease;
}

.journey-label.lit { opacity: 1; }
.journey-label.active { fill: var(--text); }

.journey-label-year {
  font-size: 6.5px;
  fill: var(--text-faint);
}

.journey-stops {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.journey-stop {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  padding: 1rem 1.2rem;
  opacity: 0.45;
  transition: opacity 0.35s ease, border-color 0.35s ease, transform 0.35s ease, background 0.35s ease;
}

.journey-stop.lit {
  opacity: 1;
  border-left-color: var(--stop-border, var(--accent));
  transform: translateX(4px);
}

.journey-stop.active {
  background: color-mix(in srgb, var(--stop-border, var(--accent)) 7%, var(--bg-raised));
  transform: translateX(6px);
}

.journey-stop.map-hover {
  background: color-mix(in srgb, var(--stop-border, var(--accent)) 4%, var(--bg-raised));
  border-left-color: var(--stop-border, var(--accent));
  opacity: 1;
}

.journey-stop h3 { font-size: 1rem; letter-spacing: -0.01em; }

.journey-stop .stop-dates {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
}

.journey-stop.lit .stop-dates {
  color: var(--stop-border, var(--accent));
}

.journey-stop p { font-size: 0.85rem; color: var(--text-soft); margin-top: 0.3rem; }

/* ============ Game ============ */
.game {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 720px;
}

.game-quarter {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.game h3 { font-size: 1.25rem; letter-spacing: -0.01em; margin-bottom: 0.5rem; }

.game-narrative { color: var(--text-soft); font-size: 0.95rem; margin-bottom: 1.4rem; }

.game-choices { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.6rem; }

.game-choice {
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.game-choice:hover { border-color: var(--accent); transform: translateX(3px); }

.game-choice .choice-key {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  margin-right: 0.6rem;
}

.game-meters { display: flex; flex-direction: column; gap: 0.7rem; }

.game-meter { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 0.8rem; }

.game-meter .meter-name { font-size: 0.78rem; color: var(--text-faint); }

.meter-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1), background 0.4s;
}

.meter-fill.bad { background: #c4574e; }

.game-meter .meter-val {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.game-feedback {
  font-size: 0.88rem;
  color: var(--text-soft);
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin: 1.2rem 0;
  min-height: 1.2em;
}

.game-result-archetype {
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin: 0.4rem 0 0.8rem;
}

.game-aside { font-size: 0.82rem; color: var(--text-faint); margin-top: 1.4rem; }

.btn-game {
  background: var(--accent);
  color: var(--bg);
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}

.btn-game:hover { opacity: 0.9; transform: translateY(-1px); }

/* ============ Now strip (currently building) ============ */
.now-strip {
  margin-bottom: 2.5rem;
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.now-strip-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  display: block;
  margin-bottom: 0.9rem;
}

.now-tiles {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.now-tile {
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  min-width: 170px;
  flex: 1;
}

.now-tile-title {
  font-size: 0.82rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.2rem;
}

.now-tile-status {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  display: block;
  margin-bottom: 0.5rem;
}

.now-tile-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.now-tile-tags span {
  font-size: 0.65rem;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-faint);
}

/* ============ Principles ============ */
.principles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.6rem 2.5rem;
}

.principle { display: flex; gap: 1.1rem; align-items: baseline; }

.principle-num {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  min-width: 1.6rem;
}

.principle h3 { font-size: 1.05rem; letter-spacing: -0.01em; margin-bottom: 0.3rem; }

.principle p { font-size: 0.9rem; color: var(--text-soft); }

/* ============ Command palette ============ */
.palette[hidden], .terminal[hidden] { display: none; }

.palette {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 10, 8, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 14vh;
}

.palette-box {
  width: min(560px, calc(100vw - 2rem));
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

#palette-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}

#palette-list { list-style: none; max-height: 320px; overflow-y: auto; padding: 0.4rem; }

#palette-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--text-soft);
}

#palette-list li.active { background: var(--accent-soft); color: var(--text); }

#palette-list li .palette-kind {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
}

#palette-list li.empty { cursor: default; color: var(--text-faint); }

/* ============ Terminal ============ */
.terminal {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  z-index: 40;
  width: min(680px, calc(100vw - 2rem));
  background: #0d1410;
  border: 1px solid #1f2d24;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #9fd8b8;
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  background: #111a14;
  border-bottom: 1px solid #1f2d24;
}

.terminal-dot { width: 10px; height: 10px; border-radius: 50%; background: #2c4435; }

.terminal-title { margin-left: 0.6rem; font-size: 0.72rem; color: #5e8a6f; }

#terminal-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #5e8a6f;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}

#terminal-close:hover { color: #9fd8b8; }

.terminal-output {
  padding: 0.8rem;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.55;
}

.terminal-output .t-cmd { color: #e6f2ea; }
.terminal-output .t-accent { color: #5fbf97; }

.terminal-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-top: 1px solid #1f2d24;
}

.terminal-prompt { color: #5fbf97; }

#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6f2ea;
  font: inherit;
}

.footer-hint { float: right; }

.footer-hint kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

/* ============ Responsive (new sections) ============ */
@media (max-width: 800px) {
  .journey-wrap { grid-template-columns: 1fr; margin-left: 0; margin-right: 0; }
  .journey-map { position: relative; top: 0; } /* not static — the legend overlay anchors to it; top:0 cancels the sticky offset */
  .principles { grid-template-columns: 1fr; }
  .game { padding: 1.4rem; }
  .game-meter { grid-template-columns: 90px 1fr 56px; }
  .footer-hint { display: none; }
  .kbd-hint { display: none; }
}

/* ============ Colour pass ============ */
#journey { padding-bottom: 3rem; }
#journey .section-num { color: var(--accent-3); }
#projects .section-num { color: var(--accent-2); }
#play .section-num { color: var(--accent-4); }
#principles .section-num { color: var(--accent-2); }
#skills .section-num { color: var(--accent-4); }


.cards .card:nth-child(3n+2) .card-badge {
  color: var(--accent-3);
  background: color-mix(in srgb, var(--accent-3) 13%, transparent);
}

.cards .card:nth-child(3n) .card-badge {
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 13%, transparent);
}

.cards .card:nth-child(3n+2):hover { border-color: color-mix(in srgb, var(--accent-3) 45%, var(--border)); }
.cards .card:nth-child(3n):hover { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); }

.principle:nth-child(3n+2) .principle-num { color: var(--accent-3); }
.principle:nth-child(3n) .principle-num { color: var(--accent-2); }

.chips span:hover {
  border-color: var(--accent);
  color: var(--text);
}

.journey-stop {
  position: relative;
}

.journey-stop .stop-num {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  opacity: 0.7;
}

.journey-stop.lit .stop-num { color: var(--stop-border, var(--accent)); }

/* ============ Side nav ============ */
.side-nav { display: none; }

@media (min-width: 1160px) {
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    position: fixed;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
  }

  .side-nav a {
    font-size: 0.75rem;
    color: var(--text-faint);
    text-decoration: none;
    padding-left: 0.7rem;
    border-left: 2px solid var(--border);
    line-height: 1.5;
    transition: color 0.15s, border-color 0.15s;
  }

  .side-nav a:hover { color: var(--text); }

  .side-nav a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
  }
}

/* ============ Case study accordion ============ */
.case-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.case-toggle .chev { transition: transform 0.25s ease; }

.card.open .case-toggle .chev { transform: rotate(180deg); }

.case-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}

.case-panel-inner { overflow: hidden; }

.card.open .case-panel { grid-template-rows: 1fr; }

.case-panel h4 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 1rem 0 0.25rem;
}

.case-panel h4:first-child {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.case-panel p { font-size: 0.9rem; flex-grow: 0; }

/* ============ Principle cards ============ */
.principle {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
}

/* ============ Case study link button ============ */
.case-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 0.45rem 1rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.case-link:hover { background: var(--accent); color: var(--bg); }

/* ============ Case study pages ============ */
.case-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.case-back {
  margin-bottom: 2rem;
}

.case-back a {
  font-size: 0.88rem;
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.15s;
}

.case-back a:hover { color: var(--accent); }

.case-hero {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.case-hero-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.case-status {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
}

.case-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
  font-weight: 750;
  margin-bottom: 0.7rem;
}

.case-tagline {
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 56ch;
}

.case-section {
  margin-bottom: 2.8rem;
}

.case-section h2 {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
  font-weight: 600;
}

.case-section p {
  color: var(--text-soft);
  font-size: 0.97rem;
  max-width: 66ch;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tech-badge {
  font-size: 0.8rem;
  font-family: var(--mono);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  color: var(--text-soft);
}

.arch-diagram {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  overflow-x: auto;
  color: var(--text-soft);
  white-space: pre;
}

/* ============ Architecture flow component ============ */

.arch-flow {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.arch-layer {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}

.arch-layer-label {
  font-size: 0.66rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  min-width: 108px;
  padding-top: 0.55rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.arch-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
}

.arch-node {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.8rem;
}

.arch-node--key {
  border-left: 2px solid var(--accent);
}

.arch-node-name {
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 500;
  line-height: 1.3;
}

.arch-node-detail {
  font-size: 0.73rem;
  color: var(--text-faint);
  line-height: 1.3;
}

.arch-node-detail--mono {
  font-family: var(--mono);
  font-size: 0.7rem;
}

.arch-connector {
  padding-left: calc(108px + 1.25rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 4px;
  padding-bottom: 4px;
}

.arch-connector::before {
  content: '';
  display: block;
  width: 1px;
  height: 14px;
  background: var(--border);
}

.arch-connector::after {
  content: '▾';
  font-size: 0.65rem;
  color: var(--text-faint);
  line-height: 1;
  margin-left: -0.22em;
}

@media (max-width: 560px) {
  .arch-layer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .arch-layer-label {
    min-width: unset;
    padding-top: 0;
  }

  .arch-connector {
    padding-left: 0.2rem;
  }
}

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.screenshot-placeholder {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-faint);
  font-family: var(--mono);
}

.outcomes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.outcomes-list li {
  padding-left: 1.3rem;
  position: relative;
  color: var(--text-soft);
  font-size: 0.97rem;
}

.outcomes-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

.case-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.case-nav a {
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.15s;
}

.case-nav a:hover { opacity: 0.75; }

.case-nav .case-nav-center {
  color: var(--text-faint);
  font-size: 0.82rem;
  text-decoration: none;
}

@media (max-width: 800px) {
  .screenshot-grid { grid-template-columns: 1fr; }
  .now-tiles { flex-direction: column; }
}
