/* ═══════════════════════════════════════════════════════════════════════════
   NCTS Design Tokens — Editorial/Journal theme
   Fonts: Fraunces (display serif) + Public Sans (body)
   Accent: Oxblood
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* ── Brand accent ── */
  --accent:         #8B1A1A;   /* oxblood */
  --accent-hover:   #6E1515;
  --accent-dim:     rgba(139, 26, 26, 0.08);
  --accent-light:   #F5E8E8;   /* tinted bg for badges/labels */

  /* ── Backgrounds (light, default) ── */
  --bg:             #FAF9F7;   /* warm off-white */
  --bg-alt:         #F2EFE9;   /* cream — alternating sections */
  --bg-dark:        #17120D;   /* rich warm dark */
  --bg-dark-alt:    #221A12;

  /* ── Text (light sections) ── */
  --fg:             #1A1714;
  --fg-muted:       #5E5A56;
  --fg-subtle:      #908B86;

  /* ── Text (dark sections — use these on --bg-dark backgrounds) ── */
  --fg-inv:         #EDE8E1;
  --fg-inv-muted:   #A89F97;
  --fg-inv-subtle:  #6E6660;

  /* ── Borders ── */
  --border:         #E4DFD8;
  --border-dark:    rgba(237, 232, 225, 0.1);

  /* ── Surfaces ── */
  --surface:        #EDEAE5;
  --surface-dark:   #261E16;

  /* ── Typography ── */
  --font-display:   'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:      'Public Sans', system-ui, -apple-system, sans-serif;

  /* ── Layout ── */
  --max-w:          1100px;
  --px:             clamp(1.25rem, 4vw, 2rem);
  --section-py:     clamp(4rem, 8vw, 7rem);
}

/* ── Base ── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p {
  line-height: 1.75;
}

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--px);
}

/* ── Kicker / label above headings ── */
.kicker {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kicker::before {
  content: '';
  display: block;
  width: 1.5rem;
  height: 1px;
  background: currentColor;
  flex-shrink: 0;
}

.kicker-center {
  justify-content: center;
}

.kicker-center::before { display: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  text-decoration: none;
  letter-spacing: 0;
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--fg-subtle);
}

.btn-outline-inv {
  background: transparent;
  color: var(--fg-inv);
  border-color: var(--border-dark);
}

.btn-outline-inv:hover {
  border-color: var(--fg-inv-muted);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* ── Rule ── */
.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── Tag / category badge ── */
.tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
}

/* ── Dark section utility ── */
.section-dark {
  background: var(--bg-dark);
  color: var(--fg-inv);
}

.section-dark .kicker { color: #C97A7A; }
.section-dark .kicker::before { background: #C97A7A; }

/* ── Prose (news detail, legal pages) ── */
.prose {
  max-width: 68ch;
}

.prose h2 {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 2.5vw, 1.875rem);
  font-weight: 400;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--fg);
}

.prose h3 {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--fg);
}

.prose p {
  font-size: 1.0625rem;
  line-height: 1.8;
  margin-bottom: 1.375rem;
  color: var(--fg-muted);
}

.prose ul, .prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25rem;
}

.prose li {
  margin-bottom: 0.5rem;
  color: var(--fg-muted);
  font-size: 1.0625rem;
  line-height: 1.7;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Placeholder state ── */
.muted-state {
  padding: 3rem 0;
  color: var(--fg-subtle);
  font-size: 0.9375rem;
}

/* ═══════════════════════════════════════════════
   Motion System — Editorial / Organic
   Respects prefers-reduced-motion
   ═══════════════════════════════════════════════ */

@media (prefers-reduced-motion: no-preference) {
  /* Hero load sequence — fires on page load, not scroll */
  [data-hero] {
    opacity: 0;
    transform: translateY(18px);
    animation: ncts-hero-in 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  }
  [data-hero="2"] { animation-delay: 0.13s; }
  [data-hero="3"] { animation-delay: 0.26s; }
  [data-hero="4"] { animation-delay: 0.42s; }
  [data-hero="5"] { animation-delay: 0.58s; }

  @keyframes ncts-hero-in {
    to { opacity: 1; transform: none; }
  }

  /* Scroll reveal: single element */
  [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94),
      transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
  }

  /* Scroll reveal: staggered grid/list parent */
  [data-reveal-stagger] > * {
    opacity: 0;
    transform: translateY(20px);
    transition:
      opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
      transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  [data-reveal-stagger].is-revealed > * { opacity: 1; transform: none; }
  [data-reveal-stagger].is-revealed > *:nth-child(1) { transition-delay: 0s; }
  [data-reveal-stagger].is-revealed > *:nth-child(2) { transition-delay: 0.08s; }
  [data-reveal-stagger].is-revealed > *:nth-child(3) { transition-delay: 0.16s; }
  [data-reveal-stagger].is-revealed > *:nth-child(4) { transition-delay: 0.24s; }
  [data-reveal-stagger].is-revealed > *:nth-child(5) { transition-delay: 0.32s; }
  [data-reveal-stagger].is-revealed > *:nth-child(6) { transition-delay: 0.40s; }

  /* NC map motif: path draws in on hero load */
  .motif-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    animation: ncts-draw-nc 2.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-delay: 0.2s;
  }

  @keyframes ncts-draw-nc {
    to { stroke-dashoffset: 0; }
  }
}

/* Stats counter — tabular nums for stable width during count-up */
[data-count] { font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════
   Leaflet Map Popups — shared across homepage + practice-map
   ═══════════════════════════════════════════════ */

/* Dark style (default) */
.ncts-popup .leaflet-popup-content-wrapper {
  background: #221A12;
  border-radius: 8px;
  border: 1px solid rgba(237,232,225,0.12);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  padding: 0;
  overflow: hidden;
}

.ncts-popup .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.ncts-popup .leaflet-popup-tip-container { margin-top: -1px; }

.ncts-popup .leaflet-popup-tip {
  background: #221A12;
  box-shadow: none;
}

/* Light / Cream styles */
.ncts-popup--light .leaflet-popup-content-wrapper,
.ncts-popup--cream .leaflet-popup-content-wrapper {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.ncts-popup--light .leaflet-popup-tip,
.ncts-popup--cream .leaflet-popup-tip { background: var(--bg); }

/* Popup inner layout */
.map-popup {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.875rem 1.125rem 1rem;
  min-width: 200px;
}

.map-popup-type {
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.map-popup-name {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg-inv);
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.ncts-popup--light .map-popup-name,
.ncts-popup--cream .map-popup-name { color: var(--fg); }

.map-popup-city {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--fg-inv-muted);
}

.ncts-popup--light .map-popup-city,
.ncts-popup--cream .map-popup-city { color: var(--fg-muted); }

.map-popup-link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.625rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #C97A7A;
  text-decoration: none;
  transition: opacity 0.15s;
}

.ncts-popup--light .map-popup-link,
.ncts-popup--cream .map-popup-link { color: var(--accent); }

.map-popup-link:hover { opacity: 0.75; }

/* ── City labels on practice map ── */
.city-label {
  font-family: var(--font-body);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  text-align: center;
}

.city-label--dark {
  color: rgba(140, 210, 240, 0.65);
  text-shadow: 0 0 12px rgba(0, 212, 255, 0.45);
}

.city-label--light,
.city-label--cream {
  color: rgba(55, 32, 12, 0.72);
  text-shadow: none;
}

/* ── Cluster panel — pinned overlay inside the map container ── */
.cluster-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 850;
  background: #221A12;
  border-radius: 8px;
  border: 1px solid rgba(237, 232, 225, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  padding: 0.875rem 2rem 1rem 1.125rem;
  min-width: 200px;
  max-width: 280px;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  pointer-events: all;
}

.cluster-panel--hidden {
  display: none;
}

.cluster-panel--light,
.cluster-panel--cream {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.cluster-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-inv-subtle);
  font-size: 11px;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.15s;
}

.cluster-close:hover { color: var(--fg-inv-muted); }

.cluster-panel--light .cluster-close,
.cluster-panel--cream .cluster-close { color: var(--fg-subtle); }

.cluster-panel--light .cluster-close:hover,
.cluster-panel--cream .cluster-close:hover { color: var(--fg-muted); }

/* ── Cluster pin icon ── */
.ncts-cluster {
  background: transparent !important;
  border: none !important;
}

.cluster-badge {
  position: relative;
  width: 28px;
  height: 28px;
}

.cluster-ring,
.cluster-count {
  pointer-events: none;
}

.cluster-ring {
  position: absolute;
  inset: 0;
  width: 28px;
  height: 28px;
}

.cluster-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  color: #FAF9F7;
  line-height: 1;
  letter-spacing: 0;
}

/* ── Cluster panel entries ── */
.cluster-entry {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cluster-rule {
  border: none;
  border-top: 1px solid rgba(237, 232, 225, 0.12);
  margin: 0.5rem 0;
}

.ncts-popup--light .cluster-rule,
.ncts-popup--cream .cluster-rule {
  border-top-color: var(--border);
}
