/* ---------- language switch + cookie banner + legal pages ----------
   Loaded on every page, after core.css. */

/* ---------------------------------------------------- language switch */
/* The EN/DE pill was replaced by the React island in components/ui/switch.tsx.
   These rules are kept only for the <noscript> fallback links below; the
   .langsw markup they targeted is no longer rendered. */
.langsw-root {
  display: inline-flex;
  align-items: center;
  flex: none;
  /* switch.tsx draws its track with `box-shadow: 0 0 0 0.66em #aaa`, which
     paints ~10.5px outside the element's own box and is not part of layout.
     Without this margin the grey ring overlaps the Start a Project button by
     3px. Left/right differ because only the right side has a neighbour. */
  margin-inline: 12px 34px;
}
.langsw-root noscript a {
  font: 600 11.5px/1 var(--font-ui); letter-spacing: .08em;
  padding: 6px 8px; color: var(--text-muted); text-decoration: none;
}

/* An outer neutral pill with a coloured indicator that slides between the two
   options. The indicator is a sibling behind the links rather than a
   background on the active one, because only a single moving element can
   animate between positions. */
.langsw {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--muted);
  flex: none;
  isolation: isolate;          /* keeps the indicator under the labels */
}

.langsw__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  /* exactly one option wide, so translateX(100%) lands on the other */
  width: calc((100% - 6px) / 2);
  height: calc(100% - 6px);
  border-radius: var(--r-pill);
  background: #2563EB;                       /* EN */
  z-index: -1;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .28);
}
/* Colour and shadow cross-fade on a plain transition; the travel itself is a
   keyframe animation, because a transition cannot peak in the middle and the
   squash has to build up and release again inside one move. */
.langsw.is-ready .langsw__thumb {
  transition:
    background-color .5s cubic-bezier(.65, 0, .35, 1),
    box-shadow       .5s cubic-bezier(.65, 0, .35, 1);
}
.langsw[data-lang="de"] .langsw__thumb {
  transform: translateX(100%);
  background: #DC2626;                       /* DE */
  box-shadow: 0 2px 8px rgba(220, 38, 38, .28);
}

/* The pill leads with its edge: it stretches as it leaves, holds the stretch
   across the gap, and settles back to a true round at the far side. scaleX is
   applied about the centre so both ends deform, which reads as one physical
   object moving rather than a box being redrawn. */
@keyframes langsw-to-de {
  0%   { transform: translateX(0)    scaleX(1);    }
  22%  { transform: translateX(14%)  scaleX(1.14); }
  55%  { transform: translateX(62%)  scaleX(1.18); }
  82%  { transform: translateX(97%)  scaleX(1.05); }
  100% { transform: translateX(100%) scaleX(1);    }
}
@keyframes langsw-to-en {
  0%   { transform: translateX(100%) scaleX(1);    }
  22%  { transform: translateX(86%)  scaleX(1.14); }
  55%  { transform: translateX(38%)  scaleX(1.18); }
  82%  { transform: translateX(3%)   scaleX(1.05); }
  100% { transform: translateX(0)    scaleX(1);    }
}
/* The keyframes end exactly on the resting transform for that language, so
   dropping the class after the run leaves the pill where it already is. */
.langsw.is-to-de .langsw__thumb {
  animation: langsw-to-de .5s cubic-bezier(.65, 0, .35, 1) both;
}
.langsw.is-to-en .langsw__thumb {
  animation: langsw-to-en .5s cubic-bezier(.65, 0, .35, 1) both;
}

.langsw__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 6px 10px;
  border-radius: var(--r-pill);
  font: 600 11.5px/1 var(--font-ui);
  letter-spacing: .08em;
  color: var(--text-muted);
  text-decoration: none;
  /* Held back so the label flips as the pill arrives under it, not the
     instant the link is clicked - otherwise the incoming label sits white
     on the light track for the whole 500ms of travel. .24s + .26s lands
     exactly on the end of the slide. */
  transition: color .26s var(--ease-out) .24s;
  -webkit-tap-highlight-color: transparent;
}
.langsw__opt:hover { color: var(--ink); }
.langsw__opt.on { color: #FFFFFF; }
.langsw__opt:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* On the dark drawer the pill needs its own ground. The type rules also have
   to be restated: `.mobile-menu a` sets a 32px menu font and is more specific
   than `.langsw__opt`, so without these the two labels render at menu size and
   collide into one word. */
.mobile-menu .langsw {
  margin-top: 22px;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .16);
  align-self: flex-start;
}
.mobile-menu .langsw__opt {
  font: 600 12px/1 var(--font-ui);
  letter-spacing: .08em;
  min-width: 46px;
  min-height: 40px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, .62);
  /* the drawer staggers its links in; the switch is chrome, not a menu item */
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}
.mobile-menu .langsw__opt:hover { color: #FFFFFF; }
.mobile-menu .langsw__opt.on { color: #FFFFFF; }

@media (prefers-reduced-motion: reduce) {
  .langsw.is-ready .langsw__thumb { transition: none; }
  .langsw.is-to-de .langsw__thumb,
  .langsw.is-to-en .langsw__thumb { animation: none; }
}
@media (pointer: coarse) {
  .langsw__opt { min-height: 40px; min-width: 46px; padding: 10px 12px; }
}

/* --------------------------------------------------------- cookie bar */
.cc {
  position: fixed;
  left: 16px; right: 16px;
  bottom: 16px;
  z-index: 2400;               /* above the drawer (1500), below nothing else */
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
  border-radius: var(--r-block);
  box-shadow: 0 12px 40px rgba(18, 16, 12, .18);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .3s var(--ease-out), transform .35s var(--ease-out);
}
.cc.is-in { opacity: 1; transform: none; }
.cc__inner {
  max-width: 980px;
  margin-inline: auto;
  padding: clamp(18px, 2.4vw, 24px);
}
.cc__title { margin: 0 0 6px; font: 400 19px/1.3 var(--font-display); }
.cc__body  { margin: 0 0 8px; font-size: 14px; line-height: 1.6; color: var(--text-muted); max-width: 68ch; }
.cc__link  { font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.cc__options { margin: 16px 0 4px; display: grid; gap: 10px; }
.cc__opt { display: flex; gap: 11px; align-items: flex-start; cursor: pointer; }
.cc__opt input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent-2); }
.cc__opt span { display: block; font-size: 13.5px; line-height: 1.45; }
.cc__opt strong { display: block; font-weight: 600; }
.cc__opt em { font-style: normal; color: var(--text-muted); font-size: 12.5px; }
.cc__opt--locked { opacity: .72; cursor: default; }

.cc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}
/* Reject carries the same visual weight as Accept - a quieter "reject" is a
   dark pattern and is not valid consent under GDPR Art. 7(3). */
.cc__btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font: 600 14px/1 var(--font-ui);
  cursor: pointer;
  transition: background-color .25s var(--ease-out), color .25s var(--ease-out);
}
.cc__btn:hover { background: var(--surface-2); }
.cc__btn--accept { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cc__btn--accept:hover { background: var(--accent-2); }
.cc__btn--save { background: var(--ink); border-color: var(--ink); color: var(--text-invert); }
.cc__btn--ghost { border-color: var(--muted); color: var(--text-muted); flex: 0 0 auto; }

@media (min-width: 760px) {
  .cc__actions { justify-content: flex-end; }
  .cc__btn { flex: 0 0 auto; min-width: 132px; }
}

/* "Cookie Settings" is a button, not a link, because it opens the consent
   dialog rather than going anywhere. Every rule in the footer targets
   `.foot-bottom nav a`, so the button matched none of them and fell back to the
   UA button font (16px) and full-strength black. These restate the anchor
   styling so it sits on the same line, at the same size and weight, and gets
   the same tap padding on touch. */
.foot-bottom nav .foot-cookie {
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: inherit;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color .3s var(--ease-out);
}
.foot-bottom nav .foot-cookie:hover { color: var(--ink); }
.foot-bottom nav .foot-cookie:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

@media (pointer: coarse) {
  /* matches the padding the sibling links get, so the row stays aligned */
  .foot-bottom nav .foot-cookie { padding-block: 9px; }
}

/* ------------------------------------------------------- legal pages */
.legal-draft {
  display: inline-block;
  margin: 14px 0 0;
  padding: 9px 15px;
  border-radius: var(--r-pill);
  border: 1px dashed var(--accent-2);
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--text);
}
.post-byline--plain { border-top: 0; padding-top: 0; margin-top: 14px; font-size: 13px; color: var(--text-muted); }
.legal-body h2 { font-size: clamp(19px, 1.9vw, 23px); }
/* placeholders are meant to be impossible to miss while drafting */
.legal-body .legal-todo {
  margin-top: 26px;
  padding: 13px 16px;
  border-left: 3px solid var(--accent-2);
  background: var(--surface-2);
  font-size: 13.5px;
}
