/* Feed redesign (2026-08-24, mockup pass) — TOP AREA ONLY.
   Loads after styles.css + zz_feed_controls/zz_feed_layout, so
   equal-specificity rules here win by order.

   SCOPE NOTE (user 2026-08-24, round 6): the CARDS themselves were rolled
   back to their original reels look (bottom overlay title + side action
   rail, 9:16 stage) — this file must NOT style card internals. It owns the
   page chrome around them: theme tokens, tabs, search, sort, topic chips,
   welcome banner. Card rules live in styles.css as before.

   Strategy: the feed routes nearly all its colors through the --feed-*
   tokens on .feed-theme-shell.feed-theme-dark — section 1 RETOKENS the dark
   theme to the design-system palette (docs/design_system.md, same values as
   /explore's --cmp-*). The light theme is parked (pages/feed/page.py clamps
   the shell to dark), so only the dark block is redefined. */

/* ---- 1. dark theme retokened to the design system ------------------------- */

.feed-theme-shell.feed-theme-dark {
  --feed-bg: var(--sp-bg);
  --feed-panel: var(--sp-surface);
  --feed-panel-strong: var(--sp-surface);
  --feed-card-bg: var(--sp-surface);
  --feed-card-border: var(--sp-border-strong);
  --feed-card-shadow: none;
  --feed-border: var(--sp-border-strong);
  --feed-divider: var(--sp-border);
  --feed-input-bg: var(--sp-surface);
  --feed-input-border: var(--sp-border-strong);
  --feed-text: var(--sp-text);
  --feed-title: var(--sp-text);
  --feed-subtitle: var(--sp-text-2);
  --feed-meta: var(--sp-text-3);
  --feed-muted: var(--sp-text-3);
  --feed-accent: var(--sp-accent);
  --feed-primary: var(--sp-accent);
  --feed-primary-strong: var(--sp-accent-hover);
  --feed-track: var(--sp-chip);
  --feed-badge-bg: var(--sp-surface);
  --feed-badge-border: var(--sp-border-strong);
  --feed-badge-text: var(--sp-text-2);
  --feed-type-question-bg: color-mix(in srgb, var(--sp-accent) 14%, transparent);
  --feed-type-stat-bg: color-mix(in srgb, var(--sp-accent) 14%, transparent);
  --feed-type-pill-border: color-mix(in srgb, var(--sp-accent) 30%, transparent);
  --feed-type-pill-text: var(--sp-accent-hover);
  --feed-answered-badge-bg: var(--sp-border);
  --feed-answered-badge-border: var(--sp-border-strong);
  --feed-answered-badge-text: var(--sp-text-2);
  --feed-icon-btn-bg: var(--sp-surface);
  --feed-icon-btn-border: var(--sp-border-strong);
  --feed-icon-btn-color: var(--sp-text-2);
  --feed-icon-btn-hover: var(--sp-chip);
  --feed-icon-btn-accent-bg: color-mix(in srgb, var(--sp-accent) 14%, transparent);
  --feed-icon-btn-accent-border: color-mix(in srgb, var(--sp-accent) 30%, transparent);
  --feed-icon-btn-accent-color: var(--sp-accent-hover);
  --feed-icon-btn-accent-hover: color-mix(in srgb, var(--sp-accent) 20%, transparent);
  --feed-mode-switch-bg: var(--sp-chrome);
  --feed-mode-switch-border: var(--sp-border-strong);
  --feed-mode-switch-label: var(--sp-text-3);
  --feed-mode-switch-indicator-bg: color-mix(in srgb, var(--sp-accent) 14%, transparent);
  --feed-mode-switch-indicator-border: color-mix(in srgb, var(--sp-accent) 30%, transparent);
  --feed-mode-switch-label-active: var(--sp-accent-hover);
  --feed-result-surface: var(--sp-chrome);
  --feed-result-border: var(--sp-border-strong);
  --feed-result-track: var(--sp-chip);
  --feed-result-track-selected: color-mix(in srgb, var(--sp-accent) 20%, transparent);
  --feed-result-fill: #3A3D46;
  --feed-result-fill-selected: var(--sp-accent);
  --feed-result-label: var(--sp-text);
  --feed-result-accent: var(--sp-accent-hover);
  --feed-answer-bg: var(--sp-chrome);
  --feed-answer-border: var(--sp-border-strong);
  --feed-answer-text: var(--sp-text);
  --feed-answer-hover: var(--sp-chip);
  --feed-note-bg: var(--sp-chrome);
  --feed-note-border: var(--sp-border-strong);
  --feed-note-border-strong: var(--sp-border-strong);
  --feed-note-icon: var(--sp-text-3);
  --feed-note-text: var(--sp-text-2);
  --feed-stage-bg: var(--sp-bg);
  --feed-video-stage-bg: #000000;
  --feed-stage-border: var(--sp-border-strong);
  --feed-control-panel-bg: var(--sp-chrome);
  --feed-skeleton-fill: rgba(42, 44, 51, 0.9);
  --feed-skeleton-fill-selected: color-mix(in srgb, var(--sp-accent) 35%, transparent);
  --feed-segment-surface: transparent;
  --feed-segment-border: transparent;
  --feed-segment-active: transparent;
  --feed-segment-active-shadow: none;
  --feed-order-surface: var(--sp-surface);
  --feed-order-active: var(--sp-chip);
  --feed-chart-chip-surface: var(--sp-surface);
  --feed-chart-chip-border: var(--sp-border-strong);
  --feed-chart-chip-text: var(--sp-text-2);
  --feed-header-bg: rgba(13, 14, 18, 0.92);
  --feed-header-border: var(--sp-border-strong);
  --feed-header-text: var(--sp-text);
  --feed-header-muted: var(--sp-text-3);
  --feed-header-muted-hover: var(--sp-text-2);
  --feed-theme-btn-bg: var(--sp-surface);
  --feed-theme-btn-border: var(--sp-border-strong);
  --feed-theme-btn-color: var(--sp-text-2);
  --feed-user-bg: var(--sp-accent);
  --feed-user-color: var(--sp-bg);
  --feed-category-bg: color-mix(in srgb, var(--sp-accent) 12%, transparent);
  --feed-category-border: color-mix(in srgb, var(--sp-accent) 28%, transparent);
  --feed-category-text: var(--sp-accent-hover);
  --feed-loader-bg: var(--sp-surface);
  --feed-loader-border: var(--sp-border-strong);
  --feed-loader-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  --feed-loader-orb: var(--sp-accent);
  --feed-loader-orb-soft: color-mix(in srgb, var(--sp-accent) 35%, transparent);
  --feed-loader-detail: var(--sp-text-2);
}

/* page ground (body-level rules can't read the shell-scoped tokens) */
body:where([data-sp-has~="app"]):not(#sp-s):where([data-sp-has~="feed-dark"]):not(.sp-s):not(.sp-s) {
  background: var(--sp-bg) !important;
  color-scheme: dark;
}

body:where([data-sp-has~="app"]):not(#sp-s):where([data-sp-has~="feed-dark"]):not(.sp-s):not(.sp-s) #app-container {
  background-color: var(--sp-bg) !important;
}

/* ---- 2. feed typography --------------------------------------------------- */

#main-feed-shell.main-feed-page-shell {
  font-family: "Instrument Sans", "Manrope", sans-serif;
}

/* ---- 3. content tabs (For You / Stats / Quizzes): underline style --------- */

#main-feed-shell.main-feed-page-shell .feed-content-tabs {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-indicator {
  display: none;
}

#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-control {
  border: 0 !important;
}

#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-label {
  position: relative;
  padding: 6px 2px 8px;
  margin-right: 16px;
  border-radius: 0;
  background: transparent !important;
  color: var(--feed-muted);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none !important;
  transition: color 0.15s ease;
}

#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}

/* !important: older feed bands color the active tab with the accent */
#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label,
#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-label[data-active] {
  color: var(--sp-text) !important;
}

/* orange underline (mockup) */
#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-control[data-active] .mantine-SegmentedControl-label::after,
#main-feed-shell.main-feed-page-shell .feed-content-tabs .mantine-SegmentedControl-label[data-active]::after {
  background: var(--feed-accent);
}

/* ---- 4. search trigger + sort select -------------------------------------- */

#main-feed-shell.main-feed-page-shell .feed-search-open-btn {
  width: 36px;
  height: 36px;
  border-radius: 50% !important;
  background: var(--feed-icon-btn-bg) !important;
  border: 1px solid var(--feed-icon-btn-border) !important;
  color: var(--feed-icon-btn-color) !important;
}

#main-feed-shell.main-feed-page-shell .feed-order-select .mantine-Input-input {
  background: var(--feed-order-surface) !important;
  border: 1px solid var(--feed-border) !important;
  border-radius: 999px !important;
  color: var(--feed-text) !important;
  font-weight: 700;
}

/* ---- 5. topic chips: dark pills, orange when checked ----------------------- */

#main-feed-shell.main-feed-page-shell .feed-topic-chip .mantine-Chip-label {
  background: #16171C !important;
  border: 1px solid #1F2127 !important;
  border-radius: 999px !important;
  color: var(--feed-subtitle) !important;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 32px;
  box-shadow: none !important;
}

#main-feed-shell.main-feed-page-shell .feed-topic-chip .mantine-Chip-label[data-checked] {
  background: var(--feed-accent) !important;
  border-color: var(--feed-accent) !important;
  color: var(--sp-bg) !important;
}

#main-feed-shell.main-feed-page-shell .feed-topic-chip .mantine-Chip-checkIcon {
  color: var(--sp-bg);
}

