/* ---------- Tokens ---------- */
:root{
  --bg: #f3efe4;
  --bg-alt: #ebe4d3;
  --panel: #ffffff;
  --ink: #1c1a16;
  --ink-soft: #55524a;
  --grey: #8a867a;
  --grey-line: #d9d3c2;
  --yellow: #f3c332;
  --yellow-deep: #e0a800;
  --radius: 14px;
  --maxw: 100%;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin:0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; text-decoration: none; }
ul{ margin:0; padding:0; }

/* ---------- Progress bar ---------- */
.progress-bar{
  position: fixed;
  top:0; left:0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--yellow-deep), var(--yellow));
  z-index: 200;
  transition: width 0.08s linear;
}

/* ---------- Nav ---------- */
.nav{
  position: fixed;
  top:0; left:0; right:0;
  height: 64px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(243,239,228,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--grey-line);
  z-index: 150;
}
.nav::after{
  content:'';
  position: absolute;
  top: 100%; left:0; right:0;
  height: 28px;
  background: linear-gradient(to bottom, rgba(243,239,228,0.7), rgba(243,239,228,0));
  pointer-events: none;
}
.nav-logo{
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.nav-logo .dot{ color: var(--yellow-deep); }
.nav-links{
  display:flex;
  gap: 28px;
  list-style:none;
}
.nav-links a{
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s;
}
.nav-links a:hover{ color: var(--ink); }
.nav-links a::after{
  content:'';
  position:absolute;
  left:0; bottom:-2px;
  width:0; height:2px;
  background: var(--yellow-deep);
  transition: width 0.25s ease;
}
.nav-links a:hover::after{ width: 100%; }
.nav-toggle{
  display:none;
  flex-direction: column;
  gap: 5px;
  background:none;
  border:none;
  cursor:pointer;
  padding: 6px;
}
.nav-toggle span{
  width: 22px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

/* ---------- Layout: left content / right sticky visual ---------- */
.layout{
  display:flex;
  padding-top: 64px;
}
.content{
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 0 6vw 10vh 6vw;
}
.visual{
  flex: 0 0 34%;
  max-width: 520px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  display:flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--grey-line);
  background: var(--bg-alt);
  overflow: hidden;
}
.visual-inner{
  position: relative;
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
}
#climbCanvas{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  background-color: var(--bg-alt);
}
.visual-caption{
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--grey);
  background: var(--panel);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--grey-line);
}
#frameLabel{ color: var(--yellow-deep); font-weight: 700; }

/* ---------- Hero ---------- */
.hero{
  min-height: calc(100vh - 64px);
  display:flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--maxw);
  padding-top: 4vh;
}
.status{
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 14px 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--grey-line);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.status-dot{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2f9e5b;
  box-shadow: 0 0 0 3px rgba(47,158,91,0.18);
  flex: none;
}
.eyebrow{
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey);
  margin: 0 0 14px;
  font-weight: 600;
}
.hero h1{
  font-family: var(--font-head);
  font-size: clamp(3.4rem, 9vw, 7.2rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 24px;
  font-weight: 700;
  position: relative;
  display: inline-block;
}
.hero-sub{
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 0 32px;
}
.hero-links{
  display:flex;
  gap: 16px;
  margin-bottom: 56px;
  flex-wrap: wrap;
}
.btn{
  display:inline-flex;
  align-items:center;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 1.5px solid transparent;
}
.btn-primary{
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--yellow-deep);
}
.btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 6px 0 var(--yellow-deep); }
.btn-ghost{
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn-ghost:hover{ background: var(--ink); color: var(--bg); }

.hero-stats{
  display:flex;
  gap: 40px;
  flex-wrap: wrap;
  border-top: 1px solid var(--grey-line);
  padding-top: 24px;
}
.stat{
  display:flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.stat:hover{ transform: scale(1.08); }
.stat-num{
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--yellow-deep);
}
.stat-label{
  font-size: 0.78rem;
  color: var(--grey);
  max-width: 14ch;
}

/* ---------- Sections ---------- */
.section{
  max-width: var(--maxw);
  padding: 10vh 0;
  border-top: 1px solid var(--grey-line);
}
.section-title{
  font-family: var(--font-head);
  font-size: 1.9rem;
  font-weight: 700;
  display:flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 36px;
}
.tag{
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--bg);
  background: var(--ink);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

/* ---------- Cards ---------- */
.card{
  background: var(--panel);
  border: 1px solid var(--grey-line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 22px;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}
.card:hover{
  transform: translateY(-3px) scale(1.025);
  box-shadow: 0 16px 32px -14px rgba(28,26,22,0.28);
  border-color: var(--yellow-deep);
  z-index: 2;
}
.card-head, .edu-head{
  display:flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.card h3, .edu-head h3{
  font-family: var(--font-head);
  font-size: 1.2rem;
  margin: 0;
}
.date{
  font-size: 0.78rem;
  color: var(--grey);
  white-space: nowrap;
  font-weight: 600;
}
.card-role, .edu-sub{
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 4px 0 14px;
}
.edu-grade{ margin: 0; font-size: 0.95rem; }
.bullets{
  list-style: none;
  display:flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.bullets li{
  position: relative;
  padding-left: 18px;
  font-size: 0.95rem;
  color: var(--ink);
}
.bullets li::before{
  content:'';
  position:absolute;
  left:0; top: 9px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--yellow-deep);
}
/* ---------- Project demo reel ---------- */
/* --demo-ratio is the source footage ratio, set per project in the markup.
   The reel is two clips wide, so its own ratio is doubled; each clip then sits
   at exactly the recorded ratio and object-fit has nothing to letterbox. */
/* Vertical margin leaves room for the active clip's scale-up (~11% of clip height). */
.demo-reel{
  position: relative;
  display:flex;
  gap: 10px;
  margin: 4% 0 calc(16px + 4%);
  aspect-ratio: calc((var(--demo-ratio, 16 / 9)) * 2);
}
.demo-clip{
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--grey-line);
  background: var(--ink);
  cursor: pointer;
  outline: none;
  transition: transform 0.55s var(--ease),
              filter 0.45s ease,
              box-shadow 0.45s ease,
              border-color 0.35s ease;
}
.demo-clip video{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.82) brightness(0.96);
  transition: filter 0.35s ease;
}

/* Active clip slides toward centre and grows; the other tucks in behind it. */
.demo-reel[data-active="0"] .demo-clip:nth-child(1),
.demo-reel[data-active="1"] .demo-clip:nth-child(2){
  z-index: 3;
  border-color: var(--yellow-deep);
  box-shadow: 0 22px 40px -18px rgba(28,26,22,0.55);
}
/* Shift must stay <= (scale - 1) / 2 so the grown clip still covers its resting
   footprint; otherwise it slides out from under a still cursor and flickers. */
.demo-reel[data-active="0"] .demo-clip:nth-child(1){ transform: translateX(10%) scale(1.22); }
.demo-reel[data-active="1"] .demo-clip:nth-child(2){ transform: translateX(-10%) scale(1.22); }
.demo-reel[data-active="0"] .demo-clip:nth-child(1) video,
.demo-reel[data-active="1"] .demo-clip:nth-child(2) video{ filter: none; }

.demo-reel[data-active="0"] .demo-clip:nth-child(2),
.demo-reel[data-active="1"] .demo-clip:nth-child(1){
  z-index: 2;
  filter: brightness(0.55) blur(1px);
}
.demo-reel[data-active="0"] .demo-clip:nth-child(2){ transform: translateX(-45%) scale(0.86); }
.demo-reel[data-active="1"] .demo-clip:nth-child(1){ transform: translateX(45%) scale(0.86); }

.demo-clip:focus-visible{ border-color: var(--yellow-deep); box-shadow: 0 0 0 3px var(--yellow); }

.demo-clip::after{
  content: 'Click to expand';
  position: absolute;
  top: 8px; right: 8px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.demo-reel[data-active="0"] .demo-clip:nth-child(1)::after,
.demo-reel[data-active="1"] .demo-clip:nth-child(2)::after{
  opacity: 1;
  transform: none;
}
.demo-label{
  position: absolute;
  left: 8px; bottom: 8px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  border: 1px solid var(--grey-line);
  white-space: nowrap;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
}
.demo-reel[data-active] .demo-label{ opacity: 0; }

/* ---------- Project photos (hardware project) ---------- */
/* Square crops of portrait phone photos; the subject sits centrally in both. */
.photo-row{
  display:flex;
  gap: 10px;
  margin: 4px 0 16px;
}
.photo{
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--grey-line);
  background: var(--bg-alt);
}
.photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Demo lightbox ---------- */
.demo-modal{
  width: min(92vw, 1200px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.demo-modal[open]{ animation: demo-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
.demo-modal::backdrop{
  background: rgba(28,26,22,0.8);
  backdrop-filter: blur(6px);
}
.demo-modal[open]::backdrop{ animation: demo-fade 0.3s ease; }
.demo-modal-bar{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.demo-modal-title{
  font-family: var(--font-head);
  font-weight: 600;
  color: #fff;
  font-size: 1rem;
}
.demo-modal-close{
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--yellow);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.demo-modal-close:hover{ transform: scale(1.08); }
.demo-modal video{
  display: block;
  width: 100%;
  max-height: 82vh;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
@keyframes demo-pop{ from{ opacity: 0; transform: scale(0.94); } }
@keyframes demo-fade{ from{ opacity: 0; } }

@media (prefers-reduced-motion: reduce){
  .demo-clip, .demo-clip video, .demo-clip::after{ transition: none; }
  .demo-reel[data-active] .demo-clip{ transform: none !important; filter: none; }
  .demo-modal[open], .demo-modal[open]::backdrop{ animation: none; }
}

.chips{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}
.card-foot{
  display:flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}
.code-link{
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  border-bottom: 2px solid var(--yellow);
  padding-bottom: 1px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.code-link:hover{ border-color: var(--yellow-deep); color: var(--yellow-deep); }

.chip{
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--grey-line);
  color: var(--ink-soft);
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s ease;
}
.chip:hover{
  transform: scale(1.1);
  border-color: var(--yellow-deep);
}

.awards{ display:flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.award-pill{
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.award-pill:hover{
  transform: scale(1.08);
}

/* ---------- Skills ---------- */
.skills-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.skill-group h4{
  font-family: var(--font-head);
  font-size: 0.95rem;
  margin: 0 0 12px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Contact ---------- */
.contact-card{ text-align:left; }
.contact-card p{ margin: 0 0 20px; font-size: 1.05rem; }
.contact-links{ display:flex; gap: 14px; flex-wrap: wrap; }
.footer{
  margin-top: 60px;
  font-size: 0.8rem;
  color: var(--grey);
}

/* ---------- Reveal-on-scroll ---------- */
.reveal{
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in-view{
  opacity: 1;
  transform: translateY(0);
}
.card.reveal.in-view:hover{
  transform: translateY(-3px) scale(1.025);
}
.award-pill.reveal.in-view:hover{
  transform: scale(1.08);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  /* The climbing animation needs a tall side column; on narrow screens it
     squeezed the content into a strip, so drop it and go single-column. */
  .visual{ display: none; }

  .nav{ padding: 0 20px; }
  .nav-links{
    position: fixed;
    top: 64px; right: 0;
    background: var(--bg);
    flex-direction: column;
    width: 220px;
    padding: 20px;
    gap: 18px;
    border-left: 1px solid var(--grey-line);
    border-bottom: 1px solid var(--grey-line);
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  .nav-links.open{ transform: translateX(0); }
  .nav-toggle{ display:flex; }

  .content{ padding: 0 24px 64px; }
  .hero{ min-height: auto; padding: 72px 0 64px; }
  .section{ padding: 64px 0; }
  .skills-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 600px){
  .content{ padding: 0 16px 48px; }
  .hero{ padding: 48px 0 48px; }
  .hero h1{ font-size: clamp(2.6rem, 13vw, 3.4rem); margin-bottom: 18px; }
  .hero-sub{ font-size: 1.02rem; margin-bottom: 24px; }
  .status{ font-size: clamp(0.64rem, 3.1vw, 0.74rem); white-space: nowrap; padding: 5px 12px 5px 10px; margin-bottom: 14px; }
  .hero-links{ margin-bottom: 36px; gap: 12px; }
  .hero-links .btn{ flex: 1 1 0; justify-content: center; }
  .hero-stats{ gap: 28px; }
  .stat-label{ max-width: 16ch; }

  .section{ padding: 48px 0; }
  .section-title{ font-size: 1.5rem; margin-bottom: 24px; }

  .card{ padding: 20px; margin-bottom: 16px; }
  .card h3, .edu-head h3{ font-size: 1.1rem; }
  .bullets li{ font-size: 0.92rem; }

  /* Demo reel becomes a swipeable row: each clip at its recorded ratio, with the
     next one peeking in so it's obvious there's more. Bleeds to the card edges. */
  .demo-reel{
    aspect-ratio: auto;
    gap: 10px;
    margin: 16px -20px 18px;
    padding: 0 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 20px;
    scrollbar-width: none;
  }
  .demo-reel::-webkit-scrollbar{ display: none; }
  .photo-row{
    margin: 4px -20px 16px;
    padding: 0 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 20px;
    scrollbar-width: none;
  }
  .photo-row::-webkit-scrollbar{ display: none; }
  .photo{ flex: 0 0 76%; scroll-snap-align: start; }
  .demo-clip{
    flex: 0 0 86%;
    height: auto;
    aspect-ratio: var(--demo-ratio, 16 / 9);
    scroll-snap-align: start;
  }
  /* The grow-and-tuck effect is built for two clips side by side; in the swipe
     row it would overlap the neighbouring clip, so keep clips flat. */
  .demo-reel[data-active] .demo-clip{
    transform: none !important;
    filter: none;
    box-shadow: none;
  }

  .contact-links .btn{ flex: 1 1 100%; justify-content: center; }
  .awards{ flex-direction: column; }
  .award-pill{ border-radius: 14px; }
}

/* Touch screens: no hover, so show the tap hint up front and skip hover lifts
   that otherwise stick after a tap. */
@media (hover: none){
  .demo-clip video{ filter: none; }
  .demo-clip::after{ content: 'Tap to play'; opacity: 1; transform: none; }
  .card:hover, .card.reveal.in-view:hover{
    transform: none;
    box-shadow: none;
    border-color: var(--grey-line);
  }
  .stat:hover, .chip:hover, .award-pill:hover, .award-pill.reveal.in-view:hover{ transform: none; }
}
