/*
 * Energy Sharing — site.css, no build step.
 * Order: tokens · @font-face · base · layout · components · focus · helpers · media queries.
 * Tokens and focus rules are copied from DESIGN.md ("Umsetzung als CSS-Variablen"):
 * change them there first; TestStylesheetHasDesignTokens checks the copy.
 */

/* Tokens */

:root {
  color-scheme: light dark;
  --c-bg: #FAFAF7;
  --c-surface: #ECE9E0;
  --c-text: #1E2328;
  --c-text-2: #5A5F66;
  --c-link: #7A5400;
  --c-border: #8A8E93;
  --c-border-strong: #5A5F66;
  --c-input-border: #6B7076;
  --c-primary: #1E2328;
  --c-on-primary: #FFFFFF;
  --c-accent: #D9A21B;
  --c-on-accent: #1E2328;
  --c-error: #8F2F1A;
  --c-focus: #D9A21B;
  --c-focus-text: #1E2328;
  --c-focus-edge: #1E2328;
  --c-primary-hover: #3A4048;
  --c-btn2-bg: #D9A21B;
  --c-btn2-text: #1E2328;
  --c-btn2-border: #7A5400;
  --c-footer-bg: #1E2328;
  --c-footer-text: #ECE9E0;
  --c-footer-text-2: #B9B5AA;
  --c-footer-link: #E8B43A;
  --c-footer-edge: transparent;
  --font: "Atkinson Hyperlegible", "Atkinson Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #171B1F;
    --c-surface: #2A3036;
    --c-text: #ECE9E0;
    --c-text-2: #B9B5AA;
    --c-link: #E8B43A;
    --c-border: #6E747B;
    --c-border-strong: #B9B5AA;
    --c-input-border: #8A8F95;
    --c-primary: #D9A21B;
    --c-on-primary: #171B1F;
    --c-on-accent: #171B1F;
    --c-error: #F0A58C;
    --c-focus-edge: #ECE9E0;
    --c-primary-hover: #E8B43A;
    --c-btn2-bg: transparent;
    --c-btn2-text: #ECE9E0;
    --c-btn2-border: #B9B5AA;
    --c-footer-bg: #2A3036;
    --c-footer-edge: #6E747B;
  }
}

/* @font-face — self-hosted subset, see docs-tech/schrift.md */

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-400.woff2?v=4e5761edad") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-400-italic.woff2?v=db08489888") format("woff2");
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/atkinson-hyperlegible-700.woff2?v=b43274ba45") format("woff2");
}

/* Metric-matched fallback: a late font swaps without reflow (docs-tech/schrift.md) */

@font-face {
  font-family: "Atkinson Fallback";
  src: local("Arial"), local("Liberation Sans"), local("DejaVu Sans");
  size-adjust: 98.76%;
  ascent-override: 96.19%;
  descent-override: 29.36%;
  line-gap-override: 0%;
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.6;
}

h1, h2, h3 {
  margin: 0 0 1rem;
  font-weight: 700;
  overflow-wrap: break-word;
}
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { margin-top: 3rem; font-size: 1.5rem; line-height: 1.3; }
h3 { margin-top: 2rem; font-size: 1.25rem; line-height: 1.35; }
.display { font-size: clamp(2rem, 1.2rem + 3.8vw, 3.75rem); line-height: 1.05; letter-spacing: -0.02em; }

p, ul, ol { margin: 0 0 1rem; }
li + li { margin-top: 0.5rem; }
small, .small { font-size: 1rem; line-height: 1.5; }

a {
  color: var(--c-link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

/* Layout */

.container {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: 16px;
}
/* Short pages: the dark footer closes the window, no light strip below it. */
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1 0 auto; padding-block: 2rem 4rem; }
.lesespalte { max-width: 68ch; }

/* Components */

.skip-link {
  display: inline-block;
  margin: 8px;
  padding: 8px 16px;
}

.site-header { border-bottom: 1px solid var(--c-border); }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-block: 10px;
  color: var(--c-text);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}
.marke { flex: none; width: 32px; height: 32px; }
.marke-kachel { fill: #1E2328; }
.marke-bogen { fill: none; stroke: #D9A21B; stroke-width: 2; stroke-linecap: round; }
.marke-sonne { fill: #D9A21B; }
.marke-daecher { fill: none; stroke: #ECE9E0; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.wordmark:hover { text-decoration: underline; text-decoration-thickness: 2px; }

.site-header-inner { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 24px; }
.site-nav { flex: 0 1 auto; }
.site-nav ul { margin: 0; padding: 0; list-style: none; }
.site-nav li + li { margin-top: 0; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 4px;
  color: var(--c-text);
  font-weight: 700;
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
.nav-liste { display: none; }
.nav-menue summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 12px;
  border: 1px solid var(--c-border-strong);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
.nav-menue[open] ul {
  position: absolute;
  inset-inline: 0;
  top: 100%;
  padding: 8px 16px 12px;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
}
.nav-menue[open] li a { width: 100%; }

.icon { width: 1.25em; height: 1.25em; vertical-align: -0.2em; }
a .icon { width: 0.9em; height: 0.9em; margin-left: 0.15em; vertical-align: -0.05em; }

.kurz-gesagt,
.hinweis {
  margin: 0 0 2rem;
  padding: 16px 20px;
  background: var(--c-surface);
  border-left: 4px solid var(--c-primary);
}
.hinweis {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 2rem;
}
.hinweis .icon { flex: none; width: 1.5rem; height: 1.5rem; margin-top: 0.1rem; }
.kurz-gesagt p:last-child,
.hinweis p:last-child { margin-bottom: 0; }

.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}
.button { background: var(--c-primary); color: var(--c-on-primary); }
.button:hover:not(:focus-visible) { background: var(--c-primary-hover); }
.button-secondary {
  background: var(--c-btn2-bg);
  color: var(--c-btn2-text);
  border-color: var(--c-btn2-border);
}

.quelle-ref { font-size: 1rem; line-height: 0; }
.quellen { padding-left: 1.5em; }
.stand { color: var(--c-text-2); }

/* Start page: header with the grid-area drawing (DESIGN.md "Kopf der Startseite") */

.hero { display: grid; gap: 2rem; padding-block: 1.5rem 2.5rem; }
.lead { max-width: 34ch; margin: 0; color: var(--c-text-2); font-size: 1.3rem; line-height: 1.5; }
.netzgebiet { display: block; width: 100%; max-width: 28rem; height: auto; }
.ng-gold { fill: var(--c-accent); }
.ng-netz { stroke: var(--c-text); stroke-width: 4; stroke-linecap: round; }
.ng-haus path { fill: var(--c-surface); stroke: var(--c-text); stroke-width: 4; stroke-linejoin: round; }

/* Timeline (DESIGN.md "Zeitstrahl"): only for content that is a sequence in time */

.band { margin-block: 3rem; padding-block: 2.5rem 3rem; background: var(--c-surface); }
.band h2 { margin-top: 0; margin-bottom: 2rem; }
.zeitstrahl {
  margin: 0 0 0 10px;
  padding: 0;
  list-style: none;
  border-left: 4px solid var(--c-text);
}
.zeitstrahl li { position: relative; margin: 0; padding: 0 0 1.75rem 2rem; }
.zeitstrahl li:last-child { padding-bottom: 0; }
.zeitstrahl li::before {
  content: "";
  position: absolute;
  top: 0.35rem;
  left: -12px;
  width: 20px;
  height: 20px;
  border: 4px solid var(--c-text);
  border-radius: 50%;
  background: var(--c-surface);
}
.zeitstrahl .zs-heute::before { background: var(--c-accent); }
.zs-datum { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
.zeitstrahl p { max-width: 40ch; margin: 0.25rem 0 0; font-size: 1rem; line-height: 1.5; }

.site-footer {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--c-footer-edge);
  background: var(--c-footer-bg);
  color: var(--c-footer-text);
}
.site-footer a { color: var(--c-footer-link); }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links li + li { margin-top: 0; }
.footer-links a { display: inline-block; padding-block: 8px; }
.site-footer p { margin: 0.5rem 0 0; color: var(--c-footer-text-2); }

.platzhalter { padding-block: 3rem 4rem; text-align: center; }
.platzhalter .netzgebiet { max-width: 14rem; margin: 0 auto 1.5rem; }

/* Content pages (spec H) */

.bereich { margin: 0 0 0.5rem; }
.bereich a { color: var(--c-text-2); }
.stand .icon { width: 1.1em; height: 1.1em; margin-right: 0.25em; vertical-align: -0.2em; }

.begriffe,
.artikel { margin: 2rem 0 0; padding: 0; list-style: none; }
.begriffe li,
.artikel li { margin: 0; padding-block: 1.25rem; border-top: 1px solid var(--c-border); }
.begriffe li:last-child,
.artikel li:last-child { border-bottom: 1px solid var(--c-border); }
.begriffe a,
.artikel a { font-size: 1.25rem; font-weight: 700; }
.begriffe p,
.artikel p { margin: 0.25rem 0 0; }
.artikel time { display: block; margin-top: 0.25rem; }

.verwandt { padding-left: 1.25em; }

.schritte { margin: 2rem 0; padding-left: 0; list-style: none; counter-reset: schritt; }
.schritte > li { position: relative; margin: 0 0 2rem; padding-left: 3.25rem; counter-increment: schritt; }
.schritte > li::before {
  content: counter(schritt);
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-weight: 700;
}
.schritte > li > h2 { margin-top: 0.15rem; font-size: 1.375rem; }

figure { margin: 2rem 0; }
figure img { display: block; width: 100%; height: auto; border-radius: 8px; }
figcaption { margin-top: 0.5rem; color: var(--c-text-2); font-size: 1rem; line-height: 1.5; }
figure.schmal { max-width: 20rem; }

/* Focus — GOV.UK pattern, verbatim from DESIGN.md. After the components, so it wins over their colours. */

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid transparent;
  background: var(--c-focus);
  color: var(--c-focus-text);
  box-shadow: 0 4px 0 0 var(--c-focus-edge);
  text-decoration: none;
}

:where(input, select, textarea):focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 0;
  box-shadow: inset 0 0 0 2px var(--c-focus-edge);
}

/* Helpers */

.visually-hidden,
.skip-link:not(:focus) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Media queries */

@media (min-width: 40rem) {
  .container { padding-inline: 24px; }
  .ganz { white-space: nowrap; } /* keeps "Baden-Württemberg" from breaking at its hyphen */
  h1 { font-size: 2rem; }
  .nav-menue { display: none; }
  .nav-liste { display: flex; gap: 8px 24px; }
}

@media (min-width: 52rem) {
  .hero { grid-template-columns: 7fr 5fr; align-items: end; gap: 3rem; padding-block: 3.5rem 3rem; }
  .netzgebiet { justify-self: end; }
  .zeitstrahl { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; border-left: 0; border-top: 4px solid var(--c-text); }
  .zeitstrahl li { padding: 1.5rem 2rem 0 0; }
  .zeitstrahl li::before { top: -12px; left: 0; }
}

@media (min-width: 64rem) {
  .container { padding-inline: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .zeitstrahl .zs-heute::before { background: CanvasText; }
  .kurz-gesagt,
  .hinweis { border: 1px solid CanvasText; border-left-width: 4px; }
  .button,
  .button-secondary { border-color: ButtonText; }
  .schritte > li::before { border: 2px solid CanvasText; }
}
