/* ── TOKENS ─────────────────────────────────────────────────────────────── */
:root {
  --red:        #B01E28;
  --black:      #000000;
  --white:      #FFFFFF;
  --grey-light: #F5F5F5;
  --grey-mid:   #888888;

  --hex-w:      220px;
  --hex-h:      calc(var(--hex-w) * 1.1547);  /* pointy-top: height > width */
  --hex-gap:    8px;
  --hex-clip:   polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); /* vertex at top */

  --nav-h-open: 72px;
  --nav-h-scroll: 48px;
  --transition-nav: background 0.3s ease, height 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
  --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── RESET + BASE ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  color: var(--black);
  background: var(--white);
  line-height: 1.8;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
h1 { font-family: 'Newsreader', serif; font-weight: 300; font-size: 88px; line-height: 1.05; }
h2 { font-family: 'Newsreader', serif; font-weight: 300; font-size: 56px; line-height: 1.1; }
h3 { font-family: 'Newsreader', serif; font-weight: 300; font-size: 28px; line-height: 1.2; }
p  { font-size: 17px; line-height: 1.8; }

.label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-mid);
}

/* ── PRELOADER ──────────────────────────────────────────────────────────── */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.cube-loader {
  width: 40px;
  height: 40px;
  position: relative;
  transform-style: preserve-3d;
  animation: cubeRotate 1.4s ease-in-out infinite;
}

.cube-face {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0,0,0,0.08);
}
.cube-face.front  { transform: translateZ(20px);  background: var(--red); }
.cube-face.back   { transform: rotateY(180deg) translateZ(20px); background: rgba(0,0,0,0.06); }
.cube-face.left   { transform: rotateY(-90deg) translateZ(20px); background: rgba(0,0,0,0.06); }
.cube-face.right  { transform: rotateY(90deg) translateZ(20px);  background: rgba(0,0,0,0.06); }
.cube-face.top    { transform: rotateX(90deg) translateZ(20px);  background: rgba(0,0,0,0.06); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(20px); background: rgba(0,0,0,0.06); }

@keyframes cubeRotate {
  0%   { transform: rotateX(0deg)   rotateY(0deg); }
  50%  { transform: rotateX(90deg)  rotateY(90deg); }
  100% { transform: rotateX(180deg) rotateY(180deg); }
}

/* ── HEX BACKGROUND (global fixed) ─────────────────────────────────────── */
.hex-bg-global {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ── TOPBAR NAV ─────────────────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: var(--nav-h-open);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: var(--transition-nav);
}

#topbar.scrolled {
  height: var(--nav-h-scroll);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.nav-logo {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 18px;
  color: var(--red);
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
}

.nav-link {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
  position: relative;
  padding-bottom: 6px;
  transition: color 0.2s ease;
}
.nav-link:hover { color: var(--red); }

/* Underline active indicator */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--white);
}
#topbar.scrolled .nav-link.active::after { background: var(--black); }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--black);
  transition: transform 0.3s ease, opacity 0.3s ease;
}
/* White bars when topbar is dark (scrolled) — desktop only */
#topbar.scrolled .hamburger span { background: var(--white); }
@media (max-width: 768px) {
  /* On mobile the scrolled topbar stays white so black bars remain legible */
  #topbar.scrolled { background: var(--white); box-shadow: 0 1px 0 rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.06); }
  #topbar.scrolled .hamburger span { background: var(--black); }
  #topbar.scrolled .nav-link { color: var(--black); }
  #topbar.scrolled .logo { color: var(--red); }
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav panel */
.nav-mobile-panel {
  display: none;
  position: fixed;
  top: var(--nav-h-open);
  left: 0;
  right: 0;
  background: var(--white);
  z-index: 99;
  flex-direction: column;
  padding: 24px 48px 32px;
  gap: 0;
  transform: translateY(-20px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.nav-mobile-panel.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.nav-mobile-panel .nav-link {
  padding: 16px 0;
  font-size: 14px;
  color: var(--black);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: block;
}

/* ── HERO ───────────────────────────────────────────────────────────────── */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: #F02050; /* matches three.js scene background — shows while scene loads */
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}

.hero-overlay h1 {
  color: var(--white);
  text-align: center;
  pointer-events: none;
  -webkit-text-stroke: 0.75px rgba(0,0,0,0.35);
  text-shadow: 0 2px 32px rgba(0,0,0,0.4);
}

.hero-cta {
  margin-top: 32px;
  display: inline-block;
  padding: 14px 36px;
  border: 1.5px solid var(--black);
  color: var(--black);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  pointer-events: all;
}
.hero-cta:hover {
  border-color: var(--black);
  color: var(--black);
  background: rgba(255,255,255,0.75);
}

/* ── ABOUT ──────────────────────────────────────────────────────────────── */
#about {
  position: relative;
  z-index: 1;
  background: var(--white);
}

/* Two-column: bio 33% left, timeline 66% right — constrained to site max-width */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  align-items: start;   /* each col sizes to its own content; JS sets timeline height */
  max-width: 1280px;
  margin: 0 auto;
}

.about-bio-col {
  padding: 80px 48px;
  /* no border-right — the timeline scrollbar acts as the column separator */
}

.about-bio-col .section-label { display: block; margin-bottom: 16px; }
.about-bio-col h2 { margin-bottom: 32px; }
.about-bio-col p  { color: #333; margin-bottom: 32px; }

/* Timeline column: height = bio column height (CSS grid drives row from bio col
   since overflow:auto here contributes 0 to the row's min-height).
   direction:rtl pushes the scrollbar to the LEFT edge, where it sits flush
   against the bio column and acts as the visual separator between columns. */
.about-timeline-col {
  overflow-y: auto;
  overflow-x: hidden;
  direction: rtl;           /* scrollbar flips to left edge */
  scrollbar-width: thin;
  scrollbar-color: var(--red) transparent;
}
.about-timeline-col::-webkit-scrollbar { width: 4px; }
.about-timeline-col::-webkit-scrollbar-track { background: transparent; }
.about-timeline-col::-webkit-scrollbar-thumb { background: var(--red); border-radius: 2px; }

.linkedin-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
  border-bottom: 1px solid var(--black);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.linkedin-link:hover { color: var(--red); border-color: var(--red); }
.linkedin-link svg { width: 16px; height: 16px; }

/* ── TIMELINE (vertical, accordion) ─────────────────────────────────────── */
.timeline-wrap {
  padding: 0 48px 48px;
  direction: ltr; /* restore LTR inside the rtl scroll container */
}

.timeline-track {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Central vertical line */
.timeline-track::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--grey-light);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

/* Older (academic/early-career) nodes — de-emphasised */
.timeline-item.older { opacity: 0.35; }
.timeline-item.older:hover { opacity: 0.7; }

/* ── Row: [text left] [node] [logo right] ── */
.timeline-row {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: center;
  padding: 40px 0;
  border-bottom: 1px solid var(--grey-light);
}

/* Left: date / role / org, right-aligned toward the line */
.timeline-text {
  padding-right: 48px;
  text-align: right;
}

/* Centre: hex node sitting on the vertical line */
.timeline-node {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.timeline-node::before {
  content: '';
  display: block;
  width: 14px;
  height: 12px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--black);
  transition: background 0.2s ease, transform 0.2s ease;
}

.timeline-item:hover .timeline-node::before,
.timeline-item.active .timeline-node::before { background: var(--red); transform: scale(1.3); }
.timeline-item.current .timeline-node::before { background: var(--red); }

/* Right: logo, all pinned to the same left edge */
.timeline-logo-col {
  padding-left: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.timeline-logo {
  display: block;
  max-height: 80px;
  max-width: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  filter: grayscale(100%);
  opacity: 0.55;
  transition: filter 0.35s ease, opacity 0.35s ease;
}

.timeline-item:hover .timeline-logo,
.timeline-item.active .timeline-logo { filter: grayscale(0%); opacity: 1; }

/* Text fallback for items with no logo */
.timeline-logo-text {
  font-family: 'Newsreader', serif;
  font-size: 20px;
  font-weight: 300;
  color: var(--grey-mid);
  font-style: italic;
}

/* ── Accordion detail: full width, slides down below the row ── */
.timeline-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  border-left: 3px solid var(--red);
  background: var(--grey-light);
}

.timeline-item.active .timeline-detail { max-height: 320px; }

.timeline-detail-inner {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 32px;
  padding: 28px 48px;
  align-items: start;
}

.timeline-detail p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--grey-mid);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.timeline-detail ul { padding-left: 0; list-style: none; }

.timeline-detail li {
  font-size: 13px;
  line-height: 1.8;
  color: #444;
  padding-left: 16px;
  position: relative;
  margin-bottom: 4px;
}

.timeline-detail li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 18px;
  line-height: 1.4;
}

/* ── Text labels ── */
.timeline-date {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin-bottom: 10px;
}

.timeline-role {
  font-family: 'Newsreader', serif;
  font-weight: 300;
  font-size: 22px;
  color: var(--black);
  margin-bottom: 6px;
  line-height: 1.3;
}

.timeline-org {
  font-size: 13px;
  color: var(--grey-mid);
  letter-spacing: 0.02em;
}

/* ── PROJECTS ───────────────────────────────────────────────────────────── */
#projects {
  position: relative;
  z-index: 1;
  background: var(--grey-light);
  padding: 80px 0;
  overflow: hidden;
}

.projects-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  position: relative;
  z-index: 1; /* sit above the ghost hex background */
}

.projects-header {
  margin-bottom: 64px;
}

.projects-header .section-label { display: block; margin-bottom: 16px; }

/* Ghost hex cells — fill section background aligned to the project tile grid.
   Uses ::before (border layer) + ::after (fill layer inset 1px) so clip-path
   doesn't swallow the outline — same technique as reference honeycomb.css */
.ghost-hex {
  position: absolute;
}
.ghost-hex::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: var(--hex-clip);
  background: rgba(136,136,136,0.18);
}
.ghost-hex::after {
  content: '';
  position: absolute;
  inset: 1px;
  clip-path: var(--hex-clip);
  background: var(--grey-light);
}

/* Hex grid container */
#hex-grid-stage {
  position: relative;
  margin: 0 auto;
}

/* Hex rows (flexbox, flat-top) */
.hex-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  position: relative;
}

/* Row overlap: reference formula — H * 0.75 + GAP * 0.65 → margin = -(H*0.25) + GAP*0.65 */
.hex-row + .hex-row {
  margin-top: calc(var(--hex-gap) * 0.65 - var(--hex-h) * 0.25);
}

/* Fewer-cell rows (1 and 3) self-centre via flexbox — no transform needed.
   The centering of a 4-cell row within a 5-cell container produces exactly
   the (W+gap)/2 offset required for flat-top hex tiling. */

/* Hex cell wrapper */
.hex-cell {
  flex: 0 0 var(--hex-w);
  width: var(--hex-w);
  height: var(--hex-h);
  clip-path: var(--hex-clip);
  margin-right: var(--hex-gap);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: rgba(136,136,136,0.08);
}
.hex-cell:last-child { margin-right: 0; }

/* Ghost cell (spacer) */
.hex-cell.ghost {
  visibility: hidden;
  pointer-events: none;
}

/* Hub cell — white theme */
.hex-cell.hub {
  background: var(--white);
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hub-label {
  text-align: center;
  pointer-events: none;
}
.hub-label .hub-above,
.hub-label .hub-below {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-mid);
  margin: 4px 0;
}
.hub-label .hub-name {
  display: block;
  font-family: 'Newsreader', serif;
  font-size: 26px;
  font-weight: 300;
  color: var(--red);
  letter-spacing: 0.15em;
}

/* Project cell image */
.hex-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.75) saturate(0.9);
  transform: scale(1);
  transition: transform 0.6s ease, filter 0.6s ease;
}

/* Project cell overlay — red tint on hover */
.hex-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-align: center;
  background: rgba(176, 30, 40, 0.72); /* red tint */
}

.hex-overlay-name {
  font-family: 'Newsreader', serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--white);
  line-height: 1.3;
}

.hex-overlay-meta {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
}

/* Hover state */
.hex-cell:not(.hub):hover .hex-img {
  transform: scale(1.08);
  filter: brightness(0.5) saturate(0.7);
}
.hex-cell:not(.hub):hover .hex-overlay { opacity: 1; }
.hex-cell:not(.hub):hover {
  box-shadow: inset 0 0 0 1.5px rgba(176,30,40,0.7);
}

/* Fade-in animation for hex cells */
.hex-cell {
  opacity: 0;
  animation: hexFadeIn 0.5s var(--ease-out) forwards;
}
@keyframes hexFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hex-cell.hub { opacity: 1; animation: none; }

/* ── PROJECT MODAL ──────────────────────────────────────────────────────── */
#project-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

#project-modal.open {
  opacity: 1;
  pointer-events: all;
}

/* Prev / Next navigation arrows */
.modal-nav {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1010;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
#project-modal.open .modal-nav { display: flex; }
.modal-nav:hover { background: rgba(255,255,255,0.28); border-color: rgba(255,255,255,0.5); }
.modal-nav.hidden { opacity: 0; pointer-events: none; }
.modal-nav-prev { left: 20px; }
.modal-nav-next { right: 20px; }

@media (max-width: 768px) {
  /* Hidden on mobile — use swipe instead */
  .modal-nav { display: none !important; }
}

/* Wrapper — animates the panel */
.modal-wrap {
  max-width: 1140px;
  width: 100%;
  transform: translateY(24px);
  transition: transform 0.4s var(--ease-out);
}
#project-modal.open .modal-wrap { transform: translateY(0); }

/* ── Split panel: image left / text right ────────────────────────── */
.modal-panel {
  display: flex;
  flex-direction: row;
  background: var(--white);
  width: 100%;
  max-height: 88vh;
  overflow: hidden;
  position: relative;
}

/* Left column — full-height image, 55% width */
.modal-image-col {
  flex: 0 0 55%;
  position: relative;
  overflow: hidden;
}
.modal-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Right column — white scrollable text panel */
.modal-text-col {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background: var(--white);
  /* scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--grey-light) transparent;
}
.modal-text-col::-webkit-scrollbar { width: 4px; }
.modal-text-col::-webkit-scrollbar-track { background: transparent; }
.modal-text-col::-webkit-scrollbar-thumb { background: var(--grey-light); }

/* Close button — top-right of text column */
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--black);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.modal-close:hover { background: var(--red); border-color: var(--red); color: var(--white); }

.modal-body {
  padding: 56px 40px 48px;
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-type {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
}

.modal-sep {
  width: 40px;
  height: 1px;
  background: var(--grey-light);
}

.modal-loc-year {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-mid);
}

.modal-title {
  font-family: 'Newsreader', serif;
  font-size: 40px;
  font-weight: 300;
  margin-bottom: 24px;
  line-height: 1.1;
}

.modal-description {
  font-size: 15px;
  line-height: 1.85;
  color: #444;
  margin-bottom: 32px;
}

/* Practice link row: studio logo + link side by side */
.modal-practice-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.modal-studio-logo {
  height: 44px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  opacity: 0.75;
  filter: grayscale(100%);
  display: none; /* shown by JS when a logo is available */
}

.modal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  border-bottom: 1px solid var(--red);
  padding-bottom: 2px;
}

.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 32px;
}
.modal-gallery img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* ── Mobile: revert to stacked layout ───────────────────────────── */
@media (max-width: 768px) {
  .modal-panel { flex-direction: column; max-height: 92vh; overflow-y: auto; }
  .modal-image-col { flex: 0 0 auto; height: 260px; }
  .modal-text-col { overflow-y: visible; }
  .modal-body { padding: 24px 24px 40px; }
  .modal-title { font-size: 28px; }
  .modal-close { background: rgba(0,0,0,0.45); border-color: transparent; color: var(--white); }
  .modal-gallery { flex-direction: row; overflow-x: auto; }
  .modal-gallery img { width: 220px; height: 160px; flex-shrink: 0; }
}

/* ── LAB ────────────────────────────────────────────────────────────────── */
#lab {
  position: relative;
  z-index: 1;
  min-height: 600px;
  overflow: hidden;
}

.lab-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: var(--black);
}

.lab-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1;
}

.lab-content {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 48px;
}

.lab-content .section-label { color: rgba(255,255,255,0.5); margin-bottom: 12px; display: block; }

.lab-title {
  font-family: 'Newsreader', serif;
  font-weight: 300;
  font-size: 56px;
  color: var(--white);
  margin-bottom: 48px;
  line-height: 1.1;
}

.lab-tiles {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 600px;
  gap: 32px;
}

.lab-tile {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 360px;
  transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
  cursor: default;
}
.lab-tile:hover {
  transform: translateY(-6px);
  background: rgba(0,0,0,0.52);
  border-color: rgba(255,255,255,0.32);
}

.lab-tile h3 {
  font-family: 'Newsreader', serif;
  font-weight: 300;
  font-size: 28px;
  color: var(--white);
  margin-bottom: 16px;
}

.lab-tile p {
  font-size: 17px;
  line-height: 1.7;
  color: rgba(255,255,255,0.8);
  max-width: 360px;
  margin-bottom: 40px;
}

.lab-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 2px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.lab-link:hover { color: var(--red); border-color: var(--red); }

/* Archive password form */
.archive-form { margin-top: auto; }

.archive-input-wrap {
  position: relative;
  max-width: 300px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
}

.archive-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 12px 0;
  transition: border-color 0.2s ease;
}
.archive-input::placeholder { color: rgba(255,255,255,0.4); }
.archive-input:focus ~ .input-line { background: var(--red); }

.input-line {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}
.archive-input:focus ~ .input-line { transform: scaleX(1); }

.archive-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid var(--white);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}
.archive-submit:hover { background: var(--white); color: var(--black); }

.archive-message {
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.6);
  display: none;
}

/* ── FOOTER ─────────────────────────────────────────────────────────────── */
#contact {
  position: relative;
  z-index: 1;
  background: var(--black);
  padding: 48px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 32px;
}

.footer-social {
  color: var(--white);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}
.footer-social:hover { color: var(--red); }
.footer-social svg { width: 24px; height: 24px; fill: currentColor; }

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-meta p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--grey-mid);
  line-height: 1.5;
  text-align: center;
}

/* ── SCROLL ANIMATIONS ──────────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.from-left  { transform: translateX(-20px); }
.fade-in.from-right { transform: translateX(20px); }
.fade-in.visible {
  opacity: 1;
  transform: translate(0);
}

/* ── STICKY MOBILE CTA ──────────────────────────────────────────────────── */
#sticky-cta {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--black);
  padding: 16px 24px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}
#sticky-cta.visible { transform: translateY(0); }
#sticky-cta a {
  display: block;
  text-align: center;
  color: var(--white);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.3);
  transition: border-color 0.2s;
}
#sticky-cta a:hover { border-color: var(--red); color: var(--red); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --hex-w: 137px;
    --hex-gap: 6px;
  }
  h1 { font-size: 56px; }
  h2 { font-size: 40px; }
}

@media (max-width: 768px) {
  #topbar { padding: 0 24px; }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-mobile-panel { display: flex; }

  /* About: stack bio on top, timeline below on mobile */
  .about-grid { grid-template-columns: 1fr; }
  .about-bio-col { padding: 48px 24px 40px; border-right: none; border-bottom: 1px solid var(--grey-light); }
  .about-timeline-col { overflow-y: visible; height: auto !important; direction: ltr; }
  .timeline-wrap { padding-top: 0 !important; }

  /* Timeline: collapse to left-edge vertical line on mobile */
  .timeline-wrap { padding: 0 24px 48px; }
  .timeline-track::before { left: 24px; transform: none; }
  .timeline-row {
    grid-template-columns: 1fr;
    padding: 24px 0 24px 48px;
    position: relative;
  }
  .timeline-node {
    position: absolute;
    left: 18px;
    top: 28px;
    justify-content: flex-start;
  }
  .timeline-text { padding-right: 0; text-align: left; }
  .timeline-logo-col { padding-left: 0; padding-top: 16px; }
  .timeline-logo { height: 52px; width: 140px; opacity: 0.7; }
  .timeline-detail-inner { grid-template-columns: 1fr; gap: 12px; padding: 20px 24px; }

  .projects-inner { padding: 0 24px; }
  .lab-content { padding: 60px 24px; }
  .lab-tiles { grid-template-columns: 1fr; }
  .lab-tile { min-height: 280px; }

  #contact { padding: 60px 24px; }

  /* #sticky-cta removed */

  /* modal mobile overrides now live in the split-panel @media block above */

  h1 { font-size: 40px; }
  h2 { font-size: 32px; }
}

@media (max-width: 600px) {
  :root {
    --hex-w: 111px;
    --hex-gap: 4px;
  }
}

/* Disable parallax on mobile (causes jank) */
@media (max-width: 768px) {
  .hero-bg { background-attachment: scroll; }
}
