/* ==========================================================================
   BB|PY – base.css
   Farben, Schriften, Grundtypografie, Reset.
   Farben und Abstände zentral hier ändern (CSS Custom Properties).
   ========================================================================== */

/* ---------- Schriften (lokal, OFL-lizenziert, siehe assets/fonts) ---------- */
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design-Tokens ---------- */
:root {
  /* Farben */
  --color-background: #faf8f4;   /* warmes Weiß */
  --color-surface: #f2ece2;      /* sehr helles Beige */
  --color-surface-raised: #ffffff;
  --color-text: #2a2926;         /* Anthrazit */
  --color-muted: #67625a;        /* dunkles Grau, AA-konform */
  --color-gold: #b39359;         /* Gold für Linien, Rahmen, Icons (nicht für Text) */
  --color-gold-text: #7d6130;    /* dunkleres Gold, für Text lesbar (AA) */
  --color-border: #e3dccf;
  --color-dark: #1f1e1c;         /* Lightbox, Footer */
  --color-on-dark: #f4f0e8;
  --color-gold-on-dark: #c9ad74;

  /* Schriften */
  --font-display: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Hanken Grotesk", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Typo-Skala (fließend) */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.5rem, 1.34rem + 0.8vw, 2rem);
  --step-3: clamp(1.95rem, 1.6rem + 1.6vw, 3rem);
  --step-4: clamp(2.5rem, 1.9rem + 3vw, 4.5rem);
  --step-5: clamp(3.4rem, 2.2rem + 6vw, 7.5rem);

  /* Abstände */
  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: clamp(2rem, 1.6rem + 2vw, 3rem);
  --space-xl: clamp(3rem, 2.2rem + 4vw, 5.5rem);
  --space-2xl: clamp(4.5rem, 3rem + 7vw, 9rem);

  /* Layout */
  --width-content: 76rem;
  --width-text: 40rem;
  --gutter: clamp(1.25rem, 0.8rem + 2.5vw, 3rem);
  --header-height: 4.5rem;

  --radius-s: 2px;
  --radius-m: 6px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration: 240ms;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  overflow-x: clip; /* Sicherheitsnetz gegen seitliches Scrollen */
  min-height: 100vh;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
video,
svg,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

[hidden] {
  display: none !important; /* einzige !important-Regel: hidden muss immer greifen */
}

/* ---------- Typografie ---------- */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
}

h2 {
  font-size: var(--step-3);
}

h3 {
  font-size: var(--step-2);
  line-height: 1.15;
}

h4 {
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0.01em;
}

p {
  text-wrap: pretty;
}

p + p {
  margin-top: 1em;
}

a {
  color: inherit;
  text-decoration-color: var(--color-gold);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--duration) var(--ease), text-decoration-color var(--duration) var(--ease);
}

a:hover {
  color: var(--color-gold-text);
}

strong {
  font-weight: 600;
}

small {
  font-size: var(--step--1);
}

::selection {
  background: #e9dcc0;
  color: var(--color-text);
}

/* ---------- Fokus ---------- */
:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

/* ---------- Hilfsklassen ---------- */
.visually-hidden {
  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: absolute;
  left: var(--space-s);
  top: var(--space-s);
  z-index: 1000;
  padding: 0.7rem 1.1rem;
  background: var(--color-text);
  color: var(--color-background);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--duration) var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-background);
}

/* ---------- Reduzierte Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
}
