/* ---------------------------------------------------------------------------
   TechPlast design tokens.

   Two layers, unchanged in principle from the first build: the palette names
   colours, the semantic layer names roles, and components only ever reach for a
   role. That is what makes a theme a change of thirty values instead of a change
   everywhere.

   What changed is the temperature. The catalogue photography is shot on a warm
   seamless sweep, and a stark white page framed every one of those photographs
   as a grey rectangle sitting on white. The ground is now a warm bone that the
   sweep sits inside rather than on top of, so the product is the only cool thing
   on the page. Navy and ember stay -- they are the company colours -- but navy
   is now structural (header, footer, ink) rather than a background for content.

   Dark mode is not the light palette inverted. Inverting warm bone gives a muddy
   brown; these are cool-neutral charcoals that let the same warm photography
   read as lit rather than stained, with borders that gain contrast in the dark
   rather than losing it.
   --------------------------------------------------------------------------- */
:root {
  /* ---- Palette: raw colour, referenced only by the semantic layer below ---- */
  --navy-900: #070d13;
  --navy-800: #0b141d;
  --navy-700: #101c28;
  --navy-600: #1a2d3f;
  --navy-500: #274158;

  --ember-600: #c2500f;
  --ember-500: #e2611b;
  --ember-400: #f97e35;
  --ember-300: #ffa268;

  /* Warm neutrals. The 100/200 pair is the page and the plate a product sits on. */
  --bone-50: #fdfcfa;
  --bone-100: #f6f3ee;
  --bone-200: #efeae1;
  --bone-300: #e3dcd0;
  --bone-400: #d3c9b9;
  --stone-500: #77726a;
  --stone-600: #5c5850;
  --white: #fff;

  --green-500: #10714a;
  --green-100: #d9f2e6;
  --amber-500: #8f5a00;
  --amber-100: #ffeec4;
  --red-500: #ad1f2b;
  --red-100: #fce9ea;
  --blue-500: #1c5a96;
  --blue-100: #dbe9f6;

  /* ---- Semantic: what components actually use ---- */
  --surface: var(--bone-100);
  --surface-raised: var(--bone-50);
  --surface-sunken: var(--bone-200);
  --surface-plate: var(--bone-200);
  --surface-inverse: var(--navy-800);
  /* Frosted bars over scrolling content. */
  --glass: rgba(253, 252, 250, .72);
  --glass-border: rgba(16, 28, 40, .08);

  --text: #111820;
  --text-muted: var(--stone-500);
  --text-subtle: var(--stone-600);
  --text-on-brand: #fff;
  --text-on-inverse: #f2efe9;

  --border: var(--bone-300);
  --border-strong: var(--bone-400);
  --border-hair: rgba(17, 24, 32, .09);

  --brand: var(--navy-800);
  --brand-hover: var(--navy-600);
  --accent: var(--ember-500);
  --accent-hover: var(--ember-600);
  --accent-text: var(--ember-600);
  --accent-wash: rgba(226, 97, 27, .1);

  --success: var(--green-500);
  --success-surface: var(--green-100);
  --warning: var(--amber-500);
  --warning-surface: var(--amber-100);
  --danger: var(--red-500);
  --danger-surface: var(--red-100);
  --info: var(--blue-500);
  --info-surface: var(--blue-100);

  /* Chart ink. Not --brand: that is a surface colour in dark mode and the bars vanish into it. */
  --chart-bar: var(--navy-700);
  --chart-track: var(--bone-300);

  /* ---- Elevation. Layered rather than single, so a shadow has a contact edge
     as well as an ambient bloom and does not read as a grey smear. ---- */
  --shadow-xs: 0 1px 2px rgba(17, 24, 32, .05);
  --shadow-sm: 0 1px 2px rgba(17, 24, 32, .05), 0 4px 12px rgba(17, 24, 32, .05);
  --shadow: 0 2px 4px rgba(17, 24, 32, .04), 0 12px 28px rgba(17, 24, 32, .08);
  --shadow-lg: 0 4px 8px rgba(17, 24, 32, .05), 0 28px 60px rgba(17, 24, 32, .13);
  --shadow-ember: 0 10px 30px rgba(226, 97, 27, .28);

  color-scheme: light;
}

/* ---- Theme-independent: shape, type, space, motion ---- */
:root {
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --radius-pill: 999px;

  --font-display: "Space Grotesk var", "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter var", Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-arabic: "Cairo var", Cairo, "Segoe UI", Tahoma, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, monospace;

  /* Fluid type. One scale for the whole site: a heading is a step, never a
     hand-picked pixel size, which is what keeps a page rhythm intact when the
     same page is read at 1280px and at 380px. */
  --step--2: clamp(.69rem, .67rem + .1vw, .75rem);
  --step--1: clamp(.81rem, .78rem + .15vw, .89rem);
  --step-0: clamp(1rem, .97rem + .17vw, 1.09rem);
  --step-1: clamp(1.2rem, 1.13rem + .35vw, 1.44rem);
  --step-2: clamp(1.44rem, 1.31rem + .64vw, 1.9rem);
  --step-3: clamp(1.73rem, 1.5rem + 1.1vw, 2.5rem);
  --step-4: clamp(2.07rem, 1.7rem + 1.8vw, 3.3rem);
  --step-5: clamp(2.49rem, 1.9rem + 2.9vw, 4.35rem);
  --step-6: clamp(2.99rem, 2.05rem + 4.6vw, 5.73rem);

  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: .75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: clamp(4rem, 9vw, 8rem);

  /* Motion. Three easings carry the whole site: expo for anything entering
     (fast start, long settle -- it reads as physical), soft for state changes,
     spring for the few things that should feel handled, like a chip or a badge. */
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --dur-1: 140ms;
  --dur-2: 260ms;
  --dur-3: 480ms;
  --dur-4: 760ms;
  --dur-5: 1100ms;

  --header-h: 76px;
}

:root[data-theme="dark"] {
  --surface: #0b1016;
  --surface-raised: #131a22;
  --surface-sunken: #070b0f;
  --surface-plate: #1a232c;
  --surface-inverse: #131a22;
  --glass: rgba(11, 16, 22, .72);
  --glass-border: rgba(255, 255, 255, .08);

  --text: #e9e7e2;
  --text-muted: #9aa2ac;
  --text-subtle: #b4bac2;
  --text-on-brand: #fff;
  --text-on-inverse: #e9e7e2;

  /* A light-mode hairline is invisible on a dark ground; these gain contrast. */
  --border: #232d38;
  --border-strong: #35424f;
  --border-hair: rgba(255, 255, 255, .07);

  --brand: #131a22;
  --brand-hover: #1d2731;
  --accent: var(--ember-500);
  --accent-hover: var(--ember-400);
  /* The light-mode accent text is too dark to read on a dark ground. */
  --accent-text: var(--ember-300);
  --accent-wash: rgba(249, 126, 53, .14);

  --success: #4fcf8f;
  --success-surface: #0e3421;
  --warning: #f2b53a;
  --warning-surface: #35280b;
  --danger: #ff8080;
  --danger-surface: #3c161a;
  --info: #7fb9f0;
  --info-surface: #10273c;

  --chart-bar: #7cb4e6;
  --chart-track: #1b242e;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .4);
  --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 12px 28px rgba(0, 0, 0, .5);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, .5), 0 28px 60px rgba(0, 0, 0, .62);
  --shadow-ember: 0 10px 30px rgba(226, 97, 27, .3);

  color-scheme: dark;
}

/* No stored preference means the operating system decides. The guard keeps an
   explicit light choice winning over a dark system setting; without it, choosing
   light on a dark-mode machine would appear to do nothing. It also matches
   data-theme="", which is what the server renders when nobody has chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #0b1016;
    --surface-raised: #131a22;
    --surface-sunken: #070b0f;
    --surface-plate: #1a232c;
    --surface-inverse: #131a22;
    --glass: rgba(11, 16, 22, .72);
    --glass-border: rgba(255, 255, 255, .08);

    --text: #e9e7e2;
    --text-muted: #9aa2ac;
    --text-subtle: #b4bac2;
    --text-on-brand: #fff;
    --text-on-inverse: #e9e7e2;

    --border: #232d38;
    --border-strong: #35424f;
    --border-hair: rgba(255, 255, 255, .07);

    --brand: #131a22;
    --brand-hover: #1d2731;
    --accent: var(--ember-500);
    --accent-hover: var(--ember-400);
    --accent-text: var(--ember-300);
    --accent-wash: rgba(249, 126, 53, .14);

    --success: #4fcf8f;
    --success-surface: #0e3421;
    --warning: #f2b53a;
    --warning-surface: #35280b;
    --danger: #ff8080;
    --danger-surface: #3c161a;
    --info: #7fb9f0;
    --info-surface: #10273c;

    --chart-bar: #7cb4e6;
    --chart-track: #1b242e;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .4);
    --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 12px 28px rgba(0, 0, 0, .5);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, .5), 0 28px 60px rgba(0, 0, 0, .62);
    --shadow-ember: 0 10px 30px rgba(226, 97, 27, .3);

    color-scheme: dark;
  }
}

/* Aliases kept so rules written against the first build keep resolving. New
   rules use the role names above. */
:root {
  --ink: var(--text);
  --navy: var(--brand);
  --navy-2: var(--brand-hover);
  --orange: var(--accent);
  --orange-dark: var(--accent-text);
  --orange-500: var(--ember-500);
  --orange-400: var(--ember-400);
  --orange-600: var(--ember-600);
  --paper: var(--surface-raised);
  --mist: var(--surface-sunken);
  --line: var(--border);
  --muted: var(--text-muted);
  --grey-100: var(--bone-100);
  --grey-200: var(--bone-200);
  --grey-300: var(--bone-300);
  --grey-500: var(--stone-500);
}
