/* ════════════════════════════════════════════════════════════════════
   Gemeinsames Design-System der Unterseiten (ai.html, finance.html,
   impressum.html, datenschutz.html).
   Abgeleitet aus index.html: zwei Farben, Cinzel + Michroma, Pixel-Raster,
   Pixel-Zacken, Halbton-Rahmen, Pillen, Laufband.
   ════════════════════════════════════════════════════════════════════ */

/* ── Schriften (OFL, selbst gehostet, Lizenzen in assets/fonts) ── */
@font-face {
  font-family: 'Cinzel';
  src: url('fonts/cinzel-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Cinzel';
  src: url('fonts/cinzel-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Michroma';
  src: url('fonts/michroma-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* ── Zwei Farben, sonst nichts ── */
:root {
  --ink: #0e0d0c;
  --paper: #ece6da;
  --ink-rgb: 14, 13, 12;
  --paper-rgb: 236, 230, 218;
  --e-io: cubic-bezier(0.76, 0, 0.24, 1);
  --e-out: cubic-bezier(0.25, 1, 0.5, 1);
  --pad: 2.2222rem;
  --gap: 1.6667rem;
  --fs-micro: max(0.7639rem, 10px);
  --fs-body: max(0.8333rem, 11px);
  --f-disp: 'Cinzel', 'Times New Roman', serif;
  --f-tech: 'Michroma', 'Eurostile', 'Arial', sans-serif;
}

.theme-dark {
  --bg: var(--ink);
  --fg: var(--paper);
  --bg-rgb: var(--ink-rgb);
  --fg-rgb: var(--paper-rgb);
  background: var(--bg);
  color: var(--fg);
}

.theme-light {
  --bg: var(--paper);
  --fg: var(--ink);
  --bg-rgb: var(--paper-rgb);
  --fg-rgb: var(--ink-rgb);
  background: var(--bg);
  color: var(--fg);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Fluides Mass: 1rem = 1vw auf einer 1440er-Bühne */
html {
  font-size: max(1vw, 8.5px);
  background: var(--ink);
  color-scheme: dark;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--paper-rgb), 0.35) var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (max-width: 767px) {
  html { font-size: min(3.6vw, 16px); }
  /* Schrift nie unter 10.5 px (Labels) und 12 px (Fliesstext), auch auf
     kleinen Android-Geräten; der Rand weicht Notch und Displayecken aus */
  :root {
    --pad: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
    --gap: 12px; --fs-micro: max(0.72rem, 10.5px); --fs-body: max(0.8rem, 12px);
  }
}

/* Tablets (Touch, ab 768 px): gleiche Bühne wie Desktop, Schrift etwas
   grösser, Rand weicht der Notch im Querformat aus */
@media (pointer: coarse) and (min-width: 768px) {
  :root {
    --pad: max(2.2222rem, env(safe-area-inset-left), env(safe-area-inset-right));
    --fs-micro: max(0.7639rem, 11px); --fs-body: max(0.8333rem, 12.5px);
  }
}

::selection { background: var(--paper); color: var(--ink); }
.theme-light ::selection { background: var(--ink); color: var(--paper); }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-tech);
  font-size: var(--fs-body);
  line-height: 1.7;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Rauschen über allem ── */
.noise {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
  background: url('noise.png');
  opacity: 0.1;
  mix-blend-mode: soft-light;
}

.no-gl .noise { mix-blend-mode: normal; opacity: 0.035; }

/* ── Pixel-Raster: deckt beim Ankommen und beim Seitenwechsel den Schirm.
   html.px-cover setzt ein Kopf-Skript sofort: das Raster ist schon beim
   ersten Bild dunkel, bevor die Zellen existieren (nahtlos von index). ── */
#pxGrid {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  grid-template-columns: repeat(var(--gc, 20), 1fr);
  grid-template-rows: repeat(var(--gr, 12), 1fr);
  pointer-events: none;
}

html.px-cover #pxGrid { background: var(--ink); pointer-events: auto; }
#pxGrid.on { pointer-events: auto; }

#pxGrid i {
  display: block;
  background: var(--ink);
  box-shadow: 0 0 0 0.5px var(--ink);
  transform: scaleX(0);
}

html.px-cover #pxGrid i { transform: scaleX(1); }

/* ── Kopf: Monogramm links, Navigation rechts; Farbe folgt der Sektion ── */
.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.8rem var(--pad);
  color: var(--paper);
  transition: color 0.35s ease, opacity 0.4s ease, transform 0.55s var(--e-out);
  pointer-events: none;
}

html[data-head="light"] .site-head { color: var(--ink); }
html[data-head="light"] #scrollProgress { background: var(--ink); }

/* Kopf weicht beim Lesen aus: beim Herunterscrollen gleitet er weg
   (html.head-hide), beim Hochscrollen kommt er zurück. Mitten auf der Seite
   trägt er dann einen weichen Verlauf in der Farbe der Sektion darunter
   (html.head-veil), damit keine Schrift unter Monogramm und Navigation
   durchläuft. Oben auf der Seite steht er frei wie bisher. */
.site-head { --hb: var(--ink-rgb); }
html[data-head="light"] .site-head { --hb: var(--paper-rgb); }
.site-head::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% + 2.6rem);
  z-index: -1;
  background: linear-gradient(to bottom, rgba(var(--hb), 0.97) 0%, rgba(var(--hb), 0.9) 52%, rgba(var(--hb), 0) 100%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
html.head-veil .site-head::before { opacity: 1; }
html.head-hide .site-head { transform: translateY(-110%); opacity: 0; }
html.head-hide .site-head:focus-within { transform: none; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html.head-hide .site-head { transform: none; }
}

#navBrand {
  display: block;
  pointer-events: auto;
  padding: 0.7rem;
  margin: -0.7rem;
}

#navBrand svg { width: 1.8rem; height: 1.8rem; min-width: 22px; min-height: 22px; display: block; overflow: visible; }

#navBrand line {
  stroke: currentColor;
  stroke-width: 5.5;
  stroke-linecap: butt;
}

.site-nav {
  display: flex;
  gap: 2.4rem;
  pointer-events: auto;
}

.site-nav a {
  font-size: var(--fs-micro);
  text-decoration: none;
  padding: 1rem 0.7rem;
  margin: -1rem -0.7rem;
}

.site-nav a.active::before { content: '['; margin-right: 0.3em; }
.site-nav a.active::after { content: ']'; margin-left: 0.3em; }

/* ── Zeichen-Tausch beim Hover ── */
.cs { position: relative; display: inline-block; overflow: hidden; vertical-align: top; }
.cs > span { display: block; white-space: pre; }
.cs > span + span { position: absolute; left: 0; top: 0; }
.cs i {
  display: inline-block;
  font-style: normal;
  transition: transform 0.6s var(--e-out);
  transition-delay: calc(var(--i) * 0.018s);
}
.cs > span + span i { transform: translateY(105%); }

@media (hover: hover) and (pointer: fine) {
  a:hover > .cs > span:first-child i,
  a:focus-visible > .cs > span:first-child i { transform: translateY(-105%); }
  a:hover > .cs > span + span i,
  a:focus-visible > .cs > span + span i { transform: translateY(0); }
}

/* ── Fortschrittslinie ── */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

/* ── Seite ── */
.page { position: relative; z-index: 3; }
.page > section { position: relative; }

/* Pixel-Zacken: Balken hängen von der neuen Sektion in die vorige */
.spikes {
  position: absolute;
  left: 0;
  right: 0;
  top: 1px;
  height: 12.5rem;
  transform: translateY(-100%);
  color: var(--bg);
  pointer-events: none;
  z-index: 2;
}

.spikes svg { display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }

@media (max-width: 767px) { .spikes { height: 6.5rem; } }

/* ── Hero: grosser Cinzel-Titel, Halbton-Bild rechts ── */
.ds-hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 34rem;
  overflow: hidden;
}

.hero-fig {
  position: absolute;
  top: 50%;
  right: var(--pad);
  height: 78%;
  aspect-ratio: 880 / 1168;
  transform: translateY(-46%);
}

.hero-fig canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero-title {
  position: absolute;
  left: var(--pad);
  bottom: 6.4rem;
  z-index: 2;
  font-family: var(--f-disp);
  font-weight: 400;
  font-size: 30rem;
  line-height: 0.8;
  letter-spacing: -0.045em;
  user-select: none;
  white-space: nowrap;
}

.hero-meta {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: 1.8rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  font-size: var(--fs-micro);
}

.hero-meta span:first-child { opacity: 0.62; }

/* ── Momente: ein Satz pro Raum, links, rechts oder zentriert ── */
.moment {
  min-height: 88vh;
  min-height: 88svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 11rem var(--pad);
}

.moment .m-body { width: 100%; max-width: 62rem; }
.moment.right .m-body { margin-left: auto; }
.moment.center { align-items: center; text-align: center; }
.moment.center .m-body { margin: 0 auto; }

/* ── Sektionskopf: (Nummer) Label, Linie per clip-path ── */
.sec-head {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 5rem;
  font-size: var(--fs-micro);
}

.sec-num { opacity: 0.55; }
.sec-num::before { content: '('; }
.sec-num::after { content: ')'; }
.sec-label { font: inherit; letter-spacing: inherit; }

.sec-rule {
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.3;
}

/* ── Statements: gravierte Versalien ── */
.quote {
  font-family: var(--f-disp);
  font-weight: 400;
  font-size: 5rem;
  line-height: 1;
  letter-spacing: -0.015em;
  max-width: 13em;
  text-wrap: balance;
}

.moment.center .quote { margin: 0 auto; font-size: 6.6667rem; line-height: 0.92; max-width: 9em; }
.quote em { font-style: normal; color: rgba(var(--fg-rgb), 0.42); }

.row-sub {
  max-width: 32em;
  margin-top: 2.4rem;
  color: rgba(var(--fg-rgb), 0.62);
  text-wrap: pretty;
}

.row-sub em { font-style: normal; color: var(--fg); }
.moment.center .row-sub { margin-left: auto; margin-right: auto; }

/* ── Bildunterschrift ── */
.fig-cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.2rem;
  font-size: var(--fs-micro);
  color: rgba(var(--fg-rgb), 0.55);
}

.fig-cap em { font-style: normal; color: var(--fg); }

/* ── Laufband ── */
.mq {
  position: relative;
  overflow: hidden;
  padding: 2.6rem 0;
  border-top: 1px solid rgba(var(--fg-rgb), 0.2);
  border-bottom: 1px solid rgba(var(--fg-rgb), 0.2);
}

.mq-track {
  display: flex;
  width: max-content;
  font-family: var(--f-disp);
  font-size: 6.9444rem;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  will-change: transform;
}

/* ── Abschluss: Pillen, magnetisch ── */
.end-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  list-style: none;
  margin-top: 4.4rem;
}

.end-links a {
  display: inline-block;
  padding: 1.25em 2.2em;
  border: 1px solid rgba(var(--fg-rgb), 0.4);
  border-radius: 999px;
  font-size: var(--fs-micro);
  text-decoration: none;
  transition: background-color 0.4s var(--e-out), color 0.4s var(--e-out);
}

@media (hover: hover) and (pointer: fine) {
  .end-links a:hover { background: var(--fg); color: var(--bg); }
}

/* ── Rechtliches: eine leise Zeile ganz unten, «Impressum · Datenschutz».
   Micro-Label in verblasster Schrift; beim Hover hellt der Link auf, eine
   feine Linie zieht von links ein und beim Verlassen nach rechts weg ── */
.legal-line {
  position: relative;
  z-index: 1;
  margin-top: 6rem;
  font-size: var(--fs-micro);
  color: rgba(var(--fg-rgb), 0.55);
}

.legal-sep { margin: 0 0.4em; }

.legal-line a {
  position: relative;
  display: inline-block;
  text-decoration: none;
  transition: color 0.4s var(--e-out);
}

/* rechts um den Zeichenabstand kürzer: die Linie endet am letzten Buchstaben */
.legal-line a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0.08em;
  bottom: 0.15em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 0.6s var(--e-io);
}

.legal-line a[aria-current="page"],
.legal-line a:focus-visible { color: var(--fg); }

@media (hover: hover) and (pointer: fine) {
  .legal-line a:hover { color: var(--fg); }
  .legal-line a:hover::after { transform: scaleX(1); transform-origin: 0% 50%; }
}

/* Tap-Ziele mindestens 44 px, ohne die Zeile zu verschieben */
@media (pointer: coarse) {
  .legal-line a { padding: max(1rem, 14px) 0.6em; margin: calc(-1 * max(1rem, 14px)) -0.6em; }
}

/* ── Rechtliches, Seiten (impressum.html, datenschutz.html): ruhige
   Textspalte auf Tinte, keine Reveals, kein Raster. Desktop und Tablet:
   Label links, Text rechts, Grundlinien bündig; Handy: gestapelt.
   Fliesstext in normaler Schreibung, Zeilenlänge in em ── */
.legal {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: 13rem var(--pad) 3rem;
}

.legal-head,
.legal-sec {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: var(--gap);
  align-items: baseline;
}

.legal-head { margin-bottom: 6.4rem; }

.legal-title {
  grid-column: 1 / -1;
  font-family: var(--f-disp);
  font-weight: 400;
  font-size: 6.6667rem;
  line-height: 0.92;
  letter-spacing: -0.015em;
}

.legal-lead,
.legal-text {
  letter-spacing: 0.01em;
  text-transform: none;
  overflow-wrap: break-word;
}

.legal-lead {
  grid-column: 2;
  max-width: 30em;
  margin-top: 3.4rem;
  font-size: max(1.3889rem, 17px);
  line-height: 1.5;
  text-wrap: balance;
}

.legal-body { border-bottom: 1px solid rgba(var(--fg-rgb), 0.2); }

.legal-sec {
  padding: 2.6rem 0 3.4rem;
  border-top: 1px solid rgba(var(--fg-rgb), 0.2);
}

.legal-label {
  font: inherit;
  font-size: var(--fs-micro);
  letter-spacing: inherit;
  padding-right: 2rem;
}

.legal-n { color: rgba(var(--fg-rgb), 0.55); }

.legal-text {
  max-width: 38em;
  font-size: max(1.0417rem, 14px);
  line-height: 1.75;
  color: rgba(var(--fg-rgb), 0.82);
  text-wrap: pretty;
}

.legal-text p + p { margin-top: 1em; }
.legal-text address { font-style: normal; }

/* E-Mail im Text: fein unterstrichen, beim Zeigen heller */
.legal-text a { text-decoration-thickness: 1px; text-underline-offset: 0.22em; }

@media (hover: hover) and (pointer: fine) {
  .legal-text a:hover { color: var(--fg); }
}

/* Domain, «E-»-Wörter sowie PLZ und Ort brechen nie um (sonst steht etwa
   «E-» allein am Zeilenende) */
.legal-nobr { white-space: nowrap; }

.legal-date {
  padding-top: 2.6rem;
  font-size: var(--fs-micro);
  color: rgba(var(--fg-rgb), 0.55);
}

/* Fusszeile: steht am Ende des Texts, bei kurzem Inhalt ganz unten */
.legal > .legal-line {
  align-self: center;
  margin-top: auto;
  padding-top: 9rem;
  text-align: center;
}

@media (max-width: 767px) {
  .legal { padding: 8.6rem var(--pad) 2.4rem; }
  .legal-head,
  .legal-sec { grid-template-columns: minmax(0, 1fr); }
  .legal-head { margin-bottom: 3.6rem; }
  .legal-title { font-size: 2.9rem; }
  .legal-lead { grid-column: 1; margin-top: 1.8rem; font-size: max(1.15rem, 16px); }
  .legal-sec { row-gap: 1rem; padding: 1.9rem 0 2.4rem; }
  /* schmale Spalte: lange Wörter trennen, kurze nie */
  .legal-text { font-size: max(1.04rem, 14px); hyphens: auto; hyphenate-limit-chars: 12 5 5; }
  .legal-date { padding-top: 1.9rem; }
  .legal > .legal-line { padding-top: 5.5rem; }
}

/* ── Linse «Look closer»: das feinere Raster zeichnet die Halbton-Engine
   selbst ins Bild. Hier liegt nur die Fassung darüber: feiner Ring, oben
   die Skala aus dem Loader, unten die Gravur. Der Ausschnitt ist das Bild,
   keine Zeiger-Ereignisse, ds.js legt alles nur für die Maus an. ── */
.ht-lens {
  position: fixed;
  inset: 0;
  z-index: 45;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}

.ht-lens-clip {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
}

.ht-lens-ring {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--paper);
  opacity: 0;
  will-change: transform, opacity;
}

.ht-lens-ring svg { display: block; overflow: visible; }
.ht-lens-ring g { fill: none; }
.ht-lens-ring .hl-x { stroke: var(--ink); stroke-width: 3; opacity: 0.5; }
.ht-lens-ring .hl-x .hl-n { stroke-width: 4; }
.ht-lens-ring .hl-p { stroke: currentColor; stroke-width: 1; }
.ht-lens-ring .hl-p .hl-c { opacity: 0.85; }
.ht-lens-ring .hl-p .hl-t { opacity: 0.42; }
.ht-lens-ring .hl-p .hl-t.on { opacity: 1; }
.ht-lens-ring .hl-p .hl-n { stroke-width: 2; }

.ht-lens-ring .hl-g {
  fill: currentColor;
  stroke: rgba(var(--ink-rgb), 0.6);
  stroke-width: 2.4px;
  stroke-linejoin: round;
  paint-order: stroke;
  font-family: var(--f-tech);
  font-size: 9px;
  letter-spacing: 0.32em;
}

/* ── Lenis (lenis.css 1.3.26) ── */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* Fixe Ecken weichen Notch und abgerundeten Displayecken aus */
@media (pointer: coarse) {
  .site-head {
    padding-top: max(1.8rem, calc(env(safe-area-inset-top) + 0.8rem));
    padding-left: max(var(--pad), env(safe-area-inset-left));
    padding-right: max(var(--pad), env(safe-area-inset-right));
  }
  .hero-meta { bottom: max(1.8rem, calc(env(safe-area-inset-bottom) + 0.8rem)); }
  /* Tap-Ziele mindestens 44 px, ohne die Optik zu verschieben */
  #navBrand { padding: max(0.7rem, 11px); margin: calc(-1 * max(0.7rem, 11px)); }
  .site-nav a {
    padding: max(1rem, 16px) max(0.7rem, 14.5px);
    margin: calc(-1 * max(1rem, 16px)) calc(-1 * max(0.7rem, 14.5px));
  }
  .end-links a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* ── Handy ── */
@media (max-width: 767px) {
  .page { overflow-x: clip; }
  .site-nav { gap: 1.4rem; }
  .moment { min-height: 0; padding: 7rem var(--pad); }
  .sec-head { margin-bottom: 2.6rem; }
  .quote { font-size: 2.3rem; }
  .moment.center .quote { font-size: 2.9rem; }
  .mq-track { font-size: 3.2rem; }
  .mq { padding: 1.6rem 0; }
  .end-links { gap: 0.6rem; }
  .end-links a { padding: 1.1em 1.4em; }
  /* vier Pillen als zwei Paare statt drei und eine allein */
  .end-links:has(li:nth-child(4):last-child) { display: grid; grid-template-columns: repeat(2, auto); justify-content: center; }
  .end-links:has(li:nth-child(4):last-child) a { width: 100%; justify-content: center; }
  /* keine einzelnen Wörter allein in der letzten Zeile */
  .quote, .row-sub { text-wrap: pretty; }
}

/* Handy hochkant: Bild füllt oben, Titel steht unten darüber */
@media (orientation: portrait) and (max-width: 900px) {
  .hero-fig { top: 9svh; right: auto; left: 50%; height: auto; width: min(86vw, 30rem); transform: translateX(-50%); }
  .hero-title { font-size: 34vw; bottom: 4.6rem; }
}

/* Handy quer (niedrig): der Titel richtet sich nach der Höhe, sonst ragt er
   aus dem Bild (html davor, damit er auch die Seitenregeln übertrifft) */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .ds-hero { min-height: 0; }
  html .hero-title,
  html .fin-hero .hero-title { font-size: 40vh; font-size: 40svh; bottom: 14vh; bottom: 14svh; }
}
