/* ==========================================================
   Bildungseinrichtungen – Stylesheet
   ========================================================== */
:root {
    --bg:        #f6f8f7;
    --surface:   #ffffff;
    --text:      #1d2a2a;
    --muted:     #5a6762;
    --line:      #dfe5e2;
    --primary:   #0667a9;
    --primary-d: #003a62;
    --primary-l: #e3f1ee;
    --accent:    #b4570f;
    --accent-l:  #fbeee2;
    --radius:    10px;
    --shadow:    0 1px 2px rgba(16, 40, 34, .06), 0 4px 16px rgba(16, 40, 34, .06);
    --font:      "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: 'Atkinson Hyperlegible Next';
  hyphens: auto;
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('/fonts/Atkinson-Hyperlegible-Next.ttf');
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next Italic';
  src: url('/fonts/Atkinson-Hyperlegible-Next-Italic.ttf');
}

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 16px/1.55 var(--font);
    color: var(--text);
    background: var(--bg);
}
a { text-decoration-style: dotted; color: var(--primary); }
a:hover { color: var(--primary-d); }
h1, h2 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.175rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

/* ---------- Header / Footer ---------- */
.site-header {
    background: var(--primary-d);
    color: #fff;
    padding: 18px 0;
    margin-bottom: 28px;
}
.site-header .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 6px 24px; }
.brand { display: inline-flex; align-items: center; gap: 2rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.25rem; }
.brand:hover { color: #fff; }
.brand-mark {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 8px;
    background: #fff; color: var(--primary-d); font-weight: 800;
}
.tagline { margin: 0; opacity: .8; font-size: .95rem; }
.site-footer { color: var(--muted); font-size: .875rem; padding: 32px 0; }
.site-footer ul { list-style-type: none; display: flex; padding-left: 0; }
.site-footer ul li:not(:first-of-type) { margin-left: 2rem; }
.site-footer a { color: var(--muted); }

/* ---------- Karten / Boxen ---------- */
.filter-card, .box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}

/* ---------- Filter ---------- */
#filterForm { font-size: 0.9rem; }
.filter-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: end;
}
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.field select, .field input {
    width: 100%;
    height: 42px;
    font: inherit;
    padding: 8px 11px;
    border: 1px solid #c9d3cf;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}
.field select:focus, .field input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.actions { display: flex; gap: 8px; }

.btn {
    display: inline-flex;
    align-items: center;
    height: 42px;
    font: inherit; font-weight: 600;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); border-color: #c9d3cf; }
.btn-ghost:hover { background: var(--primary-l); }

/* ---------- Ergebnisse / Tabelle ---------- */
.results { margin-top: 22px; }
.result-info { color: var(--muted); margin: 0 0 10px; }
.result-info strong { color: var(--text); }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
table.angebote { width: 100%; border-collapse: collapse; }
.angebote th, .angebote td { padding: 12px 14px; text-align: left; vertical-align: top; }
.angebote thead th {
    background: #eef3f1;
    font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.angebote th.sortable a { color: inherit; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.angebote th.sortable a:hover, .angebote th.is-active a { color: var(--primary-d); }
.sort-icon { font-size: .7rem; opacity: .55; }
.is-active .sort-icon { opacity: 1; }

.angebote tbody tr { border-bottom: 1px solid var(--line); transition: background .15s; }
.angebote tbody tr:last-child { border-bottom: 0; }
.angebote tbody tr:hover { background: #f7faf9; }
.col-name a { font-weight: 600; text-decoration: none; }
.col-name a:hover { text-decoration: underline; }
.col-name > span { display: block; }
.col-desc { color: #3b4a46; font-size: .93rem; max-width: 340px; }
.col-desc .clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
td[data-label="Ort"] { hyphens: none; }


table.angebote th:first-of-type { width: 40%; }
table.angebote th:nth-of-type(2) { width: 15%; }
table.angebote th:nth-of-type(3) { width: 30%; }

.sub { display: block; color: var(--muted); font-size: .85rem; }

.chip {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 2px 9px;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    text-decoration: none;
    background: var(--primary-l);
    color: var(--primary-d);
    line-height: 1.25;
}

a.chip-art:hover { color: #222222; }
a.chip-cat:hover { color: #4b2405; }
.chip-cat { background: var(--accent-l); color: #7a3a08; }
a.chip-cat:hover { color: #4b2405; }
.chip-tag { background: #eef1f0; color: #3b4a46; }
a.chip-tag:hover { color: #021624; }

/* ---------- Pager ---------- */
.angebote tfoot td { background: #fafcfb; border-top: 1px solid var(--line); }
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; }
.pager ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pager a, .pager span {
    display: inline-block; min-width: 36px; padding: 6px 10px;
    border-radius: 8px; text-align: center; text-decoration: none;
}
.pager a:hover { background: var(--primary-l); }
.pager .is-current { background: var(--primary); color: #fff; font-weight: 700; }
.pager .is-disabled { color: #a8b3af; }
.pager .gap { padding: 6px 2px; color: var(--muted); }
.pager-step { font-weight: 600; }

/* ---------- Detailseite ---------- */
.back { margin: 0 0 14px; }
.back a { text-decoration: none; font-weight: 600; }
.detail-head { margin-bottom: 22px; }
.detail-head h1 { font-size: 2rem; margin: 8px 0 8px; }
.lead { font-size: 1.1rem; color: #3b4a46; margin: 0; max-width: 70ch; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.detail-main, .detail-side { display: grid; gap: 22px; }
.detail-img { width: 100%; border-radius: var(--radius); }
.richtext { max-width: 75ch; }
.richtext ul { padding-left: 1.2em; }

.box dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; }
.box dt { font-weight: 600; font-size: .88rem; color: var(--muted); }
.box dd { margin: 0; overflow-wrap: anywhere; }
.box-traeger { border-top: 4px solid var(--accent); }
.traeger-name { margin: 0 0 12px; }
details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--primary); }

.error-box { max-width: 640px; }
.debug { background: #fff3f0; padding: 10px; border-radius: 6px; white-space: pre-wrap; }

/* ---------- Responsiv ---------- */
@media (max-width: 1000px) {
    .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .actions { grid-column: 1 / -1; }
    .detail-grid { grid-template-columns: 1fr; }
}

/* Tabelle wird auf schmalen Bildschirmen zu Karten */
@media (max-width: 760px) {
    .filter-form { grid-template-columns: 1fr; }
    h1, .detail-head h1 { font-size: 1.4rem; }
    .angebote thead { display: none; }
    .angebote, .angebote tbody, .angebote tr, .angebote td, .angebote tfoot { display: block; width: 100%; }
    .angebote tbody tr { padding: 12px 14px; }
    .angebote td { padding: 4px 0; max-width: none; }
    .angebote tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
        color: var(--muted);
    }
    .angebote td.col-name::before { display: none; }
    .angebote td.col-name a { font-size: 1.1rem; }
    .angebote tfoot td { padding: 12px; }
    .sort-mobile { display: flex; }
    .box dl { grid-template-columns: 1fr; gap: 2px; }
    .box dd { margin-bottom: 8px; }
}

/* Assistive Devices Only Content */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* Tags */
.chips {
  margin-block: 1.5rem;
}

/* Mobile Sortierleiste (per JS eingefügt, da der Tabellenkopf ausgeblendet ist) */
.sort-mobile { display: none; gap: 8px; align-items: center; margin-bottom: 10px; font-size: .9rem; }
.sort-mobile a { padding: 4px 10px; border-radius: 999px; border: 1px solid #c9d3cf; text-decoration: none; background: #fff; }
.sort-mobile a.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* HTML-Seiten */
.brand .logo {
  height: 60px;
}

.brand span {
  font-size: 1.5rem;
  letter-spacing: 0.5px;
}

.topics-card-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-gap: 1.5rem;
}

.border {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topics-card {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topics-card > p {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  font-size: 1.25rem;
}

.topics-card > p a {
  padding: 1rem 2rem;
  text-align: center;
}

.topics-card img {
  width: 100%;
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.claim {
  padding-block: 0.75rem 2.25rem;
  font-size: 1.5rem;
  color: var(--muted);
}

@media (max-width: 760px) {
  .site-header .wrap { flex-wrap: nowrap; }
  .site-header .wrap > .logo { max-width: 100px; }
  .site-header .logo { max-width: 90px; }
  .brand span { font-size: 1rem; line-height: 1.25rem; letter-spacing: unset; }

  .card-group {
    grid-template-columns: 1fr;
  }
  
@media (max-width: 760px) {
  .topics-card-group {
    grid-template-columns: 1fr 1fr;
  }

  .topics-card > p {
    min-height: 6rem;
    justify-content: center;
    align-items: center;
    padding-inline: 1rem;
    font-size: 1rem;
  }

  .topics-card > p a {
    padding: unset;
    hyphens: auto;
  }

  .topics-card {
    justify-content: space-evenly;
    overflow: hidden;
  }
}
