/* ==========================================================================
   Basis: Reset, Typografie, Layout-Primitive, Browser-Oberflächen
   ========================================================================== */

@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--masthead-h) + var(--s-5));
  scrollbar-color: hsl(var(--steel-hsl) / 0.6) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--color-text);
  background-color: var(--color-surface);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

::selection { background: hsl(var(--orange-hsl) / 0.85); color: var(--ink); }
.on-dark ::selection { background: hsl(var(--blue-bright-hsl) / 0.9); color: var(--ink); }

img, picture, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a, button, label, summary, input, select { touch-action: manipulation; }
a { color: inherit; }
:where(p, h1, h2, h3, h4, figure, blockquote, dl, dd) { margin: 0; }
:where(ul[class], ol[class]) { margin: 0; padding: 0; list-style: none; }
address { font-style: normal; }
/* :is() mit ID-Argument hebt die Spezifität, damit [hidden] ohne !important immer gewinnt */
:is([hidden], #hidden-specificity) { display: none; }

/* Headlines */
h1, h2, h3, h4, .display, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 750;
  font-stretch: 108%;
  line-height: var(--lh-head);
  letter-spacing: var(--track-head);
  text-wrap: balance;
  font-kerning: normal;
}
.display {
  font-size: var(--step-5);
  line-height: var(--lh-tight);
  letter-spacing: var(--track-display);
  font-weight: 800;
  font-stretch: 112%;
}
.h2 { font-size: var(--step-4); line-height: 1.06; letter-spacing: -0.028em; }
.h3 { font-size: var(--step-2); }
p, li, dd { text-wrap: pretty; }
strong, b { font-weight: 650; }

.lead {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--color-text-muted);
  max-width: 54ch;
}
.muted { color: var(--color-text-muted); }
.on-dark { color: var(--on-dark); --color-text-muted: var(--on-dark-muted); }

/* Links im Fließtext */
.prose a, .link {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: hsl(var(--blue-hsl) / 0.4);
  transition: text-decoration-color var(--dur-xs) var(--ease-out), color var(--dur-xs);
}
.prose a:hover, .link:hover { text-decoration-color: currentColor; }

/* Fokus: immer sichtbar, aus der Palette */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}
.on-dark :focus-visible { outline-color: var(--orange); }
main:focus { outline: none; }

/* Layout */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
.section { position: relative; padding-block: var(--section-y); }

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

.skip-link {
  position: fixed;
  top: var(--s-3);
  left: var(--s-3);
  z-index: var(--z-skip);
  padding: var(--s-3) var(--s-4);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-s);
  font-weight: 650;
  transform: translateY(-160%);
  transition: transform var(--dur-s) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* Sichtbare Platzhalter – nicht übersehen, aber nicht laut */
.ph {
  display: inline;
  padding: 0.05em 0.35em;
  border-radius: 4px;
  font-family: var(--font-display);
  font-stretch: 85%;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: hsl(36 80% 22%);
  background: hsl(45 90% 74% / 0.75);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  white-space: nowrap;
}
.ph--long { white-space: normal; }

/* Bild-Slot ohne Datei */
.img-slot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 160px;
  background: repeating-linear-gradient(135deg, hsl(var(--steel-hsl) / 0.1) 0 10px, transparent 10px 20px);
  color: var(--color-text-muted);
  font-size: var(--step--1);
}

/* Feines Rauschen auf dunklen Flächen gegen den flachen Digital-Look (nie in Fotos) */
.texture { position: relative; isolation: isolate; }
.texture::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

/* Scrollbar dunkel/hell */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: hsl(var(--steel-hsl) / 0.55); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* Tabellarische Ziffern überall, wo Zahlen stehen */
.tnum, time, .cd, .thermo, .spec dd { font-variant-numeric: tabular-nums; }

@media print {
  .masthead, .mobile-bar, .scroll-progress, video, .media__toggle { display: none; }
  body { background: #fff; }
}
