/* ============================================================
   Legal pages (Impressum, Datenschutz) + 404 — SELF-CONTAINED CSS.

   These pages depend ONLY on the design-system tokens
   (design-system/styles.css) + this file — never on css/site.css — so they
   survive any redesign of the main site. They DO load i18n.js + partials.js
   for the shared chrome (header with DE|EN switch + drawer, footer): the
   classes partials.js renders are therefore replicated below with the same
   metrics as site.css. Keep them in sync by hand when the header/footer
   changes.

   Content is bilingual: each page carries a [data-legal-lang="de"] and a
   [data-legal-lang="en"] block; <html lang> (set by i18n.js) decides which
   one is visible. Without JS the German block shows (html lang="de").
   Composes ONLY tokens — no raw hex.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
p { margin: 0 0 1.1em; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.shell { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad-x); }

/* ----- Language blocks: <html lang> picks one ----- */
[data-legal-lang] { display: none; }
html[lang="en"] [data-legal-lang="en"] { display: block; }
html:not([lang="en"]) [data-legal-lang="de"] { display: block; }

/* ----- Header (replica of the site header, rendered by partials.js) ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 48px;
  padding: 18px var(--pad-x);
  max-width: var(--max);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: start;
  padding-right: 32px;
}
.brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  filter: grayscale(20%);
  mix-blend-mode: multiply;
}
.brand .wordmark {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.22em;
  line-height: 1;
  color: var(--ink);
  white-space: nowrap;
}
.brand .tagline {
  display: block;
  font-family: var(--sans);
  font-size: 9.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 6px;
}
.nav { justify-self: center; display: flex; gap: 38px; }
.nav a {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 8px 0;
  position: relative;
  transition: color .25s ease;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .35s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after,
.nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }

@media (max-width: 1380px) {
  .brand .wordmark { font-size: 18px; letter-spacing: 0.18em; }
  .nav { gap: 26px; }
}
@media (max-width: 1024px) {
  .brand .wordmark { font-size: 16px; letter-spacing: 0.14em; }
}

/* Mobile menu (drawer below 1200px, same as the main site) */
.menu-toggle {
  display: none;
  background: none;
  border: 0;
  width: 36px;
  height: 36px;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.menu-toggle span {
  display: block;
  height: 1px;
  background: var(--ink);
  margin: 6px auto;
  width: 22px;
  transition: transform .3s ease, opacity .3s ease;
}
@media (max-width: 1200px) {
  .nav { display: none; }
  .menu-toggle { display: block; justify-self: end; grid-column: 2; grid-row: 1; }
  .site-header__inner { grid-template-columns: 1fr auto; }
  .nav.is-open {
    display: flex;
    flex-direction: column;
    grid-column: 1 / -1;
    grid-row: 2;
    gap: 18px;
    padding: 24px 0 8px;
    border-top: 1px solid var(--line-soft);
    margin-top: 12px;
  }
}
@media (max-width: 900px) {
  .brand .tagline { display: none; }
  .brand img { width: 44px; height: 44px; }
  .brand .wordmark { font-size: 16px; }
}

/* ----- Language switcher (DE | EN) ----- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: var(--tracking-mid);
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1;
}
.lang-switch__btn {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  opacity: 0.5;
  transition: opacity .18s ease;
}
.lang-switch__btn:hover,
.lang-switch__btn:focus-visible { opacity: 1; outline: none; }
.lang-switch__btn.is-active { opacity: 1; cursor: default; color: var(--accent); }
.lang-switch__sep { opacity: 0.35; font-weight: 300; user-select: none; }
.site-header .lang-switch--header { margin-left: 18px; padding-left: 18px; border-left: 1px solid var(--line-soft); }
@media (max-width: 1200px) {
  .site-header .lang-switch--header { margin-left: 0; padding-left: 0; border-left: 0; margin-top: 14px; }
}

/* ----- Legal page body ----- */
/* Top/bottom only — the horizontal gutter comes from .shell. */
.legal-page { padding-top: clamp(72px, 11vw, 160px); padding-bottom: clamp(72px, 10vw, 140px); }
.legal-page h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: var(--text-h1);
  line-height: var(--lh-display);
  margin: 0 0 56px;
}
.legal-page .columns { display: grid; grid-template-columns: 1fr 2fr; gap: clamp(32px, 5vw, 96px); }
.legal-page aside {
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-mute);
  position: sticky;
  top: 120px;
  height: max-content;
}
.legal-page aside ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 8px; }
.legal-page aside ul a { color: var(--ink-soft); }
.legal-page aside ul a:hover { color: var(--ink); }
.legal-page article h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--text-h2);
  margin: 48px 0 14px;
  letter-spacing: 0.01em;
}
.legal-page article h2:first-child { margin-top: 0; }
.legal-page article p,
.legal-page article address {
  color: var(--ink);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  max-width: var(--content-narrow);
  font-style: normal;
}
.legal-page article p + p { margin-top: 0.6em; }
.legal-page article a { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.legal-page article a:hover { color: var(--accent); }
.legal-page article code {
  font-family: var(--sans);
  font-size: 0.92em;
  background: var(--surface-faint);
  padding: 0 var(--space-1);
}
@media (max-width: 800px) {
  .legal-page .columns { grid-template-columns: 1fr; }
  .legal-page aside { position: static; }
}

/* ----- Footer (replica of the site footer, rendered by partials.js) ----- */
.site-footer {
  background: var(--bg-deep);
  color: var(--on-deep-muted);
  padding: 88px var(--pad-x) 32px;
  margin-top: 120px;
}
.site-footer .grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1.5fr 1fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--line-on-deep);
}
.site-footer h4 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--on-deep-label);
  margin: 0 0 18px;
  font-weight: 500;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.site-footer ul.footer-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 32px; }
.site-footer a { color: var(--on-deep-muted); transition: color .25s; }
.site-footer a:hover { color: var(--on-deep-white); }
.site-footer .word {
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: 0.18em;
  color: var(--on-deep);
  margin: 0 0 10px;
}
.site-footer .small { font-size: 13.5px; line-height: 1.7; color: var(--on-deep-mute); }
.site-footer .legal {
  max-width: var(--max);
  margin: 0 auto;
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 12px;
  color: var(--on-deep-faint);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
}
.site-footer .legal a { color: var(--on-deep-mute); }
.site-footer .legal__links { display: inline-flex; align-items: center; gap: 12px; }
.site-footer .legal__links .lang-switch--footer {
  margin-left: 12px;
  padding-left: 16px;
  border-left: 1px solid var(--line-soft);
  color: var(--ink-soft);
}
.site-footer .legal__links .lang-switch--footer .lang-switch__btn.is-active { color: var(--bg); }
@media (max-width: 900px) {
  .site-footer .grid { grid-template-columns: 1fr 1fr; gap: 36px; }
  .site-footer ul.footer-nav { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .site-footer .legal { flex-direction: column; gap: 12px; align-items: center; text-align: center; }
  .site-footer .legal__links { flex-wrap: wrap; justify-content: center; }
  .site-footer .legal__links .lang-switch--footer {
    margin-left: 0; padding-left: 0; border-left: 0; flex-basis: 100%; justify-content: center;
  }
}
@media (max-width: 560px) {
  .site-footer .grid { grid-template-columns: 1fr; }
}
