/* ---------------------------------------------------------------
   Line Bandits Adventskalender

   Schriften: ausschließlich Systemschriften. Es wird nichts von
   Google oder einem anderen fremden Server geladen - dadurch keine
   DSGVO-Problematik, kein Ladeverzug und keine Abhängigkeit von
   einem externen Dienst. Charakter entsteht über Schriftstärke,
   Laufweite und Größe statt über eine eigene Schriftart.

   Palette:
     --water-deep  #0b1c26  Haupt-Hintergrund (dunkles Wasser bei Nacht)
     --water-mid   #123241  Türchen (geschlossen)
     --line-orange #e8630c  Markenfarbe, CTA, heutiges Türchen
     --glow-amber  #ffb347  Leuchteffekt / Akzent
     --foam        #f4f6f5  Haupttext
     --slate       #82a0ac  Sekundärtext
   ----------------------------------------------------------------*/

:root {
  --water-deep: #0b1c26;
  --water-mid: #123241;
  --water-mid-2: #17404f;
  --line-orange: #e8630c;
  --glow-amber: #ffb347;
  --foam: #f4f6f5;
  --slate: #82a0ac;
  --radius: 16px;

  /* Eine Schriftfamilie, die auf jedem Betriebssystem vorhanden ist:
     macOS/iOS -> San Francisco, Windows -> Segoe UI,
     Android -> Roboto, Linux -> Cantarell/DejaVu. */
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
             Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  /* Verhindert, dass iOS Text beim Drehen automatisch vergrößert */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--water-deep);
  color: var(--foam);
  font-family: var(--font-ui);
  position: relative;
  overflow-x: hidden;
  /* Randbereiche bei Geräten mit Notch/abgerundeten Ecken freihalten */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.water-bg {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; /* Fallback für ältere Safari */
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(232, 99, 12, 0.14), transparent 60%),
    linear-gradient(180deg, var(--water-deep) 0%, #0e2530 45%, #0a161d 100%);
}

.water-bg::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='200' viewBox='0 0 400 200'%3E%3Cpath d='M0 40 Q50 20 100 40 T200 40 T300 40 T400 40' stroke='%23133645' stroke-width='2' fill='none'/%3E%3Cpath d='M0 100 Q50 80 100 100 T200 100 T300 100 T400 100' stroke='%23133645' stroke-width='2' fill='none'/%3E%3Cpath d='M0 160 Q50 140 100 160 T200 160 T300 160 T400 160' stroke='%23133645' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-size: 400px 200px;
}

/* ---------------- Sprachumschalter ---------------- */

.lang-switch {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(130, 160, 170, 0.25);
  z-index: 10;
}

.lang-switch button {
  min-width: 38px;
  min-height: 30px;
  padding: 0 10px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--slate);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.lang-switch button:hover { color: var(--foam); }

.lang-switch button.is-active {
  background: var(--line-orange);
  color: #fff8f0;
}

.lang-switch button:focus-visible {
  outline: 2px solid var(--glow-amber);
  outline-offset: 2px;
}

/* ---------------- Kopfbereich ---------------- */

.site-header {
  text-align: center;
  /* Oben genug Platz, damit der Sprachumschalter auch auf schmalen
     Bildschirmen nicht über dem Logo liegt. */
  padding: 66px 20px 28px;
}

@media (min-width: 560px) {
  .site-header { padding-top: 52px; }
}

.logo {
  display: block;
  width: 210px;
  max-width: 62%;
  height: auto;
  margin: 0 auto 4px;
}

@media (min-width: 640px) {
  .logo { width: 260px; }
}

.site-header h1 {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: clamp(32px, 8vw, 54px);
  line-height: 1.05;
  margin: 10px 0;
  color: var(--foam);
}

.tagline {
  max-width: 480px;
  margin: 0 auto;
  color: var(--slate);
  font-size: 15px;
  line-height: 1.5;
}

.status-line {
  margin-top: 18px;
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(232, 99, 12, 0.14);
  border: 1px solid rgba(232, 99, 12, 0.35);
  color: var(--glow-amber);
  font-size: 14px;
  font-weight: 500;
}

/* ---------------- Raster ---------------- */

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.calendar-grid {
  position: relative;
  /* Eigene Ebene, damit das Logo dahinter bleibt, aber über dem
     Seitenhintergrund liegt */
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 12px;
}

/* Das Line-Bandits-Logo liegt hinter den Türchen und schimmert durch die
   leicht durchsichtigen Türchen und die Fugen. Helle Fassung des
   Original-Logos (public/logo-watermark.png). */
.calendar-grid::before {
  content: "";
  position: absolute;
  top: -4%; right: 2%; bottom: -4%; left: 2%;
  z-index: -1;
  background: url("logo-watermark.png") center / contain no-repeat;
  opacity: 0.13;
  pointer-events: none;
}

/* Handy und kleines Tablet: Logo so groß, dass der Schriftzug
   www.line-bandits.de von der linken Kante der ersten bis zur rechten
   Kante der letzten Spalte reicht. Er beginnt im Logo bei etwa 10 %
   der Breite und endet am rechten Rand – daher steht das Logo links
   um 11 % über. */
@media (max-width: 639px) {
  .calendar-grid::before {
    left: -11%;
    right: 0;
  }
}

@media (min-width: 480px) {
  .calendar-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; }
}
@media (min-width: 640px) {
  .calendar-grid { grid-template-columns: repeat(6, 1fr); }
}
/* Auf großen Monitoren darf der Kalender mitwachsen, statt als
   schmale Spalte in der Mitte zu kleben. */
@media (min-width: 1024px) {
  main { max-width: 900px; }
  .calendar-grid { gap: 20px; }
}
@media (min-width: 1400px) {
  main { max-width: 1040px; }
}

/* ---------------- Türchen ---------------- */

.door {
  position: relative;
  border: none;
  border-radius: var(--radius);
  /* Leicht durchsichtig, damit das Logo dahinter durchschimmert */
  background: linear-gradient(160deg, rgba(23, 64, 79, 0.74), rgba(18, 50, 65, 0.74));
  color: var(--foam);
  font-family: inherit;
  font-size: clamp(20px, 5vw, 30px);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  width: 100%;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.3s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25) inset;
  -webkit-tap-highlight-color: transparent;
}

/* Quadratische Kachel.
   Moderne Browser nutzen aspect-ratio. Ältere Safari-Versionen
   (iOS 14 und davor) kennen das nicht - für sie greift weiter unten
   der Abstands-Trick, damit die Türchen nicht zu flachen Streifen
   zusammenfallen. */
.door-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1.05;
  padding-top: 10px;
}

@supports not (aspect-ratio: 1 / 1) {
  .door-inner {
    height: 0;
    padding-top: 105%;
    position: relative;
  }
  .door-inner > span {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.door::before {
  /* die kleine Öse oben, wie bei einem Produktanhänger */
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--water-deep);
  border: 2px solid rgba(130, 160, 170, 0.5);
  z-index: 1;
}

.door:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

/* Sichtbarer Fokusrahmen für Tastaturbedienung.
   Erst der allgemeine :focus als Grundlage für ältere Browser,
   danach wird er für Mausklicks per :focus-visible wieder entfernt. */
.door:focus {
  outline: 2px solid var(--glow-amber);
  outline-offset: 3px;
}
.door:focus:not(:focus-visible) { outline: none; }
.door:focus-visible {
  outline: 2px solid var(--glow-amber);
  outline-offset: 3px;
}

.door.locked {
  color: var(--slate);
  opacity: 0.75;
}
.door.locked:hover { transform: none; }

/* Vergangene Türchen treten weiter zurück als noch kommende -
   der Blick soll beim heutigen Türchen landen. */
.door.locked.past { opacity: 0.42; }
.door.locked.past::after { opacity: 0.35; }

.door.locked::after {
  content: "";
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  opacity: 0.55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2382a0ac' stroke-width='2'%3E%3Crect x='4' y='10' width='16' height='10' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}

.door.today {
  background: linear-gradient(160deg, var(--line-orange), #c94f04);
  color: #fff8f0;
  box-shadow: 0 0 0 2px rgba(255, 179, 71, 0.5), 0 6px 20px rgba(232, 99, 12, 0.45);
  animation: pulse-glow 2.4s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,179,71,0.5), 0 6px 20px rgba(232,99,12,0.45); }
  50% { box-shadow: 0 0 0 4px rgba(255,179,71,0.65), 0 10px 28px rgba(232,99,12,0.6); }
}

.door.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------------- Countdown ---------------- */

.countdown { margin-top: 18px; }
.countdown[hidden] { display: none; }

.countdown-title {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--slate);
}

.countdown-units {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.cd-unit {
  min-width: 56px;
  padding: 8px 6px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(130, 160, 170, 0.22);
}

.cd-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--foam);
  /* Gleichbreite Ziffern, damit der Countdown beim Ticken nicht zappelt */
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.cd-label {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--slate);
}

/* ---------------- Teaser ---------------- */

.teaser {
  max-width: 520px;
  margin: 8px auto 30px;
  padding: 24px 22px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(23, 64, 79, 0.75), rgba(18, 50, 65, 0.6));
  border: 1px solid rgba(255, 179, 71, 0.22);
  text-align: center;
}
.teaser[hidden] { display: none; }

.teaser-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--foam);
}

.teaser-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--slate);
}

/* ---------------- Ohne JavaScript ---------------- */

.noscript {
  max-width: 480px;
  margin: 80px auto 0;
  padding: 0 20px;
  text-align: center;
  color: var(--foam);
  line-height: 1.5;
}

/* ---------------- Fußbereich ---------------- */

.site-footer {
  max-width: 480px;
  margin: 44px auto 0;
  text-align: center;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.6;
  padding: 0 20px;
}
.site-footer a { color: var(--glow-amber); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------------- Popup ---------------- */

.modal {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(6, 14, 18, 0.82);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(165deg, #16303c, var(--water-mid));
  border-radius: 20px;
  padding: 36px 24px 28px;
  text-align: center;
  border: 1px solid rgba(255, 179, 71, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Schließen-Knopf mit ausreichend großer Trefferfläche für Finger */
.modal-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--slate);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 10px;
  font-family: inherit;
}
.modal-close:hover { color: var(--foam); }
.modal-close:focus-visible {
  outline: 2px solid var(--glow-amber);
  outline-offset: 2px;
}

.modal-day {
  color: var(--glow-amber);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px;
}

.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--water-deep);
  border: 1px dashed rgba(255, 179, 71, 0.5);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.code-box code {
  /* Monospace nur hier: macht den Code eindeutig ablesbar
     (Null vs. O, 1 vs. l) beim Abtippen */
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--glow-amber);
  word-break: break-all;
  text-align: left;
}

.copy-btn {
  background: rgba(255, 179, 71, 0.15);
  border: 1px solid rgba(255, 179, 71, 0.4);
  color: var(--glow-amber);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
}
.copy-btn:hover { background: rgba(255, 179, 71, 0.25); }

/* Die Aktion des Tages: das Wichtigste im Popup nach dem Code selbst */
.modal-action {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--foam);
}

/* Ausschluss-Hinweis (Bekleidung) - gut lesbar, aber zurückhaltend */
.exclusion {
  margin: -8px 0 16px;
  font-size: 12px;
  color: var(--slate);
}

/* Gültigkeitshinweis direkt unter dem Code - erzeugt Dringlichkeit,
   ohne dem Shop-Knopf die Aufmerksamkeit zu nehmen. */
.validity {
  margin: -8px 0 16px;
  font-size: 12.5px;
  color: var(--glow-amber);
  opacity: 0.9;
}

.shop-btn {
  display: block;
  width: 100%;
  background: var(--line-orange);
  color: #fff8f0;
  text-decoration: none;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 15px;
  transition: background 0.2s ease;
}
.shop-btn:hover { background: #c94f04; }

/* Teilen-Knopf: zurückhaltender als der Shop-Knopf, damit die
   Reihenfolge klar bleibt - erst einlösen, dann weitersagen. */
.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  min-height: 44px;
  padding: 11px 18px;
  background: transparent;
  border: 1px solid rgba(130, 160, 170, 0.45);
  border-radius: 10px;
  color: var(--slate);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.share-btn:hover {
  color: var(--foam);
  border-color: var(--foam);
}
.share-btn:focus-visible {
  outline: 2px solid var(--glow-amber);
  outline-offset: 2px;
}
.share-btn svg { flex: none; }

/* ---- Teilen-Auswahl ---- */

.share-panel {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(130, 160, 170, 0.2);
}
.share-panel[hidden] { display: none; }

.share-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.share-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 74px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid rgba(130, 160, 170, 0.28);
  background: rgba(255, 255, 255, 0.03);
  color: var(--slate);
  font-family: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.share-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(244, 246, 245, 0.45);
  color: var(--foam);
}

.share-item:focus-visible {
  outline: 2px solid var(--glow-amber);
  outline-offset: 2px;
}

/* Die Markenfarbe erscheint erst beim Darüberfahren - so bleibt das
   Raster ruhig und der orange Shop-Knopf darüber der Blickfang. */
.share-item .share-icon { line-height: 0; }
.share-whatsapp:hover .share-icon { color: #25d366; }
.share-telegram:hover .share-icon { color: #29a9eb; }
.share-facebook:hover .share-icon { color: #4267b2; }
.share-email:hover .share-icon,
.share-sms:hover .share-icon,
.share-copy:hover .share-icon { color: var(--glow-amber); }

.share-name { line-height: 1.2; text-align: center; }

.share-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--slate);
  opacity: 0.8;
}
.share-hint.is-active {
  color: var(--glow-amber);
  opacity: 1;
}

.modal-note {
  margin: 14px 0 0;
  color: var(--slate);
  font-size: 13px;
  line-height: 1.5;
}

/* ---------------- Luftblasen beim Öffnen ---------------- */

#bubble-layer {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

.bubble {
  position: absolute;
  bottom: -20px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), rgba(255,179,71,0.5));
  animation: rise 1.6s ease-in forwards;
}

@keyframes rise {
  0% { transform: translateY(0) scale(0.6); opacity: 0.9; }
  100% { transform: translateY(-70vh) scale(1.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .door, .door.today, .bubble, .shop-btn, .copy-btn {
    animation: none !important;
    transition: none !important;
  }
}
