/* ============================================================
   GeoatlasDV - Stories, Interactive & Maps views
   ============================================================ */

/* Stories & Interactive share the visualize 3-column grid */
#view-stories.is-active, #view-interactive.is-active {
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--insp-w);
  gap: 14px;
}
.panel--left.story-slides, .iaboard .panel--left { padding: 20px 16px 24px; }

/* ---------- Repeater (shared inspector list editor) ---------- */
.repeater { display: grid; gap: 10px; }
.repitem { display: grid; grid-template-columns: 1fr 26px; gap: 6px; align-items: start; background: var(--panel-2); border: 1px solid var(--hair); border-radius: var(--r-md); padding: 9px; }
.repitem__body { display: grid; gap: 7px; }
.repitem__body .field { font-size: 12.5px; padding: 7px 9px; }
.repitem__del { border: 0; background: transparent; color: var(--ink-3); border-radius: 7px; height: 26px; }
.repitem__del:hover { color: var(--accent); background: var(--accent-wash); }
.repeater__add { border: 1px dashed var(--hair-2); background: transparent; color: var(--ink-2); border-radius: var(--r-md); padding: 9px; font-weight: 600; font-size: 12.5px; }
.repeater__add:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ============ STORIES ============ */
.slidelist { display: grid; gap: 7px; margin-bottom: 14px; }
.slideitem { display: grid; grid-template-columns: 20px 16px 1fr auto; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--hair); border-radius: var(--r-md); background: var(--panel-3); cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1); }
.slideitem:hover { border-color: var(--hair-2); background: var(--panel); }
.slideitem.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--panel); }
.slideitem__idx { font-family: var(--sans); font-size: 11px; color: var(--ink-3); }
.slideitem__ico { color: var(--accent); font-size: 12px; text-align: center; }
.slideitem__t { font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slideitem__acts { display: flex; gap: 1px; opacity: 0; transition: opacity var(--dur-1); }
.slideitem:hover .slideitem__acts, .slideitem.is-active .slideitem__acts { opacity: 1; }
.slideitem__acts button { border: 0; background: transparent; color: var(--ink-3); width: 20px; height: 20px; border-radius: 5px; font-size: 11px; }
.slideitem__acts button:hover { color: var(--ink); background: var(--panel-2); }

.addslide { margin-bottom: 18px; }
.addslide > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 600; }
.addslide__btns { display: flex; gap: 6px; margin-top: 8px; }
.addslide__btns button { flex: 1; border: 1px solid var(--hair-2); background: var(--panel); color: var(--ink-2); border-radius: var(--r-pill); padding: 7px 6px; font-size: 12px; font-weight: 600; }
.addslide__btns button:hover { border-color: var(--accent); color: var(--accent-ink); }
.storyopts { border-top: 1px solid var(--hair); padding-top: 14px; }
.storyopts .seg { margin-bottom: 12px; }

.story-stage { padding: 0; }
.story-canvas { position: relative; flex: 1; min-height: 360px; overflow: hidden; padding: 22px; }
.story-canvas.is-scroll { overflow-y: auto; scroll-snap-type: y proximity; }
.slide-holder, .story-slide { width: 100%; height: 100%; }
.slide-anim { animation: slideIn .42s var(--ease); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.story-slide { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.story-slide--cover { align-items: flex-start; justify-content: center; gap: 12px; border-radius: var(--r-lg); padding: 40px; }
.story-slide--cover.is-accent { background: linear-gradient(150deg, var(--accent), var(--c7)); color: #fff; }
.cover__kicker { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.story-slide--cover:not(.is-accent) .cover__kicker { color: var(--accent); opacity: 1; }
.cover__title { font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; max-width: 16ch; }
.cover__body { font-size: 17px; max-width: 46ch; opacity: .92; }
.slide__title { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; margin-bottom: 6px; }
.slide__body { font-size: 15px; color: var(--ink-2); max-width: 60ch; margin-bottom: 14px; }
.story-slide--text { justify-content: center; }
.story-slide--text .slide__body { font-size: 16px; }
.slide__chart { flex: 1; min-height: 0; display: flex; align-items: center; }
.slide__chart svg { width: 100%; height: auto; }

.scrollslide { min-height: 92%; scroll-snap-align: start; display: flex; align-items: center; padding: 20px 0; opacity: 0; transform: translateY(24px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.scrollslide.in { opacity: 1; transform: none; }
.scrollslide > div { width: 100%; }

.story-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 22px; border-top: 1px solid var(--hair); min-height: 30px; }
.story-hint { font-size: 12px; color: var(--ink-3); }
.story-dots { display: flex; gap: 6px; }
.story-dot { width: 8px; height: 8px; border-radius: 50%; border: 0; background: var(--hair-2); cursor: pointer; transition: background var(--dur-1), transform var(--dur-1); }
.story-dot.is-on { background: var(--accent); transform: scale(1.25); }
.story-nav { display: flex; align-items: center; gap: 10px; }
.story-nav .iconbtn { font-size: 18px; line-height: 1; }
.story-count { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ============ INTERACTIVE ============ */
.ia-list { display: grid; gap: 7px; }
.ia-item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--hair); border-radius: var(--r-md); background: var(--panel-3); color: var(--ink-2); text-align: left; transition: border-color var(--dur-1), background var(--dur-1), color var(--dur-1); }
.ia-item:hover { border-color: var(--hair-2); background: var(--panel); color: var(--ink); }
.ia-item.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--panel); color: var(--ink); }
.ia-item__ico { width: 22px; height: 22px; color: var(--accent); display: grid; place-items: center; }
.ia-item__ico svg { width: 22px; height: 22px; }
.ia-item__name { font-size: 13px; font-weight: 600; }

.ia-preview { flex: 1; min-height: 360px; display: flex; align-items: center; justify-content: center; padding: 28px; overflow: auto; }
.ia-preview > * { width: 100%; }
.timeline, .quiz, .beforeafter { margin-left: auto; margin-right: auto; }

/* display type for story/interactive headings */
.cover__title, .slide__title, .maps-title, .quiz__q, .ticker__num { font-family: var(--display); }

/* ticker */
.ticker { text-align: center; }
.ticker__num { font-size: 84px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; background: linear-gradient(120deg, var(--accent), var(--c7)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.ticker__label { margin-top: 12px; font-size: 15px; color: var(--ink-2); font-weight: 550; }

/* cards */
.cards { display: grid; gap: 14px; width: 100%; }
.cards--grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.cards--carousel { grid-auto-flow: column; grid-auto-columns: 220px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.iacard { border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 18px; background: var(--panel); box-shadow: var(--sh-1); scroll-snap-align: start; transition: transform var(--dur-1), box-shadow var(--dur-1); }
.iacard:hover { transform: translateY(-3px); box-shadow: var(--sh-2); }
.iacard__emoji { font-size: 30px; margin-bottom: 10px; }
.iacard__tag { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--accent); background: var(--accent-wash); padding: 3px 8px; border-radius: 999px; margin-bottom: 8px; }
.iacard__title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.iacard__body { font-size: 13px; color: var(--ink-2); margin-top: 5px; }

/* timeline */
.timeline { width: 100%; max-width: 560px; margin: auto; position: relative; padding-left: 6px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--hair-2); }
.tlitem { position: relative; padding: 0 0 22px 34px; }
.tlitem__dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--accent); }
.tlitem__card .tlitem__date, .tlitem__date { font-family: var(--sans); font-size: 11px; color: var(--accent-ink); font-weight: 600; }
.tlitem__card h4 { font-size: 16px; font-weight: 700; margin-top: 2px; }
.tlitem__card p { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

/* before/after */
.beforeafter { position: relative; width: 100%; max-width: 560px; aspect-ratio: 16/10; border-radius: var(--r-lg); overflow: hidden; user-select: none; box-shadow: var(--sh-2); cursor: ew-resize; }
.ba__layer { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.ba__before { z-index: 2; }
.ba__tag { position: absolute; top: 14px; color: #fff; font-weight: 700; font-size: 13px; background: rgba(0,0,0,.28); padding: 5px 11px; border-radius: 999px; backdrop-filter: blur(3px); }
.ba__tag--l { left: 14px; } .ba__tag--r { right: 14px; }
.ba__handle { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; z-index: 3; transform: translateX(-50%); pointer-events: none; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.ba__handle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: var(--sh-2); display: grid; place-items: center; }
.ba__handle span::before { content: "⇔"; color: var(--ink); font-size: 15px; }

/* quiz */
.quiz { width: 100%; max-width: 480px; }
.quiz__q { font-size: 20px; font-weight: 750; letter-spacing: -0.01em; margin-bottom: 16px; }
.quiz__opts { display: grid; gap: 9px; }
.quiz__opt { text-align: left; border: 1px solid var(--hair-2); background: var(--panel); border-radius: var(--r-md); padding: 13px 15px; font-size: 14px; font-weight: 550; color: var(--ink); transition: border-color var(--dur-1), background var(--dur-1); }
.quiz__opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-wash); }
.quiz__opt.is-correct { border-color: var(--good); background: #E7F7EE; color: #12813f; }
.quiz__opt.is-wrong { border-color: var(--c5); background: #FDECF1; color: #b32a52; }
.quiz__res { margin-top: 14px; font-weight: 700; font-size: 14px; min-height: 18px; }
.quiz__res.is-good { color: #12813f; } .quiz__res.is-bad { color: #b32a52; }

/* ============ MAPS ============ */
#view-maps.is-active { grid-template-columns: minmax(0,1fr); }
.maps-hero { display: grid; grid-template-columns: 360px 1fr; align-items: center; gap: 30px; padding: 44px; height: 100%; }
.maps-illus { display: grid; place-items: center; }
.maps-copy { max-width: 560px; }
.maps-title { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 8px; }
.maps-sub { font-size: 16px; color: var(--ink-2); margin-bottom: 22px; }
.maps-cards { display: grid; gap: 12px; margin-bottom: 26px; }
.maps-card { border: 1px solid var(--hair); border-radius: var(--r-md); padding: 14px 16px; background: var(--panel-3); }
.maps-card h4 { font-size: 14px; font-weight: 700; }
.maps-card p { font-size: 13px; color: var(--ink-2); margin-top: 3px; }
.maps-card--btn { display: block; width: 100%; text-align: left; cursor: pointer; transition: border-color var(--dur-1), transform var(--dur-1), box-shadow var(--dur-1); }
.maps-card--btn:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--sh-2); }
.maps-card__go { color: var(--accent); font-weight: 700; font-size: 12px; opacity: 0; transition: opacity var(--dur-1); }
.maps-card--btn:hover .maps-card__go { opacity: 1; }

@media (max-width: 1160px) {
  #view-stories.is-active, #view-interactive.is-active { grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-auto-rows: min-content; }
  #view-stories .panel--inspector, #view-interactive .panel--inspector { grid-column: 1 / -1; max-height: 420px; }
  .maps-hero { grid-template-columns: 1fr; text-align: center; gap: 20px; }
  .maps-illus { max-width: 220px; margin: auto; }
}
@media (max-width: 820px) {
  #view-stories.is-active, #view-interactive.is-active { grid-template-columns: 1fr; }
  #view-stories .panel--inspector, #view-interactive .panel--inspector { max-height: none; }
  .story-canvas, .ia-preview { min-height: 300px; }
  .maps-hero { padding: 24px; }
}
