/* --- 0. Schriften, selbst gehostet ---------------------------------------
   Newsreader und Inter Tight (SIL OFL) aus @fontsource-variable, von
   build-website.js nach website/design/fonts/ kopiert. Nur latin + latin-ext;
   Griechisch und Formelzeichen (∫, √, λ) kommen aus der Ersatzschrift.
   Die Kursive von Newsreader ist Pflicht: Variablen stehen kursiv. */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/newsreader-latin-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(fonts/newsreader-latin-ext-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url(fonts/newsreader-latin-opsz-italic.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url(fonts/newsreader-latin-ext-opsz-italic.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-tight-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-tight-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ==========================================================================
   Arbeitsheft.online — Redesign, Stylesheet
   Ein Import, keine Abhängigkeiten. Erwartet die Schriften Newsreader und
   Inter Tight (siehe README, Abschnitt „Schriften“).
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */
:root {
  /* Farben */
  --ah-ink:            #14343B;   /* Schiefertürkis: Text, Schiene, Buttons */
  --ah-ink-80:         rgba(20,52,59,.82);
  --ah-ink-55:         rgba(20,52,59,.55);
  --ah-ink-40:         rgba(20,52,59,.40);
  --ah-accent:         #E5533D;   /* Korall: Fortschritt, aktiver Zustand, CTA-Hover */
  --ah-accent-hi:      #F0664F;
  --ah-accent-soft:    #F0A292;   /* Korall auf dunklem Grund */
  --ah-ok:             #4A7C59;   /* richtig / abgeschlossen */
  --ah-ok-soft:        #8FBF9E;   /* Häkchen auf dunklem Grund */
  --ah-ok-bg:          #F1F7F2;

  --ah-bg:             #FAF7F2;   /* Seitengrund */
  --ah-bg-alt:         #EFEAE1;   /* Grund für Fokus-Ansicht */
  --ah-surface:        #FFFDFA;   /* Karten, Kopfzeile */
  --ah-surface-2:      #F4F0E8;   /* Hinweisbox */
  --ah-line:           #E4DDD2;   /* Rahmen */
  --ah-line-soft:      #F2ECE3;   /* Tabellenlinien */
  --ah-line-strong:    #D8D0C4;   /* Eingaben, Tasten */
  --ah-track:          #E7E0D5;   /* leere Fortschrittsschiene */

  --ah-on-ink:         #EAF0EF;   /* Text auf --ah-ink */
  --ah-on-ink-75:      rgba(234,240,239,.75);
  --ah-on-ink-60:      rgba(234,240,239,.62);
  --ah-on-ink-40:      rgba(234,240,239,.40);
  --ah-on-ink-line:    rgba(255,255,255,.12);
  --ah-on-ink-border:  rgba(255,255,255,.22);

  /* Schrift */
  --ah-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --ah-sans:  "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Maße */
  --ah-rail:      300px;  /* Kapitelschiene, PC */
  --ah-measure:   720px;  /* Lesespalte */
  --ah-radius:    8px;
  --ah-radius-sm: 6px;
  --ah-radius-lg: 10px;

  /* Abstände: 4-px-Raster */
  --ah-1: 4px;  --ah-2: 8px;  --ah-3: 12px; --ah-4: 16px;
  --ah-5: 20px; --ah-6: 24px; --ah-8: 32px; --ah-10: 40px;

  --ah-shadow-rail: 14px 0 40px rgba(20,52,59,.28);
  --ah-scrim:       rgba(20,52,59,.45);
}

/* --- 2. Grundlagen ------------------------------------------------------- */
.ah-root {
  margin: 0;
  background: var(--ah-bg);
  color: var(--ah-ink);
  font-family: var(--ah-sans);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
.ah-root *, .ah-root *::before, .ah-root *::after { box-sizing: border-box; }
/* :where() hält diese Grundregeln auf Elementgewicht. Als ".ah-root a" (0,1,1)
   schlugen sie die Bausteinklassen (0,1,0): Schieneneinträge standen dunkel auf
   dunklem Grund, .ah-rail-close und .ah-rail-foot verloren ihren Rahmen. */
:where(.ah-root) a { color: var(--ah-ink); }
:where(.ah-root) a:hover { color: var(--ah-accent); }
:where(.ah-root) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.ah-num { font-variant-numeric: tabular-nums; }

/* Sprunglink für Tastatur / Screenreader */
.ah-skip {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--ah-ink); color: #fff; padding: 10px 16px;
  border-radius: 0 0 var(--ah-radius-sm) 0; font-size: 14px;
}
.ah-skip:focus { left: 0; }

/* --- 3. Gerüst ----------------------------------------------------------- */
/* Querformat (PC, Tablet quer): Schiene fest links.
   Hochformat / < 900px: Schiene wird zum Overlay, per [data-rail] gesteuert. */
.ah-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.ah-main  { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ah-content { flex: 1; padding: var(--ah-10) var(--ah-10) var(--ah-10); }
.ah-measure { width: 100%; max-width: var(--ah-measure); margin: 0 auto; }

/* Kopfzeile */
.ah-topbar {
  flex: none; min-height: 62px; display: flex; align-items: center;
  justify-content: space-between; gap: var(--ah-4);
  padding: var(--ah-2) var(--ah-10) var(--ah-2) var(--ah-5);
  background: var(--ah-surface); border-bottom: 1px solid var(--ah-line);
}
.ah-crumb { font-size: 13px; color: var(--ah-ink-55); }
.ah-crumb strong { color: var(--ah-ink); font-weight: 500; }
.ah-topbar-right { display: flex; align-items: center; gap: var(--ah-5); }
.ah-stat { display: flex; align-items: baseline; gap: 5px; }
.ah-stat b { font-family: var(--ah-serif); font-size: 18px; font-weight: 600; }
.ah-stat b.is-accent { color: var(--ah-accent); }
.ah-stat span { font-size: 11.5px; color: var(--ah-ink-55); }
.ah-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--ah-ink); color: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600;
}

/* Umschalter ☰ — nur sichtbar, wenn die Schiene zu ist */
.ah-rail-open  { width: 44px; height: 44px; flex: none; border: 1px solid var(--ah-line-strong);
                 border-radius: 7px; background: #fff; display: none;
                 align-items: center; justify-content: center; font-size: 16px; }
.ah-rail-open:hover { border-color: var(--ah-ink); }
[data-rail="closed"] .ah-rail-open { display: flex; }
.ah-topbar-left { display: flex; align-items: center; gap: var(--ah-4); }

/* --- 4. Kapitelschiene --------------------------------------------------- */
.ah-rail {
  width: var(--ah-rail); flex: none; background: var(--ah-ink); color: var(--ah-on-ink);
  display: flex; flex-direction: column; padding: var(--ah-6) 0 var(--ah-5);
}
[data-rail="closed"] .ah-rail { display: none; }

.ah-rail-head {
  padding: 0 var(--ah-6) var(--ah-5); border-bottom: 1px solid var(--ah-on-ink-line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ah-3);
}
.ah-wordmark { font-family: var(--ah-serif); font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.ah-eyebrow {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(234,240,239,.5); margin-top: 3px;
}
.ah-rail-close {
  width: 44px; height: 44px; flex: none; margin: -8px -8px 0 0;
  border-radius: var(--ah-radius-sm); border: 1px solid var(--ah-on-ink-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--ah-on-ink-75);
}
.ah-rail-close:hover { border-color: var(--ah-accent); color: #fff; }

.ah-rail-chapter { padding: var(--ah-5) var(--ah-6) var(--ah-3); }
.ah-rail-chapter .ah-eyebrow { color: var(--ah-accent); font-weight: 600; margin: 0; }
.ah-chapter-title { font-family: var(--ah-serif); font-size: 24px; line-height: 1.2; margin-top: 5px; }

.ah-rail-list { flex: 1; overflow-y: auto; padding: var(--ah-2) var(--ah-3);
                display: flex; flex-direction: column; gap: 2px; }
.ah-rail-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--ah-radius-sm); min-height: 40px;
  color: var(--ah-on-ink-60); font-size: 13.5px; text-decoration: none;
}
.ah-rail-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.ah-rail-item > .ah-no { flex: none; width: 24px; font-size: 11px; color: var(--ah-on-ink-40);
                         font-variant-numeric: tabular-nums; }
.ah-rail-item > .ah-label { flex: 1; }
.ah-rail-item > .ah-meta  { font-size: 11px; color: var(--ah-on-ink-40); }
.ah-rail-item.is-done > .ah-meta { color: var(--ah-ok-soft); }
.ah-rail-item[aria-current="true"] {
  background: rgba(229,83,61,.16); box-shadow: inset 2px 0 0 var(--ah-accent); color: #fff;
}
.ah-rail-item[aria-current="true"] > .ah-no   { color: var(--ah-accent-soft); }
.ah-rail-item[aria-current="true"] > .ah-label { font-weight: 600; }
.ah-rail-item[aria-current="true"] > .ah-meta  { color: var(--ah-accent-soft); }

.ah-tag {
  font-size: 9.5px; letter-spacing: .06em; padding: 1px 5px;
  border: 1px solid rgba(234,240,239,.28); border-radius: 3px; color: rgba(234,240,239,.5);
}

.ah-rail-foot { padding: var(--ah-4) var(--ah-6) 0; border-top: 1px solid var(--ah-on-ink-line);
                display: flex; gap: var(--ah-2); }
.ah-rail-foot > * {
  flex: 1; text-align: center; padding: 12px 0; border: 1px solid var(--ah-on-ink-border);
  border-radius: 7px; font-size: 12.5px; color: var(--ah-on-ink-75); text-decoration: none;
}
.ah-rail-foot > *:hover { border-color: var(--ah-accent); color: #fff; }

/* Overlay-Modus (Hochformat, Handy) */
.ah-scrim { display: none; }
@media (max-width: 899px), (orientation: portrait) and (max-width: 1100px) {
  .ah-shell { position: relative; }
  .ah-rail {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: min(312px, 84vw); box-shadow: var(--ah-shadow-rail);
  }
  .ah-rail-open { display: flex; }
  [data-rail="closed"] .ah-rail { display: none; }
  [data-rail="open"] .ah-scrim {
    display: block; position: fixed; inset: 0; z-index: 30; background: var(--ah-scrim);
  }
  [data-rail="open"] .ah-rail-open { display: flex; }
  .ah-rail-item { min-height: 44px; font-size: 14px; }
  .ah-content { padding: var(--ah-5) var(--ah-5) 0; }
  .ah-topbar { padding: var(--ah-3) var(--ah-4); }
  .ah-topbar-right .ah-stat { display: none; }
}

/* --- 5. Fortschritt ------------------------------------------------------ */
.ah-progress { display: flex; align-items: center; gap: var(--ah-2); }
.ah-progress-track { flex: 1; height: 4px; border-radius: 2px; background: var(--ah-track); overflow: hidden; }
.ah-rail .ah-progress-track { background: rgba(255,255,255,.16); }
.ah-progress-bar { height: 100%; background: var(--ah-accent); }
.ah-progress-bar.is-done { background: var(--ah-ok); }
.ah-progress-label { font-size: 11px; color: var(--ah-ink-55); font-variant-numeric: tabular-nums; }
.ah-rail .ah-progress-label { color: rgba(234,240,239,.65); }

/* Schrittpunkte eines Aufgaben-Sets */
.ah-steps { display: flex; gap: var(--ah-1); }
.ah-steps > span { flex: 1; height: 5px; border-radius: 3px; background: #E2DBD0; }
.ah-steps > span.is-current { background: var(--ah-accent); }
.ah-steps > span.is-done    { background: var(--ah-ok); }

.ah-dots { display: flex; gap: var(--ah-1); align-items: center; }
.ah-dots > span {
  width: 26px; height: 26px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 11.5px;
  border: 1px solid var(--ah-line-strong); color: var(--ah-ink-40);
}
.ah-dots > span.is-current { background: var(--ah-ink); border-color: var(--ah-ink); color: #fff; font-weight: 600; }
.ah-dots > span.is-locked  { border-style: dashed; }

/* --- 6. Typografie im Inhalt -------------------------------------------- */
.ah-section-label { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
                    color: var(--ah-accent); font-weight: 600; }
.ah-h1 { font-family: var(--ah-serif); font-size: clamp(27px, 3.4vw, 42px); font-weight: 500;
         letter-spacing: -.02em; line-height: 1.12; margin: 6px 0 0; }
.ah-h2 { font-family: var(--ah-serif); font-size: clamp(21px, 2.2vw, 29px); font-weight: 500;
         letter-spacing: -.015em; line-height: 1.25; margin: 0; }
.ah-h3 { font-family: var(--ah-serif); font-size: 23px; font-weight: 400; margin: 3px 0 0; }
.ah-prose { font-family: var(--ah-serif); font-size: clamp(16.5px, 1.2vw, 18px);
            line-height: 1.6; color: var(--ah-ink-80); text-wrap: pretty; }
.ah-prose strong { font-weight: 600; color: var(--ah-ink); }

/* Formel, freistehend */
.ah-formula {
  background: var(--ah-ink); color: #F6F1E9; border-radius: var(--ah-radius);
  font-family: var(--ah-serif); font-size: clamp(18px, 2vw, 22px);
  text-align: center; padding: var(--ah-5) var(--ah-6);
}
/* Gestapelter Bruch: <span class="ah-frac"><span>a</span><i></i><span>n+1</span></span>
   — nie U+2044 neben kursiven Glyphen verwenden, der Strich verschwindet. */
.ah-frac { display: inline-flex; flex-direction: column; align-items: center;
           vertical-align: middle; margin: 0 2px; }
.ah-frac > span { padding: 0 3px; line-height: 1.1; }
.ah-frac > i { height: 1px; align-self: stretch; background: currentColor; }
.ah-frac + span, .ah-frac ~ span { vertical-align: middle; }

/* --- 7. Karten und Tabellen --------------------------------------------- */
.ah-card { background: var(--ah-surface); border: 1px solid var(--ah-line);
           border-radius: var(--ah-radius); overflow: hidden; }
.ah-card-head { padding: 11px 18px; border-bottom: 1px solid #EFE8DE;
                font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase;
                font-weight: 600; color: var(--ah-ink-55); }
.ah-card-body { padding: var(--ah-5) var(--ah-6); }
.ah-note { background: var(--ah-surface-2); border-radius: var(--ah-radius);
           padding: var(--ah-4) var(--ah-5); font-family: var(--ah-serif);
           font-size: 16px; line-height: 1.55; color: rgba(20,52,59,.75); }

.ah-table { width: 100%; border-collapse: collapse; font-family: var(--ah-serif); font-size: 17.5px; }
.ah-table th {
  text-align: left; padding: 11px 18px; border-bottom: 1px solid var(--ah-line-soft);
  font-family: var(--ah-serif); font-weight: 400; font-size: 15px; color: var(--ah-ink-55);
}
.ah-table td { padding: 12px 18px; border-bottom: 1px solid var(--ah-line-soft); }
.ah-table tr:last-child td { border-bottom: 0; }

/* --- 8. Aufgabenblock --------------------------------------------------- */
.ah-task { margin-top: var(--ah-6); border-top: 2px solid var(--ah-ink); padding-top: var(--ah-5); }
.ah-task-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ah-4); }
.ah-task-question { font-family: var(--ah-serif); font-size: clamp(18px, 1.4vw, 19px);
                    line-height: 1.55; margin: var(--ah-5) 0 0; }

.ah-input {
  width: 100%; background: #fff; border: 1.5px solid var(--ah-ink);
  border-radius: 7px; padding: 13px 15px;
  font-family: var(--ah-serif); font-size: 18px; color: var(--ah-ink);
}
.ah-input::placeholder { color: var(--ah-ink-40); }
.ah-input:focus-visible { outline: 2px solid var(--ah-accent); outline-offset: 1px; }
.ah-input.is-ok  { border-color: var(--ah-ok); background: var(--ah-ok-bg); }
.ah-input.is-off { border-color: var(--ah-accent); background: #FDF1EE; }

/* Formeltasten */
.ah-keys { display: flex; gap: 7px; flex-wrap: wrap; margin-top: var(--ah-3); }
.ah-keys > button {
  min-width: 48px; min-height: 44px; padding: 0 13px; background: #fff;
  border: 1px solid var(--ah-line-strong); border-radius: 7px;
  font-family: var(--ah-serif); font-size: 15px;
}
.ah-keys > button:hover { border-color: var(--ah-ink); }

.ah-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px; border-radius: 7px;
  background: var(--ah-ink); color: #fff; font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.ah-btn:hover { background: var(--ah-accent); color: #fff; }
.ah-btn.is-accent { background: var(--ah-accent); }
.ah-btn.is-accent:hover { background: var(--ah-accent-hi); }
.ah-btn.is-ghost { background: #fff; color: var(--ah-ink); border: 1px solid var(--ah-line-strong); font-weight: 400; }
.ah-btn.is-ghost:hover { background: #fff; border-color: var(--ah-ink); color: var(--ah-ink); }
.ah-btn.is-block { width: 100%; }
.ah-btn:focus-visible { outline: 2px solid var(--ah-accent); outline-offset: 2px; }

.ah-links { display: flex; flex-wrap: wrap; gap: var(--ah-5); margin-top: var(--ah-3);
            font-size: 13px; color: var(--ah-ink-55); }
.ah-links > * { color: inherit; text-decoration: none; }
.ah-links > *:hover { color: var(--ah-accent); }

/* Rückmeldung */
.ah-feedback { padding: var(--ah-4) var(--ah-5); background: var(--ah-surface-2);
               border-radius: var(--ah-radius); margin-top: var(--ah-4); }
.ah-feedback.is-ok { background: var(--ah-ok-bg); }
.ah-feedback-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
                     font-weight: 600; color: var(--ah-ink-55); }
.ah-feedback p { font-family: var(--ah-serif); font-size: 16px; line-height: 1.55;
                 margin: 7px 0 0; color: rgba(20,52,59,.88); }

/* Schritt-für-Schritt-Lösung */
.ah-steps-list { display: flex; flex-direction: column; gap: var(--ah-4); margin-top: var(--ah-5); }
.ah-step { display: flex; gap: var(--ah-4); align-items: flex-start; }
.ah-step > b {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: var(--ah-ok); color: #fff; display: flex; align-items: center;
  justify-content: center; font-size: 11.5px; font-weight: 600;
}
.ah-step.is-current > b { background: var(--ah-ink); }
.ah-step-title { font-size: 13px; font-weight: 600; }
.ah-step-math { font-family: var(--ah-serif); font-size: 17px; margin-top: 3px; color: rgba(20,52,59,.88); }

/* --- 9. Aktionsleiste (Handy, unten fixiert) ---------------------------- */
.ah-actionbar {
  flex: none; display: flex; gap: var(--ah-3); align-items: center;
  padding: var(--ah-3) var(--ah-4) calc(var(--ah-5) + env(safe-area-inset-bottom));
  background: var(--ah-surface); border-top: 1px solid var(--ah-line);
  position: sticky; bottom: 0; z-index: 20;
}
.ah-actionbar .ah-btn { min-height: 50px; }
@media (min-width: 900px) { .ah-actionbar { position: static; padding: var(--ah-4) var(--ah-10); } }

/* --- 10. Rücksicht ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .ah-root *, .ah-root *::before, .ah-root *::after {
    animation-duration: .01ms !important; transition-duration: .01ms !important;
  }
}
@media print {
  .ah-rail, .ah-scrim, .ah-topbar, .ah-actionbar, .ah-keys, .ah-rail-open { display: none !important; }
  .ah-root { background: #fff; }
  .ah-content { padding: 0; }
}
