/* Inside Columbus 311: Scrollytelling Interactive Stylesheet */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Header Styling */
.story-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 1.75rem 1rem 1.25rem;
}

@media (min-width: 768px) {
  .story-header {
    padding: 2.25rem 1.5rem 1.75rem;
  }
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.kicker {
  display: inline-block;
  text-transform: uppercase;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.headline {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  line-height: 1.2;
  margin: 0 0 0.65rem;
  font-weight: 700;
  color: var(--text-main);
}

@media (min-width: 768px) {
  .headline {
    font-size: 2.25rem;
    margin-bottom: 0.85rem;
  }
}

.deck {
  font-size: 0.975rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0 0 1rem;
  max-width: 850px;
}

@media (min-width: 768px) {
  .deck {
    font-size: 1.1rem;
    line-height: 1.5;
  }
}

.meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  padding-bottom: 0.25rem;
}

.meta-item strong {
  color: var(--text-muted);
}

/* Scrollytelling Two-Column Layout */
.story-layout {
  display: flex;
  flex-direction: column;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem 0.75rem 2rem;
  position: relative;
}

@media (min-width: 1024px) {
  .story-layout {
    flex-direction: row-reverse; /* Stage on right, Prose on left */
    gap: 2rem;
    padding: 1.25rem 1.25rem 3rem;
  }
}

/* Stage Column (Sticky on Desktop and Mobile) */
.stage-column {
  width: 100%;
}

@media (min-width: 1024px) {
  .stage-column {
    flex: 1 1 58%;
    position: sticky;
    top: 1rem;
    height: calc(100vh - 2rem);
    max-height: 720px;
    min-height: 560px;
  }
}

@media (max-width: 1023px) {
  .stage-column {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-page);
    padding: 0.25rem 0 0.5rem;
  }
}

.stage-sticky-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 1023px) {
  .stage-sticky-card {
    height: 330px; /* Precise height on mobile leaving 514px for reading */
  }
}

/* Scene Navigator Tabs */
.scene-tabs {
  display: flex;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  padding: 0.2rem;
  gap: 0.2rem;
}

.tab-btn {
  flex: 1 1 0;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.4rem;
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  text-align: center;
}

@media (min-width: 768px) {
  .tab-btn {
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
  }
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.tab-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Stage Header */
.stage-banner {
  padding: 0.5rem 0.75rem 0.35rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
}

.stage-titles {
  flex: 1 1 240px;
}

.stage-title {
  font-size: 0.95rem;
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

@media (min-width: 768px) {
  .stage-title {
    font-size: 1.1rem;
  }
}

.stage-meta {
  font-size: 0.675rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
  line-height: 1.25;
}

@media (min-width: 768px) {
  .stage-meta {
    font-size: 0.725rem;
  }
}

.stage-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.control-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.control-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.control-btn:focus-visible {
  outline: 2px solid var(--primary);
}

/* Canvas Area */
.stage-canvas-wrap {
  flex: 1 1 auto;
  position: relative;
  min-height: 200px;
  overflow: hidden;
  background: var(--bg-surface);
}

.stage-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Tooltip */
.stage-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.725rem;
  line-height: 1.35;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, -115%);
  transition: opacity 0.1s ease;
  z-index: 50;
  white-space: nowrap;
}

.stage-tooltip.active {
  opacity: 1;
}

/* Stage Status Bar */
.stage-status-bar {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-light);
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
}

.stage-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.675rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .legend-item {
    font-size: 0.725rem;
  }
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.stage-footnote {
  color: var(--text-faint);
  font-size: 0.65rem;
  font-style: italic;
  display: none;
}

@media (min-width: 768px) {
  .stage-footnote {
    display: block;
    font-size: 0.7rem;
  }
}

/* Prose Column */
.prose-column {
  width: 100%;
}

@media (min-width: 1024px) {
  .prose-column {
    flex: 1 1 42%;
    max-width: 480px;
  }
}

.story-scene {
  padding: 1.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border-light);
  min-height: 75vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 1024px) {
  .story-scene {
    padding: 2.5rem 0;
    min-height: 85vh;
  }
}

.story-scene:last-child {
  border-bottom: none;
  min-height: 60vh;
}

.scene-kicker {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.scene-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 0.85rem;
  color: var(--text-main);
}

@media (min-width: 768px) {
  .scene-title {
    font-size: 1.75rem;
  }
}

.story-scene p {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

@media (min-width: 768px) {
  .story-scene p {
    font-size: 1.025rem;
    line-height: 1.6;
  }
}

.prose-callout {
  background: var(--bg-surface);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

.prose-callout.warning {
  border-left-color: var(--surge-red);
}

.prose-callout h4 {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
  color: var(--text-main);
}

.prose-callout p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.scene-photo-wrap {
  margin: 1rem 0;
}

.scene-photo {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  display: block;
}

.scene-photo-wrap figcaption {
  font-size: 0.725rem;
  color: var(--text-faint);
  margin-top: 0.35rem;
  line-height: 1.35;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 1rem 0;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--surge-red);
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.stat-label {
  display: block;
  font-size: 0.725rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.scroll-cue {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* SVG Chart Typography and Elements - Essential labels >= 12px */
.chart-axis text {
  font-size: 12px;
  fill: var(--text-faint);
  font-family: var(--font-sans);
}

.chart-axis line, .chart-axis path {
  stroke: var(--border-medium);
}

.grid-line {
  stroke: var(--border-light);
  stroke-dasharray: 2, 2;
}

.label-title {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text-main);
  font-family: var(--font-sans);
}

@media (min-width: 768px) {
  .label-title {
    font-size: 12.5px;
  }
}

.label-val {
  font-size: 12px;
  font-weight: 700;
  fill: var(--text-muted);
  font-family: var(--font-sans);
}

.label-badge {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
}

/* Footer */
.story-footer {
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

html[data-pique-reduced-motion="reduce"] * {
  transition: none !important;
  animation: none !important;
}
