/* sipost.de — site styles. Follows security-bits-style-guide/STYLE_GUIDE.md.
   Tokens come from tokens.css (copied verbatim, do not edit). Light/dark is
   taken from the browser via prefers-color-scheme — no toggle. */

/* ---------- Base (§14) ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg);
  background: var(--bg);
  overflow-wrap: anywhere;
  /* keep the footer at the bottom on short pages (login) */
  display: flex; flex-direction: column; min-height: 100vh;
}
main { flex: 1 0 auto; width: 100%; }
img, svg { max-width: 100%; height: auto; }

:root { accent-color: var(--accent); }
::selection { background: var(--accent); color: var(--fg-on-accent); }
main ul > li::marker, main ol > li::marker { color: var(--accent); }

h1, h2, h3 {
  font-family: var(--font-sans);
  font-weight: var(--weight-heading);
  line-height: var(--leading-tight);
  color: var(--fg-heading);
  text-decoration: underline var(--accent) 2px;
  text-underline-offset: .15em;
  margin: 0 0 var(--space-4);
}
h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--text-xl); }
p { margin: 0 0 var(--space-4); max-width: var(--width-prose); }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
main p a, main li a { text-decoration: underline; text-underline-offset: .15em; }

:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
  box-shadow:
    0 0 0 2px var(--focus-halo),
    0 0 0 5px var(--focus-ring),
    0 0 0 7px var(--focus-edge);
}

.skip-link {
  position: absolute; inset-inline-start: var(--space-4); top: -4rem; z-index: 100;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans); font-weight: var(--weight-semibold);
  background: var(--accent); color: var(--fg-on-accent);
  border-radius: var(--radius-md); text-decoration: none;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: var(--space-4); color: var(--fg-on-accent); }

/* ---------- Layout (§5) ---------- */
.wrap {
  max-width: var(--width-content); margin-inline: auto;
  padding-inline: var(--space-4); padding-block: var(--space-6);
}
@media (min-width: 768px) { .wrap { padding-inline: var(--space-6); } }

:target, main [id] { scroll-margin-top: 7rem; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  font-family: var(--font-sans);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5);
  align-items: center;
  padding-block: var(--space-3);
}
.brand {
  margin-inline-end: auto;
  padding-bottom: 2px;
  font-weight: var(--weight-heading); font-size: var(--text-lg);
  color: var(--fg-heading); text-decoration: none;
  border-bottom: 3px solid var(--accent);
}
.brand:hover { color: var(--fg-heading); }
.site-nav { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.site-nav a {
  display: inline-block; padding-block: var(--space-2);
  font-weight: var(--weight-semibold); font-size: var(--text-sm);
  color: var(--fg-muted); text-decoration: none;
}
.site-nav a:hover { color: var(--fg-heading); box-shadow: inset 0 -2px 0 var(--accent); }

.grid { display: grid; gap: var(--space-5); }
@media (min-width: 768px)  { .cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cols-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Components (§6, §7) ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans); font-size: var(--text-base);
  font-weight: var(--weight-semibold); line-height: var(--leading-snug);
  border: 1px solid transparent; border-radius: var(--radius-md);
  text-decoration: none; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--fg-on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--fg-on-accent); }
.btn-secondary { background: var(--surface); color: var(--fg); border-color: var(--border-control); }
.btn-secondary:hover { background: var(--bg-hover); color: var(--fg); }

.actions {
  display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center;
  max-width: none;
}

.hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.hero .wrap { padding-block: var(--space-8); }
@media (min-width: 768px) { .hero h1 { font-size: var(--text-4xl); } }
.lede { font-size: var(--text-lg); color: var(--fg-muted); }

.cards { margin: 0; padding: 0; list-style: none; }
.card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; font-size: var(--text-lg); }
.card p:last-child { margin-bottom: 0; }

/* Numbered steps — vertical brand rule as the house device (§7) */
.steps {
  display: grid; gap: var(--space-5);
  margin: 0 0 var(--space-6); padding: 0;
  list-style: none; counter-reset: step;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-inline-start: var(--space-8);
  border-inline-start: 4px solid var(--accent);
}
.steps li::before {
  content: counter(step);
  position: absolute; inset-inline-start: var(--space-4); top: 0;
  font-family: var(--font-sans); font-weight: var(--weight-heading);
  font-size: var(--text-2xl); line-height: var(--leading-tight);
  color: var(--accent);
}
.steps h3 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.steps p { margin: 0; }

.alert {
  margin: 0; padding: var(--space-4);
  font-family: var(--font-sans); font-size: var(--text-sm);
  border-inline-start: 5px solid currentColor; border-radius: var(--radius-md);
}
.alert strong { display: block; margin-bottom: var(--space-1); }
.alert p { margin: 0; max-width: none; color: var(--fg); }
.alert-info { color: var(--info); background: var(--info-bg); }

/* FAQ — square stacked panels (§7) */
.faq { border: 1px solid var(--border); background: var(--surface); }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 44px; padding: var(--space-4);
  font-family: var(--font-sans); font-weight: var(--weight-heading);
  color: var(--fg-heading); cursor: pointer; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+"; flex: none;
  width: 1em; text-align: center;
  color: var(--accent); font-size: var(--text-xl); line-height: 1;
}
.faq details[open] summary::before { content: "\2212"; }
.faq summary:hover { background: var(--accent-bg); }
.faq details p { margin: 0; padding: 0 var(--space-4) var(--space-4) calc(var(--space-4) + 1em + var(--space-3)); }

.start {
  padding: var(--space-6) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border); border-inline-start: 5px solid var(--accent);
}
.start h2 { margin-top: 0; }
.start .actions { margin-bottom: 0; }
.address { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-muted); }

/* Login (§6 Forms) — single-column flow at --width-narrow */
.login { max-width: var(--width-narrow); padding-block: var(--space-7); }
.login-card {
  padding: var(--space-6) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.login-card h1 { font-size: var(--text-2xl); margin-bottom: var(--space-5); }
.login-card .alert { margin-bottom: var(--space-5); }
.login-card form { margin: 0; }
.field { margin-bottom: var(--space-5); }
.field label {
  display: block; margin-bottom: var(--space-2);
  font-family: var(--font-sans); font-size: var(--text-sm);
  font-weight: var(--weight-semibold); color: var(--fg);
}
.field input {
  width: 100%; min-height: 44px; padding: var(--space-3);
  font-family: var(--font-sans); font-size: var(--text-base);
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--border-control); border-radius: var(--radius-md);
}
.field input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.btn-block { width: 100%; justify-content: center; }
.login-back { margin: var(--space-5) 0 0; font-family: var(--font-sans); font-size: var(--text-sm); }

.alert-danger { color: var(--danger); background: var(--danger-bg); }
.alert .status { margin: 0; color: var(--danger); }
/* 1.4.1 — the error is carried by a glyph and words, not the hue alone */
.status { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); }
.status-bad::before { content: "\2715"; font-size: 1.1em; line-height: 1; }

.site-footer {
  margin-top: var(--space-7);
  font-family: var(--font-sans); font-size: var(--text-sm);
  color: var(--fg-muted);
  background: var(--surface); border-top: 1px solid var(--border);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: center; }
.site-footer p { margin: 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.footer-nav a { display: inline-block; padding-block: var(--space-2); text-decoration: underline; text-underline-offset: .15em; }
.footer-note { flex-basis: 100%; color: var(--fg-subtle); }

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

/* Impressum / Datenschutz */
.legal { max-width: calc(var(--width-prose) + 2 * var(--space-6)); }
.legal h2 { margin-top: var(--space-7); }
.legal h3 { margin-top: var(--space-6); font-size: var(--text-lg); }
.legal .alert { max-width: none; margin-bottom: var(--space-6); }
.impressum-img { display: block; border-radius: var(--radius-md); }
[hidden] { display: none !important; }
