.story-page {
  background: var(--cream);
}

.story-back {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  z-index: 20;
  font-family: 'Sora', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brown);
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(102, 79, 11, 0.2);
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
}

.story-back:hover {
  color: var(--purple);
  border-color: var(--purple);
}

.story-hero {
  padding: 8rem clamp(1.5rem, 8vw, 8rem) 5rem;
  max-width: 920px;
  margin: 0 auto;
}

.story-eyebrow {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--purple);
}

.story-hero h1 {
  margin: 0 0 2.25rem;
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  font-weight: 700;
  color: var(--brown);
  letter-spacing: -0.01em;
}

.story-text em,
.story-reflection-block em {
  font-style: italic;
  font-weight: 700;
  color: var(--purple);
}

/* ---------- Overview: Problem / My role ---------- */

.story-overview {
  background: var(--cream);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 8vw, 8rem) 4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
}

.story-overview-col h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  font-weight: 700;
  color: var(--brown);
}

.story-overview-col p {
  margin: 0 0 1rem;
  line-height: 1.55;
  font-size: 0.94rem;
  color: var(--brown);
}

.story-overview-col p:last-child {
  margin-bottom: 0;
}

.story-overview-col strong {
  color: var(--brown);
}

.story-role-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.story-role-list li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  line-height: 1.5;
  font-size: 0.94rem;
  color: var(--brown);
}

.story-role-list .role-icon {
  display: inline-flex;
  flex: none;
  color: var(--brown);
  opacity: 0.75;
  margin-top: 0.2rem;
}

.story-role-list .role-icon svg {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

/* ---------- Meta: Duration / Tools / Team ---------- */

.story-meta {
  background: var(--cream);
  max-width: 1080px;
  margin: 0 auto;
  padding: 2.5rem clamp(1.5rem, 8vw, 8rem) 4rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  border-top: 1px solid rgba(102, 79, 11, 0.15);
}

.story-meta-col h3 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--purple);
}

.story-meta-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.story-meta-col li {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--brown);
  opacity: 0.85;
}

/* ---------- Road / scroll stage ---------- */

.story-road-wrap {
  position: relative;
  height: calc(24 * 100vh);
  background: var(--cream);
}

.road-visual {
  position: sticky;
  top: 0;
  height: 47vh;
  overflow: hidden;
  background: var(--cream);
}

.story-content-panel {
  position: sticky;
  top: 50vh;
  height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--cream);
}

/* Per-stop reference photos, sitting in the road's own empty corners (near
   the vanishing point, where the ribbon never reaches) so they never cover
   the ribbon or the centered text column below. Sized with clamp()/vw so
   they shrink smoothly with the viewport instead of disappearing. */
.story-photos {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.2s linear;
}

.story-photo {
  position: relative;
  border-radius: 1.3rem;
  border: 4px solid #fff;
  box-shadow: 0 0.8rem 1.6rem rgba(102, 79, 11, 0.24);
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  background: none;
  padding: 0;
  flex: none;
}

.story-photo img {
  display: block;
  width: 100%;
}

.story-photo:not(.story-photo--wide) {
  height: min(36vh, clamp(58px, 20vw, 230px));
  width: calc(min(36vh, clamp(58px, 20vw, 230px)) * 0.46);
}

.story-photo:not(.story-photo--wide) img {
  height: 100%;
  object-fit: cover;
}

.story-photo--wide {
  width: clamp(80px, 15vw, 240px);
  border-radius: 0.6rem;
}

.story-photo--wide img {
  height: auto;
}

/* Standalone single photo — positioned directly in the road's corner. */
.story-photos > .story-photo {
  position: absolute;
  top: 0.7rem;
}

.story-photos > .story-photo[data-side="left"] {
  right: calc(50% + clamp(0.5rem, 7vw, 6.5rem));
}

.story-photos > .story-photo[data-side="right"] {
  left: calc(50% + clamp(0.5rem, 7vw, 6.5rem));
}

/* Before/after pair — the two photos sit right next to each other with a
   connecting arrow, so the comparison reads as one grouped unit. */
.story-photo-pair {
  position: absolute;
  top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.story-photo-pair[data-side="left"] {
  right: calc(50% + clamp(0.5rem, 7vw, 6.5rem));
}

.story-photo-pair[data-side="right"] {
  left: calc(50% + clamp(0.5rem, 7vw, 6.5rem));
}

.story-photo-pair .story-photo--wide {
  width: clamp(60px, 10vw, 165px);
}

.story-photo-pair-arrow {
  flex: none;
  color: var(--purple);
  font-size: 1.4rem;
  font-weight: 700;
}

.story-photo--tilt-left {
  transform: rotate(-4deg);
}

.story-photo--tilt-right {
  transform: rotate(4deg);
}

.story-photo:hover {
  transform: rotate(0deg) scale(1.04);
}

.story-photo::before {
  content: '✦';
  position: absolute;
  color: var(--purple);
  font-size: 1.1rem;
  pointer-events: none;
}

.story-photo--tilt-left::before {
  top: -0.9rem;
  right: -0.7rem;
}

.story-photo--tilt-right::before {
  top: -0.9rem;
  left: -0.7rem;
}

/* ---------- Photo lightbox ---------- */

.story-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background: rgba(102, 79, 11, 0.72);
  cursor: zoom-out;
}

.story-lightbox.is-open {
  display: flex;
}

.story-lightbox img {
  max-width: min(90vw, 640px);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 0.6rem;
  border: 6px solid #fff;
  box-shadow: 0 2rem 4rem rgba(0, 0, 0, 0.35);
  cursor: default;
}

.story-lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--brown);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.story-road-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#roadRibbon {
  filter: drop-shadow(0 0.6vh 1.4vh rgba(102, 79, 11, 0.16));
}

#roadCenterline {
  stroke: #ffffff;
  stroke-linecap: round;
}

.road-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.road-marker {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform, opacity;
}

.road-marker .marker-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 0.7rem;
  height: 0.7rem;
  margin: -0.35rem 0 0 -0.35rem;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

.road-marker .marker-label {
  position: absolute;
  top: 0;
  width: 9rem;
  text-align: left;
}

.road-marker.side-right .marker-label {
  left: 1.1rem;
  text-align: left;
}

.road-marker.side-left .marker-label {
  right: 1.1rem;
  left: auto;
  text-align: right;
}

.road-marker .marker-num {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 0.1rem;
}

.road-marker .marker-title {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brown);
  line-height: 1.25;
}

.story-progress {
  flex: none;
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--brown);
  opacity: 0.42;
}

.story-heading {
  flex: none;
  margin: 0 0 1rem;
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: var(--brown);
  line-height: 1.2;
}

.story-text {
  position: relative;
  z-index: 2;
  max-width: 980px;
  width: min(92vw, 980px);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: center;
  padding: 1.25rem 1.5rem;
  transition: opacity 0.2s linear;
}

.story-body-viewport {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#storyBody {
  will-change: transform;
}

.story-text p {
  margin: 0 0 0.5rem;
  line-height: 1.4;
  color: var(--brown);
  font-size: 0.88rem;
}

.story-text ul {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
  text-align: left;
  display: inline-block;
}

.story-text li {
  margin-bottom: 0.2rem;
  line-height: 1.35;
  color: var(--brown);
  font-size: 0.88rem;
}

.story-text code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: rgba(102, 79, 11, 0.1);
  padding: 0.1rem 0.4rem;
  border-radius: 0.3rem;
  font-size: 0.9em;
}

/* ---------- Key-insight callout ---------- */

.story-insight {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: rgba(221, 197, 240, 0.32);
  border: 1px solid rgba(144, 42, 222, 0.16);
  border-radius: 0.85rem;
  padding: 0.9rem 1.15rem;
  margin: 0.5rem 0 0.7rem;
  text-align: left;
}

.story-insight-icon {
  flex: none;
  margin-top: 0.05rem;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--purple);
}

.story-insight-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  color: var(--purple);
  font-size: 0.92rem;
  line-height: 1.3;
}

.story-insight-body {
  margin: 0;
  color: var(--brown);
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.9;
}

/* ---------- Feature highlight row ---------- */

.story-features {
  display: flex;
  margin-top: 0.6rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(102, 79, 11, 0.14);
}

.story-feature {
  flex: 1 1 0;
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0 0.9rem;
  text-align: left;
  border-left: 1px solid rgba(102, 79, 11, 0.14);
}

.story-feature:first-child {
  border-left: none;
  padding-left: 0;
}

.story-feature-icon {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--lilac);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brown);
}

.story-feature-icon svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.story-feature-title {
  margin: 0 0 0.1rem;
  font-weight: 700;
  color: var(--brown);
  font-size: 0.8rem;
}

.story-feature-body {
  margin: 0;
  color: var(--brown);
  opacity: 0.78;
  font-size: 0.74rem;
  line-height: 1.35;
}

/* ---------- Reflection (outside the road) ---------- */

.story-reflection {
  background: var(--cream);
  padding: 6rem clamp(1.5rem, 8vw, 8rem) 7rem;
  max-width: 920px;
  margin: 0 auto;
  border-top: 1px solid rgba(102, 79, 11, 0.15);
}

.story-reflection-block {
  text-align: center;
  margin-bottom: 4rem;
}

.story-reflection-block:last-child {
  margin-bottom: 0;
}

.story-reflection-block h2 {
  margin: 0 0 1.75rem;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  font-weight: 700;
  color: var(--brown);
}

.story-reflection-block p {
  margin: 0 0 1.1rem;
  line-height: 1.5;
  color: var(--brown);
  text-align: left;
}

.story-reflection-block .btn {
  display: inline-block;
  margin-top: 1.5rem;
}

.story-reflection-block .store-badges {
  justify-content: center;
  margin-top: 1.5rem;
  margin-bottom: 0;
}


@media (max-width: 700px) {
  .story-back {
    top: 1rem;
    left: 1rem;
    font-size: 0.78rem;
    padding: 0.5rem 0.9rem;
  }

  .story-overview {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding-bottom: 2.5rem;
  }

  .story-meta {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding-top: 2rem;
    padding-bottom: 2.5rem;
  }

  .road-marker .marker-label {
    width: 7rem;
  }

  .road-marker .marker-title {
    font-size: 0.85rem;
  }

  .road-visual {
    height: 40vh;
  }

  .story-content-panel {
    top: 42vh;
    height: 58vh;
  }

  .story-photo-pair {
    gap: 0.3rem;
  }

  .story-photo-pair-arrow {
    font-size: 1.1rem;
  }

  .story-photos > .story-photo,
  .story-photo-pair {
    top: 3.75rem;
  }

  .story-heading {
    margin-bottom: 0.9rem;
  }

  .story-text {
    padding: 1.25rem 1.25rem;
  }

  .story-text p,
  .story-text li {
    font-size: 0.84rem;
    margin-bottom: 0.4rem;
  }

  .story-insight {
    padding: 0.75rem 0.9rem;
  }

  .story-insight-title {
    font-size: 0.85rem;
  }

  .story-insight-body {
    font-size: 0.76rem;
  }

  .story-features {
    flex-direction: column;
    gap: 0.6rem;
  }

  .story-feature {
    border-left: none;
    border-top: 1px solid rgba(102, 79, 11, 0.14);
    padding: 0.6rem 0 0;
  }

  .story-feature:first-child {
    border-top: none;
    padding-top: 0;
  }
}

/* ---------- Simple project detail pages (no road) ---------- */

.detail-media {
  background: var(--cream);
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem clamp(1.5rem, 8vw, 8rem) 2rem;
  display: flex;
  justify-content: center;
}
