/* =====================================================================
   Bio Hof Fürst – Grundlagen (Farben, Schrift, Knöpfe, Formulare)
   Wird von der Webseite UND der Verwaltung benutzt.
   Schriften: Systemschriften (keine Google-Fonts – datenschutzfreundlich).
   ===================================================================== */
:root {
  /* Palette */
  --elfenbein: #F8F6F0;      /* Hintergrund */
  --elfenbein-2: #F1EDE1;
  --sand: #E8E0CE;
  --linie: #DDD3BD;
  --wald: #2E4F4F;           /* Demeter-Waldgrün: Akzente */
  --wald-dunkel: #1F3838;
  --wald-hell: #4F7575;
  --anthrazit: #222222;      /* Text */
  --grau: #5A5750;
  --terrakotta: #B5573A;     /* Buttons & Status */
  --terrakotta-dunkel: #96432A;
  --ocker: #C58B2B;
  --erde: #8A6A4A;
  --weiss: #FFFFFF;
  --ok: #3F7D5A;
  --fehler: #A3321F;

  --kopf-h: 72px;           /* Höhe der festen Kopfleiste: Sprungziele landen genau darunter */
  --radius: 16px;
  --radius-klein: 10px;
  --schatten-klein: 0 1px 2px rgba(34, 34, 34, .06), 0 2px 10px rgba(34, 34, 34, .05);
  --schatten: 0 2px 4px rgba(34, 34, 34, .06), 0 14px 36px rgba(34, 34, 34, .12);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--kopf-h); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--elfenbein);
  color: var(--anthrazit);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; display: block; }
/* Vom Hofbetreiber eingestellter Bildausschnitt (js/api.js: HofUI.bildAnwenden) */
img.bild-ausschnitt { transform: scale(var(--zoom, 1)); transform-origin: var(--ox, 50%) var(--oy, 50%); }
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--wald-dunkel);
  margin: 0 0 .5em;
}
p { margin: 0 0 1em; }
a { color: var(--wald); text-underline-offset: .18em; }
a:hover { color: var(--terrakotta-dunkel); }
:focus-visible { outline: 3px solid var(--terrakotta); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { width: min(1160px, 100% - 40px); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--weiss); color: var(--wald-dunkel);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; box-shadow: var(--schatten);
}
.skip-link:focus { top: 12px; }

.icon { width: 1.2em; height: 1.2em; flex: none; display: inline-block; vertical-align: -.2em; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 46px; padding: .65em 1.4em;
  border: 2px solid transparent; border-radius: 999px;
  font: 600 1rem/1.15 var(--sans); text-decoration: none; text-align: center;
  cursor: pointer; transition: background-color .2s, color .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn-terra { background: var(--terrakotta); color: var(--weiss); }
.btn-terra:hover { background: var(--terrakotta-dunkel); color: var(--weiss); }
.btn-wald { background: var(--wald); color: var(--weiss); }
.btn-wald:hover { background: var(--wald-dunkel); color: var(--weiss); }
.btn-rand { background: transparent; border-color: var(--wald); color: var(--wald); }
.btn-rand:hover { background: var(--wald); color: var(--weiss); }
.btn-hell { background: rgba(248, 246, 240, .12); border-color: rgba(248, 246, 240, .75); color: var(--weiss); backdrop-filter: blur(4px); }
.btn-hell:hover { background: var(--elfenbein); color: var(--wald-dunkel); }
.btn-gefahr { background: transparent; border-color: var(--fehler); color: var(--fehler); }
.btn-gefahr:hover { background: var(--fehler); color: var(--weiss); }
.btn-klein { min-height: 38px; padding: .4em 1em; font-size: .92rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- Formulare ---------- */
.feld { display: grid; gap: 6px; margin-bottom: 16px; }
/* Zwei Felder nebeneinander (Vorname | Nachname) */
.feld-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.feld-reihe .feld { min-width: 0; }
.feld label, .feld .label { font-weight: 600; font-size: .95rem; }
.feld label small, .feld .label small { font-weight: 400; color: var(--grau); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: .6em .85em;
  font: inherit; color: var(--anthrazit); background: var(--weiss);
  border: 1.5px solid var(--linie); border-radius: var(--radius-klein);
  transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--wald); box-shadow: 0 0 0 3px rgba(46, 79, 79, .2); }
input[aria-invalid="true"] { border-color: var(--fehler); }
.haken { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; font-size: .92rem; line-height: 1.45; }
.haken input { width: 22px; height: 22px; min-height: 0; margin: 2px 0 0; accent-color: var(--wald); }
.feld-hinweis { font-size: .85rem; line-height: 1.4; color: var(--grau); }
.fehlertext { color: var(--fehler); font-size: .9rem; font-weight: 600; min-height: 1.2em; }
.honig { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Dialoge ---------- */
dialog {
  width: min(520px, calc(100% - 28px)); max-height: calc(100dvh - 28px);
  padding: 0; border: 0; border-radius: 20px; background: var(--elfenbein); color: var(--anthrazit);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35); overflow: auto;
}
dialog::backdrop { background: rgba(20, 34, 32, .6); backdrop-filter: blur(2px); }
.dialog-innen { padding: 26px 26px 24px; }
.dialog-kopf { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog-kopf h2 { font-size: 1.55rem; margin: 0; }
.dialog-zu { background: none; border: 0; padding: 6px; margin: -6px; cursor: pointer; color: var(--grau); border-radius: 8px; }
.dialog-zu:hover { color: var(--anthrazit); background: var(--sand); }
.dialog-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 6px; }
/* Handy: Fenster beginnen oben (nicht mittig) – die Bildschirmtastatur verdeckt so nichts, und man liest von oben nach unten */
@media (max-width: 640px) {
  dialog { width: calc(100% - 20px); max-width: calc(100% - 20px); margin-top: 10px; margin-bottom: auto; max-height: calc(100dvh - 20px); border-radius: 18px; }
  .dialog-innen { padding: 20px 16px 18px; }
}

/* ---------- Hinweis, wenn die Seite als Datei (file://) statt über den Server geöffnet wurde ---------- */
.datei-hinweis {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  padding: 14px 20px; background: #FFE9A8; color: #4a3600; border-top: 3px solid var(--ocker);
  font-size: .95rem; line-height: 1.45; text-align: center;
}
.datei-hinweis a { color: #4a3600; font-weight: 700; }

/* ---------- Kleine Meldung unten ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200;
  max-width: min(560px, calc(100% - 32px));
  padding: 14px 20px; border-radius: 14px;
  background: var(--wald-dunkel); color: var(--elfenbein); font-weight: 600; box-shadow: var(--schatten);
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
.toast.fehler { background: var(--fehler); color: var(--weiss); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
