/* ── Design tokens ─────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg-deep: #0a0e14;
  --bg-surface: #121820;
  --bg-elevated: #1a2230;
  --bg-glass: rgba(18, 24, 32, 0.72);

  --text-primary: #ede8df;
  --text-secondary: #a8a29a;
  --text-muted: #6b7280;

  --accent-emerald: #2d8a62;
  --accent-emerald-bright: #3cb87d;
  --accent-gold: #c9a84c;
  --accent-gold-soft: #d4b86a;
  --accent-copper: #b8734a;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(45, 138, 98, 0.35);

  --nav-hover-bg: rgba(255, 255, 255, 0.06);
  --footer-bg: rgba(10, 14, 20, 0.6);
  --logo-mark-border: rgba(255, 255, 255, 0.15);
  --noise-opacity: 0.035;
  --motto-block-bg: linear-gradient(135deg, rgba(45, 138, 98, 0.12) 0%, rgba(201, 168, 76, 0.08) 100%);
  --bg-atmosphere:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(45, 138, 98, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(201, 168, 76, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(26, 34, 48, 0.9) 0%, var(--bg-deep) 70%),
    var(--bg-deep);

  --font-display: 'Cormorant Garamond', 'Palatino Linotype', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 60px rgba(45, 138, 98, 0.12);

  --nav-height: 72px;
  --site-nav-track-width: 37rem;
  --max-width: 1120px;
  --content-width: 720px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

  --county-ni: #7eb8ff;
  --county-roi: #3cb87d;
}

[data-theme="light"] {
  color-scheme: light;
  --bg-deep: #f4f0e8;
  --bg-surface: #ebe6dc;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(244, 240, 232, 0.88);

  --text-primary: #1a2230;
  --text-secondary: #4a5568;
  --text-muted: #718096;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(45, 138, 98, 0.3);

  --nav-hover-bg: rgba(0, 0, 0, 0.05);
  --footer-bg: rgba(235, 230, 220, 0.9);
  --logo-mark-border: rgba(255, 255, 255, 0.35);
  --noise-opacity: 0.025;
  --motto-block-bg: linear-gradient(135deg, rgba(45, 138, 98, 0.1) 0%, rgba(201, 168, 76, 0.12) 100%);
  --bg-atmosphere:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(45, 138, 98, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(201, 168, 76, 0.14) 0%, transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(235, 230, 220, 0.95) 0%, var(--bg-deep) 70%),
    var(--bg-deep);

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 60px rgba(45, 138, 98, 0.1);

  --county-ni: #2563eb;
  --county-roi: #15803d;
}

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-anchor: none;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

/* Atmospheric background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg-atmosphere);
  transition: background var(--transition);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-emerald-bright);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-gold-soft);
}

/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--accent-emerald);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

/* ── Header & navigation ───────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition), border-color var(--transition);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}

.logo-home-link {
  display: flex;
  align-items: center;
  color: var(--text-primary);
  text-decoration: none;
  min-width: 0;
}

.logo-home-link:hover {
  color: var(--text-primary);
}

.site-logo:hover {
  color: var(--text-primary);
}

.site-logo a.site-logo,
a.site-logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

a.site-logo:hover {
  color: var(--text-primary);
}

.logo-mark {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-emerald) 0%, #1a5c42 100%);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 12px rgba(45, 138, 98, 0.4);
  border: 2px solid var(--logo-mark-border);
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* Future emblem logos (thistle / shamrock): keep identical box to text R mark */
.logo-mark.logo-mark--emblem,
.logo-mark .logo-emblem {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 0;
  border-radius: 50%;
}

a.hce-cross-site-link {
  text-decoration-color: rgba(201, 168, 76, 0.35);
  text-underline-offset: 0.12em;
}

a.hce-cross-site-link:hover {
  text-decoration-color: var(--accent-gold-soft);
}

a.site-logo .logo-mark {
  pointer-events: auto;
}

.logo-mark:focus-visible {
  outline: 2px solid var(--accent-gold-soft);
  outline-offset: 2px;
}

.logo-mark.logo-mark--cross-site:hover {
  box-shadow: 0 2px 16px rgba(201, 168, 76, 0.45);
  border-color: var(--accent-gold-soft);
}

.header-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.logo-subtitle {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  font-weight: 500;
}

.site-nav > ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.25rem;
}

@media (min-width: 769px) {
  .site-nav {
    flex-shrink: 0;
  }

  .site-nav > ul {
    width: var(--site-nav-track-width);
    justify-content: space-between;
    gap: 0;
    flex-wrap: nowrap;
  }

  .site-nav > ul > li {
    flex-shrink: 0;
  }
}

.site-nav a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
}

.site-nav a[aria-current="page"] {
  color: var(--accent-emerald-bright);
}

.site-nav > ul > li {
  position: relative;
}

.nav-province-row {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.nav-province-row > a {
  flex: 1;
}

.nav-dropdown-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle:focus-visible {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
}

.nav-dropdown-toggle svg {
  width: 1rem;
  height: 1rem;
  transition: transform var(--transition);
}

.nav-item--has-dropdown.is-open .nav-dropdown-toggle svg {
  transform: rotate(180deg);
}

.nav-dropdown {
  list-style: none;
  margin: 0;
  padding: 0.375rem 0;
  display: block;
  min-width: 11.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card, 0 8px 24px rgba(0, 0, 0, 0.18));
}

.nav-dropdown li {
  margin: 0;
}

.nav-dropdown a {
  display: block;
  padding: 0.4375rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 0;
  white-space: nowrap;
}

.nav-dropdown a:hover,
.nav-dropdown a:focus-visible {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
}

.nav-dropdown a[aria-current="page"] {
  color: var(--accent-emerald-bright);
  background: var(--nav-hover-bg);
}

.nav-dropdown a.nav-county-link--ni {
  color: var(--county-ni);
}

.nav-dropdown a.nav-county-link--roi {
  color: var(--county-roi);
}

.nav-dropdown a.nav-county-link--ni:hover,
.nav-dropdown a.nav-county-link--ni:focus-visible,
.nav-dropdown a.nav-county-link--roi:hover,
.nav-dropdown a.nav-county-link--roi:focus-visible {
  color: var(--text-primary);
}

.nav-dropdown a.nav-county-link--inactive {
  color: var(--text-muted);
  opacity: 0.65;
}

.nav-dropdown a.nav-county-link--inactive:hover,
.nav-dropdown a.nav-county-link--inactive:focus-visible {
  color: var(--text-secondary);
  opacity: 0.85;
  background: var(--nav-hover-bg);
}

.nav-countries-label {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-dropdown .nav-dropdown-inactive-item {
  display: block;
  padding: 0.4375rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.65;
  white-space: nowrap;
  cursor: default;
}

.nav-dropdown-footer {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-subtle);
}

.nav-dropdown-footer a {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-gold);
}

.nav-dropdown-footer a:hover,
.nav-dropdown-footer a:focus-visible {
  color: var(--accent-gold-soft);
}

@media (min-width: 769px) {
  .nav-item--has-dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 1rem;
  }

  .nav-item--has-dropdown .nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.25rem);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  }

  .nav-item--has-dropdown:hover .nav-dropdown,
  .nav-item--has-dropdown:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0.5rem);
    pointer-events: auto;
  }
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--accent-gold);
  cursor: pointer;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.theme-toggle:hover {
  color: var(--accent-gold-soft);
  background: var(--nav-hover-bg);
}

.theme-icon {
  width: 22px;
  height: 22px;
}

.theme-icon-moon {
  display: none;
}

[data-theme="light"] .theme-icon-sun {
  display: none;
}

[data-theme="light"] .theme-icon-moon {
  display: block;
}

/* Header catalogue search */
.header-search-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.header-search-link:hover,
.header-search-link:focus-visible,
.header-search-link.is-current {
  color: var(--accent-gold);
  background: var(--nav-hover-bg);
  border-color: var(--border-accent);
}

.header-search-link svg {
  width: 20px;
  height: 20px;
}

/* ── Main layout ───────────────────────────────────────────── */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ── Hero (homepage) ───────────────────────────────────────── */
.hero {
  position: relative;
  padding: 4rem 0 3.5rem;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-gold);
  margin-bottom: 1.25rem;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: '';
  width: 2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold));
}

.hero-eyebrow::after {
  background: linear-gradient(90deg, var(--accent-gold), transparent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 600;
  line-height: 1.1;
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-gold-soft) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  max-width: 540px;
  margin: 0 auto 2rem;
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.hero-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--accent-emerald-bright);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* ── Page header (inner pages) ─────────────────────────────── */
.page-header {
  padding: 3rem 0 2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  margin: 0 0 0.75rem;
  line-height: 1.15;
  color: var(--text-primary);
}

.page-subtitle {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-style: italic;
  color: var(--accent-gold-soft);
  margin: 0;
}

.page-meta {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-style: italic;
  max-width: var(--content-width);
}

/* ── Content sections ────────────────────────────────────────── */
.content-section {
  max-width: var(--content-width);
  margin: 0 auto 2.5rem;
}

.content-section p {
  margin: 0 0 1.5rem;
  color: var(--text-primary);
  text-align: left;
}

.content-section p:last-child {
  margin-bottom: 0;
}

.lead {
  font-size: 1.1875rem;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-emerald);
  padding-left: 1.25rem;
  margin-bottom: 2rem !important;
}

.content-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
}

.content-section h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  line-height: 1.2;
}

.content-section h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-gold-soft);
  margin: 2rem 0 0.75rem;
}

.content-quote {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent-gold);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.content-quote p {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
}

.content-quote p:last-child {
  margin-bottom: 0;
}

.content-quote ul {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  color: var(--text-secondary);
}

.content-quote-source {
  font-style: normal;
  font-weight: 500;
  color: var(--text-muted);
}

.highlight-box {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, rgba(45, 138, 98, 0.14) 0%, rgba(201, 168, 76, 0.1) 100%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
}

.highlight-box p {
  margin: 0;
  color: var(--text-primary);
}

.download-offer {
  max-width: var(--content-width);
  margin: 0 auto 2.5rem;
  padding: 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: center;
}

.download-offer p {
  margin: 0 0 1.25rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.download-offer-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--bg-base);
  background: var(--accent-emerald);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition), transform var(--transition);
}

.download-offer-btn:hover {
  background: var(--accent-emerald-bright);
}

.references-list {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

.references-list li {
  margin-bottom: 0.75rem;
}

.back-link {
  max-width: var(--content-width);
  margin: 2rem auto 0;
  font-size: 0.9375rem;
}

.back-link a {
  color: var(--accent-emerald-bright);
  font-weight: 500;
}

.content-figure {
  margin: 1.5rem 0;
}

.content-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.content-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

.figure-grid {
  display: grid;
  gap: 1.5rem;
  margin: 1.5rem 0 2rem;
}

.figure-grid-equal {
  grid-template-columns: repeat(2, minmax(0, 288px));
  justify-content: center;
  align-items: start;
}

.figure-grid-equal .content-figure {
  margin: 0;
}

.figure-grid-equal .content-figure img {
  width: 288px;
  max-width: 100%;
  height: 173px;
  object-fit: cover;
}

.figure-grid-equal .content-figure:first-child img {
  object-position: top center;
}

.figure-grid-equal .figure-image-frame {
  width: 288px;
  max-width: 100%;
  height: 173px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.figure-grid-equal .figure-image-frame img {
  display: block;
  width: 100%;
  max-width: none;
  height: 173px;
  object-fit: cover;
  border: 0;
  border-radius: 0;
}

.figure-grid-equal .figure-image-frame-crop-bottom img {
  object-position: top center;
}

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

.haplogroup-lineage-label {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.hunthill-lineage {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--text-primary);
}

.hunthill-lineage li {
  margin-bottom: 0.75rem;
  line-height: 1.65;
  padding-left: 0.25rem;
}

.hunthill-lineage-key {
  color: var(--accent-gold-soft);
  font-weight: 600;
}

.hunthill-lineage a {
  color: var(--accent-emerald-bright);
  text-decoration: none;
}

.hunthill-lineage a:hover {
  color: var(--accent-gold-soft);
}

.hunthill-lineage-key a {
  color: inherit;
  font-weight: inherit;
}

.hunthill-lineage-key a:hover {
  color: inherit;
  opacity: 0.85;
}

.content-list {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  color: var(--text-primary);
}

.content-list li {
  margin-bottom: 0.5rem;
}

.history-catalogue-container {
  max-width: var(--content-width);
  margin: 0 auto 2.5rem;
  padding: 3rem 0 0;
}

.history-catalogue-container h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  margin: 0 0 2rem;
  line-height: 1.15;
  color: var(--text-primary);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.history-catalogue-container h2 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--accent-gold-soft);
  margin: 2rem 0 0.75rem;
}

.history-catalogue-container ul {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  color: var(--text-primary);
}

.history-catalogue-container li {
  margin-bottom: 0.5rem;
  line-height: 1.65;
}

.history-catalogue-container strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.history-catalogue-container .hce-ref-primary,
.page-meta .hce-ref-primary {
  color: var(--text-primary);
  font-weight: 600;
  font-size: inherit;
  letter-spacing: normal;
  opacity: 1;
}

[data-theme="light"] .history-catalogue-container .hce-ref-primary,
[data-theme="light"] .page-meta .hce-ref-primary {
  color: var(--text-primary);
  opacity: 1;
}

/* Catalogue Ref# labels (dimmed beside green name links) */
.hce-ref,
.county-rutherford-ref {
  color: #7a8290;
  font-weight: 500;
  font-size: 0.92em;
  letter-spacing: 0.02em;
  opacity: 0.82;
}

[data-theme="light"] .hce-ref,
[data-theme="light"] .county-rutherford-ref {
  color: #6b7280;
  opacity: 0.88;
}

.history-catalogue-container .content-list .hce-ref {
  margin-right: 0.2em;
}

/* Parents: shared ref column width, tight ref-to-name gap (same as siblings/issue) */
.history-catalogue-container ul.hce-ref-align-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0;
  row-gap: 0.5rem;
  align-items: baseline;
}

.history-catalogue-container ul.hce-ref-align-list > li.hce-ref-align-row {
  display: contents;
}

.history-catalogue-container ul.hce-ref-align-list .hce-ref-align-name {
  min-width: 0;
}

.history-catalogue-container ul.hce-ref-align-list > li.hce-ref-align-full {
  grid-column: 1 / -1;
}

.history-catalogue-container .content-list .hce-ref-col {
  display: inline-block;
  vertical-align: baseline;
  white-space: nowrap;
  box-sizing: content-box;
}

.county-rutherford-list .hce-ref {
  margin-right: 0.35em;
}

.page-meta .hce-ref {
  font-size: 0.95em;
}

/* Citation references (superscript numbers + footnotes block) */
.history-catalogue-container a.cite-ref {
  display: inline;
  vertical-align: super;
  font-size: 0.72em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.history-catalogue-container .cite-ref-num {
  display: inline-block;
  min-width: 1.15em;
  padding: 0.05em 0.2em;
  border-radius: 3px;
  color: var(--accent-gold);
  background: rgba(201, 168, 76, 0.14);
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.history-catalogue-container a.cite-ref:hover .cite-ref-num,
.history-catalogue-container a.cite-ref:focus-visible .cite-ref-num {
  color: var(--bg-deep);
  background: var(--accent-gold);
}

.history-catalogue-container .content-references {
  margin: 1.5rem 0 2rem;
  padding: 1.25rem 1.25rem 1.25rem 2.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-secondary);
  list-style: decimal;
}

.history-catalogue-container .content-references li {
  margin-bottom: 0.75rem;
  padding-left: 0.25rem;
  scroll-margin-top: 5rem;
}

.history-catalogue-container .content-references .ref-num {
  color: var(--accent-gold);
  font-weight: 700;
  margin-right: 0.35em;
}

/* Drop cap — modern treatment */
.dropcap::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 3.75rem;
  line-height: 0.85;
  padding: 0.05em 0.15em 0 0;
  color: var(--accent-gold);
  font-weight: 600;
}

/* ── Timeline cards (homepage history) ─────────────────────── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 3rem 0;
}

.timeline-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.timeline-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.timeline-year {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1.75;
  min-width: 4rem;
}

.timeline-card p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.timeline-card p a {
  color: var(--accent-emerald-bright);
  text-decoration: none;
  font-weight: 500;
}

.timeline-card p a:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

/* ── County lists (province county pages) ──────────────────── */
.county-section {
  max-width: var(--max-width);
  margin: 0 auto 3rem;
  padding: 0 clamp(1.25rem, 4vw, 2rem);
}

.county-section .page-meta {
  max-width: var(--content-width);
  margin: 0 auto 1.5rem;
}

.county-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  max-width: var(--content-width);
  margin: 0 auto 1.5rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.county-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.county-legend-swatch {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.county-legend-swatch--ni {
  background: var(--county-ni);
}

.county-legend-swatch--roi {
  background: var(--county-roi);
}

.county-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: var(--content-width);
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.county-list a {
  display: block;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.875rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.county-list a:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateX(4px);
}

.county-link--ni {
  color: var(--county-ni);
}

.county-link--roi {
  color: var(--county-roi);
}

.county-link--default {
  color: var(--accent-gold);
}

.county-back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.county-back-link:hover {
  color: var(--accent-emerald-bright);
}

.county-return-link {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.county-rutherford-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  overflow-anchor: none;
}

.county-rutherford-list > li {
  margin-bottom: 0.625rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  position: relative;
}

.county-rutherford-item--has-children {
  position: relative;
  z-index: 1;
}

.county-rutherford-list > .county-rutherford-item--has-children.county-rutherford-branch-active {
  z-index: 101;
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

/* Only the hovered top-level branch stacks above its siblings */
.county-rutherford-list:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) {
  z-index: 1;
}

.county-rutherford-children .county-rutherford-item--has-children.county-rutherford-branch-active {
  z-index: 60;
}

.county-rutherford-trigger {
  position: relative;
  z-index: 3;
  display: inline;
}

/* Nested names must sit above sibling sub-panels that open on the same row */
.county-rutherford-children .county-rutherford-trigger {
  z-index: 10;
}

/* Invisible bridge from the name link down into the panel below */
.county-rutherford-trigger::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -0.75rem;
  right: -0.75rem;
  height: 1rem;
}

/* Top-level Captain/Donegal: taller bridge down into panel 1 */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-trigger::after {
  height: 1.5rem;
  pointer-events: auto;
}

/* Right bridges (panel 1→2, 3→4, …): active so the cursor can reach the next panel */
.county-rutherford-children .county-rutherford-item--has-children > .county-rutherford-trigger::before {
  content: '';
  position: absolute;
  top: -0.25rem;
  bottom: -0.25rem;
  left: 100%;
  width: 45%;
  pointer-events: auto;
}

/* Left bridges (panel 2→3, 4→5, …): passive only — those panels open from the name link */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-trigger::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-trigger::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-trigger::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-trigger::before {
  left: auto;
  right: 100%;
  width: 38%;
  pointer-events: none;
}

/* Name link only above its sub-panel while hovered (keeps left panels reachable below) */
.county-rutherford-item--has-children.county-rutherford-branch-active.county-rutherford-link-hovered > .county-rutherford-trigger {
  z-index: 25;
}

/* Ancestor row names (panel 1, 2, 3…) sit above their sub-panels by default;
   drop them below when the cursor is in a deeper panel but not on that name */
.county-rutherford-item--has-children.county-rutherford-branch-active:has(> .county-rutherford-children .county-rutherford-branch-active):not(.county-rutherford-link-hovered) > .county-rutherford-trigger {
  z-index: 1;
}

/* Inactive panel 2 rows sit below an open branch in the same panel (no pointer-events change) */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) > .county-rutherford-trigger {
  z-index: 1;
}

/* Inactive panel 1 rows sit below the active row while navigating the name column */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) > .county-rutherford-trigger {
  z-index: 1;
}

/* Shield the sub-panel zone once a branch is open — row height only (no 150vh scroll inflation) */
.county-rutherford-children .county-rutherford-item--has-children.county-rutherford-branch-active::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 40%;
  right: 0;
  height: auto;
  z-index: 1;
  pointer-events: none;
}

/* Inactive sibling sub-panels must not steal hover from the active row's zone */
.county-rutherford-children:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) > .county-rutherford-children,
.county-rutherford-children:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) > .county-rutherford-children * {
  pointer-events: none;
}

/* Inactive panel 1 names stay reachable — only their sub-panels are blocked above */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) > .county-rutherford-trigger {
  pointer-events: auto;
}

/* Inactive panel 1 rows must not steal hover via their right-hand bridge */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children:has(> .county-rutherford-item--has-children.county-rutherford-branch-active) > .county-rutherford-item--has-children:not(.county-rutherford-branch-active) > .county-rutherford-trigger::before {
  pointer-events: none;
}

.county-rutherford-list > li > a {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent-emerald-bright);
  text-decoration: none;
}

.county-rutherford-list > li > a:hover,
.county-rutherford-list > li:hover > a,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-trigger:hover > a,
.county-rutherford-trigger:focus-within > a,
.county-rutherford-item--has-children.county-rutherford-branch-active.county-rutherford-link-hovered > .county-rutherford-trigger > a {
  color: var(--accent-gold);
  text-decoration: underline;
  z-index: 26;
}

.county-rutherford-trigger > a {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent-emerald-bright);
  text-decoration: none;
  position: relative;
  z-index: 1;
}

.county-rutherford-children {
  display: none;
  list-style: none;
  position: absolute;
  top: calc(100% - 0.125rem);
  left: -1px;
  right: -1px;
  margin: 0;
  padding: 0.375rem 0 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  box-shadow: var(--shadow-card);
  z-index: 2;
  isolation: isolate;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children {
  top: 100%;
  margin-top: -0.5rem;
  padding-top: 0.5rem;
}

/* Bridge upward from panel 1 into the top-level trigger */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children::before {
  content: '';
  position: absolute;
  top: -1.5rem;
  left: 0;
  right: 0;
  height: 1.5rem;
  pointer-events: auto;
}

/* Nested sub-panels alternate right/left within the root dropdown width */
/* 2nd, 4th, 6th, 8th panels — right strip */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  top: 0;
  left: 40%;
  right: -1px;
  width: auto;
  min-width: 0;
  max-width: none;
  z-index: 2;
  margin-top: 0;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border-accent);
  border-left: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-sm) 0;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: auto;
  height: 3rem;
  right: 100%;
  width: 42%;
  z-index: 0;
  pointer-events: auto;
}

/* Panel 2 entry bridge must not cover the panel 1 name that opened it */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::before {
  pointer-events: none;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children.county-rutherford-link-hovered > .county-rutherford-children::before,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children.county-rutherford-branch-active > .county-rutherford-children::before {
  pointer-events: none;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  top: 0;
  left: 100%;
  right: auto;
  width: 150%;
  min-width: 0;
  max-width: none;
  border-top: 1px solid var(--border-accent);
  border-left: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 16;
}

/* 3rd, 5th, 7th panels — left strip */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  top: 0;
  left: auto;
  right: calc(100% - 1px);
  width: 66.666%;
  min-width: 0;
  margin-top: 0;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border-accent);
  border-right: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-accent);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  z-index: 15;
}

/* 6th panel — right strip (re-stated after left rules) */
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  top: 0;
  left: 100%;
  right: auto;
  width: 150%;
  min-width: 0;
  max-width: none;
  margin-top: 0;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border-accent);
  border-right: none;
  border-left: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 18;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::after,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::after,
.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: auto;
  height: 3rem;
  left: 100%;
  width: 38%;
  z-index: 0;
  pointer-events: auto;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  z-index: 15;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  z-index: 16;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  z-index: 17;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  z-index: 18;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  z-index: 19;
}

.county-rutherford-list > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children > .county-rutherford-item--has-children > .county-rutherford-children {
  z-index: 20;
}

/* Open panels follow the JS-tracked active branch (immune to stale CSS :hover) */
.county-rutherford-item--has-children.county-rutherford-branch-active > .county-rutherford-children {
  display: block;
  z-index: 2;
  pointer-events: auto;
}

/* Nested panel shells stay inert; each open branch re-enables its own direct panel above */
.county-rutherford-children .county-rutherford-children {
  pointer-events: none;
}

.county-rutherford-children .county-rutherford-children li,
.county-rutherford-children .county-rutherford-children .county-rutherford-trigger,
.county-rutherford-children .county-rutherford-children a {
  pointer-events: auto;
}

.county-rutherford-children li {
  margin: 0;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0;
}

.county-rutherford-children li + li {
  border-top: 1px solid var(--border-subtle);
}

.county-rutherford-children a {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-emerald-bright);
  text-decoration: none;
  position: relative;
  z-index: 10;
}

/* Panel 2+ names: underline on the link itself only, not the whole row */
.county-rutherford-children .county-rutherford-children a:hover,
.county-rutherford-children .county-rutherford-children .county-rutherford-item--has-children.county-rutherford-branch-active.county-rutherford-link-hovered > .county-rutherford-trigger > a {
  color: var(--accent-gold);
  text-decoration: underline;
}

.county-rutherford-children .county-rutherford-label {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.county-rutherford-dates {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.county-rutherford-note {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0;
}

/* Emigration card: first line beside label, following lines align with Origins text */
.timeline-card--wrap {
  grid-template-columns: auto 1fr;
  column-gap: 1.5rem;
  row-gap: 0;
}

.timeline-card--wrap .timeline-year {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.timeline-card--wrap .timeline-body {
  grid-column: 1 / -1;
  grid-row: 1;
}

.timeline-card--wrap .timeline-body p {
  padding-left: var(--timeline-origins-indent, 7rem);
  text-indent: calc(var(--timeline-emigration-indent, 9rem) - var(--timeline-origins-indent, 7rem));
}

/* ── Explore grid (homepage links) ─────────────────────────── */
.section-heading {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}

.section-intro {
  color: var(--text-secondary);
  margin: 0 0 2rem;
  max-width: 520px;
}

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

.explore-card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.explore-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold));
  opacity: 0;
  transition: opacity var(--transition);
}

.explore-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}

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

.explore-card-icon {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-emerald-bright);
  margin-bottom: 0.75rem;
  line-height: 1;
}

.explore-card h3 {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.explore-card p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
  flex-grow: 1;
}

.explore-card-arrow {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-emerald-bright);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Motto block ─────────────────────────────────────────────── */
.motto-block {
  text-align: center;
  padding: 3rem 2rem;
  margin: 0 auto 2.5rem;
  max-width: var(--content-width);
  background: var(--motto-block-bg);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  position: relative;
}

.motto-block::before {
  content: '\201C';
  position: absolute;
  top: 0.5rem;
  left: 1.5rem;
  font-family: var(--font-display);
  font-size: 5rem;
  line-height: 1;
  color: var(--accent-emerald);
  opacity: 0.25;
}

.motto-latin {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.motto-english {
  font-size: 1rem;
  color: var(--accent-gold-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ── Source / attribution ────────────────────────────────────── */
.source,
.attribution {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.attribution a {
  color: var(--accent-emerald-bright);
}

/* ── Contact page ────────────────────────────────────────────── */
.contact-panel {
  max-width: var(--content-width);
  margin: 0 auto;
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.contact-panel p {
  color: var(--text-secondary);
  margin: 0 0 2rem;
  font-size: 1.0625rem;
}

.contact-email {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent-emerald) 0%, #1f6b4a 100%);
  color: #fff !important;
  font-size: 1.0625rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px rgba(45, 138, 98, 0.35);
}

.contact-email:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(45, 138, 98, 0.45);
  color: #fff !important;
}

.contact-email svg {
  flex-shrink: 0;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--footer-bg);
  transition: background-color var(--transition), border-color var(--transition);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-motto {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
}

.footer-motto em {
  color: var(--accent-gold-soft);
  font-style: normal;
}

.footer-copy {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: right;
}

.history-catalogue-container .hce-page-title-format {
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.history-catalogue-container .hce-title-lock {
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.history-catalogue-container .hce-title-lock:hover {
  color: var(--text-secondary);
  border-color: rgba(201, 168, 76, 0.35);
}

.history-catalogue-container .hce-title-lock.is-locked,
.history-catalogue-container .hce-title-lock[aria-pressed="true"] {
  color: var(--accent-gold-soft);
  border-color: rgba(201, 168, 76, 0.45);
  background: rgba(201, 168, 76, 0.1);
}

.footer-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}

.footer-catalogue-label {
  color: var(--text-secondary);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem 1rem;
    display: none;
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav > ul {
    flex-direction: column;
    width: auto;
    justify-content: flex-start;
    gap: 0.125rem;
  }

  .site-nav a {
    padding: 0.75rem 1rem;
  }

  .nav-dropdown-toggle {
    display: inline-flex;
  }

  .nav-province-row > a {
    padding-right: 0.5rem;
  }

  .nav-item--has-dropdown .nav-dropdown {
    display: none;
    position: static;
    min-width: 0;
    margin: 0.125rem 0 0.375rem;
    padding: 0.25rem 0 0.375rem;
    background: transparent;
    border: none;
    border-left: 2px solid var(--border-subtle);
    border-radius: 0;
    box-shadow: none;
  }

  .nav-item--has-dropdown.is-open .nav-dropdown {
    display: block;
  }

  .nav-dropdown a {
    padding-left: 1.25rem;
    padding-right: 0.75rem;
    white-space: normal;
  }

  .nav-dropdown-footer {
    margin-top: 0.125rem;
    padding-top: 0.125rem;
  }

  .logo-subtitle {
    display: none;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero-stats {
    gap: 1.25rem;
  }

  .timeline-card {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .timeline-card--wrap .timeline-body p {
    padding-left: 0;
    text-indent: 0;
  }

  .timeline-card--wrap .timeline-year {
    grid-column: 1;
    grid-row: auto;
  }

  .timeline-card--wrap .timeline-body {
    grid-column: 1;
    grid-row: auto;
  }

  .timeline-year {
    font-size: 1.25rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  main {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .header-inner {
    padding: 0 1rem;
  }

  .dropcap::first-letter {
    font-size: 3rem;
  }
}

/* ── HCE catalogue search (RootsMagic-style) ───────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main.hce-search-main {
  max-width: none;
  width: 100%;
  padding: 1rem 0.75rem 3rem;
}

.hce-search-page {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  max-width: 1680px;
  margin: 0 auto;
}

.hce-search-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.hce-search-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.hce-search-intro {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.hce-search-status {
  margin: 0.65rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hce-search-workspace {
  display: grid;
  grid-template-columns: minmax(210px, 240px) minmax(0, 1fr);
  gap: 0;
  min-height: 520px;
  align-items: stretch;
}

.hce-search-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hce-search-panel--criteria {
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-deep);
  min-width: 0;
}

.hce-search-panel--results {
  background: var(--bg-surface);
  min-width: 0;
  overflow: hidden;
}

.hce-search-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.hce-search-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.hce-search-btn:hover,
.hce-search-btn:focus-visible {
  background: var(--nav-hover-bg);
  border-color: var(--border-accent);
}

.hce-search-btn--primary {
  background: linear-gradient(135deg, var(--accent-emerald) 0%, #1a5c42 100%);
  border-color: rgba(45, 138, 98, 0.5);
  color: #fff;
}

.hce-search-btn--primary:hover,
.hce-search-btn--primary:focus-visible {
  background: linear-gradient(135deg, var(--accent-emerald-bright) 0%, var(--accent-emerald) 100%);
  color: #fff;
}

.hce-search-btn.is-active {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.hce-search-criteria {
  padding: 0.5rem 0.55rem 0.75rem;
  overflow: auto;
}

.hce-search-criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  table-layout: fixed;
}

.hce-search-criteria-table th,
.hce-search-criteria-table td {
  padding: 0.18rem 0.25rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.2;
}

.hce-search-criteria-table th {
  width: 42%;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  padding-right: 0.35rem;
}

.hce-search-criteria-table tr:last-child th,
.hce-search-criteria-table tr:last-child td {
  border-bottom: none;
}

.hce-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  line-height: 1.2;
  padding: 0.15rem 0.35rem;
  min-height: 0;
}

.hce-search-criteria-table input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.hce-search-input:focus {
  outline: 2px solid var(--border-accent);
  outline-offset: 1px;
}

.hce-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.hce-search-results-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.hce-search-results-head {
  flex-shrink: 0;
  background: rgba(45, 138, 98, 0.16);
}

.hce-search-results-head-table-wrap {
  overflow: hidden;
}

.hce-search-results-hscroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  background: rgba(45, 138, 98, 0.16);
  border-bottom: 1px solid rgba(45, 138, 98, 0.35);
  scrollbar-color: rgba(45, 138, 98, 0.5) rgba(45, 138, 98, 0.16);
  scrollbar-width: thin;
}

.hce-search-results-hscroll::-webkit-scrollbar {
  height: 14px;
}

.hce-search-results-hscroll::-webkit-scrollbar-track {
  background: rgba(45, 138, 98, 0.16);
}

.hce-search-results-hscroll::-webkit-scrollbar-thumb {
  background: rgba(45, 138, 98, 0.45);
  border-radius: 4px;
}

.hce-search-results-hscroll::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 138, 98, 0.62);
}

.hce-search-results-hscroll::-webkit-scrollbar-corner {
  background: rgba(45, 138, 98, 0.16);
}

.hce-search-results-hscroll-inner {
  height: 1px;
}

.hce-search-results-body {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
  scrollbar-color: rgba(45, 138, 98, 0.5) rgba(45, 138, 98, 0.16);
  scrollbar-width: thin;
}

.hce-search-results-body::-webkit-scrollbar {
  width: 14px;
}

.hce-search-results-body::-webkit-scrollbar-track {
  background: rgba(45, 138, 98, 0.16);
}

.hce-search-results-body::-webkit-scrollbar-thumb {
  background: rgba(45, 138, 98, 0.45);
  border-radius: 4px;
}

.hce-search-results-body::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 138, 98, 0.62);
}

.hce-search-results {
  width: max-content;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.8125rem;
  table-layout: auto;
}

.hce-search-results-head-table {
  margin: 0;
}

.hce-search-results thead th {
  padding: 0.18rem 0.45rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  background: rgba(45, 138, 98, 0.16);
  color: var(--text-primary);
  border: none;
}

.hce-search-results tbody td {
  padding: 0.18rem 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  line-height: 1.2;
  white-space: nowrap;
}

.hce-search-results tbody tr {
  cursor: pointer;
}

.hce-search-results tbody tr:hover {
  background: var(--nav-hover-bg);
}

.hce-search-results tbody tr.is-selected {
  background: rgba(45, 138, 98, 0.16);
}

.hce-search-results tbody tr.is-selected td {
  border-bottom-color: rgba(45, 138, 98, 0.25);
}

.hce-search-results a {
  color: var(--accent-emerald-bright);
  text-decoration: none;
  font-weight: 500;
}

.hce-search-results a:hover {
  text-decoration: underline;
}

.hce-search-empty td {
  color: var(--text-muted);
  font-style: italic;
  padding: 1.25rem 0.75rem;
}

.hce-search-dialog {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0;
  background: var(--bg-elevated);
  color: var(--text-primary);
  max-width: 24rem;
}

.hce-search-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.hce-search-dialog-inner {
  padding: 1rem 1.25rem 1.1rem;
}

.hce-search-dialog-inner h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
}

.hce-search-dialog-note {
  margin: 0 0 0.75rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.hce-search-column-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.hce-search-column-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.875rem;
}

.hce-search-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .hce-search-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hce-search-panel--criteria {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}

@media print {
  .site-header,
  .site-footer,
  .hce-search-panel--criteria,
  .hce-search-toolbar,
  .skip-link {
    display: none !important;
  }

  .hce-search-workspace {
    display: block;
  }

  .hce-search-page {
    border: none;
    box-shadow: none;
  }

  .hce-search-results-body {
    overflow: visible;
  }

  .hce-search-results-head-table,
  .hce-search-results-body-table {
    transform: none !important;
  }

  .hce-search-results-hscroll {
    display: none;
  }

  .hce-search-results tbody tr.is-selected {
    background: #eee;
  }
}
