/* =============================
   Design Tokens
============================== */
@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

:root {
  /* Brand palette (approx. from Figma) */
  --brand: #b899f2;   /* purple */
  --brand-600: #a382ee;
  --sage: #6f887f;    /* green card */
  --ink: #2c2c2c;     /* text */
  --paper: #f1efe6;   /* background */

  /* Typography */
  --font-sans: 'Kanit', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, "Noto Sans", sans-serif;

  /* Effects */
  --radius-lg: 24px;
  --radius-md: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* =============================
   Base / Resets
============================== */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 0 0 40px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
}

/* Utility for italic black heading like in Figma */
.font-black-italic { font-weight: 900; font-style: italic; font-family: var(--font-sans); margin-bottom: 20px; margin-top: 50px; text-align: center; }

/* Headings */
h1, h2, h3 { font-weight: 900; letter-spacing: .3px; margin: 0; }

/* =============================
   Tables (optional)
============================== */
table { border-collapse: collapse; width: min(1200px, 90vw); margin: 20px auto; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
th, td { border-bottom: 1px solid #e6e6e6; padding: 12px 14px; text-align: left; }
th { background: #f5f6f8; font-weight: 700; }
tr:last-child td { border-bottom: 0; }

/* =============================
   Hero
============================== */
.page-hero h1 {
  margin: 16px auto 8px;
  text-align: center;
  font-size: clamp(2rem, 2.4vw + 1rem, 3.2rem);
}

/* =============================
   Map + Pins
============================== */
.map-section { margin: 16px auto 40px; }

.map {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.12), 0 10px 30px rgba(0, 0, 0, 0.12);
}

.map-bg {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.pin {
  position: absolute;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.pin:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 50%; }

/* Icon size responsive with clamp: min 52px, pref 8vw, max 96px */
.pin .pin-img {
  display: block;
  width: 18vw;
  height: 18vw;
  object-fit: cover;
  transition: transform .08s ease-in-out;
}

.pin:hover .pin-img { transform: translateY(-2px) scale(1.02); }

/* Info bubble on map */
#infoCard { max-width: min(520px, 60vw); pointer-events: none; }

.bubble {
  background: var(--brand);
  color: #fff;
  border-radius: 20px;
  padding: 18px 20px;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.2));
}

.bubble-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 6px; }
.bubble-line { margin: 4px 0; font-weight: 400;}
.bubble-muted { opacity: .85; font-style: italic; }

/* Screen-reader only */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* =============================
   Buttons
============================== */
.btn-primary {
  display: inline-block;
  border: 0;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  font-size: clamp(1rem, 1.2vw + 0.6rem, 1.6rem);
  padding: clamp(0.8rem, 1.6vw, 2rem) clamp(1.6rem, 3vw, 3rem);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: transform .06s ease-in-out;
  font-family: var(--font-sans);
}

.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

/* =============================
   Chart Card
============================== */
.chart-card {
  width: min(1200px, 90vw);
  margin: 24px auto 40px;
  padding: 16px;
  background: var(--sage);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.chart-card canvas {
  display: block;
  width: 100% !important;
  height: clamp(360px, 50vh, 560px) !important;
  border-radius: calc(var(--radius-lg) - 4px);
}

/* =============================
   Visit Planner (Calendar + Time)
============================== */
.predict-section { width: min(1200px, 92vw); margin: 32px auto 18px; }

.predict-section h2 {
  font-size: clamp(1.6rem, 2.2vw + 1rem, 2.6rem);
  color: var(--brand);
  text-align: center;
  margin: 50px 0 20px;
  font-weight: 900;
}

.predict-wrap { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }

/* Calendar */
.cal-card { background: var(--sage); color: #fff; border-radius: 22px; padding: 16px 18px 20px; box-shadow: var(--shadow); }

.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 900; font-size: 1.4rem; letter-spacing: .3px; }

.cal-nav { background: #ffffff22; color: #fff; border: 0; border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.cal-nav:hover { background: #ffffff33; }

.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; opacity: .9; font-weight: 700; margin: 8px 2px; }
.cal-weekdays span { text-align: center; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }

.cal-day {
  background: #1f2937;
  color: #fff;
  border: 0;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px auto;
  cursor: pointer;
  font-weight: 800;
}

.cal-day[disabled] { opacity: .35; cursor: default; }
.cal-day.is-today { outline: 3px solid #fff; }
.cal-day.is-selected { background: #ffffff; color: #1f2937; }

/* Time dropdown */
.time-card { background: var(--sage); color: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow); position: relative; }

.time-toggle { width: 100%; background: #ffffff22; color: #fff; border: 0; border-radius: 12px; padding: 14px 16px; font-weight: 900; cursor: pointer; text-align: left; font-family: var(--font-sans); }

.time-list { list-style: none; margin: 10px 0 0; padding: 0; display: none; }
.time-list.show { display: block; }
.time-list li { background: #ffffff22; margin: 10px 0; padding: 14px 16px; border-radius: 16px; font-weight: 800; cursor: pointer; font-family: var(--font-sans);}
.time-list li:hover { background: #ffffff33; }

.predict-actions { 
       margin-top: 18px; 
       display: flex; 
       flex-direction: column; /* Anordnung in Spalten (untereinander) */
       align-items: center;    /* Horizontale Zentrierung der Elemente */
       gap: 16px; 
     }

/* Prediction result card */
.predict-result {
  background: var(--sage);
  color: #fff;
  border-radius: 26px;
  padding: 38px 46px 42px;
  box-shadow: var(--shadow);
  margin-top: 36px;
  width: min(1200px, 90vw);
  margin-inline: auto;
}

.predict-result p { margin: 0 0 12px; font-size: clamp(1rem, 0.9vw + 0.6rem, 1.4rem); font-style: italic; font-weight: 700; }
.predict-result strong { display: block; font-size: clamp(2rem, 2.8vw + 0.8rem, 3rem); font-weight: 900; margin: 18px 0; }
.predict-result .predict-footer { font-size: clamp(1rem, 0.8vw + 0.4rem, 1.3rem); font-style: italic; font-weight: 700; }

@media (max-width: 900px) {
  .predict-wrap { grid-template-columns: 1fr; }
  .cal-card, .time-card {
    width: 100%;
    max-width: 95vw;
    box-sizing: border-box;
    margin-inline: auto;
  }
  /* Mobile tuning: Calendar should never overflow */
  .cal-card {
    padding: 12px;          /* weniger Innenabstand */
    overflow: hidden;       /* schneidet potentielles Überstehen ab */
  }
  .cal-weekdays {
    gap: 6px;               /* kleinere Abstände der Wochentage */
    margin: 6px 2px;
  }
  .cal-grid {
    gap: 6px;               /* kleinere Abstände der Tage */
  }
  .cal-day {
    width: clamp(34px, 11vw, 42px);   /* kleinere, responsive Kreise */
    height: clamp(34px, 11vw, 42px);
    margin: 6px auto;
  }

  /* Mobile Anpassung der Info-Bubbles auf der Karte */
  .bubble {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
  }

  .bubble-title {
    font-size: 0.9rem;
  }

  .bubble-line {
    font-size: 0.75rem;
  }

  .bubble-muted {
    font-size: 0.7rem;
  }

  #infoCard {
    max-width: 80vw;
  }
}

/* =============================
   Marquee-Effekt (Laufschrift) - KORREKTUR
============================== */

/* 1. Wrapper (h1): Ansichtsbereich definieren */
.running-text-wrapper {
       width: 100%;
       text-align: left; 
       /* Wichtig: Inhalte außerhalb dieses Bereichs abschneiden */
       overflow: hidden; 
       /* Füge eine Mindesthöhe hinzu, falls der h1 sonst zusammenfällt */
       line-height: 1.2; 
     }
     
     /* 2. Content (span): Alle Kopien in eine Reihe bringen */
     .running-text-content {
       /* Text in einer einzigen Zeile halten */
       white-space: nowrap; 
       /* Ermöglicht die korrekte Breitenberechnung und Verschiebung */
       display: inline-block; 
       
       /* Startposition: Wir starten bei 0% */
       transform: translateX(0); 
       
       /* Animation anwenden: Name, Dauer, Timing (linear), Endlos */
       /* Anpassung der Dauer: Da der Text 4x so lang ist, muss die Dauer angepasst werden */
       animation: marquee-loop 8s linear infinite; 
     }
     
     /* 3. Keyframes: Die Bewegung definieren */
     @keyframes marquee-loop {
       /* Startpunkt: Der gesamte Block beginnt an der normalen Position */
       0% {
         transform: translateX(0%);
       }
       /* Endpunkt: Der Block wird um die Breite eines EINZELNEN der vier Titel verschoben */
       100% {
         /* WICHTIG: Verschiebung um -25%, da der sichtbare Bereich nur 1/4 der Gesamtbreite ist. */
         transform: translateX(-25%); 
       }
     }