*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600&family=Courier+Prime:wght@400;700&display=swap');

:root {
  --navy:    #1a2744;
  --navy2:   #243159;
  --navy3:   #0f1a30;
  --gold:    #c9a84c;
  --gold2:   #e8c97a;
  --gold3:   #f5e4b0;
  --cream:   #f5f1e8;
  --cream2:  #ede8dc;
  --cream3:  #e3ddd0;
  --text:    #1e1a14;
  --muted:   #6b6255;
  --border:  #d0c9b8;
  --white:   #fdfaf4;
  --success: #2d6a4f;
  --teal:    #2d9c94;
  --radius:  5px;
  --shadow:  0 2px 12px rgba(26,39,68,0.08);
  --shadow2: 0 4px 24px rgba(26,39,68,0.13);
}

/* ── Base ────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.65;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */
nav {
  background: var(--navy3);
  border-bottom: 2px solid var(--gold);
  padding: 0 2rem;
  display: flex;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.nav-brand {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.75rem 1.5rem 0.75rem 0;
  border-right: 1px solid rgba(255,255,255,0.08);
  margin-right: 1rem;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-brand-icon { font-size: 22px; color: var(--gold2); line-height: 1; }
.nav-brand-title { font-family: 'Playfair Display', serif; font-size: 18px; color: var(--gold2); letter-spacing: 0.06em; display: block; }
.nav-brand-sub   { font-size: 9.5px; color: rgba(255,255,255,0.35); letter-spacing: 0.1em; text-transform: uppercase; display: block; margin-top: 1px; }

.nav-links { display: flex; align-items: stretch; flex: 1; }
.nav-links a {
  color: rgba(255,255,255,0.6); text-decoration: none; font-size: 12.5px;
  font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0 1.2rem; display: flex; align-items: center;
  border-bottom: 2px solid transparent; transition: all 0.2s; margin-bottom: -2px;
}
.nav-links a:hover  { color: #fff; border-bottom-color: rgba(201,168,76,0.4); }
.nav-links a.active { color: var(--gold2); border-bottom-color: var(--gold); }

.nav-toggle { display: none; background: none; border: none; color: var(--gold2); font-size: 20px; cursor: pointer; padding: 0.5rem; margin-left: auto; }

.nav-mobile { display: none; background: var(--navy3); border-bottom: 2px solid var(--gold); flex-direction: column; }
.nav-mobile.open { display: flex; }
.nav-mobile a { color: rgba(255,255,255,0.7); text-decoration: none; padding: 1rem 2rem; font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.06); }
.nav-mobile a.active { color: var(--gold2); }

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

.page-header {
  background: linear-gradient(135deg, var(--navy3) 0%, var(--navy2) 100%);
  color: #fff;
  padding: 2.5rem 0 2rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--gold);
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 40px,
    rgba(201,168,76,0.025) 40px,
    rgba(201,168,76,0.025) 80px
  );
}
.page-header .container { position: relative; }
.page-header h1 {
  font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700;
  color: var(--gold2); line-height: 1.2; margin-bottom: 6px;
}
.page-header p  { font-size: 13px; color: rgba(255,255,255,0.5); }
.page-header a  { color: rgba(255,255,255,0.45); text-decoration: none; }
.page-header a:hover { color: var(--gold2); }

/* ── Hero (index) ─────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy3) 0%, var(--navy2) 60%, #1a3050 100%);
  padding: 4rem 0 3.5rem;
  border-bottom: 3px solid var(--gold);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent, transparent 50px,
    rgba(201,168,76,0.03) 50px,
    rgba(201,168,76,0.03) 100px
  );
}
.hero::after {
  content: 'AHPC';
  position: absolute; right: -20px; top: 50%; transform: translateY(-50%);
  font-family: 'Playfair Display', serif; font-size: 200px; font-weight: 700;
  color: rgba(255,255,255,0.03); line-height: 1; pointer-events: none;
  letter-spacing: -0.05em;
}
.hero .container { position: relative; }
.hero-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.75rem;
}
.hero-eyebrow::before, .hero-eyebrow::after {
  content: ''; flex: 1; height: 1px; background: rgba(201,168,76,0.3); max-width: 60px;
}
.hero h1 {
  font-family: 'Playfair Display', serif; font-size: 40px; font-weight: 700;
  color: #fff; line-height: 1.15; margin-bottom: 1rem; max-width: 700px;
}
.hero h1 em { color: var(--gold2); font-style: normal; }
.hero-sub {
  font-size: 15px; color: rgba(255,255,255,0.55); max-width: 560px; margin-bottom: 2rem; line-height: 1.7;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: 'Playfair Display', serif; font-size: 16px; color: var(--navy);
  margin-bottom: 1.1rem; padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--cream2);
  display: flex; align-items: center; gap: 0.6rem;
}
.card-title-icon { color: var(--gold); font-size: 14px; }

/* ── Stats ────────────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-top: 3px solid var(--gold); border-radius: var(--radius);
  padding: 1.25rem 1rem; text-align: center;
  box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow2); }
.stat-val   { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; color: var(--navy); display: block; }
.stat-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: var(--navy); color: rgba(255,255,255,0.75);
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 11px 14px; text-align: left;
  white-space: nowrap;
}
thead th:first-child { border-radius: 0; }
tbody tr { border-bottom: 1px solid var(--cream2); transition: background 0.1s; }
tbody tr:hover { background: #fffef7; }
tbody td { padding: 10px 14px; color: var(--text); vertical-align: middle; }
tbody td a { color: var(--navy); text-decoration: none; font-weight: 500; }
tbody td a:hover { color: var(--gold); }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 3px; letter-spacing: 0.03em;
}
.badge-navy  { background: #e6e9f3; color: var(--navy2); }
.badge-gold  { background: #f8edd6; color: #7a5c1e; }
.badge-green { background: #d4ecdf; color: var(--success); }
.badge-teal  { background: #d4edeb; color: #1a5c57; }
.badge-gray  { background: #e8e5e0; color: #4a4744; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-row { display: grid; gap: 1rem; margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 5px;
}
input[type=text], input[type=number], select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-family: 'Source Sans 3', sans-serif;
  font-size: 14px; background: var(--white); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,39,68,0.08);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  border: 1.5px solid transparent; letter-spacing: 0.02em; white-space: nowrap;
}
.btn-primary { background: var(--navy); color: var(--gold2); border-color: var(--navy); }
.btn-primary:hover { background: var(--navy3); border-color: var(--navy3); }
.btn-outline {
  background: transparent; color: var(--navy); border-color: var(--border);
}
.btn-outline:hover { background: var(--cream2); border-color: var(--cream3); }
.btn-gold { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; }
.btn-gold:hover { background: var(--gold2); }
.btn-sm { padding: 5px 13px; font-size: 11.5px; }

/* ── Results info ─────────────────────────────────────────────────────────── */
.results-info { font-size: 12px; color: var(--muted); margin-bottom: 0.75rem; font-style: italic; }
.no-results   { text-align: center; padding: 3.5rem; color: var(--muted); font-size: 14px; }

/* ── Bar charts ───────────────────────────────────────────────────────────── */
.bar-row    { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.bar-label  { width: 210px; flex-shrink: 0; color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.bar-track  { flex: 1; height: 22px; background: var(--cream2); border-radius: 3px; overflow: hidden; }
.bar-fill   { height: 100%; background: var(--navy); border-radius: 3px; transition: width 0.5s ease; }
.bar-fill-gold { background: linear-gradient(90deg, var(--gold) 0%, var(--gold2) 100%); }
.bar-fill-teal { background: var(--teal); }
.bar-count  { width: 38px; flex-shrink: 0; color: var(--navy); font-weight: 700; text-align: right; font-size: 12px; font-family: 'Courier Prime', monospace; }

/* ── Detail page ──────────────────────────────────────────────────────────── */
.detail-field { padding: 0.75rem 0; border-bottom: 1px solid var(--cream2); display: flex; flex-direction: column; gap: 3px; }
.detail-field:last-child { border-bottom: none; }
.detail-key { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.detail-val { font-size: 15px; color: var(--navy); font-weight: 500; }

/* ── Spinner / empty ──────────────────────────────────────────────────────── */
#spinner {
  display: none; text-align: center; padding: 2.5rem; color: var(--muted);
  font-size: 13px;
}
.spinner-dot::after {
  content: ''; display: inline-block; width: 32px; height: 32px;
  border: 3px solid var(--cream2); border-top-color: var(--navy);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  margin: 0 auto; display: block; margin-bottom: 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  background: var(--navy3);
  border-top: 2px solid var(--gold);
  margin-top: 4rem;
}
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 2rem;
  display: flex; align-items: flex-start; gap: 2rem; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.footer-icon  { font-size: 28px; color: var(--gold); }
.footer-title { font-family: 'Playfair Display', serif; font-size: 15px; color: var(--gold2); }
.footer-sub   { font-size: 10px; color: rgba(255,255,255,0.3); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.footer-info  { font-size: 11.5px; color: rgba(255,255,255,0.3); line-height: 1.8; flex: 1; }

/* ── Timeline strip (index) ───────────────────────────────────────────────── */
.timeline-strip {
  background: var(--navy2); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
  border: 1px solid rgba(201,168,76,0.2);
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.timeline-period {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 70px;
}
.timeline-period-label { font-size: 10px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.06em; }
.timeline-period-val   { font-family: 'Courier Prime', monospace; font-size: 14px; font-weight: 700; color: var(--gold2); }
.timeline-divider { height: 30px; width: 1px; background: rgba(201,168,76,0.2); }
.timeline-bar-wrap { flex: 1; min-width: 180px; }
.timeline-label-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.timeline-label-row span { font-size: 10px; color: rgba(255,255,255,0.35); }
.timeline-bar { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.timeline-fill { height: 100%; background: linear-gradient(90deg, var(--gold) 0%, var(--gold2) 100%); border-radius: 4px; }

/* ── Quick search (index) ─────────────────────────────────────────────────── */
.quick-search-wrap { position: relative; margin-bottom: 0; }
.quick-search-wrap input {
  padding-right: 50px; font-size: 15px; padding: 11px 50px 11px 14px;
  border: 1.5px solid var(--border);
}
.quick-search-btn {
  position: absolute; right: 0; top: 0; bottom: 0;
  padding: 0 14px; background: var(--navy); color: var(--gold2);
  border: none; cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 16px; transition: background 0.15s;
}
.quick-search-btn:hover { background: var(--navy3); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .hero h1   { font-size: 28px; }
}
@media (max-width: 640px) {
  .container  { padding: 0 1rem; }
  nav         { padding: 0 1rem; }
  .nav-links  { display: none; }
  .nav-toggle { display: block; }
  .stats-row  { grid-template-columns: repeat(2, 1fr); }
  .hero       { padding: 2.5rem 0 2rem; }
  .hero h1    { font-size: 24px; }
  .hero::after { display: none; }
  .form-row   { grid-template-columns: 1fr !important; }
  .footer-inner { flex-direction: column; gap: 1rem; }
  .bar-label  { width: 120px; }
}
