/* quotes.nooz.ai — design tokens + base shell styles
 * Ported from hyper.nooz.ai (nooz-public). Dark is the default theme;
 * [data-theme="light"] is an opt-in override, toggled via the theme
 * switcher and persisted to localStorage under the "nooz-theme" key.
 */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/inter-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/static/fonts/inter-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/cormorant-garamond-700.woff2') format('woff2');
}

/* ---- Design tokens: dark is the default (no data-theme attr, or data-theme="dark") ---- */
:root,
[data-theme="dark"] {
  --bg-primary: #0b0f1a;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-hover: #1e2a40;
  --text-primary: #f1f5f9;
  --text-secondary: #b8cad8;
  --text-muted: #8fa3b8;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --border-color: #253048;
  --shadow-color: rgba(0, 0, 0, .4);

  /* semantic aliases used throughout the shell */
  --direct-fg: var(--accent-green);
  --direct-bg: rgba(16, 185, 129, .14);
  --reported-fg: var(--accent-orange);
  --reported-bg: rgba(245, 158, 11, .14);
}

[data-theme="light"] {
  --bg-primary: #e8eaee;   /* light grey page — so white cards stand out */
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;      /* cards stay white, pop against the grey page */
  --bg-hover: #eef1f5;
  --text-primary: #1a1a1f;
  --text-secondary: #3a3a42;
  --text-muted: #6b6b76;
  --accent-blue: #3b3a6b;
  --accent-purple: #6b4fa0;
  --accent-green: #1f7a4d;
  --accent-orange: #8a6d1f;
  --accent-red: #b3261e;
  --border-color: #cfd4db;  /* visible medium-grey section borders (was near-white) */
  --shadow-color: rgba(20, 20, 30, .10);

  --direct-fg: #1f7a4d;
  --direct-bg: #e7f4ec;
  --reported-fg: #8a6d1f;
  --reported-bg: #f6efdc;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .15s ease, color .15s ease;
}

a { color: inherit; text-decoration: none; }

/* ---- header / nav ---- */
header {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg-secondary) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  z-index: 5;
}

.bar {
  max-width: 920px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -.02em;
}
.logo b { color: var(--accent-blue); }
.logo span { color: var(--text-muted); font-weight: 500; }

nav {
  display: flex;
  gap: 22px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-muted);
}
nav a.active { color: var(--text-primary); }
nav a.active::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--accent-blue);
  margin-top: 6px;
  border-radius: 2px;
}

.grow { flex: 1; }
.count { font-size: 13px; color: var(--text-muted); }

.theme-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3px;
}
.theme-switch button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 16px;
  cursor: pointer;
}
.theme-switch button.active {
  background: var(--accent-blue);
  color: #fff;
}

/* ---- filter row ---- */
.filters {
  max-width: 920px;
  margin: 0 auto;
  padding: 18px 24px 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text-muted);
}
.search input {
  border: 0;
  outline: 0;
  flex: 1;
  font: inherit;
  color: var(--text-primary);
  background: transparent;
}
.chip {
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.chip.on {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
.sort { margin-left: auto; font-size: 13px; color: var(--text-muted); }

/* ---- main / feed ---- */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 24px 60px;
}
.stream {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- quote card ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px 26px;
  box-shadow: 0 1px 2px var(--shadow-color);
}
.card:hover { background: var(--bg-hover); }

.quote {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 25px;
  line-height: 1.34;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 18px;
  position: relative;
}
.quote .mark {
  color: var(--accent-blue);
  opacity: .45;
  font-size: 30px;
  margin-right: 2px;
}

.who { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  background: color-mix(in srgb, var(--accent-blue) 20%, transparent);
  color: var(--accent-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid var(--border-color);
}
.avatar.rep {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.name { font-weight: 600; font-size: 15px; }
.title { color: var(--text-muted); font-size: 13px; }

.meta {
  margin-left: auto;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.pub { font-weight: 600; color: var(--text-secondary); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .02em;
}
.pill.direct { color: var(--direct-fg); background: var(--direct-bg); }
.pill.reported { color: var(--reported-fg); background: var(--reported-bg); }

.cardfoot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.cardfoot a { color: var(--accent-blue); font-weight: 500; }
.credit { margin-left: auto; font-size: 11px; opacity: .7; }

/* ---- feed: empty state + pagination ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.load-more {
  align-self: center;
  margin: 8px auto 0;
  padding: 10px 22px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.load-more:hover { background: var(--bg-hover); }

/* ---- initials-avatar color hash (deterministic, theme-safe) ----
 * app.main._avatar_color() hashes a name to one of these 5 indices;
 * Task 7 swaps in real photos and these become an unused fallback. */
.avatar-color-0 { background: color-mix(in srgb, var(--accent-blue) 20%, transparent); color: var(--accent-blue); }
.avatar-color-1 { background: color-mix(in srgb, var(--accent-purple) 20%, transparent); color: var(--accent-purple); }
.avatar-color-2 { background: color-mix(in srgb, var(--accent-green) 20%, transparent); color: var(--accent-green); }
.avatar-color-3 { background: color-mix(in srgb, var(--accent-orange) 20%, transparent); color: var(--accent-orange); }
.avatar-color-4 { background: color-mix(in srgb, var(--accent-red) 20%, transparent); color: var(--accent-red); }

/* ---- People: directory grid ---- */
.people-grid {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 0 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.person-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: 0 1px 2px var(--shadow-color);
}
.person-card:hover { background: var(--bg-hover); }
.person-card-name { font-weight: 600; font-size: 14.5px; }
.person-card-count { font-size: 12.5px; color: var(--text-muted); }
.person-card-credit {
  font-size: 10.5px;
  color: var(--text-muted);
  opacity: .7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.avatar-lg { width: 64px; height: 64px; font-size: 19px; }
.avatar-xl {
  width: 132px;
  height: 132px;
  border-radius: 16px;
  font-size: 40px;
  margin-bottom: 16px;
}

/* ---- Person page: identity column + "Quotes over time" timeline ---- */
.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
}
.crumb { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); }
.crumb a { color: var(--accent-blue); }

.id { position: sticky; top: 78px; align-self: start; }
.pname {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 4px;
}
.prole { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.stats {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}
.stat b { display: block; font-size: 20px; font-weight: 700; }
.stat span { font-size: 12px; color: var(--text-muted); }
.bio { font-size: 13.5px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 10px; }
.attr { font-size: 11.5px; color: var(--text-muted); }
.attr a { color: var(--accent-blue); }
.topics { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 7px; }
.topic {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent-blue) 16%, transparent);
  color: var(--accent-blue);
  font-weight: 500;
}

.tl-head { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 600; margin: 2px 0 18px; }
.month {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 22px 0 12px;
}
.spine { position: relative; padding-left: 26px; }
.spine::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border-color);
}
.q { position: relative; margin-bottom: 16px; }
.q::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent-blue);
}
.qcard {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px 20px;
}
.qtext {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 12px;
  color: var(--text-primary);
}
.qmeta { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-muted); }
.qmeta a { color: var(--accent-blue); font-weight: 500; margin-left: auto; }

.truncated-note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 760px) {
  .wrap { grid-template-columns: 1fr; }
  .id { position: static; }
}

/* ---- Search: big search box, Keyword/Semantic toggle, results count ---- */
.bigsearch {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 15px 18px;
  box-shadow: 0 1px 3px var(--shadow-color);
  font-size: 17px;
}
.bigsearch input {
  border: 0;
  outline: 0;
  flex: 1;
  font: inherit;
  color: var(--text-primary);
  background: transparent;
}
.modes {
  max-width: 760px;
  margin: 16px auto 8px;
  display: flex;
  gap: 8px;
}
.mode {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}
.mode.on { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.mode.disabled { cursor: not-allowed; opacity: .55; }
.mode small { opacity: .8; font-weight: 400; }
.hint {
  max-width: 760px;
  margin: 6px auto 22px;
  font-size: 13px;
  color: var(--text-muted);
}
.hint b { color: var(--accent-blue); }
.rescount {
  max-width: 680px;
  margin: 0 auto 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Literal query-term highlighting in Search results (server-built from
 * escaped segments — see app.main._highlight_query_terms — never |safe
 * on raw input). */
mark {
  background: color-mix(in srgb, var(--accent-orange) 40%, transparent);
  color: var(--text-primary);
  border-radius: 3px;
  padding: 0 1px;
}

/* ---- "Find similar quotes" (Task 8): seed card + match-strength bar ---- */
.seed-stream { max-width: 680px; margin: 0 auto 8px; }
.similar-head {
  max-width: 680px;
  margin: 28px auto 16px;
  text-align: center;
}
.matchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}
.matchbar-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  overflow: hidden;
}
.matchbar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-blue);
}
.matchpct { flex: none; font-weight: 500; }
