/* ============================================================
 * Macrition card depth layer
 * ============================================================
 *
 * Builds on enhancements.css. Addresses issues found by
 * vision-model audit of the live rendered pages:
 *
 * 1. Cookie banner, was blocking content on every page; now a
 * compact bottom-right toast that doesn't obstruct anything.
 * 2. Card depth, cards were still flat/invisible; stronger
 * shadows + visible borders + subtle inner light.
 * 3. Hero enhancement, deeper, richer gradient; glassmorphism
 * on the diary card; better ambient orb visibility.
 * 4. Dashboard spacing, tightened gap between hero and tabs;
 * better grid alignment; zero-state encouragement.
 * 5. Water widget, droplet-shaped glasses with fill animation.
 * 6. Calculator result, hero number with gradient text.
 * 7. Pricing card, better differentiation with scale + shadow.
 * 8. Button polish, gradient primary, tactile press.
 * 9. Navigation, cleaner, less cluttered.
 * 10. Section rhythm, alternating backgrounds for visual flow.
 *
 * Loaded AFTER enhancements.css.
 * ============================================================ */

/* ============================================================
 * 1. COOKIE BANNER, compact toast
 * ============================================================
 * Was a full-width bar blocking content. Now a compact toast.
 * (UI-AUDIT W12) The toast anchored bottom-RIGHT -
 * exactly where the Ask-AI FAB (.ai-fab, z-index 900,
 * bottom:24 right:24) and the back-to-top button live - and its
 * z-index 9999 buried both until the visitor dealt with consent.
 * Moved to bottom-LEFT and lowered to z 1050: above page content
 * and the FAB, still below modals (1100) and toasts (1200).
 * ============================================================ */
.cookie-banner,
.cookie-consent,
#cookieBanner,
#cookieConsent,
#nutriCookieBanner,
.nutri-cookie-banner,
.cookie-notice,
.cc-banner,
.cc-window {
  position: fixed !important;
  bottom: 16px !important;
  left: 16px !important;
  right: auto !important;
  top: auto !important;
  width: auto !important;
  max-width: 380px !important;
  margin: 0 !important;
  padding: 16px 20px !important;
  border-radius: 14px !important;
  background: var(--surface, #FFFFFF) !important;
  border: 1px solid var(--border, rgba(15,23,42,0.08)) !important;
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.10),
    0 16px 48px rgba(15, 23, 42, 0.06) !important;
  z-index: 1050 !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

/* (UI-AUDIT W12) Phones: the toast would span nearly the full
   viewport and cover the icon-only Ask-AI FAB (right:16, bottom:80, 48px
   wide). Keep the right 96px clear so the FAB column stays visible and
   tappable while consent is pending. */
@media (max-width: 600px) {
  .cookie-banner,
  .cookie-consent,
  #cookieBanner,
  #cookieConsent,
  #nutriCookieBanner,
  .nutri-cookie-banner,
  .cookie-notice,
  .cc-banner,
  .cc-window {
    max-width: calc(100vw - 96px) !important;
    padding: 12px 14px !important;
    font-size: 12px !important;
  }

  /* (S84) The mobile bottom navigation (injected by mobile-nav.js) owns
     the bottom band; lift the consent card above it so the Home/Tools
     tabs stay tappable while consent is pending. */
  body.mn-has-nav .cookie-banner,
  body.mn-has-nav .cookie-consent,
  body.mn-has-nav #cookieBanner,
  body.mn-has-nav #cookieConsent,
  body.mn-has-nav #nutriCookieBanner,
  body.mn-has-nav .nutri-cookie-banner,
  body.mn-has-nav .cookie-notice,
  body.mn-has-nav .cc-banner,
  body.mn-has-nav .cc-window {
    bottom: calc(64px + 12px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

.cookie-banner .cookie-actions,
.cookie-consent .cookie-actions,
.cookie-banner button,
.cookie-consent button {
  margin-top: 10px !important;
  width: 100% !important;
}

[data-theme="dark"] .cookie-banner,
[data-theme="dark"] .cookie-consent,
[data-theme="dark"] #cookieBanner,
[data-theme="dark"] #cookieConsent,
[data-theme="dark"] #nutriCookieBanner,
[data-theme="dark"] .nutri-cookie-banner {
  background: var(--surface, #1E293B) !important;
  border-color: var(--border, rgba(255,255,255,0.10)) !important;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 16px 48px rgba(0, 0, 0, 0.2) !important;
}

/* ============================================================
 * 2. CARD DEPTH, stronger shadows + visible borders
 * ============================================================
 * VLM said cards were "flat, pasted on, imperceptible shadows".
 * ============================================================ */
:root {
  --shadow-card:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 4px 12px rgba(15, 23, 42, 0.05),
    0 12px 32px rgba(15, 23, 42, 0.03);
  --shadow-card-hover:
    0 2px 8px rgba(15, 23, 42, 0.08),
    0 8px 24px rgba(15, 23, 42, 0.08),
    0 24px 56px rgba(15, 23, 42, 0.04);
  --border-card: rgba(15, 23, 42, 0.08);
  --border-card-hover: rgba(15, 23, 42, 0.14);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] {
  --shadow-card:
    0 1px 3px rgba(0, 0, 0, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.2),
    0 12px 32px rgba(0, 0, 0, 0.15);
  --shadow-card-hover:
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.25),
    0 24px 56px rgba(0, 0, 0, 0.15);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-card-hover: rgba(255, 255, 255, 0.16);
  --inner-light: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.calc-widget,
.dash-card,
.glass-surface,
.pricing-card,
.blog-card,
.calc-card,
.feature-card,
.goal-card,
.metric-card,
.admin-card,
.msg-card,
.sec-card,
.tool-card,
.stat-banner {
  background: var(--surface, #FFFFFF) !important;
  border: 1px solid var(--border-card) !important;
  box-shadow: var(--shadow-card), var(--inner-light) !important;
  transition:
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.calc-card[href]:hover,
.blog-card[href]:hover,
.feature-card[href]:hover,
.goal-card[href]:hover,
.tool-card[href]:hover,
.calc-widget.hover-lift:hover,
.dash-card.glass-surface-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover), var(--inner-light) !important;
  border-color: var(--border-card-hover) !important;
}

/* ============================================================
 * 3. HERO ENHANCEMENT, deeper gradient + glassmorphism
 * ============================================================
 * VLM said hero was "washed out, generic, flat, low-contrast".
 * ============================================================ */
.hero,
section.hero {
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 100%, rgba(34, 197, 94, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(251, 191, 36, 0.06) 0%, transparent 70%),
    var(--surface, #FFFFFF) !important;
  border-bottom: 1px solid var(--border-card) !important;
}

[data-theme="dark"] .hero,
[data-theme="dark"] section.hero {
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 80% 100%, rgba(34, 197, 94, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(251, 191, 36, 0.08) 0%, transparent 70%),
    var(--surface, #1E293B) !important;
}

/* Glassmorphism on the hero diary card */
.hero .ring-card,
.hero .hero-card,
.hero-visual .glass-surface {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  box-shadow:
    0 4px 16px rgba(15, 23, 42, 0.08),
    0 16px 48px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}

[data-theme="dark"] .hero .ring-card,
[data-theme="dark"] .hero .hero-card,
[data-theme="dark"] .hero-visual .glass-surface {
  background: rgba(30, 41, 59, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 16px 48px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* Hero headline gradient text */
.hero h1 {
  background: linear-gradient(135deg, var(--text, #0F172A) 0%, var(--primary, #6366F1) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, var(--text, #E2E8F0) 0%, var(--primary, #818CF8) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Hero stats row, give it a container */
.hero-stats {
  padding: 16px 0 !important;
  border-top: 1px solid var(--border-card) !important;
  margin-top: 8px !important;
}

.hero-stat strong {
  font-size: 24px !important;
  font-weight: 800 !important;
  color: var(--primary, #6366F1) !important;
}

/* ============================================================
 * 4. DASHBOARD SPACING, tighten gaps, align grid
 * ============================================================
 * VLM said "massive whitespace between Hero and Tabs".
 * ============================================================ */
.dash-container {
  padding-top: 20px !important;
}

.dash-hero {
  margin-bottom: 16px !important;
}

.dash-tabs {
  margin-bottom: 16px !important;
  position: sticky;
  top: var(--header-h, 60px);
  z-index: 50;
  background: var(--surface, #FFFFFF) !important;
  border-radius: 12px !important;
  border: 1px solid var(--border-card) !important;
  box-shadow: var(--shadow-card) !important;
  padding: 6px !important;
}

[data-theme="dark"] .dash-tabs {
  background: var(--surface, #1E293B) !important;
}

.dash-tab {
  border-radius: 8px !important;
  transition: all 180ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.dash-tab.active {
  background: var(--primary, #6366F1) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25) !important;
}

/* Zero-state encouragement, don't show stark 0s */
.ring-num:empty::before,
.ring-num:contains('0') {
  color: var(--text-muted, #94A3B8) !important;
}

/* Dashboard hero gradient enhancement */
.dash-hero {
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(34, 197, 94, 0.08) 0%, transparent 60%),
    var(--surface, #FFFFFF) !important;
  border: 1px solid var(--border-card) !important;
  box-shadow: var(--shadow-card) !important;
}

[data-theme="dark"] .dash-hero {
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(99, 102, 241, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(34, 197, 94, 0.10) 0%, transparent 60%),
    var(--surface, #1E293B) !important;
}

/* ============================================================
 * 5. WATER WIDGET, droplet styling
 * ============================================================
 * VLM said grey rectangles "look like wireframe placeholders".
 * ============================================================ */
.water-glass,
.water-cup,
.water-tracker-mini-fill {
  border-radius: 0 0 8px 8px !important;
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.25) 100%) !important;
  border: 1.5px solid rgba(14, 165, 233, 0.3) !important;
  border-top: none !important;
  transition: all 300ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.water-glass.filled,
.water-cup.filled,
.water-glass.active {
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.6) 0%, rgba(14, 165, 233, 0.8) 100%) !important;
  border-color: rgba(14, 165, 233, 0.5) !important;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.25) !important;
}

/* ============================================================
 * 6. CALCULATOR RESULT, hero number with gradient
 * ============================================================ */
.calc-result,
.result-panel,
.result-card,
.calc-result-hero {
  text-align: center;
  padding: 40px 24px 32px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.10) 0%, transparent 70%),
    var(--surface, #FFFFFF) !important;
  border-radius: 20px !important;
  border: 1px solid var(--border-card) !important;
  box-shadow: var(--shadow-card) !important;
  margin-bottom: 20px;
}

.calc-result .result-number,
.result-panel .result-value,
.result-card .big-number,
.calc-result-hero .result-number {
  font-family: 'Noto Serif SC', Georgia, serif !important;
  font-size: clamp(48px, 7vw, 80px) !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  letter-spacing: -0.02em !important;
  background: linear-gradient(135deg, var(--primary, #6366F1) 0%, var(--accent, #8B5CF6) 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  display: block;
  margin: 8px 0 !important;
}

[data-theme="dark"] .calc-result,
[data-theme="dark"] .result-panel,
[data-theme="dark"] .result-card {
  background:
    radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.14) 0%, transparent 70%),
    var(--surface, #1E293B) !important;
}

/* ============================================================
 * 7. PRICING CARD, better differentiation
 * ============================================================ */
.pricing-card.featured,
.pricing-card.popular,
.pricing-card.highlight {
  transform: scale(1.05);
  z-index: 2;
  position: relative;
  border: 2px solid var(--primary, #6366F1) !important;
  box-shadow:
    0 4px 16px rgba(99, 102, 241, 0.15),
    0 16px 48px rgba(99, 102, 241, 0.10),
    0 32px 80px rgba(99, 102, 241, 0.05) !important;
}

.pricing-card.featured::before,
.pricing-card.popular::before,
.pricing-card.highlight::before {
  content: '★ Most Popular';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary, #6366F1) 0%, var(--accent, #8B5CF6) 100%);
  color: white;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 18px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  white-space: nowrap;
}

.pricing-card .price,
.pricing-card .plan-price {
  font-family: 'Noto Serif SC', Georgia, serif !important;
  font-size: 42px !important;
  font-weight: 700 !important;
  color: var(--text, #0F172A) !important;
}

.pricing-card.featured .price,
.pricing-card.popular .price {
  background: linear-gradient(135deg, var(--primary, #6366F1) 0%, var(--accent, #8B5CF6) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 768px) {
  .pricing-card.featured,
  .pricing-card.popular,
  .pricing-card.highlight {
    transform: scale(1);
    margin: 20px 0;
  }
}

/* ============================================================
 * 8. BUTTON POLISH, gradient primary, tactile press
 * ============================================================ */
.btn-primary,
.btn-gradient {
  background: linear-gradient(135deg, var(--primary, #6366F1) 0%, var(--accent, #8B5CF6) 100%) !important;
  border: none !important;
  color: white !important;
  box-shadow:
    0 2px 8px rgba(99, 102, 241, 0.25),
    0 4px 16px rgba(99, 102, 241, 0.10) !important;
  transition:
    transform 120ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.btn-primary:hover,
.btn-gradient:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(99, 102, 241, 0.30),
    0 8px 24px rgba(99, 102, 241, 0.15) !important;
}

.btn-primary:active,
.btn-gradient:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(99, 102, 241, 0.20) !important;
}

/* ============================================================
 * 9. SECTION RHYTHM, alternating backgrounds
 * ============================================================ */
section:nth-of-type(even):not(.hero):not(.cta):not(.cookie-banner):not(.newsletter-section) {
  background: var(--bg-soft, #F8FAFC) !important;
}

section:nth-of-type(odd):not(.hero):not(.cta):not(.cookie-banner):not(.newsletter-section) {
  background: var(--bg, #FFFFFF) !important;
}

[data-theme="dark"] section:nth-of-type(even):not(.hero):not(.cta) {
  background: var(--bg-soft, #1E293B) !important;
}

[data-theme="dark"] section:nth-of-type(odd):not(.hero):not(.cta) {
  background: var(--bg, #0F172A) !important;
}

/* ============================================================
 * 10. FLOATING AI BUTTON, better styling
 * ============================================================ */
.ai-fab,
.floating-ai,
.ask-ai-fab,
#aiFab,
#askAi {
  /* (235-D Lock C) the !important positional pin RETIRED at the raw source
     (the REG-Z discipline): the pin fought the fab's own responsive grammar
     (ai-assistant.css) AND the save-bar yield — the fixed fab rendered ON
     the goals sticky save-bar at mobile widths (the D-235-02 delta catch).
     The fab geometry authority is ai-assistant.css + the save-bar yield
     (the layered 80px position value dies with its !important — the
     designed 24px/16px base restored). */
  bottom: 80px;
  right: 20px;
  box-shadow:
    0 4px 16px rgba(99, 102, 241, 0.30),
    0 8px 32px rgba(99, 102, 241, 0.15);
}

/* ============================================================
 * 11. NAVIGATION, cleaner, less cluttered
 * ============================================================ */
.site-header,
header.site-header {
  backdrop-filter: blur(12px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
  background: rgba(255, 255, 255, 0.85) !important;
  border-bottom: 1px solid var(--border-card) !important;
}

/* FIX: backdrop-filter creates a stacking context that clips
   position:fixed nav on mobile. Disable it at mobile widths. */
@media (max-width: 980px) {
  .site-header,
  header.site-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--surface, #FFFFFF) !important;
  }
}

[data-theme="dark"] .site-header,
[data-theme="dark"] header.site-header {
  background: rgba(15, 23, 42, 0.85) !important;
}

/* ============================================================
 * 12. MACRO RINGS, bigger, clearer
 * ============================================================ */
.macro-ring,
.macro-rings .macro-ring {
  position: relative;
}

.macro-ring .value {
  font-weight: 700 !important;
  font-size: 14px !important;
}

.macro-ring .label {
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  color: var(--text-muted, #64748B) !important;
}

/* ============================================================
 * 13. STAT BANNER, give it a container
 * ============================================================ */
.stat-banner {
  padding: 32px !important;
  border-radius: 20px !important;
}

.stat-banner .item .num,
.stat-banner .glass-stat .num {
  font-family: 'Noto Serif SC', Georgia, serif !important;
  font-size: 36px !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg, var(--primary, #6366F1) 0%, var(--accent, #8B5CF6) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============================================================
 * 14. REDUCED MOTION
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
 * 15. BODY PADDING, prevent cookie banner overlap
 * ============================================================
 * Cookie banner is fixed at bottom-right (max 380px wide,
 * ~72px tall when action buttons stack). Without body padding,
 * it can overlap footer links and bottom-of-page content.
 * Add bottom padding so the banner never covers interactive
 * elements near the page bottom.
 * ============================================================ */
body {
  padding-bottom: 72px !important;
}

/* ============================================================
 * FIX: Mobile hamburger menu, nav was constrained by parent.container height
 * The.container has display:flex and height:56px, which clips the absolute-positioned
 * nav dropdown. Fix: when nav is open at mobile widths, set explicit height auto.
 * ============================================================ */
@media (max-width: 980px) {
  .main-nav {
    position: absolute !important;
    top: 100% !important;
    /* Reset bottom: the design-system <=980px sheet variant ships
       bottom:0; together with height:auto + top:100% the resolved
       height becomes 0 + padding (25px sliver). See critical-fixes.css. */
    bottom: auto !important;
    left: 0 !important;
    right: 0 !important;
    height: auto !important;
    max-height: calc(100vh - 60px) !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    background: var(--surface, #FFFFFF) !important;
    border-bottom: 1px solid var(--border, rgba(15,23,42,0.08)) !important;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12) !important;
    padding: 12px 0 !important;
  }
  
  .main-nav.open {
    display: flex !important;
    flex-direction: column !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }
  
  .main-nav:not(.open) {
    display: none !important;
  }
  
  .main-nav > a {
    display: flex !important;
    width: 100% !important;
    padding: 14px 24px !important;
    font-size: 15px !important;
    border-radius: 0 !important;
  }
  
  .main-nav > a:hover {
    background: var(--primary-50, rgba(99, 102, 241, 0.06)) !important;
  }
  
  .menu-toggle {
    display: flex !important;
    z-index: 1001 !important;
  }
  
  .site-header .container {
    overflow: visible !important;
    height: auto !important;
    min-height: 56px !important;
  }
}
