/* ==========================================================================
   Feuerwehr Wissen
   Colors: Leitstellenblau for text, Funkblau for everything clickable,
   Signalrot only for "Prüfungsrelevant".
   ========================================================================== */

/* Fonts are hosted here (no request to Google, see DSGVO). */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("/fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("/fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}
/* Atkinson's zero carries a slash and reads like "Ø" (medical shorthand for
   "none"). Digits in running text therefore come from Barlow. */
@font-face {
  font-family: "Ziffern";
  src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2");
  font-weight: 100 599;
  font-display: swap;
  unicode-range: U+0030-0039;
}
@font-face {
  font-family: "Ziffern";
  src: url("/fonts/barlow-latin-700-normal.woff2") format("woff2");
  font-weight: 600 900;
  font-display: swap;
  unicode-range: U+0030-0039;
}

:root {
  --paper: #F6F5F3;
  --surface: #FFFFFF;
  --ink: #1F1D1D;
  --slate: #5D5F66;
  --line: #DEDBD7;
  --radio: #B3261E;
  --radio-soft: #FBEAE8;
  --signal: #7A5200;
  --signal-soft: #FFF5D6;

  --font-head: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --font-body: "Ziffern", "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: 2rem;

  --gutter: 16px;
  --measure: 68ch;
  --radius: 6px;
}

@media (min-width: 900px) {
  :root {
    --step-0: 1.125rem;
    --step-3: 2.625rem;
    --gutter: 32px;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  hyphens: auto;
  overflow-wrap: break-word;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.005em;
  margin: 0;
  hyphens: manual;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }

a { color: var(--radio); text-underline-offset: 0.18em; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

/* ---------- Header ---------- */

.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
}

.site-header__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.brand {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--step-1);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.search {
  position: relative;
  flex: 1 1 18rem;
}

.search__icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  transform: translateY(-50%);
  color: var(--slate);
  pointer-events: none;
}

.search__input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem 0.6rem 2.4rem;
  min-height: 44px;
}
.search__input::placeholder { color: var(--slate); }
.search__input:focus { outline: none; border-color: #F29B93; }

/* ---------- Main layout ---------- */

.site-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem var(--gutter) 4rem;
}
.site-main:focus { outline: none; }

.loading, .empty { color: var(--slate); }

.site-footer {
  border-top: 1px solid var(--line);
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2.5rem;
  color: var(--slate);
  font-size: var(--step--1);
}
.site-footer p { margin: 0 0 0.25rem; max-width: var(--measure); }

.breadcrumb {
  font-size: var(--step--1);
  color: var(--slate);
  margin: 0 0 0.75rem;
}
.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}
/* separator drawn by CSS so screen readers don't read it out */
.breadcrumb > ol > li + li::before {
  content: "›";
  margin: 0 0.45rem;
  color: var(--slate);
}
.breadcrumb a {
  color: var(--radio);
  display: inline-block;
  padding: 0.3rem 0; /* larger tap target on phones */
}
.breadcrumb a:hover { text-decoration-thickness: 2px; }
.breadcrumb a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

/* ---------- Path menus (▾ next to Übersicht / Lernfeld) ---------- */

.breadcrumb { position: relative; }
.breadcrumb > ol > li { display: inline-flex; align-items: center; }

.crumb-menu { display: inline-block; }
.crumb-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: 0.1rem;
  border-radius: var(--radius);
  color: var(--radio);
}
.crumb-menu summary::-webkit-details-marker { display: none; }
.crumb-menu summary svg { width: 14px; height: 14px; transition: transform 150ms ease; }
.crumb-menu summary:hover { background: var(--radio-soft); }
.crumb-menu[open] summary { background: var(--radio-soft); }
.crumb-menu[open] summary svg { transform: rotate(180deg); }

/* The panel is placed relative to the whole path, so it never runs off
   the right edge on a phone. */
.crumb-menu__panel {
  position: absolute;
  z-index: 4;
  left: 0;
  top: calc(100% + 4px);
  width: min(26rem, 100%);
  max-height: min(70vh, 34rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(23, 34, 58, 0.16);
  padding: 0.4rem 0;
  font-size: var(--step-0);
}
.crumb-menu__panel ul { list-style: none; margin: 0; padding: 0; }
.crumb-menu__panel a {
  display: flex;
  align-items: baseline;
  padding: 0.55rem 1rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
}
.crumb-menu__panel a:hover { background: var(--radio-soft); color: var(--radio); }
.crumb-menu__panel a[aria-current="page"] {
  font-weight: 700;
  color: var(--radio);
  background: var(--radio-soft);
}
.crumb-menu__panel .status { flex: none; }
.crumb-menu__group {
  margin: 0.6rem 1rem 0.2rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--slate);
}
.crumb-menu__group:first-child { margin-top: 0.3rem; }

.page-head { margin-bottom: 2rem; max-width: var(--measure); }
.page-head p { margin: 0.5rem 0 0; color: var(--slate); }

.section { margin-top: 3rem; }
.section > h2 { margin-bottom: 0.75rem; }
.section__intro { margin: -0.25rem 0 1rem; max-width: 44rem; color: var(--slate); line-height: 1.5; }

/* ---------- Home: course band ---------- */

.home-intro { max-width: 40rem; }
.home-intro p { margin: 0.75rem 0 0; color: var(--slate); }

/* Home: shortcuts to what the class needs every day */
.shortcuts { margin-top: 1.75rem; }
.shortcuts ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 700px) { .shortcuts ul { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.shortcut {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  min-height: 4.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.shortcut:hover { border-color: var(--radio); background: var(--radio-soft); }
.shortcut:focus-visible { outline: 2px solid var(--radio); outline-offset: 2px; }
.shortcut__title { font: 600 var(--step-1) / 1.15 var(--font-head); color: var(--radio); overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 420px) { .shortcut__title { font-size: 1.05rem; } .shortcut { padding-inline: 0.75rem; } }
.shortcut__sub { font: 500 var(--step--1) / 1.3 var(--font-head); color: var(--slate); }

/* Home: latest additions */
.news ul { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.news li {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--line);
}
.news__date { font: 500 var(--step-0) / 1.5 var(--font-head); color: var(--slate); font-variant-numeric: tabular-nums; }
.news__text a { text-decoration: none; font-weight: 700; }
.news__text a:hover { text-decoration: underline; }
.news__new {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--radio);
  color: #fff;
  font: 600 var(--step--1) / 1.5 var(--font-head);
  vertical-align: 0.1em;
}

/* Self test overview */
.quiz-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); max-width: 44rem; }
.quiz-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.25rem;
  border-bottom: 1px solid var(--line);
}
.quiz-item__title { font-weight: 700; text-decoration: none; }
.quiz-item__title:hover { text-decoration: underline; }
.quiz-item__meta { margin: 0.15rem 0 0; font: 500 var(--step--1) / 1.4 var(--font-head); color: var(--slate); }
.quiz-item .button { flex-shrink: 0; }

.band-wrap { margin-top: 1.5rem; }

.band-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--step-1);
  margin-bottom: 0.5rem;
}
.band-caption span { color: var(--slate); font-size: var(--step--1); font-family: var(--font-body); font-weight: 400; }

.band {
  display: flex;
  gap: 3px;
  height: 3.5rem;
}

.band__seg {
  flex-basis: 0;
  min-width: 6px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  display: flex;
  align-items: flex-end;
  padding: 0 0 0.35rem 0.4rem;
  overflow: hidden;
  transition: background-color 150ms ease;
}
.band__seg:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.band__seg:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.band__seg--exam { background: var(--slate); }
.band__seg:hover { background: var(--radio); }
.band__seg:focus-visible { outline-offset: 3px; }

/* ---------- Row lists (fields, topics) ---------- */

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.row {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.85rem 0.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}
.row:hover { background: var(--surface); }
.row:hover .row__title { color: var(--radio); }

.row--plain { grid-template-columns: minmax(0, 1fr) auto; }

.row__nr {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--slate);
  font-variant-numeric: tabular-nums;
}

.row__title { font-weight: 700; }
.row__sub {
  grid-column: 2;
  font-size: var(--step--1);
  color: var(--slate);
}
.row--plain .row__sub { grid-column: 1; }

/* Atkinson's slashed zero reads like "Ø" in counts, so figures use Barlow */
.row__meta, .row__sub, .band-caption span, .pdf__meta {
  font-family: var(--font-head);
  font-weight: 500;
}

.row__meta {
  font-size: var(--step-0);
  color: var(--slate);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--radio);
  border-radius: 999px;
  font-family: var(--font-head);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--radio);
  vertical-align: 0.1em;
  white-space: nowrap;
}

/* Topic status dot: filled = has content */
.status {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 1.5px solid var(--slate);
  margin-right: 0.6rem;
  vertical-align: 0.1em;
}
.status--done { background: var(--radio); border-color: var(--radio); }

.cluster-title {
  font-size: var(--step-1);
  margin: 2rem 0 0.5rem;
  color: var(--ink);
}
.cluster-title:first-child { margin-top: 0; }

.legend {
  font-size: var(--step--1);
  color: var(--slate);
  margin: 0 0 1.25rem;
}

/* ---------- Topic page ---------- */

.topic {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .topic {
    grid-template-columns: minmax(0, 1fr) 19rem;
    gap: 4rem;
    align-items: start;
  }
  /* only when it fits on screen (set in app.js), otherwise the lower part of
     a long group work list could never be reached */
  .topic__aside.is-sticky { position: sticky; top: 6rem; }
}

.article { max-width: var(--measure); }
/* Vertical rhythm lives only in these rules; blocks set no margins themselves */
.article > * { margin-block: 0; }
.article > * + * { margin-top: 1.1rem; }
.article > h2 { margin-top: 2.25rem; }
.article > h2:first-child { margin-top: 0; }
.article > h2 + * { margin-top: 0.6rem; }
.article > p + ul, .article > p + ol { margin-top: 0.35rem; }
.article > h3 { margin-top: 1.6rem; }
.article > h3 + * { margin-top: 0.4rem; }
.article ul, .article ol { padding-left: 1.25rem; }
.article ol { padding-left: 1.6rem; }
.article li + li { margin-top: 0.4rem; }
.article strong { font-weight: 700; }

/* Sticky header is ~112px on phones, ~64px on desktop */
.article h2 { scroll-margin-top: 8rem; }
.article h2:focus { outline: none; }
@media (min-width: 900px) { .article h2 { scroll-margin-top: 5.5rem; } }

.toc {
  max-width: var(--measure);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.25rem 0;
  margin-bottom: 2rem;
}
.toc__title {
  font-family: var(--font-head);
  font-size: var(--step-1);
  font-weight: 600;
  cursor: pointer;
  padding: 0.55rem 0;
}
.toc__title::marker { color: var(--radio); }
.toc details[open] .toc__title { margin-bottom: 0.4rem; }
.toc ol {
  margin: 0;
  padding-left: 1.9rem;
  columns: 2 14rem;
  column-gap: 2rem;
}
.toc li { break-inside: avoid; padding: 0.15rem 0; }
.toc ol { padding-bottom: 0.75rem; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* Jump index on reference pages: all sub headings as tappable chips */
.jump {
  display: grid;
  gap: 1rem 2rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem 0 1.25rem;
  margin-bottom: 2rem;
}
.jump__title {
  margin: 0 0 0.45rem;
  font-family: var(--font-head);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate);
}
.jump__list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.jump__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-head);
  font-weight: 600;
  text-decoration: none;
}
.jump__link:hover { border-color: var(--radio); background: var(--radio-soft); }
.jump__link:focus-visible { outline: 2px solid var(--radio); outline-offset: 2px; }
/* Quick bar under the topic title (phones and tablets only, the aside is
   visible next to the text on wide screens) */
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: -0.75rem 0 1.5rem;
}
.quick__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--radio);
  font: 600 var(--step-0) / 1 var(--font-head);
  text-decoration: none;
  cursor: pointer;
}
.quick__item:hover { border-color: var(--radio); background: var(--radio-soft); }
.quick__item:focus-visible { outline: 2px solid var(--radio); outline-offset: 2px; }
.quick__item svg { width: 1rem; height: 1rem; }
.quick__item--primary { background: var(--radio); border-color: var(--radio); color: #fff; }
.quick__item--primary:hover { background: #8E1D17; border-color: #8E1D17; }
.quick__count { font-weight: 500; opacity: 0.8; }
.quick__item--primary .quick__count { opacity: 0.85; }
@media (min-width: 900px) { .quick { display: none; } }
#downloads-title, #gruppenarbeit { scroll-margin-top: 8rem; }

.jump, .toc { scroll-margin-top: 8rem; }
@media (min-width: 900px) { .jump, .toc { scroll-margin-top: 5.5rem; } }

/* Related topics at the end of a topic */
.see-also { max-width: var(--measure); margin-top: 2.5rem; }
.see-also h2 { font-size: var(--step-1); margin: 0 0 0.6rem; }
.see-also ul { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.see-also a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
}
.see-also a:hover { border-color: var(--radio); background: var(--radio-soft); }
.see-also__where { font: 500 var(--step--1) / 1.3 var(--font-head); color: var(--slate); }
.empty-topic + .see-also { margin-top: 1.5rem; }

/* Search hits inside a topic */
mark.hit {
  background: #FFE9A8;
  color: inherit;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #F2D06B;
  scroll-margin: 8rem 0 6rem;
}
mark.hit--current { background: #FFC933; box-shadow: 0 0 0 2px #E0A800; }

.findbar {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 21;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 30rem;
  margin: 0 auto;
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 18px rgb(23 34 58 / 0.28);
}
.findbar__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-head);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.findbar__count { font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 0.35rem; }
.findbar__term { opacity: 0.8; }
.findbar__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.findbar__btn:hover { background: rgb(255 255 255 / 0.12); }
.findbar__btn:focus-visible { outline: 2px solid #F29B93; outline-offset: -2px; }
.findbar__btn svg { width: 1.25rem; height: 1.25rem; }
.has-findbar .back-to-index { bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 4rem); }

.search-note {
  max-width: var(--measure);
  margin: -0.75rem 0 1.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Floating "back to overview" button on long topic pages */
.back-to-index {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1.05rem 0 0.85rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-head);
  font-size: var(--step-0);
  font-weight: 600;
  box-shadow: 0 6px 18px rgb(23 34 58 / 0.28);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  transition: opacity 180ms ease-out, transform 180ms ease-out, visibility 0s linear 180ms;
}
.back-to-index.is-visible {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}
.back-to-index svg { width: 1.1rem; height: 1.1rem; }
.back-to-index:hover { background: var(--radio); }
.back-to-index:active { transform: scale(0.97); }
.back-to-index:focus-visible { outline: 2px solid var(--radio); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .back-to-index, .back-to-index.is-visible { transform: none; transition: opacity 120ms linear, visibility 0s linear 120ms; }
  .back-to-index.is-visible { transition-delay: 0s; }
}
/* ---------- "Zuhause üben": tools and the practice window ---------- */

.tools {
  max-width: var(--measure);
  margin: 0 0 2rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--radio-soft);
  border: 1px solid #EDC3BE;
  border-radius: var(--radius);
}
.tools h2 { font-size: var(--step-1); margin-bottom: 0.4rem; }
.tools p { margin: 0 0 0.9rem; font-size: var(--step--1); line-height: 1.5; color: var(--slate); }
.tools__row { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.tool {
  display: grid;
  gap: 0.25rem;
  align-content: start;
  min-height: 44px;
  padding: 0.8rem 1rem;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 2px solid #EDC3BE;
  border-radius: var(--radius);
  cursor: pointer;
}
.tool:hover { border-color: var(--radio); }
.tool:focus-visible { outline: 3px solid var(--radio); outline-offset: 2px; }
.tool__title { font: 600 var(--step-0) / 1.2 var(--font-head); color: var(--radio); }
.tool__desc { font-size: var(--step--1); line-height: 1.4; color: var(--slate); }

.practice {
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
}
.practice[open] { display: flex; flex-direction: column; overflow: hidden; }
.practice::backdrop { background: rgba(23, 34, 58, 0.55); }
@media (min-width: 700px) {
  .practice {
    width: min(1500px, calc(100% - 2rem));
    height: calc(100% - 2rem);
    max-height: 64rem;
    margin: auto;
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(23, 34, 58, 0.3);
  }
}
.practice__head {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.75rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.practice__title { font-size: var(--step-1); }
.practice__tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.practice__tab {
  min-height: 44px;
  padding: 0 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.practice__tab:hover { border-color: var(--radio); }
.practice__tab[aria-selected="true"] { color: #fff; background: var(--radio); border-color: var(--radio); }
.practice__tab:focus-visible { outline: 3px solid var(--radio); outline-offset: 2px; }
.practice__ext { margin-left: auto; font-size: var(--step--1); }
/* Phones: one slim row with the tabs and the close button */
@media (max-width: 699px) {
  .practice__head { flex-wrap: nowrap; gap: 0.5rem; padding: 0.4rem 0.5rem 0.4rem 0.75rem; }
  .practice__title, .practice__ext { display: none; }
  .practice__tabs { flex: 1; flex-wrap: nowrap; }
  .practice__tab { flex: 1; padding: 0 0.5rem; font-size: var(--step--1); }
}
.practice__body { flex: 1; min-height: 0; background: #ECEAE7; }
.practice__frame { display: block; width: 100%; height: 100%; border: 0; }
.practice__frame[hidden] { display: none; }

/* ---------- Install hint on the home page ---------- */
.install { max-width: var(--measure); }
.install p { margin: 0 0 0.75rem; font-size: var(--step--1); line-height: 1.5; color: var(--slate); }
.install .button { margin-bottom: 0.75rem; }
.install ul { margin: 0.25rem 0 0.75rem; padding-left: 1.25rem; font-size: var(--step--1); line-height: 1.5; }
.install li + li { margin-top: 0.4rem; }

/* ---------- Image view (lightbox) ---------- */

.lightbox {
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  background: rgba(10, 16, 28, 0.96);
  color: #fff;
}
.lightbox[open] { display: flex; flex-direction: column; overflow: hidden; }
.lightbox::backdrop { background: rgba(10, 16, 28, 0.96); }
.lightbox__close {
  position: fixed;
  z-index: 2;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.lightbox__close svg { width: 24px; height: 24px; }
.lightbox__close:focus-visible { outline: 3px solid #F29B93; outline-offset: 3px; }
.lightbox__stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: calc(52px + 1.25rem) 0.75rem 0.5rem;
  touch-action: pan-x pan-y pinch-zoom;
}
.lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 9rem);
  background: #fff;
  border-radius: 6px;
  cursor: zoom-in;
}
.lightbox.is-zoomed .lightbox__stage { place-items: start center; }
.lightbox.is-zoomed .lightbox__img { max-width: none; max-height: none; height: auto; cursor: zoom-out; }
.lightbox__caption {
  flex: none;
  margin: 0;
  padding: 0.5rem 1rem max(0.75rem, env(safe-area-inset-bottom));
  text-align: center;
  font-size: var(--step--1);
  line-height: 1.4;
  color: #D6D2CE;
}

.offline-bar {
  margin: 0;
  padding: 0.6rem 1rem;
  background: #FFF3D1;
  border-bottom: 1px solid #E2C46A;
  color: var(--ink);
  font-size: var(--step--1);
  line-height: 1.45;
  text-align: center;
}
.offline-bar[hidden] { display: none; }

@media print { .back-to-index { display: none; } }

.article h3[id] { scroll-margin-top: 8rem; }
.article h3:focus { outline: none; }
@media (min-width: 900px) { .article h3[id] { scroll-margin-top: 5.5rem; } }

.note {
  border: 1px solid #E9C55A;
  background: var(--signal-soft);
  padding: 0.9rem 1.1rem 1rem;
  border-radius: var(--radius);
}
.note__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--step-1);
  color: var(--signal);
  margin-bottom: 0.2rem;
}
.note__label svg { width: 1.1rem; height: 1.1rem; flex: none; }
.note p { margin: 0; }

/* Model solution under a task (Segelaufgaben), always visible */
.solution {
  margin: 1.25rem 0 0;
  padding: 0.25rem 1.1rem 1rem;
  background: var(--radio-soft);
  border: 1px solid #EDC3BE;
  border-radius: var(--radius);
}
.solution__title { margin: 0.9rem 0 0.25rem; color: var(--radio); font-size: var(--step-1); }
.solution > :nth-child(2) { margin-top: 0.5rem; }

/* "Das Wichtigste in Kürze" at the top of a page */
.summary {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1.1rem 1rem;
  background: var(--surface);
  border: 1px solid #EDC3BE;
  border-radius: var(--radius);
}
.summary__title {
  margin: 0 0 0.35rem;
  font: 600 var(--step-1) / 1.2 var(--font-head);
  color: var(--radio);
}
.summary ul, .summary ol { margin: 0; padding-left: 1.2rem; }
.summary li + li { margin-top: 0.3rem; }
.summary p { margin: 0.4rem 0 0; }

/* Steckbrief: key data, two columns on wide screens, stacked on phones */
.facts {
  margin: 1.25rem 0 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.facts__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem;
  padding: 0.6rem 1rem;
}
.facts__row + .facts__row { border-top: 1px solid var(--line); }
.facts dt { font-weight: 700; font-size: var(--step--1); color: var(--slate); }
.facts dd { margin: 0; }
@media (min-width: 560px) {
  .facts__row { grid-template-columns: 11rem minmax(0, 1fr); gap: 1rem; }
  .facts dt { font-size: inherit; color: var(--ink); }
}

.figure__credit { display: block; margin-top: 0.15rem; font-size: 0.8rem; }
.figure__credit a { color: inherit; }

.figure { margin: 1.5rem 0 0; }
.figure > a { display: block; cursor: zoom-in; }
.figure img {
  display: block; max-width: 100%; height: auto;
  max-height: 34rem; /* tall pictures (e.g. a pair of symbols) stay a sensible size; tap opens the full picture */
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.5rem; box-sizing: border-box;
}
.figure > a:focus-visible img { outline: 2px solid var(--radio); outline-offset: 2px; }
.figure figcaption { font-size: var(--step--1); color: var(--slate); margin-top: 0.4rem; }
.figure__hint { white-space: nowrap; }

.pdf {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}
a.pdf:hover { border-color: var(--radio); }
a.pdf:hover .pdf__title { color: var(--radio); }

.pdf__icon { flex: none; width: 1.6rem; height: 2rem; color: var(--radio); }
.pdf__text { display: flex; flex-direction: column; min-width: 0; }
.pdf__title { font-weight: 700; line-height: 1.3; }
.pdf__meta { font-size: var(--step--1); color: var(--slate); }

.pdf--missing { border-style: dashed; background: transparent; }
.pdf--missing .pdf__icon { color: var(--slate); }

/* Lecturers' PDFs come first, before the summary */
.downloads {
  max-width: var(--measure);
  margin-bottom: 2rem;
}
.downloads h2 { font-size: var(--step-1); margin-bottom: 0.75rem; }

.aside-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.25rem;
}
.aside-box h2 { font-size: var(--step-1); margin-bottom: 0.75rem; }
.aside-box .pdf { background: var(--paper); border-color: transparent; }
.aside-box a.pdf:hover { border-color: var(--radio); }
.aside-box .empty { margin: 0; font-size: var(--step--1); }
/* Two boxes side by side, stacked on phones (Segelaufgaben) */
.doc-pair { display: grid; gap: 1rem; margin-bottom: 2rem; max-width: 56rem; }
.topic.topic--single { grid-template-columns: minmax(0, 1fr); }
.doc-pair .aside-box { margin: 0; }
.doc-pair__solution { background: var(--radio-soft); border-color: #EDC3BE; }
.doc-pair__solution .pdf { background: var(--surface); }
@media (min-width: 700px) { .doc-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.pdf-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }

.empty-topic {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--slate);
  max-width: var(--measure);
}
.empty-topic p { margin: 0; }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  max-width: var(--measure);
}
.pager a { text-decoration: none; display: flex; flex-direction: column; min-height: 44px; }
.pager small { color: var(--slate); font-size: var(--step--1); }
.pager span { font-weight: 700; }
.pager a:hover span { text-decoration: underline; }
.pager__next { text-align: right; grid-column: 2; }

/* ---------- Search results ---------- */

.results { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.result { border-bottom: 1px solid var(--line); }
.result a {
  display: block;
  padding: 1rem 0.25rem;
  text-decoration: none;
  color: var(--ink);
}
.result a:hover .result__title { color: var(--radio); text-decoration: underline; }
.result__where { display: block; font-size: var(--step--1); color: var(--slate); }
.result__title { display: block; font-weight: 700; font-size: var(--step-1); font-family: var(--font-head); }
.result__snippet { display: block; margin-top: 0.25rem; color: var(--slate); font-size: var(--step--1); }

mark {
  background: var(--radio-soft);
  color: var(--ink);
  border-radius: 2px;
}

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

.button {
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  border: 2px solid var(--radio);
  background: var(--radio);
  color: #fff;
  cursor: pointer;
}
.button:hover { background: #8E1D17; border-color: #8E1D17; }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button--quiet { background: transparent; color: var(--radio); }
.button--quiet:hover { background: var(--radio-soft); border-color: var(--radio); }

/* ---------- Self test card (right column) ---------- */

.topic__aside { display: grid; gap: 1rem; align-content: start; }

.quiz-card { border-color: #EDC3BE; background: var(--radio-soft); }
.quiz-card p { margin: 0 0 0.75rem; font-size: var(--step--1); line-height: 1.5; }
.quiz-card .quiz-card__last { color: var(--slate); font-family: var(--font-head); font-weight: 500; }
.quiz-card .button { width: 100%; }

/* ---------- Self test dialog ---------- */

.has-dialog { overflow: hidden; }

.quiz {
  /* Scale of type and spacing inside the question view. quiz.js lowers it
     (down to about 0.78) only as far as needed so that a question fits the
     window without scrolling. */
  --qs: 1;
  padding: 0;
  border: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
}
.quiz[open] { display: flex; flex-direction: column; overflow: hidden; }
.quiz::backdrop { background: rgba(23, 34, 58, 0.55); }

@media (min-width: 700px) {
  .quiz {
    width: min(40rem, calc(100% - 4rem));
    /* a dialog is pinned to all four edges, so "auto" would stretch it */
    height: -webkit-fit-content;
    height: fit-content;
    max-height: min(56rem, calc(100% - 2rem));
    margin: auto;
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(23, 34, 58, 0.3);
  }
}

.quiz__head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.75rem 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.quiz__title { font-size: var(--step-1); flex: 1; }
.quiz__close {
  flex: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--slate);
  cursor: pointer;
}
.quiz__close:hover { background: var(--paper); color: var(--ink); }
.quiz__close svg { width: 20px; height: 20px; }

/* Starts at its content height and only shrinks (and scrolls) when the screen
   is too low. "flex: 1" (basis 0) collapsed it to one line in Safari on iPads,
   because the dialog itself is only as high as its content. */
.quiz__head { flex: none; }
.quiz__body { padding: calc(1.25rem * var(--qs)); overflow-y: auto; flex: 0 1 auto; min-height: 0; }
@media (max-width: 699px) {
  .quiz__body { flex-grow: 1; } /* phones: full-screen dialog, body fills it */
}

.quiz__progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.quiz__progress span { display: block; height: 100%; background: var(--radio); }
.quiz__count { margin: calc(0.6rem * var(--qs)) 0 calc(1rem * var(--qs)); font-size: var(--step--1); color: var(--slate); font-family: var(--font-head); font-weight: 500; }

.quiz__question { border: 0; margin: 0; padding: 0; }
.quiz__question legend {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: calc(var(--step-2) * var(--qs));
  line-height: 1.2;
  margin-bottom: calc(1rem * var(--qs));
  padding: 0;
}
.quiz__question legend:focus { outline: none; }

.quiz__option {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: calc(0.85rem * var(--qs)) 1rem;
  margin-bottom: calc(0.6rem * var(--qs));
  font-size: calc(var(--step-0) * var(--qs));
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  line-height: 1.45;
}
.quiz__option:hover { border-color: #F29B93; }
.quiz__option input { margin: 0.2rem 0 0; width: 1.15rem; height: 1.15rem; flex: none; accent-color: var(--radio); }
.quiz__option:has(input:checked) { border-color: var(--radio); background: var(--radio-soft); }
.quiz__option:has(input:focus-visible) { outline: 3px solid var(--radio); outline-offset: 2px; }

.quiz__nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: calc(1.5rem * var(--qs));
}

/* After a round: repeat mistakes, repeat all, close. Stacked on phones. */
.quiz__nav--result { flex-wrap: wrap; justify-content: flex-start; }
@media (max-width: 520px) {
  .quiz__nav--result { flex-direction: column; }
  .quiz__nav--result .button { width: 100%; }
}

/* "Test vorzeitig beenden": a quiet text button below the navigation */
.quiz__end { margin: calc(0.5rem * var(--qs)) 0 0; text-align: center; }
.quiz__end-btn {
  min-height: 44px;
  padding: 0 0.75rem;
  border: 0;
  background: none;
  color: var(--slate);
  font: inherit;
  font-size: var(--step--1);
  text-decoration: underline;
  cursor: pointer;
}
.quiz__end-btn:hover:not(:disabled) { color: var(--radio); }
.quiz__end-btn:disabled { opacity: 0.45; cursor: default; text-decoration: none; }
.quiz__end-btn:focus-visible { outline: 3px solid var(--radio); outline-offset: 2px; border-radius: 4px; }
.quiz__partial { color: var(--slate); font-size: var(--step--1); margin-bottom: 0.5rem !important; }

.quiz__score { text-align: center; padding: 0.5rem 0 1.5rem; border-bottom: 1px solid var(--line); }
.quiz__score p { margin: 0; }
.quiz__score-number { font-family: var(--font-head); font-weight: 600; font-size: var(--step-3); }
.quiz__score-number:focus { outline: none; }
.quiz__score-percent { color: var(--slate); font-family: var(--font-head); font-size: var(--step-1); margin-bottom: 0.75rem !important; }

.quiz__review-title { margin: 1.5rem 0 0.75rem; }
.quiz__review { margin: 0; padding-left: 1.4rem; }
.quiz__review li { margin-bottom: 1.25rem; }
.quiz__review p { margin: 0 0 0.3rem; line-height: 1.5; }
.quiz__review-q { font-weight: 700; }
.quiz__review-topic { margin: 0 0 0.15rem; font: 500 var(--step--1) / 1.3 var(--font-head); color: var(--slate); }
.quiz__given span, .quiz__correct span { font-weight: 700; }
.quiz__given { color: var(--signal); }
.quiz__correct { color: var(--radio); }
.quiz__explain { color: var(--slate); font-size: var(--step--1); }
.quiz__all-right { margin: 1.5rem 0; text-align: center; }
.quiz__source { margin: 1rem 0 0; font-size: var(--step--1); color: var(--slate); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
