:root {
  --sky: #f3ecfc;
  --panel: #ece0fb;
  --mid: #d3b8f5;
  --deep: #b48cec;
  --ink: #4a2f66;
  --muted: #8a6ba8;
  --hud: #2e1f45;
  --badge-bg: #3d2566;
  --badge-fg: #d9c2f5;
}
body.dark {
  --sky: #1f1430;
  --panel: #2f2044;
  --ink: #ece0fb;
  --muted: #c7aee0;
  --hud: #150c22;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--sky);
  color: var(--ink);
  font-family: 'VT323', monospace;
  font-size: 1.25rem;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}
.px { font-family: 'Press Start 2P', cursive; }
a { color: inherit; }
img { image-rendering: pixelated; }

/* ---- pixel mouse-trail squares ---- */
.trail-pixel {
  position: fixed;
  pointer-events: none;
  width: 8px;
  height: 8px;
  background: var(--deep);
  z-index: 9999;
  animation: pixelFade 0.7s steps(4) forwards;
}
@keyframes pixelFade {
  0%   { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-22px); }
}

/* ---- HUD bar ---- */
.hud {
  background: var(--hud);
  color: #fff;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 4px solid var(--deep);
}
.hud span { color: var(--mid); }

/* ---- drifting pixel clouds ---- */
.sky-layer {
  position: relative;
  height: 90px;
  overflow: hidden;
  background: var(--sky);
}
.cloud {
  position: absolute;
  top: 20px;
  width: 32px;
  height: 16px;
  background: var(--mid);
  box-shadow:
    8px 0 0 var(--mid), 16px 0 0 var(--mid),
    8px -8px 0 var(--mid), 16px -8px 0 var(--mid),
    -4px 4px 0 var(--mid), 28px 4px 0 var(--mid);
  animation: drift 26s linear infinite;
  opacity: 0.9;
}
.cloud.c2 { top: 46px; animation-duration: 34s; animation-delay: -10s; transform: scale(0.8); }
.cloud.c3 { top: 8px; animation-duration: 20s; animation-delay: -4s; transform: scale(0.6); }
@keyframes drift {
  from { left: -60px; }
  to   { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cloud { animation: none; left: 20%; }
}

.page { max-width: 720px; margin: 0 auto; padding: 0 2.5rem 3.5rem; }

/* ---- pixel block bevel (chunky game block look) ---- */
.block {
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,0.5),
    inset -4px -4px 0 rgba(0,0,0,0.15),
    6px 6px 0 var(--deep);
  padding: 1.75rem;
  margin-top: 2rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
/* big blocks (about/skills/education/contact + project blocks): pop-out animation only, no color/highlight change */
.block.interactive:hover {
  transform: translateY(-4px);
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,0.5),
    inset -4px -4px 0 rgba(0,0,0,0.15),
    6px 10px 0 var(--deep);
}
.block.interactive:active {
  transform: translateY(0);
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,0.5),
    inset -4px -4px 0 rgba(0,0,0,0.15),
    6px 6px 0 var(--deep);
}

/* ---- hero / level title ---- */
.hero { text-align: center; margin-top: 1.5rem; }
.hero .world { font-family: 'Press Start 2P', cursive; font-size: 0.65rem; color: var(--muted); margin-bottom: 0.9rem; letter-spacing: 0.05em; }
.hero h1 { font-family: 'Press Start 2P', cursive; font-size: 1.7rem; margin-bottom: 1rem; }
.hero .tagline { font-size: 1.25rem; color: var(--muted); margin-bottom: 1.75rem; }

/* ---- sticky nav bar (single block) ---- */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--hud);
  border-bottom: 4px solid var(--deep);
  padding: 0.75rem 1rem;
  margin-top: 1.75rem;
}

/* ---- nav: question blocks ---- */
nav.qblocks { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem; }
nav.qblocks a, .theme-toggle {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--mid);
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.5), inset -3px -3px 0 rgba(0,0,0,0.15);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: transform 0.1s ease;
}
nav.qblocks a:hover, .theme-toggle:hover { transform: translateY(-4px); background: var(--deep); }
nav.qblocks a:active, .theme-toggle:active { transform: translateY(0); }
nav.qblocks a:focus-visible, .theme-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.theme-toggle { font-size: 0.8rem; padding: 0.6rem 0.75rem; line-height: 1; }

/* ---- fallback offset for direct links like /#education (nav clicks are handled precisely in script.js) ---- */
section[id] { scroll-margin-top: 6rem; }
@media (max-width: 600px) {
  section[id] { scroll-margin-top: 9rem; }
}

section h2 { font-family: 'Press Start 2P', cursive; font-size: 0.9rem; margin-bottom: 1.2rem; color: var(--ink); }
section h2::before { content: "▸ "; color: var(--deep); }

.note {
  color: var(--muted);
  border: 3px dashed var(--deep);
  padding: 0.9rem 1.1rem;
  font-size: 1.15rem;
  background: rgba(255,255,255,0.35);
}

/* ---- skills: item blocks (color highlight only, no sound) ---- */
.skill-group { margin-bottom: 1.5rem; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group h3 { font-family: 'Press Start 2P', cursive; font-size: 0.6rem; color: var(--muted); margin-bottom: 0.8rem; }
.item-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.item {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.5rem;
  border: 3px solid var(--ink);
  background: var(--mid);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.5), inset -2px -2px 0 rgba(0,0,0,0.15);
  padding: 0.6rem 0.7rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s ease, box-shadow 0.1s ease;
}
.item:hover {
  background: var(--deep);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.35), inset -2px -2px 0 rgba(0,0,0,0.25);
}

/* ---- education ---- */
.edu-entry { margin-bottom: 1.5rem; }
.edu-entry h3 {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 0.6rem;
}
.edu-entry .edu-school { color: var(--ink); }

/* ---- projects: one big block wraps the whole grid (pops like the other sections) ---- */
.projects-wrap { margin-top: 2rem; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}
/* individual project cards: separate hover animation (tilt + grow) instead of the pop-up used elsewhere */
.project-card {
  margin-top: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover {
  transform: scale(1.045) rotate(-1.2deg);
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,0.5),
    inset -4px -4px 0 rgba(0,0,0,0.15),
    9px 9px 0 var(--deep);
}
.project-card:active {
  transform: scale(1) rotate(0deg);
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,0.5),
    inset -4px -4px 0 rgba(0,0,0,0.15),
    6px 6px 0 var(--deep);
}
.project-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6rem;
  text-align: left;
  margin-top: 0;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.project-block .dot {
  width: 40px;
  height: 40px;
  background: var(--mid);
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.5), inset -3px -3px 0 rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.65rem;
  flex-shrink: 0;
}
.project-block h3 {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.72rem;
  color: var(--ink);
}
.project-block p {
  font-size: 1.05rem;
  color: var(--muted);
}

/* ---- contact: power-up badges ---- */
.badge-row { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; }
.badge { text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; width: 68px; }
.badge .circle {
  width: 46px;
  height: 46px;
  background: var(--badge-bg);
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.15), inset -3px -3px 0 rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}
.badge:hover .circle { transform: translateY(-3px); }
.badge .circle svg { width: 22px; height: 22px; stroke: var(--badge-fg); fill: none; }
.badge .label { font-family: 'Press Start 2P', cursive; font-size: 0.42rem; color: var(--muted); text-align: center; }

footer { text-align: center; margin-top: 2.5rem; }
.press-start {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  color: var(--deep);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .press-start { animation: none; } }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.15rem; }
  .block { padding: 1.3rem; }
}

/* ---- mystery mascot sprite, bottom-left of the screen ---- */
.mc-sprite {
  position: fixed;
  bottom: 40px;
  left: 16px;
  z-index: 60;
  cursor: pointer;
}
/* floating animation only plays while she's walking (hover/focus) — she stands still on the ground otherwise */
.mc-sprite.walking {
  animation: mc-float 2.4s ease-in-out infinite;
}
@keyframes mc-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-22px); }
}
@media (prefers-reduced-motion: reduce) {
  .mc-sprite.walking { animation: none; }
}
.mc-sprite:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.mc-sprite img {
  display: block;
  width: 66px;
  height: auto;
  image-rendering: pixelated;
  transform-origin: bottom center;
  transition: transform 0.2s ease;
}
.mc-sprite:hover img,
.mc-sprite:focus-visible img {
  transform: scale(1.12);
}

/* speech bubble: up and well to the right of her, not centered over her head */
.mc-speech {
  position: absolute;
  left: 100%;
  bottom: calc(100% + 26px);
  margin-left: 12px;
  transform: translateY(8px);
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.5), inset -2px -2px 0 rgba(0,0,0,0.15);
  padding: 0.6rem 0.8rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.45rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.mc-speech::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 18px;
  border: 6px solid transparent;
  border-top-color: var(--ink);
}
.mc-speech.show {
  opacity: 1;
  transform: translateY(0);
}

/* ---- project detail popup: centered on screen ---- */
.project-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 30, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 1.25rem;
}
.project-modal-overlay.show { display: flex; }
.project-modal {
  position: relative;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  margin-top: 0;
  text-align: left;
}
.project-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
  background: var(--mid);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.5), inset -2px -2px 0 rgba(0,0,0,0.15);
  width: 32px;
  height: 32px;
  cursor: pointer;
}
.project-modal-close:hover { background: var(--deep); }
.project-modal-dot {
  width: 44px;
  height: 44px;
  background: var(--mid);
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.5), inset -3px -3px 0 rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  margin-bottom: 1rem;
}
.project-modal h3 {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.95rem;
  margin-bottom: 1.1rem;
  color: var(--ink);
  padding-right: 2.5rem;
}
.project-modal-media {
  width: 100%;
  border: 3px solid var(--ink);
  background: rgba(0,0,0,0.12);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.3), inset -3px -3px 0 rgba(0,0,0,0.15);
  margin-bottom: 1.1rem;
  overflow: hidden;
  line-height: 0;
}
.project-modal-media img,
.project-modal-media video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 65vh;
  object-fit: contain;
}
.project-modal p {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.project-modal-link {
  display: inline-block;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--mid);
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.5), inset -3px -3px 0 rgba(0,0,0,0.15);
  padding: 0.75rem 0.9rem;
}
.project-modal-link:hover { background: var(--deep); }

/* ---- mystery game easter egg: fake error windows + coming soon ---- */
.mystery-window {
  position: fixed;
  width: 280px;
  z-index: 200;
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow:
    inset 3px 3px 0 rgba(255,255,255,0.5),
    inset -3px -3px 0 rgba(0,0,0,0.15),
    5px 5px 0 #6a1fb0;
  animation: mystery-pop 0.12s ease-out;
}
@keyframes mystery-pop {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.mystery-window-bar {
  background: #4b1470;
  color: #f0d9ff;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.55rem;
  padding: 0.45rem 0.55rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mystery-window-x { cursor: pointer; }
.mystery-window-body {
  padding: 1.2rem 0.9rem;
  font-size: 1.1rem;
  text-align: center;
  color: var(--ink);
}
.mystery-window.comingsoon {
  width: 380px;
  cursor: pointer;
  z-index: 210;
}
.mystery-window.comingsoon .mystery-window-bar { background: #6a1fb0; }
.mystery-window.comingsoon .mystery-window-body {
  font-family: 'Press Start 2P', cursive;
  font-size: 0.75rem;
  line-height: 1.9;
  padding: 1.8rem 1.1rem;
}
.mystery-window.comingsoon.glitching {
  animation: mystery-glitch-settle 0.3s ease-out;
  overflow: visible;
}
@keyframes mystery-glitch-settle {
  0%   { transform: translate(-5px, 3px) skewX(1.5deg); opacity: 0.5; }
  40%  { transform: translate(4px, -2px) skewX(-1deg); opacity: 1; }
  70%  { transform: translate(-2px, 1px); }
  100% { transform: translate(0, 0); }
}
.mystery-glitch-bit {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  animation-name: mystery-bit-flicker;
  animation-iteration-count: infinite;
  animation-timing-function: steps(1);
}
@keyframes mystery-bit-flicker {
  0%, 80%, 100% { opacity: 0; }
  85%, 92% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .mystery-window,
  .mystery-window.comingsoon.glitching {
    animation: none;
  }
  .mystery-glitch-bit { display: none; }
}

/* ---- redirect popup: centered on screen ---- */
.mc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 30, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.mc-modal-overlay.show { display: flex; }
.mc-modal {
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow:
    inset 4px 4px 0 rgba(255,255,255,0.5),
    inset -4px -4px 0 rgba(0,0,0,0.15),
    6px 6px 0 var(--deep);
  padding: 1.6rem;
  max-width: 300px;
  text-align: center;
}
.mc-modal p {
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 1.2rem;
}
.mc-modal-buttons { display: flex; justify-content: center; }

@media (max-width: 600px) {
  .mc-sprite img { width: 56px; }
}
