/* ============================================================
   CHAIN — Homepage-specific overrides and supplemental styles
   ============================================================ */

/* ============================================================
   EXPLORE GOALS — "How do you want to explore?" section
   ============================================================ */

.explore-goals {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-14) 0;
}


[data-theme="dark"] .explore-goals {
  background: var(--ink-950, #080808);
}

.explore-goals__header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.explore-goals__eyebrow {
  font-size: var(--type-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent-dark);
  margin-bottom: var(--space-3);
}

.explore-goals__heading {
  font-family: var(--font-editorial);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

/* 2-col on tablet, 4-col on desktop */
.explore-goals__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: stretch;
}

@media (min-width: 640px) {
  .explore-goals__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
}

@media (min-width: 1100px) {
  .explore-goals__grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-5);
  }
}

/* ── Goal card ───────────────────────────────────────────── */
.goal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 32px 24px 26px;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  gap: 0;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 0.22s var(--ease-out),
    transform 0.22s var(--ease-out),
    border-color 0.22s var(--ease-out),
    background 0.22s var(--ease-out);
}

/* Accent top stripe */
.goal-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--amber-400) 0%, #c2410c 100%);
  opacity: 0;
  transition: opacity 0.22s var(--ease-out);
}

.goal-card:hover {
  box-shadow: 0 6px 28px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.04);
  transform: translateY(-4px);
  border-color: rgba(180,120,20,.28);
  background: #fefcf8;
}

.goal-card:hover::before { opacity: 1; }
.goal-card:active { transform: translateY(0) scale(0.985); }

[data-theme="dark"] .goal-card {
  background: var(--ink-800);
  border-color: var(--ink-700);
}
[data-theme="dark"] .goal-card:hover {
  background: #1e1a13;
  border-color: rgba(251,191,36,.3);
  box-shadow: 0 8px 36px rgba(0,0,0,.5);
}

/* ── "Just browsing" dark card ──────────────────────────── */
.goal-card--browse {
  background: #1a1410;
  border-color: rgba(255,255,255,.09);
}

.goal-card--browse::before {
  background: linear-gradient(90deg, #e8b84b 0%, rgba(232,184,75,.45) 100%);
}

.goal-card--browse:hover {
  background: #201c14;
  border-color: rgba(232,184,75,.3);
  box-shadow: 0 6px 32px rgba(0,0,0,.4);
}

.goal-card--browse .goal-card__label       { color: #c99a35; }
.goal-card--browse .goal-card__title       { color: #f0ebe0; }
.goal-card--browse .goal-card__desc        { color: rgba(235,220,190,.45); }
.goal-card--browse .goal-card__links       { border-top-color: rgba(255,255,255,.09); }
.goal-card--browse .goal-card__link        { color: #e8b84b; }
.goal-card--browse .goal-card__link--muted { color: rgba(255,255,255,.3); }

/* ── Icon wrapper — strict 44×44, cream-amber bg ────────── */
.goal-card__icon-wrap {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #fdf0dc;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  transition: background 0.2s;
}

.goal-card:hover .goal-card__icon-wrap {
  background: #fce8c8;
}

.goal-card__icon-wrap svg {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  max-width: 20px;
  max-height: 20px;
  display: block;
  stroke: #a05c0f;
  fill: none;
  transition: stroke 0.2s;
}

.goal-card:hover .goal-card__icon-wrap svg {
  stroke: #7c4410;
}

/* dark card icon overrides */
.goal-card--browse .goal-card__icon-wrap {
  background: rgba(232,184,75,.1);
}
.goal-card--browse:hover .goal-card__icon-wrap {
  background: rgba(232,184,75,.17);
}
.goal-card--browse .goal-card__icon-wrap svg {
  stroke: #c99a35;
}
.goal-card--browse:hover .goal-card__icon-wrap svg {
  stroke: #e8b84b;
}

/* ── Body ───────────────────────────────────────────────── */
.goal-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: center;
}

.goal-card__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  margin-bottom: 6px;
  text-align: center;
}

.goal-card__title {
  font-family: var(--font-editorial);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: 10px;
  text-align: center;
}

.goal-card__desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  flex: 1;
  text-align: center;
}

/* ── Footer — pinned to bottom across all cards ──────────── */
.goal-card__links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 18px;
  margin-top: 20px;
  width: 100%;
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.goal-card__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: gap 0.16s var(--ease-out);
}

.goal-card:hover .goal-card__link:first-child { gap: 8px; }

.goal-card__link--muted {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-align: center;
}

/* ============================================================
   ORIGINS SECTION — Before the Chain
   ============================================================ */

.origins-section {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.origins-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  flex-wrap: wrap;
  margin-bottom: var(--space-10);
}

.origins-header__text {
  flex: 1;
  min-width: 280px;
}

.origins-header__link {
  flex-shrink: 0;
  align-self: flex-end;
}

/* Civilization cards grid */
.civilizations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-10);
}

@media (min-width: 640px) {
  .civilizations-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .civilizations-grid { grid-template-columns: repeat(3, 1fr); }
}

.civ-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0;
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* Image thumbnail strip */
.civ-card__thumb {
  width: 100%;
  height: 200px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  background: var(--ink-800);
}
.civ-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform 0.4s var(--ease-out);
  filter: brightness(0.85) saturate(0.9);
  will-change: transform;
}
.civ-card:hover .civ-card__thumb img {
  transform: scale(1.05);
}
.civ-card__thumb-caption {
  position: absolute;
  bottom: 0; right: 0;
  padding: 3px 8px;
  background: rgba(0,0,0,.55);
  font-size: 9px;
  color: rgba(255,255,255,.55);
  border-radius: var(--radius-sm) 0 0 0;
}

/* Card inner row (era-marker + body) */
.civ-card__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  flex: 1;
  text-align: center;
}

.civ-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, var(--amber-400), var(--sienna-400));
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.civ-card:hover {
  box-shadow: 0 8px 40px rgba(0,0,0,.22), 0 2px 8px rgba(0,0,0,.14);
  transform: translateY(-4px);
  border-color: var(--amber-300);
}

.civ-card:hover::before {
  opacity: 1;
}

.civ-card__era-marker {
  display: none;
}

.civ-card__era-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber-400);
  border: 2px solid var(--amber-200);
  flex-shrink: 0;
}

.civ-card__era-line {
  width: 1px;
  flex: 1;
  background: linear-gradient(to bottom, var(--amber-200), transparent);
  min-height: 20px;
  margin-top: var(--space-2);
}

.civ-card__body {
  flex: 1;
  text-align: center;
}

.civ-card__header {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.civ-card__period {
  font-size: var(--type-xs);
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-wide);
  text-align: center;
}

.civ-card__region-badge {
  font-size: 10px;
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  padding: 3px var(--space-3);
  background: rgba(196, 146, 0, 0.12);
  color: var(--amber-600, #b45309);
  border: 1px solid rgba(196, 146, 0, 0.25);
  border-radius: var(--radius-pill);
}

[data-theme="dark"] .civ-card__region-badge {
  background: rgba(196, 146, 0, 0.15);
  color: var(--amber-300);
  border-color: rgba(196, 146, 0, 0.3);
}

.civ-card__name {
  font-family: var(--font-editorial);
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  line-height: 1.25;
  text-align: center;
}

.civ-card__summary {
  font-size: var(--type-sm);
  color: var(--color-text-secondary);
  line-height: 1.65;
  margin-bottom: var(--space-4);
  text-align: center;
}

.civ-card__facts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  text-align: left;  /* facts table stays left-aligned for readability */
}

.civ-card__fact {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--type-xs);
}

.civ-card__fact-label {
  font-weight: var(--weight-bold);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  flex-shrink: 0;
}

.civ-card__fact-value {
  color: var(--color-text-secondary);
}

.civ-card__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-size: var(--type-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-accent-dark);
  transition: gap var(--duration-fast);
  width: 100%;
}

.civ-card__link:hover { gap: var(--space-2); }

/* Origins bridge — the transition to the slave trade */
.origins-bridge {
  background: var(--ink-900);
  border-radius: var(--radius-xl);
  padding: clamp(var(--space-8), 5vw, var(--space-16));
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
}

@media (min-width: 900px) {
  .origins-bridge {
    grid-template-columns: 3fr 2fr;
    align-items: center;
  }
}

.origins-bridge__title {
  font-family: var(--font-editorial);
  font-size: var(--type-xl);
  font-weight: var(--weight-bold);
  color: #ffffff;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-5);
}

.origins-bridge__body {
  font-size: var(--type-md);
  color: var(--ink-300);
  line-height: var(--leading-loose);
  margin-bottom: var(--space-5);
}

.origins-bridge__body:last-of-type { margin-bottom: var(--space-8); }

.origins-bridge__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--ink-800);
  border-bottom: 1px solid var(--ink-800);
}

@media (max-width: 640px) {
  .origins-bridge__stats { grid-template-columns: 1fr; }
}

.origins-bridge__stat {}

.origins-bridge__stat-number {
  display: block;
  font-family: var(--font-editorial);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: var(--weight-bold);
  color: var(--amber-300);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.origins-bridge__stat-label {
  display: block;
  font-size: var(--type-xs);
  color: var(--ink-500);
  line-height: 1.6;
}

.origins-bridge__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Override btn--ghost inside dark background */
.origins-bridge .btn--ghost {
  color: var(--ink-300);
  border-color: var(--ink-700);
}
.origins-bridge .btn--ghost:hover {
  color: var(--amber-300);
  border-color: var(--amber-400);
  background: rgba(224, 122, 0, .06);
}

/* Origins bridge quote */
.origins-bridge__quote {
  display: flex;
  align-items: center;
}

.origins-bridge__blockquote {
  border-left: 3px solid var(--sienna-500);
  padding-left: var(--space-6);
}

.origins-bridge__blockquote p {
  font-family: var(--font-editorial);
  font-size: 1.125rem;
  color: var(--ink-200);
  line-height: 1.75;
  font-style: italic;
  margin-bottom: var(--space-4);
}

.origins-bridge__blockquote cite {
  font-size: var(--type-xs);
  color: var(--ink-600);
  font-style: normal;
  letter-spacing: var(--tracking-wide);
}

/* ── Civ-card hover peek overlay ─────────────────────────── */
.civ-card__peek {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(8,4,0,.98) 0%,
    rgba(8,4,0,.95) 55%,
    rgba(8,4,0,.85) 80%,
    rgba(8,4,0,.6) 100%
  );
  padding: var(--space-6) var(--space-6) var(--space-7);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-3);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s cubic-bezier(0.22,1,0.36,1), transform 0.28s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
  z-index: 5;
}
.civ-card:hover .civ-card__peek {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.civ-peek__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}
.civ-peek__region {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--amber-300, #fcd34d);
  background: rgba(196,146,0,.18);
  border: 1px solid rgba(196,146,0,.3);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.civ-peek__period {
  font-size: 10px;
  color: rgba(255,255,255,.45);
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.civ-peek__name {
  font-family: var(--font-editorial);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}
.civ-peek__summary {
  font-size: 0.775rem;
  color: rgba(255,255,255,.6);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.civ-peek__facts {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: rgba(255,255,255,.06);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,.08);
}
.civ-peek__fact {
  display: flex;
  gap: var(--space-2);
  font-size: 0.72rem;
  align-items: baseline;
}
.civ-peek__fact-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,.35);
  flex-shrink: 0;
  font-size: 0.65rem;
}
.civ-peek__fact-value {
  color: rgba(255,255,255,.7);
}
.civ-peek__cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--amber-300, #fcd34d);
  text-decoration: none;
  margin-top: var(--space-1);
  transition: gap 0.15s;
}
.civ-card:hover .civ-peek__cta { gap: 9px; }
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .civ-card__peek { transition: opacity 0.15s; transform: none; }
}

/* Dark mode refinements */
[data-theme="dark"] .civ-card {
  background: var(--ink-800);
  border-color: var(--ink-700);
}

[data-theme="dark"] .civ-card:hover {
  border-color: var(--amber-400);
}

[data-theme="dark"] .civ-card__facts {
  background: var(--ink-900);
}

[data-theme="dark"] .origins-bridge {
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
}

/* Screenreader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Thread feature header spacing */
.thread-feature__header {
  margin-bottom: var(--space-10);
}

/* Then/Now issue wrapper */
.then-now-issue {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
}

/* Smooth tab transition */
[role="tabpanel"] {
  animation: fade-up 0.35s var(--ease-out) both;
}

/* Object date text */
.object-date {
  font-size: var(--type-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}

/* Utility: flex between */
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Section divider */
.section-divider {
  height: 1px;
  background: var(--color-border);
  margin: 0;
}

/* Editorial card full height inside grid cell */
.editorial-grid > article,
.editorial-grid > a {
  height: 100%;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}

.editorial-grid > a:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

/* Ensure consistent thread feature background on light mode */
[data-theme="light"] .thread-feature {
  background: #111111;
}

/* Hover accent on question cards (light mode) */
[data-theme="light"] .question-card:hover {
  background: var(--amber-50);
}

/* Audience grid in dark section */
.learning-section .audience-card:hover {
  background: rgba(255,255,255,.06);
}

/* Source shelf scroll on mobile */
@media (max-width: 640px) {
  .sources-shelf {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: var(--space-4);
    padding-bottom: var(--space-4);
    -webkit-overflow-scrolling: touch;
  }
  .source-card {
    min-width: 240px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }
}

/* Responsive thread scroller */
@media (max-width: 900px) {
  .thread-panel {
    display: none;
  }
}

/* Thread step active state border */
.thread-step.is-active {
  border-left: none;
}

.thread-step.is-active .thread-step__body {
  padding-left: var(--space-3);
  border-left: 2px solid var(--sienna-500);
  margin-left: -2px;
}

/* Animated counter number */
@keyframes count-in {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.thread-panel__counter {
  animation: count-in 0.2s var(--ease-out);
}

/* Footer newsletter input (for potential enhancement) */
.footer-newsletter {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.footer-newsletter__input {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  background: var(--ink-800);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius-md);
  color: var(--ink-200);
  font-size: var(--type-sm);
  outline: none;
  transition: border-color var(--duration-fast);
}

.footer-newsletter__input:focus {
  border-color: var(--amber-400);
}

.footer-newsletter__btn {
  padding: var(--space-2) var(--space-4);
  background: var(--amber-400);
  color: var(--ink-900);
  border-radius: var(--radius-md);
  font-size: var(--type-xs);
  font-weight: var(--weight-bold);
  transition: background var(--duration-fast);
}

.footer-newsletter__btn:hover {
  background: var(--amber-300);
}

/* Progress indicator on hero section */
.hero-scroll-hint {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-600);
  font-size: var(--type-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  animation: bounce-hint 2s infinite;
}

@keyframes bounce-hint {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
  50%       { transform: translateX(-50%) translateY(4px); opacity: 1; }
}

.hero-scroll-hint__arrow {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

/* Dot connector between then/now columns on wide screens */
@media (min-width: 768px) {
  .then-now-split {
    position: relative;
  }

  .then-now-split::after {
    content: '→';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: var(--type-md);
    color: var(--color-accent-dark);
    z-index: 2;
  }
}

/* Dark mode specific overrides for then-now section */
[data-theme="dark"] .then-now-section {
  background: var(--ink-800);
}

[data-theme="dark"] .then-now-issue {
  background: var(--ink-800);
  border-color: var(--ink-700);
}

[data-theme="dark"] .then-card {
  background: var(--ink-900);
  border-color: var(--ink-700);
}

/* Highlight current nav item */
.site-nav__link[aria-current="page"] {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Linked thread nodes in hero chain ──────────────────── */
.thread-node--link {
  display: flex;
  align-items: flex-start;
  gap: 0;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  transition: background 0.15s ease;
  margin: 0 -8px;
  padding: 4px 8px;
}
.thread-node--link:hover {
  background: rgba(255,255,255,0.05);
}
.thread-node--link:hover .thread-node__year {
  color: var(--amber-400, #fbbf24);
}
.thread-node__cta {
  display: none;
  font-size: 0.7rem;
  color: var(--amber-400, #fbbf24);
  margin-top: 2px;
  letter-spacing: 0.03em;
}
.thread-node--link:hover .thread-node__cta {
  display: block;
}

/* ============================================================
   CONTEXT RIBBON — Global metadata bar
   ============================================================ */
.context-ribbon {
  background: var(--slate-800);
  border-bottom: 1px solid var(--slate-700);
  position: sticky;
  top: 100px; /* nav-total height */
  z-index: 90;
  font-size: var(--type-xs);
}

.context-ribbon__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 36px;
}

.context-ribbon__stats {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: nowrap;
  overflow: hidden;
}

.context-ribbon__stat {
  color: var(--slate-300);
  font-size: 11px;
  white-space: nowrap;
}

.context-ribbon__stat strong {
  color: var(--amber-300);
  font-weight: 600;
}

.context-ribbon__divider {
  color: var(--slate-600);
  flex-shrink: 0;
}

.context-ribbon__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

.context-ribbon__link {
  color: var(--slate-300);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--duration-fast);
  white-space: nowrap;
}

.context-ribbon__link:hover { color: #fff; }

.context-ribbon__link--live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--amber-300);
}

.context-ribbon__live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--amber-400);
  animation: ribbon-pulse 2s ease-in-out infinite;
}

@keyframes ribbon-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* Thread-page variant: orientation tracker */
.context-ribbon--thread .context-ribbon__stats {
  gap: var(--space-4);
}

.context-ribbon__era-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 6px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid;
  white-space: nowrap;
}

.context-ribbon__progress-track {
  display: flex;
  align-items: center;
  gap: 3px;
}

.context-ribbon__progress-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--slate-600);
  transition: background 0.2s;
}

.context-ribbon__progress-dot--done  { background: var(--slate-500); }
.context-ribbon__progress-dot--active { background: var(--amber-400); transform: scale(1.4); }

[data-theme="light"] .context-ribbon {
  background: var(--slate-800);
  border-color: var(--slate-700);
}

/* ============================================================
   HERO ARTIFACT — Era distribution chart
   ============================================================ */
.hero__artifact {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.artifact__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.artifact__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber-300);
}

.artifact__meta {
  font-size: 10px;
  color: var(--slate-400);
}

.artifact__chart {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.artifact__row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 24px;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
  cursor: pointer;
}

.artifact__row:hover { background: rgba(255,255,255,0.06); }
.artifact__row--largest .artifact__bar { opacity: 1 !important; }

.artifact__era-num {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate-400);
  white-space: nowrap;
}

.artifact__era-name {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artifact__bar-track {
  height: 12px;
  background: rgba(255,255,255,0.09);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.artifact__bar {
  display: block;
  height: 100%;
  width: var(--pct);
  min-width: 6px;
  background: var(--era-color, var(--amber-500));
  border-radius: 6px;
  opacity: 1;
  filter: saturate(1.4) brightness(1.15);
  transition: filter 0.2s;
  box-shadow: 0 0 8px color-mix(in srgb, var(--era-color) 60%, transparent);
}

.artifact__row:hover .artifact__bar {
  filter: saturate(1.6) brightness(1.3);
}

.artifact__count {
  font-size: 10px;
  font-weight: 700;
  color: var(--slate-400);
  text-align: right;
}

.artifact__footer {
  display: flex;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.artifact__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.artifact__stat-n {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber-300);
}

.artifact__stat-l {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-400);
}

.artifact__cta {
  font-size: 11px;
  font-weight: 600;
  color: var(--amber-300);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  transition: gap 0.15s;
  padding-top: var(--space-2);
}

.artifact__cta:hover { gap: var(--space-3); }

/* ============================================================
   HERO SEARCH — Command-K style
   ============================================================ */
.hero__search-form--cmd .hero__search-row {
  position: relative;
}

.hero__search-kbd {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--ink-400);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
}

.hero__search-form--cmd .hero__search-input {
  padding-left: 3.5rem;
}

/* ── Hero eyebrow dot ── */
.hero__eyebrow-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber-400);
  margin-right: var(--space-2);
  animation: ribbon-pulse 2s ease-in-out infinite;
  vertical-align: middle;
}

/* ============================================================
   AUDIT FIXES — Motion, Animation, Hover Consistency
   ============================================================ */

/* ---- Reduced-motion guards for transforms/animations ------- */
@media (prefers-reduced-motion: reduce) {
  /* Civilization card image zoom — disable scale on hover */
  .civ-card__thumb img {
    transition: none !important;
    will-change: auto !important;
  }
  .civ-card:hover .civ-card__thumb img {
    transform: none !important;
  }

  /* Civilization card hover lift */
  .civ-card:hover {
    transform: none !important;
  }

  /* Hero question pills — disable float */
  .hero__q-pill:hover {
    transform: none !important;
  }

  /* Hero journey button — disable slide */
  .hero__journey-btn:hover {
    transform: none !important;
  }

  /* Explore card background scale */
  .explore-card:hover .explore-card__bg {
    transform: none !important;
  }

  /* Object card image bg scale */
  .object-card:hover .object-card__image-bg {
    transform: none !important;
  }

  /* Hero scroll hint bounce */
  .hero-scroll-hint {
    animation: none !important;
  }

  /* Hero eyebrow dot pulse */
  .hero__eyebrow-dot {
    animation: none !important;
  }

  /* Context ribbon live dot */
  .context-ribbon__live-dot {
    animation: none !important;
  }

  /* Tab panel fade-up */
  [role="tabpanel"] {
    animation: none !important;
  }

  /* Thread panel counter pop */
  .thread-panel__counter {
    animation: none !important;
  }
}

/* ---- Ensure will-change is released after hover ends ------- */
.civ-card:not(:hover) .civ-card__thumb img {
  will-change: auto;
}

/* ---- Consistent hover lift on editorial grid links --------- */
.editorial-grid > a:hover .editorial-card {
  transform: none; /* let the <a> wrapper handle the lift */
}

/* ---- Origins bridge dark mode: ensure text contrast -------- */
[data-theme="dark"] .origins-bridge__body {
  color: var(--ink-300);
}

/* ============================================================
   POLISH — Homepage visual refinements
   ============================================================ */

/* ── Artifact bar chart: animate on load ─────────────────── */
@keyframes bar-grow {
  from { width: 0; }
  to   { width: var(--pct); }
}

@media (prefers-reduced-motion: no-preference) {
  .artifact__bar {
    animation: bar-grow 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  /* Stagger each bar */
  .artifact__row:nth-child(1) .artifact__bar { animation-delay: 0.30s; }
  .artifact__row:nth-child(2) .artifact__bar { animation-delay: 0.38s; }
  .artifact__row:nth-child(3) .artifact__bar { animation-delay: 0.46s; }
  .artifact__row:nth-child(4) .artifact__bar { animation-delay: 0.54s; }
  .artifact__row:nth-child(5) .artifact__bar { animation-delay: 0.62s; }
  .artifact__row:nth-child(6) .artifact__bar { animation-delay: 0.70s; }
  .artifact__row:nth-child(7) .artifact__bar { animation-delay: 0.78s; }
  .artifact__row:nth-child(8) .artifact__bar { animation-delay: 0.86s; }
  .artifact__row:nth-child(9) .artifact__bar { animation-delay: 0.94s; }
}

/* ── Artifact row: glow the count on hover ───────────────── */
.artifact__row:hover .artifact__count {
  color: var(--amber-300);
}
.artifact__row:hover .artifact__era-name {
  color: rgba(255,255,255,0.95);
}

/* ── Hero content: staggered entrance ───────────────────── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .animate-fade-up {
    opacity: 0;
    animation: fade-in-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
  .animate-delay-100 { animation-delay: 0.10s; }
  .animate-delay-200 { animation-delay: 0.20s; }
  .animate-delay-250 { animation-delay: 0.25s; }
  .animate-delay-300 { animation-delay: 0.30s; }
  .animate-delay-400 { animation-delay: 0.40s; }
}

/* ── Hero search: focus glow ─────────────────────────────── */
.hero__search-input:focus {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25), 0 4px 24px rgba(0,0,0,0.3);
}

/* ── Hero journey button: magnetic hover ─────────────────── */
.hero__journey-btn {
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.15s ease;
}
.hero__journey-btn:hover {
  transform: translateY(-2px) scale(1.012);
  box-shadow: 0 8px 32px rgba(196, 120, 0, 0.35);
}

/* ── Hero Q-pill: float on hover ─────────────────────────── */
.hero__q-pill {
  transition: transform 0.18s ease, background 0.15s ease, border-color 0.15s ease;
}
.hero__q-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.12);
}

/* ── Thread step: step number ring pulse ─────────────────── */
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 120, 0, 0); }
  50%       { box-shadow: 0 0 0 5px rgba(196, 120, 0, 0.18); }
}

.thread-step.is-active .thread-step__number {
  animation: step-pulse 2.5s ease-in-out infinite;
}

/* ── Thread step: smooth expand/collapse ─────────────────── */
.thread-step__text,
.thread-step__links {
  transition: opacity 0.3s ease;
}
.thread-step:not(.is-active) .thread-step__text,
.thread-step:not(.is-active) .thread-step__links {
  opacity: 0.65;
}
.thread-step.is-active .thread-step__text,
.thread-step.is-active .thread-step__links {
  opacity: 1;
}

/* ── Question grid card: refined hover ───────────────────── */
.question-card {
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.18s ease;
}
.question-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border-color: var(--color-accent-dark);
}
.question-card:hover .question-card__q {
  color: var(--color-text-primary);
}
[data-theme="dark"] .question-card:hover {
  border-color: var(--amber-500);
  background: rgba(245, 158, 11, 0.06);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

/* Question card icon pulse on hover */
.question-card__icon {
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-block;
}
.question-card:hover .question-card__icon {
  transform: scale(1.2);
}

/* ── Explore cards: elevated hover with glow ─────────────── */
.explore-card {
  transition:
    transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.explore-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.explore-card__bg {
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.explore-card:hover .explore-card__bg {
  transform: scale(1.06);
}

/* ── Object cards: image zoom + lift ─────────────────────── */
.object-card {
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease,
    border-color 0.18s ease;
}
.object-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
  border-color: var(--color-accent-dark);
}
.object-card__image-bg {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.object-card:hover .object-card__image-bg {
  transform: scale(1.05);
}
[data-theme="dark"] .object-card:hover {
  border-color: var(--amber-500);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

/* ── Source cards: gentle lift ───────────────────────────── */
.source-card {
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease,
    border-color 0.18s ease;
}
.source-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.1);
  border-color: var(--color-accent-dark);
}
[data-theme="dark"] .source-card:hover {
  border-color: var(--amber-500);
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

/* ── Audience cards: left border accent on hover ─────────── */
.audience-card {
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.audience-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--amber-400), var(--sienna-400));
  border-radius: 2px 0 0 2px;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.audience-card:hover::before {
  transform: scaleY(1);
}
.audience-card:hover .audience-card__number {
  color: var(--amber-300);
}

/* ── Editorial card: image overlay on hover ──────────────── */
.editorial-card--featured .editorial-card__image {
  overflow: hidden;
}
.editorial-card--featured .editorial-card__image > div {
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.editorial-grid > a:hover .editorial-card--featured .editorial-card__image > div {
  transform: scale(1.02);
}

/* ── Thread tag chips: subtle hover ──────────────────────── */
.thread-tag,
.thread-step__tag {
  transition: background 0.15s ease, color 0.15s ease;
}
.thread-step__tag:hover {
  background: rgba(245, 158, 11, 0.2);
  color: var(--amber-300);
}

/* ── Origins bridge stats: count-up flash ────────────────── */
@keyframes stat-flash {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.origins-bridge__stat.is-visible .origins-bridge__stat-number {
  animation: stat-flash 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Section eyebrow: shimmer line ───────────────────────── */
.section-eyebrow {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.section-eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 2px;
  background: currentColor;
  opacity: 0.6;
  flex-shrink: 0;
  border-radius: 1px;
}

/* ── Then/Now section: chain connector dot glow ──────────── */
@keyframes connector-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 120, 0, 0); transform: translate(-50%, -50%); }
  50%       { box-shadow: 0 0 0 8px rgba(196, 120, 0, 0.12); transform: translate(-50%, -50%); }
}

@media (min-width: 768px) and (prefers-reduced-motion: no-preference) {
  .then-now-split::after {
    animation: connector-pulse 3s ease-in-out infinite;
  }
}

/* ── PPP tabs: underline slide ───────────────────────────── */
.ppp-tabs {
  position: relative;
}
.ppp-tab {
  position: relative;
  transition: color 0.18s ease;
}
.ppp-tab::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--amber-400), var(--sienna-400));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.ppp-tab.is-active::after {
  transform: scaleX(1);
}

/* ── Reduced motion: kill all above animations ───────────── */
@media (prefers-reduced-motion: reduce) {
  .artifact__bar { animation: none !important; }
  .animate-fade-up { opacity: 1 !important; animation: none !important; }
  .thread-step.is-active .thread-step__number { animation: none !important; }
  .hero__journey-btn:hover { transform: none !important; }
  .hero__q-pill:hover { transform: none !important; }
  .question-card:hover { transform: none !important; }
  .explore-card:hover { transform: none !important; }
  .explore-card__bg { transition: none !important; }
  .object-card:hover { transform: none !important; }
  .object-card__image-bg { transition: none !important; }
  .source-card:hover { transform: none !important; }
  .audience-card::before { transition: none !important; }
  .editorial-card--featured .editorial-card__image > div { transition: none !important; }
  .ppp-tab::after { transition: none !important; }
  .then-now-split::after { animation: none !important; }
}
