/* About page: pinned story scrollytelling panel. Mobile-first: base rules
   are the stacked fallback (also used for prefers-reduced-motion at any
   width via .story-static); the >=900px block layers on the pinned
   image-column + paging-window carousel that GSAP ScrollTrigger drives. */
.story {
  margin: 0 clamp(1.25rem, 5vw, 5rem) clamp(5rem, 10vh, 8rem);
}

.story-stage {
  border: 1px solid color-mix(in srgb, var(--sh-bone) 16%, transparent);
  border-radius: 14px;
  overflow: clip;
  background: var(--sh-ink-2);
}

.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid color-mix(in srgb, var(--sh-bone) 12%, transparent);
}

.story-head-file {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.story-head .dots {
  display: flex;
  gap: 6px;
}

.story-head .dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sh-bone) 25%, transparent);
}

.story-head .dots span:first-child {
  background: var(--sh-orange);
}

.story-head .file {
  font-family: var(--sh-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--sh-taupe);
}

.story-hint {
  font-family: var(--sh-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  color: var(--sh-orange);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.story-hint.show { opacity: 1; }

.story-image-frame { display: none; }

.story-card-img {
  margin-bottom: 1.5rem;
  border-radius: 8px;
  overflow: hidden;
}

.story-card-img img {
  display: block;
  width: 100%;
  height: auto;
}

.story-window { position: relative; }

.story-track {
  display: flex;
  flex-direction: column;
}

.story-card {
  padding: clamp(2.5rem, 6vh, 4rem) clamp(1.25rem, 3vw, 2.5rem);
  border-bottom: 1px solid color-mix(in srgb, var(--sh-bone) 10%, transparent);
}

.story-card:last-child { border-bottom: 0; }

.story-card .meta {
  display: flex;
  gap: 1.25rem;
  font-family: var(--sh-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sh-taupe);
  margin-bottom: 0.9rem;
}

.story-card .meta .y { color: var(--sh-orange); }

.story-card h2 {
  font-family: var(--sh-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--sh-bone);
  margin-bottom: 0.9rem;
}

.story-card p {
  color: color-mix(in srgb, var(--sh-bone) 72%, var(--sh-taupe));
  line-height: 1.65;
  max-width: 52ch;
}

.story-progress { display: none; }

.story-tabs { display: none; }

@media (min-width: 900px) {
  .story {
    position: relative;
    /* No explicit height here on purpose. #storyStage (not .story) is now
       both the ScrollTrigger trigger AND the pin target — GSAP inserts its
       own pin-spacer sized to (stage's natural height + the JS-computed
       scroll distance) and .story, having no declared height of its own,
       simply auto-sizes to wrap that spacer exactly. Two independently
       authored distances (a CSS height here + a JS "bottom bottom" read of
       a *different* wrapper element) is what produced the dead scroll
       space after the last card before — don't reintroduce a height here. */
  }

  .story-stage {
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .story-head { flex: 0 0 auto; }

  .story-main {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 0;
  }

  .story-image-frame {
    display: block;
    position: relative;
    border-right: 1px solid color-mix(in srgb, var(--sh-bone) 12%, transparent);
    overflow: hidden;
    background: var(--sh-ink);
  }

  .story-still {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
  }

  .story-still.on { opacity: 1; }

  .story-still img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
  }

  /* sharp foreground copy: shows the whole (square) source image uncropped */
  .story-still img.fg {
    object-fit: contain;
    transform: scale(1.04);
  }

  .story-still.on img.fg { transform: scale(1); }

  /* blurred backdrop fills the non-square frame instead of flat black bars */
  .story-still img.bg {
    object-fit: cover;
    filter: blur(28px) brightness(0.55);
    transform: scale(1.15);
  }

  .story-still-tag {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 2;
    font-family: var(--sh-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sh-orange);
    background: color-mix(in srgb, var(--sh-ink) 78%, transparent);
    border: 1px solid color-mix(in srgb, var(--sh-orange) 55%, transparent);
    border-radius: 4px;
    padding: 0.25rem 0.6rem;
  }

  .story-still-cap {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 2;
    font-family: var(--sh-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sh-bone);
  }

  .story-window {
    position: relative;
    height: 100%;
  }

  .story-track {
    position: relative;
    height: 100%;
  }

  /* one card at a time, stacked and crossfaded — same mechanism as
     .story-still, so there's no track-height/translateY math to keep in
     sync with the pin's scroll distance */
  .story-card {
    position: absolute;
    inset: 0;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    border-bottom: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
  }

  .story-card.on {
    opacity: 1;
    pointer-events: auto;
  }

  .story-card-img { display: none; }

  .story-progress {
    display: block;
    flex: 0 0 auto;
    height: 3px;
    background: color-mix(in srgb, var(--sh-bone) 12%, transparent);
  }

  .story-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--sh-orange);
  }

  .story-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    padding: 0.9rem 1rem 1.1rem;
    border-top: 1px solid color-mix(in srgb, var(--sh-bone) 12%, transparent);
    background: var(--sh-ink);
  }

  .story-tab {
    flex: 1;
    border-radius: 6px;
    background: color-mix(in srgb, var(--sh-bone) 88%, var(--sh-orange));
    color: var(--sh-ink);
    font-family: var(--sh-mono);
    font-size: 0.575rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.7rem 0.4rem;
    border: 0;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
  }

  .story-tab:hover { transform: translateY(-2px); }

  .story-tab.on {
    background: var(--sh-orange);
    color: var(--sh-ink);
  }

  /* prefers-reduced-motion fallback: force the mobile stacked layout even
     at desktop widths (JS never creates the ScrollTrigger when this class
     is present, so nothing here needs to fight a running pin) */
  .story.story-static {
    height: auto;
  }

  .story.story-static .story-stage {
    height: auto;
    display: block;
  }

  .story.story-static .story-main { display: block; }

  .story.story-static .story-image-frame,
  .story.story-static .story-progress,
  .story.story-static .story-tabs,
  .story.story-static .story-hint {
    display: none;
  }

  .story.story-static .story-window { height: auto; overflow: visible; }

  .story.story-static .story-track { display: block; }

  .story.story-static .story-card { height: auto; display: block; }

  .story.story-static .story-card-img { display: block; }
}

/* ================= ABOUT HERO ================= */
.ah-hero {
  position: relative;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
  background: var(--sh-ink);
}

/* ---- ONE massive line, vertically centered, bleeding off both sides ---- */
.ah-title {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -54%;
  z-index: 10;
  font-family: "Archivo", sans-serif;
  font-weight: 900;
  /* sized for the longer "hamza_story.prproj" string — still bleeds off both sides a touch, but stays readable */
  font-size: clamp(52px, 9vw, 210px);
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--sh-bone);
  user-select: none;
  pointer-events: none;
  /* entrance (transform) + ambient drift (translate, the individual
     property) run on separate properties so they compose instead of
     fighting — same trick used for the per-letter float below */
  animation:
    ah-title-enter 1.3s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    ah-title-drift 14s ease-in-out 1.3s infinite alternate;
}
/* slides in from the right once on load */
@keyframes ah-title-enter {
  from { transform: translateX(14vw); }
  to { transform: translateX(0); }
}
/* slow ambient sway afterward, layered on top of the -50%/-54% centering */
@keyframes ah-title-drift {
  from { translate: -50% -54%; }
  to { translate: calc(-50% - 3vw) -54%; }
}
.ah-title .accent { color: var(--sh-orange); }

/* ---- per-letter animation (set up by JS) ---- */
.ah-title .ltr {
  display: inline-block;
  /* entrance: rise from below, staggered via --i */
  opacity: 0;
  transform: translateY(0.35em);
  animation:
    ah-ltr-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards,
    ah-ltr-float 5.5s ease-in-out infinite;
  animation-delay:
    calc(0.15s + var(--i) * 0.045s),                 /* entrance stagger */
    calc(1.1s + var(--i) * 0.35s);                   /* float phase offset */
}
@keyframes ah-ltr-in {
  to { opacity: 1; transform: translateY(0); }
}
/* buoyant drift: tiny rise + tilt, out of sync per letter */
@keyframes ah-ltr-float {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  50% { translate: 0 -0.045em; rotate: 0.6deg; }
}
@media (prefers-reduced-motion: reduce) {
  .ah-title {
    animation: none;
  }
  .ah-title .ltr {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ============ COLLAGE ITEMS ============ */
/* RULES that keep it clean:
   - only .ah-puffy overlaps the headline (z:20)
   - everything else lives in the clear bands ABOVE and BELOW the headline (z:5)
   - small sizes, generous spacing, max ±6deg rotation */
.ah-item {
  position: absolute;
  will-change: transform;
  cursor: grab;
  user-select: none;
  z-index: 5;
}
.ah-item:active { cursor: grabbing; }
.ah-item.front { z-index: 20; }

/* polaroids — smaller, warm placeholder instead of dark blobs */
.ah-polaroid {
  background: var(--sh-bone);
  padding: 6px 6px 20px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
.ah-polaroid .ph {
  width: clamp(90px, 9.5vw, 150px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: linear-gradient(160deg, #e8d9c4 0%, #d9c5a8 55%, #cdb391 100%);
  position: relative;
}
/* subtle "empty frame" mark so placeholders look intentional, not broken */
.ah-polaroid .ph::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(22, 17, 16, 0.18);
  font-size: 26px;
}
.ah-polaroid .ph img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ah-polaroid .cap {
  font-family: var(--sh-mono);
  font-size: 8px;
  color: #4a3f37;
  letter-spacing: 0.14em;
  margin-top: 7px;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

/* timecode tag */
.ah-tc {
  background: var(--sh-panel);
  border: 1px solid rgba(239, 230, 218, 0.12);
  padding: 7px 12px;
  font-size: clamp(8px, 0.9vw, 11px);
  letter-spacing: 0.14em;
  color: var(--sh-taupe);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.ah-tc b { color: var(--sh-orange-hot); font-weight: 500; }

/* editor icons — small accents, not competitors */
.ah-icon {
  width: clamp(36px, 4vw, 62px);
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.4));
  animation: ah-float 6s ease-in-out infinite;
}
.ah-icon svg { width: 100%; height: 100%; overflow: visible; display: block; }
.ah-icon svg * { transform-origin: center; transform-box: fill-box; }
@keyframes ah-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}
.ah-icon:hover svg { animation: ah-wiggle 0.5s ease; }
@keyframes ah-wiggle {
  25% { transform: rotate(-8deg) scale(1.1); }
  70% { transform: rotate(5deg); }
  100% { transform: rotate(0); }
}

/* the ONE element allowed on top of the headline */
.ah-puffy {
  width: clamp(72px, 8vw, 118px);
  aspect-ratio: 1;
  filter: drop-shadow(0 14px 30px rgba(255, 90, 31, 0.35));
  animation: ah-float 7s ease-in-out infinite;
}

/* uploaded stickers */
.ah-sticker {
  width: clamp(80px, 8.5vw, 130px);
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 4px solid var(--sh-bone);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
  background: var(--sh-panel);
  position: relative;
}
.ah-sticker img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ah-sticker .peel {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sh-orange);
  color: var(--sh-ink);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}
.ah-sticker:hover .peel { opacity: 1; }
@keyframes ah-pop {
  0% { scale: 0; rotate: -25deg; }
  70% { scale: 1.12; }
  100% { scale: 1; rotate: 0deg; }
}
.ah-item.pop { animation: ah-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }

/* ---- chrome: eyebrow / button / scroll ---- */
.ah-eyebrow {
  position: absolute;
  /* +5rem clears the fixed .sh-nav bar (~68px tall) sitting on top of this hero */
  top: calc(5.5vh + 5rem);
  left: 5vw;
  z-index: 30;
  font-size: clamp(8px, 0.95vw, 12px);
  letter-spacing: 0.32em;
  color: var(--sh-taupe);
  white-space: nowrap;
}
.ah-eyebrow b { color: var(--sh-orange); font-weight: 500; }

.ah-add {
  position: absolute;
  right: 5vw;
  bottom: 6.5vh;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--sh-orange-hot), var(--sh-orange));
  color: var(--sh-ink);
  font-family: var(--sh-mono);
  font-weight: 700;
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: 0.1em;
  padding: 14px 24px;
  border: none;
  border-radius: 999px;
  rotate: -3deg;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(255, 90, 31, 0.35);
  transition: rotate 0.3s cubic-bezier(0.3, 1.8, 0.5, 1), scale 0.3s;
}
.ah-add:hover { rotate: 2deg; scale: 1.05; }
.ah-add .plus {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--sh-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}
.ah-add:focus-visible { outline: 2px solid var(--sh-bone); outline-offset: 3px; }

.ah-scroll {
  position: absolute;
  bottom: 5vh;
  left: 5vw;
  z-index: 30;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--sh-taupe);
  animation: ah-blink 2.2s ease-in-out infinite;
}
@keyframes ah-blink { 50% { opacity: 0.35; } }

/* ---- sticker upload popup: drag-and-drop or select ---- */
.ah-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.ah-modal[hidden] { display: none; }

.ah-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 13, 11, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ah-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--sh-panel);
  border: 1px solid rgba(239, 230, 218, 0.14);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
}

.ah-modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(239, 230, 218, 0.2);
  background: none;
  color: var(--sh-bone);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.ah-modal-close:hover { border-color: var(--sh-orange); color: var(--sh-orange); }

.ah-modal-title {
  font-family: var(--sh-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--sh-taupe);
  margin-bottom: 1.25rem;
}

.ah-dropzone {
  border: 2px dashed rgba(239, 230, 218, 0.25);
  border-radius: 12px;
  padding: 2.25rem 1.25rem;
  text-align: center;
  color: var(--sh-bone);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.ah-dropzone.drag {
  border-color: var(--sh-orange);
  background: rgba(255, 90, 31, 0.06);
}

.ah-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sh-orange);
  color: var(--sh-ink);
  font-size: 20px;
  margin-bottom: 0.9rem;
}

.ah-dropzone p {
  font-family: var(--sh-mono);
  font-size: 0.8rem;
  margin: 0.4rem 0;
}
.ah-dropzone-or {
  color: var(--sh-taupe);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.ah-dropzone-btn {
  margin-top: 0.6rem;
  background: var(--sh-orange);
  color: var(--sh-ink);
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.4rem;
  font-family: var(--sh-mono);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.ah-dropzone-btn:hover { transform: translateY(-2px); }
.ah-dropzone-btn:focus-visible,
.ah-modal-close:focus-visible { outline: 2px solid var(--sh-bone); outline-offset: 2px; }

/* ---- mobile: stack the name on two centered rows, hide half the collage ---- */
@media (max-width: 700px) {
  .ah-title {
    white-space: normal;
    text-align: center;
    font-size: 15vw;
    line-height: 0.92;
    width: 100%;
    translate: -50% -60%;
  }
  .ah-item.m-hide { display: none; }
  .ah-add { right: auto; left: 50%; translate: -50% 0; bottom: 5vh; }
}
@media (prefers-reduced-motion: reduce) {
  .ah-icon, .ah-puffy, .ah-scroll { animation: none !important; }
}
