/* Reset, typography and shared building blocks (tones, edges, buttons, labels). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--text-light);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Long German compounds in the mono headlines must not overflow on phones */
h1, h2, h3 {
  overflow-wrap: break-word;
  hyphens: auto;
  /* Hyphenate only long compounds, never short words like "Auftrag" */
  hyphenate-limit-chars: 13 5 5;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 3px;
}

@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;
  }
}

.visually-hidden {
  position: absolute !important;
  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;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--black);
  font-family: var(--font-mono);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  outline-color: var(--text-light);
}

/* ---------- Layout ---------- */

.container {
  width: min(100% - 2 * var(--gutter), var(--content-max));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-pad-top) var(--section-pad-bottom);
}

/* ---------- Tones ---------- */

.tone-dark {
  --label-color: var(--accent);
  --text-muted: var(--muted-dark);
  background-color: var(--black);
  color: var(--text-light);
}

.tone-light {
  --label-color: var(--muted-light);
  --text-muted: var(--muted-light);
  background-color: var(--offwhite);
  color: var(--black);
}

.tone-accent {
  --label-color: var(--black);
  --text-muted: var(--black);
  background-color: var(--accent);
  color: var(--black);
}

/* The accent focus ring would vanish on the accent background */
.tone-accent :focus-visible {
  outline-color: var(--black);
}

.has-grid {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

/* ---------- Slanted section edges ---------- */

.edge {
  position: relative;
  z-index: 1;
  height: var(--edge-h);
  /* Overlap the next section by 1px: fractional heights otherwise leave a seam */
  margin-bottom: -1px;
  line-height: 0;
}

.edge svg {
  width: 100%;
  height: 100%;
}

.edge polygon {
  fill: currentColor;
}

.edge--from-dark   { background-color: var(--black); }
.edge--from-light  { background-color: var(--offwhite); }
.edge--from-accent { background-color: var(--accent); }
.edge--to-dark     { color: var(--black); }
.edge--to-light    { color: var(--offwhite); }
.edge--to-accent   { color: var(--accent); }

/* ---------- Typography ---------- */

.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  line-height: 1.5;
  letter-spacing: 0.08em;
  color: var(--label-color, var(--accent));
}

.label--caps {
  text-transform: uppercase;
}

.h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: 1.03;
  letter-spacing: -0.03em;
}

.h2 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-muted);
}

.prose {
  max-width: 44rem;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.prose > * + * {
  margin-top: 1em;
}

.prose h2 {
  margin-top: 2em;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
}

.prose h3 {
  margin-top: 1.5em;
  font-size: 1.25rem;
  font-weight: 600;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  min-height: var(--btn-h);
  padding: 0 28px;
  border: var(--border) solid transparent;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.btn--accent {
  background: var(--accent);
  color: var(--black);
}

.btn--dark {
  background: var(--black);
  color: var(--text-light);
}

.btn--outline {
  border-color: currentColor;
  background: transparent;
}

.btn--sm {
  min-height: 48px;
  padding: 0 24px;
}

/* ---------- AI placeholder badge (must stay until all placeholders are replaced) ---------- */

.ph {
  position: relative;
}

.ph-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  background: var(--black);
  color: var(--text-light);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

/* ---------- Simple page intro (default and error templates) ---------- */

.page-intro {
  padding-block: 36px 40px;
}

.page-intro .container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
}

.page-intro__text {
  max-width: 500px;
}

@media (min-width: 48rem) {
  .page-intro {
    padding-block: 56px 48px;
  }

  .page-intro .container {
    gap: 28px;
  }
}
