/* Adventskalender – baut auf ../css/style.css auf */

.back-link {
  font-size: 0.85rem;
  color: var(--dim);
  text-decoration: none;
}
.back-link:hover { color: var(--neon); }

/* ---------- Intro ---------- */

.intro {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "candles title" "candles status";
  align-items: end;
  align-content: center;
  column-gap: clamp(24px, 4vw, 56px);
  row-gap: 14px;
}

.title {
  grid-area: title;
  font-weight: 800;
  font-size: clamp(2rem, 5.4vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  hyphens: manual;
}
.status {
  grid-area: status;
  color: var(--dim);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  max-width: 52ch;
  line-height: 1.4;
}

.candles {
  grid-area: candles;
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 18px);
  height: 150px;
}
.candle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 26px;
}
.candle .wax {
  display: block;
  width: 26px;
  height: 78px;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 3px 3px 2px 2px;
}
.candle:nth-child(2) .wax { height: 92px; }
.candle:nth-child(3) .wax { height: 70px; }
.candle:nth-child(4) .wax { height: 86px; }
.candle .wick { display: block; width: 2px; height: 8px; background: #555; }
.candle .flame {
  display: block;
  width: 14px;
  height: 24px;
  margin-bottom: 2px;
  border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%;
  transform-origin: 50% 90%;
  background: transparent;
}
.candle small {
  position: absolute;
  bottom: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--dim);
}
.candle.lit .wax { background: #d4d4d4; border-color: #d4d4d4; }
.candle.lit small { color: #000; }
.candle.lit .wick { background: #111; }
.candle.lit .flame {
  background: radial-gradient(ellipse at 50% 70%, #fff 0 18%, var(--neon) 45%, rgba(228, 255, 26, 0.2) 100%);
  box-shadow: 0 0 18px 4px rgba(228, 255, 26, 0.35), 0 0 60px 10px rgba(228, 255, 26, 0.12);
}

/* ---------- Türchen ---------- */

.calendar-doors { display: grid; gap: 14px; }

.doors {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: clamp(84px, 9vw, 120px);
  grid-auto-flow: dense;
  gap: clamp(6px, 1vw, 12px);
}
.door { position: relative; perspective: 900px; }
.door.wide { grid-column: span 2; }
.door.big { grid-column: span 2; grid-row: span 2; }

.door-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  text-align: left;
  border-radius: 6px;
}

.inside {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 10px 12px;
  border-radius: 6px;
  background: #0d0d0d;
  border: 1px solid var(--neon);
  overflow: hidden;
}
.peek {
  color: var(--neon);
  font-weight: 800;
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  line-height: 1.1;
  margin-left: auto;
  text-align: right;
}
.inside-num {
  position: absolute;
  top: 8px; left: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dim);
}
.big .peek { font-size: clamp(1rem, 2vw, 1.6rem); }

.leaf {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 6px;
  background: #111;
  border: 1px solid var(--line);
  transform-origin: 0 50%;
  backface-visibility: hidden;
  will-change: transform;
  transition: border-color .25s, background .25s;
}
.num {
  font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 2.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: #3d3d3d;
}
.big .num { font-size: clamp(3rem, 6vw, 5.5rem); }

.door[data-state="ready"] .num { color: var(--fg); }
.door[data-state="ready"] .leaf { border-color: #444; background: #151515; }
.door[data-state="ready"]:hover .leaf { border-color: var(--neon); }
.door.today .leaf { border-color: var(--neon); box-shadow: 0 0 0 1px var(--neon), 0 0 30px rgba(228, 255, 26, 0.18); }
.door.today .num { color: var(--neon); }
.door[data-state="locked"] .door-btn { cursor: not-allowed; }
.door[data-state="locked"] .inside { visibility: hidden; }
.door:not([data-state="opened"]) .inside { border-color: transparent; }
.door:not([data-state="opened"]) .peek { visibility: hidden; }
.door[data-state="opened"] .leaf { background: #0a0a0a; }

.hint { font-size: 0.75rem; color: var(--dim); }

/* ---------- Spruch-Ansicht ---------- */

body.viewer-open { overflow: hidden; }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.985);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vw, 64px);
  overflow-y: auto;
}
.viewer[hidden] { display: none; }
.viewer-inner { width: 100%; max-width: 1200px; }
.viewer-meta {
  font-size: 0.8rem;
  color: var(--neon);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: clamp(16px, 3vw, 32px);
}
.viewer-nav { display: flex; align-items: center; gap: 12px; margin-top: clamp(24px, 4vw, 48px); }
.viewer-nav .nav-btn:disabled { opacity: 0.25; cursor: default; border-color: var(--line); color: var(--fg); }
.viewer-close {
  position: absolute;
  top: clamp(12px, 3vw, 32px);
  right: clamp(12px, 3vw, 32px);
  width: 44px; height: 44px;
  font-size: 2rem;
  line-height: 1;
  color: var(--dim);
}
.viewer-close:hover { color: var(--neon); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--neon);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .intro {
    grid-template-columns: 1fr;
    grid-template-areas: "candles" "title" "status";
  }
  .candles { height: 120px; }
  .candle .wax { height: 60px; }
  .candle:nth-child(2) .wax { height: 72px; }
  .candle:nth-child(3) .wax { height: 54px; }
  .candle:nth-child(4) .wax { height: 66px; }
  .doors { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 88px; }
}
