/* Adventskalender „Kleine Anker im Advent“ – Familie in Balance
   Keine externen Schriften oder Dienste: alles liegt lokal. */

@font-face {
  font-family: "Sacramento";
  src: url("../fonts/Sacramento-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --papier: #fffefb;
  --schnee: #f6f8f5;
  --salbei: #b7d4bf;
  --salbei-zart: #e3efe6;
  --salbei-tief: #46644f;
  --petrol: #1d8a8c;
  --gold: #b98a2c;
  --gold-hell: #e6c975;
  --wein: #8c1d2e;
  --wein-tief: #6d1423;
  --rose: #f4dedb;
  --tinte: #2d3631;
  --tinte-weich: #5b6660;

  --schrift-hand: "Sacramento", "Snell Roundhand", "Segoe Script", cursive;
  --schrift-text: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Roboto, system-ui, sans-serif;

  --rand: 16px;
  --radius-tuer: 6px;
  --dauer-tuer: 700ms;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--tinte);
  font-family: var(--schrift-text);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

[hidden] { display: none !important; }

a { color: var(--salbei-tief); }

:focus-visible {
  outline: 3px solid var(--petrol);
  outline-offset: 3px;
}

.sprunglink {
  position: absolute;
  left: var(--rand);
  top: -100px;
  background: var(--tinte);
  color: #fff;
  padding: .5em 1em;
  border-radius: 4px;
  z-index: 50;
}
.sprunglink:focus { top: 8px; }

/* ---------- Kopf ---------- */

.kopf {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px var(--rand) 8px;
  text-align: center;
}

.kopf__bild {
  max-width: 600px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(140, 29, 46, .08), 0 18px 40px -24px rgba(109, 20, 35, .45);
}

.kopf__titel {
  margin: 28px 0 0;
  font-family: var(--schrift-hand);
  font-weight: 400;
  font-size: clamp(2.75rem, 11vw, 4.5rem);
  line-height: 1.05;
  color: var(--wein);
}

.anker {
  display: inline-block;
  width: .5em;
  height: .5em;
  vertical-align: -.02em;
  margin-left: .1em;
}

.kopf__unterzeile {
  margin: 6px 0 0;
  font-size: 1.125rem;
  letter-spacing: .01em;
  color: var(--salbei-tief);
}

/* ---------- Vortext ---------- */

.vortext {
  width: calc(100% - 2 * var(--rand));
  max-width: 40rem;
  margin: 26px auto 28px;
  padding: 24px 20px 22px;
  background: #fff;
  border: 1px solid var(--salbei-zart);
  border-top: 3px solid var(--salbei);
  border-radius: 14px;
  font-size: 1rem;
  line-height: 1.6;
}
@media (min-width: 560px) { .vortext { padding: 32px 40px 30px; font-size: 1.0625rem; line-height: 1.65; } }

.vortext p { margin: 0 0 .85em; max-width: 38em; }

.vortext__titel {
  margin: 0 0 .7em;
  font-family: var(--schrift-text);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--salbei-tief);
  text-wrap: balance;
}

.vortext__einleitung { margin-bottom: .4em !important; font-weight: 600; color: var(--tinte); }

.vortext__liste {
  list-style: none;
  margin: 0 0 1.1em;
  padding: 0;
}
.vortext__liste li {
  display: grid;
  grid-template-columns: 1.9em 1fr;
  align-items: baseline;
  padding: .2em 0;
}
.vortext__symbol { font-size: 1.05em; }

.vortext__schluss {
  margin: 0 !important;
  padding-top: .9em;
  border-top: 1px solid var(--salbei-zart);
  font-weight: 600;
  color: var(--wein);
}

.vortext__weiter {
  display: none;
  margin-top: 16px;
  padding: 8px 0;
  color: var(--salbei-tief);
  font-weight: 600;
}
@media (max-width: 559px) { .vortext__weiter { display: inline-block; } }

/* ---------- Kalender ---------- */

.kalender {
  max-width: 1040px;
  margin: 0 auto;
  padding: 8px var(--rand) 48px;
}
.kalender:focus { outline: none; }

.hinweis {
  max-width: 34em;
  margin: 18px auto 26px;
  text-align: center;
  color: var(--tinte-weich);
}
.hinweis strong { color: var(--wein); font-weight: 600; }

.tueren {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 10px;
}

@media (min-width: 560px) {
  .tueren { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 900px) {
  .tueren { gap: 18px; }
}

/* Türchen 24 ist das große Tor: 2×2 Felder auf dem Handy, 2 Felder breit ab Tablet.
   So geht das Raster immer ohne Lücke auf (23 + 4 = 27 = 9×3, 23 + 2 = 25 = 5×5). */
.tueren > li.ist-gross { grid-column: span 2; grid-row: span 2; }
@media (min-width: 560px) {
  .tueren > li.ist-gross { grid-row: span 1; }
}

.tuer {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 560 / 397;
  padding: 0;
  border: 0;
  border-radius: var(--radius-tuer);
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
  perspective: 900px;
  -webkit-tap-highlight-color: transparent;
}
.ist-gross .tuer { aspect-ratio: auto; height: 100%; min-height: 120px; }

/* Was hinter der Tür liegt */
.tuer__innen {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-tuer);
  overflow: hidden;
  background: var(--salbei-zart);
  box-shadow: inset 0 2px 8px rgba(45, 54, 49, .25);
}
.tuer__innen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Platzhalter, solange es kein Bild gibt */
.platzhalter {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .1em;
  background: url("../img/glitzer.svg") 0 0 / 140px 100px repeat, #fff;
  color: var(--salbei-tief);
  text-align: center;
}
.platzhalter svg { width: 34%; max-width: 64px; height: auto; color: var(--salbei-tief); opacity: .8; }
.platzhalter span { font-family: var(--schrift-hand); font-size: clamp(1.1rem, 4.5vw, 1.6rem); line-height: 1; }

/* Das Türblatt */
.tuer__blatt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-tuer);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform var(--dauer-tuer) cubic-bezier(.3, .7, .25, 1), box-shadow var(--dauer-tuer);
  box-shadow: 0 1px 2px rgba(45, 54, 49, .12), 0 6px 14px -8px rgba(45, 54, 49, .35);
  overflow: hidden;
  backface-visibility: hidden;
}

/* feine Goldkante und Goldstaub */
.tuer__blatt::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: .45;
  pointer-events: none;
}
.tuer__blatt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/glitzer.svg") 0 0 / 140px 100px repeat;
  opacity: .8;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.35) 45%, transparent 85%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.35) 45%, transparent 85%);
}

.tuer__zahl {
  position: relative;
  z-index: 1;
  font-family: var(--schrift-hand);
  font-size: clamp(2.1rem, 9.5vw, 3.4rem);
  line-height: 1;
  padding-right: .08em; /* Schreibschrift läuft nach rechts aus */
}
.ist-gross .tuer__zahl { font-size: clamp(2.8rem, 13vw, 4.6rem); }

/* Knauf */
.tuer__knauf {
  position: absolute;
  right: 9%;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset -1px -1px 1px rgba(0,0,0,.25);
}

/* Farbvarianten der Türen */
.farbe-salbei .tuer__blatt { background: var(--salbei); color: var(--salbei-tief); }
.farbe-rose   .tuer__blatt { background: var(--rose);   color: var(--wein); }
.farbe-weiss  .tuer__blatt { background: #fff;          color: var(--gold); box-shadow: inset 0 0 0 1px #eee6d6, 0 6px 14px -8px rgba(45, 54, 49, .3); }
.farbe-wein   .tuer__blatt { background: var(--wein);   color: var(--gold-hell); }
.farbe-tanne  .tuer__blatt { background: var(--salbei-tief); color: var(--gold-hell); }
.farbe-wein   .tuer__blatt::after,
.farbe-tanne  .tuer__blatt::after { opacity: 1; }

/* Tür steht offen */
.ist-offen .tuer__blatt {
  transform: rotateY(-104deg);
  box-shadow: none;
}

/* Heute dran (öffenbar, noch nicht geöffnet) */
.ist-heute .tuer {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.ist-heute .tuer:focus-visible { outline-color: var(--petrol); }

/* Hover nur bei echten Zeigegeräten */
@media (hover: hover) {
  .ist-bereit:not(.ist-offen) .tuer:hover .tuer__blatt { transform: rotateY(-14deg); }
}

/* Verschlossen: sanftes Wackeln */
.wackelt .tuer__blatt { animation: wackeln 520ms ease-in-out; }
@keyframes wackeln {
  0%, 100% { transform: rotateY(0) translateX(0); }
  20% { transform: rotateY(-7deg) translateX(-1px); }
  40% { transform: rotateY(3deg)  translateX(1px); }
  60% { transform: rotateY(-4deg); }
  80% { transform: rotateY(1deg); }
}

/* ---------- Meldung & Testmodus ---------- */

.meldung {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  max-width: calc(100vw - 2 * var(--rand));
  width: max-content;
  padding: .7em 1.15em;
  border-radius: 999px;
  background: var(--tinte);
  color: #fff;
  font-size: .95rem;
  text-align: center;
  opacity: 0;
  transition: transform 300ms ease, opacity 300ms ease;
  pointer-events: none;
  z-index: 40;
}
.meldung.ist-sichtbar { transform: translate(-50%, 0); opacity: 1; }

.testmodus {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 45;
  padding: .3em .75em;
  border-radius: 999px;
  background: #fff6d8;
  border: 1px dashed var(--gold);
  color: #6b4e12;
  font-size: .8rem;
  font-weight: 600;
}

/* ---------- Fenster (geöffnetes Türchen) ---------- */

.fenster {
  width: min(640px, calc(100vw - 2 * var(--rand)));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--tinte);
  box-shadow: 0 30px 80px -20px rgba(45, 54, 49, .55);
  overflow: hidden auto;
  overscroll-behavior: contain;
}
.fenster::backdrop {
  background: rgba(46, 60, 52, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.fenster[open] { animation: fenster-auf 360ms cubic-bezier(.2, .8, .2, 1); }
.fenster[open]::backdrop { animation: abdunkeln 360ms ease; }
@keyframes fenster-auf { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes abdunkeln { from { opacity: 0; } }

.fenster__karte { position: relative; }

/* Schließen-Knopf bleibt beim Scrollen langer Texte sichtbar */
.fenster__zu {
  position: sticky;
  top: 10px;
  z-index: 2;
  margin: 10px 10px -54px auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--tinte);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(45, 54, 49, .2);
}
.fenster__zu svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.fenster__bild img { width: 100%; aspect-ratio: 560 / 397; object-fit: cover; }
.fenster__bild .platzhalter { position: relative; aspect-ratio: 560 / 397; }
.fenster__bild .platzhalter svg { max-width: 96px; }
.fenster__bild .platzhalter span { font-size: 2.4rem; }

.fenster__inhalt { padding: 18px 24px 28px; }
@media (min-width: 560px) { .fenster__inhalt { padding: 22px 36px 34px; } }

.fenster__tag {
  margin: 0;
  font-size: .875rem;
  line-height: 1.4;
  color: var(--salbei-tief);
}

.fenster__titel {
  margin: 6px 0 0;
  font-family: var(--schrift-hand);
  font-weight: 400;
  font-size: clamp(2.1rem, 8.5vw, 2.75rem);
  line-height: 1.12;
  color: var(--wein);
  text-wrap: balance;
}

.fenster__text { margin-top: 12px; max-width: 36em; font-size: 1.0625rem; line-height: 1.65; hyphens: auto; -webkit-hyphens: auto; }
.fenster__text p { margin: 0 0 .9em; }
.fenster__text p:last-child { margin-bottom: 0; }

.fenster__link {
  display: inline-block;
  margin-top: 18px;
  padding: .75em 1.4em;
  border-radius: 999px;
  background: var(--salbei-tief);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.fenster__link:hover { background: var(--petrol); }

body.fenster-offen { overflow: hidden; }

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

.fuss {
  border-top: 1px solid var(--salbei-zart);
  background: var(--schnee);
  padding: 28px var(--rand) calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
}
@media (min-width: 1072px) {
  .fuss { padding-left: calc((100vw - 1040px) / 2 + var(--rand)); padding-right: calc((100vw - 1040px) / 2 + var(--rand)); }
}

.fuss__marke {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--tinte);
  text-decoration: none;
  line-height: 1.3;
}
.fuss__marke img { width: 56px; height: 56px; border-radius: 50%; clip-path: circle(48%); }
.fuss__marke small { color: var(--tinte-weich); font-size: .85rem; }

.fuss__links { display: flex; gap: 22px; }
.fuss__links a { color: var(--tinte-weich); padding: 10px 0; }

/* ---------- Weniger Bewegung ---------- */

@media (prefers-reduced-motion: reduce) {
  :root { --dauer-tuer: 0ms; }
  .wackelt .tuer__blatt { animation: none; }
  .fenster[open], .fenster[open]::backdrop { animation: none; }
  .meldung { transition: opacity 150ms linear; }
  .ist-bereit:not(.ist-offen) .tuer:hover .tuer__blatt { transform: none; }
}
