/* Türchen Kalenderansicht – gemeinsame Grundlage aller Vorlagen */

@font-face { font-family: "Figtree"; font-weight: 300 900; font-display: swap; src: url("../fonts/figtree-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-weight: 300 900; font-display: swap; src: url("../fonts/figtree-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C4, U+A720-A7FF; }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-display: swap; src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 200 800; font-display: swap; src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+20A0-20AB, U+20AD-20C4, U+A720-A7FF; }
@font-face { font-family: "Abril Fatface"; font-weight: 400; font-display: swap; src: url("../fonts/abril-fatface-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: "Abril Fatface"; font-weight: 400; font-display: swap; src: url("../fonts/abril-fatface-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+A720-A7FF; }
@font-face { font-family: "Bree Serif"; font-weight: 400; font-display: swap; src: url("../fonts/bree-serif-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: "Bree Serif"; font-weight: 400; font-display: swap; src: url("../fonts/bree-serif-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF, U+A720-A7FF; }
@font-face { font-family: "Kalam"; font-weight: 400; font-display: swap; src: url("../fonts/kalam-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }
@font-face { font-family: "Kalam"; font-weight: 700; font-display: swap; src: url("../fonts/kalam-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+FEFF, U+FFFD; }

:root {
  --t-ground: #6b2219;
  --t-ground-2: #82301f;
  --t-door: #f6e7cf;
  --t-door-ink: #4a170f;
  --t-accent: #f2b544;
  --t-open: #fff8ec;
  --t-on-ground: #ffffff;
  --t-on-accent: #141414;

  /* Vorlagen setzen diese Rollen */
  --page-bg: var(--t-ground);
  --page-ink: var(--t-on-ground);
  --font-display: "Figtree", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 4vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  --page-ink-2: color-mix(in oklab, var(--page-ink) 76%, var(--page-bg));
  --panel: color-mix(in oklab, var(--page-bg) 88%, var(--page-ink));
  --field-bg: color-mix(in oklab, var(--page-bg) 70%, #fff 30%);
  margin: 0;
  min-height: 100dvh;
  background: var(--page-bg);
  color: var(--page-ink);
  font: 400 1.0625rem/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
::selection { background: var(--t-accent); color: var(--t-on-accent); }
svg { display: block; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1.5px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--t-accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); line-height: 1.1; text-wrap: balance; }
p { margin: 0; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; border-radius: 10px; background: var(--page-ink); color: var(--page-bg); }
.skip:focus { top: 12px; }

.page {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding: clamp(18px, 4vw, 40px) var(--gutter) 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(18px, 3vw, 28px);
}

/* Kopf */
.t-head { display: grid; gap: 8px; }
.t-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.t-logo {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--t-accent);
  color: var(--t-on-accent);
  font: 800 1.25rem/1 var(--font-display);
}
.t-logo[hidden] { display: none; }
.t-name { font-weight: 650; font-size: 0.9375rem; letter-spacing: 0.01em; overflow-wrap: anywhere; color: var(--page-ink-2); }
.t-title { font-size: clamp(1.75rem, 5.2vw, 3rem); max-width: 22ch; hyphens: auto; overflow-wrap: break-word; }
.t-sub { color: var(--page-ink-2); max-width: 52ch; }

/* Status */
.t-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.status-big { font: 700 1.125rem/1.3 var(--font-body); }
.status-num { font-family: var(--font-display); font-size: 2.25rem; line-height: 1; margin-right: 6px; }
.status-small { flex-basis: 100%; color: var(--page-ink-2); max-width: 56ch; }

/* Buttons */
.t-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--t-accent);
  color: var(--t-on-accent);
  font: 700 1rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), filter 0.2s;
}
.t-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.t-btn:active { transform: translateY(1px); }
.t-btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.t-btn svg { width: 18px; height: 18px; }
.t-btn-ghost { background: transparent; color: var(--page-ink); box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--page-ink) 40%, transparent); }

/* Türchen allgemein */
.door { position: relative; appearance: none; border: 0; padding: 0; background: none; cursor: pointer; font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.door.is-locked { cursor: not-allowed; }
.door-lock { width: 12px; height: 12px; }
.door-gift { width: 46%; height: 46%; max-width: 44px; max-height: 44px; }
.door.is-shaking { animation: shake 0.42s var(--ease-out); }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -4px 0; } 45% { translate: 3px 0; } 70% { translate: -2px 0; } }
.door-tip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); translate: -50% 0;
  z-index: 5; white-space: nowrap; pointer-events: none;
  padding: 6px 10px; border-radius: 8px;
  background: #141414; color: #fff;
  font: 600 0.8125rem/1.2 var(--font-body);
  box-shadow: 0 6px 16px -6px rgb(0 0 0 / 0.5);
}

/* Fokus beim Öffnen: Rest dimmt */
.t-cal { position: relative; outline: none; }
.t-cal .door { transition: opacity 0.4s var(--ease-out), filter 0.4s var(--ease-out); }
body.has-sheet .t-cal .door:not(.is-opening) { opacity: 0.45; filter: saturate(0.6); }

/* Anmeldung */
.t-signup {
  border-radius: calc(var(--radius) + 6px);
  background: var(--panel);
  padding: clamp(22px, 4vw, 40px);
}
.signup-inner { max-width: 560px; display: grid; gap: 14px; }
.t-signup h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
.signup-lede { color: var(--page-ink-2); }
.signup-form { display: grid; gap: 14px; margin-top: 6px; }
.signup-form[hidden], .signup-done[hidden] { display: none; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 650; font-size: 0.9375rem; }
.opt { font-weight: 400; color: var(--page-ink-2); }
.field input {
  min-height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid color-mix(in oklab, var(--page-ink) 28%, transparent);
  background: var(--field-bg);
  color: var(--page-ink);
}
.field input:focus-visible { outline: 3px solid var(--t-accent); outline-offset: 1px; border-color: transparent; }
.field input[aria-invalid="true"] { border-color: #e5484d; }
.field-err { color: inherit; font-size: 0.9375rem; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.field-err::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; translate: 0 -1px; }
.field-err[hidden] { display: none; }
.consent { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; font-size: 0.9375rem; color: var(--page-ink-2); cursor: pointer; }
.consent input {
  appearance: none;
  width: 22px; height: 22px; margin: 1px 0 0;
  border-radius: 6px;
  border: 2px solid color-mix(in oklab, var(--page-ink) 55%, transparent);
  background: var(--field-bg);
  display: grid; place-items: center;
  cursor: pointer;
}
.consent input::after {
  content: "";
  width: 11px; height: 6px;
  border: solid var(--t-on-accent);
  border-width: 0 0 2.5px 2.5px;
  rotate: -45deg;
  translate: 0 -1px;
  opacity: 0;
}
.consent input:checked { background: var(--t-accent); border-color: var(--t-accent); }
.consent input:checked::after { opacity: 1; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-form .t-btn { justify-self: start; min-width: 160px; }
.form-note { font-size: 0.875rem; color: var(--page-ink-2); }
.signup-done { display: grid; gap: 8px; outline: none; }
.done-icon { width: 36px; height: 36px; color: var(--t-accent); }
.done-title { font-size: 1.375rem; }
.done-text { color: var(--page-ink-2); }

/* Fuß */
.t-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding-top: 8px; font-size: 0.875rem; color: var(--page-ink-2); }
.t-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.t-foot a { color: var(--page-ink-2); }
.t-foot a:hover { color: var(--page-ink); }

/* Blatt */
.sheet {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  margin: auto auto 12px;
  padding: 26px 24px 24px;
  border: 0;
  border-radius: 22px;
  background: var(--t-open);
  color: var(--t-door-ink);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6);
  overflow: auto;
}
@media (min-width: 640px) { .sheet { margin: auto; } }
.sheet::backdrop { background: rgb(10 10 10 / 0.45); }
.sheet[open] { animation: sheet-in 0.5s var(--ease-out); }
@keyframes sheet-in { from { translate: 0 40px; opacity: 0; } }
.sheet-close-form { position: absolute; top: 10px; right: 10px; margin: 0; }
.sheet-close { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.sheet-close:hover { background: color-mix(in oklab, currentColor 10%, transparent); }
.sheet-close svg { width: 18px; height: 18px; }
.sheet-day { font-size: 0.875rem; font-weight: 600; opacity: 0.75; }
.sheet-title { font-size: clamp(1.5rem, 5vw, 1.875rem); margin: 6px 40px 10px 0; color: inherit; }
.sheet-text { line-height: 1.6; }
.sheet-extra { display: grid; gap: 14px; margin-top: 18px; justify-items: start; }
.sheet-extra .t-btn { background: var(--t-door-ink); color: var(--t-open); }
.code {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px 12px 16px;
  border: 2px dashed currentColor;
  border-radius: 14px;
}
.code > div { display: grid; gap: 2px; }
.code-label { font-size: 0.8125rem; font-weight: 600; opacity: 0.75; }
.code-value { font: 800 1.375rem/1.1 var(--font-display); letter-spacing: 0.06em; overflow-wrap: anywhere; }
.code-copy { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: color-mix(in oklab, currentColor 10%, transparent); color: inherit; font-weight: 650; cursor: pointer; }
.code-copy svg { width: 16px; height: 16px; }
.raffle { width: 100%; display: grid; gap: 12px; justify-items: start; padding: 16px; border-radius: 14px; background: color-mix(in oklab, currentColor 6%, transparent); }
.raffle strong { display: block; margin-bottom: 2px; }
.raffle-done { display: grid; grid-template-columns: 24px 1fr; gap: 10px; }
.raffle-done svg { width: 22px; height: 22px; }
.raffle-terms { font-size: 0.875rem; }

body[data-ground="dark"] { --field-bg: color-mix(in oklab, var(--page-bg) 80%, #000 20%); }

/* Prototyp-Leiste (nur Entwicklung) */
.proto {
  position: fixed; right: 12px; bottom: 12px; z-index: 40;
  max-width: calc(100vw - 24px);
  background: #151515; color: #f3f3f3;
  border-radius: 14px;
  font: 500 0.8125rem/1.3 "Figtree", system-ui, sans-serif;
  box-shadow: 0 12px 30px -10px rgb(0 0 0 / 0.55);
}
.proto summary { cursor: pointer; padding: 10px 14px; font-weight: 700; list-style: none; }
.proto summary::-webkit-details-marker { display: none; }
.proto-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 150px)); gap: 8px 10px; padding: 0 14px 14px; }
.proto label { display: grid; gap: 4px; color: #c9c9c9; }
.proto select { min-height: 34px; border-radius: 8px; border: 1px solid #3a3a3a; background: #222; color: #fff; padding: 0 6px; }
.proto-check { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 8px; }
.proto :focus-visible { outline: 2px solid #fff; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
