/* =========================================================
   Nonstrain - compliance & i18n add-ons
   Language toggle · footer legal links · cookie banner ·
   legal reading column. Loaded AFTER styles.css on every page.
   Uses the site's existing design tokens so everything matches.
   ========================================================= */

/* =========================================================
   Language toggle (DE / EN)
   ========================================================= */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  line-height: 1;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
/* Desktop-only variant for the top nav (mobile switches inside the menu). */
.lang-toggle--desktop { display: none; }
@media (min-width: 768px) { .lang-toggle--desktop { display: inline-flex; } }
.lang-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 5px 10px;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-softer);
  border-radius: 999px;
  transition: color 180ms ease, background 200ms ease;
}
a.lang-opt:hover { color: var(--accent-press); }
.lang-opt.is-active {
  color: var(--ink);
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(9, 63, 57, 0.10);
}

/* Footer (dark teal) context */
.site-footer .lang-toggle {
  border-color: rgba(250, 246, 236, 0.22);
  background: rgba(250, 246, 236, 0.06);
}
.site-footer .lang-opt { color: rgba(250, 246, 236, 0.62); }
.site-footer a.lang-opt:hover { color: var(--bg); }
.site-footer .lang-opt.is-active { color: var(--ink); background: var(--accent); }

/* Mobile menu context - bump the hit target up a touch */
.mobile-menu .lang-toggle { align-self: flex-start; }
.mobile-menu .lang-opt { padding: 8px 14px; font-size: 0.9375rem; }

/* =========================================================
   Footer legal links + cookie-settings button
   ========================================================= */
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 22px;
  padding-top: 24px;
}
.footer-legal a,
.footer-legal .footer-legal-link {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(250, 246, 236, 0.7);
  letter-spacing: -0.005em;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 180ms ease;
}
.footer-legal a:hover,
.footer-legal .footer-legal-link:hover { color: var(--bg); }
.footer-legal .footer-legal-spacer { flex: 1 1 auto; }

/* =========================================================
   Cookie consent banner - see assets/js/consent.js
   ========================================================= */
.ns-cc, .ns-cc * { box-sizing: border-box; }
.ns-cc {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  color: var(--ink-soft);
  line-height: 1.55;
}
.ns-cc[hidden], .ns-cc [hidden] { display: none !important; }

.ns-cc-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 2147483000;
  display: flex;
  justify-content: center;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  pointer-events: none;
}
.ns-cc-card {
  pointer-events: auto;
  width: 100%;
  max-width: 680px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 2px 4px rgba(9, 63, 57, 0.05), 0 18px 48px rgba(9, 63, 57, 0.16);
  padding: clamp(1.1rem, 3vw, 1.6rem);
}
.ns-cc h2 {
  margin: 0 0 0.4rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.ns-cc p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ink-softer);
}
.ns-cc a {
  color: var(--accent-press);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
.ns-cc a:hover { color: var(--ink); }

.ns-cc-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.ns-cc-btn {
  appearance: none;
  cursor: pointer;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.7rem 1.15rem;
  border-radius: 10px;
  line-height: 1;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease,
    transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 240ms ease;
}
.ns-cc-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Accept + Reject are deliberately EQUAL weight (German DPA requirement). */
.ns-cc-btn.is-primary {
  background: var(--accent);
  color: var(--ink);
  flex: 1 1 0;
  min-width: 150px;
  box-shadow: 0 1px 2px rgba(9, 63, 57, 0.08), 0 1px 0 rgba(255, 255, 255, 0.30) inset;
}
.ns-cc-btn.is-primary:hover {
  background: var(--accent-press);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(9, 63, 57, 0.14);
}
.ns-cc-btn.is-reject {
  background: var(--bg-alt);
  color: var(--ink);
  border-color: var(--line-strong);
  flex: 1 1 0;
  min-width: 150px;
}
.ns-cc-btn.is-reject:hover { border-color: var(--ink); background: #E6E0D0; transform: translateY(-1px); }
.ns-cc-btn.is-link {
  background: transparent;
  color: var(--ink-softer);
  border-color: transparent;
  flex: 0 0 auto;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ns-cc-btn.is-link:hover { color: var(--ink); }

.ns-cc-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(9, 63, 57, 0.5);
}
.ns-cc-dialog {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(9, 63, 57, 0.32);
  padding: clamp(1.3rem, 3vw, 1.9rem);
}
.ns-cc-modal h2 { font-size: 1.2rem; margin: 0 0 0.5rem; color: var(--ink); }
.ns-cc-intro { font-size: 0.9rem; color: var(--ink-softer); margin: 0 0 0.5rem; }
.ns-cc-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.ns-cc-row:first-of-type { border-top: none; }
.ns-cc-row h3 { margin: 0 0 0.25rem; font-size: 0.98rem; font-weight: 700; color: var(--ink); }
.ns-cc-row p { margin: 0; font-size: 0.85rem; color: var(--ink-softer); }
.ns-cc-modal .ns-cc-actions { margin-top: 1.4rem; }

/* Toggle switch */
.ns-cc-switch { position: relative; flex: 0 0 auto; width: 46px; height: 26px; }
.ns-cc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ns-cc-track {
  position: absolute; inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background 0.18s ease;
}
.ns-cc-track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.ns-cc-switch input:checked + .ns-cc-track { background: var(--accent); }
.ns-cc-switch input:checked + .ns-cc-track::after { transform: translateX(20px); }
.ns-cc-switch input:disabled + .ns-cc-track { background: var(--accent); opacity: 0.55; }
.ns-cc-switch input:focus-visible + .ns-cc-track { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Floating reopen button */
.ns-cc-reopen {
  position: fixed;
  left: 16px; bottom: 16px;
  z-index: 2147482999;
  appearance: none;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  box-shadow: 0 4px 16px rgba(9, 63, 57, 0.12);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.ns-cc-reopen:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px rgba(9, 63, 57, 0.16);
}
.ns-cc-reopen:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

@media (max-width: 520px) {
  .ns-cc-btn.is-primary, .ns-cc-btn.is-reject { flex: 1 1 100%; }
  .ns-cc-btn.is-link { flex: 1 1 100%; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ns-cc-track, .ns-cc-track::after, .ns-cc-btn, .ns-cc-reopen { transition: none; }
}

/* =========================================================
   Legal pages - Impressum / Datenschutz / Imprint / Privacy
   A clean reading column inside the site's full chrome.
   ========================================================= */
.ns-legal {
  max-width: 760px;
  margin: 0 auto;
  /* generous top padding clears the fixed 72px nav */
  padding: clamp(7rem, 11vw, 9.5rem) clamp(1.25rem, 4vw, 2rem) 5rem;
  color: var(--ink-soft);
  line-height: 1.75;
  font-size: 1.0625rem;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
}
.ns-legal h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(2.25rem, 5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
  font-weight: 600;
  color: var(--ink);
}
.ns-legal .ns-lead {
  color: var(--ink-softer);
  font-size: 1rem;
  margin: 0 0 2.5rem;
}
.ns-legal h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 3rem 0 0.85rem;
  font-weight: 600;
  color: var(--ink);
}
.ns-legal h3 {
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 1.85rem 0 0.5rem;
  font-weight: 700;
  color: var(--ink);
}
.ns-legal h4 {
  font-size: 1.02rem;
  line-height: 1.35;
  margin: 1.3rem 0 0.4rem;
  font-weight: 700;
  color: var(--ink);
}
.ns-legal p { margin: 0 0 1rem; color: var(--ink-soft); }
.ns-legal strong { color: var(--ink); font-weight: 700; }
.ns-legal a {
  color: var(--accent-press);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.ns-legal a:hover { color: var(--ink); }
.ns-legal .ns-block { margin: 0 0 1rem; color: var(--ink-soft); }
.ns-legal ul { margin: 0 0 1rem; padding-left: 1.25rem; color: var(--ink-soft); }
.ns-legal li { margin: 0 0 0.4rem; }
.ns-legal hr { border: none; border-top: 1px solid var(--line); margin: 2.75rem 0; }
.ns-legal .ns-updated { font-size: 0.85rem; color: var(--ink-softer); }
.ns-legal .ns-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 3rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-press);
  text-decoration: none;
}
.ns-legal .ns-back:hover { color: var(--ink); }
.ns-legal .ns-back svg { transition: transform 320ms cubic-bezier(0.22, 0.61, 0.36, 1); }
.ns-legal .ns-back:hover svg { transform: translateX(-3px); }

/* =========================================================
   Mobile fixes
   ========================================================= */

/* Mobile menu: once the page is scrolled, .nav.is-scrolled gets a
   backdrop-filter, which (per spec) makes the nav the containing block for the
   position:fixed menu — collapsing it to the nav's height and letting the page
   show through behind it. Viewport units escape the containing-block trap, so
   the menu always covers the full screen. (#mobile-menu beats Tailwind's
   inset-0 on specificity; bottom:auto lets the height win over top:0/bottom:0.) */
#mobile-menu {
  height: 100vh;   /* fallback */
  height: 100dvh;  /* dynamic viewport height on mobile */
  bottom: auto;
}

/* On phones, don't leave a cookie button floating on screen after consent.
   The footer "Cookie settings" / "Cookie-Einstellungen" link reopens it. */
@media (max-width: 767px) {
  .ns-cc-reopen { display: none; }
}
