/* ============================================================
   Adventskalender – hanseatisch, modern, zurückhaltend
   Palette: Marineblau, Papier/Creme, Messing, Ziegelrot, Tannengrün
   ============================================================ */

:root {
  /* Flächen */
  --night: #071320;
  --night-deep: #040b12;
  --night-soft: #0c1e2e;
  --paper: #f7f2e7;
  --paper-soft: #efe7d7;
  --paper-edge: #e2d8c5;

  /* Schrift */
  --ink: #0e1b26;
  --ink-soft: #33414d;
  --mist: #93a3b2;

  /* Akzente */
  --brass: #c2a35a;
  --brass-soft: #e0cda0;
  --brick: #a03a30;
  --fir: #234a3d;
  --fir-soft: #4f7f6c;

  /* Schleier für Bilder, die zu hell oder zu bunt für die Palette sind */
  --veil: rgba(7, 19, 32, 0.62);
  --veil-soft: rgba(7, 19, 32, 0.2);

  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.95);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Das hidden-Attribut muss jedes display überstimmen
   (sonst bleibt z. B. der "Mehr dazu"-Button trotz hidden sichtbar). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--paper);
  background:
    radial-gradient(900px 620px at 50% -18%, rgba(194, 163, 90, 0.12), transparent 62%),
    radial-gradient(760px 520px at 88% 4%, rgba(35, 74, 61, 0.4), transparent 68%),
    radial-gradient(700px 500px at 6% 22%, rgba(160, 58, 48, 0.12), transparent 70%),
    linear-gradient(180deg, var(--night-soft) 0%, var(--night) 48%, var(--night-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

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

/* Backstein-Giebel: feine Mauerwerksstruktur, nach unten ausgeblendet */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='36'><g fill='none' stroke='%23a03a30' stroke-width='1' stroke-opacity='.55'><path d='M0 .5H72M0 18.5H72M0 35.5H72'/><path d='M.5 0V18M36.5 0V18M18.5 18V36M54.5 18V36'/></g></svg>");
  background-repeat: repeat;
  background-size: 72px 36px;
  opacity: 0.22;
  -webkit-mask-image: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.35) 24%,
    transparent 52%
  );
  mask-image: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.35) 24%,
    transparent 52%
  );
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(1.6rem, 4vw, 3.4rem) clamp(1rem, 4vw, 2rem) 3.5rem;
}

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

.site-header {
  text-align: center;
  margin-bottom: clamp(1.6rem, 3.5vw, 2.75rem);
}

.eyebrow {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--brass);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 6.4vw, 3.7rem);
  letter-spacing: 0.01em;
  line-height: 1.1;
  color: var(--paper);
}

/* Feine Messinglinie mit Raute – das einzige Ornament */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin: 1.1rem auto 0;
  max-width: 15rem;
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(194, 163, 90, 0.55), transparent);
}

.ornament span {
  width: 6px;
  height: 6px;
  border: 1px solid var(--brass);
  transform: rotate(45deg);
  opacity: 0.85;
}

.subtitle {
  margin: 0.65rem auto 0;
  max-width: 32rem;
  color: var(--mist);
  font-size: clamp(0.92rem, 1.9vw, 1rem);
  line-height: 1.65;
}

/* Widmung: einzige persönliche Zeile im Kopfbereich */
.dedication {
  margin: 1.15rem auto 0;
  max-width: 30rem;
  font-family: var(--serif);
  font-size: clamp(1.02rem, 2.3vw, 1.18rem);
  letter-spacing: 0.015em;
  color: var(--brass-soft);
}.status {
  margin: 0.7rem 0 0;
  min-height: 1.2rem;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: rgba(224, 205, 160, 0.75);
  text-transform: uppercase;
}

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

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(0.55rem, 1.4vw, 0.9rem);
}

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

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

/* Grundform: Papierkalender */

.door {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  padding: 0;
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbf7ee 0%, var(--paper-soft) 100%);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease;
}

/* schmale Tannengrün-Kante oben */
.door::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(35, 74, 61, 0.55), transparent);
}

/* feine Messing-Innenlinie */
.door::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(194, 163, 90, 0.4);
  border-radius: 6px;
  pointer-events: none;
}

.door__number {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.9vw, 1.85rem);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.door__badge {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(14, 27, 38, 0.42);
}

.door__lock {
  position: absolute;
  bottom: 9px;
  right: 10px;
  display: none;
  color: rgba(245, 239, 227, 0.5);
  line-height: 0;
}

.door.is-locked .door__lock {
  display: block;
}

/* gesperrt: zurückgenommen, nur Kontur */

.door.is-locked {
  cursor: not-allowed;
  background: linear-gradient(180deg, #0f2131 0%, #0a1826 100%);
  border-color: rgba(245, 239, 227, 0.08);
  box-shadow: none;
}

.door.is-locked::before {
  background: transparent;
}

.door.is-locked::after {
  border-color: rgba(245, 239, 227, 0.06);
}

.door.is-locked .door__number {
  color: rgba(245, 239, 227, 0.32);
  font-size: clamp(1.15rem, 3.2vw, 1.5rem);
}

.door.is-locked .door__badge {
  color: rgba(245, 239, 227, 0.18);
}

/* freigeschaltet: das Papier tritt hervor */

.door:hover:not(.is-locked),
.door:focus-visible {
  transform: translateY(-3px);
  border-color: var(--brass);
  box-shadow: 0 22px 42px -26px rgba(0, 0, 0, 1);
  outline: none;
}

.door:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 3px;
}

/* bereits geöffnet: Tannengrün */

.door.is-opened {
  background: linear-gradient(180deg, #2b5446 0%, var(--fir) 100%);
  border-color: rgba(194, 163, 90, 0.45);
}

.door.is-opened::before {
  background: linear-gradient(90deg, transparent, rgba(194, 163, 90, 0.8), transparent);
}

.door.is-opened::after {
  border-color: rgba(224, 205, 160, 0.45);
}

.door.is-opened .door__number,
.door.is-opened .door__badge {
  color: var(--paper);
}

.door.is-opened .door__badge {
  color: rgba(247, 242, 231, 0.6);
}

/* heute: feiner Messingring, kein Blinken */

.door.is-today {
  animation: today 4s ease-in-out infinite;
}

@keyframes today {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(194, 163, 90, 0.4), var(--shadow);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(194, 163, 90, 0), var(--shadow);
  }
}

.door.shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

/* ---------- Dialog: Papierkarte ---------- */

.door-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(520px, 92vw);
  color: var(--ink);
}

.door-dialog::backdrop {
  background: rgba(4, 11, 18, 0.8);
  backdrop-filter: blur(3px);
}

.door-card {
  position: relative;
  padding: clamp(1.6rem, 5vw, 2.6rem);
  border-radius: 6px;
  border: 1px solid var(--paper-edge);
  background: linear-gradient(180deg, #fbf7ee 0%, #f2ead9 100%);
  box-shadow: 0 40px 80px -34px rgba(0, 0, 0, 1);
  text-align: center;
  animation: card-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* feine Messing-Doppellinie */
.door-card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(194, 163, 90, 0.35);
  border-radius: 3px;
  pointer-events: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.dialog-close {
  position: absolute;
  top: 0.55rem;
  right: 0.7rem;
  z-index: 1;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(14, 27, 38, 0.4);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.dialog-close:hover {
  background: rgba(14, 27, 38, 0.06);
  color: var(--ink);
}

.door-card__day {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--brick);
}

/* Emoji als Medaillon statt Kirmes */
.door-card__medallion {
  width: 3.4rem;
  height: 3.4rem;
  margin: 1.05rem auto 0.35rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(194, 163, 90, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  font-size: 1.55rem;
  line-height: 1;
}

.door-card__title {
  margin: 0.55rem 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.3rem, 4.4vw, 1.7rem);
  color: var(--ink);
  letter-spacing: 0.01em;
}

.door-card__text {
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  line-height: 1.75;
  white-space: pre-wrap;
  font-size: 0.97rem;
}

.door-card__figure {
  margin: 1.3rem 0 0;
}

.door-card__image {
  display: block;
  width: 100%;
  max-height: 22rem;
  border-radius: 3px;
  object-fit: cover;
  /* Fotos verschiedener Herkunft dezent auf die Palette stimmen */
  filter: saturate(0.92) contrast(1.02);
}

.door-card__credit {
  margin-top: 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: rgba(51, 65, 77, 0.75);
  text-align: right;
}

.door-card__credit a {
  color: inherit;
  text-underline-offset: 0.15em;
}

/* Bilder, die von sich aus zu hell oder zu bunt sind, über einen Schleier und
   eine Vignette in die Marineblau-Palette holen (steuerbar über
   "imageTreatment": "moody" in content/doors.json). */
.door-card__figure.is-moody {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
}

.door-card__figure.is-moody .door-card__image {
  filter: brightness(0.82) saturate(0.76) contrast(1.06);
}

.door-card__figure.is-moody::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 38%, transparent 26%, var(--veil) 96%),
    linear-gradient(200deg, var(--veil-soft) 0%, transparent 52%);
}

.door-card__link {
  display: inline-block;
  margin-top: 1.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 3px;
  background: var(--brick);
  color: #fdf8ee;
  font-weight: 600;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s;
}

.door-card__link:hover {
  background: #8c3029;
  transform: translateY(-1px);
}

/* ---------- Fußbereich & Toast ---------- */

.site-footer {
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(194, 163, 90, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.4rem;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(147, 163, 178, 0.85);
}

/* Tannenzweig als Ornament */
.footer-twig svg {
  display: block;
  width: 148px;
  height: auto;
  color: var(--fir-soft);
  opacity: 0.9;
}

.footer-twig .twig-snow {
  stroke: rgba(247, 242, 231, 0.55);
}

/* Hamburger Silhouette: Michel, Elbphilharmonie, Wappen, Speicherstadt */
.footer-skyline {
  width: 100%;
  margin-top: 0.35rem;
}

.footer-skyline svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--brass);
  opacity: 0.32;
}

.footer-skyline .skyline-snow {
  stroke: rgba(247, 242, 231, 0.55);
  opacity: 0.7;
}

@media (min-width: 720px) {
  .footer-skyline svg {
    max-width: 700px;
    margin: 0 auto;
  }
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  color: rgba(147, 163, 178, 0.85);
  font: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(194, 163, 90, 0.45);
  cursor: pointer;
}

.link-button:hover {
  color: var(--brass-soft);
}

/* Installationshinweis: einziger Ort mit Messing-Betonung im Footer */
#install-button {
  color: var(--brass-soft);
  text-decoration-color: rgba(194, 163, 90, 0.7);
}

#install-button:hover {
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%) translateY(10px);
  padding: 0.65rem 1.15rem;
  border-radius: 3px;
  border: 1px solid rgba(194, 163, 90, 0.5);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.84rem;
  box-shadow: 0 20px 40px -26px rgba(0, 0, 0, 1);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 10;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  #snow {
    display: none;
  }
}
