/* Takshashila China Brain — site styles
   Brand: Takshashila style guide — Llama maroon #620d3c + Marigold #f1a222
   on white / pale-yellow surfaces; Lora headings, Inter body. */

@import url('https://fonts.googleapis.com/css2?family=Lora:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  color-scheme: light;
  /* brand — two colours only */
  --brand: #620d3c;          /* Llama maroon — headers, dark panels, emphasis */
  --brand-ink: #fffbe2;      /* pale yellow on maroon */
  --accent: #f1a222;         /* Marigold — the single accent */
  --accent-soft: #fdf0d5;    /* marigold tint for pill fills */
  --gold-ink: #8a5a10;       /* dark gold: legible small text on gold tints */
  --link: #620d3c;

  /* surfaces & ink (per style guide) */
  --page: #ffffff;
  --surface: #ffffff;
  --surface-alt: #fffbe2;    /* warm alternate zone */
  --ink: #2a2a2a;
  --ink-2: #4d4d4d;
  --muted: #6b6b6b;
  --hairline: #e6e0d8;
  --baseline: #d5ccbf;
  --border: #e6e0d8;

  /* categorical series for data (validated palette — themes stay diverse);
     single-series charts use the brand chart token instead */
  --s1: #2a78d6; --s2: #1baf7a; --s3: #eda100; --s4: #008300;
  --s5: #4a3aa7; --s6: #e34948; --s7: #e87ba4; --s8: #eb6834;
  --chart-1: #620d3c;        /* Llama for single-series marks */

  --radius: 10px;
  --sans: "Inter", "Lato", system-ui, -apple-system, sans-serif;
  --serif: "Lora", "Iowan Old Style", Georgia, serif;
  --maxw: 1160px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* "Llama night" — maroon-tinted dark, never stark black */
  --brand: #3d0a27;
  --brand-ink: #fffbe2;
  --accent: #f1a222;
  --accent-soft: #3a2408;
  --gold-ink: #f1c27d;
  --link: #e3a8c7;
  --page: #1c0712;
  --surface: #2a0c1d;
  --surface-alt: #241019;
  --ink: #f5eee9;
  --ink-2: #d9c9c2;
  --muted: #a08d96;
  --hairline: #43172f;
  --baseline: #5a2242;
  --border: #43172f;
  --s1: #3987e5; --s2: #199e70; --s3: #c98500; --s4: #008300;
  --s5: #9085e9; --s6: #e66767; --s7: #d55181; --s8: #d95926;
  --chart-1: #b45c8b;        /* lighter Llama step for dark surface */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--page);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------------------------------------------------------- header */
.site-header {
  background: var(--brand);
  color: var(--brand-ink);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 2px 12px rgba(0,0,0,.25);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 18px;
  min-height: 62px;
}
.brand-mark {
  display: flex; align-items: center; gap: 12px;
  color: var(--brand-ink); font-weight: 650; letter-spacing: .2px;
  white-space: nowrap;
}
.brand-mark:hover { text-decoration: none; }
.seal {
  width: 36px; height: 36px; border-radius: 7px; flex: none;
  background: var(--accent); color: #620d3c;
  display: grid; place-items: center;
  writing-mode: vertical-rl; text-orientation: upright;
  font-family: var(--serif); font-size: 13.5px; font-weight: 700;
  line-height: 1; letter-spacing: 1px;
  box-shadow: inset 0 0 0 1.5px rgba(98,13,60,.28);
}
.brand-sub { display: block; font-size: 11px; font-weight: 400; opacity: .75; letter-spacing: .4px; text-transform: uppercase; }
.main-nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.main-nav a {
  color: var(--brand-ink); opacity: .82; padding: 8px 12px;
  border-radius: 7px; font-size: 14.5px;
}
.main-nav a:hover { opacity: 1; background: rgba(255,255,255,.08); text-decoration: none; }
.main-nav a.active { opacity: 1; background: rgba(255,255,255,.14); }
.theme-btn {
  background: rgba(255,255,255,.1); color: var(--brand-ink);
  border: 1px solid rgba(255,255,255,.2); border-radius: 7px;
  width: 34px; height: 34px; cursor: pointer; font-size: 15px;
}

/* ------------------------------------------------------------------ hero */
.hero {
  background:
    radial-gradient(1100px 420px at 78% -60px, rgba(241,162,34,.20), transparent 60%),
    radial-gradient(900px 380px at 12% 120%, rgba(26,3,16,.55), transparent 60%),
    var(--brand);
  color: var(--brand-ink);
  padding: 72px 0 64px;
}
.hero h1 {
  font-family: var(--serif); font-size: clamp(34px, 5vw, 54px);
  line-height: 1.12; letter-spacing: .2px; max-width: 780px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .kicker { color: var(--accent); }
.hero p.lede {
  margin-top: 18px; max-width: 640px; font-size: 18px; opacity: .88;
}
.hero-cta { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: 8px;
  font-weight: 600; font-size: 15px; border: 1px solid transparent;
  cursor: pointer;
}
.btn-accent { background: var(--accent); color: #3d0a27; }
.btn-accent:hover { filter: brightness(1.06); text-decoration: none; }
.btn-ghost { border-color: rgba(255,255,255,.4); color: var(--brand-ink); }
.btn-ghost:hover { background: rgba(255,255,255,.08); text-decoration: none; }

/* --------------------------------------------------------------- layout */
.section { padding: 46px 0; }
.section.alt { background: var(--surface-alt); }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--serif); font-size: 27px; font-weight: 650; }
.section-head .more { margin-left: auto; font-size: 14px; }
.kicker {
  font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin-bottom: 6px;
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.card h3 { font-size: 16.5px; line-height: 1.35; font-weight: 650; }
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--link); }
.card .meta { font-size: 13px; color: var(--muted); margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card .summary { font-size: 14px; color: var(--ink-2); margin-top: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.pill {
  display: inline-block; font-size: 12px; padding: 2.5px 10px;
  border-radius: 999px; background: var(--accent-soft); color: var(--gold-ink);
  font-weight: 600; white-space: nowrap;
}
.pill.type {
  background: color-mix(in srgb, var(--brand) 8%, transparent);
  color: var(--brand);
}
:root[data-theme="dark"] .pill.type {
  background: color-mix(in srgb, #e3a8c7 14%, transparent);
  color: #e3a8c7;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); display: inline-block; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 16px;
}
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value {
  font-size: 34px; font-weight: 600; line-height: 1.15; margin-top: 2px;
  font-variant-numeric: tabular-nums; color: var(--brand);
}
:root[data-theme="dark"] .tile .value { color: var(--ink); }
.tile .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* theme tiles on home */
.theme-card { display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color .15s; }
.theme-card:hover { border-color: var(--accent); text-decoration: none; }
.theme-card .count { color: var(--muted); font-size: 13px; }
.theme-card .name { font-weight: 650; color: var(--ink); font-size: 15.5px; line-height: 1.3; }
.theme-card .bar { height: 5px; border-radius: 3px; background: var(--hairline); overflow: hidden; margin-top: 6px; }
.theme-card .bar i { display: block; height: 100%; border-radius: 3px; }

/* ------------------------------------------------------------- research */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px;
}
.filters select, .filters input[type="search"], .ask-input {
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--page); border: 1px solid var(--baseline);
  border-radius: 7px; padding: 8px 10px;
}
.filters input[type="search"] { flex: 1 1 220px; min-width: 180px; }
.filters .count-note { font-size: 13px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.filters button.link-btn { background: none; border: none; color: var(--link); cursor: pointer; font-size: 13.5px; }

.result-list { display: flex; flex-direction: column; gap: 12px; }

/* ---------------------------------------------------------- researchers */
.person-card { display: flex; gap: 16px; align-items: flex-start; }
.person-card .avatar {
  width: 74px; height: 74px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff; display: grid; place-items: center;
  font-family: var(--serif); font-size: 26px; overflow: hidden;
}
.person-card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-card h3 { font-size: 17px; }
.person-card .role { font-size: 13px; color: var(--brand); font-weight: 600; margin-top: 1px; }
:root[data-theme="dark"] .person-card .role { color: #e3a8c7; }
.person-card .bio { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.person-card .links { margin-top: 8px; font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ ask */
.ask-hero { text-align: center; padding: 44px 0 8px; }
.ask-hero h1 { font-family: var(--serif); font-size: clamp(28px, 4vw, 40px); }
.ask-hero p { color: var(--ink-2); max-width: 620px; margin: 10px auto 0; }
.ask-box { max-width: 760px; margin: 26px auto 0; display: flex; gap: 10px; }
.ask-input { flex: 1; font-size: 16px; padding: 13px 16px; border-radius: 10px; }
.ask-suggest { max-width: 760px; margin: 14px auto 0; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.ask-suggest button {
  font: inherit; font-size: 13px; cursor: pointer;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px;
}
.ask-suggest button:hover { border-color: var(--accent); color: var(--accent); }
.answer { max-width: 860px; margin: 30px auto; }
.answer-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.answer-block h2 { font-family: var(--serif); font-size: 21px; margin-bottom: 12px; }
.answer-block .finding { margin: 0 0 14px; padding-left: 14px; border-left: 3px solid var(--chart-1); }
.answer-block .finding p { font-size: 15px; }
.answer-block .finding .src { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.answer-block .finding .src a { color: var(--muted); text-decoration: underline; }
.sources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 14px; }

/* ------------------------------------------------------------ dashboard */
.viz-root { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px 16px; }
.viz-root h3 { font-size: 15px; font-weight: 650; margin-bottom: 2px; }
.viz-root .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.viz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.viz-grid .full { grid-column: 1 / -1; }
@media (max-width: 860px) { .viz-grid { grid-template-columns: 1fr; } }
.viz-root svg { display: block; width: 100%; height: auto; }
.viz-root text { font-family: var(--sans); }
.axis-label { font-size: 11px; fill: var(--muted); }
.bar-label { font-size: 11.5px; fill: var(--ink-2); }
.bar-value { font-size: 11.5px; fill: var(--ink-2); }
.viz-tip {
  position: fixed; z-index: 90; pointer-events: none;
  background: var(--ink); color: var(--page);
  font-size: 12.5px; line-height: 1.45; padding: 7px 11px;
  border-radius: 7px; box-shadow: 0 4px 18px rgba(0,0,0,.25);
  max-width: 260px; opacity: 0; transition: opacity .08s;
}

/* ---------------------------------------------------------------- about */
.prose { max-width: 760px; }
.prose h2 { font-family: var(--serif); font-size: 24px; margin: 30px 0 10px; }
.prose p, .prose li { color: var(--ink-2); font-size: 15.5px; }
.prose ul { padding-left: 22px; margin: 10px 0; }
.prose strong { color: var(--ink); }

/* --------------------------------------------------------------- footer */
.site-footer {
  margin-top: 40px; background: var(--brand); color: var(--brand-ink);
  padding: 36px 0 30px; font-size: 14px;
}
.site-footer .wrap { display: flex; gap: 30px; flex-wrap: wrap; justify-content: space-between; }
.site-footer a { color: var(--brand-ink); opacity: .8; }
.site-footer a:hover { opacity: 1; }
.site-footer .cols { display: flex; gap: 46px; flex-wrap: wrap; }
.site-footer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .6; margin-bottom: 8px; }
.site-footer li { list-style: none; margin: 4px 0; }
.footnote { opacity: .55; font-size: 12.5px; margin-top: 18px; }

@media (max-width: 720px) {
  .site-header .wrap { flex-wrap: wrap; padding: 10px 16px; }
  .main-nav { margin-left: 0; width: 100%; }
  .hero { padding: 48px 0 42px; }
}
