/* ==========================================================================
   VolleyPsy tokens — layered on the Nocturne design system.
   Load order:  nocturne/styles.css  →  volleypsy-tokens.css  →  scoped *.razor.css
   Theme switch: <html data-theme="dark|light">  (dark is the default)
   ========================================================================== */

:root {
  color-scheme: dark;

  /* — Surfaces (dark is Nocturne's native ground) — */
  --vp-bg:          var(--color-bg);          /* #161826 page */
  --vp-surface-1:   var(--color-surface);     /* #232532 cards, bars */
  --vp-surface-2:   #2b2e3d;                  /* raised: sheets, popovers, active rows */
  --vp-surface-3:   #343747;                  /* pressed / selected fill */
  --vp-text:        var(--color-text);        /* #e9e9ed  14.6:1 on bg */
  --vp-text-muted:  var(--color-neutral-400); /* #b2b6ca   8.3:1 on bg */
  --vp-text-subtle: var(--color-neutral-500); /* #9397ab   5.6:1 on bg — min for small text */
  --vp-border:      var(--color-neutral-800); /* #3f424d hairlines, card edges */
  --vp-divider:     var(--color-divider);

  /* — Brand — */
  --vp-accent:       var(--color-accent);      /* #9184d9 lines, icons, large text (5.2:1) */
  --vp-accent-text:  var(--color-accent-300);  /* #d2cefd small accent text */
  --vp-accent-tint:  var(--color-accent-900);  /* #2b2741 selected fills */
  --vp-accent-press: var(--color-accent-400);

  /* — Teams. Never colour alone: Home = ● circle token + "H", Away = ◆ diamond token + "A" — */
  --vp-home:        #9184d9;   /* = accent */
  --vp-home-text:   #d2cefd;
  --vp-home-tint:   #2b2741;
  --vp-away:        #e3a157;   /* warm amber, same L as home (≈0.75) */
  --vp-away-text:   #f6d3a6;
  --vp-away-tint:   #3a2d1f;
  --vp-libero:      #e9e9ed;   /* libero = inverted token: solid light fill, dark numeral */

  /* — Semantic (always paired with an icon + word) — */
  --vp-live:        #6cc497;  --vp-live-tint:    #1c3227;   /* connected / live */
  --vp-success:     #6cc497;  --vp-success-tint: #1c3227;
  --vp-warning:     #e2cb62;  --vp-warning-tint: #34301b;   /* offline, queued writes */
  --vp-danger:      #ee8c91;  --vp-danger-tint:  #3d2228;   /* errors, lapsed (402) */
  --vp-info:        #82b6e4;  --vp-info-tint:    #1d2c3e;   /* syncing, read-only */

  /* — Court illustration — */
  --vp-court-floor: #20233a;   /* playing area, a step bluer than surface */
  --vp-court-front: #282c48;   /* front (attack) zone, net → 3 m line */
  --vp-court-free:  #191b2b;   /* free zone */
  --vp-court-line:  #cfd3e5;   /* boundary + attack line, 2px */
  --vp-court-net:   var(--color-accent);
  --vp-path-home:   var(--vp-home);
  --vp-path-away:   var(--vp-away);
  --vp-path-ball:   var(--color-text);

  /* — Typography (Inter, max weight 500 per Nocturne) — */
  --vp-font:            var(--font-body);
  --vp-weight:          400;
  --vp-weight-strong:   500;
  --vp-num:             tabular-nums;          /* font-variant-numeric for every number */
  --vp-score-xl: 200px;  /* spectator big screen */
  --vp-score-lg: 120px;  /* desktop scoreboard */
  --vp-score-md: 72px;   /* mobile pinned score */
  --vp-score-sm: 32px;   /* set history, cards */
  --vp-h1: 32px; --vp-h2: 25px; --vp-h3: 20px; --vp-h4: 16px;
  --vp-body: 15px; --vp-small: 13px; --vp-label: 11px;  /* label: uppercase, .08em */
  --vp-lh-tight: 1.1; --vp-lh-body: 1.55;

  /* — Spacing: Nocturne's 0.7× scale, extended — */
  --vp-space-1: var(--space-1);  /*  2.8 */
  --vp-space-2: var(--space-2);  /*  5.6 */
  --vp-space-3: var(--space-3);  /*  8.4 */
  --vp-space-4: var(--space-4);  /* 11.2 */
  --vp-space-6: var(--space-6);  /* 16.8 */
  --vp-space-8: var(--space-8);  /* 22.4 */
  --vp-space-12: 33.6px;
  --vp-space-16: 44.8px;

  /* — Hit targets: compact on mouse, 48px on touch — */
  --vp-hit: 36px;
  --vp-hit-score: 56px;   /* +1 buttons */

  /* — Radius — */
  --vp-radius-sm: var(--radius-sm);  /* 4  chips */
  --vp-radius-md: var(--radius-md);  /* 8  buttons, inputs, cards */
  --vp-radius-lg: var(--radius-lg);  /* 14 sheets, dialogs */
  --vp-radius-pill: 999px;           /* status chips, tokens */

  /* — Elevation (edge + ambient dark) — */
  --vp-elev-1: var(--shadow-sm);
  --vp-elev-2: var(--shadow-md);
  --vp-elev-3: var(--shadow-lg);

  /* — Motion — */
  --vp-dur-instant: 80ms;   /* press feedback */
  --vp-dur-fast:    160ms;  /* hovers, chips, score tick */
  --vp-dur-base:    240ms;  /* sheets, toasts */
  --vp-dur-slow:    360ms;  /* rotation step, token travel */
  --vp-ease-out:    cubic-bezier(.2, .7, .2, 1);
  --vp-ease-in-out: cubic-bezier(.6, 0, .2, 1);

  --vp-focus: 0 0 0 2px var(--vp-bg), 0 0 0 4px var(--color-accent);
}

/* Touch devices get courtside sizing */
@media (pointer: coarse) {
  :root { --vp-hit: 48px; --vp-hit-score: 72px; }
  .btn, .input, .seg-opt { min-height: var(--vp-hit); }
  .btn-icon { width: var(--vp-hit); height: var(--vp-hit); }
}

/* — Light theme: Nocturne's ramps mirrored (100↔900) so every Nocturne class still resolves — */
[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f2f3f8;  --color-surface: #fafafd;  --color-text: #1d1f2b;
  --color-accent: #5d5294;
  --color-divider: color-mix(in srgb, #1d1f2b 16%, transparent);
  --color-neutral-100: #292b31; --color-neutral-200: #3f424d; --color-neutral-300: #595d6c;
  --color-neutral-400: #4f5363; --color-neutral-500: #626678; --color-neutral-600: #9397ab;
  --color-neutral-700: #b2b6ca; --color-neutral-800: #dcdfeb; --color-neutral-900: #eceef5;
  --color-accent-100: #2b2741; --color-accent-200: #423a6a; --color-accent-300: #4e4485;
  --color-accent-400: #4a4180; --color-accent-500: #5d5294; --color-accent-600: #796cbf;
  --color-accent-700: #b5abfc; --color-accent-800: #e7e5fe; --color-accent-900: #f1f0fe;
  --shadow-sm: 0 0 0 1px #dcdfeb;
  --shadow-md: 0 0 0 1px #d0d3e2, 0 6px 18px rgba(29,31,43,.10);
  --shadow-lg: 0 0 0 1px #c3c7d8, 0 16px 40px rgba(29,31,43,.16);

  --vp-surface-2: #eef0f6;  --vp-surface-3: #e3e6ef;
  --vp-text-subtle: #626678;   /* 5.4:1 on bg */
  --vp-border: #d6d9e5;
  --vp-home: #5d5294;  --vp-home-text: #4a4180;  --vp-home-tint: #ebe9fb;
  --vp-away: #94570f;  --vp-away-text: #7a470c;  --vp-away-tint: #f7ebdc;
  --vp-libero: #1d1f2b;
  --vp-live: #23744a;    --vp-live-tint: #dff1e7;
  --vp-success: #23744a; --vp-success-tint: #dff1e7;
  --vp-warning: #76600f; --vp-warning-tint: #f6efcf;
  --vp-danger: #b03642;  --vp-danger-tint: #f8e1e3;
  --vp-info: #2b659c;    --vp-info-tint: #e0ecf7;
  --vp-court-floor: #e7e5f4; --vp-court-front: #dcd9ef; --vp-court-free: #f2f3f8;
  --vp-court-line: #3f424d;
}

@media (prefers-reduced-motion: reduce) {
  :root { --vp-dur-fast: 0ms; --vp-dur-base: 0ms; --vp-dur-slow: 0ms; }
}

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.vp-num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
