/* ============================================================
   Adventskalender – Design
   Farben kannst du hier oben ganz einfach anpassen.
   ============================================================ */

@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Great Vibes"; src: url("../fonts/great-vibes-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("../fonts/nunito-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --night: #120d18;
  --plum: #3a1a2c;
  --red: #a11f30;
  --red-deep: #6f1322;
  --green: #22523e;
  --green-deep: #153528;
  --cream: #f8eedc;
  --paper: #fdf8ef;
  --gold: #d6aa52;
  --gold-soft: #efd99c;
  --ink: #3b2626;
  --ink-soft: #6c5552;
  --radius: 14px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --script: "Great Vibes", "Snell Roundhand", cursive;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #0b0a12; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(214,170,82,.18), transparent 60%),
    radial-gradient(900px 600px at 10% 30%, rgba(161,31,48,.22), transparent 65%),
    radial-gradient(900px 600px at 90% 60%, rgba(34,82,62,.25), transparent 65%),
    linear-gradient(180deg, #2a1424 0%, var(--night) 55%, #0b0a12 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.script { font-family: var(--script); font-weight: 400; }

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* ---------- Lichterkette ---------- */
.lights { position: absolute; top: 0; left: 0; right: 0; height: 70px; pointer-events: none; z-index: 1; }
.lights svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bulb {
  position: absolute; width: 11px; height: 17px; margin-left: -5.5px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c);
  box-shadow: 0 0 10px 3px var(--c), 0 0 24px 6px color-mix(in srgb, var(--c) 45%, transparent);
  animation: twinkle var(--t, 3s) ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.bulb::before { content: ""; position: absolute; top: -5px; left: 2.5px; width: 6px; height: 6px; background: #3b3328; border-radius: 2px; }
@keyframes twinkle { 0%,100% { opacity: 1; } 50% { opacity: .45; box-shadow: 0 0 4px 1px var(--c); } }

/* ---------- Kopfbereich ---------- */
.hero { position: relative; z-index: 2; text-align: center; padding: 90px 20px 24px; }
.hero-kicker {
  margin: 0; font-family: var(--serif); font-style: italic; letter-spacing: .08em;
  color: var(--gold-soft); font-size: 1.05rem;
}
.hero-title {
  margin: 6px 0 4px; font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.15;
  color: var(--paper); text-shadow: 0 2px 30px rgba(214,170,82,.25);
}
.hero-title .script { font-size: 1.45em; color: var(--gold-soft); padding: 0 .1em; display: inline-block; transform: translateY(.06em); }
.hero-sub { margin: 6px auto 0; max-width: 34rem; color: #e9dcc8; opacity: .9; }
.countdown {
  display: inline-block; margin: 20px 0 0; padding: 7px 18px; border-radius: 999px;
  background: rgba(253,248,239,.08); border: 1px solid rgba(214,170,82,.35);
  color: var(--gold-soft); font-size: .95rem; min-height: 1.6em;
}
.countdown:empty { display: none; }
.preview-banner {
  position: relative; z-index: 5; background: var(--gold); color: #2b1d0e; text-align: center;
  padding: 8px 14px; font-size: .9rem; font-weight: 700;
}
.preview-banner a { color: #2b1d0e; }

/* ---------- Kalender-Raster ---------- */
main { position: relative; z-index: 2; padding: 10px 16px 40px; }
.calendar {
  max-width: 1080px; margin: 0 auto;
  display: grid; gap: 14px;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 128px;
  grid-auto-flow: dense;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(253,248,239,.07), rgba(253,248,239,.02));
  border: 1px solid rgba(214,170,82,.25);
  box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 0 0 6px rgba(0,0,0,.12);
}
.loading { grid-column: 1 / -1; text-align: center; color: var(--gold-soft); font-style: italic; align-self: center; }

.door { position: relative; perspective: 1400px; cursor: pointer; border-radius: var(--radius); outline: none; }
.door.wide { grid-column: span 2; }
.door.tall { grid-row: span 2; }
.door.big  { grid-column: span 2; grid-row: span 2; }

/* Das, was hinter der Tür liegt */
.door-inside {
  position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fff6e3, #ecd9b6);
  box-shadow: inset 0 0 0 2px rgba(110,70,30,.2), inset 0 6px 18px rgba(0,0,0,.25);
  display: grid; place-items: center; color: var(--red);
}
.door-inside .thumb { position: absolute; inset: 0; background-size: cover; background-position: center; }
.door-inside .inside-heart { font-size: 2rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,.15)); }
.door-inside .inside-num {
  position: absolute; bottom: 6px; right: 9px; font-family: var(--serif); font-weight: 700; font-size: .95rem;
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* Die Tür selbst */
.door-front {
  position: absolute; inset: 0; border-radius: var(--radius);
  transform-origin: left center; transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.2,.7,.2,1);
}
.door-front .face {
  position: absolute; inset: 0; border-radius: var(--radius);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.door-front .face-front {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 6px 16px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.18);
  overflow: hidden;
}
/* gestickter Rand + feines Muster */
.door-front .face-front::before {
  content: ""; position: absolute; inset: 7px; border-radius: calc(var(--radius) - 5px);
  border: 1.5px dashed color-mix(in srgb, var(--fg) 55%, transparent);
  pointer-events: none;
}
.door-front .face-front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--fg) 18%, transparent) 1px, transparent 1.4px);
  background-size: 14px 14px; opacity: .55;
}
.door-front .face-back {
  transform: rotateY(180deg);
  background: linear-gradient(90deg, var(--bg-back), color-mix(in srgb, var(--bg-back) 70%, #000));
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.15);
}
.door-num {
  position: relative; z-index: 1;
  font-family: var(--serif); font-weight: 700; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.18);
}
.door.big .door-num { font-size: clamp(3rem, 8vw, 4.6rem); }
.door-icon { position: relative; z-index: 1; width: 26px; height: 26px; opacity: .9; }
.door.big .door-icon { width: 40px; height: 40px; }
.door-knob {
  position: absolute; right: 13px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 35% 35%, #fff3c9, var(--gold) 60%, #8a6522);
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
}

/* Farbvarianten */
.v-red   { --bg: linear-gradient(145deg, #b3283a, var(--red-deep)); --fg: var(--gold-soft); --bg-back: #5a0f1b; }
.v-green { --bg: linear-gradient(145deg, #2c664d, var(--green-deep)); --fg: var(--gold-soft); --bg-back: #0f281e; }
.v-cream { --bg: linear-gradient(145deg, #fffaf0, #eddcbf); --fg: var(--red); --bg-back: #cdb894; }
.v-gold  { --bg: linear-gradient(145deg, #e8c574, #b98a35); --fg: #5a1520; --bg-back: #8c6626; }
.v-plum  { --bg: linear-gradient(145deg, #5b2a44, #2f1424); --fg: #f3d9a4; --bg-back: #220d19; }

/* Hover / Fokus */
.door:hover .door-front, .door:focus-visible .door-front { transform: rotateY(-8deg); }
.door:focus-visible { box-shadow: 0 0 0 3px var(--gold-soft); }

/* Offen */
.door.open .door-front, .door.open:hover .door-front { transform: rotateY(-78deg); }
.door.open { z-index: 2; }

/* Gesperrt: leichtes Wackeln beim Klick */
.door.shake .door-front { animation: shake .5s ease; }
@keyframes shake { 20% { transform: rotateY(-6deg) translateX(-3px); } 40% { transform: translateX(3px); } 60% { transform: rotateY(-4deg) translateX(-2px); } 80% { transform: translateX(2px); } }

/* Heute */
.door.today .face-front { box-shadow: 0 0 0 2px var(--gold-soft), 0 0 26px 4px rgba(239,217,156,.55), 0 6px 16px rgba(0,0,0,.35); animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px var(--gold-soft), 0 0 40px 10px rgba(239,217,156,.75), 0 6px 16px rgba(0,0,0,.35); } }
.today-ribbon {
  position: absolute; z-index: 3; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #3b1a0e; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.35); pointer-events: none; white-space: nowrap;
}
.door.open .today-ribbon { display: none; }

/* Herzchen, die beim Öffnen aufsteigen */
.float-heart {
  position: fixed; z-index: 60; pointer-events: none; font-size: 18px; color: #ff6b81;
  animation: floatUp 1.6s ease-out forwards;
}
@keyframes floatUp { 0% { opacity: 0; transform: translate(0,0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), -140px) scale(1.2) rotate(var(--rot)); } }

/* ---------- Fußbereich ---------- */
.footer { position: relative; z-index: 2; text-align: center; padding: 10px 20px 140px; }
.footer::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0 70 Q150 30 300 62 T600 58 T900 50 T1200 64 V120 H0Z' fill='%23f3ecf2' fill-opacity='.10'/%3E%3Cpath d='M0 90 Q200 60 400 86 T800 80 T1200 88 V120 H0Z' fill='%23f3ecf2' fill-opacity='.16'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
.signature { font-size: 2.1rem; color: var(--gold-soft); margin: 10px 0 4px; line-height: 1.2; }
.link-btn { background: none; border: 0; color: #d9c8b4; text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: .9rem; cursor: pointer; opacity: .8; }
.link-btn:hover { opacity: 1; }

/* ---------- Fenster (Modal) ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10,6,12,.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .3s ease; }
.card {
  position: relative; width: min(600px, 100%); max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px); overflow-y: auto;
  background: var(--paper); color: var(--ink);
  border-radius: 20px; padding: 34px 30px 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6), inset 0 0 0 1px rgba(214,170,82,.6), inset 0 0 0 8px var(--paper), inset 0 0 0 9px rgba(214,170,82,.45);
  animation: pop .45s cubic-bezier(.2,.9,.3,1.2);
  overscroll-behavior: contain;
}
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes fade { from { opacity: 0; } }
.card-close {
  position: absolute; top: 12px; right: 14px; width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: rgba(161,31,48,.08); color: var(--red); font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.card-close:hover { background: rgba(161,31,48,.16); }
.card-day { text-align: center; font-family: var(--script); font-size: 1.9rem; color: var(--gold); line-height: 1.1; margin-bottom: 8px; }
.card-image { margin: 8px auto 18px; padding: 10px 10px 34px; background: #fff; box-shadow: 0 8px 24px rgba(60,30,20,.22); transform: rotate(-1.2deg); max-width: 92%; width: fit-content; }
.card-image img { display: block; max-width: 100%; max-height: 52vh; height: auto; margin: 0 auto; }
.card-title { font-family: var(--serif); font-weight: 400; text-align: center; color: var(--red-deep); font-size: 1.75rem; line-height: 1.25; margin: 4px 0 10px; }
.card-title:empty { display: none; }
.card-text { white-space: pre-line; text-align: center; font-size: 1.08rem; color: var(--ink); }
.card-text.quote { font-family: var(--serif); font-style: italic; font-size: 1.2rem; }
.card-text:empty { display: none; }
.card-music { margin: 20px 0 6px; }
.card-music iframe { display: block; width: 100%; border: 0; border-radius: 12px; background: #eee3cf; }
.card-music .ratio { position: relative; aspect-ratio: 16 / 9; }
.card-music .ratio iframe { position: absolute; inset: 0; height: 100%; }
.card-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.card-links:empty { display: none; }
.btn-primary, .btn-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary { background: linear-gradient(145deg, #b3283a, var(--red-deep)); color: #fff6e6; box-shadow: 0 6px 16px rgba(111,19,34,.35); }
.btn-link { background: #fff; color: var(--red-deep); box-shadow: inset 0 0 0 1.5px rgba(161,31,48,.35); }
.btn-primary:hover, .btn-link:hover { transform: translateY(-1px); }
.card-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding-top: 12px; border-top: 1px dashed rgba(214,170,82,.5); }
.nav-btn { background: none; border: 0; color: var(--ink-soft); font: inherit; font-size: .92rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.nav-btn:hover:not(:disabled) { color: var(--red); background: rgba(161,31,48,.06); }
.nav-btn:disabled { visibility: hidden; }
.card-heart { color: var(--red); font-size: 1.1rem; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } }
.empty-note { text-align: center; color: var(--ink-soft); font-style: italic; }

.card-welcome { text-align: center; }
.welcome-ornament { color: var(--gold); letter-spacing: .4em; margin-bottom: 4px; }
.card-welcome .card-title { font-family: var(--script); font-size: 2.8rem; color: var(--red-deep); }
.card-welcome .signature { color: var(--gold); margin: 18px 0 18px; }

/* ---------- Hinweis-Bläschen ---------- */
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: 26px; transform: translate(-50%, 30px);
  background: var(--paper); color: var(--ink); padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); font-weight: 700; opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s ease; max-width: calc(100% - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Kleinere Bildschirme ---------- */
@media (max-width: 820px) {
  .calendar { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 112px; gap: 12px; padding: 14px; }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .hero { padding-top: 76px; }
  .calendar { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 100px; gap: 10px; padding: 10px; border-radius: 18px; }
  .card { padding: 30px 18px 18px; }
  .card-title { font-size: 1.5rem; }
  .door-knob { right: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
