/* ─── Tina Design System ─── */
:root {
  --primary: #1a365d;
  --primary-light: #2b6cb0;
  --accent: #d69e2e;
  --accent-light: #faf089;
  --bg: #fefcf9;
  --bg-card: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Fira Code", monospace;
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; }

/* ─── Layout ─── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ─── Header ─── */
.site-header {
  background: var(--primary);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.02em;
}
.site-title:hover { color: var(--accent); }

.site-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a {
  color: rgba(255,255,255,0.85);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.site-nav a:hover,
.site-nav a.active { background: rgba(255,255,255,0.15); color: white; }

/* ─── Hero ─── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #2a4365 50%, #2c5282 100%);
  color: white;
  padding: 3rem 0;
  text-align: center;
}

.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.hero p { font-size: 1.1rem; opacity: 0.85; max-width: 600px; margin: 0 auto; }

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat .num { font-size: 1.75rem; font-weight: 800; color: var(--accent); }
.hero-stat .label { font-size: 0.85rem; opacity: 0.75; margin-top: 0.15rem; }

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ─── Page Sections ─── */
.page-section { padding: 2.5rem 0; }

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
  display: inline-block;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ─── Tables ─── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table th {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: left;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f7fafc; }

/* ─── Filters ─── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: white;
}

/* ─── Tags / Badges ─── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: white; }
.badge-accent { background: var(--accent); color: white; }
.badge-light { background: #edf2f7; color: var(--text-muted); }

/* ─── Score highlight ─── */
.score-value { font-weight: 700; font-size: 1.1rem; color: var(--primary-light); }
.rank-value { font-weight: 600; color: var(--text); }

/* ─── Footer ─── */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.7);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* ─── Article ─── */
.article-content {
  max-width: 720px;
  margin: 0 auto;
}

.article-content h2 { font-size: 1.35rem; margin: 1.75rem 0 0.75rem; color: var(--primary); }
.article-content h3 { font-size: 1.15rem; margin: 1.25rem 0 0.5rem; }
.article-content p { margin-bottom: 1rem; }
.article-content ul, .article-content ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.article-content li { margin-bottom: 0.35rem; }
.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: var(--accent-light);
  border-radius: 0 6px 6px 0;
}
.article-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; }
.article-content th { background: #f7fafc; }
.article-content code { background: #edf2f7; padding: 0.15em 0.4em; border-radius: 3px; font-size: 0.9em; }
.article-content pre { background: #2d3748; color: #e2e8f0; padding: 1rem; border-radius: 6px; overflow-x: auto; margin: 1rem 0; }

/* ─── Study tree ─── */
.study-subject {
  margin-bottom: 1.5rem;
}

.study-subject h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.study-articles { list-style: none; }
.study-articles li { margin-bottom: 0.35rem; }
.study-articles a { font-size: 0.95rem; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .hero { padding: 2rem 0; }
  .hero h1 { font-size: 1.5rem; }
  .card-grid { grid-template-columns: 1fr; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.5rem; }
}

/* ─── Pagefind overrides ─── */
.pagefind-ui {
  margin-bottom: 1.5rem;
}
