/*--------------------------------------------------------------
"Naša priča" — the cinematic story view of a Pro gallery.
Full-bleed chapters: a hero photo that fills the screen with the
time and title over it, then a short sequence of photos.
--------------------------------------------------------------*/

.story-body { background: var(--bg); overflow-x: hidden; }

.story-exit {
  position: fixed;
  top: var(--sp-2);
  right: var(--sp-2);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(12, 11, 10, .55);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: .55rem 1rem;
}
.story-exit:hover { border-color: var(--accent); color: var(--accent); }

.story-section-nav { display: none; }

@media (max-width: 899px) {
  .story-body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .story-section-nav {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 100;
    display: block;
  }
  .story-section-toggle {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    color: var(--accent);
    background: rgba(12, 11, 10, .94);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .3);
    font-size: 1.25rem;
    cursor: pointer;
    transition: border-color .2s, transform .2s;
  }
  .story-section-toggle[aria-expanded="true"] { border-color: var(--accent); }
  .story-section-toggle:active { transform: scale(.94); }
  .story-section-panel {
    position: absolute;
    bottom: calc(100% + .75rem);
    left: 50%;
    transform: translateX(-50%);
    width: min(340px, calc(100vw - 2rem));
    padding: 1rem .5rem .5rem;
    border: 1px solid var(--border-strong);
    border-radius: 1rem;
    background: rgba(12, 11, 10, .96);
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, .4);
    animation: story-picker-open .2s ease-out;
  }
  .story-section-panel[hidden] { display: none; }
  .story-section-heading {
    margin: 0 .65rem .65rem;
    color: var(--ink-muted);
    font-size: .6875rem;
    letter-spacing: .15em;
    text-transform: uppercase;
  }
  .story-section-links {
    max-height: min(55svh, 360px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .story-section-links a {
    display: flex;
    align-items: center;
    gap: .8rem;
    min-height: 44px;
    padding: .65rem;
    border-radius: .6rem;
    color: var(--ink);
    font-size: .9375rem;
    line-height: 1.4;
  }
  .story-section-links a:hover,
  .story-section-links a[aria-current="location"] { background: var(--bg-elevated); color: var(--accent); }
  .story-section-number { color: var(--accent); font-size: .6875rem; flex-shrink: 0; }
  .story-section-nav :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  @keyframes story-picker-open {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }
  @media (prefers-reduced-motion: reduce) {
    .story-section-panel { animation: none; }
    .story-section-toggle { transition: none; }
  }
}

/* --- opening screen --- */
.story-intro {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-elevated) center/cover no-repeat;
}
.story-intro::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.55) 0%, rgba(0,0,0,.35) 45%, rgba(12,11,10,.95) 100%);
}
.story-intro-inner { position: relative; z-index: 1; padding: var(--sp-3); }
.story-intro h1 {
  font-style: italic;
  font-size: clamp(2.5rem, 7vw, 5rem);
  margin-bottom: var(--sp-1);
}
.story-date {
  color: var(--ink-muted);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: .8125rem;
}
.story-scroll {
  margin-top: var(--sp-5);
  color: var(--ink-muted);
  font-size: .8125rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.story-scroll .arrow {
  display: block;
  margin-top: .6rem;
  color: var(--accent);
  animation: story-bob 2.4s ease-in-out infinite;
}
@keyframes story-bob {
  0%, 100% { transform: translateY(0); opacity: .65; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* --- chapters --- */
.chapter-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  background: var(--bg-elevated) center/cover no-repeat;
  background-attachment: scroll;
}
.chapter-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,.35) 100%);
}
.chapter-meta {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-3);
}
.chapter-time {
  display: block;
  color: var(--accent);
  font-size: .8125rem;
  letter-spacing: .3em;
  margin-bottom: .6rem;
}
.chapter-meta h2 {
  font-style: italic;
  font-size: clamp(2rem, 6vw, 4rem);
  margin: 0;
}
.chapter-text {
  max-width: 46ch;
  margin: var(--sp-2) 0 0;
  color: var(--ink);
  font-size: 1.0625rem;
  font-style: italic;
}

.chapter-sequence {
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-1);
  background: var(--bg);
  grid-template-columns: 1fr;
}
.chapter-sequence figure { margin: 0; }
.chapter-sequence img { width: 100%; height: 100%; object-fit: cover; }
.seq-1 img { max-height: 90vh; object-fit: contain; }

/*--------------------------------------------------------------
Chapter layouts. Four variants cycle (see services/story.js), so
consecutive chapters never share the same shape. Everything below
applies on wider screens only — on a phone every chapter is one
column, where asymmetry would just look like a mistake.
--------------------------------------------------------------*/
@media (min-width: 900px) {
  /* default rows, used whenever a chapter has fewer photos than its
     layout expects */
  .seq-2 { grid-template-columns: repeat(2, 1fr); }
  .seq-3 { grid-template-columns: repeat(3, 1fr); }
  .seq-4 { grid-template-columns: repeat(2, 1fr); }

  /* A — title bottom-left, two photos of unequal width, the second
     dropped down so the row doesn't sit on one line */
  .chapter--a .seq-2 { grid-template-columns: 1.55fr 1fr; align-items: start; }
  .chapter--a .chapter-sequence figure:nth-child(2) { margin-top: 12%; }

  /* B — title bottom-right, one tall photo beside two stacked, inset
     from the edges so it reads as a spread, not a filmstrip */
  .chapter--b .chapter-hero { min-height: 84svh; }
  .chapter--b .chapter-meta { text-align: right; }
  .chapter--b .chapter-text { margin-left: auto; }
  .chapter--b .chapter-sequence { padding: var(--sp-3) var(--sp-4); }
  .chapter--b .seq-3 { grid-template-columns: 1.7fr 1fr; }
  .chapter--b .seq-3 figure:first-child { grid-row: span 2; }

  /* C — title centred over a slightly shorter hero, three photos with
     the middle one larger and its neighbours offset */
  .chapter--c .chapter-hero { align-items: center; }
  .chapter--c .chapter-meta { text-align: center; }
  .chapter--c .chapter-text { margin-left: auto; margin-right: auto; }
  .chapter--c .seq-3 { grid-template-columns: 1fr 1.45fr 1fr; align-items: start; }
  .chapter--c .chapter-sequence figure:nth-child(odd) { margin-top: 9%; }

  /* D — the hero splits: photo on one side, the title on a solid panel
     beside it. Four photos below, staggered. */
  .chapter--d .chapter-hero {
    min-height: 76svh;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 32%);
    align-items: stretch;
  }
  .chapter--d .chapter-hero::before {
    background: linear-gradient(to right, rgba(0,0,0,.5) 0%, rgba(0,0,0,.1) 60%);
  }
  .chapter--d .chapter-meta {
    grid-column: 2;
    max-width: none;
    margin: 0;
    padding: var(--sp-4) var(--sp-3);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .chapter--d .seq-4 { grid-template-columns: repeat(4, 1fr); align-items: start; }
  .chapter--d .chapter-sequence figure:nth-child(even) { margin-top: 16%; }
}

/* The rest of a chapter's photos under its row — and, in the guest chapter,
   the photographer's pick of guest photos — as one grid */
.chapter-gallery {
  columns: 3 260px;
  column-gap: var(--sp-1);
  padding: var(--sp-1);
  background: var(--bg);
}
.chapter-gallery figure {
  margin: 0 0 var(--sp-1);
  break-inside: avoid;
  position: relative;
}
/* Guest photos keep their own shape here — portrait and landscape side by
   side, never cropped or stretched to a common size. */
.chapter-gallery img { width: 100%; height: auto; }
.chapter-gallery figcaption {
  position: absolute;
  left: .5rem;
  bottom: .5rem;
  font-size: .6875rem;
  letter-spacing: .06em;
  background: rgba(12, 11, 10, .72);
  color: var(--ink);
  padding: .15rem .5rem;
  border-radius: 999px;
}

/* --- closing screen --- */
.story-end {
  text-align: center;
  padding: var(--sp-6) var(--sp-3);
  background: radial-gradient(ellipse at bottom, var(--bg-elevated) 0%, var(--bg) 70%);
}
.story-end h2 { font-style: italic; font-size: clamp(1.75rem, 4vw, 2.75rem); }
.story-end-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: var(--sp-3); }

/* --- scroll reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .story-scroll .arrow { animation: none; }
}

/* The studio footer follows the story-end screen directly. */
.story-body .site-footer { margin-top: 0; }
