/* Lebendiger Adventskalender Muehlenrade – bewusst ein festes Nacht-Thema */

@font-face { font-family: "Mountains of Christmas"; font-weight: 700; font-display: swap;
  src: url("../fonts/mountains-of-christmas-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap;
  src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap;
  src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap;
  src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --night-1: #0b1530;
  --night-2: #13254d;
  --night-3: #1d3566;
  --snow: #f4f7fc;
  --paper: #fff8ec;
  --paper-2: #f7ead2;
  --ink: #2a2017;
  --ink-soft: #6b5a48;
  --gold: #e8b64c;
  --gold-2: #f6d27d;
  --red: #b3262e;
  --red-2: #8e1b22;
  --green: #1f6b45;
  --green-2: #144d31;
  --muted-on-dark: #b9c5de;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-deco: "Mountains of Christmas", "Georgia", serif;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--snow);
  background-color: var(--night-1);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(232, 182, 76, .14), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(80, 130, 220, .18), transparent 60%),
    linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
  background-attachment: fixed;
}

/* Sterne am Himmel */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .8;
  background-image:
    radial-gradient(1.5px 1.5px at 8% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 18% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 8%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 47% 22%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 61% 6%, #fff7d6 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 26%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 34%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 4% 44%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 40%, #fff 50%, transparent 51%);
}

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

a { color: var(--gold-2); }
a:hover { color: #fff; }
.card a { color: var(--red); }
.card a:hover { color: var(--red-2); }

.wrap, .site-header, .site-footer { position: relative; z-index: 2; }
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px 40px; flex: 1; }

/* ---------- Kopf ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1040px; width: 100%; margin: 0 auto; padding: 18px 16px 8px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--snow); min-width: 0; }
.crest { width: 48px; height: auto; filter: drop-shadow(0 3px 8px rgba(0,0,0,.45)); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); font-weight: 700; }
.brand-title { font-weight: 800; font-size: 1.02rem; }
.top-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-block; padding: 7px 14px; border-radius: 999px; text-decoration: none;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: var(--snow);
  font-weight: 700; font-size: .92rem; white-space: nowrap;
}
.pill:hover { background: rgba(255,255,255,.2); color: #fff; }
.pill--gold { border-color: var(--gold); color: var(--gold-2); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 34px 0 20px; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .18em; font-size: .8rem; font-weight: 800; color: var(--gold-2); }
.card .eyebrow { color: var(--red); }
h1, h2, h3 { line-height: 1.15; }
.hero h1 {
  font-family: var(--font-deco); font-weight: 700; margin: 0 0 14px;
  font-size: clamp(2.3rem, 7vw, 4.4rem); letter-spacing: .01em;
  color: #fff; text-shadow: 0 2px 0 var(--red-2), 0 0 28px rgba(232, 182, 76, .45);
}
.nowrap { white-space: nowrap; }
.lead { max-width: 680px; margin: 0 auto 22px; font-size: 1.1rem; color: #e3e9f6; }

.progress { max-width: 460px; margin: 0 auto; }
.progress p { margin: 8px 0 0; color: var(--muted-on-dark); }
.progress strong { color: #fff; }
.progress-bar { height: 12px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; border: 1px solid rgba(255,255,255,.18); }
.progress-fill {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #d84a4a 10px 20px);
  transition: width 1s ease;
}

/* ---------- Kalender ---------- */
.section-title {
  font-family: var(--font-deco); font-size: clamp(1.8rem, 4.5vw, 2.6rem); text-align: center;
  margin: 34px 0 6px; color: var(--gold-2);
}
.legend { display: flex; justify-content: center; gap: 18px; list-style: none; padding: 0; margin: 0 0 18px; color: var(--muted-on-dark); font-size: .95rem; }
.legend li { display: flex; align-items: center; gap: 7px; }
.dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.dot--free { background: var(--paper); border: 2px dashed var(--gold); }
.dot--booked { background: var(--red); }
.dot--own { background: var(--gold); }

.calendar {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
}
.door { position: relative; aspect-ratio: 4 / 5; flex: 0 0 calc((100% - 6 * 14px) / 7); }
.door-inner {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 14px; text-decoration: none; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease;
}
.door-wd { font-size: .8rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.door-num { font-family: var(--font-deco); font-size: 3.1rem; line-height: 1; margin: 4px 0 6px; }
.door-state { font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: .04em; }

/* freie Tuerchen: Papier mit goldenem Rahmen */
.door--free .door-inner {
  background:
    radial-gradient(circle at 50% 0%, rgba(232,182,76,.18), transparent 60%),
    linear-gradient(160deg, var(--paper), var(--paper-2));
  color: var(--ink);
  outline: 2px dashed var(--gold); outline-offset: -8px;
}
.door--free .door-num { color: var(--red); }
.door--free .door-state { background: var(--green); color: #fff; }
.door--free a.door-inner:hover, .door--free a.door-inner:focus-visible {
  transform: translateY(-4px) rotate(-1deg); box-shadow: 0 16px 34px rgba(0,0,0,.45), 0 0 0 3px var(--gold);
}
a.door-inner:focus-visible { outline: 3px solid var(--gold-2); }
.door--free.tone-1 .door-num { color: var(--green); }
.door--free.tone-3 .door-num { color: #9a6b12; }

/* vergebene Tuerchen: verpacktes Geschenk mit Band */
.door--booked .door-inner, .door--own .door-inner { color: #fff; }
.door--booked.tone-0 .door-inner { background: linear-gradient(160deg, #c2333b, var(--red-2)); }
.door--booked.tone-1 .door-inner { background: linear-gradient(160deg, #2a8257, var(--green-2)); }
.door--booked.tone-2 .door-inner { background: linear-gradient(160deg, #2f4f8f, #1c2f5c); }
.door--booked.tone-3 .door-inner { background: linear-gradient(160deg, #a5303a, #6f1820); }
.door--booked .door-inner::before, .door--own .door-inner::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(80% - 5px), rgba(246,210,125,.9) calc(80% - 5px), rgba(246,210,125,.9) calc(80% + 5px), transparent calc(80% + 5px)),
    linear-gradient(180deg, transparent calc(9% - 5px), rgba(246,210,125,.9) calc(9% - 5px), rgba(246,210,125,.9) calc(9% + 5px), transparent calc(9% + 5px));
  opacity: .9;
}
.door--booked .door-wd, .door--booked .door-num, .door--booked .door-state,
.door--own .door-wd, .door--own .door-num, .door--own .door-state { position: relative; z-index: 1; }
.door--booked .door-num, .door--own .door-num { text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.door--booked .door-wd { text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.door--booked .door-state { background: rgba(0,0,0,.45); }
.bow {
  position: absolute; top: calc(9% - 12px); left: 80%; width: 46px; height: 24px; transform: translateX(-50%) rotate(-12deg); z-index: 2;
  background:
    radial-gradient(circle at 50% 55%, var(--gold) 0 5px, transparent 6px),
    radial-gradient(ellipse 12px 9px at 30% 50%, var(--gold-2) 0 98%, transparent 100%),
    radial-gradient(ellipse 12px 9px at 70% 50%, var(--gold-2) 0 98%, transparent 100%);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
}

/* eigener Tag */
.door--own .door-inner { background: linear-gradient(160deg, #f0c25e, #c98f1d); box-shadow: 0 0 0 3px #fff, 0 0 26px rgba(246,210,125,.7); }
.door--own .door-state { background: #fff; color: var(--red-2); }

/* vergangene Tage */
.door--past .door-inner { background: rgba(255,255,255,.06); color: var(--muted-on-dark); box-shadow: none; border: 1px dashed rgba(255,255,255,.2); }
.door--past .door-state { background: rgba(255,255,255,.1); }

.hint { text-align: center; color: var(--muted-on-dark); font-size: .95rem; margin: 16px 0 0; }

/* ---------- Karten / Formulare ---------- */
.card {
  color-scheme: light;
  position: relative; background: var(--paper); color: var(--ink); border-radius: var(--radius);
  padding: 26px 24px; margin: 30px auto 0; max-width: 680px; box-shadow: var(--shadow);
  border-top: 6px solid var(--red);
}
.card::after { /* Tannenzweig-Ecke */
  content: ""; position: absolute; top: -18px; right: 18px; width: 64px; height: 36px; pointer-events: none;
  background:
    radial-gradient(circle at 70% 70%, var(--red) 0 6px, transparent 7px),
    radial-gradient(circle at 52% 76%, #d84a4a 0 5px, transparent 6px),
    radial-gradient(ellipse 30px 9px at 40% 45%, var(--green) 0 98%, transparent 100%),
    radial-gradient(ellipse 26px 8px at 70% 35%, #2a8257 0 98%, transparent 100%);
}
.card--narrow { max-width: 440px; }
.card--table { max-width: 1040px; padding: 8px; border-top-color: var(--green); }
.card--link { border-top-color: var(--gold); background: linear-gradient(180deg, #fffaf0, #fbefd6); }
.card--danger { border-top-color: #7b6a5a; }
.card--celebrate { text-align: center; border-top-color: var(--gold); padding-top: 46px; }
.card--mine { text-align: center; }
.card-title { font-family: var(--font-deco); font-size: clamp(1.9rem, 5vw, 2.5rem); margin: 0 0 10px; color: var(--red-2); }
.card-title--small { font-family: var(--font); font-weight: 800; font-size: 1.2rem; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.inline-icon { width: 22px; height: 22px; color: var(--gold); flex: none; }
.muted { color: var(--ink-soft); }
.small { font-size: .88rem; }
.center { text-align: center; }
.big-date { font-weight: 800; font-size: 1.35rem; color: var(--green); margin: 4px 0 12px; }
.celebrate-star { position: absolute; top: -34px; left: 50%; width: 68px; height: 68px; transform: translateX(-50%); filter: drop-shadow(0 4px 10px rgba(232,182,76,.6)); }

.form { display: grid; gap: 16px; margin-top: 12px; }
.field { display: grid; gap: 6px; }
.field label, .check { font-weight: 700; }
input[type=text], input[type=email], input[type=password], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 2px solid #e2d3b8; border-radius: 12px; padding: 11px 13px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(232,182,76,.25); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--green); flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 800; cursor: pointer; text-decoration: none;
  color: #fff !important; background: linear-gradient(180deg, #c8323a, var(--red-2));
  border: 0; border-radius: 999px; padding: 11px 22px; box-shadow: 0 4px 0 #5e1117, 0 8px 18px rgba(0,0,0,.25);
  transition: transform .1s ease, box-shadow .1s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #5e1117; }
.btn--big { font-size: 1.12rem; padding: 14px 28px; justify-self: start; }
.btn--small { padding: 8px 16px; font-size: .92rem; }
.btn--tiny { padding: 5px 11px; font-size: .82rem; box-shadow: none; }
.btn--ghost { background: transparent; color: var(--green) !important; border: 2px solid var(--green); box-shadow: none; }
.btn--ghost:hover { background: rgba(31,107,69,.08); }
.wrap > .center .btn--ghost, .wrap > p.center .btn--ghost { color: var(--gold-2) !important; border-color: var(--gold); }
.btn--danger { background: linear-gradient(180deg, #6b5a48, #4a3d30); box-shadow: 0 4px 0 #2e261d; }
.btn-icon { width: 20px; height: 20px; color: var(--gold-2); }
.linklike { background: none; border: 0; color: var(--muted-on-dark); font: inherit; text-decoration: underline; cursor: pointer; margin-top: 18px; }
.linklike:hover { color: #fff; }

.copy-row { display: flex; gap: 8px; }
.copy-input { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .9rem; }
.copy-row .btn { flex: none; }

details summary { cursor: pointer; font-weight: 800; color: var(--ink-soft); }
details[open] summary { margin-bottom: 10px; }

.flashes { max-width: 680px; margin: 18px auto 0; display: grid; gap: 8px; }
.flash { margin: 0; padding: 12px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); }
.flash--error { background: #fde8e8; color: #7d1a1f; border-left: 6px solid var(--red); }
.flash--ok { background: #e5f5ec; color: #14492f; border-left: 6px solid var(--green); }
.flash--info { background: #fff6e0; color: #6a4b0f; border-left: 6px solid var(--gold); }

/* ---------- So geht's ---------- */
.step-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); padding: 20px; text-align: center; }
.step svg { width: 54px; height: 54px; }
.step h3 { margin: 8px 0 6px; font-size: 1.1rem; color: #fff; }
.step p { margin: 0; color: var(--muted-on-dark); font-size: .95rem; }

/* ---------- Admin ---------- */
body.admin .wrap { max-width: 1100px; }
.admin-head { max-width: 1040px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.admin-head .card-title { margin: 0; }
.admin-actions { display: flex; gap: 8px; align-items: center; }
.admin-actions form { margin: 0; }
body.admin .card { max-width: 1040px; }
.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.admin-table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); padding: 10px; border-bottom: 2px solid #e2d3b8; }
.admin-table td { padding: 10px; border-bottom: 1px solid #efe3cc; vertical-align: top; }
.admin-table tr.is-free td { background: #fffdf7; }
.admin-table tr.is-booked td:first-child { border-left: 4px solid var(--green); }
.admin-table .note { max-width: 260px; white-space: pre-wrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.freitext { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .9rem; white-space: pre; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.prose h2 { font-size: 1.1rem; margin: 18px 0 4px; }
.prose ul { padding-left: 20px; }

/* ---------- Fuss mit Dorf ---------- */
.site-footer { margin-top: 40px; }
.village { display: block; width: 100%; height: 180px; }
.footer-bar { background: #dfe8f5; color: #34445f; text-align: center; padding: 6px 16px 18px; font-size: .9rem; }
.footer-bar p { margin: 2px 0; }
.footer-bar a { color: #1c2f5c; }
.win { animation: flicker 6s infinite ease-in-out; }
.win--2 { animation-delay: -2s; }
.win--3 { animation-delay: -4s; animation-duration: 7.5s; }
.lights circle { animation: twinkle 1.6s infinite alternate; }
.lights circle:nth-child(2n) { animation-delay: -.8s; }
.treestar { animation: twinkle 2.4s infinite alternate; }
.wheel { animation: spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 50% { opacity: .95; } }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .win, .lights circle, .treestar, .wheel { animation: none; }
  .progress-fill { transition: none; }
}

/* ---------- Handy ---------- */
@media (max-width: 860px) and (min-width: 561px) {
  .door { flex-basis: calc((100% - 4 * 14px) / 5); }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .site-header { padding-top: 12px; }
  .crest { width: 40px; }
  .brand-title { font-size: .92rem; }
  .kicker { font-size: .7rem; }
  .pill { padding: 6px 11px; font-size: .85rem; }
  .calendar { gap: 10px; }
  .door { flex-basis: calc((100% - 2 * 10px) / 3); }
  .door-num { font-size: 2.5rem; }
  .card { padding: 22px 16px; }
  .copy-row { flex-direction: column; }
  .btn--big { justify-self: stretch; }
  .village { height: 120px; }
}
.btn--sso { background: linear-gradient(180deg, #2f4f8f, #1c2f5c); box-shadow: 0 4px 0 #0f1b38, 0 8px 18px rgba(0,0,0,.25); }
.card--narrow details { margin-top: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 150px; gap: 12px; align-items: start; }
input[type=time] { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 2px solid #e2d3b8; border-radius: 12px; padding: 9px 13px; }
.time-tag { font-size: .82rem; font-weight: 700; color: var(--green); }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
