/* ==========================================================================
   Adventskalender „Antwort der Stadt“ — Komponente
   Alle Klassen mit Präfix ak- und unter .rsv-ak, damit die Komponente
   direkt in eine Seite der Webseite eingebettet werden kann.
   Farben aus dem Farbkonzept der Webseite (global.css), ergänzt um ein
   warmes Gold als Advents-Akzent.
   ========================================================================== */
.rsv-ak {
  --ak-blau: #14304f;
  --ak-blau-dunkel: #0d2138;
  --ak-blau-hell: #eaf0f6;
  --ak-rot: #c8102e;
  --ak-sand: #f7f5f0;
  --ak-text: #1e2430;
  --ak-rand: #d8dde3;
  --ak-gold: #f0cf7a;
  --ak-tuer-hell: #fbf6ea;
  --ak-tuer-dunkel: #efe4cb;
  --ak-radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ak-text);
  line-height: 1.6;
}
.rsv-ak *, .rsv-ak *::before, .rsv-ak *::after { box-sizing: border-box; }

/* ---------- Brett ---------- */
.ak-brett {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: clamp(1rem, 3vw, 1.8rem);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(240, 207, 122, 0.16), transparent 55%),
    linear-gradient(160deg, var(--ak-blau) 0%, var(--ak-blau-dunkel) 100%);
  color: #f5f7fa;
  isolation: isolate;
}
/* leiser Schneefall */
.ak-brett::before {
  content: "";
  position: absolute;
  inset: -200px 0 0 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90px 120px, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 160px 60px, rgba(255,255,255,.8) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 230px 170px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 60px 190px, rgba(255,255,255,.7) 50%, transparent 51%);
  background-size: 260px 200px;
  animation: ak-schnee 26s linear infinite;
}
@keyframes ak-schnee { to { transform: translateY(200px); } }

.ak-kopf { max-width: 46rem; margin-bottom: 1.2rem; }
.ak-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ak-gold);
}
.ak-titel {
  margin: 0 0 0.6rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 4.2vw, 2.3rem);
  line-height: 1.15;
  color: #fff;
}
.ak-einleitung p { margin: 0 0 0.5rem; font-size: 1.02rem; opacity: 0.92; }

/* Legende */
.ak-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}
.ak-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.6rem 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  background: var(--u-hell, #eef0f3);
  color: var(--u-farbe, #4a5361);
}
.ak-chip .ak-icon {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--u-farbe, #4a5361);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
}

/* ---------- Türchen-Raster ---------- */
.ak-raster {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(6.6rem, auto);
  grid-auto-flow: dense;
  gap: clamp(0.5rem, 1.4vw, 0.85rem);
}
@media (max-width: 52rem) { .ak-raster { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 34rem) { .ak-raster { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: minmax(6.2rem, auto); } }

/* Formate je Spaltenzahl so gewählt, dass das Raster lückenlos aufgeht:
   6 Spalten: 24 + 3 + 3 = 30 Zellen · 4 Spalten: + 2 breite = 32 · 3 Spalten: nur 24 groß = 27 */
.ak-tuer.ak-nr-24, .ak-tuer.ak-nr-12 { grid-column: span 2; grid-row: span 2; }
@media (max-width: 52rem) { .ak-tuer.ak-nr-6, .ak-tuer.ak-nr-13 { grid-column: span 2; } }
@media (max-width: 34rem) {
  .ak-tuer.ak-nr-12 { grid-column: auto; grid-row: auto; }
  .ak-tuer.ak-nr-6, .ak-tuer.ak-nr-13 { grid-column: auto; }
}

.ak-tuer {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  perspective: 2600px;
  container-type: inline-size;
  -webkit-tap-highlight-color: transparent;
}
.ak-tuer:focus-visible { outline: 3px solid var(--ak-gold); outline-offset: 3px; border-radius: 10px; }

/* Innenleben (hinter der Tür) */
.ak-innen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0.6rem 0.65rem 0.7rem;
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(0,0,0,.28), rgba(0,0,0,0) 40%),
    var(--u-hell, #eef0f3);
  border-top: 5px solid var(--u-farbe, #4a5361);
  color: var(--ak-text);
  box-shadow: inset 0 2px 10px rgba(0,0,0,.25);
}
.ak-innen-nr {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--u-farbe, #4a5361);
  opacity: 0.8;
}
.ak-innen-urteil {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding-right: 1.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--u-farbe, #4a5361);
  line-height: 1.25;
}
.ak-innen-icon {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--u-farbe, #4a5361);
  color: #fff;
  font-size: 0.68rem;
}
.ak-innen-label { display: none; }
.ak-innen-teaser {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.22;
  color: var(--ak-blau-dunkel);
}
@container (max-width: 7.5rem) {
  .ak-innen { padding: 0.45rem 0.5rem 0.55rem; }
  .ak-innen-teaser { font-size: 0.74rem; line-height: 1.18; }
}
@container (min-width: 10.5rem) {
  .ak-innen-label { display: inline; }
  .ak-innen-teaser { font-size: 0.92rem; -webkit-line-clamp: 4; }
}
@container (min-width: 16rem) {
  .ak-innen { padding: 0.9rem 1rem 1rem; }
  .ak-innen-urteil { font-size: 0.78rem; }
  .ak-innen-teaser { font-size: 1.15rem; -webkit-line-clamp: 5; }
}

/* Türflügel */
.ak-fluegel {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.3, 0.75, 0.2, 1);
}
.ak-front, .ak-rueck {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.ak-front {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.7), transparent 60%),
    linear-gradient(145deg, var(--ak-tuer-hell), var(--ak-tuer-dunkel));
  box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 8px 18px rgba(0,0,0,.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* Perforation wie beim echten Kalender */
.ak-front::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px dashed rgba(20, 48, 79, 0.25);
  border-radius: 6px;
}
.ak-front::after { /* kleiner Griff */
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 18px;
  margin-top: -9px;
  border-radius: 3px;
  background: rgba(20, 48, 79, 0.16);
}
.ak-rueck {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #e9dcbd, #dccb9f);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.ak-zahl {
  position: relative;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  line-height: 1;
  color: var(--ak-blau);
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}
@container (min-width: 16rem) { .ak-zahl { font-size: clamp(2.8rem, 8vw, 4.4rem); } }
.ak-nr-24 .ak-zahl { color: var(--ak-rot); }
.ak-zahl-datum {
  display: block;
  margin-top: 0.3rem;
  font-family: system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(20, 48, 79, 0.55);
  text-shadow: none;
}
.ak-schloss {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.ak-tuer:not(.ak-offen):not(.ak-gesperrt):hover .ak-front,
.ak-tuer:not(.ak-offen):not(.ak-gesperrt):focus-visible .ak-front {
  transform: translateY(-3px);
  box-shadow: 0 5px 0 rgba(0,0,0,.18), 0 14px 24px rgba(0,0,0,.32);
}
.ak-tuer.ak-offen { z-index: 2; }
.ak-tuer.ak-offen .ak-fluegel { transform: rotateY(-97deg); }
.ak-tuer.ak-offen:hover .ak-innen { filter: brightness(1.04); }
.ak-tuer.ak-gesperrt { cursor: not-allowed; }
.ak-tuer.ak-gesperrt:hover .ak-schloss { opacity: 0.7; }
.ak-tuer.ak-wackeln .ak-fluegel { animation: ak-wackeln 0.45s ease; }
@keyframes ak-wackeln {
  20% { transform: rotateY(-7deg); }
  45% { transform: rotateY(0deg); }
  70% { transform: rotateY(-4deg); }
  100% { transform: rotateY(0deg); }
}

/* Hinweis (z. B. „öffnet am 7. Dezember“) */
.ak-hinweis {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  z-index: 5;
  transform: translate(-50%, 1rem);
  max-width: calc(100% - 2rem);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  color: var(--ak-blau-dunkel);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.ak-hinweis.ak-sichtbar { opacity: 1; transform: translate(-50%, 0); }

.ak-fuss {
  margin: 1.1rem 0 0;
  font-size: 0.78rem;
  opacity: 0.75;
}
.ak-fuss a { color: inherit; }

/* ---------- Popup ---------- */
.ak-dialog {
  width: min(44rem, calc(100vw - 1.5rem));
  max-height: min(88vh, 52rem);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--ak-text);
  box-shadow: 0 20px 60px rgba(13, 33, 56, 0.45);
  overflow: hidden;
}
.ak-dialog[open] { display: flex; flex-direction: column; animation: ak-auf 0.28s ease; }
.ak-dialog::backdrop { background: rgba(13, 33, 56, 0.66); backdrop-filter: blur(2px); }
@keyframes ak-auf { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

.ak-d-kopf {
  position: relative;
  flex: none;
  padding: 1rem 3.4rem 0.9rem 1.3rem;
  background: linear-gradient(160deg, var(--ak-blau) 0%, var(--ak-blau-dunkel) 100%);
  color: #fff;
}
.ak-d-kicker {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ak-gold);
}
.ak-d-titel {
  margin: 0.2rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 3.4vw, 1.55rem);
  line-height: 1.2;
  color: #fff;
}
.ak-d-zu {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 2.3rem;
  height: 2.3rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.ak-d-zu:hover, .ak-d-zu:focus-visible { background: rgba(255,255,255,.25); outline: none; }

.ak-d-inhalt {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.1rem 1.3rem 1.2rem;
  overscroll-behavior: contain;
}
.ak-d-urteil {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
  padding: 0.3rem 0.8rem 0.3rem 0.4rem;
  border-radius: 999px;
  background: var(--u-hell, #eef0f3);
  color: var(--u-farbe, #4a5361);
  font-size: 0.86rem;
  font-weight: 700;
}
.ak-d-urteil .ak-icon {
  display: inline-grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: var(--u-farbe, #4a5361);
  color: #fff;
  font-size: 0.85rem;
}
.ak-d-kurz {
  margin: 0 0 1rem;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ak-blau-dunkel);
}
.ak-d-abschnitt { margin: 0 0 1.05rem; }
.ak-d-h {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5b6573;
}
.ak-d-zitat {
  margin: 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--ak-rand);
  border-radius: 0 8px 8px 0;
  background: var(--ak-sand);
}
.ak-d-zitat p { margin: 0 0 0.4rem; font-style: italic; }
.ak-d-zitat footer { font-size: 0.8rem; color: #5b6573; font-style: normal; }
.ak-d-text p, .ak-d-text ul { margin: 0 0 0.7rem; }
.ak-d-text ul { padding-left: 1.2rem; }
.ak-d-text li { margin: 0.15rem 0; }
.ak-d-belege {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.84rem;
  color: #4a5361;
}
.ak-d-belege li { margin: 0.15rem 0; }

.ak-bilanz { margin: 0.4rem 0 0; display: grid; gap: 0.7rem; }
.ak-bilanz-gruppe h4 { margin: 0 0 0.3rem; }
.ak-bilanz-gruppe ul { margin: 0; padding-left: 1.2rem; font-size: 0.92rem; }
.ak-bilanz-gruppe button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--ak-blau);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.ak-bilanz-gruppe button:disabled { color: #8a929d; text-decoration: none; cursor: default; }

.ak-d-navi {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--ak-rand);
  background: var(--ak-sand);
}
.ak-d-navi button {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--ak-rand);
  border-radius: 8px;
  background: #fff;
  color: var(--ak-blau);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.ak-d-navi button:hover:not(:disabled), .ak-d-navi button:focus-visible { border-color: var(--ak-blau); outline: none; }
.ak-d-navi button:disabled { opacity: 0.45; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .ak-brett::before { animation: none; }
  .ak-fluegel, .ak-front, .ak-hinweis { transition: none; }
  .ak-dialog[open], .ak-tuer.ak-wackeln .ak-fluegel { animation: none; }
}
