/* Guided stories (/verhalen, /en/stories). Builds on board.css tokens and map styles. */
.record-page:has(.story), .record-page:has(.story-list) { max-width: 1250px; }
.story-meta { margin-top: 6px; color: var(--muted); font-size: .85rem; }
.record-page .story-howto { max-width: 75ch; color: var(--muted); font-size: .92rem; }

.story { margin-top: 26px; }
.story.has-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}
.story-map-panel {
  order: 2;
  position: sticky;
  top: calc(var(--header-stuck, 64px) + 12px);
  height: calc(100svh - var(--header-stuck, 64px) - 24px);
  min-height: 320px;
}
.story-map-frame {
  position: relative;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: radial-gradient(circle, #44404a 1px, transparent 1px) 0 0 / 22px 22px, #121217;
}
.story-map-caption {
  position: absolute;
  top: 10px;
  left: 12px;
  margin: 0;
  padding: 3px 8px;
  border-radius: 4px;
  background: #1a1a20e6;
  pointer-events: none;
  color: var(--muted);
  font-size: .76rem;
}

.story-steps { order: 1; margin: 0; padding: 0; list-style: none; }
.story-step { padding: 4px 0 18vh; }
.story-step:last-child { padding-bottom: 24px; }
.story-step + .story-step { border-top: 1px solid var(--line); padding-top: 22px; }
.story-step-number { margin: 0 0 6px; color: var(--red); font: 800 .9rem var(--mono); }
.story-step-number span { color: var(--muted); font-weight: 400; }
.record-page .story-text { margin-bottom: 12px; font: normal clamp(1.15rem, 2vw, 1.35rem)/1.45 var(--serif); }
.story.has-map .story-step:not(.active) .story-text { color: var(--muted); }
.story.has-map .story-step { transition: color .2s; }
.story-step-map { margin-bottom: 12px; }

.story-record {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-size: .93rem;
}
.story.has-map .story-step.active .story-record { border-color: #4a4a56; }
.record-page .story-record p { margin-bottom: 8px; }
.story-record .record-meta { color: var(--muted); font-size: .78rem; }
.story-record .record-meta .badge { display: inline-block; margin: 0 3px; padding: 0 5px; font-size: .64rem; line-height: 1.5; vertical-align: 1px; }
.record-page .story-record h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.3; }
.story-record h3 a { text-decoration: none; }
.story-record h3 a:hover { text-decoration: underline; }
.story-relation { color: var(--muted); }
.story-limits { color: var(--muted); font-size: .86rem; }
.story-limits strong { color: var(--ink); font-weight: 650; }
.story-sources summary { cursor: pointer; color: var(--muted); font-size: .84rem; }
.story-sources ul { margin: 6px 0 0; padding-left: 18px; font-size: .86rem; }
.story-sources li + li { margin-top: 4px; }

.story-notes { margin-top: 30px; padding: 14px 16px; border-left: 3px solid var(--gold); background: var(--panel); border-radius: 0 6px 6px 0; }
.story-notes ul { margin: 0; padding-left: 18px; }
.story-notes li + li { margin-top: 6px; }
.story-notes small { color: var(--muted); }
.story-end { margin-top: 30px; }
.story-next { font-size: 1.1rem; }

.story-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; margin: 14px 0 0; padding: 0; list-style: none; }
.story-list a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
}
.story-list a:hover { border-color: var(--red); }

/* Static network thumbnail on each story card (story-graph.mjs draws it on the server). */
.story-graph {
  display: block;
  width: calc(100% + 32px);
  height: auto;
  aspect-ratio: 320 / 132;
  margin: -14px -16px 4px;
  border-bottom: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  background: radial-gradient(circle, #34313a 1px, transparent 1px) 0 0 / 16px 16px, #121217;
}
.story-graph .tg-link { stroke: #8b747a; stroke-width: 1px; opacity: .6; }
.story-graph .tg-link.focus { stroke: #c98a85; opacity: .8; }
.story-graph .tg-link.contested { stroke: var(--gold); stroke-dasharray: 3 3; opacity: .8; }
.story-graph .tg-node { fill: #202026; stroke: var(--organization); stroke-width: 1.5px; }
.story-graph .tg-person { stroke: var(--person); }
.story-graph .tg-event { stroke: var(--event); }
.story-graph .tg-institution { stroke: var(--institution); }
.story-graph .tg-focus { fill: var(--red); stroke: #ffb3ad; stroke-width: 1.5px; }
.story-graph .tg-halo { fill: var(--red); opacity: .2; }
.story-graph .tg-label {
  fill: var(--muted);
  font: 500 11px var(--sans);
  text-anchor: middle;
  paint-order: stroke;
  stroke: #121217;
  stroke-width: 3px;
  stroke-linejoin: round;
}
.story-graph .tg-focus-label { fill: #fff4ea; font-weight: 750; }
.story-list a:hover .story-graph .tg-link.focus { stroke: #ff9c8c; opacity: 1; }
.story-list strong { font: normal 1.2rem/1.25 var(--serif); }
.story-list span { color: var(--muted); font-size: .9rem; }
.story-list small { margin-top: auto; color: var(--muted); font-size: .78rem; }

@media (max-width: 900px) {
  .story.has-map { display: block; }
  .story-map-panel {
    z-index: 3;
    top: var(--header-stuck, 0px);
    height: 40svh;
    min-height: 240px;
    margin: 0 -4px 14px;
    padding-bottom: 8px;
    background: var(--bg);
  }
  .story-step { padding-bottom: 10vh; }
}
@media (prefers-reduced-motion: reduce) {
  .story.has-map .story-step { transition: none; }
}

/* New nodes pop up, then their connections draw in (story.js adds .entering for about a second). */
.story-map .graph-node.entering > circle { transform-box: fill-box; transform-origin: center; animation: story-node-pop .5s cubic-bezier(.34, 1.5, .64, 1) both; }
.story-map .graph-node.entering .node-label { animation: story-fade-in .4s ease .3s both; }
.story-map .graph-link.entering .link-stroke { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: story-link-draw .6s ease-out .35s forwards; }
.story-map .graph-link.contested.entering .link-stroke { stroke-dasharray: none; stroke-dashoffset: 0; animation: story-fade-in .5s ease .35s both; }
@keyframes story-node-pop { from { transform: scale(0); } }
@keyframes story-fade-in { from { opacity: 0; } }
@keyframes story-link-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .story-map .entering, .story-map .entering * { animation: none !important; }
}
