/* LOOGI theme — hardcoded dark UI, OKLCH palette portiert aus dem Designprototyp.
   Schriften via fonts.bunny.net (DSGVO-konformer Google-Fonts-Mirror, siehe ADR 0010). */

@import url('https://fonts.bunny.net/css?family=inter-tight:300,400,500,600,700|jetbrains-mono:400,500&display=swap');

:root {
  --bg: oklch(0.155 0.005 240);
  --bg-2: oklch(0.185 0.006 240);
  --panel: oklch(0.205 0.007 240);
  --panel-2: oklch(0.235 0.007 240);
  --line: oklch(0.28 0.008 240);
  --line-soft: oklch(0.235 0.008 240);
  --fg: oklch(0.95 0.004 240);
  --fg-2: oklch(0.78 0.006 240);
  --fg-3: oklch(0.60 0.008 240);
  --fg-4: oklch(0.46 0.008 240);
  --accent: oklch(0.80 0.105 195);
  --accent-soft: oklch(0.80 0.105 195 / 0.14);
  --accent-line: oklch(0.80 0.105 195 / 0.35);
  --link: oklch(0.82 0.07 230);
  --visited: oklch(0.72 0.09 305);
  --warn: oklch(0.78 0.12 65);
  --error: oklch(0.66 0.18 25);
}

* { box-sizing: border-box; }
/* KEIN html { height: 100% } — iOS Safari evaluiert das gegen die initial
   stable viewport height (innerHeight minus Toolbar-Bereich, statisch ab
   Page-Load) und ignoriert spaetere Toolbar-Show/Hide. Body min-height:100dvh
   ist dynamisch und kann dann groesser werden als html → Body ragt unten
   aus html raus, und im Spalt rendert iOS den html-Default-Hintergrund
   (schwarz im Dark-Mode). Sichtbar als "schwarzer Bottom-Streifen" nach
   jedem Layout-Recalc (z.B. Drawer-Toggle). Ohne explizite height passt
   sich html dem body-Inhalt an — kein Mismatch.
   Background auf html als Defense-in-depth: falls je doch ein Spalt
   entsteht, hat er unsere bg-Farbe statt browser-default schwarz. */
html { margin: 0; padding: 0; background: var(--bg); }
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter Tight', -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;     /* Fallback fuer aeltere Browser */
  min-height: 100dvh;    /* iOS Safari: dynamic viewport — passt sich an
                            URL-Bar-Show/Hide an. */
  /* Kein height:100% und kein overflow auf body — body waere sonst eigener
     Scroll-Container und iOS Safari klappt die URL-Bar nicht ein. Window
     muss Scroll-Root sein. */
}
::selection { background: var(--accent-soft); color: var(--fg); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
a { color: var(--link); text-decoration: none; }
a:visited { color: inherit; }
a:hover { text-decoration: underline; }

/* Defensive horizontale Overflow-Schutzschicht NUR auf html (clip statt
   hidden — clip etabliert KEINEN Scroll-Container, anders als hidden.
   Fallback: hidden fuer Browser ohne clip-Support, modernes Safari/Chrome
   /Firefox nutzen clip und lassen damit das Window scrollen. */
html { overflow-x: hidden; overflow-x: clip; }

/* Icons (SVGs aus icons.html, currentColor) */
.sxng-icon-set, .sxng-icon-set-big, .sxng-icon-set-small {
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
}
.sxng-icon-set-small { width: 14px; height: 14px; }
.sxng-icon-set       { width: 18px; height: 18px; }
.sxng-icon-set-big   { width: 22px; height: 22px; }

/* Header (no top-nav per Designprototyp — Preferences/About im Footer) */
main { flex: 1; display: flex; flex-direction: column; }

/* Decorative search-icon vor dem Input — Klick-Submit per Enter, Buttons hidden */
.search_box_icon { color: var(--fg-3); flex-shrink: 0; }
body.index_endpoint #send_search,
body.index_endpoint #clear_search,
body.results_endpoint #send_search,
body.results_endpoint #clear_search { display: none; }

/* ───────── Index page ───────── */
body.index_endpoint main { align-items: center; justify-content: center; }
body.index_endpoint #main_index {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 20vh;
  gap: 36px;
  width: 100%;
}
/* Landing-Page Logo (Designprototyp .logo). Wordmark height 144px. */
body.index_endpoint .logo {
  display: inline-flex;
  align-items: center;
  user-select: none;
}
body.index_endpoint .logo img {
  height: 144px;
  width: auto;
  display: block;
}

/* ───────── Search box (Index — large) ───────── */
body.index_endpoint #search { width: min(640px, 100%); }
body.index_endpoint #search_header { display: flex; flex-direction: column; gap: 14px; }
body.index_endpoint #search_view { width: 100%; }
body.index_endpoint .search_box {
  position: relative;
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
body.index_endpoint .search_box:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--panel);
}
body.index_endpoint #q {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font: inherit;
  font-size: 15.5px;
  letter-spacing: 0.005em;
}
body.index_endpoint #q::placeholder { color: var(--fg-4); }
/* Categories on the index page (hidden — search defaults to general) */
body.index_endpoint #categories { display: none; }

/* ───────── Results page — top bar (Designprototyp: blurred sticky) ───────── */
body.results_endpoint main {
  display: block;
}
body.results_endpoint #main_results {
  display: block;
  padding: 0 0 32px;
  margin: 0;
}
#search.with_logo { display: none; }

/* Topbar (Spec): height 60px fix, padding 0 28px, kein eigener border-bottom
   (Tabs-Reihe darunter haelt die Linie — Spec: "Border-Linien überlappen
   sich nicht. Wenn zwei Container Borders teilen, hat nur einer die Border"). */
body.results_endpoint #search {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  margin: 0;
}
body.results_endpoint #search_header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  height: 72px;
  max-width: 1400px;
  margin: 0 auto;
}
body.results_endpoint #search_logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
body.results_endpoint #search_logo img {
  height: 40px;
  width: auto;
  display: block;
}
body.results_endpoint #search_view {
  flex: 1;
  min-width: 0;
}
body.results_endpoint .search_box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 16px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  max-width: 800px;
  transition: border-color .15s, box-shadow .15s;
}
body.results_endpoint .search_box:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
body.results_endpoint #q {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  font: inherit;
  font-size: 15.5px;
  letter-spacing: 0.005em;
}
/* Autocomplete (Designprototyp hat keine Send/Clear-Buttons in Suchbox —
   Buttons bleiben im DOM fuer sxng-core JS-Hooks, sind aber via display:none
   in der globalen Regel oben unsichtbar). Autocomplete nur sichtbar wenn
   sxng-core JS Eintraege populated hat (no-js und empty-ul → hidden). */
.autocomplete {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
html.no-js .autocomplete,
.autocomplete:has(ul:empty) {
  display: none;
}
.autocomplete:empty,
.autocomplete ul:empty { display: none; }
.autocomplete ul { list-style: none; margin: 0; padding: 6px 0; }
.autocomplete li {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--fg-2);
  cursor: pointer;
}
.autocomplete li:hover,
.autocomplete li.active { background: var(--bg-2); color: var(--fg); }

/* Tabs-Reihe (Spec: 44px fix, padding 0 28, border-bottom 1 line-soft).
   Tabs gap 4, padding 0 14. Aktiv-Underline 2px accent bei bottom -1px
   (ueberlappt die Border ohne Versatz). Meta rechts via margin-left:auto. */
#categories {
  border-bottom: 1px solid var(--line-soft);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 28px;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#categories_container {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
}
.category {
  position: relative;
}
.category_checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.category label,
.category_button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  font-size: 13.5px;
  color: var(--fg-3);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.005em;
  transition: color .12s;
}
.category label:hover,
.category_button:hover { color: var(--fg); }
.category_checkbox input[type="checkbox"]:checked + label,
.category_button.selected {
  color: var(--fg);
  font-weight: 500;
}
.category_button.selected::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.category_button .tab_icon {
  flex-shrink: 0;
  color: inherit;
}
.category_name { font-size: 13.5px; }
.category_count {
  font-size: 10.5px;
  color: var(--fg-4);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 400;
}
.category .help { display: none; }

/* Results-Layout (Spec: max-width 1400, padding 0 28 auf Hauptzeile Main).
   [Sidebar 240 | Center flex 1]. */
.results_layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 0 28px;
}
#main_column {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 0;
}
#center_column {
  min-width: 0;
}
#urls { min-width: 0; }

/* Sub-Desktop-Layouts kommen geblockt am Ende der Datei (siehe ADR 0014):
   - @media (max-width: 1023px) and (min-width: 641px) → Tablet (kompakt)
   - @media (max-width: 640px)                          → Phone (Drawer-Pattern) */
body.sidebar_collapsed #filters_sidebar { width: 56px; padding: 20px 0; }
body.sidebar_collapsed #filters_sidebar > :not(.sidebar_header) { display: none; }
body.sidebar_collapsed .sidebar_header .filter_label { display: none; }
body.sidebar_collapsed .sidebar_collapse_btn svg { transform: rotate(0deg) !important; }

/* ────────── Filter-Sidebar (LINKS, 240 px) — Designprototyp Sidebar ────── */
#filters_sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--line-soft);
  padding: 22px 20px 40px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: width .18s ease;
}
.sidebar_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar_collapse_btn {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--fg-3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.sidebar_collapse_btn:hover { color: var(--fg); border-color: var(--line); }
.filter_section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter_label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-4);
  font-weight: 500;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* RadioList — Custom Radio (Designprototyp RadioList). Spec: gap 6. */
.radio_list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.radio_form { margin: 0; padding: 0; }
.radio_option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  transition: background .12s, color .12s;
}
.radio_option:hover { background: var(--bg-2); }
.radio_option.selected { color: var(--fg); background: transparent; }
.radio_indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .12s;
}
.radio_option.selected .radio_indicator { border-color: var(--accent); }
.radio_dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background .12s;
}
.radio_option.selected .radio_dot { background: var(--accent); }
.radio_label { flex: 1; }

/* CheckboxList — Custom Checkbox mit Count (Designprototyp Sources). Spec: gap 6. */
.checkbox_list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checkbox_option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--fg-2);
  font-size: 13px;
  transition: background .12s, color .12s;
}
.checkbox_option:hover { background: var(--bg-2); }
.checkbox_option.checked { color: var(--fg); }
.checkbox_indicator {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .12s, border-color .12s;
  color: oklch(0.18 0.01 195);
}
.checkbox_option.checked .checkbox_indicator { background: var(--accent); border-color: var(--accent); }
.checkbox_check { opacity: 0; transition: opacity .12s; }
.checkbox_option.checked .checkbox_check { opacity: 1; }
.checkbox_label { flex: 1; }
.checkbox_count {
  font-size: 10.5px;
  color: var(--fg-4);
}


/* Result-Item (Spec): padding 18px 0, border-bottom 1 line-soft.
   Outer = CSS-Grid [1fr Content | auto Hover-Actions] gap 20 (Designprototyp
   ResultItem). Innen .result_main = flex column gap 4: 3 Zeilen — URL
   (Mono 12 fg-3) | Title (16 fg 500) | Snippet (13.5 fg-2 1.55 wrap-pretty).
   min-width 0 fuer Text-Children, sonst sprengt langer Text das Layout. */
.result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line-soft);
}
.result_main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.result:last-child { border-bottom: 0; }
.result .url_header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--fg-3);
  font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.02em;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}
.result .url_header:hover { color: var(--fg-2); text-decoration: none; }
.result-favicon-square {
  position: relative;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: 0;
  font-family: 'Inter Tight', system-ui, sans-serif;
  overflow: hidden;
}
/* Echtes Favicon via Resolver — liegt absolut ueber dem Letter-Square.
   onerror entfernt das img bei Lade-Fehler, dann ist das Letter-Square
   wieder sichtbar. background:white falls das Favicon transparent ist
   (z.B. SVG ohne fill) — sonst scheint die Hue durchs Logo. */
.result-favicon-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: white;
}
.result .url_wrapper { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.result .url_wrapper span { color: var(--fg-3); }
.result h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.005em;
  min-width: 0;
}
.result h3 a { color: var(--fg); text-decoration: none; overflow-wrap: anywhere; }
.result h3 a:hover { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.result .content {
  margin: 0;
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.6;
  text-wrap: pretty;
  min-width: 0;
  overflow-wrap: anywhere;
}
.result .content.empty_element { color: var(--fg-4); font-style: italic; }
.result .highlight { color: var(--accent); font-weight: 500; }
/* Result-Item zeigt nur 3 Zeilen (URL/Title/Snippet) — Meta + Engines weg */
.result .published_date,
.result .result_length,
.result .result_views,
.result .result_author,
.result .engines,
.result .break,
.result .thumbnail { display: none; }

/* Image results grid */
#urls.only_template_images,
.only_template_images #urls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.result-images { padding: 0; border: 0; }
.result-images a {
  display: block;
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
}
.result-images img.image_thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.result-images .title,
.result-images .source,
.result-images .image_resolution { display: none; }
.result-images .detail { display: none; }


/* Engines table */
.engine-stats { width: 100%; border-collapse: collapse; font-size: 12px; }
.engine-stats td { padding: 4px 0; color: var(--fg-3); }
.engine-stats .engine-name { color: var(--fg-2); }
.engine-stats .response-error { color: var(--warn); text-align: right; }
.engine-stats .response-time { text-align: right; }
.bar-chart-graph { display: inline-block; width: 60px; height: 6px; background: var(--bg-2); border-radius: 3px; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.bar-chart-bar { height: 100%; background: var(--accent); }

/* Answers */
#answers {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  grid-column: 1 / -1;
}
#answers .title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-3); margin: 0 0 8px; }
#answers .answer { font-size: 15px; color: var(--fg); }

/* Corrections */
#corrections {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#corrections h4 { margin: 0 8px 0 0; font-size: 13px; font-weight: 500; color: var(--fg-3); }
#corrections form { display: inline; margin: 0; }
#corrections input[type="submit"] {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--fg-2);
  padding: 4px 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
#corrections input[type="submit"]:hover { color: var(--fg); border-color: var(--accent-line); background: var(--accent-soft); }

/* Pagination — siehe Block weiter unten (Designprototyp PageBtn). */

/* Footer — flex, rechts-ausgerichtet via .spacer (Designprototyp LOOGI.html) */
footer {
  border-top: 1px solid var(--line-soft);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 12px;
  color: var(--fg-4);
}
footer .spacer { flex: 1; }
/* Visited-State explizit ueberschreiben — sonst wuerde das globale
   a:visited (color:inherit) die Footer-Links auf var(--fg-4) setzen
   (Footer-color), was sie dunkler als ungelesen var(--fg-3) macht. */
footer a,
footer a:visited { color: var(--fg-3); text-decoration: none; }
footer a:hover { color: var(--fg); text-decoration: none; }

/* Errors */
.dialog-error,
.dialog-error-block {
  background: var(--panel);
  border: 1px solid var(--error);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 16px 0;
  color: var(--fg);
  font-size: 14px;
}
.dialog-error .close { float: right; color: var(--fg-3); }

/* Back-to-top */
#backToTop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: none;
}
#backToTop a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-2);
}
#backToTop a:hover { color: var(--fg); }

/* Hide nojs widgets */
.show_if_nojs { display: none; }

/* Preferences (minimaler Style — funktional) */
body.preferences_endpoint #main_preferences {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 32px;
}
.preferences_back { margin: 16px 0; }
.preferences_back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--fg-2);
  font-size: 13px;
}
.preferences_back a:hover { color: var(--fg); background: var(--panel); text-decoration: none; }

/* About / Info pages (Markdown-rendered: privacy, terms, about, search-syntax) */
main.page_with_header #page_logo {
  display: block;
  padding: 22px 0 12px;
  text-align: center;
}
main.page_with_header #page_logo img {
  height: 56px;
  width: auto;
  display: inline-block;
}
body.info_endpoint main,
main.page_with_header {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 48px;
}
body.info_endpoint ul.tabs,
main.page_with_header ul.tabs {
  list-style: none;
  padding: 0;
  margin: 8px 0 24px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft);
}
body.info_endpoint ul.tabs li,
main.page_with_header ul.tabs li { margin: 0; }
body.info_endpoint ul.tabs a,
main.page_with_header ul.tabs a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 13.5px;
  color: var(--fg-3);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color .12s, border-color .12s;
  margin-bottom: -1px;
}
body.info_endpoint ul.tabs a:hover,
main.page_with_header ul.tabs a:hover { color: var(--fg); }
body.info_endpoint ul.tabs a.active,
main.page_with_header ul.tabs a.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.info-page {
  font-size: 15px;
  line-height: 1.65;
  color: var(--fg-2);
}
.info-page h1 { font-size: 28px; font-weight: 600; color: var(--fg); margin: 16px 0 18px; }
.info-page h2 { font-size: 19px; font-weight: 600; color: var(--fg); margin: 28px 0 10px; }
.info-page h3 { font-size: 16px; font-weight: 600; color: var(--fg); margin: 20px 0 8px; }
.info-page p  { margin: 8px 0 12px; }
.info-page ul, .info-page ol { padding-left: 22px; margin: 8px 0 12px; }
.info-page li { margin: 4px 0; }
.info-page a { color: var(--link); }
.info-page a:hover { color: var(--accent); }
.info-page code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}
.info-page hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 24px 0;
}
.info-page strong { color: var(--fg); font-weight: 600; }

/* Result-Item Hover-Actions (Designprototyp ResultItem) — 2. Grid-Spalte */
.result_actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transition: opacity .15s ease;
  pointer-events: none;
}
.result:hover .result_actions {
  opacity: 1;
  pointer-events: auto;
}
.result_action {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--fg-3);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.result_action:hover {
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
}

/* ────────── Pagination-Polish (Designprototyp Pagination/PageBtn) ────────── */
#pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 32px 0 60px;
  flex-wrap: wrap;
}
#pagination form { margin: 0; padding: 0; display: inline; }
.numbered_pagination { display: inline-flex; gap: 6px; }
/* Pagination buttons — nur die Input/Button-Elemente, NICHT die wrapping
   <form class="page_number">. (Sonst rendern Browser den form-Wrapper UND
   den input mit jeweils einem Box-Style → 2 Kaesten pro Zahl.) */
#pagination .previous_page button,
#pagination .next_page button,
#pagination input[type="submit"],
#pagination input[type="button"] {
  appearance: none;
  -webkit-appearance: none;
  min-width: 36px;
  height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#pagination .previous_page button:hover,
#pagination .next_page button:hover,
#pagination input[type="submit"]:hover {
  color: var(--fg);
  background: var(--panel);
  border-color: var(--line);
}
#pagination input.page_number_current {
  background: var(--accent-soft);
  color: var(--fg);
  border-color: var(--accent-line);
  cursor: default;
}

/* ────────── Hamburger-Toggle (Off-Canvas-Filter-Drawer) ────────── */
/* Default: nur sichtbar im Phone-Block (siehe weiter unten). */
#drawer_toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: var(--fg-3);
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
#drawer_toggle:hover { color: var(--fg); border-color: var(--line); }
#drawer_toggle:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

/* ────────── Off-Canvas-Drawer Overlay (Default — sichtbar nur auf Phone) ─── */
#drawer_overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 70;
  display: none;  /* Auf Desktop/Tablet komplett aus dem Layout */
}

/* ────────── Mobile (Phone ≤ 640 px) ────────── */
@media (max-width: 640px) {
  /* Topbar kompakt: 56 px Inhaltsraum + safe-area-inset-top fuer Notch.
     Sticky-Top bleibt 0 (Bar laeuft bis zur Notch); padding-top schiebt
     den Inhalt unter die Notch. */
  body.results_endpoint #search { padding-top: env(safe-area-inset-top); }
  body.results_endpoint #search_header {
    height: auto;
    min-height: 56px;
    gap: 12px;
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  }
  body.results_endpoint #search_logo img { height: 28px; }
  body.results_endpoint .search_box {
    height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    gap: 10px;
  }
  body.results_endpoint #q { font-size: 15px; }

  /* Hamburger sichtbar nur auf Phone */
  #drawer_toggle { display: inline-flex; }

  /* ───── Filter-Sidebar als Off-Canvas-Drawer ─────
     Drawer-Pattern dominiert auch wenn body.sidebar_collapsed gesetzt ist
     (z.B. von einer vorherigen Tablet-Session). */
  #filters_sidebar,
  body.sidebar_collapsed #filters_sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(85vw, 320px);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 80;
    background: var(--bg);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: calc(env(safe-area-inset-top) + 22px)
             max(20px, env(safe-area-inset-left))
             calc(env(safe-area-inset-bottom) + 32px)
             max(20px, env(safe-area-inset-left));
    border-right: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  /* Falls vorher sidebar_collapsed aktiv war: Inhalte wieder voll zeigen. */
  body.sidebar_collapsed #filters_sidebar > :not(.sidebar_header) { display: revert; }
  body.sidebar_collapsed .sidebar_header .filter_label { display: revert; }

  /* Drawer offen: einfahren. KEIN Body-Scroll-Lock (weder CSS overflow noch
     JS position:fixed) — beide aendern den Body-Scroll-Container-Status,
     was iOS Safari als Trigger fuer URL-Bar-Reveal auslegt. Drawer + Overlay
     decken alles visuell ab, Body-Scroll dahinter ist unsichtbar. Siehe
     setDrawerOpen() in loogi.js fuer den iOS-Bottom-Toolbar-Nudge nach Close. */
  body.drawer_open #filters_sidebar,
  body.drawer_open.sidebar_collapsed #filters_sidebar { transform: translateX(0); }

  /* Overlay aktivieren (display:none → block damit Transition greift).
     touch-action:none verhindert dass Swipe-Gesten auf der Overlay-Flaeche
     den Body-Scroll dahinter beeinflussen — Tap (Click-to-close) bleibt
     funktional, da Click-Events nicht von touch-action gefiltert werden. */
  #drawer_overlay { display: block; touch-action: none; }
  body.drawer_open #drawer_overlay { opacity: 1; pointer-events: auto; }

  /* Collapse-Btn in der Sidebar ist auf Phone redundant (Drawer-Pattern hat
     eigene Close-Mechanismen: Hamburger erneut, Overlay-Tap, ESC). */
  .sidebar_collapse_btn { display: none; }

  /* Layout in der Center-Column: kein Padding rechts/links via .results_layout
     da Drawer fixed ist und nicht mit-shiftet. Main-Column bekommt eigenes. */
  .results_layout { padding: 0; }
  #main_column { padding: 16px max(16px, env(safe-area-inset-right)) 0
                          max(16px, env(safe-area-inset-left)); }

  /* ───── Tabs-Reihe horizontal scrollbar ─────
     4 Tabs + Counts passen nicht in 375 px Viewport. overflow-x:auto laesst
     den User horizontal scrollen, scrollbar visuell ausgeblendet (Touch-
     Inertia trotzdem aktiv).
     overflow-y:hidden + touch-action:pan-x verhindern dass iOS-Safari die
     Tab-Strip auch vertikal scrollen/bouncen laesst — sonst kann der User
     den Strip nach unten/oben "ziehen" obwohl es nichts zu sehen gibt. */
  #categories {
    padding: 0 max(12px, env(safe-area-inset-left));
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-y: none;
    touch-action: pan-x;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  #categories::-webkit-scrollbar { display: none; }
  #categories_container { flex-shrink: 0; }

  /* ───── Result-Item: Actions weg auf Phone, Layout block ─────
     "Im neuen Tab oeffnen" und "Domain ausblenden" sind auf Phone mehr
     Stoerung als Nutzen (kleines Display, kein Hover, Daumen verdeckt
     den rechten Rand). Komplett ausblenden + Grid-Layout zu Block weil
     die zweite Spalte sonst Platz reservieren wuerde. */
  .result_actions { display: none; }
  .result { display: block; }

  /* ───── Index-Page: Logo + Padding kompakter ───── */
  body.index_endpoint .logo img { height: 88px; }
  body.index_endpoint #main_index {
    padding: 24px max(16px, env(safe-area-inset-left)) 16vh
             max(16px, env(safe-area-inset-right));
    gap: 24px;
  }

  /* ───── Pagination Touch-Targets (Apple HIG ≥44px) ─────
     Auf Phone nur 5 Seitennummern: [pageno, pageno+4]. Forms ausserhalb
     dieser Spanne tragen Klasse .phone_hidden (siehe results.html) und
     werden hier ausgeblendet. */
  #pagination {
    gap: 8px;
    padding: 24px max(12px, env(safe-area-inset-left))
             calc(env(safe-area-inset-bottom) + 60px)
             max(12px, env(safe-area-inset-right));
  }
  #pagination form.phone_hidden { display: none; }
  #pagination .previous_page button,
  #pagination .next_page button,
  #pagination input[type="submit"],
  #pagination input[type="button"] {
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    font-size: 13.5px;
  }

  /* ───── Footer: zentriert, wrap, safe-area-inset-bottom ───── */
  footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    padding: 16px max(16px, env(safe-area-inset-right))
             calc(env(safe-area-inset-bottom) + 16px)
             max(16px, env(safe-area-inset-left));
  }
  footer .spacer { display: none; }

  /* ───── BackToTop: Position oberhalb der Home-Bar ───── */
  #backToTop {
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(env(safe-area-inset-bottom) + 16px);
  }
}

/* ────────── Tablet (641–1023 px) ────────── */
/* Layout-Konzept (240 Sidebar + Center) bleibt; nur Padding kompakter
   damit auf 768 px iPad-portrait noch genug Platz fuer Content bleibt. */
@media (max-width: 1023px) and (min-width: 641px) {
  .results_layout { padding: 0 16px; }
  #main_column { padding: 20px 20px 0; }
}

