/* ==========================================================================
   RunBackHome Design System
   Version: 1.0.0

   "Your Home. Your Data. Your Control."

   Earth-tone palette rooted in warmth, ownership, and family.
   Built to Marcelo Design X craft standard.
   Vanilla CSS custom properties — no preprocessor, no build step.

   Vision Council approved: June 2, 2026
   Department: CDO / Design
   ========================================================================== */


/* ==========================================================================
   1. RESET
   ========================================================================== */

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

html {
  scroll-behavior: auto; /* Lenis handles smooth scrolling */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Work Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.6;
  overflow-x: hidden;
  color: var(--text-primary);
  background: var(--bg-primary);
}

img, video { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
input, textarea, select { font: inherit; }


/* ==========================================================================
   2. CUSTOM PROPERTIES — LIGHT THEME (DEFAULT / LANDING PAGE)
   ========================================================================== */

:root {
  /* --- Brand Colors --- */
  --color-forest: #1a3a2a;
  --color-forest-rgb: 26, 58, 42;
  --color-stone: #d4c5a9;
  --color-stone-rgb: 212, 197, 169;
  --color-hearth: #c75b12;
  --color-hearth-rgb: 199, 91, 18;
  --color-cream: #FAF6F0;
  --color-cream-rgb: 250, 246, 240;
  --color-charcoal: #2c2c2c;
  --color-charcoal-rgb: 44, 44, 44;

  /* --- Semantic Colors (Light Mode) --- */
  --bg-primary: #FAF6F0;
  --bg-secondary: #ffffff;
  --bg-elevated: #f3ede3;
  --bg-glass: rgba(26, 58, 42, 0.04);
  --bg-glass-hover: rgba(26, 58, 42, 0.08);
  --bg-glass-active: rgba(26, 58, 42, 0.12);
  --bg-accent-soft: rgba(199, 91, 18, 0.08);

  --text-primary: #1a3a2a;
  --text-secondary: rgba(26, 58, 42, 0.75);
  --text-muted: rgba(26, 58, 42, 0.45);
  --text-watermark: rgba(26, 58, 42, 0.03);
  --text-on-accent: #ffffff;

  --accent: var(--color-hearth);
  --accent-rgb: var(--color-hearth-rgb);
  --accent-hover: #b5510f;

  --border-subtle: rgba(26, 58, 42, 0.08);
  --border-medium: rgba(26, 58, 42, 0.15);
  --border-strong: rgba(26, 58, 42, 0.25);
  --border-gradient: linear-gradient(90deg, rgba(212, 197, 169, 0.6), transparent);

  --shadow-card: 0 4px 24px rgba(26, 58, 42, 0.06);
  --shadow-elevated: 0 8px 48px rgba(26, 58, 42, 0.1);
  --shadow-glow: 0 0 40px rgba(199, 91, 18, 0.15);

  /* --- Semantic Status Colors --- */
  --color-success: #2d7a4f;
  --color-success-rgb: 45, 122, 79;
  --color-warning: #d4a017;
  --color-warning-rgb: 212, 160, 23;
  --color-danger: #c0392b;
  --color-danger-rgb: 192, 57, 43;
  --color-info: #2c6fbb;
  --color-info-rgb: 44, 111, 187;

  /* --- MDX Signature Easing --- */
  --ease-mdx: cubic-bezier(0.625, 0.05, 0, 1);
  --ease-smooth: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-snap: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Transition Durations --- */
  --dur-fast: 0.3s;
  --dur-medium: 0.5s;
  --dur-slow: 0.8s;
  --dur-dramatic: 1.2s;

  /* --- Spacing Scale (fluid) --- */
  --space-2xs: clamp(2px, 0.25vw, 4px);
  --space-xs: clamp(4px, 0.5vw, 8px);
  --space-sm: clamp(8px, 1vw, 16px);
  --space-md: clamp(16px, 2vw, 32px);
  --space-lg: clamp(32px, 4vw, 64px);
  --space-xl: clamp(64px, 8vw, 128px);
  --space-2xl: clamp(96px, 12vw, 192px);
  --space-section: clamp(80px, 12vh, 160px);

  /* --- Typography Scale (fluid) --- */
  --fs-xs: clamp(11px, 0.8vw, 13px);
  --fs-sm: clamp(12px, 1vw, 14px);
  --fs-body: clamp(16px, 1.2vw, 20px);
  --fs-lg: clamp(18px, 1.6vw, 24px);
  --fs-xl: clamp(20px, 2vw, 28px);
  --fs-h4: clamp(22px, 2.5vw, 32px);
  --fs-h3: clamp(26px, 3vw, 42px);
  --fs-h2: clamp(36px, 5vw, 72px);
  --fs-h1: clamp(48px, 8vw, 110px);
  --fs-display: clamp(56px, 10vw, 160px);
  --fs-watermark: clamp(80px, 15vw, 240px);

  /* --- Font Families --- */
  --ff-display: 'Source Serif 4', 'Georgia', serif;
  --ff-body: 'Work Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* --- Border Radius --- */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 100px;
  --radius-round: 50%;

  /* --- Content Width --- */
  --max-width: 1440px;
  --content-padding: clamp(20px, 4vw, 80px);
  --reading-width: 680px;

  /* --- Z-Index Scale --- */
  --z-below: -1;
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-nav: 1000;
  --z-modal-backdrop: 2000;
  --z-modal: 2500;
  --z-toast: 3000;
  --z-preloader: 10000;
}


/* ==========================================================================
   3. DARK THEME (DASHBOARD / APP MODE)
   ========================================================================== */

[data-theme="dark"] {
  --bg-primary: #0f1a14;
  --bg-secondary: #152019;
  --bg-elevated: #1a2b22;
  --bg-glass: rgba(212, 197, 169, 0.04);
  --bg-glass-hover: rgba(212, 197, 169, 0.08);
  --bg-glass-active: rgba(212, 197, 169, 0.14);
  --bg-accent-soft: rgba(199, 91, 18, 0.12);

  --text-primary: #e8e4dc;
  --text-secondary: rgba(232, 228, 220, 0.7);
  --text-muted: rgba(232, 228, 220, 0.4);
  --text-watermark: rgba(232, 228, 220, 0.03);

  --accent: #d4763a;
  --accent-rgb: 212, 118, 58;
  --accent-hover: #e08545;

  --border-subtle: rgba(212, 197, 169, 0.08);
  --border-medium: rgba(212, 197, 169, 0.15);
  --border-strong: rgba(212, 197, 169, 0.25);
  --border-gradient: linear-gradient(90deg, rgba(212, 197, 169, 0.3), transparent);

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-elevated: 0 16px 64px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 40px rgba(212, 118, 58, 0.2);

  --color-success: #3da66a;
  --color-warning: #e6b422;
  --color-danger: #e04a3c;
  --color-info: #4a8fd4;
}


/* ==========================================================================
   4. TYPOGRAPHY
   ========================================================================== */

/* --- Headings: Source Serif 4 — warmth, trust, authority --- */
h1, h2, h3, h4, h5, h6,
.heading {
  font-family: var(--ff-display);
  line-height: 1.0;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: var(--fs-xl); }
h6 { font-size: var(--fs-lg); }

.display-text {
  font-family: var(--ff-display);
  font-size: var(--fs-display);
  line-height: 0.92;
  letter-spacing: -0.03em;
  font-weight: 800;
}

/* --- Labels: uppercase, wide tracking, small --- */
.label {
  font-family: var(--ff-body);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

/* --- Section heading pattern --- */
.section-heading {
  font-size: var(--fs-h2);
  line-height: 1.05;
  max-width: 800px;
}

/* --- Body text: generous line-height, constrained width --- */
.body-text {
  font-family: var(--ff-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: var(--reading-width);
}

/* --- Watermark text: behind content for depth --- */
.watermark {
  font-family: var(--ff-display);
  font-size: var(--fs-watermark);
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-watermark);
  position: absolute;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
  z-index: var(--z-below);
}

/* --- Stat number: for animated counters --- */
.stat-number {
  font-family: var(--ff-display);
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* --- Blockquote: for testimonials, manifesto quotes --- */
.quote {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  font-style: italic;
  line-height: 1.5;
  color: var(--text-primary);
  position: relative;
  padding-left: var(--space-lg);
  border-left: 3px solid var(--color-stone);
}


/* ==========================================================================
   5. LAYOUT
   ========================================================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}

.section {
  padding: var(--space-section) 0;
  position: relative;
  min-height: 60vh;
}

/* --- Grid Systems --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.split-60-40 {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}

.split-50-50 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  text-align: center;
  padding: var(--space-xl) 0;
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4,
  .split-60-40, .split-50-50 {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   6. BUTTONS & CTAs
   ========================================================================== */

/* --- Primary CTA: pill with arrow circle --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-on-accent);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--dur-medium) var(--ease-mdx);
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.btn-primary .arrow-circle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  transition: transform var(--dur-medium) var(--ease-mdx);
  flex-shrink: 0;
}
.btn-primary:hover .arrow-circle {
  transform: translate(4px, -4px);
}

/* --- Secondary CTA: outlined pill --- */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-medium);
  color: var(--text-primary);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--dur-medium) var(--ease-mdx);
  cursor: pointer;
  background: transparent;
}
.btn-secondary:hover {
  background: var(--bg-glass);
  border-color: var(--text-primary);
  transform: translateY(-2px);
}

/* --- Ghost button --- */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease-mdx);
  cursor: pointer;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

/* --- Button sizes --- */
.btn-sm {
  padding: 10px 20px;
  font-size: var(--fs-xs);
  gap: 8px;
}
.btn-sm .arrow-circle {
  width: 24px;
  height: 24px;
}
.btn-lg {
  padding: 20px 40px;
  font-size: var(--fs-body);
  gap: 16px;
}
.btn-lg .arrow-circle {
  width: 40px;
  height: 40px;
}

/* --- Dual CTA group --- */
.cta-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* --- Focus states (accessibility) --- */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}


/* ==========================================================================
   7. CARDS
   ========================================================================== */

/* --- Glassmorphism card (dark theme / dashboard) --- */
.glass-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: clamp(24px, 3vw, 48px);
  transition: background var(--dur-medium) var(--ease-mdx),
              border-color var(--dur-medium) var(--ease-mdx),
              transform var(--dur-medium) var(--ease-mdx),
              box-shadow var(--dur-medium) var(--ease-mdx);
}
.glass-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-medium);
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated);
}

/* --- Feature card: top gradient line --- */
.feature-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--dur-medium) var(--ease-mdx);
}
.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--dur-medium) var(--ease-mdx);
}
.feature-card:hover::before {
  opacity: 1;
}
.feature-card:hover {
  background: var(--bg-glass-hover);
  transform: translateY(-4px);
}
.feature-card .icon-box {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--bg-accent-soft);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-md);
  color: var(--accent);
}

/* --- Surface card (light theme / landing) --- */
.surface-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 3vw, 48px);
  box-shadow: var(--shadow-card);
  transition: all var(--dur-medium) var(--ease-mdx);
}
.surface-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-elevated);
}

/* --- Stat card (dashboard) --- */
.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}


/* ==========================================================================
   8. NAVIGATION
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  padding: var(--space-sm) var(--content-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--dur-medium) var(--ease-mdx),
              backdrop-filter var(--dur-medium) var(--ease-mdx),
              transform var(--dur-fast) ease;
}
.nav.scrolled {
  background: rgba(250, 246, 240, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}
.nav.hidden {
  transform: translateY(-100%);
}

[data-theme="dark"] .nav.scrolled {
  background: rgba(15, 26, 20, 0.85);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--ff-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
}
.nav-logo svg,
.nav-logo img {
  height: 36px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.nav-link {
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-mdx);
}
.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}

.nav-cta {
  flex-shrink: 0;
}

/* --- Mobile hamburger --- */
.nav-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-round);
  place-items: center;
  cursor: pointer;
  position: relative;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--dur-fast) var(--ease-mdx);
  position: absolute;
}
.nav-hamburger span:nth-child(1) { transform: translateY(-6px); }
.nav-hamburger span:nth-child(3) { transform: translateY(6px); }
.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: grid; }
  .nav-cta { display: none; }
}


/* ==========================================================================
   9. HERO SECTION
   ========================================================================== */

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--content-padding);
  position: relative;
  overflow: hidden;
}

.hero-headline {
  font-family: var(--ff-display);
  font-size: var(--fs-h1);
  line-height: 1.0;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: var(--space-md);
  max-width: 900px;
}
.hero-headline .accent {
  color: var(--accent);
}

.hero-subtitle {
  font-family: var(--ff-body);
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: var(--reading-width);
  margin-bottom: var(--space-lg);
}

/* --- Scroll indicator --- */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.scroll-indicator-text {
  font-family: var(--ff-body);
  font-size: var(--fs-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.scroll-indicator-line {
  width: 1px;
  height: 40px;
  background: var(--text-muted);
  animation: scrollPulse 2s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.5); opacity: 0.4; }
}

@media (max-width: 768px) {
  .hero { min-height: 80vh; }
  .scroll-indicator { display: none; }
}


/* ==========================================================================
   10. FORM INPUTS
   ========================================================================== */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-label {
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.form-input {
  padding: 14px 18px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--fs-body);
  transition: all var(--dur-fast) var(--ease-mdx);
  outline: none;
  width: 100%;
}
.form-input::placeholder {
  color: var(--text-muted);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--color-hearth-rgb), 0.12);
}
.form-input:hover:not(:focus) {
  border-color: var(--border-strong);
}

[data-theme="dark"] .form-input {
  background: var(--bg-glass);
  border-color: var(--border-subtle);
}
[data-theme="dark"] .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

/* --- Textarea --- */
.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* --- Select --- */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231a3a2a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
}

/* --- Helper / Error text --- */
.form-helper {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.form-error {
  font-size: var(--fs-xs);
  color: var(--color-danger);
}
.form-input.error {
  border-color: var(--color-danger);
}
.form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(var(--color-danger-rgb), 0.12);
}


/* ==========================================================================
   11. MODAL / DIALOG
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--dur-medium) var(--ease-mdx);
}
.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: var(--z-modal);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: 560px;
  width: calc(100% - 40px);
  max-height: 90vh;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: all var(--dur-medium) var(--ease-mdx);
  box-shadow: var(--shadow-elevated);
}
.modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

[data-theme="dark"] .modal {
  background: var(--bg-elevated);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}
.modal-title {
  font-family: var(--ff-display);
  font-size: var(--fs-h4);
}
.modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  transition: all var(--dur-fast) var(--ease-mdx);
}
.modal-close:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: var(--space-md);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}


/* ==========================================================================
   12. SIDEBAR NAVIGATION (DASHBOARD)
   ========================================================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: transform var(--dur-medium) var(--ease-mdx);
}

[data-theme="dark"] .sidebar {
  background: var(--bg-secondary);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  margin-bottom: var(--space-lg);
  font-family: var(--ff-display);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
}
.sidebar-logo svg,
.sidebar-logo img {
  height: 28px;
  width: auto;
}

.sidebar-section-label {
  font-family: var(--ff-body);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: var(--space-xs) var(--space-sm);
  margin-top: var(--space-md);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-mdx);
}
.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}
.sidebar-link.active {
  color: var(--text-primary);
  background: var(--bg-glass-hover);
}
.sidebar-link .icon {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  flex-shrink: 0;
}
.sidebar-link.active .icon {
  opacity: 1;
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

/* --- Dashboard main content area --- */
.dashboard-main {
  margin-left: 260px;
  padding: var(--space-lg);
  min-height: 100vh;
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .dashboard-main {
    margin-left: 0;
  }
}


/* ==========================================================================
   13. FOOTER
   ========================================================================== */

.footer {
  background: var(--color-forest);
  color: var(--color-cream);
  padding: var(--space-xl) var(--content-padding);
  position: relative;
  overflow: hidden;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid rgba(212, 197, 169, 0.15);
}

.footer-brand {
  max-width: 360px;
}
.footer-brand-name {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.footer-brand-desc {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: rgba(250, 246, 240, 0.6);
}

.footer-heading {
  font-family: var(--ff-body);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(250, 246, 240, 0.4);
  margin-bottom: var(--space-md);
}
.footer-link {
  display: block;
  font-size: var(--fs-sm);
  color: rgba(250, 246, 240, 0.7);
  padding: var(--space-2xs) 0;
  transition: color var(--dur-fast) var(--ease-mdx);
}
.footer-link:hover {
  color: var(--color-cream);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-top: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: rgba(250, 246, 240, 0.4);
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}


/* ==========================================================================
   14. MARQUEE
   ========================================================================== */

.marquee {
  overflow: hidden;
  white-space: nowrap;
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.marquee-inner {
  display: inline-flex;
  gap: var(--space-xl);
}
.marquee-inner span {
  font-family: var(--ff-display);
  font-size: var(--fs-h2);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
}
.marquee-inner span::after {
  content: '\2022';
  margin-left: var(--space-xl);
  color: var(--accent);
}


/* ==========================================================================
   15. BACKGROUND TEXTURES
   ========================================================================== */

/* --- Subtle grid pattern --- */
.bg-grid {
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* --- Radial gradient glow --- */
.bg-glow {
  position: relative;
}
.bg-glow::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--color-hearth-rgb), 0.1) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

/* --- Noise texture overlay --- */
.bg-noise::after {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.02;
  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='.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;
  z-index: var(--z-preloader);
}

/* --- Warm gradient section background --- */
.bg-warm-gradient {
  background: linear-gradient(
    135deg,
    var(--bg-primary) 0%,
    rgba(var(--color-stone-rgb), 0.12) 50%,
    var(--bg-primary) 100%
  );
}


/* ==========================================================================
   16. PRELOADER
   ========================================================================== */

.preloader {
  position: fixed;
  inset: 0;
  z-index: var(--z-preloader);
  background: var(--color-forest);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.preloader-logo {
  width: 80px;
  height: 80px;
  opacity: 0;
}
.preloader-counter {
  font-family: var(--ff-body);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: rgba(250, 246, 240, 0.5);
  font-variant-numeric: tabular-nums;
}
.preloader-ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid rgba(250, 246, 240, 0.15);
  position: absolute;
  transform: scale(0);
}


/* ==========================================================================
   17. HOVER & MICRO-INTERACTIONS
   ========================================================================== */

.image-wrapper {
  overflow: hidden;
  border-radius: var(--radius-md);
}
.image-wrapper img {
  transition: transform var(--dur-slow) var(--ease-mdx);
}
.image-wrapper:hover img {
  transform: scale(1.05);
}

.link-hover {
  position: relative;
  display: inline-block;
}
.link-hover::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--dur-medium) var(--ease-mdx);
}
.link-hover:hover::after {
  width: 100%;
}


/* ==========================================================================
   18. ACCESSIBILITY & REDUCED MOTION
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Skip to content */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--accent);
  color: var(--text-on-accent);
  border-radius: var(--radius-sm);
  z-index: calc(var(--z-preloader) + 1);
  transition: top var(--dur-fast) var(--ease-mdx);
}
.skip-link:focus {
  top: 12px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .preloader { display: none; }
  .marquee-inner { animation: none; }
}


/* ==========================================================================
   19. RESPONSIVE BREAKPOINTS
   ========================================================================== */

@media (max-width: 480px) {
  :root {
    --content-padding: 16px;
    --space-section: 48px;
  }
  .stats-row { grid-template-columns: 1fr; }
  .cta-group { flex-direction: column; align-items: stretch; }
  .display-text { font-size: clamp(36px, 10vw, 56px); }
}

@media (max-width: 768px) {
  :root {
    --content-padding: 20px;
    --space-section: 60px;
  }
  .display-text { font-size: clamp(40px, 10vw, 64px); }
  .hero { min-height: 80vh; }
}

@media (min-width: 1920px) {
  :root {
    --max-width: 1600px;
  }
}


/* ==========================================================================
   20. UTILITY CLASSES
   ========================================================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }

.mx-auto { margin-left: auto; margin-right: auto; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.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;
}
