:root {
  /* ==============================
     CTC TeleFund Design Tokens
     ============================== */

  /* Brand colors */
  --color-navy-900: #1b2a4a;
  --color-blue-700: #2c5f8a;
  --color-gold-600: #c6922a;
  --color-gold-700: #a87a22;
  --color-gold-200: #e8d5a3;

  /* Neutrals */
  --color-ink-900: #2d2d2d;
  --color-slate-500: #6b7280;
  --color-cream-50: #f5f3ef;
  --color-white: #ffffff;
  --color-border: #e6e1d8;

  /* Status */
  --color-green-700: #1a7a4c;
  --color-red-700: #b42318;

  /* Typography */
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Type scale */
  --text-base: 1rem; /* 16px */
  --text-sm: 0.875rem; /* 14px */
  --text-lg: 1.125rem; /* 18px */
  --h1: 2.125rem; /* 34px mobile default */
  --h2: 1.75rem; /* 28px */
  --h3: 1.375rem; /* 22px */

  /* Layout */
  --container-max: 1200px;
  --reading-max: 72ch;

  /* Spacing scale */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;
  --space-7: 80px;

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 12px;

  /* Shadows */
  --shadow-sm: 0 6px 18px rgba(27, 42, 74, 0.08);

  /* Focus */
  --focus-ring: 0 0 0 3px rgba(44, 95, 138, 0.35);
}

/* Desktop typography adjustments */
@media (min-width: 900px) {
  :root {
    --text-base: 1.125rem; /* 18px */
    --h1: 3rem; /* 48px */
    --h2: 2.125rem; /* 34px */
    --h3: 1.5rem; /* 24px */
  }
}

/* ==============================
   Base element styling
   ============================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-ink-900);
  background: var(--color-cream-50);
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-blue-700);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: var(--space-2);
  background: var(--color-white);
  color: var(--color-navy-900);
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--color-gold-600);
  z-index: 100;
}

.skip-link:focus {
  left: var(--space-2);
}

main {
  display: block;
}

/* ==============================
   Simple layout helpers
   ============================== */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-2);
}

.section {
  padding: var(--space-6) 0;
}

@media (max-width: 600px) {
  .section {
    padding: var(--space-5) 0;
  }
}

/* ==============================
   Typography
   ============================== */

h1,
h2,
h3 {
  font-family: var(--font-heading);
  color: var(--color-navy-900);
  line-height: 1.15;
  margin: 0 0 var(--space-2);
}

h1 {
  font-size: var(--h1);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--h2);
}

h3 {
  font-size: var(--h3);
}

p {
  margin: 0 0 var(--space-2);
  max-width: var(--reading-max);
}

.muted {
  color: var(--color-slate-500);
}

/* ==============================
   Header / nav (baseline)
   ============================== */

header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

header nav {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
}

.wordmark-ctc {
  color: var(--color-navy-900);
}

.wordmark-telefund {
  color: var(--color-gold-600);
}

header nav > a {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  color: var(--color-navy-900);
  text-decoration: none;
}

header nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-2);
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

header nav li {
  position: relative;
}

header nav li > a {
  font-weight: var(--font-weight-medium);
}

header nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.nav-cta {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(232, 213, 163, 0.35);
}

.nav-cta:hover {
  background: rgba(232, 213, 163, 0.55);
  text-decoration: none;
}

/* Dropdown baseline (simple; can be improved later) */
header nav li ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-1);
  box-shadow: var(--shadow-sm);
  min-width: 220px;
  z-index: 10;
}

header nav li:hover ul {
  display: block;
}

header nav li ul li {
  margin: 0;
}

header nav li ul a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
}

header nav li ul a:hover {
  background: rgba(232, 213, 163, 0.35);
  text-decoration: none;
}

/* ==============================
   Buttons
   ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease,
    color 120ms ease;
}

.btn-primary {
  background: var(--color-gold-600);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-gold-700);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-blue-700);
  color: var(--color-blue-700);
}

.btn-secondary:hover {
  background: var(--color-blue-700);
  color: var(--color-white);
  text-decoration: none;
}

/* ==============================
   Page primitives
   ============================== */

.page-hero {
  padding: var(--space-7) 0;
  background:
    radial-gradient(1200px 450px at 20% 10%, rgba(232, 213, 163, 0.35), transparent 55%),
    radial-gradient(900px 420px at 80% 0%, rgba(44, 95, 138, 0.14), transparent 55%),
    var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

/* ==============================
   Homepage hero: SVG illustration layout
   ============================== */

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: var(--space-5);
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

.hero-copy {
  min-width: 0;
}

.hero-illustration {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.hero-illustration svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ==============================
   SVG demo v2: Trend draw + points sequencing
   (Scoped so it won't affect v1 demo)
   ============================== */

.hero-illustration--v2 #ctc-trend {
  /* Path is roughly ~470 units long; give a little headroom */
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation:
    ctcDrawLine 3s ease-out forwards,
    ctcBreathe 6s ease-in-out 3s infinite;
}

.hero-illustration--v2 #ctc-trend-points circle {
  opacity: 0;
  animation: ctcFadeIn 0.5s ease-out forwards;
}

.hero-illustration--v2 #ctc-trend-points circle:nth-child(1) { animation-delay: 0.2s; }
.hero-illustration--v2 #ctc-trend-points circle:nth-child(2) { animation-delay: 0.6s; }
.hero-illustration--v2 #ctc-trend-points circle:nth-child(3) { animation-delay: 1.0s; }
.hero-illustration--v2 #ctc-trend-points circle:nth-child(4) { animation-delay: 1.6s; }
.hero-illustration--v2 #ctc-trend-points circle:nth-child(5) { animation-delay: 2.2s; }
.hero-illustration--v2 #ctc-trend-points circle:nth-child(6),
.hero-illustration--v2 #ctc-trend-points circle:nth-child(7) { animation-delay: 2.8s; }

@keyframes ctcDrawLine {
  to { stroke-dashoffset: 0; }
}

@keyframes ctcBreathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes ctcFadeIn {
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-illustration--v2 #ctc-trend,
  .hero-illustration--v2 #ctc-trend-points circle {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
  }

  /* Hide SMIL dynamic elements entirely; base static vector remains */
  .hero-illustration--v2 .ctc-pulse,
  .hero-illustration--v2 #ctc-travel-dot {
    display: none !important;
  }
}

.hero-demo-note {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
}

@media (prefers-reduced-motion: reduce) {
  /* Fallback for any inline-svg animations */
  .hero-illustration * {
    animation: none !important;
    transition: none !important;
  }
}

.page-hero .lead {
  font-size: var(--text-lg);
  color: var(--color-slate-500);
  max-width: 68ch;
}

.hero-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.kicker {
  display: inline-block;
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-blue-700);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-1);
}

.grid {
  display: grid;
  gap: var(--space-3);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}

/* Team / headshots (used on About page) */
.card img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: calc(var(--radius-md) - 2px);
  margin-bottom: var(--space-2);
  border: 1px solid var(--color-border);
}

.stack-3 {
  margin-top: var(--space-3);
}

.stack-4 {
  margin-top: var(--space-4);
}

.card h3 {
  margin-top: 0;
}

.card p {
  margin-bottom: 0;
}

/* About: team card helpers */
.team-title {
  margin-bottom: var(--space-2);
}

.team-contact {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-2);
  display: grid;
  gap: 6px;
}

.team-contact a {
  color: var(--color-blue-700);
  font-weight: var(--font-weight-medium);
}

.callout {
  background: rgba(232, 213, 163, 0.25);
  border: 1px solid rgba(198, 146, 42, 0.35);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.callout strong {
  color: var(--color-navy-900);
}

.cta-band {
  background: var(--color-navy-900);
  color: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.cta-band h2 {
  color: var(--color-white);
}

.cta-band p {
  color: rgba(255, 255, 255, 0.82);
}

.cta-band .btn-primary {
  border-color: rgba(255, 255, 255, 0.12);
}

.cta-band .btn-secondary {
  border-color: rgba(255, 255, 255, 0.8);
  color: rgba(255, 255, 255, 0.96);
}

.cta-band .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Lists */
.checklist {
  padding-left: 18px;
}

.checklist li {
  margin: 10px 0;
  max-width: var(--reading-max);
}

/* Tables (case studies) */
.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

th {
  background: rgba(232, 213, 163, 0.35);
  font-weight: var(--font-weight-semibold);
  color: var(--color-navy-900);
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:last-child td {
  border-bottom: none;
}

.metric-highlight {
  color: var(--color-gold-700);
  font-weight: var(--font-weight-bold);
}

/* ==============================
   Footer (baseline)
   ============================== */

footer {
  background: var(--color-navy-900);
  color: rgba(255, 255, 255, 0.88);
  padding: var(--space-6) var(--space-2);
}

footer a {
  color: var(--color-gold-200);
}

footer nav {
  margin-top: var(--space-2);
}

.muted-on-dark {
  color: rgba(255, 255, 255, 0.72);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-heading {
  margin: 0 0 var(--space-1);
  font-weight: var(--font-weight-semibold);
  color: rgba(255, 255, 255, 0.96);
}

.footer-links {
  display: grid;
  gap: 10px;
}

.footer-legal {
  margin-top: var(--space-4);
  color: rgba(255, 255, 255, 0.68);
  font-size: var(--text-sm);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
