/* =========================================================
   CSS Custom Properties — light theme
   ========================================================= */
:root {
  --color-bg:         #f8f9fb;
  --color-surface:    #ffffff;
  --color-border:     #e2e6ea;
  --color-text:       #1a1d23;
  --color-text-muted: #6b7280;
  --color-accent:     #3b82f6;
  --color-logo:       #111827;

  --radius:    10px;
  --shadow:    0 1px 3px rgba(0, 0, 0, 0.07), 0 4px 16px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", monospace;

  --header-h: 56px;
  --gap:      24px;
  --card-min: 380px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-logo);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--color-accent); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-accent); text-decoration: none; }

.breadcrumb .sep { opacity: 0.5; }

/* =========================================================
   Main
   ========================================================= */
.site-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 40px var(--gap) 60px;
}

/* Page title */
.page-title {
  margin-bottom: 32px;
}

.page-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--color-text);
}

.subtitle {
  margin-top: 6px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* =========================================================
   Charts Grid
   ========================================================= */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

/* =========================================================
   Chart Card
   ========================================================= */
.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.card-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.century-select {
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 3px 28px 3px 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  outline: none;
}
.century-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.card-description {
  padding: 10px 20px 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.chart-container {
  padding: 8px 4px 4px;
  /* Height is set by ApexCharts options; container stretches to fit */
}

/* Clickable chart bars */
#card-3 .apexcharts-bar-area {
  cursor: pointer;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  text-align: center;
  padding: 20px var(--gap);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 480px) {
  :root {
    --card-min: 280px;
    --gap: 16px;
  }

  .page-title h1 { font-size: 1.4rem; }
}
