:root {
  /* Cozy home palette — warm wood, cream, brass */
  --bg: #1a130d;            /* espresso (hub at-night feel) */
  --bg-cream: #f3e7cf;      /* parchment (subpages) */
  --paper: #f7eedb;         /* lighter parchment */
  --ink: #2b201a;           /* dark slate (text on cream) */
  --ink-light: #f3e7cf;     /* cream (text on dark) */
  --muted: #8a7a66;         /* warm grey */
  --muted-dark: #6b5a47;
  --wood: #8b6f47;          /* walnut */
  --wood-light: #c9a87c;    /* oak */
  --accent: #c97c5d;        /* terracotta */
  --accent-2: #7a8c6e;      /* sage */
  --brass: #d4a04a;         /* warm gold */
  --line: rgba(139, 111, 71, 0.28);
  --line-dark: rgba(43, 32, 26, 0.18);
  --glass: rgba(247, 238, 219, 0.55);
  --glass-dark: rgba(26, 19, 13, 0.55);
  --font-display: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --font-mono: 'Space Mono', monospace;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
}

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

html, body {
  background: var(--bg);
  color: var(--ink-light);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
}

/* ---- 3D canvas ---- */
#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
  touch-action: pan-y;            /* let mobile users swipe up/down to scroll */
}

/* ---- Loader ---- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  overflow: hidden;
  perspective: 1200px;
  perspective-origin: 50% 35%;
}
#loader.hidden { opacity: 0; visibility: hidden; }

.keycap-stage {
  position: relative;
  width: min(640px, 92vw);
  height: 130px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-style: preserve-3d;
  transform: rotateX(22deg);
}
.keycaps {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  transform-style: preserve-3d;
}

/* ---- 3D keycap ----
   .keycap = the cap container with built-in 3D depth via stacked shadows
   .key-top = the printed/illuminated top face (slightly inset, dished)
*/
.keycap {
  --cap-size: 64px;
  --depth: 14px;
  width: var(--cap-size);
  height: var(--cap-size);
  border-radius: 10px;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  /* Skirt + bevel + drop shadow stacked to fake 3D extrusion */
  background: linear-gradient(180deg, #2a1d11 0%, #18100a 100%);
  box-shadow:
    /* extruded sides built from stacked solid shadows */
    0 1px 0 #3a2818,
    0 2px 0 #34241a,
    0 3px 0 #2c1f15,
    0 4px 0 #251a11,
    0 5px 0 #1f160e,
    0 6px 0 #19110a,
    0 7px 0 #130d07,
    0 8px 0 #0e0905,
    0 10px 14px rgba(0, 0, 0, 0.55),
    0 16px 30px rgba(0, 0, 0, 0.55);
}
.keycap .key-top {
  position: absolute;
  inset: 3px 3px 9px 3px;
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 210, 160, 0.10), transparent 65%),
    linear-gradient(180deg, #5a4128 0%, #3d2c1c 55%, #2a1d11 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 175, 0.22),    /* top edge highlight */
    inset 0 -2px 6px rgba(0, 0, 0, 0.55),       /* dish shadow */
    inset 2px 0 4px rgba(0, 0, 0, 0.25),        /* left dish shadow */
    inset -2px 0 4px rgba(0, 0, 0, 0.25);       /* right dish shadow */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.65rem;
  color: var(--brass);
  text-shadow:
    0 -1px 0 rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 200, 140, 0.15),
    0 0 8px rgba(212, 160, 74, 0.4);
}
/* subtle shine line near the top of each cap */
.keycap::before {
  content: '';
  position: absolute;
  top: 5px; left: 8px; right: 8px;
  height: 6px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 220, 180, 0.18), transparent);
  pointer-events: none;
  z-index: 1;
}

.loader-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  color: var(--muted);
  text-transform: uppercase;
  opacity: 0;
}
.loader-text.visible {
  opacity: 1;
  transition: opacity 0.5s ease;
}
@media (max-width: 540px) {
  .keycap { --cap-size: 44px; }
  .keycap .key-top { font-size: 1.1rem; }
}

/* ---- Top bar ---- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.04em;
  font-size: 1.4rem;
  color: var(--ink-light);
  text-decoration: none;
}
.brand span { color: var(--brass); font-style: normal; }
.nav {
  display: flex;
  gap: 1.8rem;
}
.nav a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease;
  text-transform: uppercase;
}
.nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.nav a:hover { color: var(--ink-light); }
.nav a:hover::after { transform: scaleX(1); }

/* ---- Scroll hint ---- */
.scroll-hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  transition: opacity 0.4s ease;
  text-transform: uppercase;
}
.scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--brass), transparent);
  animation: drop 1.6s ease-in-out infinite;
}
@keyframes drop {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---- HUD ---- */
.hud {
  position: fixed;
  bottom: 1.5rem;
  right: 2rem;
  z-index: 50;
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-mono);
  color: var(--muted);
}
.hud-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.hud-item span {
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}
.hud-item b {
  font-size: 0.95rem;
  color: var(--brass);
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* ---- Scroll-driven content ---- */
.scroll-container {
  position: relative;
  z-index: 10;
  pointer-events: none;
}
.panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 8vw;
  pointer-events: auto;
}
.panel > * { max-width: 720px; }

.panel-tag {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.4em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  line-height: 1.05;
}

.panel p {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.7;
  color: rgba(244,234,255,0.85);
}

/* Hero */
.hero {
  align-items: center;
  text-align: center;
  justify-content: center;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink-light);
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .accent {
  font-style: italic;
  color: var(--brass);
  font-weight: 300;
}
.hero-sub {
  margin-top: 1.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Projects */
.projects {
  list-style: none;
  border-top: 1px solid var(--line);
}
.projects li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.1rem;
  transition: padding-left 0.4s ease, color 0.4s ease;
  cursor: pointer;
}
.projects li:hover {
  padding-left: 1rem;
  color: var(--accent);
}
.projects li b {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.projects li span { color: var(--muted); font-size: 0.85rem; }

/* Skills chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.chips span {
  padding: 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-light);
  background: rgba(255, 245, 220, 0.04);
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.chips span:hover {
  border-color: var(--brass);
  color: var(--brass);
  background: rgba(212,160,74,0.10);
  transform: translateY(-2px);
}

/* CTA */
.cta {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.95rem 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--ink-light);
  text-decoration: none;
  border: 1px solid var(--brass);
  border-radius: 999px;
  background: rgba(212,160,74,0.08);
  text-transform: uppercase;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.cta:hover {
  background: var(--brass);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -10px var(--brass);
}

/* End */
.end {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  font-family: var(--font-display);
  letter-spacing: 0.4em;
  color: var(--muted);
  font-size: 0.7rem;
}

/* ---- Lofi mute button (top right) ---- */
.mute-btn {
  position: fixed;
  top: 3.6rem;           /* tucked under the CONTACT nav link */
  right: 2rem;
  z-index: 60;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 245, 220, 0.05);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brass);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.mute-btn:hover {
  background: rgba(212, 160, 74, 0.12);
  border-color: var(--brass);
  transform: scale(1.06);
}
.mute-btn .ic { width: 18px; height: 18px; display: block; }
.mute-btn .ic-off { display: none; }
.mute-btn.muted .ic-on  { display: none; }
.mute-btn.muted .ic-off { display: block; color: var(--muted); }
.mute-btn.muted { color: var(--muted); }
@media (max-width: 720px) {
  .mute-btn { right: 1rem; top: 3.2rem; width: 32px; height: 32px; }
}

/* ---- 3D-scene hover tooltip (doors + room items) ---- */
.door-label {
  position: fixed;
  z-index: 40;
  padding: 0.7rem 1rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--brass);
  border-radius: 6px;
  pointer-events: none;
  transform: translate(-50%, -150%);
  opacity: 0;
  transition: opacity 0.18s ease, border-color 0.2s ease;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  box-shadow: 0 12px 24px -10px rgba(43,32,26,0.5);
}
.door-label b {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.door-label span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-transform: uppercase;
}
.door-label.item { border-color: var(--accent-2); }
.door-label.item span { color: var(--accent-2); }
.door-label.visible { opacity: 1; }

/* Hub: ghost panels exist only to give the scroll bar length so camera can travel */
body.hub .panel.ghost { background: transparent; }
body.hub .panel { pointer-events: none; }
body.hub .scroll-container { pointer-events: none; }
body.hub .topbar a { pointer-events: auto; }

/* =====================================================
   SUBPAGES (about / projects / skills / contact)
   ===================================================== */
body.subpage {
  background:
    radial-gradient(ellipse at 20% -10%, rgba(212, 160, 74, 0.10), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(201, 124, 93, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink-light);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
/* Subtle warm grid on dark */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(212,160,74,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(212,160,74,0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

body.subpage .topbar {
  background: linear-gradient(to bottom, rgba(26,19,13,0.88), rgba(26,19,13,0));
}
body.subpage .brand { color: var(--ink-light); }
body.subpage .brand span { color: var(--brass); }
body.subpage .nav a { color: var(--muted); }
body.subpage .nav a:hover { color: var(--ink-light); }
body.subpage .nav a::after { background: var(--brass); }
.nav a.active { color: var(--ink-light); }
.nav a.active::after { transform: scaleX(1); }

.back-link {
  position: fixed;
  top: 5.2rem;
  left: 2rem;
  z-index: 40;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 245, 220, 0.04);
  backdrop-filter: blur(6px);
  text-transform: uppercase;
  transition: color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.back-link:hover { color: var(--ink-light); border-color: var(--brass); transform: translateX(-3px); background: rgba(212,160,74,0.10); }
.back-link .arrow { transition: transform 0.3s ease; }
.back-link:hover .arrow { transform: translateX(-3px); }

main.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 9rem 6vw 6rem;
}
.page-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 1.2rem;
  text-transform: uppercase;
}
.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  line-height: 1;
  letter-spacing: -0.025em;
  margin-bottom: 1.2rem;
  color: var(--ink-light);
}
.page-title .accent {
  font-style: italic;
  font-weight: 300;
  color: var(--brass);
}
.page-lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 640px;
  line-height: 1.7;
  margin-bottom: 3.5rem;
}

/* ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 3rem;
  align-items: start;
  margin-bottom: 4rem;
}
.portrait {
  position: relative;
  padding: 0.7rem 0.7rem 0.4rem;
  background: rgba(255, 245, 220, 0.06);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 0 24px 50px -20px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.3);
  transform: rotate(-1.2deg);
  transition: transform 0.5s ease;
  perspective: 1200px;
}
.portrait:hover { transform: rotate(0deg); }

/* Hover-to-flip: front (about.jpg) flips to reveal back (fitr.jpg) */
.flip-inner {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.6, 0.2, 0.2, 1);
  cursor: pointer;
}
.portrait:hover .flip-inner,
.flip-inner.flipped {
  transform: rotateY(180deg);
}
.flip-inner img {
  width: 100%;
  height: auto;
  display: block;
  filter: saturate(0.95) contrast(1.02);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip-front { position: relative; z-index: 2; }
.flip-back {
  position: absolute;
  top: 0; left: 0;
  transform: rotateY(180deg);
  z-index: 1;
}
.portrait figcaption {
  margin-top: 0.6rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}
.about-text p {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--ink-light);
  margin-bottom: 1.2rem;
}
.about-text b { color: #fff; font-weight: 600; }

.quick-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-top: 2rem;
}
.quick-facts > div {
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
  border-radius: 3px;
  background: rgba(255, 245, 220, 0.04);
}
.quick-facts span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}
.quick-facts b { font-size: 0.92rem; color: var(--ink-light); font-weight: 600; }

.block { margin-top: 3.5rem; }
.block-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 1.5rem;
  color: var(--ink-light);
  position: relative;
  padding-left: 1.1rem;
}
.block-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  width: 3px; height: 60%;
  transform: translateY(-50%);
  background: var(--brass);
  border-radius: 2px;
}

.timeline {
  list-style: none;
  border-left: 1px dashed var(--line);
  padding-left: 1.5rem;
}
.timeline li {
  position: relative;
  padding: 0.6rem 0 1.4rem;
}
.timeline li::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 1.1rem;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--brass);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--brass), 0 0 12px rgba(212,160,74,0.3);
}
.t-year {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--brass);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}
.timeline b { display: block; font-size: 1.05rem; color: var(--ink-light); font-weight: 600; }
.t-sub { display: block; font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }

.sem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.sem-card {
  border: 1px solid var(--line);
  padding: 1.4rem;
  border-radius: 6px;
  background: rgba(255, 245, 220, 0.04);
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.sem-card:hover {
  border-color: var(--brass);
  transform: translateY(-3px);
  background: rgba(212,160,74,0.08);
}
.sem-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  font-style: italic;
  color: var(--brass);
  margin-bottom: 0.6rem;
}
.sem-card p { font-size: 0.95rem; color: var(--muted); line-height: 1.65; }

.info-list { list-style: none; }
.info-list li {
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
  font-size: 1rem;
  color: var(--muted);
}
.info-list li b { color: var(--ink-light); display: inline-block; margin-right: 0.3rem; font-weight: 600; }

/* PROJECTS — shared meta */
.proj-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.proj-num {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 300;
  font-style: italic;
  color: var(--brass);
  line-height: 1;
  text-shadow: 0 0 18px rgba(212,160,74,0.35);
}
.proj-tag {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-transform: uppercase;
}

/* Projects intro header (above the pinned section) */
.proj-intro {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 9rem 6vw 2rem;
}
.proj-hint {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  opacity: 0.85;
  text-transform: uppercase;
}

/* HORIZONTAL SCROLL — pinned section */
.proj-pin {
  position: relative;
  z-index: 1;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
.proj-track {
  display: flex;
  height: 100vh;
  align-items: center;
  will-change: transform;
}
.proj-h {
  flex: 0 0 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 1.1fr;
  gap: 4vw;
  padding: 8rem 8vw 4rem;
  align-items: center;
  position: relative;
}
.proj-h::before {
  content: '';
  position: absolute;
  left: 8vw; right: 8vw;
  top: 6.5rem;
  height: 1px;
  background: var(--line);
}
.proj-text h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.6rem, 2.8vw, 2.6rem);
  margin-bottom: 1rem;
  color: var(--ink-light);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.proj-text p {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 520px;
}

/* Media area inside a horizontal panel */
.proj-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  max-height: 75vh;
}
.proj-media { display: flex; gap: 1rem; align-items: center; justify-content: center; }
.proj-media img {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 245, 220, 0.04);
  padding: 4px;
  transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
  box-shadow: 0 24px 48px -22px rgba(0,0,0,0.7);
}
.proj-media img:hover {
  transform: translateY(-4px);
  border-color: var(--brass);
  box-shadow: 0 28px 60px -22px rgba(212,160,74,0.4);
}

/* Landscape sizing */
.proj-media.landscape img {
  width: auto;
  height: auto;
  max-height: 65vh;
  max-width: 100%;
  object-fit: contain;
}
.proj-media.landscape.two img { max-width: 48%; }

/* Portrait sizing — much smaller, capped */
.proj-media.portrait img {
  width: auto;
  height: auto;
  max-height: 60vh;
  max-width: 240px;
  object-fit: contain;
}
.proj-media.two.portrait { gap: 1.4rem; }

.proj-end-nav {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 6vw 4rem;
}

/* SKILLS */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.2rem;
}
.skill-card {
  border: 1px solid var(--line);
  padding: 1.6rem;
  border-radius: 6px;
  background: rgba(255, 245, 220, 0.04);
  transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.skill-card:hover {
  border-color: var(--brass);
  transform: translateY(-4px);
  background: rgba(212,160,74,0.08);
}
.skill-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  color: var(--brass);
  margin-bottom: 1rem;
  text-transform: none;
  letter-spacing: 0;
}
.bullet { list-style: none; }
.bullet li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.bullet li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--brass);
  font-weight: bold;
  font-size: 1.4rem;
  top: 0.05rem;
}

/* CONTACT */
.contact-page { max-width: 900px; }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 2rem 0 3rem;
}
.contact-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 245, 220, 0.04);
  text-decoration: none;
  color: var(--ink-light);
  transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.contact-card:not(.static):hover {
  border-color: var(--brass);
  transform: translateY(-4px);
  background: rgba(212,160,74,0.10);
  box-shadow: 0 18px 36px -18px rgba(212,160,74,0.3);
}
.c-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
}
.c-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink-light);
}
.c-arrow {
  position: absolute;
  right: 1.6rem; top: 1.6rem;
  font-size: 1.3rem;
  color: var(--brass);
  transition: transform 0.3s ease;
}
.contact-card:hover .c-arrow { transform: translate(4px, -4px); }
.signoff {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--muted);
  text-align: center;
  margin-top: 1rem;
}

/* PAGE NAV */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  gap: 1rem;
}
.prev-link, .next-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 245, 220, 0.04);
  text-transform: uppercase;
  transition: color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
}
.prev-link:hover, .next-link:hover {
  color: var(--ink-light);
  border-color: var(--brass);
  background: rgba(212,160,74,0.10);
}
.prev-link:hover { transform: translateX(-4px); }
.next-link:hover { transform: translateX(4px); }
.next-link { margin-left: auto; }

/* ---- Mobile ---- */
@media (max-width: 720px) {
  .topbar { padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .brand { font-size: 1.1rem; }
  .nav { gap: 0.8rem; flex-wrap: wrap; }
  .nav a { font-size: 0.58rem; letter-spacing: 0.12em; }
  .panel { padding: 6rem 6vw; }
  .hud { right: 1rem; gap: 0.8rem; bottom: 1rem; }
  .hud-item span { font-size: 0.5rem; }
  .hud-item b { font-size: 0.85rem; }
  .scroll-hint { font-size: 0.55rem; letter-spacing: 0.22em; bottom: 1rem; }
  main.page { padding: 7rem 5vw 4rem; }
  .page-title { font-size: clamp(2rem, 9vw, 3rem); }
  .page-lead { font-size: 0.95rem; }
  .block-title { font-size: 1.3rem; }
  .proj-num { font-size: 2rem; }
  .door-label { font-size: 0.7rem; padding: 0.5rem 0.7rem; }
  .about-grid { grid-template-columns: 1fr; }
  .quick-facts { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .back-link { top: 4rem; left: 1rem; }

  /* Projects: vertical stack on mobile (no pin) */
  .proj-pin { height: auto; overflow: visible; }
  .proj-track {
    display: flex;
    flex-direction: column;
    height: auto;
    transform: none !important;
  }
  .proj-h {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    grid-template-columns: 1fr;
    padding: 3rem 5vw;
    gap: 2rem;
  }
  .proj-h::before { display: none; }
  .proj-visual { max-height: none; }
  .proj-media.landscape img { max-height: 50vh; }
  .proj-media.portrait img { max-height: 55vh; max-width: 200px; }
  .proj-intro { padding: 7rem 5vw 1rem; }
}

/* ---- Very small phones (<= 400px) ---- */
@media (max-width: 400px) {
  .topbar { padding: 0.7rem 0.8rem; }
  .brand { font-size: 0.95rem; letter-spacing: 0.02em; }
  .nav { gap: 0.55rem; }
  .nav a { font-size: 0.52rem; letter-spacing: 0.08em; }
  .hud { display: none; }                /* HUD too cramped on tiny screens */
  .scroll-hint { font-size: 0.5rem; }
  .mute-btn { width: 28px; height: 28px; top: 2.6rem; }
  .mute-btn .ic { width: 14px; height: 14px; }
  main.page { padding: 6rem 4vw 3rem; }
  .page-tag { font-size: 0.55rem; letter-spacing: 0.22em; }
  .back-link { font-size: 0.55rem; padding: 0.4rem 0.7rem; }
  .quick-facts > div { padding: 0.7rem 0.8rem; }
  .sem-card { padding: 1rem; }
  .skill-card { padding: 1.1rem; }
  .contact-card { padding: 1.3rem; }
  .c-value { font-size: 1.05rem; }
  .page-nav { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .next-link { margin-left: 0; }
}

/* ---- Reduce motion preference ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .scroll-line { animation: none; }
}
