@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&family=Playfair+Display:wght@400;500;600&display=swap');

html {
  scroll-behavior: smooth;
}

/* hide sections by default */
#mapScreen,
#resultScreen,
#citywideMapScreen {
  display: none;
  scroll-margin-top: 32px;
}

body {
  margin: 0;
  font-family: 'Playfair Display', serif;
  background: #f7f7f7;
  color: #222;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
}

/* ---------------- WELCOME SCREEN: PAGE 1 + PAGE 2 ---------------- */
#welcomeScreen {
  /* Stack two full-screen blocks vertically */
  background: #ffffff;
}

/* Default wrapper for welcome pages */
#welcomeScreen .page {
  width: 100%;
  box-sizing: border-box;
}

/* Second page keeps the readable text width */
.welcomeStory.page {
  max-width: none;
  width: 100%;
  margin: 0 auto;
}

/* First page breaks out to full browser width */
.welcomeIntro.page {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: grid;
  /* Left = 2/5, Right = 3/5 */
  grid-template-columns: 2fr 3fr;
}

/* Make the first screen full-width (no margins/padding constraints) */
.welcomeIntro {
  max-width: none;      /* override .page limit */
  width: 100%;
  margin: 0;            /* remove centering margins */
  padding: 0;           /* remove side padding */

  min-height: 100vh;
  display: grid;
  /* Left = 2/5, Right = 3/5 */
  grid-template-columns: 2fr 3fr;
}

/* Left column text */

/* NEW: controls vertical alignment of the whole left column */
.welcomeIntroText {
  display: flex;
  flex-direction: column;
  justify-content: center; /* centers title block vertically */
  padding: 0 80px; /* controls left/right spacing of text */
}

.welcomeIntroText h1 {
  font-size: 120px;
  margin: 0 0 20px 0;
  line-height: 1;
  font-family: 'Playfair Display', serif;
  color: #000000;
}

.welcomeIntroText h2 {
  font-size: 28px;
  font-weight: 400;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
  color: #000000;
  margin: 0 0 40px 0;
}

.welcomeIntroText .authors {
  font-size: 18px;
  font-weight: 400;
  
  font-family: 'Playfair Display', serif;
  color: #656565;
  margin: 0;
}

/* Date below authors, even lighter */
.welcomeIntroText .date {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 400;
  color: #5f5f5f; /* lighter than authors */
}

/* Right column now becomes a full-height image */
.welcomeIntroPhoto {
  height: 100vh;
  position: relative;

  /* THIS ensures it fully fills its grid column */
  width: 100%;
  overflow: hidden;
}

/* Image fills the entire right column */
.welcomePhotoCard {
  width: 100%;
  height: 100%; /* fill full column height */
  background-image: url("image/berlinerfeuerwehr112.jpg");
  background-size: cover;
  background-position: center;
  border-radius: 0; /* remove card look */
}

/* Photographer name on top of the image */
.photoCredit {
  position: absolute;
  bottom: 16px;
  right: 16px;
  font-size: 13px;
  font-weight: 600; /* makes it bold */
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 4px;
}

/* Second page uses a sticky stage with a long scroll area */
/* Full-width scrollytelling section */
.welcomeStory {
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;

  /* Tall section creates the scroll distance for the cumulative reveal */
  min-height: 300vh;
  position: relative;
}

/* This keeps the text composition fixed on screen while the user scrolls */
.storyStickyFrame {
  position: sticky;
  top: 0;
  height: 100vh;

  display: flex;
  align-items: center;

  /* Small side padding, but much wider than before */
  padding: 0 64px;
  box-sizing: border-box;
}

/* Holds all paragraphs in one shared composition */
.storySequence {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 72px;
}

/* Shared paragraph styling */
.storyParagraph {
  font-size: 18px;
  line-height: 1.7;
  margin: 0;

  /* Hidden by default; specific blocks below decide when to reveal */
  opacity: 0;
  transform: translateY(30px);
}

/* First paragraph: left aligned and appears first */
/* First paragraph: fully visible from the start and pushed left */
.storyParagraphLeft {
  align-self: flex-start;
  text-align: left;
  max-width: 920px;

  /* Start visible, but allow JS to hide it later */
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* First paragraph becomes a row: text on the left, icon on the right */
.storyParagraphWithIcon {
  display: flex;
  align-items: center;
  gap: 24px; /* space between paragraph and gif */
  flex-direction: row-reverse; /* flips order: icon → text */
}

/* Keep the first paragraph text width readable */
.storyParagraphText {
  max-width: 800px;
  margin: 0;
  font-size: 22px;
  line-height: 1.7;
  font-family: 'Playfair Display', serif;
  font-weight: 500;
}

/* Animated icon sizing */
.storyAlertIcon {
  width: 80px;   /* adjust if you want it bigger or smaller */
  height: 80px;
  object-fit: contain;
  flex-shrink: 0; /* prevents the gif from shrinking */
  padding-right: 4%;
}


/* Second paragraph: centered, hidden until later */
.storyParagraphCenter {
  align-self: center;
  text-align: center;
  max-width: 1200px;
  opacity: 1;
  transform: none;
}

/* This targets the actual text element inside the middle paragraph */
.storyParagraphCenter .storyParagraphText {
  font-size: 30px;
}

/* Stack the three sentences vertically */
.storyQuestions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Each sentence starts hidden */
.storyLine {
  display: block;
  opacity: 0;
  transform: translateY(18px);
}

/* When visible */
.storyLine.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Third paragraph: pushed right, hidden until later */
.storyParagraphRight {
  align-self: flex-end;
  font-size: 22px;
  text-align: right;
  max-width: 550px;
  font-family: 'Playfair Display', serif;
  font-weight: 500;
}

/* Final block: button centered, text to the right */
.storyFinalBlock {
  position: relative;
  width: 100%;
  height: 100%;

  opacity: 0;
  transform: translateY(30px);
}

/* Start button appears together with the final block */
.storyFinalBlock #startButton {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); /* true center of screen */
}

/* Text to the right of the button */
.storyFinalBlock .storyParagraphRight {
  position: absolute;
  left: calc(50% + 200px); /* push text to the right of button */
  top: 50%;
  transform: translateY(-50%);

  text-align: left;
  max-width: 550px;
}

/* class added by JavaScript when each block should appear */
.storyVisible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* When JS removes visibility from the first paragraph, hide it cleanly */
.storyParagraphLeft:not(.storyVisible) {
  opacity: 0;
  transform: translateY(-10px);
}

/* When the final block becomes visible, also reveal its paragraph */
.storyFinalBlock.storyVisible .storyParagraphRight {
  opacity: 1;
  transform: translateY(-15%);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Fade + rise reveal */
@keyframes storyReveal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive: stack into one column on smaller screens */
@media (max-width: 900px) {
  .welcomeIntro {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .welcomeIntroText h1 {
    font-size: 52px;
  }

  .welcomePhotoCard {
    aspect-ratio: 16 / 10;
  }
}

/* make map page wrappers full-width */
#mapScreen .page,
#resultScreen .page,
#citywideMapScreen .page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* full-width section for the citywide thematic map */
#citywideMapScreen {
  min-height: 100vh;
  background: white;
  padding-top: 40px;
}

/* give padding only to the text elements above the map */
#mapScreen h1{
  margin-bottom: 10px;
  margin-left: 24px;
  font-size: 44px;
}
#mapScreen p{
  margin-top: 0;
  margin-left: 24px;
  font-size: 20px;
}

#resultScreen h1{
  margin-bottom: 10px;
  margin-left: 24px;
  font-size: 44px;
}

#resultScreen p {
  padding-left: 24px;
  padding-right: 24px;
  font-size: 20px;
}

.hidden {
  display: none;
}

#resultIntro {
  position: sticky;
  top: 0;
  z-index: 30;
  background: white;
  padding: 20px 0 12px 0;
}

#resultIntro h1 {
  margin-top: 0;
  margin-bottom: 10px;
  margin-left: 24px;
  font-size: 44px;
}

#resultIntro #resultStatus {
  margin-top: 0;
  margin-bottom: 12px;
  padding-left: 0;
  padding-right: 24px;
  font-size: 20px;
  line-height: 1.6;
}

#startButton {
  margin-top: 40px;
  font-size: 28px;
  padding: 16px 28px;
  border-radius: 40px;
  border: none;
  background: #E6001A;
  color: white;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

#startButton:hover {
  background: #000000;
  animation: bounceStartButton 2s infinite;
}

#mapScreen,
#resultScreen {
  background: white;
  max-width: none;
  width: 100%;
  padding: 20px 0 32px 0;
}

#mapScreen {
  min-height: auto;
}

#resultScreen {
  min-height: 100vh;
}

#map,
#resultMap {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f3;
  border: 1px solid #ccc;
}

/* First map (selection)*/
#map {
  height: 70vh;
  min-height: 560px;
  max-height: 820px;
}

/* Result map*/
#resultMap {
  height: 80vh;
  min-height: 550px;
}

#status{
  margin-bottom: 12px;
  margin-left: 24px;
  line-height: 1.6;
}

#resultStatus {
  margin: 0;
  line-height: 1.6;  
}

#resetBtn {
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #bbb;
  background: white;
  cursor: pointer;
  border-radius: 6px;
}

/* --- NEW: result screen two-column layout --- */

#resultLayout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}

#resultMapWrapper {
  width: 100%;
  position: sticky;
  top: 150px;
  align-self: start;
}

#infoPanel {
  background: #ffffff;
  padding: 20px 20px 0 20px;
  min-height: 700px;
  box-sizing: border-box;
}

#infoPanel h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

#infoContent {
  font-size: 16px;
  line-height: 1.5;
}

.statBlock {
  margin-bottom: 18px;
  padding-bottom: 14px;
}

/* upper sentence line before the large number */
.statLead {
  font-size: 20px;
  line-height: 1.5;
  color: #444;
  text-align: center;
  margin: 0 0 18px 0;
}

/* the large central number */
.statBigNumber {
  font-size: 64px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  color: #111;
  margin: 0 0 18px 0;
}

/* lower sentence line after the large number */
.statTrail {
  font-size: 20px;
  line-height: 1.5;
  color: #444;
  text-align: center;
  max-width: 24ch;
  margin: 0 auto;
}

.statNote {
  font-size: 14px;
  color: #444;
  margin-top: 6px;
  line-height: 1.4;
}

.statSection {
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 0 20px 0;
  box-sizing: border-box;
  scroll-margin-top: 140px;
}

.statSection:first-of-type {
  justify-content: center;
  padding-top: 0;
}

/* smaller note text shown below the main sentence and above the arrow */
.statNote {
  font-size: 13px;
  line-height: 1.5;
  color: #666;
  text-align: center;
  max-width: 34ch;
  margin: 14px auto 0 auto;
}

/* inline hover term for small explanations */
.tooltipTerm {
  position: relative;
  display: inline-block;
  text-decoration: underline dotted;
  cursor: help;
}

/* hidden explanation box shown on hover */
.tooltipBox {
  visibility: hidden;
  opacity: 0;

  position: absolute;
  left: 50%;
  bottom: 125%;
  transform: translateX(-50%);

  width: 220px;
  padding: 10px 12px;

  background: #ffffff;
  color: #333;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);

  font-size: 14px;
  line-height: 1.4;
  text-align: left;

  transition: opacity 0.15s ease;
  z-index: 30;
}

/* show the explanation when hovering over the term */
.tooltipTerm:hover .tooltipBox {
  visibility: visible;
  opacity: 1;
}

.nextStatBtn {
  display: block;
  margin: 40px auto;
  margin-top: 28px;
  width: 52px;
  height: 52px;
  border-width: 1px;
  border-radius: 50%;
  background: none;
  color: #000000;
  font-size: 24px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.nextStatBtn:hover {
  background: #000000;
  color: white;
  transform: translateY(2px);
  animation: bounceArrow 2s infinite;
}

@keyframes bounceArrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes bounceStartButton {
  0%, 100% { transform: translate(-50%, -50%); }
  50% { transform: translate(-50%, -65%); }
}

/* button leading from the local story to the Berlin-wide map */
.nextSectionBtn {
  display: block;
  margin: 50px auto 0 auto;
  padding: 16px 20px;

  border: none;
  border-radius: 40px;

  background: #E6001A;
  color: #ffffff;

  font-size: 16px;
  font-weight: 500;
  cursor: pointer;

  transition: background 0.15s ease, transform 0.15s ease;
}

.nextSectionBtn:hover {
  background: #000000;
  color: white;
  transform: translateY(2px);
  animation: bounceArrow 2s infinite;
}

/* --- make layout stack on smaller screens --- */

@media (max-width: 900px) {
  #resultLayout {
    grid-template-columns: 1fr;
  }

  #infoPanel {
    min-height: auto;
  }

  #map,
  #resultMap {
    height: 500px;
  }
}

#resetBtn {
  margin-left: 24px;
  margin-top: 5px;
  margin-bottom: 19px;

  padding: 9px 16px;

  border-radius: 40px;
  border: 1.5px solid #000000;

  background: white;
  color: #000000;

  font-weight: 500;

  cursor: pointer;

  transition: all 0.15s ease;
}

#resetBtn:hover {
  background: #000000;
  color: white;
  animation: bounceArrow 2s infinite;
}

#resultIntroRow {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding-left: 24px;
  padding-right: 24px;
}

#resultResetBtn {
  margin-left: 0;
  margin-top: 5px;
  margin-bottom: 19px;
  white-space: nowrap;

  padding: 9px 16px;

  border-radius: 40px;
  border: 1.5px solid #000000;

  background: white;
  color: #000000;

  font-weight: 500;

  cursor: pointer;

  transition: all 0.15s ease;
}

#resultResetBtn:hover {
  background: #000000;
  color: white;
  animation: bounceArrow 2s infinite;
}

/* sticky white header for the stats panel */
#infoHeader {
  position: sticky;
  top: 150px;
  z-index: 20;

  background: white;
  padding: 10px 0 10px 0;   /* white space under the title before the border */
  margin-bottom: 28px;      /* pushes the content lower */

  border-bottom: 1px solid #eee;
}

/* text block above the full-width map */
.citywideHeader {
  padding-bottom: 24px;
  text-align: left;
}

/* controls above the citywide map */
.citywideControls {
  padding-bottom: 24px;
}

/* one row = text on the left, switch on the right */
.switchRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  margin-left: 24px;
  margin-right: 24px;
  margin-bottom: 14px;

  cursor: pointer;
}

/* text label next to each switch */
.switchLabel {
  font-size: 16px;
  line-height: 2;
  color: #222;
}

/* hide the native checkbox */
.switchRow input {
  display: none;
}

/* switch track */
.switchSlider {
  position: relative;
  flex: 0 0 52px;
  width: 52px;
  height: 30px;

  background: #d1d5db;
  border-radius: 999px;

  transition: background 0.2s ease;
}

/* switch knob */
.switchSlider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;

  width: 24px;
  height: 24px;

  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);

  transition: transform 0.2s ease;
}

/* active state */
.switchRow input:checked + .switchSlider {
  background: #111;
}

/* move knob when active */
.switchRow input:checked + .switchSlider::before {
  transform: translateX(22px);
}

.citywideHeader h1 {
  margin-top: 0;
  margin-bottom: 6px;
  margin-left: 24px;
}

.citywideHeader p {
  line-height: 1.6;
  margin-top: 0;
  margin-bottom: 24px;
  margin-left: 24px;
}

/* two-column layout for the Berlin-wide section */
#citywideLayout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: start;
}

/* sticky map on the left, same logic as the local section */
#citywideMapWrapper {
  position: sticky;
  top: 20px;
  align-self: start;
}

/* map now lives inside the left column, not full-width anymore */
#citywideMap {
  width: 100%;
  height: 760px;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: hidden;
}

/* right-side panel for switches + legend */
#citywideSidePanel {
  padding-right: 24px;
  box-sizing: border-box;
}

/* controls now belong to the side panel */
.citywideControls {
  padding-bottom: 6px;
  margin-top: 24px;
}

/* legend box under the switches */
#citywideLegend {
  margin-top: 20px;
  margin-left: 20px;
  margin-bottom: 14px;
  padding-top: 40px;
  border-top: 1px solid #e5e5e5;
}

#citywideLegendTitle {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 15px;
}

/* each legend row: color square + text */
.legendItem {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.legendSwatch {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex: 0 0 18px;
  gap: 12px;
}

.legendLabel {
  font-size: 14px;
  line-height: 1.4;
  color: #333;
}

.citywideControlsDescription {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 24px;
  margin-bottom: 20px;
  margin-left: 24px;
}

#citywideLegendNote {
  margin: 24px 0 0 0;
  padding-left: 0;
  font-size: 14px;
  line-height: 1.4;
  color: #555;
  max-width: 400px;
}

.leaflet-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  color: #222;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 6px 8px;
  font-size: 14px;
  line-height: 1.4;
}

/* footer block under the citywide map section */
#citywideFooter {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;

  margin-top: 40px;
  padding: 32px 24px 48px 24px;
  border-top: 1px solid #d9d9d9;
}

/* left text block */
#citywideSource h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 22px;
  color: #000000;
}

#citywideSource p {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: #000000;
  max-width: 85ch;
}

/* right restart block */
#citywideRestart {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}

.restartPrompt {
  margin: 0 0 14px 0;
  font-size: 28px;
  font-weight: 600;
}

/* restart button */
.restartBtn {
  padding: 12px 20px;
  margin: 16px 0 0 0;
  border: none;
  border-radius: 999px;
  background: #E6001A;
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  animation: gentleBounce 1.8s infinite ease-in-out;
}

.restartBtn:hover {
  background: #000000;
  transform: translateY(1px);
}

@keyframes gentleBounce {
  0% { transform: translateY(0); }
  50% { transform: translateY(6px); }
  100% { transform: translateY(0); }
}

#citywideNextBtn {
  display: block;
  margin: 130px 24px 0 24px;
  
  width: 52px;
  height: 52px;

  border-radius: 50%;
  border-width: 1px;
  border-style: solid;
  
  background: none;
  color: #000000;
  
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  
  transition: background 0.2s ease, transform 0.2s ease;
}

#citywideNextBtn:hover {
  background: #000000;
  color: white;
  transform: translateY(2px);
  animation: bounceArrow 2s infinite;
}

.legendStation {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #000;
  background: #000000;
  display: inline-block;
  flex: 0 0 12px;
}