/* ==========================================================================
   Adventskalender 2026 — Stil & Farben aus background_2026.png
   Hauptfarben:
     Hintergrund: #f6f6f6 (Alabaster / Warmweiß)
     Karten/Flächen: #ffffff & #f9f7f4
     Gold-Linien & Akzente: #ae8c66 / #b08a67 / #b38d53
     Sanftes Sandgold: #d2c2b0 / #ae9473
     Dunkle Schrift (Kontrast): #4d3d2b / #786045
   ========================================================================== */

:root {
  --bg-main: #f6f6f6;
  --bg-surface: #ffffff;
  --bg-soft: #faf8f5;
  --gold-primary: #ae8c66;
  --gold-warm: #b08a67;
  --gold-deep: #96724b;
  --gold-bright: #b38d53;
  --gold-muted: #ae9473;
  --gold-light: #d2c2b0;
  --gold-hairline: rgba(174, 140, 102, 0.35);
  --text-dark: #4a3a28;
  --text-muted: #7b6650;
  --shadow-soft: 0 8px 24px rgba(174, 140, 102, 0.1);
  --shadow-hover: 0 14px 32px rgba(174, 140, 102, 0.18);
  --shadow-modal: 0 28px 70px rgba(58, 44, 29, 0.24);
  --radius-card: 16px;
  --radius-modal: 22px;
  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-sans: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-main);
  color: var(--text-dark);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* Decorative background layer matching background_2026.png */
.bg-decorations {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.decor-bauble {
  position: absolute;
  top: 0;
  left: -18px;
  width: clamp(220px, 28vw, 390px);
  height: auto;
  opacity: 0.72;
}

.decor-cluster-br {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: clamp(140px, 18vw, 240px);
  height: auto;
  opacity: 0.85;
}

/* Main page container */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

/* Header */
.calendar-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 38px;
  padding: 18px 24px 24px;
  background: rgba(246, 246, 246, 0.82);
  backdrop-filter: blur(4px);
  border-radius: 20px;
}

.header-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.emblem-line {
  display: inline-block;
  width: 58px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
}

.emblem-star {
  width: 24px;
  height: 24px;
}

.header-kicker {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  color: var(--gold-warm);
}

.header-title {
  margin: 0 0 12px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.8rem, 3.6vw, 2.6rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold-primary);
  line-height: 1.08;
}

.header-subtitle {
  margin: 0 auto 18px;
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 520px;
}

.header-status-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--gold-hairline);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(174, 140, 102, 0.08);
}

.opened-counter {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--gold-deep);
}

.reset-btn {
  appearance: none;
  border: none;
  border-left: 1px solid var(--gold-hairline);
  background: transparent;
  padding: 2px 0 2px 12px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.reset-btn:hover,
.reset-btn:focus-visible {
  color: var(--gold-deep);
  text-decoration: underline;
  outline: none;
}

/* 24 Doors Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
}

@media (max-width: 1080px) {
  .calendar-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 680px) {
  .calendar-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .page-wrapper {
    padding: 24px 14px 36px;
  }
}

@media (max-width: 440px) {
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Individual Door Card */
.door-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1 / 1.12;
  padding: 16px 12px 14px;
  background: linear-gradient(165deg, var(--bg-surface) 0%, var(--bg-soft) 100%);
  border: 1.5px solid var(--gold-light);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  color: var(--gold-primary);
  text-align: center;
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease;
  overflow: hidden;
}

/* Inner fine ornamental border */
.door-card::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(174, 140, 102, 0.24);
  border-radius: calc(var(--radius-card) - 6px);
  pointer-events: none;
  transition: border-color 0.25s ease;
}

.door-card:hover,
.door-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--gold-primary);
  box-shadow: var(--shadow-hover);
  outline: none;
}

.door-card:hover::before,
.door-card:focus-visible::before {
  border-color: rgba(174, 140, 102, 0.55);
}

.door-card:active {
  transform: translateY(-1px) scale(0.99);
}

.door-card.is-opened {
  background: linear-gradient(165deg, #fffdf9 0%, #f5efe6 100%);
  border-color: var(--gold-primary);
}

/* Door hinges (left) and small handle (right) */
.door-hinge {
  position: absolute;
  left: 0;
  z-index: 2;
  width: 7px;
  height: 20px;
  background: linear-gradient(180deg, #fffdf9 0%, var(--gold-light) 50%, #fffdf9 100%);
  border: 1.2px solid var(--gold-primary);
  border-left: none;
  border-radius: 0 4px 4px 0;
  pointer-events: none;
}

.door-hinge::after {
  content: "";
  position: absolute;
  left: 0;
  right: 1px;
  top: 50%;
  height: 1px;
  background: var(--gold-primary);
  transform: translateY(-50%);
}

.door-hinge--top {
  top: 26%;
  transform: translateY(-50%);
}

.door-hinge--bottom {
  bottom: 26%;
  transform: translateY(50%);
}

.door-handle {
  position: absolute;
  right: 16px;
  top: 52%;
  z-index: 2;
  width: 5px;
  height: 15px;
  transform: translateY(-50%);
  background: var(--bg-surface);
  border: 1.2px solid var(--gold-primary);
  border-radius: 999px;
  pointer-events: none;
}

.door-handle::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 50%;
  width: 11px;
  height: 3.5px;
  transform: translateY(-50%);
  transform-origin: right center;
  background: linear-gradient(90deg, var(--gold-warm), var(--gold-deep));
  border-radius: 999px;
  transition: transform 0.25s ease;
}

.door-card:hover .door-handle::after,
.door-card:focus-visible .door-handle::after {
  transform: translateY(-50%) rotate(-12deg);
}

.door-top-row {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 20px;
}

.door-media-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-muted);
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(210, 194, 176, 0.18);
}

.door-media-badge svg {
  width: 11px;
  height: 11px;
}

.door-opened-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: var(--gold-primary);
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.door-card.is-opened .door-opened-dot {
  opacity: 1;
  transform: scale(1);
}

.door-opened-dot svg {
  width: 11px;
  height: 11px;
}

.door-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.door-motif {
  width: 28px;
  height: 28px;
  color: var(--gold-primary);
  opacity: 0.85;
  transition: transform 0.3s ease, opacity 0.25s ease;
}

.door-card:hover .door-motif {
  transform: scale(1.08) rotate(6deg);
  opacity: 1;
}

.door-number {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.1rem, 3.2vw, 2.75rem);
  line-height: 1;
  color: var(--gold-primary);
  letter-spacing: 0.02em;
}

.door-label {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Footer */
.calendar-footer {
  margin-top: 44px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Popup / Modal
   ========================================================================== */
.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(54, 42, 29, 0.56);
  backdrop-filter: blur(6px);
  animation: fadeInBackdrop 0.22s ease-out;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  background: var(--bg-main);
  border: 1.5px solid var(--gold-primary);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-modal);
  padding: 14px;
  text-align: center;
  animation: scaleInModal 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(174, 140, 102, 0.25);
  border-radius: calc(var(--radius-modal) - 8px);
  pointer-events: none;
}

.modal-scroll {
  position: relative;
  z-index: 1;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  padding: 24px 20px 26px;
}

.modal-close-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--gold-light);
  background: var(--bg-surface);
  color: var(--gold-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.modal-close-icon:hover,
.modal-close-icon:focus-visible {
  background: var(--gold-primary);
  border-color: var(--gold-primary);
  color: #ffffff;
  transform: rotate(90deg);
  outline: none;
}

.modal-close-icon svg {
  width: 18px;
  height: 18px;
}

.modal-header {
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
  padding: 0 36px;
}

.modal-kicker {
  display: block;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--gold-warm);
  margin-bottom: 2px;
}

.modal-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.55rem);
  letter-spacing: 0.1em;
  color: var(--gold-primary);
}

.modal-subtitle {
  margin: 6px 0 0;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--text-dark);
}

.modal-subtitle:empty {
  display: none;
}

/* Media container inside popup */
.modal-media-frame {
  position: relative;
  z-index: 1;
  margin: 0 auto 18px;
  background: var(--bg-surface);
  border: 1.5px solid var(--gold-light);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(174, 140, 102, 0.1);
}

.modal-media-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #f9f7f4;
}

.modal-media-frame video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  background: #f9f7f4;
}

.modal-media-frame .video-embed-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  background: #231b12;
}

.modal-media-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-description {
  position: relative;
  z-index: 1;
  margin: 0 auto 22px;
  max-width: 560px;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.modal-description:empty {
  display: none;
}

.modal-donate {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0 auto 24px;
  text-align: center;
}

.modal-donate-link {
  color: var(--gold-deep);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  word-break: break-word;
  transition: color 0.2s ease;
}

.modal-donate-link:hover,
.modal-donate-link:focus-visible {
  color: var(--gold-primary);
  outline: none;
}

.modal-donate-qr-link {
  display: inline-block;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--gold-light);
  border-radius: 10px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.modal-donate-qr-link:hover,
.modal-donate-qr-link:focus-visible {
  border-color: var(--gold-primary);
  transform: translateY(-1px);
  outline: none;
}

.modal-donate-qr {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.modal-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.modal-close-btn {
  appearance: none;
  border: 1.5px solid var(--gold-primary);
  background: var(--gold-primary);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.modal-close-btn:hover,
.modal-close-btn:focus-visible {
  background: var(--gold-deep);
  border-color: var(--gold-deep);
  transform: translateY(-1px);
  outline: none;
}

@keyframes fadeInBackdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleInModal {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 540px) {
  .modal-card {
    padding: 12px;
  }

  .modal-scroll {
    max-height: calc(100vh - 64px);
    padding: 20px 10px 22px;
  }

  .modal-header {
    padding: 0 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door-card,
  .door-motif,
  .door-handle::after,
  .modal-backdrop,
  .modal-card,
  .modal-close-icon {
    transition: none;
    animation: none;
  }
}
