/* Asilia Stories photo-story blocks.
   Modelled on ArcGIS StoryMaps' block grammar (cover, sidecar docked/floating,
   guided map tour), rebuilt in plain CSS so stories stay static, fast and indexable. */

.story-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--accent); z-index: 40; }

/* Cover: full-bleed photo, title low on the frame */
.s-cover { position: relative; min-height: calc(100dvh - 68px); display: flex; align-items: flex-end; color: #fff; background: #0B1220; overflow: hidden; padding: 0; }
.s-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.s-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,13,25,.72) 0%, rgba(8,13,25,.25) 55%, rgba(8,13,25,0) 75%), linear-gradient(180deg, rgba(8,13,25,0) 50%, rgba(8,13,25,.7) 100%); }
.s-cover .wrap { position: relative; z-index: 1; padding-bottom: clamp(32px, 6vw, 72px); width: 100%; }
.s-cover .series { display: flex; align-items: center; gap: .7rem; font-size: .9rem; color: rgba(255,255,255,.85); }
.s-cover .series img { position: static; width: 34px; height: auto; }
.s-cover h1 { color: #fff; margin-top: 1rem; max-width: 18ch; font-size: clamp(2.6rem, 6vw, 5rem); }
.s-cover .stand { margin-top: 1rem; max-width: 46ch; font-size: 1.2rem; line-height: 1.5; color: rgba(255,255,255,.9); }
.s-cover .byline { margin-top: 1.4rem; font-size: .92rem; color: rgba(255,255,255,.78); }
.s-cover .credit { position: absolute; right: var(--gutter); bottom: 12px; z-index: 1; font-size: .75rem; color: rgba(255,255,255,.7); }

/* Reading column */
.s-text { padding: clamp(56px, 8vw, 104px) 0; }
.s-text .col { max-width: 66ch; margin: 0 auto; padding: 0 var(--gutter); }
.s-text h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: 1.2rem; }
.s-text p { font-size: 1.12rem; line-height: 1.75; }
.s-text p + p { margin-top: 1.1em; }
.s-text .first::first-letter { font: 600 3.6em/.8 var(--serif); float: left; margin: .08em .12em 0 0; color: var(--ink); }

/* Single photo */
.s-photo { padding: clamp(24px, 4vw, 48px) 0; margin: 0; }
.s-photo img { width: 100%; height: auto; }
.s-photo.full img { max-height: 92dvh; object-fit: cover; }
.s-photo.wide { max-width: 1100px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.s-photo figcaption, .s-gallery figcaption { max-width: 66ch; margin: .8rem auto 0; padding: 0 var(--gutter); font-size: .9rem; color: var(--muted); }
.s-photo.wide figcaption { padding: 0; margin-left: 0; }
.cap-credit { color: var(--muted); opacity: .85; }

/* Gallery: 2 or 3 photos */
.s-gallery { max-width: 1100px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) var(--gutter); display: grid; gap: 12px; grid-template-columns: repeat(var(--n, 2), 1fr); }
.s-gallery figure { margin: 0; }
.s-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.s-gallery figcaption { padding: 0; margin: .6rem 0 0; }
@media (max-width: 700px) { .s-gallery { grid-template-columns: 1fr; } }

/* Pull quote */
.s-quote { padding: clamp(48px, 7vw, 96px) 0; }
.s-quote blockquote { max-width: 36ch; margin: 0 auto; padding: 0 var(--gutter); }
.s-quote blockquote p { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.2; }

/* Evidence figure: the number, what it means, where it came from */
.s-fact { padding: clamp(48px, 7vw, 96px) 0; text-align: center; }
.s-fact .num { font: 600 clamp(4rem, 12vw, 9rem)/1 var(--serif); color: var(--accent-ink); }
.s-fact .label { margin: 1rem auto 0; max-width: 34ch; font-size: 1.2rem; color: var(--ink); }
.s-fact .src { margin-top: .8rem; font-size: .85rem; color: var(--muted); }

/* Sidecar: sticky media + scrolling narrative panels */
.s-sidecar { position: relative; padding: 0; }
.s-media { position: sticky; top: 68px; height: calc(100dvh - 68px); overflow: hidden; background: #0B1220; }
.s-media figure { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .8s ease; }
.s-media figure.on { opacity: 1; }
.s-media img { width: 100%; height: 100%; object-fit: cover; }
.s-media figcaption { position: absolute; left: var(--gutter); bottom: 12px; font-size: .78rem; color: rgba(255,255,255,.8); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.s-steps { position: relative; z-index: 1; }
.s-step { min-height: 100dvh; display: flex; align-items: center; padding: 0 var(--gutter); }
.s-step:first-child { margin-top: 0; }
.s-panel { max-width: 420px; background: var(--bg); color: var(--text); padding: clamp(20px, 2.4vw, 32px); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(8,13,25,.25); }
.s-panel h3 { font-size: 1.7rem; margin-bottom: .7rem; }
.s-panel p { font-size: 1.04rem; line-height: 1.65; }
.s-panel p + p { margin-top: .8em; }

/* Floating: panels ride over a full-screen photo */
.floating .s-steps { margin-top: calc(-100dvh + 68px); }
.floating .s-step:nth-child(even) { justify-content: flex-end; }

/* Docked: photo holds one side, text column scrolls beside it */
.docked { display: grid; grid-template-columns: 1.35fr 1fr; background: var(--bg); }
.docked .s-media { grid-column: 1; grid-row: 1; }
.docked .s-steps { grid-column: 2; grid-row: 1; }
.docked .s-step { min-height: 90dvh; padding: 0 clamp(24px, 4vw, 64px); }
.docked .s-panel { box-shadow: none; padding: 0; background: transparent; max-width: 44ch; }
@media (max-width: 860px) {
  .docked { display: block; }
  .docked .s-steps { margin-top: calc(-100dvh + 68px); }
  .docked .s-step { min-height: 100dvh; }
  .docked .s-panel { background: var(--bg); padding: 22px; box-shadow: 0 10px 40px rgba(8,13,25,.25); }
  .floating .s-step:nth-child(even) { justify-content: flex-start; }
}

/* Guided map tour: numbered places, the map flies to each */
.s-tour { display: grid; grid-template-columns: 1.3fr 1fr; padding: 0; border-top: 1px solid var(--line); }
.s-tour .s-map { position: sticky; top: 68px; height: calc(100dvh - 68px); background: var(--panel); }
.s-tour .s-map > div { width: 100%; height: 100%; }
.s-tour .places { padding: 0 clamp(24px, 4vw, 56px); }
.s-tour .tour-head { padding: clamp(48px, 6vw, 80px) 0 1rem; }
.s-tour .place { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; padding: 2rem 0; }
.s-tour .place .n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 .9rem var(--sans); }
.s-tour .place.on .n { background: var(--accent); color: #fff; }
.s-tour .place h3 { margin-top: .8rem; font-size: 1.7rem; }
.s-tour .place .where { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.s-tour .place img { margin-top: 1rem; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.s-tour .place p { margin-top: .9rem; line-height: 1.65; }
.s-tour .tour-note { font-size: .82rem; color: var(--muted); padding-bottom: 3rem; }
.pin { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #1A2541; color: #F7F3EB; font: 600 13px/1 Inter, sans-serif; border: 2px solid #F7F3EB; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pin.on { background: #B8593A; }
@media (max-width: 860px) {
  .s-tour { display: block; }
  .s-tour .s-map { top: 68px; height: 42dvh; z-index: 2; }
  .s-tour .place { min-height: 70dvh; }
}

/* Credits and consent */
.s-credits { padding: clamp(48px, 6vw, 80px) 0; border-top: 1px solid var(--line); }
.s-credits .col { max-width: 66ch; margin: 0 auto; padding: 0 var(--gutter); }
.s-credits dl { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: 1.2rem 0 0; font-size: .95rem; }
.s-credits dt { color: var(--muted); }
.s-credits dd { margin: 0; }
.s-credits .note { margin-top: 1.6rem; }

@media (prefers-reduced-motion: reduce) {
  .s-media figure { transition: none; }
  .story-progress { display: none; }
}

/* Reading progress, driven by the scroll timeline (no scroll listeners) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .story-progress { animation: story-progress linear both; animation-timeline: scroll(root); }
    @keyframes story-progress { to { transform: scaleX(1); } }
  }
}

/* Quiet the OSM basemap so the numbered pins carry the story */
.s-map .leaflet-tile-pane { filter: grayscale(.55) sepia(.12) brightness(1.02) contrast(.92); }

/* Essays: typographic header on the Dhow band, then a long-form reading column */
.essay-head { background: var(--band); color: var(--band-text); padding: clamp(56px, 9vw, 112px) 0 clamp(40px, 6vw, 72px); }
.essay-head .col { max-width: 760px; margin: 0 auto; padding: 0 var(--gutter); }
.essay-head .series { display: flex; align-items: center; gap: .7rem; font-size: .9rem; color: var(--band-muted); text-decoration: none; }
.essay-head .series img { width: 30px; height: auto; }
.essay-head h1 { color: var(--band-text); margin-top: 1.4rem; font-size: clamp(2.3rem, 4.6vw, 3.6rem); line-height: 1.1; }
.essay-head .stand { margin-top: 1.2rem; font-size: 1.2rem; line-height: 1.55; color: var(--band-muted); max-width: 52ch; }
.essay-head .byline { margin-top: 1.6rem; font-size: .92rem; color: var(--band-muted); }
.essay-body { padding: clamp(48px, 7vw, 88px) 0 clamp(32px, 5vw, 56px); }
.essay-body .col { max-width: 68ch; margin: 0 auto; padding: 0 var(--gutter); }
.essay-body p { font-size: 1.12rem; line-height: 1.8; }
.essay-body p + p { margin-top: 1.1em; }
.essay-body > .col > p:first-child::first-letter { font: 600 3.6em/.8 var(--serif); float: left; margin: .08em .12em 0 0; color: var(--ink); }
.essay-body h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin: 2.4rem 0 1rem; }
.essay-body blockquote { margin: 2.2rem 0; padding-left: 1.4rem; border-left: 3px solid var(--accent); }
.essay-body blockquote p { font: 500 clamp(1.4rem, 2.2vw, 1.75rem)/1.35 var(--serif); color: var(--ink); }
.essay-body strong { color: var(--ink); }
.essay-foot { max-width: 68ch; margin: 0 auto; padding: 0 var(--gutter) clamp(48px, 6vw, 80px); }
.tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.tags li { font-size: .82rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.bio { margin-top: 2.4rem; padding-top: 1.6rem; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; }
.bio img { width: 44px; }
.bio h2 { font-size: 1.3rem; }
.bio p { margin-top: .4rem; color: var(--muted); font-size: .97rem; line-height: 1.65; }
/* Contain the drop capital inside a short opening paragraph */
.essay-body > .col > p:first-child { display: flow-root; }
/* Some essays put quote text straight inside <blockquote> without a <p> */
.essay-body blockquote { font: 500 clamp(1.4rem, 2.2vw, 1.75rem)/1.35 var(--serif); color: var(--ink); }
