/*
 * Gavi Connect design system — canonical CSS variables.
 *
 * Source of truth: Lovable project "Gavi Calm Connect".
 * Every page in the suite — marketing site, /app, /portal, Jitsi overlay —
 * imports this file and references only these variables. Never hardcode a hex.
 *
 * The token names mirror shadcn's (background / foreground / primary /
 * secondary / muted / accent / border / ring) plus a small Gavi extension
 * set (moss, moss-soft, clay, stage, record) for surfaces the base shadcn
 * palette doesn't cover.
 *
 * Colors are in oklch to keep perceptual lightness consistent as the accent
 * ramp shifts. Two themes live here: light is the default, dark takes over
 * under either `prefers-color-scheme: dark` OR `data-theme="dark"` on :root.
 * A theme-toggle should stamp `data-theme="light" | "dark"` on <html> so
 * user override wins over the OS preference in both directions.
 */

:root {
  /* -- Type ------------------------------------------------------- */
  --gc-font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --gc-font-sans:    "Instrument Sans", ui-sans-serif, system-ui, sans-serif;

  --gc-text-xs:   0.75rem;    /* 12 */
  --gc-text-sm:   0.875rem;   /* 14 */
  --gc-text-base: 1rem;       /* 16 */
  --gc-text-lg:   1.25rem;    /* 20 */
  --gc-text-xl:   1.75rem;    /* 28 */
  --gc-text-2xl:  2.5rem;     /* 40 */
  --gc-text-3xl:  3.5rem;     /* 56 */
  --gc-text-4xl:  4.5rem;     /* 72 */

  /* -- Radii ------------------------------------------------------ */
  --gc-radius-sm:   8px;
  --gc-radius-md:   12px;
  --gc-radius-lg:   16px;    /* default card corner */
  --gc-radius-xl:   24px;    /* surfaces, video tiles */
  --gc-radius-2xl:  32px;
  --gc-radius-pill: 999px;   /* CTAs + toolbars */

  /* -- Shadows ---------------------------------------------------- */
  --gc-shadow-1: 0 1px 2px oklch(0.2 0.03 60 / 0.06);
  --gc-shadow-2: 0 4px 12px -2px oklch(0.2 0.03 60 / 0.1);
  --gc-shadow-3: 0 12px 32px -8px oklch(0.2 0.03 60 / 0.16);
  --gc-shadow-4: 0 28px 64px -16px oklch(0.2 0.03 60 / 0.28);

  /* -- Palette (light) — warm cream ground, mossy-green accent ---- */
  --gc-background:           oklch(0.965 0.012 85);
  --gc-foreground:           oklch(0.22 0.014 60);
  --gc-card:                 oklch(0.99 0.006 90);
  --gc-card-foreground:      oklch(0.22 0.014 60);
  --gc-popover:              oklch(0.99 0.006 90);
  --gc-popover-foreground:   oklch(0.22 0.014 60);
  --gc-primary:              oklch(0.43 0.075 140);
  --gc-primary-foreground:   oklch(0.975 0.012 100);
  --gc-secondary:            oklch(0.925 0.016 88);
  --gc-secondary-foreground: oklch(0.28 0.016 60);
  --gc-muted:                oklch(0.93 0.014 88);
  --gc-muted-foreground:     oklch(0.475 0.016 62);
  --gc-accent:               oklch(0.905 0.03 130);
  --gc-accent-foreground:    oklch(0.3 0.05 140);
  --gc-destructive:          oklch(0.51 0.16 28);
  --gc-destructive-foreground: oklch(0.98 0.01 90);
  --gc-border:               oklch(0.885 0.016 85);
  --gc-input:                oklch(0.885 0.016 85);
  --gc-ring:                 oklch(0.43 0.075 140);

  /* Gavi-specific extension palette. */
  --gc-stage:                oklch(0.19 0.012 55);   /* in-call dark surface */
  --gc-stage-foreground:     oklch(0.955 0.01 90);
  --gc-tile:                 oklch(0.26 0.014 58);   /* participant tile */
  --gc-moss:                 oklch(0.43 0.075 140);  /* tenant-overridable brand */
  --gc-moss-soft:            oklch(0.66 0.09 138);
  --gc-clay:                 oklch(0.62 0.06 70);    /* secondary warm accent */
  --gc-record:               oklch(0.55 0.18 25);    /* recording dot / leave */
}

@media (prefers-color-scheme: dark) {
  :root {
    --gc-background:           oklch(0.175 0.012 58);
    --gc-foreground:           oklch(0.955 0.01 90);
    --gc-card:                 oklch(0.225 0.013 58);
    --gc-card-foreground:      oklch(0.955 0.01 90);
    --gc-popover:              oklch(0.235 0.013 58);
    --gc-popover-foreground:   oklch(0.955 0.01 90);
    --gc-primary:              oklch(0.68 0.095 138);
    --gc-primary-foreground:   oklch(0.19 0.03 140);
    --gc-secondary:            oklch(0.27 0.014 58);
    --gc-secondary-foreground: oklch(0.945 0.01 90);
    --gc-muted:                oklch(0.27 0.014 58);
    --gc-muted-foreground:     oklch(0.735 0.014 85);
    --gc-accent:               oklch(0.31 0.032 140);
    --gc-accent-foreground:    oklch(0.9 0.05 138);
    --gc-destructive:          oklch(0.62 0.17 26);
    --gc-destructive-foreground: oklch(0.98 0.01 90);
    --gc-border:               oklch(0.33 0.014 60);
    --gc-input:                oklch(0.33 0.014 60);
    --gc-ring:                 oklch(0.68 0.095 138);

    --gc-stage:                oklch(0.155 0.012 55);
    --gc-stage-foreground:     oklch(0.955 0.01 90);
    --gc-tile:                 oklch(0.235 0.013 58);
    --gc-moss:                 oklch(0.68 0.095 138);
    --gc-moss-soft:            oklch(0.78 0.08 138);
    --gc-clay:                 oklch(0.72 0.06 72);
    --gc-record:               oklch(0.64 0.18 26);
  }
}

/* Explicit theme override — wins over the media query in both directions
 * so a user toggle sticks. */
:root[data-theme="dark"] {
  --gc-background:           oklch(0.175 0.012 58);
  --gc-foreground:           oklch(0.955 0.01 90);
  --gc-card:                 oklch(0.225 0.013 58);
  --gc-card-foreground:      oklch(0.955 0.01 90);
  --gc-popover:              oklch(0.235 0.013 58);
  --gc-popover-foreground:   oklch(0.955 0.01 90);
  --gc-primary:              oklch(0.68 0.095 138);
  --gc-primary-foreground:   oklch(0.19 0.03 140);
  --gc-secondary:            oklch(0.27 0.014 58);
  --gc-secondary-foreground: oklch(0.945 0.01 90);
  --gc-muted:                oklch(0.27 0.014 58);
  --gc-muted-foreground:     oklch(0.735 0.014 85);
  --gc-accent:               oklch(0.31 0.032 140);
  --gc-accent-foreground:    oklch(0.9 0.05 138);
  --gc-destructive:          oklch(0.62 0.17 26);
  --gc-destructive-foreground: oklch(0.98 0.01 90);
  --gc-border:               oklch(0.33 0.014 60);
  --gc-input:                oklch(0.33 0.014 60);
  --gc-ring:                 oklch(0.68 0.095 138);
  --gc-stage:                oklch(0.155 0.012 55);
  --gc-stage-foreground:     oklch(0.955 0.01 90);
  --gc-tile:                 oklch(0.235 0.013 58);
  --gc-moss:                 oklch(0.68 0.095 138);
  --gc-moss-soft:            oklch(0.78 0.08 138);
  --gc-clay:                 oklch(0.72 0.06 72);
  --gc-record:               oklch(0.64 0.18 26);
}
:root[data-theme="light"] {
  --gc-background:           oklch(0.965 0.012 85);
  --gc-foreground:           oklch(0.22 0.014 60);
  --gc-card:                 oklch(0.99 0.006 90);
  --gc-card-foreground:      oklch(0.22 0.014 60);
  --gc-popover:              oklch(0.99 0.006 90);
  --gc-popover-foreground:   oklch(0.22 0.014 60);
  --gc-primary:              oklch(0.43 0.075 140);
  --gc-primary-foreground:   oklch(0.975 0.012 100);
  --gc-secondary:            oklch(0.925 0.016 88);
  --gc-secondary-foreground: oklch(0.28 0.016 60);
  --gc-muted:                oklch(0.93 0.014 88);
  --gc-muted-foreground:     oklch(0.475 0.016 62);
  --gc-accent:               oklch(0.905 0.03 130);
  --gc-accent-foreground:    oklch(0.3 0.05 140);
  --gc-destructive:          oklch(0.51 0.16 28);
  --gc-destructive-foreground: oklch(0.98 0.01 90);
  --gc-border:               oklch(0.885 0.016 85);
  --gc-input:                oklch(0.885 0.016 85);
  --gc-ring:                 oklch(0.43 0.075 140);
  --gc-stage:                oklch(0.19 0.012 55);
  --gc-stage-foreground:     oklch(0.955 0.01 90);
  --gc-tile:                 oklch(0.26 0.014 58);
  --gc-moss:                 oklch(0.43 0.075 140);
  --gc-moss-soft:            oklch(0.66 0.09 138);
  --gc-clay:                 oklch(0.62 0.06 70);
  --gc-record:               oklch(0.55 0.18 25);
}

/* Utility: warm stage gradient behind hero + in-call. */
.gc-stage-gradient {
  background:
    radial-gradient(120% 80% at 15% 0%, color-mix(in oklab, var(--gc-moss) 16%, transparent), transparent 60%),
    radial-gradient(100% 70% at 90% 100%, color-mix(in oklab, var(--gc-clay) 14%, transparent), transparent 62%),
    var(--gc-stage);
}

/* Utility: translucent glass toolbar. Backdrop-filter blur — the pill bar. */
.gc-glass-bar {
  background: color-mix(in oklab, var(--gc-stage) 62%, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid color-mix(in oklab, var(--gc-stage-foreground) 14%, transparent);
}

/* Utility: 44×44 tap-target minimum for mobile controls. */
.gc-tap { min-height: 44px; min-width: 44px; }

/* Reduced motion — every animated utility should be safe. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
