/* Hip Hop Exchange — token layer + base. HAND-WRITTEN: nothing builds this file.
 *
 * The template ships no package.json, so deploy.sh's build_css step skips and THIS file
 * is what ships. src/input.css is the Tailwind v4 twin: same token NAMES and VALUES in an
 * @theme block. If you add a build ("build": "tailwindcss -i src/input.css -o
 * assets/css/style.css --minify") this file is regenerated from input.css; components.css
 * is separate and keeps working because it only depends on token names.
 *
 * ── Rules this file lives by (tests/test-design-tokens.php enforces them) ──────────────
 * 1. Tailwind v4 OWNS --color-* --text-* --font-* --leading-* --tracking-* --radius-*
 *    --shadow-*. They are declared only inside @layer (theme/base). An UNLAYERED :root
 *    redefinition would beat Tailwind utilities and silently restyle them.
 * 2. Every colour derives from ONE number: --brand-hue (0-360, intake rejects 35-60).
 * 3. Dark mode gets depth from --color-bg-elevated, never from shadows.
 * 4. Contrast: every text/surface pair is >= 4.5:1 (UI parts >= 3:1) for EVERY hue 0-359,
 *    both modes. The test re-derives that from the values below; edit a lightness here
 *    and it re-checks.
 */
@layer theme, base, components, utilities;

@layer theme {
  :root {
    --brand-hue: 345;

    /* colour — light */
    --color-bg: hsl(var(--brand-hue) 22% 98%);
    --color-bg-elevated: hsl(0 0% 100%);
    --color-surface: hsl(var(--brand-hue) 18% 95%);
    --color-text: hsl(var(--brand-hue) 25% 10%);
    --color-text-muted: hsl(var(--brand-hue) 12% 34%);
    --color-border: hsl(var(--brand-hue) 14% 84%);
    --color-border-strong: hsl(var(--brand-hue) 12% 44%);
    --color-brand: hsl(var(--brand-hue) 70% 26%);
    --color-brand-hover: hsl(var(--brand-hue) 70% 21%);
    --color-brand-active: hsl(var(--brand-hue) 70% 16%);
    --color-on-brand: hsl(0 0% 100%);
    --color-focus: hsl(var(--brand-hue) 85% 28%);
    --color-success: hsl(142 72% 24%);
    --color-warning: hsl(32 90% 26%);
    --color-danger: hsl(0 72% 40%);

    /* spacing (Tailwind's own base unit + a named scale for hand-written CSS) */
    --spacing: 0.25rem;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --touch-target: 2.75rem;

    /* type */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --leading-tight: 1.2;
    --leading-normal: 1.5;

    /* shape + elevation */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow-sm: 0 1px 3px hsl(var(--brand-hue) 25% 10% / 0.08);

    /* motion */
    --duration-fast: 120ms;
    --duration-base: 200ms;
    --duration-slow: 320ms;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  }
}

@layer base {
  /* dark — class wins either way; OS preference applies unless the page says .light */
  :root.dark {
    color-scheme: dark;
    --color-bg: hsl(var(--brand-hue) 20% 7%);
    --color-surface: hsl(var(--brand-hue) 15% 10%);
    --color-bg-elevated: hsl(var(--brand-hue) 14% 14%);
    --color-text: hsl(var(--brand-hue) 15% 94%);
    --color-text-muted: hsl(var(--brand-hue) 10% 68%);
    --color-border: hsl(var(--brand-hue) 12% 24%);
    --color-border-strong: hsl(var(--brand-hue) 10% 56%);
    --color-brand: hsl(var(--brand-hue) 85% 74%);
    --color-brand-hover: hsl(var(--brand-hue) 85% 79%);
    --color-brand-active: hsl(var(--brand-hue) 85% 84%);
    --color-on-brand: hsl(var(--brand-hue) 35% 8%);
    --color-focus: hsl(var(--brand-hue) 95% 74%);
    --color-success: hsl(142 60% 60%);
    --color-warning: hsl(40 90% 62%);
    --color-danger: hsl(0 85% 70%);
    --shadow-sm: none;
  }
  @media (prefers-color-scheme: dark) {
    :root:not(.light) {
      color-scheme: dark;
      --color-bg: hsl(var(--brand-hue) 20% 7%);
      --color-surface: hsl(var(--brand-hue) 15% 10%);
      --color-bg-elevated: hsl(var(--brand-hue) 14% 14%);
      --color-text: hsl(var(--brand-hue) 15% 94%);
      --color-text-muted: hsl(var(--brand-hue) 10% 68%);
      --color-border: hsl(var(--brand-hue) 12% 24%);
      --color-border-strong: hsl(var(--brand-hue) 10% 56%);
      --color-brand: hsl(var(--brand-hue) 85% 74%);
      --color-brand-hover: hsl(var(--brand-hue) 85% 79%);
      --color-brand-active: hsl(var(--brand-hue) 85% 84%);
      --color-on-brand: hsl(var(--brand-hue) 35% 8%);
      --color-focus: hsl(var(--brand-hue) 95% 74%);
      --color-success: hsl(142 60% 60%);
      --color-warning: hsl(40 90% 62%);
      --color-danger: hsl(0 85% 70%);
      --shadow-sm: none;
    }
  }

  * { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: var(--font-sans, system-ui, sans-serif);
    font-size: var(--text-base, 1rem);
    line-height: var(--leading-normal, 1.5);
    color: var(--color-text, #111);
    background-color: var(--color-bg, #fafafa);
    overflow-wrap: break-word;
  }
  img, svg, video { max-width: 100%; height: auto; }
  a { color: var(--color-brand, #1d4ed8); text-decoration: underline; text-underline-offset: 0.15em; }
  a:hover { color: var(--color-brand-hover, #1e40af); }
  :focus-visible { outline: 3px solid var(--color-focus, #1d4ed8); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  }
}

/* Minimal utility shims for the pages not yet moved to components (members.php). checkout, dashboard
 * and admin no longer use utility classes (tests/test-design-tokens.php check 9). Layered so a real Tailwind build and components both win. */
@layer utilities {
  .hidden { display: none !important; }
  .mx-auto { margin-left: auto; margin-right: auto; }
  .max-w-6xl { max-width: 72rem; }
  .max-w-3xl { max-width: 48rem; }
  .max-w-xl  { max-width: 36rem; }
  .max-w-sm  { max-width: 24rem; }
  .max-w-7xl { max-width: 80rem; }
  .px-4 { padding-left: 1rem; padding-right: 1rem; }
  .py-16 { padding-top: 4rem; padding-bottom: 4rem; }
  .py-24 { padding-top: 6rem; padding-bottom: 6rem; }
  .min-h-screen { min-height: 100vh; }
  .text-center { text-align: center; }
  .text-right  { text-align: right; }
  .text-left   { text-align: left; }
  .font-bold { font-weight: 700; }
  .font-semibold { font-weight: 600; }
  .grid { display: grid; }
  .flex { display: flex; }
  .gap-4 { gap: 1rem; }
  .gap-6 { gap: 1.5rem; }
  .rounded { border-radius: 0.25rem; }
  .rounded-lg { border-radius: 0.5rem; }
}
