/* ═══════════════════════════════════════════════════════════
   PALMELLE CORE v4 — Design System
   Fonts: Fraunces (wonky serif) + Outfit (geometric sans) + DM Mono
   Palette: Forest Green + Lavender + Warm Neutrals
   Features: Cursor, Scroll Progress, Scroll Reveal, Frosted Glass Nav
   ═══════════════════════════════════════════════════════════ */

/* ── COLOR SYSTEM — draft-v4 palette ── */
:root {
  /* Warm Neutrals */
  --sand: #e8e0d1;
  --sand-dark: #d9d0c1;

  /* Remapped legacy vars for compatibility */
  --ivory: #e8e0d1;
  --ivory-dark: #d9d0c1;

  /* Forest Green — primary dark */
  --verde: #11351e;
  --midnight: #11351e;
  --navy: #11351e;

  /* Sage Green — secondary */
  --verde-mid: #2D5016;
  --sage: #2D5016;

  /* Lavender — accent (backgrounds, borders, decorative only) */
  --sunset: #cdcce8;

  /* Accent text — light green for readable accent on dark bg */
  --gold: #a3b899;
  --accent-text: #a3b899;

  /* Accent text on light bg — primary green */
  --accent-text-light: #11351e;

  /* Soft Lavender — light accent */
  --sunset-light: #dddce8;
  --terra: #dddce8;

  /* Warm Taupe — neutral */
  --clay: #7A7468;
  --taupe: #7A7468;

  /* Warm Dark */
  --warm: #3e3e4a;
}

/* ═══════════════════════════════════════════
   FONT SYSTEM — Fraunces + Outfit + DM Mono
   Overrides inline font-family with !important
   ═══════════════════════════════════════════ */

/* FRAUNCES — Display + Headings (wonky serif) */
.nav-logo,
.f-logo,
h1, h2, h3, h4,
.hero-wordmark,
.stat-number,
.score-big,
.clarity-score,
.card-title,
.section-title,
.page-title {
  font-family: "Fraunces", serif !important;
  font-variation-settings: "WONK" 1, "SOFT" 50 !important;
}

/* OUTFIT — Body text + UI (geometric sans) */
body,
p,
.f-sub,
.f-opt-text,
.btn,
button,
input,
select,
textarea,
.nav-links a,
.card-text,
.step-text,
label,
.toggle-label,
li,
td,
th,
.breadcrumb a {
  font-family: "Outfit", sans-serif !important;
}

/* DM MONO — Labels + Numbers (monospace) */
.eyebrow,
.svc-num,
.number-label,
.trust-val,
.f-note,
code,
pre,
.mono {
  font-family: "DM Mono", monospace !important;
}

/* ── SENIOR-FRIENDLY TEXT SIZING ── */
/* Optimized for readability across all ages */
html {
  font-size: 17px;
}

body {
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Minimum 16px for all readable text */
p,
li,
td,
th,
label,
.card-text,
.step-text,
.breadcrumb a {
  font-size: 16px !important;
  line-height: 1.85 !important;
}

/* Eyebrows & labels — readable at 11px minimum */
.eyebrow,
.svc-num,
.number-label,
.a-label,
.c-num,
.stat-l,
.cta-note,
.f-note {
  font-size: 11px !important;
}

/* Display sizes — Fraunces */
h1 {
  font-size: 48px !important;
  line-height: 1.2;
}

h2 {
  font-size: 36px !important;
  line-height: 1.3;
}

h3 {
  font-size: 30px !important;
  line-height: 1.3;
}

h4 {
  font-size: 24px !important;
  line-height: 1.4;
}

.page-title {
  font-size: 42px !important;
}

.section-title {
  font-size: 32px !important;
}

.card-title {
  font-size: 20px !important;
}

/* Stat numbers — prominent */
.stat-number {
  font-size: 48px !important;
  font-weight: bold;
}

.score-big {
  font-size: 64px !important;
  font-weight: bold;
}

.clarity-score {
  font-size: 52px !important;
}

/* Nav & UI */
.nav-links a {
  font-size: 14px !important;
}

.f-links a {
  font-size: 12px !important;
}

/* ═══════════════════════════════════════════
   CUSTOM CURSOR — Handled by /static/cursor.js
   CSS cursor:none is set by JS only when cursor
   elements are injected, so native cursor still
   works if JS fails to load.
   ═══════════════════════════════════════════ */

/* Buttons get pointer cursor (fallback when custom cursor is off) */
button,
a,
.btn,
[role="button"] {
  cursor: pointer;
}

/* ═══════════════════════════════════════════
   SCROLL PROGRESS BAR
   ═══════════════════════════════════════════ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sunset-light), var(--sunset));
  z-index: 9999;
  width: 0%;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   SCROLL REVEAL ANIMATIONS
   ═══════════════════════════════════════════ */
.reveal,
.reveal-left,
.reveal-right {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-left {
  transform: translateX(-30px) translateY(0);
}

.reveal-right {
  transform: translateX(30px) translateY(0);
}

.reveal.in-view,
.reveal-left.in-view,
.reveal-right.in-view {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

/* ═══════════════════════════════════════════
   NAVIGATION — Top nav with scrolled state
   ═══════════════════════════════════════════ */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: transparent;
  transition: all 0.3s ease;
}

.top-nav.scrolled {
  background: rgba(27, 58, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(184, 165, 214, 0.1);
}

.nav-logo {
  font-size: 20px !important;
  color: var(--sand);
}

.nav-links a {
  position: relative;
  color: var(--sand);
  text-decoration: none;
  transition: color 0.3s;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--sunset);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* ── MOBILE BOTTOM NAV — Frosted Glass ── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9500;
  background: rgba(27, 58, 10, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 6px 0 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(184, 165, 214, 0.15);
}

.mobile-bottom-nav ul {
  display: flex !important;
  flex-direction: row !important;
  justify-content: space-around;
  align-items: center;
  list-style: none;
  flex-wrap: nowrap;
  width: 100%;
  margin: 0;
  padding: 0;
}

.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: rgba(250, 247, 242, 0.6);
  font-family: "Outfit", sans-serif !important;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  transition: color 0.3s;
}

.mobile-bottom-nav a:hover,
.mobile-bottom-nav a.active {
  color: var(--accent-text);
}

.mobile-bottom-nav svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
  opacity: 0.8;
}

/* ═══════════════════════════════════════════
   FOOTER — Shared styles
   ═══════════════════════════════════════════ */
.footer-inner {
  background: var(--verde);
  color: var(--sand);
  padding: 40px 24px;
}

.f-logo {
  font-size: 18px !important;
  color: var(--sand);
  margin-bottom: 20px;
  display: block;
}

.f-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

.f-links a {
  color: var(--sand);
  text-decoration: none;
  font-size: 12px !important;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.f-links a:hover {
  opacity: 1;
}

.f-social {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.f-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(250, 247, 242, 0.1);
  border-radius: 50%;
  color: var(--sand);
  text-decoration: none;
  transition: background 0.3s;
}

.f-social a:hover {
  background: rgba(250, 247, 242, 0.2);
}

.f-note {
  font-size: 10px !important;
  opacity: 0.6;
  font-family: "DM Mono", monospace !important;
}

/* ═══════════════════════════════════════════
   GRAIN OVERLAY — Subtle texture
   ═══════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' result='noise' /%3E%3CfeColorMatrix in='noise' type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: overlay;
}

/* ═══════════════════════════════════════════
   SELECTION COLOR
   ═══════════════════════════════════════════ */
::selection {
  background: var(--sunset-light);
  color: var(--verde);
}

::-moz-selection {
  background: var(--sunset-light);
  color: var(--verde);
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE — 768px breakpoint
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Show mobile bottom nav */
  .mobile-bottom-nav {
    display: flex !important;
    max-height: 64px;
    overflow: hidden;
  }

  /* Space for bottom nav + adjust body */
  body {
    padding-bottom: 76px;
    font-size: 16px;
  }

  /* Hide desktop nav links on mobile */
  .nav-links {
    display: none !important;
  }

  /* Tap targets — 48px minimum */
  button,
  .btn,
  [role="button"] {
    min-height: 52px;
    padding: 16px 28px;
  }

  /* Stats wrap on small screens */
  .stat-strip {
    flex-wrap: wrap;
    gap: 20px;
  }

  /* Footer social icons — bigger tap targets */
  .f-social a {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  /* Headings scale down */
  h1 {
    font-size: 32px !important;
  }

  h2 {
    font-size: 28px !important;
  }

  h3 {
    font-size: 24px !important;
  }

  .page-title {
    font-size: 28px !important;
  }

  /* Hide cursor on touch devices */
  body {
    cursor: auto;
  }

  body::before {
    display: none;
  }
}

/* ── DIRECTORY/SEARCH RESPONSIVE — 900px ── */
@media (max-width: 900px) {
  .search-row {
    flex-direction: column !important;
  }

  input[type="search"],
  .search-input {
    width: 100% !important;
    font-size: 16px !important; /* prevents iOS zoom */
  }

  .btn-search {
    width: 100% !important;
    min-height: 52px;
  }

  .autocomplete-box {
    right: 0 !important;
  }

  /* Horizontal scroll filters */
  .filters-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    scrollbar-width: none;
  }

  .filters-bar::-webkit-scrollbar {
    display: none;
  }

  .chip,
  .filter-select {
    flex-shrink: 0;
    min-height: 44px;
  }

  /* Single column layout */
  .results-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
}

/* ── FUNNEL MOBILE — Full screen ── */
@media (max-width: 768px) {
  .funnel-panel {
    max-width: 100% !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    min-height: 100vh;
  }

  .funnel-overlay {
    align-items: stretch !important;
  }

  .f-body {
    padding: 28px 24px 100px !important;
  }

  .f-question {
    font-size: 28px !important;
  }

  .f-opt-text {
    font-size: 16px !important;
  }

  /* Fixed bottom action bar in funnel */
  .f-nav {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sand);
    padding: 14px 24px !important;
    padding-bottom: calc(14px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    margin-top: 0 !important;
    z-index: 100;
  }
}

/* ── SAFE AREA (notched phones) ── */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── PRINT ── */
@media print {
  .mobile-bottom-nav, nav, .funnel-overlay {
    display: none !important;
  }
  body { padding-bottom: 0; }
}
