/* ==========================================================================
   DESIGN TOKENS — modern, future-capable system
   Mobile-first. Prefer these vars everywhere; progressive @supports below.
   ========================================================================== */

:root {
  /* ---------- Color primitives (sRGB fallbacks) ---------- */
  --hue-brand: 214;
  --hue-success: 160;
  --hue-accent: 330;
  --hue-warm: 32;

  --blue-300: #9ec5ff;
  --blue-400: #7cb1ff;
  --blue-500: #5b9dff;
  --blue-600: #3b82f6;
  --blue-700: #2563eb;

  --green-400: #34d399;
  --green-500: #10b981;
  --green-600: #059669;

  --ink-0: #ffffff;
  --ink-100: #f4f7fb;
  --ink-200: #e8eef7;
  --ink-300: #b6c4d8;
  --ink-400: #94a3b8;
  --ink-900: #0b1220;
  --ink-950: #00212f;

  /* ---------- Semantic color ---------- */
  --color-primary: var(--blue-300);
  --color-primary-dark: var(--blue-500);
  --color-success: var(--green-500);
  --color-danger: #f87171;
  --color-warning: #fbbf24;

  --text-primary: var(--ink-0);
  --text-secondary: var(--ink-200);
  --text-muted: var(--ink-300);
  --text-inverse: var(--ink-950);

  --bg-page: var(--ink-950);
  --bg-card: rgba(0, 30, 58, 0.68);           /* bumped from 0.42 for readability */
  --bg-card-elevated: rgba(15, 23, 42, 0.82); /* bumped from 0.72 */
  --bg-overlay: rgba(0, 0, 0, 0.65);
  --bg-glass: color-mix(in srgb, var(--ink-900) 55%, transparent);

  --border-subtle: color-mix(in srgb, white 22%, transparent);  /* was 14%, lifted for a11y */
  --border-strong: color-mix(in srgb, white 32%, transparent);  /* was 22% */
  --border-focus: color-mix(in srgb, var(--blue-400) 70%, white);

  --bg-social-blue-base: color-mix(in srgb, var(--blue-400) 14%, transparent);
  --bg-social-blue-hover: color-mix(in srgb, var(--blue-400) 28%, transparent);
  --border-social-blue: color-mix(in srgb, var(--blue-400) 28%, transparent);

  --bg-social-green-base: color-mix(in srgb, var(--green-500) 14%, transparent);
  --bg-social-green-hover: color-mix(in srgb, var(--green-500) 28%, transparent);
  --border-social-green: color-mix(in srgb, var(--green-500) 28%, transparent);

  /* ---------- Layout / composition (fluid — mobile entryway first) ---------- */
  --card-max-width: min(34rem, 92vw);
  --card-width: min(92vw, 86dvw, var(--card-max-width));
  --social-grid-max: min(100%, 16rem);
  --social-cell: clamp(2.35rem, 13cqi, 3.35rem);
  --logo-size: clamp(3.5rem, 9.5vmin + 0.55rem, 6.25rem);
  --logo-inset: max(0.7rem, var(--safe-top), 2.4vmin);
  --logo-clear: calc(var(--logo-inset) + var(--logo-size) + 1.25rem);
  --content-max: 40rem;
  --prose-max: 36rem;

  /* Base plate behind logo — same glass as the contact card */
  --logo-plate-outset: 2px;
  --logo-ring-dark: #082655;
  --logo-ring-light: #f3f6fa;
  --glass-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23g)' opacity='0.6'/></svg>");

  /* City identity tints (whitish-grey base + hue hint; .is-base pops) */
  --city-london: color-mix(in srgb, #7ee0d8 32%, #e6eef2);
  --city-london-base: color-mix(in srgb, #5eead4 48%, #f4fbff);
  --city-london-glow: #4fd4c8;
  --city-jaipur: color-mix(in srgb, #e8a090 38%, #f3ece8);
  --city-jaipur-base: color-mix(in srgb, #e07a6a 52%, #fff4f0);
  --city-jaipur-glow: #d4786a;
  --accent-london: #3dbeb4;
  --accent-jaipur: #d4786a;

  --space-3xs: 0.125rem;
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 2.5rem;
  --space-3xl: 3rem;
  --space-4xl: 4rem;

  --card-padding-y: clamp(1.25rem, 3.5vh, 2rem);
  --card-padding-x: clamp(1rem, 3.5vw, 1.6rem);
  --section-gap: clamp(0.75rem, 2vh, 1.15rem);
  --item-gap: 0.4rem;
  --cluster-gap: 0.25rem;

  /* Safe areas — for notched phones / future PWA chrome */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);

  /* ---------- Radii ---------- */
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.85rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --radius-full: 9999px;
  --radius-circle: 50%;

  /* ---------- Typography (Satoshi modular cascade) ---------- */
  --font-primary: 'Satoshi', system-ui, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;

  --text-name:     clamp(1.9rem, 1.7rem + 1.4vw, 2.55rem);
  --text-tagline:  clamp(1rem, 0.95rem + 0.35vw, 1.15rem);
  --text-role:     clamp(0.9rem, 0.86rem + 0.25vw, 1rem);
  --text-location: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
  --text-phonetic: clamp(0.68rem, 0.64rem + 0.2vw, 0.78rem);
  --text-classic:  clamp(0.75rem, 0.72rem + 0.15vw, 0.85rem);
  --text-base:     1rem;
  --text-sm:       0.875rem;
  --text-xs:       0.75rem;
  --text-lg:       1.125rem;
  --text-xl:       1.25rem;
  --text-2xl:      1.5rem;

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-bold: 700;
  --weight-black: 900;

  --line-tight: 1.15;
  --line-snug: 1.35;
  --line-base: 1.5;
  --line-loose: 1.7;
  --tracking-tight: -0.03em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;

  /* ---------- Motion ---------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-frog: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-cursor: cubic-bezier(0.2, 0.8, 0.2, 1);

  --duration-instant: 80ms;
  --duration-fast: 160ms;
  --duration-base: 280ms;
  --duration-slow: 450ms;
  --duration-crawl: 900ms;

  --animation-timing: var(--ease-out);

  /* ---------- Elevation / glass ---------- */
  --blur-soft: 8px;
  --blur-base: 10px;
  --blur-strong: 16px;
  --blur-heavy: 24px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 25px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px color-mix(in srgb, var(--blue-400) 12%, transparent) inset;
  --shadow-focus: 0 0 0 3px color-mix(in srgb, var(--blue-400) 45%, transparent);

  /* ---------- Z-index scale ---------- */
  --z-bg: 0;
  --z-shader: 1;
  --z-main: 3;
  --z-veil: 2;
  --z-raised: 10;
  --z-sticky: 100;
  --z-logo: 1000;
  --z-popup: 1000;
  --z-modal: 10002;
  --z-cursor: 10050;
  --z-skip: 10100;

  /* ---------- Aspect / media ---------- */
  --aspect-square: 1 / 1;
  --aspect-card: 3 / 4;
  --aspect-wide: 16 / 9;

  /* ---------- Cursor — small rest ball, icons only on hover ---------- */
  --cursor-dot-size: 12px;
  --cursor-hover-size: calc(var(--social-cell) * 0.65);
  --cursor-ring-size: 0px;
  --cursor-trail-size: 28px;
  --cursor-animation-speed: 0.18s;
  --cursor-animation-easing: var(--ease-cursor);
  --cursor-hover-scale: 1.55;
  --cursor-color-primary: rgba(26, 43, 72, 0.7);
  --cursor-color-glow: color-mix(in srgb, var(--blue-400) 40%, transparent);
  --cursor-color-professional: color-mix(in srgb, var(--blue-600) 70%, transparent);
  --cursor-color-contact: color-mix(in srgb, var(--green-500) 70%, transparent);
  --cursor-color-personal: rgba(236, 72, 153, 0.7);
  --cursor-size: 1.1rem;
  --cursor-ring: 2.25rem;

  /* ---------- Future hooks (view transitions / containers) ---------- */
  --vt-card: card-morph;
  --vt-logo: logo-morph;
  --container-card: inline-size;
  --density: 1; /* multiply spacing in denser layouts later */
}

/* ---------- OKLCH upgrade path (wider gamut when supported) ---------- */
@supports (color: oklch(0.7 0.15 214)) {
  :root {
    --blue-300: oklch(0.84 0.08 250);
    --blue-400: oklch(0.78 0.11 250);
    --blue-500: oklch(0.70 0.14 250);
    --blue-600: oklch(0.62 0.18 255);
    --green-500: oklch(0.72 0.15 160);
    --color-primary: var(--blue-300);
    --color-primary-dark: var(--blue-500);
  }
}

/* ---------- Relative color / richer mixes ---------- */
@supports (color: color-mix(in oklab, white 50%, black)) {
  :root {
    --bg-glass: color-mix(in oklab, var(--ink-900) 60%, transparent);
    /* Note: --border-subtle intentionally NOT overridden here —
       the sRGB value (22%) is the canonical a11y-lifted value.
       The oklab block only upgrades the bg-glass calculation. */
    --shadow-glow: 0 0 24px color-mix(in oklab, var(--blue-400) 18%, transparent) inset;
  }
}

/* ---------- Desktop token lifts ---------- */
@media (min-width: 480px) {
  :root {
    --card-padding-y: clamp(1.5rem, 4vh, 2.25rem);
    --card-padding-x: clamp(1.25rem, 4vw, 1.75rem);
    --section-gap: clamp(0.85rem, 2.5vh, 1.35rem);
  }
}

/* ---------- Reduced motion: collapse motion tokens ---------- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
    --duration-crawl: 0ms;
    --ease-frog: linear;
    --ease-spring: linear;
  }
}

/* ---------- High contrast preference ---------- */
@media (prefers-contrast: more) {
  :root {
    --text-muted: #d5deea;
    --border-subtle: color-mix(in srgb, white 28%, transparent);
    --bg-card: rgba(0, 20, 40, 0.72);
  }
}

/* ---------- Theme hooks for future light / alt skins ---------- */
[data-theme="light"] {
  --text-primary: #0b1220;
  --text-secondary: #1e293b;
  --text-muted: #475569;
  --bg-page: #e8eef7;
  --bg-card: rgba(255, 255, 255, 0.72);
  --border-subtle: color-mix(in srgb, #0b1220 12%, transparent);
  --color-primary: #2563eb;
}

@media (max-width: 800px) {
  :root {
    --logo-size: clamp(4.75rem, 24vmin, 6.5rem);
    --logo-inset: max(1.4rem, calc(var(--safe-top) + 0.9rem), 5.5vmin);
    --card-width: min(92vw, 24.5rem);
    --card-padding-y: clamp(1rem, 3.2vh, 1.5rem);
    --card-padding-x: clamp(0.9rem, 4vw, 1.35rem);
  }
}

@media (max-width: 800px) and (max-height: 740px) {
  :root {
    --card-padding-y: 0.85rem;
    --space-lg: 0.85rem;
    --space-sm: 0.5rem;
    --social-cell: 2.55rem;
    --text-name: clamp(1.45rem, 6.6vw, 1.85rem);
  }
}

@media (max-width: 380px) {
  :root {
    --card-width: min(94vw, 22.5rem);
    --card-max-width: 22.5rem;
    --card-padding-y: 0.9rem;
    --card-padding-x: 0.8rem;
    --section-gap: 0.55rem;
    --logo-size: clamp(4.25rem, 26vmin, 5.75rem);
    --logo-inset: max(1.15rem, calc(var(--safe-top) + 0.7rem), 4.5vmin);
    --text-name: clamp(1.5rem, 7.4vw, 1.9rem);
    --text-tagline: 0.95rem;
    --text-role: 0.84rem;
    --social-cell: max(2.55rem, 12cqi);
  }
}

@media (max-width: 340px) {
  :root {
    --card-width: min(96vw, 20.5rem);
    --card-padding-x: 0.65rem;
    --text-name: clamp(1.35rem, 7vw, 1.7rem);
    --social-cell: 2.45rem;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  :root {
    --card-padding-y: 0.7rem;
    --card-padding-x: 1rem;
    --section-gap: 0.4rem;
    --logo-size: clamp(2.6rem, 10vmin, 3.4rem);
  }
}

/* ---------- Future CSS capability layer (opt-in utilities) ---------- */
@layer tokens, base, components, utilities;

/* Container queries — card can eventually size itself */
.business-card {
  container-type: inline-size;
  container-name: card;
}

/* View Transition API hooks (Chrome/Edge) — no-op elsewhere */
@supports (view-transition-name: none) {
  .business-card.vertical { view-transition-name: var(--vt-card); }
  .logo-lockup { view-transition-name: var(--vt-logo); }
}

/* Focus ring utility for keyboard-nav */
body.keyboard-nav :focus-visible {
  outline: 2px solid var(--border-focus, var(--color-primary));
  outline-offset: 3px;
}
