/* tks-tokens.css: the one source of truth for The Kingdom Standard design system.
 * Source: the Design System in visual-audit-20261008.md plus the rulebook in
 * tks-unified-plan-20261008.md (Wave 2, item 13). Every value the app styles with
 * should come from a token here. Names are prefixed --tks- so they never collide
 * with the older members.css and brand-tokens.css variables; Phase 2 points those
 * older names at these tokens.
 *
 * Rules that ride with the tokens:
 * - Gold (accent) is for actions. Tier colors are for rank only.
 * - Pillar colors are for data (rings, bars, dots), never for buttons.
 * - Fitness is red. Never put a Spartan tier tag on a red fitness surface.
 * - text-tertiary is the floor for readable text (5.2:1 or better on every surface).
 */
:root {
  /* ---------- Surfaces ---------- */
  --tks-bg: #050608;
  --tks-surface-1: #0F1012;
  --tks-surface-2: #15171A;
  --tks-surface-3: #1C1E22;
  --tks-surface-inset: #0A0B0D;
  --tks-surface-glass: rgba(15, 16, 18, .78);
  --tks-scrim: rgba(0, 0, 0, .6);

  /* ---------- Lines ---------- */
  --tks-line: rgba(217, 181, 67, .16);
  --tks-line-strong: rgba(217, 181, 67, .32);
  --tks-line-neutral: rgba(229, 220, 196, .08);

  /* ---------- Text ---------- */
  --tks-text-primary: #E5DCC4;
  --tks-text-secondary: rgba(229, 220, 196, .68);
  --tks-text-tertiary: rgba(229, 220, 196, .60);
  --tks-text-disabled: rgba(229, 220, 196, .30);

  /* ---------- Accent (gold, actions only) ---------- */
  --tks-accent: #D9B543;
  --tks-accent-strong: #F0CB6A;
  --tks-accent-deep: #B89030;
  --tks-accent-grad: linear-gradient(180deg, #F0CB6A 0%, #D9B543 55%, #B89030 100%);
  --tks-accent-fill: rgba(217, 181, 67, .10);
  --tks-accent-on: #1A1208;

  /* ---------- Status ---------- */
  --tks-success: #22D97F;
  --tks-success-fill: rgba(34, 217, 127, .12);
  --tks-warning: #F2A93B;
  --tks-warning-fill: rgba(242, 169, 59, .12);
  --tks-danger: #F87171;
  --tks-danger-fill: rgba(248, 113, 113, .12);
  --tks-danger-solid: #C0392B;
  --tks-info: #3B9BFF;
  --tks-info-fill: rgba(59, 155, 255, .12);

  /* ---------- Pillars (data only) ---------- */
  --tks-pillar-faith: #7FB3F0;
  --tks-pillar-family: #E0A24E;
  --tks-pillar-fitness: #C4514B;
  --tks-pillar-finances: #5FB98D;

  /* ---------- Macros. Carb and fat follow the member palette; tks-macro-colors.js sets --tks-carb and --tks-fat in the head, so no hex lives here ---------- */
  --tks-macro-cal: #D9B543;
  --tks-macro-protein: #22D97F;
  --tks-macro-carb: var(--tks-carb);
  --tks-macro-fat: var(--tks-fat);

  /* ---------- Rank tiers: primary, secondary (depth) and glow. From rank-identity.md ---------- */
  --tks-rank-none: #1C1E22;
  --tks-rank-bronze: #A8683F;
  --tks-rank-bronze-2: #5A321B;
  --tks-rank-bronze-glow: #E3A574;
  --tks-rank-iron: #6E7378;
  --tks-rank-iron-2: #2E3236;
  --tks-rank-iron-glow: #B4BAC0;
  --tks-rank-steel: #9FB0C4;
  --tks-rank-steel-2: #46566B;
  --tks-rank-steel-glow: #D8E6F6;
  --tks-rank-gold: #D9B543;
  --tks-rank-gold-2: #7E5F16;
  --tks-rank-gold-glow: #F7DF8C;
  --tks-rank-spartan: #B8322A;
  --tks-rank-spartan-2: #5C1410;
  --tks-rank-spartan-glow: #F2705C;
  --tks-rank-olympian: #EADFB8;
  --tks-rank-olympian-2: #9C8650;
  --tks-rank-olympian-glow: #FFF7DC;

  /* ---------- Muscle heat (Body, Trained layer) ---------- */
  --tks-heat-0: #1C1E22;
  --tks-heat-1: rgba(217, 181, 67, .25);
  --tks-heat-2: rgba(217, 181, 67, .45);
  --tks-heat-3: rgba(217, 181, 67, .70);
  --tks-heat-4: #D9B543;

  /* ---------- Type families and weights ---------- */
  --tks-font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --tks-font-text: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --tks-font-scripture: Georgia, 'Times New Roman', serif;
  --tks-w-regular: 400;
  --tks-w-semibold: 600;
  --tks-w-bold: 700;
  --tks-w-heavy: 800;

  /* ---------- Tracking and line height ---------- */
  --tks-track-tight: -0.01em;
  --tks-track-none: 0;
  --tks-track-label: 0.06em;
  --tks-track-eyebrow: 0.12em;
  --tks-lh-tight: 1.1;
  --tks-lh-snug: 1.25;
  --tks-lh-body: 1.45;
  --tks-lh-loose: 1.6;

  /* ---------- Type scale: font shorthand per style. Nothing under 11px ---------- */
  --tks-t-hero: 800 48px/1.1 var(--tks-font-display);
  --tks-t-display: 800 34px/1.1 var(--tks-font-display);
  --tks-t-title1: 800 28px/1.1 var(--tks-font-display);
  --tks-t-title2: 700 22px/1.25 var(--tks-font-display);
  --tks-t-title3: 700 20px/1.25 var(--tks-font-display);
  --tks-t-headline: 600 17px/1.25 var(--tks-font-text);
  --tks-t-body: 400 17px/1.45 var(--tks-font-text);
  --tks-t-callout: 400 16px/1.45 var(--tks-font-text);
  --tks-t-subhead: 400 15px/1.45 var(--tks-font-text);
  --tks-t-footnote: 400 13px/1.45 var(--tks-font-text);
  --tks-t-caption1: 600 12px/1.25 var(--tks-font-text);
  --tks-t-caption2: 600 11px/1.25 var(--tks-font-text);
  --tks-t-eyebrow: 800 12px/1.25 var(--tks-font-display);

  /* ---------- Spacing: 4 point grid ---------- */
  --tks-space-1: 4px;
  --tks-space-2: 8px;
  --tks-space-3: 12px;
  --tks-space-4: 16px;
  --tks-space-5: 20px;
  --tks-space-6: 24px;
  --tks-space-7: 32px;
  --tks-space-8: 40px;
  --tks-space-9: 48px;
  --tks-space-10: 64px;
  --tks-side-pad: 16px;
  --tks-card-pad: 16px;
  --tks-card-pad-hero: 20px;
  --tks-card-gap: 12px;
  --tks-section-gap: 32px;

  /* ---------- Sizes ---------- */
  --tks-hit: 44px;
  --tks-btn-l: 52px;
  --tks-btn-m: 44px;
  --tks-btn-s: 32px;
  --tks-row-min: 52px;
  --tks-topbar-h: 52px;
  --tks-tabbar-h: 49px;
  --tks-seg-h: 36px;
  --tks-bar-h: 6px;
  --tks-icon-s: 20px;
  --tks-icon-m: 24px;
  --tks-art-s: 24px;
  --tks-art-m: 32px;
  --tks-art-l: 48px;
  --tks-art-xl: 64px;
  --tks-emblem-card: 120px;
  --tks-emblem-row: 32px;
  --tks-glyph-stroke: 1.75;
  --tks-safe-top: env(safe-area-inset-top, 0px);
  --tks-safe-bottom: env(safe-area-inset-bottom, 0px);

  /* ---------- Radius ---------- */
  --tks-r-xs: 4px;
  --tks-r-sm: 8px;
  --tks-r-md: 12px;
  --tks-r-lg: 16px;
  --tks-r-xl: 22px;
  --tks-r-pill: 999px;

  /* ---------- Elevation ---------- */
  --tks-e0: 0 0 0 1px var(--tks-line);
  --tks-e1: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 6px rgba(0, 0, 0, .35);
  --tks-e2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 6px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .45);
  --tks-e3: 0 -10px 44px rgba(0, 0, 0, .6);
  --tks-glow-accent: 0 6px 22px rgba(217, 181, 67, .30);
  --tks-glow-ceremony: 0 0 48px rgba(240, 203, 106, .45);
  --tks-glow-text: 0 0 18px rgba(217, 181, 67, .35);
  --tks-blur-bar: blur(20px) saturate(1.6);
  --tks-focus-ring: 0 0 0 2px var(--tks-bg), 0 0 0 4px var(--tks-accent-strong);

  /* ---------- Motion ---------- */
  --tks-m-instant: 100ms;
  --tks-m-fast: 150ms;
  --tks-m-base: 250ms;
  --tks-m-sheet: 350ms;
  --tks-m-ceremony: 900ms;
  --tks-m-ceremony-min: 600ms;
  --tks-m-ceremony-max: 1200ms;
  --tks-ease-standard: cubic-bezier(.2, .8, .2, 1);
  --tks-ease-sheet: cubic-bezier(.32, .72, 0, 1);
  --tks-ease-exit: cubic-bezier(.4, 0, 1, 1);
  --tks-ease-linear: linear;
}

/* Reduced motion: travel and spin stop, short fades stay. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --tks-m-base: 150ms;
    --tks-m-sheet: 200ms;
    --tks-m-ceremony: 400ms;
  }
}
