/* ═══ HOME — scrollytelling hero + sections ═══ */

/* ── Scrollytelling container ──
   Tall track (450vh) drives the frame scrub; the viewport-sized child
   stays stuck while frames play. Falls back to a single screen when
   motion is reduced or JS is unavailable. */

.scrolly {
  position: relative;
  height: 450vh;
  /* Hero is cinematic-dark in BOTH themes — deep navy like the footage */
  background: #05070f;
}
@media (max-width: 760px) { .scrolly { height: 350vh; } }
.scrolly.scrolly-static { height: 100svh; }

.scrolly-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  width: 100%;
  overflow: hidden;
}

.scrolly-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Readability scrim + edge vignette + bottom fade into the page
   background so the sequence melts into the site instead of ending
   at a hard line. The flat scrim keeps overlay text legible on the
   brightest frames; the lower-third band anchors the identity stage. */
.scrolly-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(4, 5, 10, 0.52), rgba(4, 5, 10, 0.52)),
    radial-gradient(120% 90% at 50% 40%, transparent 46%, rgba(3, 4, 8, 0.72) 100%),
    linear-gradient(rgba(3, 4, 8, 0.46), transparent 20%),
    linear-gradient(transparent 48%, rgba(3, 4, 8, 0.55) 82%, var(--bg-0) 100%);
}

/* ── Overlay stages ── */

.scrolly-stage {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.scrolly-stage .stage-inner {
  width: min(var(--container), 100%);
  margin-inline: auto;
  pointer-events: auto;
}

.stage-center { text-align: center; }
.stage-center .stage-inner { max-width: 780px; }
.stage-left .stage-inner { max-width: var(--container); }
.stage-left .stage-inner > * { max-width: 520px; }
.stage-right { text-align: right; }
.stage-right .stage-inner > * { max-width: 520px; margin-left: auto; }

/* Stage 1 (identity): anchored to the lower band of the viewport so
   the portrait's face stays unobstructed. */
.stage-bottom { align-items: flex-end; }
.stage-bottom .stage-inner { padding-bottom: 13vh; }

#stage-1 .stage-title-xl {
  font-size: clamp(3.6rem, 2.1rem + 6.6vw, 7.8rem);
}
#stage-1 .stage-role {
  font-size: clamp(0.9rem, 0.78rem + 0.55vw, 1.15rem);
  letter-spacing: 0.16em;
  margin-top: var(--space-5);
}
@media (max-width: 640px) {
  .stage-bottom .stage-inner { padding-bottom: 15vh; }
}

/* Kicker line above the name: rules flanking the role list */
.stage-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.kicker-line {
  height: 1px;
  width: 44px;
  flex: 0 0 auto;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
}
.stage-kicker .kicker-line:last-child { background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), transparent); }
.kicker-text {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #d7dbe8;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .kicker-text { white-space: normal; text-align: center; font-size: 10px; letter-spacing: 0.16em; }
  .kicker-line { width: 22px; }
}

/* Designation line: "// role" mono chip, matching the site's eyebrow language */
.scrolly .stage-role {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-weight: 600;
}
.role-slash { color: var(--flare); font-weight: 700; font-family: var(--font-mono); }

.stage-tagline {
  margin-top: var(--space-4);
  max-width: 440px;
  margin-inline: auto;
  font-size: var(--text-md);
  color: #b9c0d4;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.6);
}

/* ── Poster typography: condensed uppercase, solid + outlined lines ──
   Accent words render as hollow orange strokes over the footage,
   solid lines stay bone-white — the reference treatment. */
.scrolly .text-aurora,
.scrolly .stage-outline {
  background: none;
  /* Faint ember fill + thick stroke + glow: outlined but unmissable */
  -webkit-text-fill-color: rgba(255, 138, 60, 0.16);
  color: rgba(255, 138, 60, 0.16);
  -webkit-text-stroke: 3px var(--flare);
  text-shadow: none;
  filter: drop-shadow(0 0 16px rgba(255, 138, 60, 0.35));
}
.scrolly .role-rotator { color: #cfd6e6; }
.scrolly .eyebrow { color: #b3bacb; }
.scrolly .eyebrow::before { color: var(--flare); }

/* Frames are dark — overlay text is always light, in both themes */
.scrolly .stage-title {
  font-family: var(--font-condensed);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(2.6rem, 1.7rem + 4.4vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0.012em;
  color: #f2efe6;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5);
  margin-top: var(--space-4);
}
.scrolly .stage-title-xl { font-size: clamp(3.6rem, 2.2rem + 6.5vw, 7.5rem); }

.scrolly .stage-role {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 500;
  color: #cdd3e4;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.6);
}
.scrolly .role-rotator { display: inline-block; }

.scrolly .stage-sub {
  margin-top: var(--space-4);
  font-size: var(--text-md);
  line-height: 1.6;
  color: #b9c0d4;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.6);
}

.stage-right .eyebrow { justify-content: flex-end; }
.stage-right .eyebrow::before { order: 2; }

.stage-cta {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

.hero-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  list-style: none;
  margin-top: var(--space-7);
  padding: 0;
}
.hero-proof li strong {
  display: block;
  font-family: var(--font-condensed);
  font-size: var(--text-xl);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #f4f6fd;
}
.hero-proof li span { font-size: var(--text-xs); color: #98a0b6; }
.hero-proof-sep { width: 1px; height: 30px; background: rgba(255, 255, 255, 0.22); }

/* Scroll hint */
.scrolly-hint {
  position: absolute;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #98a0b6;
  transition: opacity var(--dur-med) ease;
}
.scrolly-hint.is-done { opacity: 0; }
.hero-scroll-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(#98a0b6, transparent);
  animation: scroll-hint 2s var(--ease-out) infinite;
  transform-origin: top;
}
@keyframes scroll-hint {
  0% { transform: scaleY(0); }
  45% { transform: scaleY(1); }
  100% { transform: scaleY(1) translateY(20px); opacity: 0; }
}

/* Static fallback (reduced motion / no JS): stage 1 shown, others follow in flow */
.scrolly-static .scrolly-stage {
  opacity: 1;
  visibility: visible;
  position: relative;
  padding-block: var(--space-6);
}
.scrolly-static .scrolly-sticky { height: auto; min-height: 100svh; position: relative; }
.scrolly-static #stage-2,
.scrolly-static #stage-3 { display: none; }
.scrolly-static .scrolly-hint { display: none; }

/* ── Marquee ── */

.section-slim { padding-block: var(--space-5); border-block: 1px solid var(--border); }
.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-fast) ease;
}
.marquee-item:hover { color: var(--text-primary); }
.marquee-item i { font-style: normal; color: var(--accent); }

/* ── Numbers ── */

.section-alt { background: var(--bg-1); border-block: 1px solid var(--border); }

/* ── Career rows ── */

.career-list { display: flex; flex-direction: column; }
.career-row {
  display: grid;
  grid-template-columns: 44px 1.3fr 1fr 30px;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-3);
  border-bottom: 1px solid var(--border);
  color: inherit;
  transition: background-color var(--dur-fast) ease, padding-left var(--dur-med) var(--ease-out);
}

.career-org { display: flex; flex-direction: column; gap: 2px; }

.career-logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
}
.career-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.career-logo-fallback {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--accent);
}
.career-row:first-child { border-top: 1px solid var(--border); }
.career-row:hover { background: var(--surface); padding-left: var(--space-5); }

.career-period { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.career-role { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); color: var(--text-primary); }
.career-company { font-size: var(--text-sm); color: var(--text-secondary); }
.career-arrow { color: var(--text-muted); transition: transform var(--dur-med) var(--ease-spring); }
.career-row:hover .career-arrow { transform: translate(3px, -3px); color: var(--accent); }

@media (max-width: 640px) {
  .career-row { grid-template-columns: 44px 1fr 30px; }
  .career-role { grid-column: 2; }
  .career-org { grid-column: 2; }
  .career-arrow { grid-column: 3; grid-row: 1; }
}

/* ── Education cards ── */

.edu-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.edu-card { padding: var(--space-5); color: inherit; }
.edu-period { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.edu-card h3 { font-size: var(--text-md); margin-top: var(--space-3); transition: color var(--dur-fast) ease; }
.edu-card:hover h3 { color: var(--accent); }
.edu-degree { margin-top: var(--space-2); font-size: var(--text-sm); color: var(--text-secondary); }
.edu-score {
  margin-top: var(--space-3);
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-primary);
}

/* ── GitHub ── */

.gh-card { padding: var(--space-6); }
.gh-title { font-size: var(--text-lg); margin-top: var(--space-3); word-break: break-all; }
.gh-stats { display: flex; gap: var(--space-6); margin-top: var(--space-5); flex-wrap: wrap; }
.gh-stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text-primary);
}
.gh-stats span { font-size: var(--text-xs); color: var(--text-muted); }
.gh-repo { font-size: var(--text-lg); margin-top: var(--space-3); font-family: var(--font-mono); }
.gh-when { font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--space-2); }
.gh-terminal {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--bg-0);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.9;
}
.gh-prompt { color: var(--azure); }
.gh-out { color: var(--text-muted); }

/* ── Light theme refinements ── */

:root[data-theme='light'] .gh-prompt { color: var(--success); }
:root[data-theme='light'] .gh-terminal { background: var(--bg-1); }
:root[data-theme='light'] .section-slim { background: var(--bg-2); }
:root[data-theme='light'] .number-value { color: var(--flare-deep); }

/* ── Custom cursor (pointer devices only) ── */

.cursor { display: none; }

@media (hover: hover) and (pointer: fine) {
  .cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-cursor);
    pointer-events: none;
  }
  .cursor-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    margin: -3px;
    border-radius: 50%;
    background: var(--accent);
  }
  .cursor-ring {
    position: absolute;
    width: 34px;
    height: 34px;
    margin: -17px;
    border-radius: 50%;
    border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent);
    transition: opacity var(--dur-fast) ease;
  }
  .cursor.is-active .cursor-ring { opacity: 0.6; }

  @media (prefers-reduced-motion: reduce) {
    .cursor { display: none; }
  }
}

/* ── Section header with side action ── */

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

/* ── Certifications preview strip ── */

/* ── Certifications carousel ── */

.cert-carousel { position: relative; }

.cert-track {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 2px; /* room for focus outline */
}
.cert-track::-webkit-scrollbar { display: none; }

.cert-card {
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: min(280px, 76vw);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.cert-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cert-card-img { position: relative; aspect-ratio: 10 / 7; overflow: hidden; border-bottom: 1px solid var(--border); }
.cert-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out), filter var(--dur-med) ease;
}
.cert-card:hover .cert-card-img img { transform: scale(1.08); filter: brightness(0.7); }

.cert-card-cat {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 0.3em 0.8em;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--bg-0) 55%, transparent);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #f2efe6;
}

.cert-card-zoom {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: #fff;
  opacity: 0;
  transition: opacity var(--dur-fast) ease;
}
.cert-card:hover .cert-card-zoom { opacity: 1; }

.cert-card-body { padding: var(--space-4); display: flex; flex-direction: column; gap: 4px; }
.cert-card-title { font-weight: 700; font-size: var(--text-sm); color: var(--text-primary); line-height: 1.35; transition: color var(--dur-fast) ease; }
.cert-card:hover .cert-card-title { color: var(--accent); }
.cert-card-issuer { font-size: var(--text-xs); color: var(--text-muted); }

.cert-nav {
  display: none;
  position: absolute;
  top: 38%;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur));
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1;
  transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.cert-nav:hover { border-color: var(--accent); transform: translateY(-2px); }
.cert-nav-prev { left: -18px; }
.cert-nav-next { right: -18px; }
@media (min-width: 860px) { .cert-nav { display: grid; } }

/* ── Responsive hardening ── */

@media (max-width: 640px) {
  .hero-proof { gap: var(--space-4); flex-wrap: wrap; }
  .hero-proof li strong { font-size: var(--text-md); }
  .stage-cta { gap: var(--space-3); }
  .stage-cta .btn { padding: 0.68em 1.3em; }
  .scrolly .stage-title { font-size: var(--text-xl); }
  .scrolly .stage-sub { font-size: var(--text-base); }
  .work-metrics { gap: var(--space-4); }
  .work-card { padding: var(--space-5); }
  .section-head-row { flex-direction: column; align-items: flex-start; }
  .numbers-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-5) var(--space-3); }
  .number-value { font-size: var(--text-xl); }
}


/* ── Compact featured-work grid (home): three tighter cards ── */

@media (min-width: 720px) { .work-grid-compact .work-card { grid-column: span 6; } }
@media (min-width: 1080px) { .work-grid-compact .work-card { grid-column: span 4; } }
.work-grid-compact .work-card { padding: var(--space-5); gap: var(--space-4); }
.work-grid-compact .work-card h3 { font-size: var(--text-md); }
.work-grid-compact .work-card p { font-size: var(--text-sm); }
.work-grid-compact .work-media { margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) 0; }
.work-grid-compact .work-metrics { display: none; }

/* ── Marquee label ── */
.marquee-label {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin: 0 auto var(--space-3);
}

/* ── Stat tiles (achievements): poster numerals in a single ruled row ── */

.numbers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-block: 1px solid var(--border);
}
@media (min-width: 640px)  { .numbers-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .numbers-grid { grid-template-columns: repeat(6, 1fr); } } /* one row, like the reference */

.number-cell {
  text-align: left;
  padding: var(--space-6) var(--space-5);
  border-right: 1px solid var(--border);
}
.number-cell:last-child { border-right: none; }

/* Row-wrap dividers only apply where the grid actually wraps */
@media (max-width: 639px) {
  .number-cell:nth-child(2n) { border-right: none; }
  .number-cell:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (min-width: 640px) and (max-width: 1099px) {
  .number-cell:nth-child(3n) { border-right: none; }
  .number-cell:nth-child(n+4) { border-top: 1px solid var(--border); }
}

.number-value {
  font-family: var(--font-condensed);
  font-weight: 400;
  /* Sized to comfortably fit "1800+" (our widest metric) in a 6-up row
     at the container's max width — see the achievements CSS note. */
  font-size: clamp(2.2rem, 1.6rem + 1.8vw, 3.2rem);
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}
.number-value .counter { color: var(--text-primary); }
.number-value { color: var(--accent); } /* suffix inherits accent */
.number-label {
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}
@media (max-width: 1099px) { .number-label { white-space: normal; } }

/* ── Highlights scrub (shorter track than the hero) ── */

.scrolly-mini { height: 320vh; }
@media (max-width: 760px) { .scrolly-mini { height: 260vh; } }
.stage-center .stage-sub { margin-inline: auto; }

/* All highlight text rides the left edge, oversized poster scale */
.scrolly-mini .stage-left .stage-inner > * { max-width: 760px; }
.scrolly-mini .stage-title {
  font-size: clamp(3.4rem, 2rem + 7vw, 8.5rem);
  line-height: 0.94;
}
.scrolly-mini .stage-outline { -webkit-text-stroke-width: 4px; }
.scrolly-mini .eyebrow { font-size: var(--text-sm); letter-spacing: 0.2em; }

/* Outline strokes are sized for large desktop poster type — at mobile
   font sizes the same absolute px width bridges the counters of
   condensed letterforms and reads as a smudge instead of an outline. */
@media (max-width: 640px) {
  .scrolly .text-aurora,
  .scrolly .stage-outline {
    -webkit-text-stroke-width: 1.4px;
    filter: drop-shadow(0 0 6px rgba(255, 138, 60, 0.3));
  }
  .scrolly-mini .stage-outline { -webkit-text-stroke-width: 1.6px; }
}
.scrolly-mini .stage-sub {
  max-width: 560px;
  margin-top: var(--space-5);
  font-size: var(--text-lg);
  color: #cfd6e6;
}

/* ── Highlights: stronger scrim + soft entry/exit gradients ──
   This section lives mid-page, so BOTH ends melt into the page
   background instead of cutting hard. */
.scrolly-mini .scrolly-vignette {
  background:
    /* Left-side scrim so left-anchored highlight text always reads clearly;
       fades out by ~78% of the width so the right side stays uncovered. */
    linear-gradient(90deg, rgba(3, 4, 8, 0.88) 0%, rgba(3, 4, 8, 0.68) 35%, rgba(3, 4, 8, 0.32) 62%, transparent 78%),
    linear-gradient(rgba(4, 5, 10, 0.58), rgba(4, 5, 10, 0.58)),
    radial-gradient(120% 90% at 50% 45%, transparent 38%, rgba(3, 4, 8, 0.82) 100%),
    linear-gradient(var(--bg-0) 0%, rgba(3, 4, 8, 0.55) 12%, transparent 26%),
    linear-gradient(transparent 72%, rgba(3, 4, 8, 0.55) 88%, var(--bg-0) 100%);
}
