/* ==========================================================================
   Musikalischer Adventskalender – Dorfkirche Spiez
   Die Farben sind aus Marinas Zeichnung entnommen.
   ========================================================================== */

:root {
  /* Aus der Zeichnung gemessen */
  --ultramarin:   #1d316e;
  --nacht:        #142354;
  --nacht-tief:   #0e1938;
  --schnee:       #eaf0f8;
  --schnee-matt:  #a6b7d6;
  --tanne:        #1e5b2e;

  /* Aus dem Logo der Kirchgemeinde */
  --orange:       #ef8a00;
  --orange-hell:  #ffb23f;
  --gold:         #f6c76b;

  --papier:       #f7f3ec;

  --rand:         14px;
  --spalte:       1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--schnee);
  background: var(--nacht);
  background-image:
    radial-gradient(ellipse 130% 70% at 50% -8%, var(--ultramarin) 0%, transparent 62%),
    radial-gradient(ellipse 90% 50% at 12% 6%, #2a4384 0%, transparent 58%);
  background-attachment: fixed;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: Alegreya, Georgia, serif;
  font-weight: 700;
  line-height: 1.12;
  margin: 0 0 .4em;
}

a { color: var(--gold); }
a:hover { color: var(--orange-hell); }

:focus-visible { outline: 3px solid var(--orange-hell); outline-offset: 3px; border-radius: 4px; }

.visuell-versteckt {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Schneeflocken ------------------------------------------------------ */

.schnee {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(2px 2px at 12% 20%, rgba(255,255,255,.7), transparent),
    radial-gradient(2px 2px at 68% 42%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.5px 1.5px at 34% 75%, rgba(255,255,255,.6), transparent),
    radial-gradient(2px 2px at 88% 12%, rgba(255,255,255,.45), transparent),
    radial-gradient(1.5px 1.5px at 52% 90%, rgba(255,255,255,.55), transparent),
    radial-gradient(2px 2px at 5% 60%, rgba(255,255,255,.4), transparent);
  background-size: 420px 420px;
  animation: rieseln 26s linear infinite;
  opacity: .75;
}
@keyframes rieseln { from { background-position: 0 -420px; } to { background-position: 0 0; } }

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

.kopf {
  position: relative; z-index: 1;
  max-width: var(--spalte); margin: 0 auto;
  padding: 2.8rem var(--rand) 1.2rem;
  text-align: center;
}
.kopf__ort {
  margin: 0 0 .5rem; font-size: 1rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--orange-hell);
}
.kopf__titel {
  font-size: clamp(2.1rem, 8vw, 3.6rem);
  text-shadow: 0 2px 24px rgba(14,25,56,.9);
}
.kopf__unter { max-width: 34rem; margin: 0 auto; color: var(--schnee-matt); font-size: 1.05rem; }

/* --- Die gemalte Zeichnung ---------------------------------------------- */

.bild {
  position: relative; z-index: 1;
  max-width: var(--spalte); margin: 1.5rem auto 0;
  padding: 0 var(--rand);
}
.bild__rahmen {
  position: relative;
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(6,12,30,.55);
}
.bild__foto { display: block; width: 100%; height: auto; }
.bild__tueren { position: absolute; inset: 0; }

/* Auf dem Handy traegt das Bild keine Tuerchen: zu klein zum Tippen. */
@media (max-width: 819px) {
  .bild__tueren { display: none; }
}

/* Auf grossen Bildschirmen traegt das Bild die Tuerchen,
   das Raster darunter entfaellt. */
@media (min-width: 820px) {
  .kalender { display: none; }
  .kopf { padding-bottom: .4rem; }
  .kopf__titel { font-size: 2.6rem; }
}

/* --- Heute-Leiste ------------------------------------------------------- */

.heute {
  position: relative; z-index: 1;
  max-width: 40rem; margin: 1.8rem auto 2.2rem;
  padding: 0 var(--rand); text-align: center;
}
.heute__kasten {
  border: 1px solid rgba(246,199,107,.42);
  border-radius: 10px;
  background: rgba(29,49,110,.55);
  padding: 1.1rem 1.3rem;
}
.heute__datum {
  margin: 0; font-size: .95rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--gold);
}
.heute__zeit {
  font-family: Alegreya, Georgia, serif; font-size: 1.9rem;
  font-weight: 700; margin: .15rem 0 .1rem;
}
.heute__hinweis { margin: 0; color: var(--schnee-matt); font-size: .98rem; }
.heute__knopf {
  display: inline-block; margin-top: .9rem; padding: .6rem 1.5rem;
  border: none; border-radius: 999px; background: var(--orange);
  color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.heute__knopf:hover { background: var(--orange-hell); }

/* --- Das Raster (Handy) ------------------------------------------------- */

main {
  position: relative; z-index: 1;
  max-width: var(--spalte); margin: 0 auto; padding: 0 var(--rand);
}
.kalender { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 620px) { .kalender { grid-template-columns: repeat(6, 1fr); gap: 14px; } }

/* --- Ein Tuerchen, gemeinsame Teile ------------------------------------- */

.tuerchen {
  position: relative; perspective: 800px;
  border: 0; padding: 0; background: none; font: inherit; color: inherit;
  cursor: default;
}
.tuerchen--raster { aspect-ratio: 3 / 4; }

.tuerchen__nische {
  position: absolute; inset: 0;
  border-radius: 6px; overflow: hidden;
  background: #050b16;
  background-image: radial-gradient(circle at 84% 50%, #8a5f22 0%, #33220e 48%, #050b16 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .25s;
}
.tuerchen__vorschau {
  width: 100%; height: 100%; object-fit: cover;
  object-position: 78% center; display: block;
}
.tuerchen__note { font-size: 1.7rem; color: var(--gold); opacity: .65; }

.tuerchen__tuer {
  position: absolute; inset: 0;
  border-radius: 6px;
  border: 1px solid rgba(166,183,214,.45);
  background: linear-gradient(150deg, #27417f 0%, #1b2f66 55%, #16264f 100%);
  transform-origin: left center; transform: rotateY(0deg);
  transition: transform .55s cubic-bezier(.3,.7,.3,1), box-shadow .3s;
  backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.tuerchen__zahl {
  font-family: Alegreya, Georgia, serif; font-weight: 700;
  font-size: clamp(1.35rem, 5.5vw, 2.1rem);
  color: var(--schnee-matt);
}

/* --- Zustaende ---------------------------------------------------------- */

.tuerchen--zu { cursor: not-allowed; }
.tuerchen--zu .tuerchen__nische { opacity: 0; }
.tuerchen--zu .tuerchen__tuer { opacity: .7; }

.tuerchen--heute { cursor: pointer; }
.tuerchen--heute .tuerchen__nische { opacity: 0; }
.tuerchen--heute .tuerchen__tuer {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(246,199,107,.35), 0 0 26px rgba(246,199,107,.5);
  animation: kerze 3.4s ease-in-out infinite;
}
.tuerchen--heute .tuerchen__zahl { color: var(--gold); }
.tuerchen--heute:hover .tuerchen__tuer { transform: rotateY(-14deg); }

@keyframes kerze {
  0%, 100% { box-shadow: 0 0 0 2px rgba(246,199,107,.3), 0 0 18px rgba(246,199,107,.35); }
  50%      { box-shadow: 0 0 0 2px rgba(246,199,107,.45), 0 0 30px rgba(246,199,107,.65); }
}

.tuerchen--vorbei { cursor: pointer; }
.tuerchen--vorbei .tuerchen__tuer { transform: rotateY(-32deg); }
.tuerchen--vorbei .tuerchen__zahl { color: var(--schnee); }
.tuerchen--vorbei:hover .tuerchen__tuer { transform: rotateY(-44deg); }

.tuerchen--offen .tuerchen__tuer { transform: rotateY(-108deg); animation: none; }
.tuerchen--offen .tuerchen__nische { opacity: 1; }

/* --- Tuerchen auf der Zeichnung ----------------------------------------- */

.tuerchen--bild {
  position: absolute;
  width: 9.4%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}
.tuerchen--bild .tuerchen__tuer {
  border-radius: 4px;
  border-color: rgba(255,255,255,.5);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
/* Noch nicht dran und heute: durchscheinender Schleier,
   damit Marinas gemalte Zahl sichtbar bleibt. */
.tuerchen--bild.tuerchen--zu .tuerchen__tuer,
.tuerchen--bild.tuerchen--heute .tuerchen__tuer {
  background: rgba(233,240,250,.14);
  opacity: 1;
}
.tuerchen--bild.tuerchen--zu .tuerchen__zahl,
.tuerchen--bild.tuerchen--heute .tuerchen__zahl { display: none; }

/* Vergangene Tage: ebenfalls durchscheinend, damit die Zeichnung
   sichtbar bleibt. Die offene Tuer gibt den Blick aufs Foto frei. */
.tuerchen--bild.tuerchen--vorbei .tuerchen__tuer {
  background: rgba(233,240,250,.16);
  box-shadow: 5px 0 16px rgba(8,15,38,.5),
              inset 3px 0 0 rgba(246,199,107,.75),
              inset 0 0 0 1px rgba(255,255,255,.14);
}
.tuerchen--bild.tuerchen--vorbei .tuerchen__zahl { display: none; }
.tuerchen--bild.tuerchen--vorbei .tuerchen__nische { opacity: .92; }
.tuerchen--bild .tuerchen__zahl { font-size: clamp(.9rem, 1.5vw, 1.5rem); }

/* Auf der Zeichnung: Ist kein Foto hinterlegt, bleibt die Nische leer
   und die geoeffnete Tuer gibt den Blick auf das Gemalte frei. */
.tuerchen--bild .tuerchen__nische--leer {
  background: none;
  background-image: none;
}

/* --- Meldungen ---------------------------------------------------------- */

.meldung {
  max-width: 36rem; margin: 2rem auto 0;
  padding: 1rem 1.2rem; border-left: 3px solid var(--orange);
  background: rgba(29,49,110,.5); color: var(--schnee-matt);
  border-radius: 0 6px 6px 0;
}
.meldung:empty { display: none; }

/* --- Die aufgeschlagene Tafel ------------------------------------------- */

.ueberlagerung {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--rand); overflow-y: auto;
  background: rgba(8,15,38,.84); backdrop-filter: blur(3px);
}
.ueberlagerung[hidden] { display: none; }

.tafel {
  position: relative; width: 100%; max-width: 40rem; margin: auto;
  background: var(--papier); color: #23303f;
  border-radius: 10px; padding: 2rem 1.6rem 2.2rem;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  animation: auftauchen .3s ease-out;
}
@keyframes auftauchen { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.tafel__schliessen {
  position: absolute; top: .4rem; right: .6rem;
  width: 2.4rem; height: 2.4rem; border: 0; background: none;
  font-size: 1.9rem; line-height: 1; color: #8a9099; cursor: pointer;
}
.tafel__schliessen:hover { color: #23303f; }

.tafel__tag {
  margin: 0; font-size: .95rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--orange);
}
.tafel__titel { font-size: clamp(1.6rem, 5vw, 2.2rem); color: #1a2432; margin: .15rem 0 .1rem; }
.tafel__untertitel { margin: 0 0 .4rem; font-size: 1.12rem; color: #5a6472; }
.tafel__wann {
  margin: 0 0 1.3rem; padding-bottom: 1.1rem;
  border-bottom: 1px solid #e0d8cb; font-weight: 700; color: #23303f;
}
.tafel__inhalt p { margin: 0 0 1rem; }
.tafel__bild { width: 100%; height: auto; display: block; border-radius: 6px; margin: 0 0 .4rem; }
.tafel__bildtext { font-size: .92rem; color: #6b7480; margin: 0 0 1.2rem; }

/* --- Info und Fuss ------------------------------------------------------ */

.info {
  position: relative; z-index: 1;
  max-width: var(--spalte); margin: 3.5rem auto 0;
  padding: 2.4rem var(--rand);
  display: grid; gap: 2rem;
  border-top: 1px solid rgba(166,183,214,.25);
}
@media (min-width: 720px) { .info { grid-template-columns: 1.6fr 1fr; gap: 3rem; } }

.info h2 { font-size: 1.5rem; color: var(--gold); }
.info p { color: var(--schnee-matt); max-width: 38rem; }
.info__baum { font-style: italic; }
.info__dank { font-size: .95rem; color: var(--schnee-matt); opacity: .85; }
.info__kontakt p { margin-bottom: 1.1rem; }

.fuss {
  position: relative; z-index: 1;
  background: var(--papier); color: #4a5460;
  text-align: center; padding: 2.2rem var(--rand) 2.4rem; margin-top: 3rem;
}
.fuss__logo { width: 200px; height: auto; margin-bottom: 1rem; mix-blend-mode: multiply; }
.fuss__adresse { margin: 0; font-size: .95rem; line-height: 1.7; }
.fuss a { color: #b56a00; }
.fuss a:hover { color: var(--orange); }

/* --- Ruhigere Darstellung ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .schnee { animation: none; opacity: .5; }
  .tuerchen__tuer { transition: none; }
  .tuerchen--heute .tuerchen__tuer { animation: none; }
  .tafel { animation: none; }
}
