/* Legal pages — Privacy Notice / Imprint. Requires base.css.

   These are genuine separate pages, not another `is-*` state of the hero
   stage: there is no `.hero` container here, so none of the cqh/cqw stage
   units the rest of the site is built on apply. Sizing below is plain
   rem/vw, matching base.css's own mobile-tier fallback scale in spirit. */

body.legal {
  display: block;
  height: auto;
  min-height: 100dvh;
  overflow: visible auto;
}

.legal-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* `.legal--scroll` (privacy-notice/imprint/cookie-policy only — NOT
   `404.html`, which reuses `.legal-page` for its header but has no
   `.legal-body`/`.legal-scroll` wrapper) switches the page itself from
   native scrolling to a fixed-viewport-height layout: a new
   `.legal-scroll` column does the scrolling instead, with `.legal-rail` as
   its custom up/down-chevron + track + diamond-thumb control — the same
   one the lightbox caption reuses from `.about-rail`. A bare `body.legal`/
   `.legal-page` (404's own case) must keep the original auto-height/
   native-scroll rules above, or a 404 page taller than one viewport (a
   very short window) would clip with no way to scroll. Reverted back to
   plain flowing/native-scroll at phone width (see the phone media query
   below), where a thin custom rail is fiddly to hit and native touch
   scrolling already works. */
body.legal.legal--scroll {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.legal.legal--scroll .legal-page {
  height: 100dvh;
  min-height: 0;
}

/* ---------- Header ---------- */

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4vw;
  flex: 0 0 auto;
  padding: 2vh 5vw;
}

.legal-header__home {
  display: block;
  line-height: 0;
}

/* Shrunk from 150px on request ("content should start upper") — this
   full-page-nav logo was taking up more header height than the small
   back-link beside it needed, pushing the title further down than
   necessary. Still well above the 90px floor it now carries. */
.legal-header__home img {
  display: block;
  width: 110px;
  min-width: 90px;
  max-width: 14vw;
  height: auto;
  transition: opacity var(--ease-ui);
}

.legal-header__home:hover img {
  opacity: 0.82;
}

.legal-header__home:active img {
  opacity: 0.7;
}

/* These pages have no stage/flow split (see the file header comment), so
   unlike hero.*.html's fixed corner pill + separate mobile-nav instance,
   the switcher here is a single in-flow instance grouped with the back
   link, present at every width. `.legal-header` keeps its own plain
   `space-between` between the logo and this group. */
.legal-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.legal-header__back {
  font-family: var(--font-utility);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--paper-dim);
  text-decoration: none;
  transition: color var(--ease-ui);
}

.legal-header__back:hover {
  color: var(--paper);
}

.legal-header__back:active {
  color: var(--paper-dim);
}

/* ---------- Content ---------- */

/* Row beneath the header: the scrollable column plus its rail. `flex: 1`
   plus `min-height: 0` is what lets `.legal-scroll` size itself off the
   remaining viewport height instead of growing to fit its (long) content. */
.legal-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  width: 100%;
}

.legal-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.legal-scroll::-webkit-scrollbar {
  display: none;
}

/* ---------- Scroll rail ---------- */

/* Replaces the page's native scrollbar. Rebuilt from `.about-rail`'s own
   up/down-chevron + track + diamond-thumb control (`about.css`) — same
   markup shape and behaviour, sized in plain px rather than `cqw`/`cqh`
   since this file has no `.hero` stage/container-query context to size
   against (see the file header note). `legal.js` (loaded only by these
   three pages) drives it; `is-active` is set only once the column
   actually overflows, same as the lightbox caption's own copy of this
   rail — a short page (e.g. imprint's shorter register) shows no rail. */
.legal-rail {
  position: relative;
  display: none;
  flex: 0 0 20px;
  margin: 1.2vh 5vw 1.2vh 0;
  color: var(--paper);
}

.legal-rail.is-active {
  display: block;
}

.legal-rail__step {
  position: absolute;
  left: 0;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  color: inherit;
  cursor: pointer;
  transition: opacity var(--ease-ui), transform var(--ease-ui);
}

.legal-rail__step svg {
  display: block;
  width: 100%;
  height: auto;
}

.legal-rail__step:hover {
  opacity: 0.7;
}

.legal-rail__step--up {
  top: 0;
}

.legal-rail__step--down {
  bottom: 0;
}

.legal-rail__step--up:active {
  transform: translateY(-2px);
}

.legal-rail__step--down:active {
  transform: translateY(2px);
}

.legal-rail__track {
  position: absolute;
  left: 50%;
  top: 26px;
  bottom: 26px;
  width: 1px;
  margin-left: -0.5px;
  background: var(--paper);
  cursor: pointer;
}

/* Shorter than the track itself, so the diamond never collides with either
   chevron button — mirrors `.about-rail__travel`'s own clearance. */
.legal-rail__travel {
  position: absolute;
  left: 0;
  right: 0;
  top: 32px;
  bottom: 32px;
}

.legal-rail__thumb {
  position: absolute;
  left: 50%;
  top: 0;
  width: 10px;
  height: 14px;
  color: var(--paper);
  transform: translateX(-50%);
}

.legal-rail__thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Below phone width, drop the fixed-height/custom-rail layout entirely and
   let the page scroll natively again — a thin draggable rail is fiddly to
   hit with a finger, and native touch scrolling already works fine here. */
@media (max-width: 640px) {
  body.legal.legal--scroll {
    height: auto;
    min-height: 100dvh;
    overflow: visible auto;
  }

  body.legal.legal--scroll .legal-page {
    height: auto;
    min-height: 100dvh;
  }

  .legal-body {
    display: block;
  }

  .legal-scroll {
    overflow: visible;
  }

  .legal-rail {
    display: none !important;
  }
}

.legal-content {
  width: 100%;
  max-width: 760px;
  min-width: 0;
  margin: 0 auto;
  padding: 1.2vh 5vw 12vh;
}

.legal-content__title {
  margin: 0 0 3vh;
  font-family: var(--font-utility);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: normal;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--paper);
}

.legal-content__note {
  margin: 0 0 2.4rem;
  padding: 1.4rem 1.6rem;
  background: var(--panel-gallery);
  font-family: var(--font-utility);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--paper);
}

.legal-content__note p {
  margin: 0;
}

.legal-content__note p + p {
  margin-top: 0.8rem;
}

.legal-content__note a {
  color: var(--paper);
}

/* ---------- Long-document body copy ---------- */

.legal-content p {
  margin: 0 0 1.2rem;
  font-family: var(--font-utility);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--paper);
}

.legal-content a {
  color: var(--paper);
  text-decoration-color: rgba(244, 247, 249, 0.4);
  text-underline-offset: 2px;
  transition: opacity var(--ease-ui);
}

.legal-content a:hover {
  opacity: 0.78;
}

.legal-content a:active {
  opacity: 0.6;
}

.legal-content ul,
.legal-content ol {
  margin: 0 0 1.2rem;
  padding-left: 1.3rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
  font-family: var(--font-utility);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--paper);
}

.legal-content li::marker {
  color: var(--paper-dim);
}

.legal-content h2 {
  margin: 3.6rem 0 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(244, 247, 249, 0.22);
  font-family: var(--font-utility);
  font-weight: normal;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--paper);
  /* `.legal-toc`'s links jump here, and `.legal-scroll` (not the page) is
     the scrolling ancestor now — without this, a jump lands the heading
     flush against the scroll box's own top edge with no breathing room. */
  scroll-margin-top: 1.5rem;
}

.legal-content h2:first-of-type {
  margin-top: 2.4rem;
}

.legal-content h3 {
  margin: 2.2rem 0 0.9rem;
  font-family: var(--font-utility);
  font-weight: normal;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--paper);
  scroll-margin-top: 1.5rem;
}

.legal-content h3:first-child {
  margin-top: 0;
}

/* Quick nav for a long document */

.legal-toc {
  margin: 0 0 2.6rem;
  padding: 1.3rem 1.5rem;
  background: rgba(244, 247, 249, 0.06);
}

.legal-toc__title {
  margin: 0 0 0.8rem;
  font-family: var(--font-utility);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.legal-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 2rem;
}

.legal-toc li {
  margin: 0;
}

.legal-toc a {
  display: inline-block;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 247, 249, 0.3);
  transition: border-color var(--ease-ui), opacity var(--ease-ui);
}

.legal-toc a:hover {
  border-color: var(--paper);
}

.legal-toc a:active {
  opacity: 0.7;
}

@media (max-width: 640px) {
  .legal-toc ol {
    grid-template-columns: 1fr;
  }
}

/* Structured field lists — each processing activity's own register entry */

.legal-fields {
  display: grid;
  grid-template-columns: minmax(150px, 230px) 1fr;
  gap: 0.5rem 1.6rem;
  margin: 0 0 1.8rem;
}

.legal-fields dt {
  padding-top: 0.15rem;
  font-family: var(--font-utility);
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.legal-fields dd {
  margin: 0 0 0.85rem;
  font-family: var(--font-utility);
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--paper);
}

@media (max-width: 640px) {
  .legal-fields {
    grid-template-columns: 1fr;
  }

  .legal-fields dt {
    padding-top: 0.6rem;
  }
}

/* Entity cards — controller identity, processors */

.legal-entity {
  margin: 0 0 1.6rem;
  padding: 1.6rem 1.8rem;
  background: var(--panel-gallery);
}

.legal-entity__name {
  margin: 0 0 1rem;
  font-family: var(--font-utility);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--paper);
}

.legal-entity .legal-fields {
  margin-bottom: 0;
}

.legal-entity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
  margin: 0 0 1.8rem;
}

@media (max-width: 640px) {
  .legal-entity-grid {
    grid-template-columns: 1fr;
  }
}

/* Cookie table */

.legal-table-wrap {
  overflow-x: auto;
  margin: 0 0 1.6rem;
}

.legal-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
}

.legal-table caption {
  margin-bottom: 0.6rem;
  text-align: left;
  font-family: var(--font-utility);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.legal-table th,
.legal-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(244, 247, 249, 0.16);
  text-align: left;
  vertical-align: top;
  font-family: var(--font-utility);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--paper);
}

.legal-table th {
  font-weight: normal;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td {
  border-bottom: none;
}
