/* Legal pages (Impressum, Datenschutz) + Cookie Consent Banner */

body.legal-page { background: var(--paper); }
body.legal-page .site-header { position: sticky; top: 0; background: rgba(247, 241, 229, 0.92); backdrop-filter: blur(14px); box-shadow: 0 1px 0 rgba(34, 48, 31, 0.08); }

.legal {
  padding-block: clamp(5rem, 10vh, 8rem) clamp(4rem, 8vw, 7rem);
}
.legal .container { max-width: 780px; }

.legal-lang-switch { text-align: right; margin-bottom: 2rem; font-size: 0.9rem; }
.legal-lang-switch a { color: var(--russet); border-bottom: 1px solid currentColor; }

.legal-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 1.5rem + 2vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--forest-deep);
  margin-block: 0.5rem 1.5rem;
}
.legal-title em { font-style: italic; color: var(--russet); font-weight: 400; }

.legal h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.7rem);
  font-weight: 500;
  color: var(--forest-deep);
  margin-block: 2.6rem 0.9rem;
}
.legal h2:first-of-type { margin-top: 2rem; }

.legal p { line-height: 1.7; color: var(--ink); }
.legal .lead { color: var(--ink-soft); font-size: 1.1rem; }
.legal ul { margin: 0 0 1.3em 0; padding-left: 1.3em; }
.legal ul li { list-style: disc; margin-bottom: 0.3em; }
.legal a { color: var(--russet); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.legal a:hover { color: var(--russet-deep); }
.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--cream-deep);
  border: 1px solid rgba(198, 145, 47, 0.25);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}
.legal-divider { border: 0; height: 1px; background: rgba(110, 81, 56, 0.2); margin-block: 4rem; }
.legal-updated {
  margin-top: 2.5rem;
  font-size: 0.85rem;
  color: var(--bark);
  font-style: italic;
}

/* mark [TODO] placeholders visibly so the operator can fill them in */
[data-todo] {
  background: linear-gradient(180deg, rgba(217, 164, 65, 0.18), rgba(217, 164, 65, 0.12));
  color: var(--bark);
  padding: 0.1em 0.5em;
  border-radius: 4px;
  border: 1px dashed rgba(198, 145, 47, 0.55);
  font-style: italic;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin-block: 1rem 1.5rem;
  font-size: 0.95rem;
}
.legal-table th, .legal-table td {
  border: 1px solid rgba(110, 81, 56, 0.2);
  padding: 0.7rem 0.9rem;
  text-align: left;
  vertical-align: top;
}
.legal-table th {
  background: var(--cream-deep);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bark);
}

.legal-inline-btn {
  border: 0;
  background: transparent;
  color: var(--russet);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.legal-inline-btn:hover { color: var(--russet-deep); }

/* ---------------------------------------------------------------
   Cookie-Consent Banner + Modal
   --------------------------------------------------------------- */

.cc-banner {
  position: fixed;
  right: clamp(0.8rem, 2vw, 1.6rem);
  bottom: clamp(0.8rem, 2vw, 1.6rem);
  left: auto;
  z-index: 500;
  width: min(500px, calc(100vw - 1.6rem));
  padding: clamp(1.4rem, 2vw, 1.8rem);
  background: var(--paper);
  border: 1px solid rgba(198, 145, 47, 0.4);
  border-radius: 18px;
  box-shadow: 0 24px 60px -30px rgba(23, 40, 31, 0.55), 0 6px 20px -10px rgba(23, 40, 31, 0.25);
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  font-family: var(--font-sans);
}
.cc-banner.is-visible { transform: none; opacity: 1; }
.cc-banner[hidden] { display: none; }
.cc-banner h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--forest-deep);
}
.cc-banner p {
  margin: 0 0 1rem;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.cc-banner p a { color: var(--russet); text-decoration: underline; text-underline-offset: 3px; }

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.cc-btn {
  flex: 1 1 auto;
  min-width: 130px;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  border: 1px solid transparent;
  font: 600 0.88rem/1 var(--font-sans);
  cursor: pointer;
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out), border-color 0.3s var(--ease-out), transform 0.2s var(--ease-out);
}
.cc-btn:hover { transform: translateY(-1px); }
.cc-btn-primary {
  background: var(--forest);
  color: var(--cream);
}
.cc-btn-primary:hover { background: var(--forest-deep); }
.cc-btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: rgba(34, 48, 31, 0.28);
}
.cc-btn-secondary:hover { border-color: var(--ink); background: var(--cream-deep); }
.cc-btn-tertiary {
  background: transparent;
  color: var(--bark);
  border-color: transparent;
  flex: 0 0 auto;
  min-width: 0;
  padding: 0.75rem 0.6rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cc-btn-tertiary:hover { color: var(--russet); }

/* Modal for preferences */
.cc-modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(15, 23, 16, 0.75);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.cc-modal[hidden] { display: none; }
.cc-modal-inner {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid rgba(198, 145, 47, 0.4);
  border-radius: 18px;
  padding: clamp(1.5rem, 2.5vw, 2.2rem);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,0.6);
}
.cc-modal h2 {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--forest-deep);
}
.cc-modal > .cc-modal-inner > p {
  margin: 0 0 1.6rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}
.cc-cat {
  border-top: 1px solid rgba(110, 81, 56, 0.18);
  padding-block: 1.1rem;
}
.cc-cat:last-of-type { border-bottom: 1px solid rgba(110, 81, 56, 0.18); margin-bottom: 1.4rem; }
.cc-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.cc-cat-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--forest-deep);
}
.cc-cat p {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.cc-cat[data-locked] .cc-toggle { opacity: 0.6; cursor: not-allowed; }
.cc-cat[data-locked] .cc-toggle-badge { color: var(--bark); font-style: italic; font-size: 0.78rem; }

.cc-toggle {
  --w: 44px;
  --h: 24px;
  position: relative;
  display: inline-block;
  width: var(--w);
  height: var(--h);
  flex: none;
}
.cc-toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cc-toggle-track {
  display: block;
  width: var(--w);
  height: var(--h);
  background: rgba(110, 81, 56, 0.28);
  border-radius: 999px;
  transition: background-color 0.3s var(--ease-out);
}
.cc-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(var(--h) - 4px);
  height: calc(var(--h) - 4px);
  background: var(--paper);
  border-radius: 50%;
  transition: transform 0.3s var(--ease-out);
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.cc-toggle input:checked ~ .cc-toggle-track { background: var(--forest); }
.cc-toggle input:checked ~ .cc-toggle-track::after { transform: translateX(calc(var(--w) - var(--h))); }
.cc-toggle input:focus-visible ~ .cc-toggle-track { outline: 2px solid var(--gold); outline-offset: 2px; }

.cc-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

/* Reopen consent link (small floating pill, only appears after consent given) */
.cc-reopen {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 90;
  background: rgba(23, 40, 31, 0.88);
  color: var(--cream);
  border: 0;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font: 600 0.75rem/1 var(--font-sans);
  letter-spacing: 0.05em;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.3s;
}
.cc-reopen:hover { opacity: 1; }
.cc-reopen[hidden] { display: none; }

@media (max-width: 620px) {
  .cc-banner { left: 0.7rem; right: 0.7rem; bottom: 0.7rem; width: auto; max-width: none; }
  .cc-btn { flex: 1 1 100%; }
  .cc-btn-tertiary { flex: 1 1 100%; padding: 0.6rem; }
  .cc-reopen { left: auto; right: 0.7rem; bottom: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-banner, .cc-btn, .cc-toggle-track::after { transition: none !important; }
}
