/* ============================================================
   THEME — Cupertino
   -----------------------------------------------------------
   This is the ONE FILE users swap to reskin their site.
   Replace this file with any other theme.css to change the
   entire look & feel. Tokens only — no component CSS lives here.

   TOKEN CONTRACT
   -----------------------------------------------------------
   Every theme MUST declare every variable in this file, even
   if it sets it to a neutral value (e.g. --glow-md: 0 0 0 transparent;).
   That's what guarantees a clean one-file swap.

   Slots:
     Surfaces : --paper, --paper-raised, --paper-sunk, --paper-glass
     Ink      : --ink, --ink-soft, --ink-faint, --graphite, --muted
     Lines    : --guide, --guide-soft, --hair, --hair-soft
     Primary  : --ai, --ai-ink, --ai-wash           (system blue in cupertino)
     Seal     : --shu, --shu-wash                    (system red)
     Accent   : --ochre, --ochre-wash                (system orange / amber)
     Code     : --code-bg/ink/muted/accent/green/blue
     Type     : --font-display/script/serif/sans/mono
     Radius   : --r-sm, --r-md, --r-lg
     Shadow   : --shadow-sm, --shadow-md, --shadow-lg
     Blur     : --blur-sm, --blur-md, --blur-lg     (vibrancy)
     Glow     : --glow-sm, --glow-md, --glow-lg     (cupertino lifts, doesn't glow)
     Motion   : --duration-fast, --duration-normal, --duration-slow, --ease
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces — AppKit panels */
  --paper:        #F5F5F7;
  --paper-raised: #FFFFFF;
  --paper-sunk:   #E9E9EC;
  --paper-glass:  rgba(255, 255, 255, 0.72);

  /* Ink — warm black, never pure */
  --ink:        #1D1D1F;
  --ink-soft:   #3A3A3C;
  --ink-faint:  #8E8E93;
  --graphite:   #2C2C2E;
  --muted:      #6E6E73;

  /* Hairlines / guides */
  --guide:      #D2D2D7;
  --guide-soft: #E5E5EA;
  --hair:       #D2D2D7;
  --hair-soft:  #E5E5EA;

  /* Primary accent — system blue */
  --ai:         #0071E3;
  --ai-ink:     #0058B0;
  --ai-wash:    #E5F0FB;

  /* Seal — system red */
  --shu:        #FF3B30;
  --shu-wash:   #FFEAE8;

  /* Accent — system orange / amber */
  --ochre:      #FF9F0A;
  --ochre-wash: #FFF4E0;

  /* Code surface — native Xcode dark */
  --code-bg:     #1C1C1E;
  --code-ink:    #F2F2F7;
  --code-muted:  #8E8E93;
  --code-accent: #FF9F0A;
  --code-green:  #30D158;
  --code-blue:   #64D2FF;

  /* Typography — SF system stack */
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-script:  'Caveat', 'Shadows Into Light', cursive;
  --font-serif:   ui-serif, 'New York', 'Iowan Old Style', 'Palatino', Georgia, serif;
  --font-sans:    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono:    'SF Mono', ui-monospace, 'JetBrains Mono', 'Menlo', Consolas, monospace;

  /* Radius — AppKit corners */
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;

  /* Shadows — small, diffuse, lifted */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);

  /* Blur — vibrancy (Cupertino's signature) */
  --blur-sm: blur(20px) saturate(180%);
  --blur-md: blur(30px) saturate(180%);
  --blur-lg: blur(40px) saturate(180%);

  /* Glow — Cupertino doesn't glow, it lifts */
  --glow-sm: 0 0 0 transparent;
  --glow-md: 0 0 0 transparent;
  --glow-lg: 0 0 0 transparent;

  /* Motion — Apple-snappy */
  --duration-fast:   160ms;
  --duration-normal: 220ms;
  --duration-slow:   320ms;
  --ease:            cubic-bezier(0.25, 0.1, 0.25, 1);

  /* ----------------------------------------------------------
     SEMANTIC ALIASES
     -----------------------------------------------------------
     Bridge the library's expected names to this theme's native
     palette. Components can now write m.color(surface-default)
     or var(--surface-default) and reskin with the theme
     automatically.
     ---------------------------------------------------------- */

  /* Backgrounds (page-level) */
  --background-default: var(--paper);
  --background-subtle:  var(--paper-sunk);
  --background-navbar:  var(--paper-raised);

  /* Surfaces */
  --surface-default:   var(--paper);
  --surface-raised:    var(--paper-raised);
  --surface-sunk:      var(--paper-sunk);
  --surface-muted:     var(--paper-sunk);
  --surface-subtle:    var(--paper-raised);
  --surface-emphasis:  var(--ink);
  --surface-glass:     var(--paper-glass);

  /* Text */
  --text-primary:      var(--ink);
  --text-secondary:    var(--ink-soft);
  --text-muted:        var(--ink-faint);
  --text-tertiary:     var(--muted);
  --text-inverse:      var(--paper);
  --text-link:         var(--ai);
  --text-link-hover:   var(--ai-ink);

  /* Borders */
  --border-default:    var(--hair);
  --border-subtle:     var(--hair-soft);
  --border-emphasis:   var(--ink);
  --border-focus:      var(--ai);

  /* Interactive (hover / active wash layers) — macOS faint ink overlay */
  --interactive-hover:  rgba(0, 0, 0, 0.04);
  --interactive-active: rgba(0, 0, 0, 0.08);

  /* Brand (identity — action-primary usually references these) */
  --brand-primary:        var(--ai);
  --brand-primary-hover:  var(--ai-ink);

  /* Action (primary / secondary / tertiary) */
  --action-primary-default:   var(--ai);
  --action-primary-hover:     var(--ai-ink);
  --action-primary-active:    var(--ai-ink);
  --action-primary-wash:      var(--ai-wash);
  --action-secondary-default: var(--shu);
  --action-secondary-hover:   var(--shu);
  --action-secondary-active:  var(--shu);
  --action-secondary-wash:    var(--shu-wash);
  --action-tertiary-default:  var(--ochre);
  --action-tertiary-hover:    var(--ochre);
  --action-tertiary-active:   var(--ochre);
  --action-tertiary-wash:     var(--ochre-wash);

  /* Feedback / status (high-level semantic) */
  --feedback-info:     var(--ai);
  --feedback-success:  var(--code-green);
  --feedback-warning:  var(--ochre);
  --feedback-error:    var(--shu);

  /* Status — info (three-part: default / subtle / text) */
  --info-default: var(--ai);
  --info-subtle:  var(--ai-wash);
  --info-text:    var(--ai-ink);

  /* Status — success (macOS system green) */
  --success-default: var(--code-green);
  --success-subtle:  rgba(48, 209, 88, 0.12);
  --success-text:    #1E8838;

  /* Status — warning (macOS system orange) */
  --warning-default: var(--ochre);
  --warning-subtle:  var(--ochre-wash);
  --warning-text:    #B36600;

  /* Status — error (macOS system red) */
  --error-default: var(--shu);
  --error-subtle:  rgba(255, 59, 48, 0.12);
  --error-text:    #A8281F;

  /* ----------------------------------------------------------
     LIBRARY SCALES (space / radius / type / motion / z)
     -----------------------------------------------------------
     The library mixins emit var(--space-<key>), var(--radius-<key>),
     var(--font-primary), var(--font-size-<key>), var(--z-<key>), …
     Themes declare the slots so those mixins always resolve.
     ---------------------------------------------------------- */

  /* Space scale (rem for accessibility) */
  --space-2xs: 0.25rem;
  --space-xs:  0.5rem;
  --space-sm:  0.75rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;

  /* Radius alias — mirrors --r-* with standard names so
     `m.radius(size)` in the library finds --radius-<size>. */
  --radius-sm:   var(--r-sm);
  --radius-md:   var(--r-md);
  --radius-lg:   var(--r-lg);
  --radius-xl:   0.75rem;
  --radius-full: 9999px;

  /* Shadow — higher-elevation slots (AppKit floating surfaces) */
  --shadow-xl:  0 20px 50px rgba(0, 0, 0, 0.14), 0 4px 10px rgba(0, 0, 0, 0.05);
  --shadow-2xl: 0 28px 70px rgba(0, 0, 0, 0.20), 0 6px 14px rgba(0, 0, 0, 0.06);

  /* Typography — base body font + key scale slots (SF Pro stack) */
  --font-primary: var(--font-sans);
  --font-size-base: 1rem;
  --line-height-normal: 1.5;
  --font-weight-medium: 500;

  /* Z-index layers */
  --z-sticky:   1020;
  --z-dropdown: 1030;
  --z-backdrop: 1040;
  --z-modal:    1050;
  --z-popover:  1060;
  --z-tooltip:  1070;

  /* ----------------------------------------------------------
     OPTIONAL COMPONENT OVERRIDES (Feature 1.3)
     -----------------------------------------------------------
     Cupertino expresses AppKit UI: softly rounded controls,
     diffuse card lift, larger panel radii. Overrides are
     intentionally sparse — pick the ones that carry the
     identity of the OS, leave the rest on library defaults.
     ---------------------------------------------------------- */
  --btn-radius:    var(--r-md);            /* 10px — AppKit control */
  --card-radius:   var(--r-lg);            /* 14px — panel corner */
  --card-shadow:   var(--shadow-sm);       /* diffuse, lifted */
  --input-radius:  var(--r-sm);            /* 8px — text field */
  --modal-radius:  var(--r-lg);            /* matches panel */
  --tooltip-radius: var(--r-sm);           /* bezel tooltip */
}
