/* ============================================================
   Pfotenmission Kursplattform — Basis-Styles
   Tokens: css/tokens.css · Fonts: css/fonts.css (self-hosted)
   ============================================================ */

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

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-heading);
  font-weight: var(--fw-medium);
  line-height: var(--lh-tight);
  margin: 0 0 0.5em;
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { margin: 0 0 1em; text-wrap: pretty; }

a { color: var(--brand-pressed); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--caramel-100); color: var(--ink); }

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

/* Programmatischer Fokus nach Navigation (FocusOnNavigate) — kein Ring auf Überschriften */
h1:focus { outline: none; }

/* ---- Wiederkehrende Muster ---- */

/* Eyebrow/Kicker — Sperrsatz-Versalien wie „HUNDETRAINING" im Logo */
.pm-eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--brand);
}

/* Script-Akzent — Markenstimme, sparsam einsetzen */
.pm-script {
  font-family: var(--font-accent);
  font-weight: 400;
  color: var(--brand);
}

/* Pill-Buttons */
.pm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font: var(--fw-bold) var(--fs-sm)/1 var(--font-body);
  padding: 0.9rem 1.6rem;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-fast) var(--ease-soft),
              transform var(--dur-fast) var(--ease-soft);
}
.pm-btn:active { transform: scale(0.97); }
.pm-btn:hover { text-decoration: none; }

.pm-btn--primary { background: var(--brand); color: var(--text-on-brand); box-shadow: var(--shadow-sm); }
.pm-btn--primary:hover { background: var(--brand-hover); box-shadow: var(--shadow-md); }

.pm-btn--secondary { background: transparent; color: var(--brand-pressed); border-color: var(--caramel-500); }
.pm-btn--secondary:hover { background: var(--brand-tint); }

.pm-btn--sage { background: var(--accent); color: var(--text-on-brand); box-shadow: var(--shadow-sm); }
.pm-btn--sage:hover { background: var(--accent-hover); }

/* Karte — warme Fläche, Haarlinie, warmer Schatten */
.pm-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Pull-Quote im Markenton */
.pm-quote {
  background: var(--brand-tint);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--caramel-700);
}

/* ---- Formularfelder ---- */
.pm-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.pm-field__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  color: var(--text-heading);
}
.pm-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-heading);
  font: var(--fw-regular) var(--fs-body)/var(--lh-normal) var(--font-body);
  transition: border-color var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-fast) var(--ease-soft);
}
.pm-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ---- Formulare (Blazor-Validierung, warm statt Ampelrot) ---- */
.valid.modified:not([type=checkbox]) { outline: 1.5px solid var(--sage-500); }
.invalid { outline: 1.5px solid var(--danger); }
.validation-message { color: var(--danger); font-size: var(--fs-sm); }

/* ---- Fehlerzustände ---- */
.blazor-error-boundary {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
}
.blazor-error-boundary::after { content: "Da ist etwas schiefgelaufen. Lade die Seite neu — dein Fortschritt ist gespeichert."; }

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: var(--ink);
  color: var(--paper);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
}
#blazor-error-ui .reload { color: var(--teal-300); font-weight: var(--fw-bold); }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ---- Rechtsseiten (Impressum/Datenschutz) ---- */
.legal {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: var(--sp-7) var(--sp-5);
}
.legal__inner {
  width: 100%;
  max-width: var(--container-narrow);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  align-items: flex-start;
}
.legal section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.legal h2 {
  font-size: var(--fs-h3);
}
.legal p {
  color: var(--text-body);
  line-height: 1.6;
}
.legal .pm-btn {
  margin-top: var(--sp-2);
}

/* ---- Inhalts-/Lektionslisten (Kurs-Arbeitsseite + Dokumente-Tab) ---- */
.acont__success {
  background: var(--success-bg);
  color: var(--success);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}

.acont__group {
  margin-bottom: var(--sp-6);
}

.acont__grouptitle {
  font-size: var(--fs-h4);
  margin-bottom: var(--sp-3);
}

.acont__rows {
  list-style: none;
  margin: 0 0 var(--sp-5);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.acont__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  flex-wrap: wrap;
}

.acont__info {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}

.acont__title {
  font-weight: var(--fw-bold);
  color: var(--text-heading);
}

.acont__meta {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}

.acont__type {
  font-size: var(--fs-xs);
  font-weight: var(--fw-heavy);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
}

.acont__section {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.acont__job {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  padding: 0.1rem var(--sp-3);
  border-radius: var(--radius-pill);
}

.acont__job--pending { background: var(--warning-bg); color: var(--warning); }
.acont__job--processing { background: var(--teal-100); color: var(--teal-600); }
.acont__job--succeeded { background: var(--success-bg); color: var(--success); }
.acont__job--failed { background: var(--danger-bg); color: var(--danger); }

.acont__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.acont__move {
  /* Mind. ~44px Touch-Ziel (mobile-first Hauptfall). */
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--text-heading);
  cursor: pointer;
  font-size: var(--fs-body);
}

.acont__move:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
}

.acont__action {
  padding: 0.5rem 1rem;
  font-size: var(--fs-xs);
}

.acont__delete {
  font-size: var(--fs-sm);
  color: var(--danger);
}

/* ---- Ruhige Bewegung, respektiert Systemeinstellung ---- */
@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;
  }
}
