/* ==========================================================================
   DESIGN TOKENS
   Single source of truth for spacing, typography, radius, control sizing,
   color, borders, shadows, motion. Every component consumes these — never
   hardcode raw values in component files.
   ========================================================================== */

@font-face {
  font-family: "DM Mono";
  src: url("./DMMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- Color: neutral scale (swap for brand palette) ---- */
  --color-neutral-0: #ffffff;
  --color-neutral-50: #f8f9fa;
  --color-neutral-100: #f1f3f5;
  --color-neutral-200: #e9ecef;
  --color-neutral-300: #dee2e6;
  --color-neutral-400: #ced4da;
  --color-neutral-500: #adb5bd;
  --color-neutral-600: #868e96;
  --color-neutral-700: #495057;
  --color-neutral-800: #343a40;
  --color-neutral-900: #212529;
  --color-neutral-950: #16181b;

  /* ---- Color: brand / primary (#F9632D) ---- */
  --color-primary-50: #fff3ec;
  --color-primary-100: #ffe3d3;
  --color-primary-300: #fcb595;
  --color-primary-400: #fb8f5e;
  --color-primary-500: #fa7940;
  --color-primary-600: #f9632d; /* brand primary */
  --color-primary-700: #dd4f1c;
  --color-primary-800: #b83f16;

  /* ---- Color: semantic ---- */
  --color-success-50: #ecfdf3;
  --color-success-500: #12b76a;
  --color-success-600: #039855;
  --color-success-700: #027a48;

  --color-warning-50: #fffaeb;
  --color-warning-500: #f79009;
  --color-warning-600: #dc6803;
  --color-warning-700: #b54708;

  --color-error-50: #fef3f2;
  --color-error-500: #f04438;
  --color-error-600: #d92d20;
  --color-error-700: #b42318;

  --color-info-50: #eff8ff;
  --color-info-500: #2e90fa;
  --color-info-600: #1570ef;
  --color-info-700: #175cd3;

  /* ---- Semantic surface / text roles (light theme default) ---- */
  --color-bg-page: var(--color-neutral-50);
  --color-bg-surface: var(--color-neutral-0);
  --color-bg-subtle: var(--color-neutral-100);
  --color-bg-inverse: var(--color-neutral-900);

  --color-text-primary: var(--color-neutral-900);
  --color-text-secondary: var(--color-neutral-700);
  --color-text-tertiary: var(--color-neutral-600);
  --color-text-disabled: var(--color-neutral-400);
  --color-text-inverse: var(--color-neutral-0);
  --color-text-link: var(--color-primary-600);

  --color-border-default: var(--color-neutral-300);
  --color-border-subtle: var(--color-neutral-200);
  --color-border-strong: var(--color-neutral-400);
  --color-border-focus: var(--color-primary-500);

  /* ---- Spacing scale ---- */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* ---- Control heights ---- */
  --control-height-sm: 2.125rem; /* 34px */
  --control-height-md: 2.625rem; /* 42px — system default */
  --control-height-lg: 3rem;     /* 48px */

  /* ---- Typography scale ---- */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px — default UI */
  --font-size-md: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.75rem;   /* 28px */
  --font-size-4xl: 2.25rem;   /* 36px */
  --font-size-5xl: 3rem;      /* 48px */

  --line-height-xs: 1rem;
  --line-height-sm: 1.125rem;
  --line-height-md: 1.5rem;
  --line-height-lg: 1.75rem;
  --line-height-xl: 1.75rem;
  --line-height-2xl: 2rem;
  --line-height-3xl: 2.25rem;
  --line-height-4xl: 2.75rem;
  --line-height-5xl: 3.5rem;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ---- Typeface roles ----
     --font-family-base: all text (body, forms, labels, headings, supporting
     text, general UI). --font-family-mono: buttons only. */
  --font-family-base: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-family-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* ---- Letter spacing ---- */
  --letter-spacing-none: 0;

  /* ---- Button-only type rules ---- */
  --btn-text-transform: uppercase;

  /* Fluid page-level type (headline scales with viewport, clamped) */
  --font-size-fluid-h1: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  --font-size-fluid-h2: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);

  /* ---- Radius scale ----
     System-wide standard is 4px on every rectangular element (buttons,
     inputs, cards, containers). All step aliases resolve to the same
     value so existing component code doesn't need per-file edits; do
     not diverge a component from --radius without an explicit spec.
     --radius-full is a shape token (pills/circles), not a corner-radius
     style choice, so it's exempt and stays unchanged. */
  --radius: 0.25rem;      /* 4px — system default, use this for new code */
  --radius-sm: var(--radius);
  --radius-md: var(--radius);
  --radius-lg: var(--radius);
  --radius-xl: var(--radius);
  --radius-2xl: var(--radius);
  --radius-full: 999px;

  /* ---- Borders ----
     System-wide: no visible borders anywhere (buttons, inputs, cards,
     containers). Every component-level border declaration reads this
     token rather than a hardcoded width, so it stays the single place
     borders are turned off — don't reintroduce a width or color on
     individual components. Radius and shadows are unaffected. */
  --border-width: 0;

  /* ---- Icon sizing ---- */
  --icon-size-sm: 1rem;      /* 16px */
  --icon-size-md: 1.25rem;   /* 20px */
  --icon-size-lg: 1.5rem;    /* 24px */
  --icon-text-gap: 0.5rem;

  /* ---- Shadows / elevation ---- */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-xl: 0 20px 24px -4px rgba(16, 24, 40, 0.08), 0 8px 8px -4px rgba(16, 24, 40, 0.03);
  --shadow-focus-ring: 0 0 0 4px var(--color-primary-100);
  --shadow-focus-ring-error: 0 0 0 4px var(--color-error-50);

  /* ---- Motion ---- */
  --duration-fast: 120ms;
  --duration-base: 180ms;
  --duration-slow: 260ms;
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  /* Gentle, springless ease-out for effects that should feel like they
     expand/settle rather than snap (e.g. the button hover shadow). */
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-soft: 450ms;

  /* ---- Button brand palette (exact spec, do not derive from neutral/primary scales) ----
     Background/text are identical across default, hover, active, and
     focus — only --btn-shadow changes state. Do not add per-state bg
     variants back without an explicit design request. */
  --btn-primary-bg: #f9632d;
  --btn-primary-text: #ffffff;

  --btn-secondary-bg: #262525;
  --btn-secondary-text: #ffffff;

  --btn-white-bg: #ffffff;
  --btn-white-text: #262525;
  --btn-white-border: var(--color-border-default);

  --btn-focus-ring: 0 0 0 4px rgba(249, 99, 45, 0.35);
  /* Soft, bubble-like black ambient shadow — clearly visible at rest
     against surrounding page backgrounds, smoothly expanding/deepening
     on hover so the state change reads without any color change. */
  --btn-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
  --btn-shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.24);
  --btn-radius: var(--radius);

  /* ---- Page / grid system ---- */
  --page-gutter: clamp(1rem, 4.23vw, 4rem);
  --content-max-width: 80rem; /* 1280px */
  --page-max-width: 94.5rem;  /* 1512px reference */
}

/* ---- Dark theme overrides (opt-in via [data-theme="dark"]) ---- */
[data-theme="dark"] {
  --color-bg-page: var(--color-neutral-950);
  --color-bg-surface: var(--color-neutral-900);
  --color-bg-subtle: var(--color-neutral-800);
  --color-bg-inverse: var(--color-neutral-0);

  --color-text-primary: var(--color-neutral-50);
  --color-text-secondary: var(--color-neutral-300);
  --color-text-tertiary: var(--color-neutral-500);
  --color-text-disabled: var(--color-neutral-600);
  --color-text-inverse: var(--color-neutral-900);

  --color-border-default: var(--color-neutral-700);
  --color-border-subtle: var(--color-neutral-800);
  --color-border-strong: var(--color-neutral-600);
}
