/* app.css part 7/8: frontend-slim, loading line, theme blocks. Split from app.css 10.11.2026; the parts load in this order [see css_parts.py], one cascade. */
/* ── Frontend-Slim (Variante A) ───────────────────────────────── */
/* Search magnifier in the topbar */
.search-icon {
  appearance: none; background: var(--bg-soft); border: var(--rule-w) solid var(--rule);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; padding: 0;
  color: var(--fg-mid); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: border-color .15s ease, color .15s ease;
}
.search-icon:hover { border-color: var(--accent); color: var(--accent-strong); }
.search-icon svg { width: 18px; height: 18px; display: block; }
.saved-icon {
  appearance: none; background: var(--bg-soft); border: var(--rule-w) solid var(--rule);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; padding: 0;
  color: var(--fg-mid); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: border-color .15s ease, color .15s ease;
}
.saved-icon:hover { border-color: var(--accent); color: var(--accent-strong); }
.topics-icon {
  appearance: none; background: var(--bg-soft); border: var(--rule-w) solid var(--rule);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; padding: 0;
  color: var(--fg-mid); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: border-color .15s ease, color .15s ease;
}
.topics-icon:hover { border-color: var(--accent); color: var(--accent-strong); }
.topics-icon svg { width: 18px; height: 18px; display: block; }
.topics-icon.is-marked { border-color: var(--accent); color: var(--accent-strong); }
/* Desktop: icon + label side by side (mobile: icons sit at the bottom with their own text). */
.ti-label { display: none; }
@media (min-width: 761px) {
  .search-icon, .topics-icon, .saved-icon { width: auto; padding: 0 .85rem 0 .7rem; gap: .45rem; }
  .ti-label { display: inline; font-family: var(--sans); font-size: .85rem; font-weight: 600; line-height: 1; }
}
.saved-icon svg { width: 18px; height: 18px; display: block; }

/* Search overlay (own layer) */
.search-overlay {
  position: fixed; inset: 0; z-index: 3000; display: none;
  flex-direction: column; padding: 1.4rem 1.5rem;
  background: color-mix(in oklab, var(--bg) 94%, transparent);
  backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
}
.search-overlay.open { display: flex; animation: fadein .18s ease; }
.search-overlay .search-form { max-width: 820px; width: 100%; margin: 0 auto; }
/* Topic chips in the search popup (variant B): radios hidden, labels = chips. */
.so-topics {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: .9rem;
}
.so-topics-label {
  font-family: var(--sans); font-size: .74rem; font-weight: 600;
  color: var(--fg-dim); text-transform: uppercase; letter-spacing: .08em;
  margin-right: .1rem;
}
.so-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-family: var(--sans); font-size: .8rem; font-weight: 600;
  padding: .3rem .75rem; border-radius: 999px;
  border: var(--rule-w) solid var(--rule); background: var(--bg-soft);
  color: var(--fg); cursor: pointer; white-space: nowrap;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.so-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.so-chip .d { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
@media (hover: hover) { .so-chip:hover { border-color: var(--accent); } }
.so-chip:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong);
}
.so-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-overlay .search-row {
  display: flex; align-items: center; gap: .9rem; max-width: 820px; width: 100%;
  margin: 0 auto; border-bottom: 2px solid var(--accent); padding-bottom: .7rem;
}
.search-overlay .so-mag { color: var(--fg-dim); display: inline-flex; flex-shrink: 0; }
.search-overlay .so-mag svg { width: 22px; height: 22px; display: block; }
.search-overlay input {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: 1.2rem;
  background: transparent; border: 0; outline: none; color: var(--fg); padding: .3rem 0;
}
.search-overlay input::placeholder { color: var(--fg-dim); }
.search-overlay .so-close,
.filter-overlay .so-close {
  appearance: none; background: var(--bg-soft); border: var(--rule-w) solid var(--rule);
  width: 38px; height: 38px; border-radius: 50%; font-size: 1.4rem; line-height: 1;
  cursor: pointer; color: var(--fg-mid); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s ease, background .15s ease, transform .18s ease;
}
.search-overlay .so-close:hover,
.filter-overlay .so-close:hover { color: var(--accent-fg); background: var(--accent-solid); border-color: var(--accent-solid); transform: rotate(90deg); }
/* Filter chip (opens the topics overlay) */
.filter-chip svg { width: 15px; height: 15px; display: block; }
/* Active topic chip next to the topics button */
.active-chip {
  flex-shrink: 1; min-width: 0; display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--sans); font-size: .82rem; font-weight: 600;
  padding: .4rem .55rem .4rem .7rem; border-radius: 999px;
  border: var(--rule-w) solid var(--accent); background: var(--accent-soft);
  color: var(--accent-strong); white-space: nowrap;
}
.active-chip .d, .active-chip .ac-clear { flex-shrink: 0; }
.active-chip .ac-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.active-chip .ac-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%; text-decoration: none;
  font-size: 1rem; line-height: 1; color: var(--accent-strong);
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  transition: background .15s ease;
}
.active-chip .ac-clear:hover { background: var(--accent-solid); color: var(--accent-fg); }
/* Topics overlay (fullscreen, same pattern as the search) */
.filter-overlay {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: flex-start; justify-content: center;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.filter-overlay.open { display: flex; }
.filter-sheet {
  max-width: 440px; width: 100%; margin: 13vh 1.2rem 0;
  background: var(--bg); border: var(--rule-w) solid var(--rule);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  padding: 1.1rem 1.2rem 1.4rem; animation: fsheet .18s ease;
}
@keyframes fsheet { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.filter-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.filter-title { font-family: var(--display); font-weight: 700; font-size: 1.15rem; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; }
.filter-grid .topic-chip { flex: 0 0 auto; justify-content: flex-start; }
/* "Alle" [All] across both columns, so the topics below start cleanly in alphabetical order */
.filter-grid .chip-all { grid-column: 1 / -1; }
/* Search + topics as ONE sheet from the bottom with a switch [mobile, decision 06.11.]: handle, switch row [search | topics, close],
   below it, depending on the tab, search field + topics row OR the full topics grid. On desktop the topics card stays on top; handle, switch and
   search field are hidden there [the search overlay applies there]. */
.sheet-grip, .sheet-tabs-row, .sheet-search, .sheet-scope { display: none; }
@media (max-width: 760px) {
  .filter-overlay { z-index: 1450; align-items: flex-end; background: var(--scrim); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .filter-sheet {
    margin: 0; max-width: none; border-width: 1px 0 0; border-radius: 22px 22px 0 0; box-shadow: none;
    padding: 0 var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom, 0px));
    max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; position: relative; background: var(--bg-soft);
    animation: sheetup .22s cubic-bezier(.2,.8,.3,1); touch-action: pan-y;
  }
  .filter-overlay.open .filter-sheet { transition: transform .2s ease; }
  .sheet-grip { display: block; height: 28px; position: relative; cursor: grab; }
  .sheet-grip::before { content: ""; position: absolute; top: 10px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--fg-dim); opacity: .5; }
  .sheet-tabs-row { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
  .sheet-tabs { flex: 1; display: flex; border: var(--rule-w) solid var(--rule); border-radius: 999px; padding: 3px; background: var(--bg-tint); }
  .sheet-tab {
    flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer; border-radius: 999px;
    font: 600 var(--t-s)/1 var(--sans); color: var(--fg-mid); padding: 10px var(--sp-3); transition: color .15s ease, background .15s ease;
  }
  .sheet-tab[aria-selected="true"] { background: var(--accent-solid); color: var(--accent-fg); }
  .sheet-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .sheet-tabs-row .so-close { flex: none; }
  .filter-head { display: none; }   /* the switch names the view */
  /* "Search" tab */
  .filter-overlay[data-tab="suche"] .sheet-search { display: block; margin: 0 0 var(--sp-3); }
  .filter-overlay[data-tab="themen"] .sheet-search { display: none; }
  .sheet-row { display: flex; align-items: center; gap: var(--sp-2); }
  .sheet-row .so-mag { color: var(--fg-dim); display: inline-flex; flex: none; }
  .sheet-row .so-mag svg { width: 22px; height: 22px; display: block; }
  .sheet-row input[type="search"] {
    flex: 1; min-width: 0; font: 400 var(--t-m)/1.3 var(--sans); color: var(--fg);
    background: var(--bg-tint); border: 0; border-radius: 999px; padding: .7rem 1rem; outline: none; -webkit-appearance: none; appearance: none;
  }
  .sheet-row input::placeholder { color: var(--fg-dim); }
  .sheet-row input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
  .sheet-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .sheet-scope { margin: var(--sp-2) 0 0 30px; font-size: var(--t-s); color: var(--fg-mid); align-items: center; gap: var(--sp-1); }
  .filter-overlay.has-scope[data-tab="suche"] .sheet-scope { display: flex; }
  .sheet-scope b { color: var(--fg); font-weight: 600; }
  .sheet-scope button { appearance: none; background: none; border: 0; color: var(--fg-dim); font-size: 1.2rem; line-height: 1; padding: 0 var(--sp-2); cursor: pointer; }
  .filter-overlay[data-tab="suche"] .filter-grid .topic-chip.picked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
  /* In the search tab the topics are a sideways-scrolling row [narrowing], in the topics tab the full grid */
  .filter-overlay[data-tab="suche"] .filter-grid { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: var(--sp-2); scrollbar-width: none; padding-bottom: var(--sp-1); }
  .filter-overlay[data-tab="suche"] .filter-grid .topic-chip { flex: none; }
  .filter-overlay[data-tab="suche"] .filter-grid .chip-all { grid-column: auto; }
  /* With a chosen narrowing only this selection shows, not the active feed filter in addition */
  .filter-overlay.has-scope[data-tab="suche"] .filter-grid .topic-chip.active:not(.picked) { border-color: var(--rule); background: transparent; color: var(--fg); }
  /* Keyboard open: no bottom safe margin [the keyboard sits below] */
  .filter-overlay[data-tab="suche"] .filter-sheet:focus-within { padding-bottom: var(--sp-3); }
}
@keyframes sheetup { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .filter-sheet { animation: none; } }

/* ── Global loading line (indeterminate) ─────────────────────────── */
#loadbar {
  position: fixed; top: 0; left: 0; right: 0; height: 5px;
  z-index: 9998; pointer-events: none;
  opacity: 0; transition: opacity .2s ease;
}
#loadbar.active { opacity: 1; }
#loadbar::before {
  content: ""; position: absolute; top: 0; left: -40%; height: 100%; width: 40%;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--upd, #2f6fed), transparent);
  animation: loadbar-slide 1.15s cubic-bezier(.4,0,.2,1) infinite;
}
@keyframes loadbar-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #loadbar::before {
    animation: none; left: 0; width: 100%; opacity: .5;
  }
}

/* ============================================================
   NEWSPAPER SKIN (data-skin="paper") -- orthogonal to data-theme.
   Additive: overrides only variables + a few rules. Axis 1
   (light/auto/dark) stays untouched and applies automatically.
   Serif: Instrument Serif (already self-hosted) for headlines,
   robust system reading serifs as body-text fallback.
   ============================================================ */
[data-skin="paper"] {
  --paper-head: "Newsreader", "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  --paper-body: "Newsreader", "Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --radius: 3px; --radius-sm: 2px;
}

/* — Paper LIGHT / AUTO-light: paper white, anthracite, claret accent — */
[data-skin="paper"],
[data-skin="paper"][data-theme="light"] {
  --bg:#f4f1ea; --bg-soft:#fbfaf6; --bg-tint:#ece7db;
  --fg:#1c1a17; --fg-mid:#4a453d; --fg-dim:#6b665c;
  --accent:#15486b; --accent-strong:#0f3a58; --accent-soft:#dde6ee; --accent-fg:#fbfaf6; --accent-solid:#15486b;
  --upd:#3f5a8a; --upd-soft:#e3e7f0;
  --rule:#d8d1c2; --rule-soft:#e7e1d3;
  --shadow-sm: 0 1px 0 rgba(28,26,23,.06);
  --shadow-md: 0 1px 0 rgba(28,26,23,.08);
  --shadow-lg: 0 2px 0 rgba(28,26,23,.10);
}
[data-skin="paper"][data-theme="dark"] {
  --bg:#17150f; --bg-soft:#1e1b14; --bg-tint:#221e16;
  --fg:#ece5d6; --fg-mid:#b3aa96; --fg-dim:#91866e;
  --accent:#6ba3cf; --accent-strong:#8fbde0; --accent-soft:#16222e; --accent-fg:#0c141b; --accent-solid:#6ba3cf;
  --upd:#8aa0c8; --upd-soft:#1c2436;
  --rule:#2c271c; --rule-soft:#221e16;
  --shadow-sm: 0 1px 0 rgba(0,0,0,.4);
  --shadow-md: 0 1px 0 rgba(0,0,0,.5);
  --shadow-lg: 0 2px 0 rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  [data-skin="paper"]:not([data-theme]) {
    --bg:#17150f; --bg-soft:#1e1b14; --bg-tint:#221e16;
    --fg:#ece5d6; --fg-mid:#b3aa96; --fg-dim:#91866e;
    --accent:#6ba3cf; --accent-strong:#8fbde0; --accent-soft:#16222e; --accent-fg:#0c141b; --accent-solid:#6ba3cf;
    --upd:#8aa0c8; --upd-soft:#1c2436;
    --rule:#2c271c; --rule-soft:#221e16;
    --shadow-sm: 0 1px 0 rgba(0,0,0,.4);
    --shadow-md: 0 1px 0 rgba(0,0,0,.5);
    --shadow-lg: 0 2px 0 rgba(0,0,0,.6);
  }
}

/* — Typography: serif for body text, serif for headlines — */
[data-skin="paper"] body { font-family: var(--paper-body); }[data-skin="paper"] .hero h1 {
  font-family: var(--paper-head); letter-spacing: 0;
}
[data-skin="paper"] .hero h1 { font-weight: 400; }/* — Small-caps meta — */
[data-skin="paper"] .section-label {
  font-family: var(--paper-body);
  font-variant: small-caps; letter-spacing: .04em;
}
/* Newspaper skin: brand in a single ink colour -- "ai" NOT in the accent (default: accent).
   var(--fg) instead of #000, so it stays light in paper dark mode. */
/* Newspaper skin: flat modal header -- no colour gradient, no coloured
   accent line on top. Plain paper, only the hairline below as separator.
   Paper only; the default keeps gradient + accent line. */
[data-skin="paper"] .modal-header {
  background: var(--bg-soft);
}
[data-skin="paper"] .modal-header::before { display: none; }
/* Newspaper skin: remove coloured bullets in the topic filter (like the topic
   dots in the cards). Paper only; stream keeps the colour code. */
[data-skin="paper"] .filter-grid .topic-chip .d { display: none; }
/* Newspaper skin: remove the coloured bullet at "related topics". The entries
   are already separated horizontally by hairlines (border-top) -- no
   additional separator needed. Paper only. */
[data-skin="paper"] .related-item .related-cat .dot { display: none; }

