/* ==========================================================================
   Zachary Stallings Portfolio
   --------------------------------------------------------------------------
   Design notes
   - Dark, warm palette. Amber accent with a teal secondary. Flat colors only.
   - No hover effects by design. Feedback uses :active and :focus-visible.
   - All motion respects prefers-reduced-motion.
   ========================================================================== */

:root {
  --bg-0: #0a0b0d;
  --bg-1: #101215;
  --bg-2: #171a1e;
  --bg-3: #1f2329;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text-0: #f3f0ea;
  --text-1: #a9a59c;
  --text-2: #8a867e;
  --accent: #f2a93b;
  --accent-ink: #1a1204;
  --accent-soft: rgba(242, 169, 59, 0.14);
  --teal: #62d4c6;
  --teal-soft: rgba(98, 212, 198, 0.14);

  --font-display: 'Syne', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 18px;
  --radius-sm: 10px;
  --container: 1180px;
  --gutter: clamp(20px, 5vw, 56px);
  --nav-h: 72px;
  /* The height term keeps the card plus the project bar on screen on short laptops */
  --card-w: min(66vw, 820px, max(440px, calc(160vh - 560px)));
}

/* Base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  /* Syne defaults to old-style figures, which make 800,000 read as 8oo,ooo */
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.nav-open { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p, figure { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  font-weight: 500;
}
.skip-link:focus { top: 16px; }

/* Buttons --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1;
  border: 1px solid var(--line-strong);
  transition: transform 0.15s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--text-0); }
.btn--small { padding: 10px 16px; font-size: 0.85rem; }

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-1);
  transition: transform 0.15s var(--ease);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 18px; height: 18px; }

/* Navigation ------------------------------------------------------------ */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.is-scrolled {
  background: rgba(10, 11, 13, 0.84);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
/* With the mobile menu open the nav must not carry a backdrop-filter:
   it would become the containing block for the fixed menu panel. */
.nav.is-open {
  background: var(--bg-0);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-bottom-color: var(--line);
}

.nav__inner {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__brand { display: flex; align-items: center; gap: 12px; }
.nav__mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
}
.nav__name { font-weight: 500; font-size: 0.95rem; }

.nav__links { display: flex; align-items: center; gap: 28px; }
.nav__links a[data-nav] {
  font-size: 0.92rem;
  color: var(--text-1);
  position: relative;
  padding: 6px 0;
}
.nav__links a[data-nav].is-active { color: var(--text-0); }
.nav__links a[data-nav].is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav__cta { margin-left: 8px; }

.nav__toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-0);
  transition: transform 0.25s var(--ease);
}

/* Hero ------------------------------------------------------------------ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 56px) 0 96px;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.5px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 72% 40%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 70% at 72% 40%, #000 0%, transparent 70%);
}
.hero__bg::after {
  content: '';
  position: absolute;
  width: 64vmax;
  height: 64vmax;
  right: -24vmax;
  top: -28vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(242, 169, 59, 0.14), transparent);
}

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-1);
  margin-bottom: 30px;
}
.eyebrow__sep { color: var(--text-2); }

.status { display: inline-flex; align-items: center; gap: 9px; color: var(--text-0); }
.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(98, 212, 198, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(98, 212, 198, 0); }
  100% { box-shadow: 0 0 0 0 rgba(98, 212, 198, 0); }
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.4rem, 8.6vw, 6.8rem);
  line-height: 0.94;
  letter-spacing: -0.025em;
  margin-bottom: 30px;
  /* Optical correction for Syne's left side bearing at display size */
  margin-left: -0.04em;
}

.hero__role {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.35;
  margin-bottom: 10px;
}
.hero__amp { color: var(--text-2); font-weight: 500; }

.hero__rotator {
  font-size: 1.05rem;
  color: var(--text-1);
  margin-bottom: 22px;
  min-height: 1.7em;
}
.rotator { display: inline-block; color: var(--accent); font-weight: 500; }
.rotator span { display: inline-block; }
.rotator.is-out span { animation: rot-out 0.32s var(--ease) forwards; }
.rotator.is-in span { animation: rot-in 0.45s var(--ease-out); }
@keyframes rot-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes rot-in { from { opacity: 0; transform: translateY(14px); } }

.hero__text { color: var(--text-1); max-width: 54ch; margin-bottom: 36px; text-wrap: pretty; }
.hero__text strong { color: var(--text-0); font-weight: 500; }

.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero__media {
  position: relative;
  justify-self: end;
  width: min(100%, 440px);
}
.portrait {
  position: relative;
  z-index: 1;
  border-radius: 28px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait__frame {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  border: 1.5px solid var(--accent);
  transform: rotate(-4deg) translate(14px, 14px);
  z-index: 0;
}
.portrait__tag {
  position: absolute;
  left: -22px;
  bottom: -18px;
  z-index: 2;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}
.portrait__tag strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.portrait__tag span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-1);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-2);
}
.scroll-cue .mono { font-size: 0.66rem; }
.scroll-cue__line {
  position: relative;
  width: 1px;
  height: 46px;
  background: var(--line-strong);
  overflow: hidden;
}
.scroll-cue__line::after {
  content: '';
  position: absolute;
  left: 0;
  top: -40%;
  width: 100%;
  height: 40%;
  background: var(--accent);
  animation: cue 1.8s var(--ease) infinite;
}
@keyframes cue { to { top: 100%; } }

/* Short laptop screens: tighten the hero so the ticker peeks above the fold */
@media (min-width: 861px) and (max-height: 760px) {
  .hero { padding: calc(var(--nav-h) + 28px) 0 72px; min-height: calc(100svh - 56px); }
  .hero__title { font-size: clamp(3.4rem, 7.4vw, 5.75rem); margin-bottom: 24px; }
  .eyebrow { margin-bottom: 22px; }
  .hero__text { margin-bottom: 28px; }
  .hero__media { width: min(100%, 380px); }
  .scroll-cue { display: none; }
}

/* Ticker ---------------------------------------------------------------- */

.ticker {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: 16px 0;
  background: var(--bg-1);
}
/* No gap on the track: the trailing padding on each item keeps both halves
   identical, so translateX(-50%) loops without a skip. */
.ticker__track {
  display: flex;
  width: max-content;
  animation: ticker 48s linear infinite;
}
.ticker__item {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 40px;
  padding-right: 40px;
  white-space: nowrap;
}
.ticker__item::after {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: rotate(45deg);
}
@keyframes ticker { to { transform: translateX(-50%); } }

/* Sections -------------------------------------------------------------- */

.section {
  position: relative;
  padding: clamp(84px, 10vw, 140px) 0;
}
.section + .section { border-top: 1px solid var(--line); }

/* Grid, not wrapping flex: the lede always gets its own row under the title,
   whatever the title's width. */
.section__head {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 20px;
  align-items: baseline;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.section__num { color: var(--accent); }
.section__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  letter-spacing: -0.025em;
  line-height: 1;
}
.section__lede {
  grid-column: 1 / -1;
  color: var(--text-1);
  max-width: 62ch;
  margin-top: 14px;
  text-wrap: pretty;
}

/* About ----------------------------------------------------------------- */

.about__grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.statement {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 3.4vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.statement em { font-style: normal; color: var(--accent); white-space: nowrap; }
.about__body { color: var(--text-1); display: flex; flex-direction: column; gap: 18px; }
.about__body p { text-wrap: pretty; }
.about__body strong { color: var(--text-0); font-weight: 500; }

/* minmax(0, ...) tracks stay put while the counters animate; the first cell
   is wider because it holds the longest number. */
.stats {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: clamp(48px, 6vw, 84px);
}
.stats li {
  background: var(--bg-1);
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stats__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 3.2vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.stats__label { color: var(--text-1); font-size: 0.92rem; line-height: 1.45; text-wrap: balance; }

/* Experience ------------------------------------------------------------ */

.timeline { display: flex; flex-direction: column; gap: clamp(48px, 6vw, 80px); }

.job {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: clamp(24px, 4vw, 64px);
}
.job__side {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  align-self: start;
}
.job__org {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin-bottom: 12px;
}
.job__meta { color: var(--text-1); line-height: 1.9; }
.job__tag {
  display: inline-block;
  margin-top: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
}

.job__photo {
  margin-top: 34px;
  width: 196px;
  transform: rotate(-3deg);
  background: var(--bg-2);
  padding: 10px 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}
.job__photo img { border-radius: 3px; width: 100%; }
.job__photo figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-1);
}

.job__main {
  border-left: 1px solid var(--line);
  padding-left: clamp(24px, 3vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 44px;
}
.role { position: relative; }
.role::before {
  content: '';
  position: absolute;
  left: calc(-1 * clamp(24px, 3vw, 40px) - 5px);
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--bg-0);
}
.role__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.role__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.role__period { color: var(--text-2); }
.role__points { display: flex; flex-direction: column; gap: 10px; color: var(--text-1); }
.role__points li { position: relative; padding-left: 22px; }
.role__points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 9px;
  height: 1px;
  background: var(--accent);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  color: var(--text-0);
  background: var(--bg-1);
}
.chips__label {
  width: 100%;
  color: var(--text-2);
  margin-bottom: -2px;
}

/* Projects: 3D carousel ------------------------------------------------- */

/* clip, not hidden: hidden makes a scroll container, which the browser
   scrolls sideways to reveal a focused off-screen card. */
.projects { overflow: hidden; overflow: clip; }
/* Anchor jumps land with the title just under the nav so the card and its
   controls fit on screen. */
#projects { scroll-margin-top: calc(32px - clamp(84px, 10vw, 140px)); }
.projects .section__head { margin-bottom: 20px; }
.project-bar {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(28px, 4vw, 44px);
}
.projects__counter { color: var(--text-1); min-width: 64px; text-align: center; }

.stage {
  position: relative;
  height: calc(var(--card-w) * 0.625 + 24px);
  perspective: 1800px;
  perspective-origin: 50% 50%;
  margin-bottom: 20px;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.stage:focus-visible { outline: none; }
/* The card's overflow + mask clip an outline, so draw the ring inside it */
.stage:focus-visible .card--0::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border: 2px solid var(--accent);
  border-radius: inherit;
  pointer-events: none;
}

/* Side cards sit behind the scene's z=0 plane, so the scene must not catch
   their clicks; each card opts back in (hidden cards opt out further down). */
.scene {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.card {
  position: absolute;
  top: 50%;
  left: 50%;
  pointer-events: auto;
  width: var(--card-w);
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  isolation: isolate;
  -webkit-mask-image: -webkit-radial-gradient(#fff, #000);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
  transition: transform 0.8s var(--ease), opacity 0.6s var(--ease);
  will-change: transform;
  backface-visibility: hidden;
}
.card img { -webkit-user-drag: none; pointer-events: none; }

.card--0    { transform: translate(-50%, -50%)  translateZ(0)      rotateY(0deg);   z-index: 5; }
.card--p1   { transform: translate(34%, -50%)   translateZ(-280px) rotateY(-30deg); z-index: 4; }
.card--n1   { transform: translate(-134%, -50%) translateZ(-280px) rotateY(30deg);  z-index: 4; }
.card--p2   { transform: translate(96%, -50%)   translateZ(-640px) rotateY(-42deg); z-index: 3; }
.card--n2   { transform: translate(-196%, -50%) translateZ(-640px) rotateY(42deg);  z-index: 3; }
.card--pfar { transform: translate(150%, -50%)  translateZ(-900px) rotateY(-48deg); z-index: 2; opacity: 0; pointer-events: none; }
.card--nfar { transform: translate(-250%, -50%) translateZ(-900px) rotateY(48deg);  z-index: 2; opacity: 0; pointer-events: none; }

/* Dim everything except the active card */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(10, 11, 13, 0.58);
  transition: opacity 0.6s var(--ease);
  pointer-events: none;
}
.card--0::after { opacity: 0; }

.card__hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  cursor: pointer;
}

/* Media viewer inside a card */
.media { position: absolute; inset: 0; }
.media__track {
  display: flex;
  height: 100%;
  transition: transform 0.55s var(--ease);
}
.slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  background: var(--bg-3);
  overflow: hidden;
}
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slide--contain img { object-fit: contain; background: var(--bg-2); }
.slide__frame { position: absolute; inset: 0; }
.slide__frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Bottom-left so it does not sit on the poster's centered wordmark */
.play {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: 2;
  transition: transform 0.15s var(--ease);
}
.play svg { width: 28px; height: 28px; margin-left: 4px; }
.play:active { transform: scale(0.95); }
.slide.is-playing .play,
.slide.is-playing .slide__poster { display: none; }
/* .play stacks above the dim layer, so hide it on side cards */
.card:not(.card--0) .play { visibility: hidden; }

.media__ui {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.card--0 .media__ui { opacity: 1; }
.card--0 .media__ui > * { pointer-events: auto; }
.media--single .media__arrow,
.media--single .media__dots,
/* The dots already show position; a corner counter covered each site's logo */
.media__count { display: none; }

.media__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10, 11, 13, 0.74);
  border: 1px solid var(--line-strong);
  color: var(--text-0);
  display: grid;
  place-items: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 0.15s var(--ease);
}
.media__arrow--prev { left: 14px; }
.media__arrow--next { right: 14px; }
.media__arrow:active { transform: translateY(-50%) scale(0.94); }
.media__arrow svg { width: 16px; height: 16px; }

.media__dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.74);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.media__dot {
  width: 7px;
  height: 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.35);
  transition: width 0.3s var(--ease), background 0.3s;
}
.media__dot.is-active { background: var(--accent); width: 20px; }
/* Larger invisible hit area than the 7px pill */
.media__dot { position: relative; }
.media__dot::before { content: ''; position: absolute; inset: -10px -3px; }

.media__count {
  position: absolute;
  top: 14px;
  left: 14px;
  color: var(--text-0);
  background: rgba(10, 11, 13, 0.74);
  padding: 7px 10px;
  border-radius: 8px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* Project details below the stage */
.project-details {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(28px, 5vw, 72px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease);
}
.project-details.is-swapping { opacity: 0; transform: translateY(10px); }

.project-details__meta {
  display: flex;
  gap: 6px 0;
  flex-wrap: wrap;
  color: var(--text-1);
  margin-bottom: 14px;
}
/* Trailing separator, so a wrapped line never starts with a slash */
.project-details__meta .mono:not(:last-child)::after {
  content: '/';
  margin: 0 14px;
  color: var(--text-2);
}
.project-details__meta .mono:first-child { color: var(--accent); }
.project-details__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 3.6vw, 2.8rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 18px;
  text-wrap: balance;
}
.project-details__desc { color: var(--text-1); display: flex; flex-direction: column; gap: 12px; }
.project-details__aside { display: flex; flex-direction: column; gap: 28px; }
.aside__label { color: var(--text-2); margin-bottom: 12px; display: block; }
.project-details__aside .chips { margin-top: 0; }

.links { display: flex; flex-wrap: wrap; gap: 10px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  transition: transform 0.15s var(--ease);
}
.link-btn svg { width: 14px; height: 14px; }
.link-btn:active { transform: scale(0.97); }
.link-btn--primary { background: var(--text-0); color: var(--bg-0); border-color: var(--text-0); }

/* position: relative so button.offsetLeft is measured from the strip when
   main.js centers the active item. */
.project-index {
  position: relative;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 24px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.project-index::-webkit-scrollbar { display: none; }
.project-index button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-1);
  font-size: 0.88rem;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 0.15s var(--ease);
}
.project-index button:active { transform: scale(0.97); }
.project-index button .mono { color: var(--text-2); font-size: 0.66rem; }
.project-index button.is-active {
  color: var(--text-0);
  background: var(--bg-1);
  border-color: var(--line-strong);
}
.project-index button.is-active .mono { color: var(--accent); }
/* The strip clips vertically, so keep the ring inside the button */
.project-index button:focus-visible { outline-offset: -2px; }

/* Skills ---------------------------------------------------------------- */

.skills__list { border-top: 1px solid var(--line); }
.skill-row {
  display: grid;
  grid-template-columns: 256px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.skill-row__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.25;
  padding-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
/* JetBrains Mono is only loaded at 400/500; avoid a synthesized bold */
.skill-row__label .mono { color: var(--text-2); font-size: 0.66rem; font-weight: 400; }
.skill-row .chips { margin-top: 0; }

/* Contact --------------------------------------------------------------- */

.contact { padding-top: clamp(64px, 7vw, 100px); }
.contact .section__head { margin-bottom: clamp(28px, 3.5vw, 44px); }
.contact__statement {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.2vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 15ch;
  margin-bottom: clamp(32px, 4vw, 48px);
  text-wrap: balance;
}
.contact__statement em { font-style: normal; color: var(--accent); display: block; }

.contact__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
/* Label and Copy share the top row so the value gets the full card width */
.contact-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label btn" "value value";
  gap: 10px 16px;
  align-items: center;
  align-content: start;
}
.contact-card__label { color: var(--text-2); grid-area: label; }
.contact-card > .btn { grid-area: btn; }
.contact-card__value {
  grid-area: value;
  justify-self: start;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.contact-card__value:focus-visible { outline-offset: 4px; }
.contact__links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.contact__links:empty { display: none; }

/* Footer ---------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 36px 0;
  color: var(--text-2);
  font-size: 0.88rem;
}
/* 1fr auto 1fr keeps the middle line truly centered */
.footer__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}
.footer__inner > :last-child { justify-self: end; }
.footer__top { color: var(--text-1); }

@media (max-width: 899px) {
  .footer__inner { grid-template-columns: 1fr auto; gap: 8px 16px; align-items: baseline; }
  .footer__inner > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .footer__top { grid-column: 2; grid-row: 1; padding: 12px 0; margin: -12px 0; }
}

/* Toast ----------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--text-0);
  color: var(--bg-0);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
  z-index: 200;
  white-space: nowrap;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Scroll reveal --------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.12s; }
.reveal[data-delay="2"] { transition-delay: 0.24s; }
.reveal[data-delay="3"] { transition-delay: 0.36s; }

/* Responsive ------------------------------------------------------------ */

@media (max-width: 1024px) {
  :root { --card-w: min(80vw, 860px, max(360px, calc(160vh - 560px))); }
  .hero__grid { grid-template-columns: 1fr 1fr; }
  .portrait__tag { left: -14px; padding: 10px 14px; }
  .portrait__tag strong { font-size: 1rem; }
  .job { grid-template-columns: 220px 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-row { grid-template-columns: 180px 1fr; }
}

@media (max-width: 860px) {
  .hero { min-height: 0; padding-top: calc(var(--nav-h) + 40px); }
  .hero__grid { grid-template-columns: minmax(0, 1fr); }
  .hero__media { justify-self: start; width: min(100%, 340px); margin-top: 24px; }
  .portrait__tag { left: auto; right: -12px; }
  .scroll-cue { display: none; }

  .about__grid,
  .project-details,
  .contact__cards { grid-template-columns: 1fr; }

  .job { grid-template-columns: 1fr; gap: 24px; }
  .job__side { position: static; }
  .job__photo { display: none; }
  .skill-row { grid-template-columns: 1fr; gap: 14px; padding: 22px 0; }

  .nav__name { display: none; }
  .nav__toggle { display: flex; }
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    background: var(--bg-0);
    flex-direction: column;
    align-items: flex-start;
    padding: 28px var(--gutter);
    gap: 4px;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    /* visibility keeps the closed menu's links out of the tab order */
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
    border-top: 1px solid var(--line);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .nav.is-open .nav__links { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
  .nav__links a[data-nav] {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 10px 0;
  }
  .nav__links a[data-nav].is-active::after { display: none; }
  .nav__links a[data-nav].is-active { color: var(--accent); }
  .nav__cta { margin: 24px 0 0; padding: 14px 24px; font-size: 0.95rem; }
  .nav.is-open .nav__toggle span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav.is-open .nav__toggle span:last-child { transform: translateY(-4px) rotate(-45deg); }
}

/* Phones in landscape: compact menu so every link fits */
@media (max-width: 860px) and (max-height: 500px) {
  .nav__links { padding-block: 8px; gap: 0; }
  .nav__links a[data-nav] { font-size: 1.25rem; padding: 4px 0; }
  .nav__cta { margin-top: 8px; }
}

@media (max-width: 640px) {
  :root { --card-w: min(86vw, calc(115vh - 140px)); }
  body { font-size: 16px; }
  .eyebrow { gap: 8px 12px; font-size: 0.72rem; }
  .eyebrow__sep { display: none; }
  .hero__title { font-size: clamp(2.4rem, 12.8vw, 3.4rem); }
  .hero__media { width: calc(100% - 28px); max-width: 320px; }
  /* Own line, so phrases of different lengths never reflow the hero */
  .rotator { display: block; }
  .section__head { grid-template-columns: 1fr; row-gap: 10px; }
  .section__title { font-size: min(2.3rem, 9.5vw); }
  .role__head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .card--p1 { transform: translate(52%, -50%)  translateZ(-220px) rotateY(-26deg); }
  .card--n1 { transform: translate(-152%, -50%) translateZ(-220px) rotateY(26deg); }
  .card--p2, .card--n2 { opacity: 0; pointer-events: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li { padding: 18px 14px; }
  .stats li:first-child,
  .stats li:last-child { grid-column: 1 / -1; }
  .stats__num { font-size: clamp(1.5rem, 7.4vw, 2.9rem); letter-spacing: -0.02em; }
  .play { left: 14px; bottom: 14px; width: 52px; height: 52px; }
  .play svg { width: 20px; height: 20px; margin-left: 3px; }
  .media__arrow { width: 38px; height: 38px; }
  .project-bar { grid-template-columns: auto 1fr auto; gap: 10px; }
  .project-index { grid-column: 1 / -1; order: 1; padding: 2px 16px; }
  .project-details__meta { flex-direction: column; gap: 6px; }
  .project-details__meta .mono:not(:last-child)::after { content: none; }
  .contact-card { padding: 22px; }
  .contact-card__value { font-size: clamp(1rem, 4.6vw, 1.4rem); }
}

/* Reduced motion -------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .ticker__track { animation: none; }
  .status__dot { animation: none; }
  .scroll-cue__line::after { animation: none; }
  .card, .media__track, .project-details { transition: none; }
  .rotator.is-out span, .rotator.is-in span { animation: none; }
}
