/* ==== SLOT:WP5 programmet-view ==== */
/* Programmet view (#view-programmet): weeks, #innovation, #eventyr, stack-spreads. Prefix pg-. */
/* An information page, not a second landing page: a quiet header, a week
   list built to be scanned (sticky Uge index + one photo per week with a
   gentle scroll parallax), then the two long topic texts, each opened by
   a different scroll-driven photo "stack-spread". */
#view-programmet { background: var(--white); }

.pg-head { padding: var(--space-7) 0 var(--space-6); }
.pg-head-inner { max-width: 820px; }
.pg-title { margin-bottom: var(--space-4); }
.pg-intro { max-width: 62ch; }
.pg-jumps { display: flex; flex-wrap: wrap; gap: 4px var(--space-4); margin-top: var(--space-5); padding-left: 18px; }
/* The bigger jump links (2026-10-05) outgrow the header's 820px reading
   measure; the row may run past it, up to the page gutters, so all three
   stay on one line wherever the screen allows. */
.pg-jumps { width: max-content; max-width: calc(100vw - 2 * var(--gutter)); }
@media (max-width: 440px) { .pg-jumps .link-cta { font-size: 18px; } }   /* stacked on phones: keep each on one line */

/* Week by week: index column + rows */
.pg-weeks { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: var(--space-6); padding-bottom: var(--space-7); }
.pg-index { position: sticky; top: calc(var(--nav-h) + var(--space-5)); align-self: start; }
.pg-index-label { display: block; font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.02em; color: var(--muted); margin-bottom: var(--space-2); }
.pg-index ol { list-style: none; border-left: 1px solid var(--border); }
.pg-index a {
  display: block; margin-left: -1px; padding: 7px 0 7px 18px;
  border-left: 2px solid transparent; text-decoration: none;
  color: var(--muted); font-size: 15px; font-weight: 700; line-height: 1.3;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.pg-index a small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.pg-index a:hover { color: var(--navy); }
.pg-index a.is-current { color: var(--navy); border-left-color: var(--red); }
.pg-index a:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.pg-week {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-6);
  padding: var(--space-7) 0; border-top: 1px solid var(--border);
}
.pg-week:first-child { border-top: 0; padding-top: 0; }
.pg-week:nth-child(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.pg-week:nth-child(even) .pg-week-media { order: 2; }
.pg-week-media { position: sticky; top: calc(var(--nav-h) + var(--space-5)); align-self: start; aspect-ratio: 4 / 5; }
#view-programmet .pg-week-media > img { position: absolute; left: 0; top: -9%; height: 118%; will-change: transform; }
.pg-week-media.ph { aspect-ratio: 4 / 5; }
.pg-week-head { margin-bottom: var(--space-3); }
.pg-week-no { display: block; font-size: var(--fs-h3); font-weight: 900; line-height: 1.2; letter-spacing: -0.02em; color: var(--navy); text-wrap: balance; }
.pg-week-no--long { font-size: var(--fs-h3); line-height: 1.2; }
.pg-week-colon { color: var(--navy); }
.pg-week-place { display: inline; color: var(--red); }
.pg-week-text { max-width: 62ch; }

/* Topic sections (#innovation, #eventyr) */
.pg-topic { border-top: 1px solid var(--border); }
#eventyr { padding-bottom: var(--section-y); }
.pg-topic-title { margin-bottom: var(--space-4); }
/* Wider text box (Martin, 2026-10-05): up to 1120px, set in two columns on
   wide screens so each line stays a readable length. */
.pg-topic-text { max-width: min(100%, 1120px); margin: 0 auto; }
@media (min-width: 1024px) {
  .pg-topic-text { column-count: 2; column-gap: clamp(40px, 5vw, 88px); column-rule: 1px solid var(--border); orphans: 3; widows: 3; }   /* hairline between the columns (Martin, 2026-10-05) */
}

.pg-topic-text + .pg-spread, .pg-spread + .pg-topic-text { margin-top: var(--space-6); }
/* SRHU campus video (Martin, 2026-10-05): plays by itself, muted, while at
   least half of it is on screen, and pauses when scrolled away. Same controls
   as the landing's IIP film, reusing its .hx-film-btn / -timeline / -time /
   -sound pieces; state classes on .pg-video pick each button's icon. */
.pg-video { aspect-ratio: 16 / 9; max-width: 1120px; margin: var(--space-5) auto var(--space-6); background: #000; }   /* same measure as the text around it (Martin, 2026-10-05) */
.pg-video > video { cursor: pointer; }
.pg-video::after {   /* soft bottom shade so the white controls read on bright footage */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30%; pointer-events: none;
  background: linear-gradient(to top, rgba(17, 29, 64, 0.5), rgba(17, 29, 64, 0));
  transition: opacity 400ms var(--ease);
}
.pg-video-ui {
  position: absolute; z-index: 2; left: var(--space-3); right: var(--space-3); bottom: var(--space-3);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  pointer-events: none;   /* the bar's empty space lets taps through to the picture */
}
.pg-video-ui > * { pointer-events: auto; transition: opacity 400ms var(--ease); }
/* Phones: a small "Slå lyd til" that fits the buttons' row (Martin, 2026-10-21). */
@media (max-width: 760px) {
  .pg-video .hx-film-sound { gap: 6px; padding: 5px 11px; font-size: 14px; }
  .pg-video .hx-film-sound svg { width: 14px; height: 14px; }
}
.pg-video.is-idle .pg-video-ui > :not(.hx-film-sound) { opacity: 0; pointer-events: none; }
.pg-video.is-idle::after { opacity: 0; }
.pg-video.is-idle > video { cursor: none; }
.pg-video.is-playing.is-muted .hx-film-sound { display: inline-flex; }
.pg-video .hx-if-playing { display: none; }
.pg-video.is-playing .hx-if-playing { display: contents; }
.pg-video.is-playing .hx-if-paused { display: none; }
.pg-video .hx-if-muted { display: none; }
.pg-video.is-muted .hx-if-muted { display: contents; }
.pg-video.is-muted .hx-if-sound { display: none; }

/* Stack-spread: a tall track with a sticky stage; scroll position spreads the pile.
   --line (innovation): a flat deck that deals out into a neat captioned row.
   --scatter (eventyr): a rotated pile that throws out into a collage round the title. */
.pg-spread { position: relative; height: 210vh; }
.pg-spread--scatter { height: 200vh; }   /* was 230vh: a shorter pinned run, and the spread now ends at its very end, so there's no idle stretch (Martin, 2026-10-05) */
.pg-spread-stage { position: sticky; top: var(--nav-h); height: calc(100vh - var(--nav-h)); overflow: hidden; }
.pg-card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}
.pg-card .media, .pg-card .ph { width: 100%; height: 100%; box-shadow: 0 18px 40px -22px rgba(17, 29, 64, 0.45); }
.pg-card .ph { aspect-ratio: auto; }
/* Portrait and landscape cards share one height; the row of 2 portrait + 3
   landscape fits the wrap: 2w + 3 * 1.69w + gaps ≈ 7.6w. */
.pg-spread--line { --pg-lw: clamp(100px, calc((100vw - 2 * var(--gutter)) / 7.6), 200px); }
.pg-spread--line .pg-card { width: var(--pg-lw); height: calc(var(--pg-lw) * 1.3); }
.pg-spread--line .pg-card--land { width: calc(var(--pg-lw) * 1.69); }
.pg-card--logo .media { background: var(--white); }
.pg-card--logo .media > img { object-fit: contain; padding: 14%; }   /* a logo sits whole on white, never cropped */
/* --line is not pinned: its stage is just the row (cards + captions) and it
   scrolls with the page, dealing out as it rises to mid-screen. A pinned,
   full-height stage left big empty bands above and below (Martin, 2026-10-05). */
.pg-spread--line { --pg-line-stage: calc(var(--pg-lw) * 1.3 + 90px); height: auto; }
.pg-spread--line .pg-spread-stage { position: relative; top: auto; height: var(--pg-line-stage); }
.pg-card-cap {
  position: absolute; left: 0; right: 0; top: 100%; padding-top: 12px; text-align: center;
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.02em; color: var(--navy);
  opacity: calc(var(--pg-cap, 0) * 0.35); white-space: nowrap;   /* lighter, so the captions sit back (Martin, 2026-10-05) */
}
/* Scatter (Martin, 2026-10-05): the title sits in the middle of the stage
   UNDER the pile, and is revealed as the photos throw out into a collage
   around it (it also fades up with the spread, since a wide title would
   otherwise peek out past the pile). Mixed portrait and landscape cards
   so the collage looks less like a grid. --pg-sc is the card's short side. */
.pg-spread--scatter { --pg-sc: clamp(104px, 13vw, 210px); }
.pg-spread--scatter .pg-card { width: var(--pg-sc); height: calc(var(--pg-sc) * 1.28); }
.pg-spread--scatter .pg-card--land { width: calc(var(--pg-sc) * 1.4); height: var(--pg-sc); }
.pg-scatter-title {
  position: absolute; left: 50%; top: 50%; width: min(90%, 640px); text-align: center;
  transform: translate(-50%, -50%); z-index: 1; opacity: var(--pg-title, 1);
}

@media (max-width: 900px) {
  .pg-weeks { grid-template-columns: minmax(0, 1fr); }
  .pg-index { display: none; }
  .pg-week, .pg-week:nth-child(even) { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding: var(--space-6) 0; }
  .pg-week:nth-child(even) .pg-week-media { order: 0; }
  .pg-week-media, .pg-week-media.ph { position: relative; top: auto; aspect-ratio: 16 / 10; }
  .pg-spread--scatter { --pg-sc: 15vw; }
}

@media (max-width: 640px) { .pg-spread--scatter { --pg-sc: min(26vw, 104px); } }   /* pairs with SCATTER_NARROW. Capped so the
   photos stop growing past ~400px wide; uncapped they covered the title from ~500px (Martin, 2026-10-22). */

/* Reduced motion (class set by the script): no parallax, spreads shown open and static. */
#view-programmet.pg-static .pg-week-media > img { top: 0; height: 100%; transform: none !important; }
#view-programmet.pg-static .pg-spread { height: auto; }
#view-programmet.pg-static .pg-spread-stage { position: relative; top: auto; height: min(760px, calc(100vh - var(--nav-h))); }
#view-programmet.pg-static .pg-spread--line .pg-spread-stage { height: var(--pg-line-stage); }

/* Phones and small tablets: the --line row no longer fits, so instead of
   overlapping it becomes a sideways-scrolling strip (Martin, 2026-10-21).
   Cards sit in normal flow at full size, the next one peeking in at the
   edge; the deal-out transforms are overridden and the captions stay on. */
@media (max-width: 760px) {
  #view-programmet .pg-spread--line .pg-spread-stage,
  #view-programmet.pg-static .pg-spread--line .pg-spread-stage {
    --pg-lw: min(44vw, 220px);
    display: flex; gap: 12px; height: auto;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)); padding: 8px var(--gutter) 48px;
  }
  #view-programmet .pg-spread--line .pg-spread-stage::-webkit-scrollbar { display: none; }
  #view-programmet .pg-spread--line .pg-card { position: relative; left: auto; top: auto; flex: 0 0 auto; transform: none !important; }
  #view-programmet .pg-spread--line .pg-card-cap { opacity: 0.35; }
}

/* ---- Header map (Martin 2026-10-19, issue #10) ----
   India's states, flat with white borders, after the region map in
   docs/issue-assets/map-reference-nepal.png. Fills the empty right of the
   header on wide screens; the header grows to hold it. The six route
   states are in colour; hovering or focusing one pales every other state
   and leaves it unchanged. A click goes to its week (table in the SLOT:WP5
   script). Static on touch and below 1024px. No tooltip. Navy and red shades only.
   Round 2 (issue #10): cropped to the route, the right half of the header
   from 1024px up, sized with the viewport, stop names in their states,
   district lines for texture.
   Round 3 (issue #10, 2026-10-19 night): one flat red or navy per route
   state, no faded edges, and the map is the header's back-most layer. The
   SVG box (and so the route states) keeps its size and place; India and its
   neighbours are drawn on past the viewBox and cut off by the window edge
   and by the frame (clip-path set in the SLOT:WP5 script): the header plus
   the first week (Martin locked in Navy rute + Bag siden, 2026-10-20). */
.pg-art { display: none; pointer-events: none; }
@media (min-width: 1024px) {
  /* Title and intro left, map right. The map grows with the screen but never
     taller than the viewport below the nav (it is 716/600 tall). */
  .pg-head { padding-top: var(--space-6); padding-bottom: var(--space-5); }
  .pg-head .wrap {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center; column-gap: var(--space-5);
  }
  .pg-head .pg-jumps { width: auto; max-width: none; }
}
/* From 1280 the three jump links stay on one line (Martin, 2026-10-19): the
   text column is at least as wide as the links, and the map takes what is
   left (max-width: 100% below), so it shrinks rather than pushing a link down. */
@media (min-width: 1280px) {
  .pg-head .wrap { grid-template-columns: minmax(min-content, 1fr) minmax(0, 1fr); }
  .pg-head .pg-jumps { flex-wrap: nowrap; }
  .pg-head .pg-jumps a { white-space: nowrap; }
}
@media (min-width: 1024px) {
  .pg-art {
    display: block; justify-self: center; max-width: 100%;
    width: min(clamp(440px, 42vw, 900px), max(400px, calc((100vh - var(--nav-h) - 48px) * 0.838)));
    margin: calc(-1 * var(--space-4)) 0 0;
    position: relative; z-index: 0;
  }
  /* The map runs on behind the title and the first week; their content sits on top. */
  .pg-head-inner, .pg-weeks { position: relative; z-index: 1; }
  #view-programmet { overflow-x: clip; }   /* no sideways scroll from the geometry past the window edge */
}
.pg-art-svg { display: block; width: 100%; height: auto; overflow: visible; }

.pgm-svg path { fill-rule: evenodd; stroke: var(--pgm-line); stroke-width: 1.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pgm-other path { fill: var(--pgm-other); }
.pgm-state[data-state="delhi"] path { fill: var(--pgm-delhi); }
.pgm-state[data-state="uttar-pradesh"] path { fill: var(--pgm-uttar-pradesh); }
.pgm-state[data-state="uttarakhand"] path { fill: var(--pgm-uttarakhand); }
.pgm-state[data-state="rajasthan"] path { fill: var(--pgm-rajasthan); }
.pgm-state[data-state="telangana"] path { fill: var(--pgm-telangana); }
.pgm-state[data-state="goa"] path { fill: var(--pgm-goa); }
/* Jaipur and Ranthambore share Rajasthan, so each stop's own district is outlined to keep them two places
   (Jaipur; Sawai Madhopur for Ranthambore). geoBoundaries ADM2, same projection, simplified to ~1 km. */
.pgm-svg path.pgm-place { fill: none; pointer-events: none; }   /* the state borders' white 1.5px line */
.pgm-svg path.pgm-districts { fill: none; stroke-width: 0.6px; stroke-opacity: 0.5; pointer-events: none; }
.pgm-other path.pgm-districts { stroke-opacity: 0.6; }   /* white on the pale tint reads fainter than on colour */
/* Stop names: white on their state; Delhi and Goa are too small, so theirs sit
   outside in the state's own colour with a short leader line. */
.pgm-label {
  font: 700 15px/1 Helvetica, 'Helvetica Neue', Arial, sans-serif; fill: var(--white);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); pointer-events: none;
}
.pgm-label--out { fill: var(--pgm-ink); text-shadow: none; paint-order: stroke; stroke: var(--white); stroke-width: 3px; stroke-linejoin: round; }
.pgm-svg path.pgm-leader { fill: none; stroke: var(--pgm-ink); stroke-width: 1px; pointer-events: none; }
.pgm-state[data-state="delhi"] { --pgm-ink: var(--pgm-delhi); }
.pgm-state[data-state="goa"] { --pgm-ink: var(--pgm-goa); }
.pgm-hit { fill: transparent; }   /* Delhi is a few px wide; this gives it a hover/click target */
.pgm-stop { fill: var(--red); stroke: var(--white); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.pgm-other, .pgm-state { transition: opacity 180ms ease; }

/* Navy rute (Martin, 2026-10-20): route states navy, the stops red, the
   rest of India a pale tint. One flat shade: the state borders separate neighbours. */
.pgm {
  --pgm-line: var(--white);
  --pgm-other: #EFEAEC;
  --pgm-delhi: var(--navy); --pgm-uttar-pradesh: var(--navy); --pgm-uttarakhand: var(--navy);
  --pgm-rajasthan: var(--navy); --pgm-telangana: var(--navy); --pgm-goa: var(--navy);
}

@media (hover: hover) and (min-width: 1024px) {
  .pgm-state { pointer-events: auto; cursor: pointer; outline: none; }   /* focus shows as the others paling */
  .pgm-svg:has(.pgm-state:hover, .pgm-state:focus-visible) :is(.pgm-other, .pgm-state:not(:hover, :focus-visible)) { opacity: 0.25; }
}

/* ==== /SLOT:WP5 ==== */
