/* ============================================================
   Statement stages — scroll morph of a centered title + amber
   hairlines into About / Work. Shared .statement-* language;
   Curiosity keeps photo enter, Work rises the 3 cards.
   Sticky 100vh pin inside ~215–230vh runway.
   Transform/opacity only; title FLIP-measured against its slot.
   ============================================================ */

.statement-stage {
  position: relative;
  height: 323vh;
  background: #0e0e0e;
}

@media (min-width: 769px) {
  .statement-stage { height: 342vh; }
}

.statement-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: #0e0e0e;
}

/* Fill the sticky viewport; first paint is type-only on #0e0e0e */
.statement-pin .section-fullscreen {
  height: 100%;
  min-height: 0;
  padding: 5.5rem 0 3rem;
  box-sizing: border-box;
  align-items: center;
}

.statement-pin .section-fullscreen > .container {
  width: 100%;
}

.curiosity-pin .about-layout {
  margin-top: 0;
}

.curiosity-pin .about-text {
  overflow: visible;
}

/* Slot is the untransformed end box (text-sized, not column-stretched) */
.statement-slot {
  margin-bottom: 0;
  position: relative;
  width: max-content;
  max-width: 100%;
  z-index: 2;
  text-align: left;
}

.statement-block {
  display: inline-block;
  position: relative;
  max-width: 100%;
  color: #f2f2f2;
  text-align: left;
  /* Hard <br> line breaks — avoid text-wrap:balance unwrapping mid-FLIP */
  text-wrap: wrap;
  transform-origin: 0 0;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  --draw: 0;
  --rule-opacity: 1;
  --mark-opacity: 0;
}

/* ── Amber hairlines: typographic title-block, not CAD ── */
.statement-rule {
  position: absolute;
  left: 50%;
  width: 105%;
  max-width: none;
  height: 10px;
  transform: translateX(-50%);
  /* Invisible until the hair actually draws — otherwise the two ticks
     sit stacked at center as yellow vertical marks. */
  opacity: calc(var(--rule-opacity, 1) * min(1, var(--draw, 0) * 50));
  pointer-events: none;
  z-index: 3;
}

.statement-rule--top { bottom: calc(100% + 0.42em); }
.statement-rule--bot { top: calc(100% + 0.42em); }

.statement-hair {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: #E8A020;
  transform: scaleX(var(--draw, 0));
  transform-origin: center center;
  will-change: transform;
}

.statement-tick {
  position: absolute;
  top: 50%;
  width: 1px;
  height: 7px;
  background: #E8A020;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 1;
}

.statement-tick--l {
  left: calc(50% * (1 - var(--draw, 0)));
}

.statement-tick--r {
  left: calc(50% + 50% * var(--draw, 0));
}

.statement-rule-label {
  display: none;
}

/* First paint: bio, chips, label, photo, cards hidden — no flash */
.curiosity-label,
.curiosity-bio,
.curiosity-chips,
.curiosity-img-wrap,
.work-label,
.work-stage .work-card {
  opacity: 0;
}

.curiosity-bio,
.curiosity-chips,
.curiosity-label,
.work-label,
.work-stage .work-card {
  will-change: opacity, transform;
}

.curiosity-img-wrap {
  will-change: opacity;
  z-index: 1;
}

.curiosity-image {
  will-change: transform;
  transform: translate3d(22%, 0, 0);
  backface-visibility: hidden;
}

.work-pin .work-grid-home {
  margin-top: 3rem;
  position: relative;
  z-index: 1;
  /* Hide the 1px grid border while cards are opacity 0 or the empty box shows. */
  border-color: transparent;
}
.work-stage.is-docked .work-grid-home {
  border-color: var(--border);
}

@media (max-width: 768px) {
  .statement-pin .section-fullscreen {
    padding: 5.75rem 0 1.5rem;
    align-items: stretch;
  }

  .curiosity-pin .curiosity-about > .container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  .curiosity-pin .about-layout {
    min-height: 0;
    flex: 1 1 auto;
    display: grid;
    grid-template-rows: 1fr;
  }

  .curiosity-pin .about-text {
    gap: 1.15rem;
  }

  /* Stacked layout: hide CoPilot rather than crop it under the bio. */
  .curiosity-pin .about-img-wrap {
    display: none;
  }

  /* Two-line title so start type can fill the viewport width */
  .curiosity-title-slot {
    max-width: min(100%, 8em);
  }

  .curiosity-image {
    transform: translate3d(0, 28%, 0);
  }

  /* Long work title wraps 2–3 lines; slot stays that wrap for FLIP */
  .work-title-slot {
    max-width: min(100%, 13em);
  }

  .work-pin .work-panel.section-fullscreen {
    display: flex;
    flex-direction: column;
  }

  .work-pin .work-panel > .container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    justify-content: flex-start;
  }

  /* Share leftover viewport so 3 stacked cards fit under the nav */
  .work-pin .work-grid-home {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    margin-top: 0.85rem;
    flex: 1 1 auto;
    min-height: 0;
  }

  .work-pin .work-card {
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
    padding: 0.85rem 1rem;
    gap: 0.4rem;
    cursor: pointer;
  }

  .work-pin .work-card h3 {
    font-size: 1rem;
    padding-right: 1.5rem;
    position: relative;
  }

  .work-pin .work-card h3::after {
    content: '+';
    position: absolute;
    right: 0;
    top: 0;
    color: #E8A020;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1;
  }

  .work-pin .work-card.is-open h3::after {
    content: '\2212';
  }

  .work-pin .work-card-tag,
  .work-pin .work-card p,
  .work-pin .work-card-mid-img {
    display: none;
  }

  .work-pin .work-card.is-open .work-card-tag {
    display: inline-block;
  }

  .work-pin .work-card.is-open p {
    display: block;
    font-size: 0.78rem;
    line-height: 1.4;
    flex: 0 1 auto;
  }

  .work-pin .work-card.is-open .work-card-mid-img {
    display: block;
    height: auto;
    max-height: 140px;
    width: 100%;
    object-fit: cover;
    margin: 0.15rem 0;
  }

  .work-pin .work-card-link {
    pointer-events: auto;
  }
}

@media (max-width: 768px) {
  .work-pin {
    overflow-y: auto;
  }
}

@media (min-width: 769px) {
  /* Match the locked <br> breaks so docked type aligns with bio/cards */
  .curiosity-title-slot {
    max-width: min(100%, 8.5em);
  }
  .work-title-slot {
    max-width: min(100%, 14.5em);
  }
}

.statement-stage.is-pinching .statement-slot {
  z-index: 2;
}

.statement-stage.is-pinching .curiosity-img-wrap {
  z-index: 1;
}

/* Docked: identity — matches today’s static about / work */
.statement-stage.is-docked .statement-block {
  transform: none;
  will-change: auto;
  --draw: 0;
  --rule-opacity: 0;
  --mark-opacity: 0;
}

.statement-stage.is-docked .statement-rule {
  opacity: 0;
  visibility: hidden;
}

.statement-stage.is-docked .curiosity-label,
.statement-stage.is-docked .curiosity-bio,
.statement-stage.is-docked .curiosity-chips,
.statement-stage.is-docked .curiosity-img-wrap,
.statement-stage.is-docked .work-label,
.statement-stage.is-docked .work-card {
  opacity: 1;
  transform: none;
  will-change: auto;
}

.statement-stage.is-docked .curiosity-image {
  transform: none;
  will-change: auto;
}

/* ── Reduced motion: no pin, today’s static layout ─────────── */
@media (prefers-reduced-motion: reduce) {
  .statement-stage {
    height: auto;
  }

  .statement-pin {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .statement-pin .section-fullscreen {
    height: auto;
    min-height: 100vh;
    padding: var(--section-gap) 0;
    align-items: center;
  }

  .curiosity-pin .about-layout {
    margin-top: 2.5rem;
  }

  .statement-block {
    transform: none !important;
    will-change: auto;
    --draw: 0 !important;
    --rule-opacity: 0 !important;
    --mark-opacity: 0 !important;
  }

  .statement-rule {
    display: none !important;
  }

  .curiosity-label,
  .curiosity-bio,
  .curiosity-chips,
  .curiosity-img-wrap,
  .work-label,
  .work-stage .work-card {
    opacity: 1 !important;
    transform: none !important;
    will-change: auto;
  }

  .curiosity-image {
    transform: none !important;
    will-change: auto;
  }

  .work-pin .work-card p {
    display: block;
    -webkit-line-clamp: unset;
  }
}
