/* ==========================================================================
   Grundlagen: Schriften, Reset, Typografie, Fokus, Hilfsklassen
   ========================================================================== */

/* --- Schriften (lokal, Latin-Subset, SIL Open Font License – siehe ../fonts/OFL-*.txt) --- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-var.woff2") format("woff2");
  font-weight: 300 650;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-italic-var.woff2") format("woff2");
  font-weight: 300 650;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 650;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/eb-garamond-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Ersatzschriften, metrisch an die Webfonts angeglichen ---------------------
   Solange die Webfonts laden, stehen Georgia/Arial mit angepasster Größe und Zeilenmetrik
   da – beim Tausch verschiebt sich das Layout kaum (Werte: _arbeit/beispiel2/skripte/ersatz_metriken.py). */
@font-face {
  font-family: "Fraunces Ersatz";
  src: local("Georgia");
  size-adjust: 96.4%;
  ascent-override: 101.5%;
  descent-override: 26.5%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Fraunces Ersatz";
  src: local("Georgia Italic");
  font-style: italic;
  size-adjust: 90.1%;
  ascent-override: 108.6%;
  descent-override: 28.3%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Instrument Sans Ersatz";
  src: local("Arial");
  size-adjust: 102%;
  ascent-override: 95.1%;
  descent-override: 24.5%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Instrument Sans Ersatz";
  src: local("Arial Bold"), local("Arial-BoldMT");
  font-weight: 600 700;
  size-adjust: 98.9%;
  ascent-override: 98.1%;
  descent-override: 25.3%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "EB Garamond Ersatz";
  src: local("Georgia");
  size-adjust: 89.6%;
  ascent-override: 112.4%;
  descent-override: 33.3%;
  line-gap-override: 0%;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--kopf-hoehe) + var(--abstand-4));
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--papier);
  color: var(--espresso);
  font-family: var(--schrift-text);
  font-size: var(--text-m);
  line-height: var(--zeile-text);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

img {
  height: auto;
}

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

button {
  cursor: pointer;
}

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

/* --- Typografie ---------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--schrift-titel);
  font-weight: 380;
  line-height: var(--zeile-titel);
  font-variation-settings: "opsz" 144;
  text-wrap: balance;
  letter-spacing: -0.01em;
  /* lange Wörter („Datenschutzhinweise“) auf schmalen Bildschirmen trennen, kurze nie */
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 12 5 5;
  overflow-wrap: break-word;
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--zeile-eng);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
  font-variation-settings: "opsz" 72;
}

h4 {
  font-size: var(--text-l);
  font-variation-settings: "opsz" 36;
}

p,
li,
dd,
figcaption {
  text-wrap: pretty;
}

p {
  margin: 0 0 var(--abstand-4);
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Hervorhebung im Fließtext: Fraunces kursiv statt synthetischer Sans-Kursive */
em,
i,
cite {
  font-family: var(--schrift-titel);
  font-style: italic;
  font-size: 1.04em;
  font-variation-settings: "opsz" 14;
}

strong,
b {
  font-weight: 600;
}

a {
  color: var(--terrakotta-text);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: color var(--dauer-kurz), text-decoration-color var(--dauer-kurz);
}

a:hover {
  color: var(--terrakotta-tief);
  text-decoration-color: currentColor;
}

a:active {
  color: var(--espresso);
}

abbr[title] {
  text-decoration: none;
}

hr {
  border: 0;
  border-top: var(--linie-breite) solid var(--linie);
  margin: var(--abstand-6) 0;
}

::selection {
  background: color-mix(in srgb, var(--terrakotta) 28%, var(--papier));
  color: var(--espresso);
}

/* --- Fokus: deutlich sichtbar, im Stil einer Tuschelinie ------------------------ */
:focus-visible {
  outline: 2px solid var(--terrakotta-text);
  outline-offset: 3px;
  border-radius: var(--radius);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* --- Sprunglink ------------------------------------------------------------------ */
.sprunglink {
  position: absolute;
  left: var(--abstand-4);
  top: var(--abstand-3);
  z-index: 100;
  padding: var(--abstand-3) var(--abstand-5);
  background: var(--espresso);
  color: var(--papier);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dauer-kurz) var(--kurve);
}

.sprunglink:focus {
  transform: translateY(0);
  color: var(--papier);
  outline-color: var(--terrakotta);
}

/* --- Hilfsklassen --------------------------------------------------------------- */
.nur-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Kapitälchen-Label – echte Kapitälchen der EB Garamond (smcp/c2sc) */
.marke {
  font-family: var(--schrift-marke);
  font-weight: 500;
  font-size: var(--text-s);
  font-variant-caps: all-small-caps;
  font-variant-numeric: oldstyle-nums;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: var(--terrakotta-text);
}

/* Elemente, die nur mit bzw. ohne JavaScript sinnvoll sind (Media Feature „scripting“) */
@media (scripting: none) {
  .nur-mit-js {
    display: none !important;
  }
}

@media (scripting: enabled) {
  .nur-ohne-js {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
