/* internal/web/static/theme.css — тема оформления newsdepo.
 *
 * Этот файл встраивается в бинарь через go:embed и отдаётся как
 * /static/theme.css. Он НЕ зависит от Tailwind-сборки: `go build` без
 * `make web-build` всё равно должен отдавать рабочую тему.
 *
 * Тёмная тема: html[data-theme="dark"] + CSS-переменные.
 * Переключатель — кнопка #theme-btn в шапке (localStorage + prefers-color-scheme).
 */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --text: #0d0d0d;
  --text-2: #333333;
  --text-3: #666666;
  --text-4: #888888;
  --border: rgba(0, 0, 0, 0.06);
  --border-2: rgba(0, 0, 0, 0.12);
  --accent: #18e299;
  --accent-deep: #0fa76e;
  --accent-soft: #d4fae8;
  --link: #0d0d0d;
  --link-hover: #0fa76e;
  --shadow: rgba(0, 0, 0, 0.04) 0px 2px 6px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --mark-bg: #ffe90d;
  --mark-text: #111;
}

html[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #141414;
  --surface-2: #1a1a1a;
  --text: #ededed;
  --text-2: #a0a0a0;
  --text-3: #8a8a8a;
  --text-4: #6b6b6b;
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.14);
  --accent: #18e299;
  --accent-deep: #4ade80;
  --accent-soft: rgba(24, 226, 153, 0.14);
  --link: #ededed;
  --link-hover: #4ade80;
  --shadow: rgba(0, 0, 0, 0.45) 0px 2px 6px;
  --mark-bg: #7a5c00;
  --mark-text: #fff8d0;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
  margin: 0;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }

/* Шапка */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner { max-width: 1100px; margin: 0 auto; }
.header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 16px;
}
.header-logo img { height: 40px; width: auto; display: block; }
.header-title { flex: 1; min-width: 0; }
.header-title h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}
.tagline { font-size: 0.78rem; color: var(--text-3); font-style: italic; }
.clock { font-size: 0.75rem; color: var(--text-4); font-variant-numeric: tabular-nums; }
.header-actions { display: flex; align-items: center; gap: 0.35rem; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* Поиск в шапке */
.header-search { padding: 0 16px 12px; }
.header-search form { position: relative; display: flex; align-items: center; }
.header-search input[type="search"] {
  width: 100%;
  padding: 8px 40px 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.header-search input[type="search"]:focus { border-color: var(--accent); background: var(--surface); }
.header-search .search-hint {
  position: absolute;
  right: 10px;
  padding: 1px 7px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-4);
  font-size: 12px;
  pointer-events: none;
}

/* Бегущая строка */
.ticker {
  overflow: hidden;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.ticker-track { display: inline-block; padding: 6px 0; font-size: 0.82rem; }
.ticker-track a { margin-right: 18px; text-decoration: none; color: var(--text-2); }
.ticker-track .sep { margin-right: 18px; color: var(--text-4); }

/* Раскладка */
.layout-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout-wrap { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}

/* Карточки новостей */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.news-grid[data-view="list"] { grid-template-columns: 1fr; }
.news-card {
  position: relative;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.news-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card-link { display: block; padding: 14px; text-decoration: none; color: inherit; }
.news-card h2 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 6px;
}
.card-link:hover h2 { color: var(--accent-deep); }
.news-card .summary {
  font-size: 0.85rem;
  color: var(--text-3);
  line-height: 1.45;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-4);
  flex-wrap: wrap;
}
.meta .source { font-weight: 600; color: var(--text-2); }
.meta .cat {
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-3);
  text-transform: uppercase;
  font-size: 0.65rem;
  letter-spacing: 0.4px;
}
.bookmark-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-4);
  font-size: 15px;
  cursor: pointer;
}
.bookmark-btn:hover, .bookmark-btn.saved { color: var(--accent-deep); }
mark { background: var(--mark-bg); color: var(--mark-text); padding: 0 2px; border-radius: 2px; }

/* Trending */
.trending-block {
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.trending-block h2 { font-size: 0.95rem; margin: 0 0 8px; }
.trending-item {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.87rem;
}
.trending-item .src { color: var(--accent-deep); font-weight: 600; flex-shrink: 0; }
.trending-item:hover { color: var(--text); }

/* Страница новости */
.news-page { max-width: 720px; }
.news-page h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 8px; }
.meta-line { display: flex; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--text-4); margin-bottom: 14px; flex-wrap: wrap; }
.news-page .lead { font-size: 1.02rem; line-height: 1.6; color: var(--text-2); }
.btn-primary {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #06281c;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.06); }
.related { margin-top: 28px; }
.related h2 { font-size: 1.05rem; margin-bottom: 10px; }
.related a {
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.9rem;
}
.related a:hover { color: var(--text); }

/* Сайдбар */
.sidebar { display: flex; flex-direction: column; gap: 14px; }
.sb-block {
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.sidebar-head {
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
}
.sb-title {
  font-size: 0.8rem;
  padding: 8px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.sb-sub { color: var(--text-4); font-weight: 400; }
.fx-list, .cat-list, .tz-list { padding: 8px 12px; }
.fx-row, .tz-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.8rem;
  color: var(--text-2);
}
.weather-now { padding: 12px; display: flex; gap: 10px; align-items: center; }
.weather-now .w-temp { font-size: 1.5rem; font-weight: 700; }
.weather-details { padding: 0 12px 10px; font-size: 0.78rem; color: var(--text-3); }
.weather-details > div { display: flex; justify-content: space-between; padding: 2px 0; }
.weather-forecast { padding: 0 12px 12px; }
.fc-day { display: flex; justify-content: space-between; font-size: 0.78rem; padding: 2px 0; color: var(--text-3); }

/* Страница стран / источников */
.page-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-sub { color: var(--text-3); font-size: 0.9rem; margin-bottom: 1.25rem; }
.alpha-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 1.25rem; }
.alpha-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.alpha-nav a:hover { border-color: var(--accent); color: var(--text); }
.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.6rem; }
.country-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.country-card:hover { border-color: var(--accent); }
.country-card .flag { font-size: 1.4rem; line-height: 1; }
.country-card .name { flex: 1; font-size: 0.92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-card .count {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.source-list { display: flex; flex-direction: column; border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; background: var(--surface); }
.source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.92rem;
  text-decoration: none;
}
.source-row:last-child { border-bottom: none; }
.source-row:hover { background: var(--surface-2); }
.source-row .count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.empty-note { color: var(--text-3); font-size: 0.9rem; padding: 1.5rem 0; }

/* Панель фильтров */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.85rem;
}
.filter-label { color: var(--text-3); }
.filter-chip {
  padding: 2px 10px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}
.filter-chip:hover { background: var(--accent-soft); }
.filter-clear { margin-left: auto; color: var(--text-3); text-decoration: underline; }
.filter-clear:hover { color: var(--text); }

/* Футер */
.site-footer {
  border-top: 1px solid var(--border-2);
  padding: 20px 16px 30px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-3);
}
.site-footer .links { margin-bottom: 8px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.site-footer .links a { color: var(--text-2); text-decoration: none; }
.site-footer .links a:hover { color: var(--accent-deep); }

/* Мобильное меню */
.mobile-menu { display: none; padding: 0 16px 12px; }
.mobile-menu input[type="search"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}
@media (max-width: 640px) {
  .mobile-menu.open { display: block; }
  .sm\:hidden { display: inline-flex; }
}
@media (min-width: 641px) {
  .sm\:hidden { display: none; }
}

/* Утилиты */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.mt-6 { margin-top: 1.5rem; }
.text-sm { font-size: 0.875rem; }
.italic { font-style: italic; }
.text-gray-400 { color: var(--text-4); }
.text-gray-600 { color: var(--text-3); }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-6xl { font-size: 3.75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.max-w-3xl { max-width: 48rem; }
.inline-block { display: inline-block; }
.bg-blue-600 { background: #2563eb; }
.text-white { color: #fff; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.rounded-lg { border-radius: 8px; }
.bg-[var(--accent)] { background: var(--accent); }
.text-black { color: #000; }
.absolute { position: absolute; }
.top-2 { top: 0.5rem; }
.left-2 { left: 0.5rem; }
.z-50 { z-index: 50; }

/* Переключатель языка */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-2);
}
.lang-opt {
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.3px;
}
.lang-opt:hover { color: var(--text); }
.lang-opt.active { background: var(--accent); color: #06281c; }

/* Кнопка установки PWA */
.install-btn[hidden] { display: none; }

/* ---------- Палитра команд ---------- */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}
.palette-overlay[hidden] { display: none; }
.palette-box {
  width: min(560px, calc(100vw - 2rem));
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.palette-input {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.palette-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 46vh;
  overflow-y: auto;
}
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.palette-item.selected {
  background: var(--accent-soft);
  color: var(--text);
}
.palette-item .palette-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .palette-key {
  padding: 1px 6px;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-4);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.palette-empty {
  padding: 14px 10px;
  color: var(--text-4);
  font-size: 13px;
  text-align: center;
}
.palette-hint {
  display: flex;
  gap: 14px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--text-4);
}
.palette-hint kbd {
  padding: 0 4px;
  border: 1px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
