/* ==========================================================
   Extensions: marquee, scrolly experience, helix, font updates
   ========================================================== */

/* Add Reckless + Canela alternatives via Instrument/Fraunces/Playfair already imported.
   We also add Domine and Cormorant for more serif variety via Google Fonts. */

/* ===== Marquee band ===== */
.marquee-band {
  position: relative;
  overflow: hidden;
  padding: 18px 0;
  border-top: 1px solid var(--hairline-dark);
  border-bottom: 1px solid var(--hairline-dark);
  background: var(--bg-dark);
  z-index: 2;
}
body.on-light .marquee-band {
  background: var(--bg-light);
  border-color: var(--hairline-light);
}
.marquee-track {
  display: inline-flex;
  gap: 36px;
  white-space: nowrap;
  animation: marquee 40s linear infinite;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(38px, 6vw, 68px);
  letter-spacing: -0.02em;
  opacity: 0.9;
  padding-left: 36px;
}
.marquee-track span {
  flex-shrink: 0;
  line-height: 1;
}
.marquee-track span:nth-child(even) {
  color: var(--accent);
  font-style: normal;
  opacity: 0.7;
  font-size: 0.7em;
  align-self: center;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-33.333%); }
}
[data-fx="minimal"] .marquee-track { animation-duration: 60s; }

/* ===== Experience — scrolly pinned ===== */
section.exp-scrolly {
  background: var(--bg-light);
  color: var(--fg-dark);
}
.exp-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(90px, 14vh, 140px) clamp(20px, 5vw, 64px) 40px;
  overflow: hidden;
}

.exp-header {
  display: grid; grid-template-columns: 1fr auto; gap: 40px;
  align-items: end;
}
@media (max-width: 720px) { .exp-header { grid-template-columns: 1fr; } }

.exp-stage {
  display: grid;
  grid-template-columns: 220px 1fr 100px;
  gap: clamp(24px, 4vw, 64px);
  flex: 1;
  align-items: center;
  min-height: 0;
  position: relative;
  padding: 40px 0;
}
@media (max-width: 900px) {
  .exp-stage { grid-template-columns: 100px 1fr 0; gap: 20px; }
}
@media (max-width: 640px) {
  .exp-stage { grid-template-columns: 18px 1fr; gap: 18px; }
}

/* ===== DNA helix ===== */
.exp-helix {
  position: relative;
  height: 100%;
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
}
.helix {
  position: relative;
  width: 160px;
  height: 100%;
  transform-style: preserve-3d;
  perspective: 900px;
}
.helix-rung {
  position: absolute;
  top: calc(var(--i) / var(--n) * 100%);
  left: 0; right: 0;
  height: 8px;
  display: flex; align-items: center; justify-content: space-between;
  transform: rotateY(calc((var(--i) / var(--n) * 720deg) + (var(--helix-progress, 0) * 1080deg)));
  transform-style: preserve-3d;
  transition: transform 200ms linear;
}
.helix-node {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px oklch(0.78 0.13 var(--accent-h) / 0.6);
  flex-shrink: 0;
}
.helix-node.b { background: var(--fg-dark); opacity: 0.85; box-shadow: none; }
.helix-bar {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), rgba(10,10,10,0.4));
  opacity: 0.55;
  margin: 0 4px;
}

@media (max-width: 720px) {
  /* Replace the 3D rotating helix with a simple vertical progress bar on mobile
     to avoid the rotating rungs overlapping the experience text */
  .helix {
    width: 4px;
    height: 100%;
    perspective: none;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
  }
  .helix-rung { display: none; }
  .helix::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0;
    height: calc(var(--helix-progress, 0) * 100%);
    background: linear-gradient(to bottom, var(--accent), color-mix(in oklab, var(--accent) 40%, transparent));
    transition: height 200ms linear;
  }
}
@media (max-width: 640px) {
  .helix { width: 3px; }
}

/* ===== Experience cards (stacked, fade between) ===== */
.exp-cards {
  position: relative;
  height: 100%;
  min-height: 320px;
}
.exp-card {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(40px) scale(0.85);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  pointer-events: none;
  justify-content: center;
  filter: blur(6px);
}
.exp-card.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  filter: blur(0);
  z-index: 3;
}
.exp-card.prev {
  opacity: 0.35;
  transform: translateY(-42%) scale(0.58);
  filter: blur(1.5px);
  z-index: 2;
}
.exp-card.next {
  opacity: 0.35;
  transform: translateY(42%) scale(0.58);
  filter: blur(1.5px);
  z-index: 2;
}
.exp-card.far-prev {
  opacity: 0;
  transform: translateY(-80%) scale(0.4);
}
.exp-card.far-next {
  opacity: 0;
  transform: translateY(80%) scale(0.4);
}
/* Shrink meta text in prev/next previews */
.exp-card.prev .exp-card-desc,
.exp-card.next .exp-card-desc { display: none; }
.exp-card.prev .exp-card-date,
.exp-card.next .exp-card-date { opacity: 0.7; }

.exp-card-date {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.55;
  display: flex; align-items: center; gap: 10px;
}
.exp-card-dot {
  color: var(--accent);
  font-size: 10px;
  animation: pulse 2s infinite;
}
.exp-card-role {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6.5vw, 84px);
  line-height: 1;
  font-style: italic;
  letter-spacing: -0.02em;
}
.exp-card-company {
  font-family: var(--font-sans);
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 500;
  opacity: 0.75;
  margin-top: 2px;
}
.exp-card-desc {
  font-family: var(--font-sans);
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.55;
  opacity: 0.78;
  max-width: 54ch;
  margin-top: 12px;
  white-space: pre-line;
}

/* ===== Tick progress ===== */
.exp-progress {
  display: flex; flex-direction: column;
  gap: 14px;
  height: 100%;
  justify-content: center;
  padding-left: 20px;
  border-left: 1px solid var(--hairline-light);
}
@media (max-width: 900px) { .exp-progress { display: none; } }

.exp-tick {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  opacity: 0.4;
  transition: opacity 300ms, color 300ms;
}
.exp-tick-line {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
  transition: opacity 300ms, background 300ms;
}
.exp-tick.active {
  opacity: 1;
  color: var(--accent);
}
.exp-tick.active .exp-tick-line { background: var(--accent); opacity: 1; }
.exp-tick.past { opacity: 0.7; }

/* ===== Footer inside experience ===== */
.exp-footer {
  padding: 24px 0 0;
  border-top: 1px solid var(--hairline-light);
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* Show full desc on desktop, short desc on mobile */
.exp-card-desc-mobile { display: none; }

@media (max-width: 720px) {
  .exp-sticky { padding-top: 110px; padding-bottom: 24px; }
  .exp-card-role { font-size: clamp(32px, 9vw, 52px); }
  .exp-footer { font-size: 10px; }
  /* Keep prev/next previews visible on mobile — text is shorter so they fit */
  .exp-card-desc-full { display: none; }
  .exp-card-desc-mobile { display: block; }
  /* Give more width to text, less to the DNA bar on mobile */
  .exp-stage { grid-template-columns: 18px 1fr !important; gap: 18px !important; }
  .exp-footer > div { flex-basis: 100%; }
}

/* ===== Hide old experience styles ===== */
.exp-list, .exp-item { display: none !important; }
