/* ==========================================================================
   DMW-Performance — Modern CSS Reset
   ==========================================================================
   Pragmatic, modern reset. Removes browser inconsistencies, applies sensible
   defaults, and respects user preferences (reduced motion, focus visibility).
   Depends on variables.css for design tokens.
   ========================================================================== */

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

/* ----- Reset margins/padding on common block elements ----- */
html,
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
li,
figure,
blockquote,
dl,
dd,
pre {
  margin: 0;
  padding: 0;
}

/* ----- Document root ----- */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* ----- Body defaults ----- */
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  line-height: var(--leading-normal);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition:
    background-color var(--transition-base),
    color var(--transition-base);
}

/* ----- Headings ----- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  letter-spacing: -0.01em;
  /* Stop single words ("orphans") from dropping onto their own last line. */
  text-wrap: balance;
}

h1 {
  font-size: var(--text-4xl);
  /* Tighter tracking on the largest display type reads as more intentional. */
  letter-spacing: -0.025em;
}

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

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

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

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

/* ----- Paragraphs & lists ----- */
p {
  max-width: 75ch;
}

ul[class],
ol[class] {
  list-style: none;
  padding: 0;
  margin: 0;
}

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

img {
  font-style: italic;
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: 1rem;
}

/* ----- Forms ----- */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

textarea {
  resize: vertical;
}

/* ----- Links ----- */
/* Verweise im Fliesstext stehen fast immer auf hellem Grund. In hellem Gold
   waren sie mit 1,9:1 schlechter lesbar als der Text drumherum — bei
   Telefonnummer und E-Mail-Adresse im Impressum ausgerechnet dort, wo jemand
   etwas abtippen will. Auf dunklen Flaechen setzen die Bausteine ihre eigene
   Farbe, das bleibt unberuehrt. */
a {
  color: var(--color-gold-ink);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* ----- Tables ----- */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ----- Code ----- */
code,
kbd,
samp,
pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
  font-size: 0.95em;
}

/* ----- HR ----- */
hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-8);
}

/* ==========================================================================
   Accessibility helpers
   ========================================================================== */

/* Visually hidden — content readable to screen readers only */
.visually-hidden,
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link — visible on focus */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-6);
  z-index: var(--z-max);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) 0;
  transition: top var(--transition-fast);
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  color: var(--color-text-inverse);
}

/* ----- Focus styles ----- */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

/* ----- Reduced motion ----- */
@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;
  }
}
