/* ==========================================================================
   Trade Triad — Atlas Design System
   ========================================================================== */

:root {
  --navy-950: #0b1726;
  --navy-900: #122238;
  --navy-800: #1b304b;
  --navy-700: #27425f;
  --ivory-100: #faf6ec;
  --ivory-200: #f3ead6;
  --ivory-300: #e9dcc0;
  --copper-500: #b5692f;
  --copper-600: #96531f;
  --copper-300: #d99a5e;
  --green-800: #1f3d33;
  --green-700: #2c5244;
  --green-300: #7fa893;
  --ink-900: #1a1d1f;
  --ink-600: #45494d;
  --ink-400: #6b7076;
  --line: rgba(27, 48, 75, 0.16);
  --shadow-soft: 0 12px 30px -16px rgba(11, 23, 38, 0.35);

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Source Sans 3', -apple-system, 'Segoe UI', Roboto, sans-serif;

  --shell-width: 1180px;
  --radius: 6px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ivory-100);
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--copper-600); text-decoration-color: rgba(181, 105, 47, 0.35); }
a:hover { text-decoration-color: currentColor; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--copper-500);
  outline-offset: 2px;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy-950); line-height: 1.18; margin: 0 0 0.5em; }
h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.4rem); font-weight: 600; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem); font-weight: 600; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--navy-950); color: var(--ivory-100);
  padding: 0.6em 1em; z-index: 200; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.shell { max-width: var(--shell-width); margin: 0 auto; padding: 0 24px; }

/* ---- Buttons & form controls ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em; font-family: var(--font-body);
  font-weight: 600; font-size: 0.95rem; padding: 0.65em 1.3em; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2;
}
.btn--primary { background: var(--navy-950); color: var(--ivory-100); }
.btn--primary:hover { background: var(--navy-800); }
.btn--outline { background: transparent; border-color: var(--navy-800); color: var(--navy-950); }
.btn--outline:hover { background: var(--navy-950); color: var(--ivory-100); }
.btn--ghost { background: transparent; color: var(--copper-600); padding: 0.4em 0.2em; }

input[type="text"], input[type="search"], input[type="email"], select, textarea {
  font-family: var(--font-body); font-size: 0.98rem; padding: 0.6em 0.8em;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink-900);
  width: 100%;
}
label { font-weight: 600; font-size: 0.88rem; display: block; margin-bottom: 0.35em; color: var(--navy-900); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  background: var(--navy-950); color: var(--ivory-100); position: relative; z-index: 100;
  border-bottom: 3px solid var(--copper-500);
}
.site-header__row { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.7em; text-decoration: none; color: inherit; }
.brand__mark { color: var(--copper-300); }
.brand__name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--ivory-100); display: block; }
.brand__tagline { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--copper-300); display: block; }
.brand--footer .brand__name { color: var(--navy-950); }

.primary-nav ul { list-style: none; display: flex; gap: 1.6em; margin: 0; padding: 0; }
.primary-nav a {
  color: var(--ivory-200); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  padding: 0.4em 0.1em; border-bottom: 2px solid transparent;
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] { border-bottom-color: var(--copper-500); color: #fff; }

.nav-toggle {
  display: none; background: none; border: 1px solid rgba(255,255,255,0.3); color: var(--ivory-100);
  border-radius: var(--radius); padding: 0.4em 0.6em;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--navy-950);
    border-bottom: 3px solid var(--copper-500); display: none;
  }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 0; padding: 0.5em 24px 1em; }
  .primary-nav a { display: block; padding: 0.6em 0; }
}

/* ==========================================================================
   Hero / Home
   ========================================================================== */
.hero {
  background: linear-gradient(160deg, var(--navy-950) 0%, var(--navy-800) 58%, var(--green-800) 100%);
  color: var(--ivory-100); padding: 72px 0 90px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0; opacity: 0.16; mix-blend-mode: screen;
  background-image: url('/assets/images/route-lines.svg'); background-size: cover; background-position: center;
  pointer-events: none;
}
.hero__inner { position: relative; max-width: 760px; }
.hero__eyebrow { color: var(--copper-300); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; font-size: 0.82rem; }
.hero h1 { color: #fff; margin-top: 0.3em; }
.hero p.lede { font-size: 1.15rem; color: var(--ivory-200); max-width: 60ch; }
.hero__actions { display: flex; gap: 1em; flex-wrap: wrap; margin-top: 1.6em; }

.section { padding: 64px 0; }
.section--tint { background: var(--ivory-200); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; flex-wrap: wrap; margin-bottom: 1.6em; }
.section__head p { color: var(--ink-600); max-width: 58ch; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 700; color: var(--copper-600); }

/* Era grid (home) */
.era-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
@media (max-width: 920px) { .era-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .era-grid { grid-template-columns: 1fr; } }
.era-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3em 1.2em;
  text-decoration: none; color: var(--ink-900); display: flex; flex-direction: column; gap: 0.5em;
  box-shadow: var(--shadow-soft); transition: transform 0.15s ease;
}
.era-card:hover { transform: translateY(-3px); }
.era-card__icon { color: var(--copper-500); }
.era-card h3 { margin: 0; font-size: 1.1rem; }
.era-card span.count { color: var(--ink-400); font-size: 0.85rem; }

/* ==========================================================================
   Cards: events & articles
   ========================================================================== */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
@media (max-width: 980px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow-soft);
}
.card__media { aspect-ratio: 16/10; background: var(--navy-800); overflow: hidden; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: 1.1em 1.2em 1.3em; display: flex; flex-direction: column; gap: 0.5em; flex: 1; }
.card__tags { display: flex; gap: 0.4em; flex-wrap: wrap; }
.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.25em 0.6em; border-radius: 99px; background: var(--ivory-300); color: var(--navy-900);
}
.tag--era { background: var(--navy-950); color: var(--ivory-100); }
.tag--region { background: var(--green-700); color: var(--ivory-100); }
.card h3 { font-size: 1.15rem; margin: 0; }
.card h3 a { color: var(--navy-950); text-decoration: none; }
.card h3 a:hover { color: var(--copper-600); }
.card .date { font-size: 0.85rem; color: var(--ink-400); font-weight: 600; }
.card p { color: var(--ink-600); font-size: 0.95rem; margin: 0; }
.card__footer { margin-top: auto; padding-top: 0.6em; }

/* ==========================================================================
   Timeline
   ========================================================================== */
.timeline-toolbar { display: flex; flex-wrap: wrap; gap: 1em; align-items: flex-end; margin-bottom: 1.5em; }
.toolbar-field { min-width: 180px; flex: 1 1 180px; }
.toolbar-field--search { flex: 2 1 260px; }
.view-toggle { display: inline-flex; border: 1px solid var(--navy-800); border-radius: var(--radius); overflow: hidden; }
.view-toggle button {
  background: #fff; border: none; padding: 0.6em 1em; font-weight: 600; cursor: pointer; color: var(--navy-900);
  border-right: 1px solid var(--line);
}
.view-toggle button:last-child { border-right: none; }
.view-toggle button[aria-pressed="true"] { background: var(--navy-950); color: #fff; }

.active-filters { display: flex; flex-wrap: wrap; gap: 0.5em; margin-bottom: 1.2em; align-items: center; }
.active-filters .chip {
  display: inline-flex; align-items: center; gap: 0.4em; background: var(--ivory-300); border-radius: 99px;
  padding: 0.3em 0.5em 0.3em 0.8em; font-size: 0.85rem; font-weight: 600; color: var(--navy-900);
}
.active-filters .chip button { border: none; background: none; cursor: pointer; color: var(--ink-600); font-size: 1rem; line-height: 1; }
.results-count { color: var(--ink-400); font-size: 0.9rem; margin-bottom: 1em; }

.timeline-rail { position: relative; padding-left: 2.2rem; }
.timeline-rail::before {
  content: ""; position: absolute; left: 0.55rem; top: 0; bottom: 0; width: 2px;
  background: repeating-linear-gradient(to bottom, var(--copper-500) 0, var(--copper-500) 6px, transparent 6px, transparent 12px);
}
.timeline-era-group { margin-bottom: 2.4rem; }
.timeline-era-group__label {
  font-family: var(--font-display); font-size: 1.3rem; color: var(--navy-950); margin-bottom: 1em;
  position: relative;
}
.timeline-item { position: relative; padding-bottom: 1.6rem; }
.timeline-item::before {
  content: ""; position: absolute; left: -2.2rem; top: 0.35rem; width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--navy-950); border: 2px solid var(--copper-500);
}
.timeline-item .date { font-weight: 700; color: var(--copper-600); font-size: 0.88rem; letter-spacing: 0.02em; }
.timeline-item h3 { margin: 0.15em 0 0.3em; font-size: 1.15rem; }
.timeline-item h3 a { text-decoration: none; color: var(--navy-950); }
.timeline-item p { color: var(--ink-600); font-size: 0.95rem; max-width: 70ch; }
.timeline-item .meta-line { font-size: 0.82rem; color: var(--ink-400); margin-top: 0.3em; }

[hidden] { display: none !important; }
.empty-state { text-align: center; padding: 3em 1em; color: var(--ink-400); }

/* ==========================================================================
   Detail pages (event / article)
   ========================================================================== */
.detail-hero { background: var(--navy-950); color: var(--ivory-100); padding: 46px 0; }
.detail-hero .eyebrow { color: var(--copper-300); }
.detail-hero h1 { color: #fff; }
.breadcrumb { font-size: 0.85rem; color: var(--ivory-300); margin-bottom: 1em; }
.breadcrumb a { color: var(--ivory-300); }
.breadcrumb ol { display: flex; list-style: none; padding: 0; margin: 0; gap: 0.4em; flex-wrap: wrap; }
.breadcrumb li:not(:last-child)::after { content: "›"; margin-left: 0.4em; color: var(--copper-300); }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2.5rem; padding: 48px 0; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-body { font-size: 1.05rem; color: var(--ink-900); }
.detail-body h2 { margin-top: 1.6em; }
.detail-body figure { margin: 1.6em 0; }
.detail-body figcaption { font-size: 0.85rem; color: var(--ink-400); margin-top: 0.5em; }
.fact-panel {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4em;
  align-self: start; box-shadow: var(--shadow-soft);
}
.fact-panel dt { font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--copper-600); margin-top: 1em; }
.fact-panel dt:first-child { margin-top: 0; }
.fact-panel dd { margin: 0.25em 0 0; color: var(--ink-900); }
.source-note { background: var(--ivory-200); border-left: 3px solid var(--copper-500); padding: 1em 1.2em; margin-top: 1.6em; font-size: 0.92rem; }

/* Article library */
.article-list-item { display: grid; grid-template-columns: 220px 1fr; gap: 1.4rem; padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
@media (max-width: 680px) { .article-list-item { grid-template-columns: 1fr; } }
.article-list-item img { border-radius: var(--radius); aspect-ratio: 4/3; object-fit: cover; width: 100%; }

/* Glossary */
.glossary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4em 2.4em; }
@media (max-width: 700px) { .glossary-grid { grid-template-columns: 1fr; } }
.glossary-term dt { font-family: var(--font-display); font-size: 1.1rem; color: var(--navy-950); }
.glossary-term dd { color: var(--ink-600); margin: 0.3em 0 0; }

/* Generic content pages */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 1.8em; }
.prose ul { color: var(--ink-700); }

/* 404 */
.error-page { text-align: center; padding: 100px 0; }

footer.site-footer { background: var(--ivory-200); border-top: 3px solid var(--navy-950); margin-top: 3rem; }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem; padding: 48px 0 24px; }
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
.footer__about p { color: var(--ink-600); font-size: 0.92rem; }
.footer__col h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--navy-900); font-family: var(--font-body); }
.footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5em; }
.footer__col a { color: var(--ink-600); text-decoration: none; font-size: 0.92rem; }
.footer__col a:hover { color: var(--copper-600); }
.footer__bottom { border-top: 1px solid var(--line); padding: 16px 0 28px; font-size: 0.82rem; color: var(--ink-400); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .era-card { transition: none; }
}
