/* Robust Design System Tokens — Odrifit
   Reference: DESIGN-SYSTEM.md
   This file is auto-generated. Do not edit manually — update DESIGN-SYSTEM.md instead.
*/

:root {
  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 1. COLORS — Base + Semantic + States */
  /* ═══════════════════════════════════════════════════════════════════════ */

  /* Base Colors — reconciled to the Figma design library (Project Beanie file,
     240:3469): Highlight 1 / Highlight 2 / Background / Surface 1-4 / Text. */
  --primary: #26ffe6;              /* Figma "Highlight 1" — text, icons, strokes, focus rings */
  --primary-rgb: 38, 255, 230;
  --primary-fill: #2fd6c3;         /* dulled teal for filled SURFACES (buttons, FAB, filled toggles) — the neon is too bright as a fill */
  --primary-ink: #073b35;          /* dark teal text/icon on a --primary(-fill) fill (AAA) */
  --bg: #0d0d0d;                   /* Figma "Background" */
  --card-bg: #111817;              /* Figma "Surface 1" */
  --card-bg-alt: #071d1a;          /* Figma "Surface 2" */
  --surface-teal: #0a3d37;         /* Figma "Surface 4" — filled teal cards/chips */
  --surface-teal-rgb: 10, 61, 55;
  --onboard-bg: #1b1e1d;           /* warm dark — onboarding welcome + chat screens (Figma 240:2600) */
  --onboard-user-bubble: #2d3030;  /* onboarding chat: the user's reply bubble */
  --input-bg: #131c1b;
  --input-bg-focus: #1e2b29;
  --header-bg: rgba(17, 24, 23, 0.82); /* frosted sticky app header (Surface 1) */
  --border: rgba(255, 255, 255, 0.06);
  /* Neutral square icon-tile background (list rows / tiles) — deliberately
     NOT tinted to the icon's own color (unlike --surface-teal chips); the
     icon itself carries the color, popping against a quiet neutral surface.
     See DESIGN-SYSTEM.md icon-tile pattern, applied to .recs-tile__icon /
     .log-chat__opt-icon. */
  --icon-tile-bg: rgba(255, 255, 255, 0.06);
  /* Chart bars — same values as iOS Theme.chartBarNeutral / cycleFollicular
     (design/tokens.json), for the weight chart's Start / Down bars. */
  --chart-bar-neutral: #6b7373;
  --cycle-follicular: #1f7a70;
  --text: #d3dfdd;                 /* softened from #ebf7f5 — the near-white read
                                     too hot in a dim room. Still ~13:1 on --bg
                                     and a clear step above --text-muted. */
  --text-muted: #96afac;           /* nudged with --text so the primary/secondary
                                     gap stays legible */
  --text-faint: #79817f;

  /* Semantic Colors */
  --success: #4ade80;
  --success-dim: rgba(74, 222, 128, 0.08);
  --error: #ff5a4d;                /* Figma "Highlight 2" — also the coral ring accent */
  --error-rgb: 255, 90, 77;
  --error-dim: rgba(255, 90, 77, 0.08);
  --error-strong: #c62828; /* darker red — passes AA (≈5.5:1) with white text */
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.08);
  --info: #64b4ff;
  --info-dim: rgba(100, 180, 255, 0.08);

  /* Interactive State Colors */
  --primary-hover: rgba(var(--primary-rgb), 0.85);
  --primary-active: rgba(var(--primary-rgb), 0.7);
  --primary-disabled: rgba(var(--primary-rgb), 0.4);
  --text-disabled: rgba(255, 255, 255, 0.5);
  --text-placeholder: rgba(255, 255, 255, 0.3);

  /* Scrollbar — deliberately near-invisible, never tinted. */
  --scrollbar-thumb: rgba(255, 255, 255, 0.08);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.16);

  /* BMI Scale Pointer */
  --pointer: #ff5a4d;

  /* Legacy Aliases (backward compatibility) */
  --accent: var(--primary);
  --accent-dim: rgba(var(--primary-rgb), 0.08);
  --accent-soft: rgba(var(--primary-rgb), 0.6);

  /* Data-viz / artefact palette */
  --metric-protein: #FFD700;
  --metric-protein-rgb: 255, 215, 0;
  --metric-steps: #39FF14;
  --metric-steps-rgb: 57, 255, 20;
  --metric-water: #1E90FF;
  --metric-water-rgb: 30, 144, 255;
  --metric-period: #FF477E;
  --metric-period-rgb: 255, 71, 126;
  --macro-carbs: #5eead4;
  --macro-fats: #3d7d75;
  --bmi-zone-1: #3d7d75;
  --bmi-zone-3: #d4a04a;
  --bmi-zone-4: #d65656;

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 2. TYPOGRAPHY — Scale + Families + States */
  /* ═══════════════════════════════════════════════════════════════════════ */

  /* Font Families */
  --font-sans: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  /* Hero numbers only — ring value, weight, BMI, calories, macro grams, big-rock
     value, calendar day. Numbers inside sentences stay --font-sans. League Spartan
     ships one weight here (700); it reads as the "Bold" numeric display face. */
  --font-numeric: "League Spartan", var(--font-sans);

  /* Type Scale (mobile baseline) — single source of hierarchy.
     Readability floor = 11px (nothing renders smaller). */
  /* Bumped ~20% across the board (2026-09-05) for a more modern, less
     cramped feel — founder ask, applied via tokens so it propagates
     everywhere without touching individual rules. */

  /* Display headings (above the body scale) */

  /* Big metric / hero numbers (BMI value, steps count, stat values) */
  /* ── Type ramp (Figma: Header/Title/Body/Caption 1-3). Canonical. ── */
  --type-header-1: 40px;   /* ExtraBold 1.1  — one per screen */
  --type-header-2: 30px;   /* ExtraBold 1.1  — metric values */
  --type-header-3: 24px;   /* ExtraBold 1.2  — screen titles */
  --type-title-1: 20px;    /* Bold 1.2       — section headings */
  --type-title-2: 17px;    /* Bold 1.35      — card titles */
  --type-title-3: 15px;    /* SemiBold 1.35  — emphasised single line */
  --type-body-1: 17px;     /* Medium 1.5     — default body; input floor (iOS no-zoom) */
  --type-body-2: 15px;     /* Medium 1.5     — secondary body */
  --type-body-3: 13px;     /* Medium 1.5     — dense body */
  --type-caption-1: 13px;  /* SemiBold 1.4   — labels */
  --type-caption-2: 12px;  /* Bold 1.2 UPPER — eyebrows */
  --type-caption-3: 11px;  /* Medium 1.4     — floor */

  /* ── Legacy aliases → the ramp above. Fuzzy-matched to the NEAREST ramp value,
     constrained to stay non-increasing so hierarchy can flatten but never invert.
     Migrate call sites to the canonical names, then delete this block. ── */
  --type-display-3: var(--type-header-1);    /* 50 -> 40 */
  --type-display-2: var(--type-header-1);    /* 43 -> 40 */
  --type-hero:      var(--type-header-1);    /* 38 -> 40 */
  --type-display:   var(--type-header-2);    /* 34 -> 30 */
  --type-2xl:       var(--type-header-2);    /* 29 -> 30 */
  --type-xl:        var(--type-header-3);    /* 26 -> 24 */
  --type-lg:        var(--type-title-1);    /* 22 -> 20 */
  --type-base:      20px;                  /* 19 -> 20 (nearest). Pinned, NOT var(--type-title-1):
                                              base is body-lead + inputs and must not inherit a
                                              title's responsive step-up to 24px. */
  --type-body:      var(--type-body-1);    /* 17 -> 17 */
  --type-md:        var(--type-body-2);    /* 16 -> 15 */
  --type-sm:        var(--type-body-3);    /* 14 -> 13 */
  --type-xs:        var(--type-caption-1);    /* 13 -> 13 */
  --type-xxs:       var(--type-caption-1);    /* 13 -> 13 */
  --type-num-sm:    var(--type-header-2);    /* 31 -> 30 */
  --type-num-md:    var(--type-header-1);    /* 46 -> 40 */
  --type-num-lg:    var(--type-header-1);    /* 58 -> 40 */
  --type-num-xl:    var(--type-header-1);    /* 65 -> 40 */
  --type-num-2xl:   var(--type-header-1);    /* 77 -> 40 */
  --input-size:     20px;                  /* 19 -> 20. Pinned for the same reason; clears the
                                              16px iOS focus-zoom threshold. */

  /* Font Weights (explicit, no magic numbers) */
  --weight-regular: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;

  /* Line Heights (per size) */
  --line-display: 1.1;
  --line-heading: 1.2;
  --line-title: 1.35;
  --line-body: 1.5;
  --line-caption: 1.4;
  --line-label: 1.2;

  /* Text Colors (by semantic role) */
  --text-primary: var(--text);
  --text-secondary: var(--text-muted);
  --text-tertiary: var(--text-faint);
  --text-inverse: #0d0d0d;

  /* Input Font Size (16px prevents iOS zoom) */

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 3. SPACING — Modular 4px Scale (also bumped ~20%, see type-scale note above) */
  /* ═══════════════════════════════════════════════════════════════════════ */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 20px;
  --space-5: 24px;
  --space-6: 28px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 44px;
  --space-10: 48px;
  --space-11: 52px;
  --space-12: 56px;
  --space-13: 64px;
  --space-14: 68px;
  --space-16: 76px;

  /* Section rhythm (Apple Health-style): a tight gap from a section header to
     its first card, a wide gap from a block down to the next section header. */
  --section-header-gap: var(--space-3);   /* 12px — header → first card */
  --section-gap: var(--space-8);          /* 40px — block → next section header */

  /* Negative Spacing (overlaps) */
  --space-neg-1: -4px;
  --space-neg-2: -8px;
  --space-neg-3: -12px;

  /* Responsive Section Padding */
  --section-padding: var(--space-4);
  --section-gap: var(--space-6);

  /* Container Widths */
  --container-mobile: 100%;
  --container-tablet: 90vw;
  --container-desktop: 1200px;

  /* Container Padding */
  --container-padding-mobile: var(--space-4);
  --container-padding-tablet: var(--space-6);
  --container-padding-desktop: var(--space-8);

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 4. BORDERS & RADIUS */
  /* ═══════════════════════════════════════════════════════════════════════ */

  /* Radius Scale */
  --radius-none: 0;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;   /* standard card radius — nudged 16→18 toward Apple Health */
  --radius-xl: 24px;
  --radius-2xl: 28px;
  --radius-pill: 20px;
  --radius-full: 9999px;

  /* Border Widths */
  --border-thin: 1px;
  --border-accent: 2px;
  --border-thick: 3px;

  /* Border Variants */
  --border-default: 1px solid var(--border);
  --border-strong: 1px solid rgba(255, 255, 255, 0.12);

  /* Control borders. NOTE: --border-strong above is a *shorthand* (white 12%);
     these two are COLOURS and are a different scale entirely.
     --border-control is the outlined-button stroke — it replaces a hardcoded
     #666666, which is exactly white 40% over --bg. 3.81:1, clears WCAG 1.4.11.
     --border-disabled replaces disabled outlines drawn at --border (white 6%),
     which measured 1.14:1 — invisible. */
  --border-control:  rgba(255, 255, 255, 0.40);
  --border-disabled: rgba(255, 255, 255, 0.24);
  --border-accent: 2px solid var(--primary);
  --border-error: 1px solid var(--error);

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 5. SHADOWS & ELEVATION */
  /* ═══════════════════════════════════════════════════════════════════════ */

  --shadow-none: none;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.25);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.1);

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 6. Z-INDEX STACK */
  /* ═══════════════════════════════════════════════════════════════════════ */

  --z-hide: -1;
  --z-base: 0;
  --z-sticky: 10;
  --z-dropdown: 100;
  --z-fixed: 150;
  --z-modal-bg: 190;
  --z-modal: 200;
  --z-tooltip: 300;
  --z-notification: 400;

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 7. ANIMATIONS & TRANSITIONS */
  /* ═══════════════════════════════════════════════════════════════════════ */

  /* Transition Speeds */
  --transition-instant: 0.08s ease;
  --transition-fast: 0.15s ease;
  --transition-md: 0.25s ease-in-out;
  --transition-slow: 0.5s ease-out;
  --transition-very-slow: 0.8s ease-out;

  /* Easing Functions */
  --easing-in: ease-in;
  --easing-out: ease-out;
  --easing-in-out: ease-in-out;
  --easing-smooth: cubic-bezier(0.32, 0.72, 0, 1);
  --easing-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --easing-sharp: cubic-bezier(0.4, 0, 0.2, 1);

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 8. COMPONENT STATES — Buttons, Inputs, Cards */
  /* ═══════════════════════════════════════════════════════════════════════ */

  /* Button States */
  --btn-bg: var(--primary);
  /* Text that sits on a teal/accent fill. Dark by default — the bright dark-mode
     teal needs #1a1a1a (7.2:1, AAA) per the primary-CTA rule. The light theme
     uses a deeper teal where white text is the legible choice (see .theme-light). */
  --btn-text: #1a1a1a;
  --btn-bg-hover: var(--primary-hover);
  --btn-bg-active: var(--primary-active);
  --btn-bg-disabled: rgba(var(--primary-rgb), 0.3);
  --btn-text-disabled: var(--text-disabled);
  --btn-cursor-disabled: not-allowed;

  /* Input States */
  --input-border: var(--border);
  --input-text: var(--text);
  --input-border-focus: var(--primary);
  --input-shadow-focus: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
  --input-bg-error: rgba(214, 86, 86, 0.05);
  --input-border-error: var(--error);
  --input-bg-disabled: rgba(255, 255, 255, 0.03);

  /* Card States */
  --card-shadow: var(--shadow-none);
  --card-shadow-hover: var(--shadow-sm);
  --card-cursor-hover: pointer;
  --card-border-active: var(--border-accent);

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 9. ACCESSIBILITY & INTERACTION */
  /* ═══════════════════════════════════════════════════════════════════════ */

  /* Touch Targets */
  --touch-min: 44px;
  --touch-min-desktop: 40px;
  --touch-spacing: 8px;

  /* Focus Indicators */
  --focus-ring: 2px solid var(--primary);
  --focus-ring-offset: 2px;
  --focus-style: outline var(--focus-ring) var(--focus-ring-offset);

  /* Disabled / Reduced Motion */
  --opacity-disabled: 0.5;
  --cursor-disabled: not-allowed;

  /* ═══════════════════════════════════════════════════════════════════════ */
  /* 10. RESPONSIVE BREAKPOINTS */
  /* ═══════════════════════════════════════════════════════════════════════ */

  --bp-mobile: 375px;
  --bp-tablet: 540px;
  --bp-desktop: 768px;
  --bp-wide: 1024px;

  /* Sticky app header height (44px content + 2×28px padding, plus the safe-area
     inset added to its top padding) — used to offset other sticky elements
     (e.g. the viewing banner) so they stack below it. */
  --app-header-h: calc(100px + env(safe-area-inset-top));
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* REDUCED MOTION SUPPORT (WCAG Compliance) */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* HIGH CONTRAST MODE SUPPORT */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (prefers-contrast: more) {
  :root {
    --text: #ebf7f5;              /* full brightness back for high-contrast users */
    --text-muted: #e0e8ea;
    --text-faint: #c0c8ca;
    --border: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* TABLET ADJUSTMENTS (min-width: 540px) */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 540px) {
  :root {
    /* Slightly larger typography on tablet — was --type-lg / --type-md */
    --type-title-1: 24px;
    --type-body-2: 17px;

    /* More breathing room */
    --section-padding: var(--space-5);
    --section-gap: var(--space-8);

    /* Container adjustments */
    --container-padding-tablet: var(--space-6);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* DESKTOP ADJUSTMENTS (min-width: 768px) */
/* ═══════════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
  :root {
    /* Full typography scale — was --type-xl / --type-lg / --type-md */
    --type-header-3: 29px;
    --type-title-1: 24px;
    --type-body-2: 17px;

    /* Spacious layout */
    --section-padding: var(--space-6);
    --section-gap: var(--space-10);

    /* Relaxed touch target on desktop */
    --touch-min: var(--touch-min-desktop);

    /* Container sizing */
    --container-padding-desktop: var(--space-8);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* LIGHT THEME — opt-in "Light" appearance (Settings → Appearance)               */
/* Applied via :root.theme-light (on <html>) so derived tokens (--accent,        */
/* --text-primary, button/input/card states) re-resolve to the light palette.    */
/* The dark theme is the default (no class).                                     */
/*                                                                                */
/* Teal is deepened #1abc9c → #0d9488 (teal-600) for light surfaces. That one    */
/* shade satisfies BOTH constraints we have: dark (#1a1a1a) text on a teal CTA    */
/* fill = 4.65:1 (AA), and teal-as-accent text/icons on white = 3.75:1 (AA large/ */
/* bold — how our accents are actually used). No per-CTA overrides needed.        */
/* ═══════════════════════════════════════════════════════════════════════════ */
:root.theme-light {
  /* Surfaces — soft off-white base, white cards lifted above it */
  --bg:             #f3f6f6;
  --card-bg:        #ffffff;
  --card-bg-alt:    #eef3f3;
  --input-bg:       #eef2f2;
  --input-bg-focus: #e2e9e9;
  --header-bg:      rgba(255, 255, 255, 0.82); /* light frosted header */
  --border:         rgba(13, 23, 23, 0.10);
  --icon-tile-bg:   rgba(13, 23, 23, 0.06);

  /* Text — near-black (slightly teal-tinted), all AA+ on white */
  --text:        #0d1717;
  --text-muted:  #4a5658;   /* 7.1:1 on white */
  --text-faint:  #6b7678;   /* 4.7:1 on white */
  --text-inverse:#ffffff;   /* text on dark/colored fills */

  /* Brand — deep teal (teal-700) for a rich, high-contrast read on white:
     5.47:1 as accent text/icons (AA). At this depth dark text on a teal CTA
     fill fails, so --btn-text flips to white (5.47:1) for light mode. */
  --primary: #0f766e;
  --primary-rgb: 15, 118, 110;
  --primary-fill: #0d6b63;   /* already deep on light mode — only a hair duller */
  --pointer: #e23b3b;

  /* Interactive text states (on light) */
  --text-disabled:    rgba(13, 23, 23, 0.40);
  --text-placeholder: rgba(13, 23, 23, 0.35);

  /* Semantic — darkened so they're legible on light surfaces */
  --success:     #15803d;
  --success-dim: rgba(21, 128, 61, 0.10);
  --error:       #c62828;
  --error-dim:   rgba(198, 40, 40, 0.08);
  --warning:     #b45309;
  --warning-dim: rgba(180, 83, 9, 0.10);
  --info:        #1d6fd0;
  --info-dim:    rgba(29, 111, 208, 0.10);

  /* Borders that reference white-on-dark opacities → flip to black-on-light */
  --border-strong: 1px solid rgba(13, 23, 23, 0.16);
  --border-control:  rgba(13, 23, 23, 0.42);
  --border-disabled: rgba(13, 23, 23, 0.26);

  /* Data-viz / artefact palette — neon-on-dark hues darkened for light cards */
  --metric-protein: #c79100;
  --metric-protein-rgb: 199, 145, 0;
  --metric-steps: #16a34a;
  --metric-steps-rgb: 22, 163, 74;
  --metric-water: #1577d4;
  --metric-water-rgb: 21, 119, 212;
  --metric-period: #d6336c;
  --metric-period-rgb: 214, 51, 108;
  --macro-carbs: #0f9b8a;
  --macro-fats: #3d7d75;
  --bmi-zone-1: #2f8d82;
  --bmi-zone-3: #c47f1a;
  --bmi-zone-4: #c62828;

  /* Cards: faint borders on light need a soft lift to separate from the bg */
  --card-shadow: 0 1px 3px rgba(13, 23, 23, 0.06), 0 1px 2px rgba(13, 23, 23, 0.04);

  /* Deep teal fill needs white text (dark text would be 3.18:1) */
  --btn-text: #ffffff;
}

