/* ==========================================================================
   TRIONEX — base.css
   Design tokens, reset, typography, primitives, utilities.
   Load this FIRST. Every other stylesheet builds on these tokens.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* --- Type families --- */
  --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;   /* body copy */
  --font-head: "Outfit", "DM Sans", system-ui, sans-serif;        /* headings, nav, UI labels */
  --font-display: "Outfit", "DM Sans", system-ui, sans-serif;     /* hero titles */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;    /* part numbers */

  /* --- Colour (light theme, from the Trionex logo) --- */
  --color-bg: #ffffff;
  --color-surface: #f4f7fb;
  --color-surface-2: #eef2f8;
  --color-surface-3: #e3e9f2;

  --color-brand: #0a2a66;        /* logo navy */
  --color-brand-deep: #001331;
  --color-brand-bright: #0a5bd3; /* logo blue highlight */

  --color-text: #0b1b33;
  --color-text-muted: #3d4b63;
  --color-text-light: #5d6a80;
  --color-text-faint: #7a8699;

  --color-border: rgba(11, 27, 51, 0.10);
  --color-border-strong: rgba(11, 27, 51, 0.22);

  --color-accent: #0b3d91;       /* navy blue — primary accent */
  --color-accent-hover: #082c6b;
  --color-accent-soft: #e8eefa;
  --color-accent-light: #6aa8ff; /* accent on dark backgrounds */

  /* navy gradient used on buttons and active states */
  --gradient-navy: linear-gradient(135deg, #1a56c4 0%, #0b3d91 45%, #06224f 100%);
  --gradient-navy-hover: linear-gradient(135deg, #2466dc 0%, #0e47a8 45%, #082c6b 100%);
  --color-accent-ink: #ffffff;   /* text placed on top of the accent */

  --color-success: #0b3d91;
  --color-warning: #b45309;
  --color-danger: #c62828;

  /* --- Type scale --- */
  --font-size-mono: 0.75rem;   /* legacy alias — prefer the rem sizes below */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: clamp(1.05rem, 1.3vw, 1.175rem);
  --text-xl: clamp(1.25rem, 1.8vw, 1.5rem);
  --text-2xl: clamp(1.6rem, 2.6vw, 2.125rem);
  --text-3xl: clamp(2rem, 3.6vw, 3rem);
  --text-4xl: clamp(2.5rem, 5.4vw, 4.25rem);

  --leading-tight: 1.1;
  --leading-snug: 1.3;
  --leading-normal: 1.6;
  --tracking-wide: 0.03em;
  --tracking-wider: 0.10em;

  /* --- Spacing --- */
  --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;
  --space-9: 6rem;
  --space-10: 8rem;

  /* legacy aliases from the original spec */
  --spacing-sm: var(--space-3);
  --spacing-md: var(--space-4);

  /* --- Layout --- */
  --container: 1320px;
  --container-narrow: 820px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --header-h: 76px;
  --header-h-scrolled: 64px;
  --announce-h: 36px;

  /* --- Shape --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  /* --- Motion --- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 180ms;
  --dur-mid: 320ms;
  --dur-slow: 600ms;

  /* --- Elevation --- */
  --shadow-sm: 0 1px 2px rgba(11, 27, 51, 0.06);
  --shadow-md: 0 10px 28px rgba(11, 27, 51, 0.10);
  --shadow-lg: 0 24px 60px rgba(11, 27, 51, 0.16);

  /* --- Stacking --- */
  --z-base: 1;
  --z-sticky: 50;
  --z-header: 100;
  --z-drawer: 200;
  --z-modal: 300;
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  min-height: 100svh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas, picture {
  display: block;
  max-width: 100%;
}
img, video { height: auto; }

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
  padding: 0;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

::selection {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(11,27,51,0.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
  background: rgba(11, 27, 51, 0.18);
  border: 3px solid var(--color-bg);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(11, 27, 51, 0.32); }

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--color-text);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p { text-wrap: pretty; }
p + p { margin-top: var(--space-4); }

strong, b { font-weight: 500; }
small { font-size: var(--text-sm); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
}

/* Small uppercase label — used above section headings */
.eyebrow {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-light);
}
.eyebrow--accent { color: var(--color-accent); }

.lead {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 62ch;
}

.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-accent { color: var(--color-accent); }
.mono { font-family: var(--font-mono); }

/* Inline link with an underline that draws in on hover */
.link {
  position: relative;
  color: var(--color-text);
  padding-bottom: 2px;
}
.link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-mid) var(--ease-out);
}
.link:hover::after { transform: scaleX(1); transform-origin: left; }
.link--accent:hover { color: var(--color-accent); }

/* --------------------------------------------------------------------------
   4. LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }
.container--full { max-width: none; }

/* Anchor links must not drop a section's heading behind the fixed header. */
section[id],
[id].section {
  scroll-margin-top: calc(var(--header-h) + var(--announce-h) + var(--space-4));
}

.section { padding-block: clamp(3.5rem, 9vh, var(--space-9)); }
.section--tight { padding-block: var(--space-6); }
.section--flush { padding-block: 0; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.section-head__title { margin-top: var(--space-2); }

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-6); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}

.divider {
  height: 1px;
  background: var(--color-border);
  border: 0;
  margin: 0;
}

/* --------------------------------------------------------------------------
   5. BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-border: var(--color-border-strong);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.85em 1.6em;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn:hover { border-color: var(--color-text); }
.btn { font-size: 0.875rem; }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.btn--primary,
.btn--solid {
  --btn-fg: #ffffff;
  --btn-border: transparent;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--gradient-navy);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(11, 61, 145, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: box-shadow var(--dur-mid) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn--primary:hover,
.btn--solid:hover {
  background: var(--gradient-navy-hover);
  box-shadow: 0 10px 26px rgba(11, 61, 145, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

/* Shine — a soft light band sweeps across every few seconds,
   and straight away on hover. */
.btn--primary::after,
.btn--solid::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -60%;
  width: 45%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(100deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.08) 30%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0.08) 70%,
    rgba(255, 255, 255, 0) 100%);
  transform: skewX(-20deg);
  animation: btn-shine 4.5s var(--ease-in-out) infinite;
}
.btn--primary:hover::after,
.btn--solid:hover::after { animation: btn-shine-fast 0.75s var(--ease-out) 1; }

@keyframes btn-shine {
  0%, 70% { left: -60%; }
  100%    { left: 130%; }
}
@keyframes btn-shine-fast {
  from { left: -60%; }
  to   { left: 130%; }
}

.btn--ghost { --btn-border: transparent; color: var(--color-text-muted); }
.btn--ghost:hover { color: var(--color-text); --btn-border: var(--color-border); }

.btn--sm { padding: 0.6em 1.1em; font-size: 0.75rem; }
.btn--lg { padding: 1.05em 2.1em; font-size: 0.9375rem; }
.btn--block { width: 100%; }

.btn svg { width: 1.05em; height: 1.05em; }

/* --------------------------------------------------------------------------
   6. FORMS
   -------------------------------------------------------------------------- */
.field { display: grid; gap: var(--space-2); }

.label {
  font-family: var(--font-head);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-light);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.85em 1em;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}
.input::placeholder,
.textarea::placeholder { color: var(--color-text-faint); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--color-border-strong); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--color-accent);
  background: var(--color-bg);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}
.textarea { min-height: 7rem; resize: vertical; }

/* --------------------------------------------------------------------------
   7. SURFACES & BADGES
   -------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--dur-mid) var(--ease-out),
              transform var(--dur-mid) var(--ease-out),
              background var(--dur-mid) var(--ease-out);
}
.card--link:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-2);
  transform: translateY(-3px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.7em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-family: var(--font-head);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-muted);
}
.badge--stock { color: var(--color-success); border-color: rgba(11, 61, 145, 0.35); }
.badge--low { color: var(--color-warning); border-color: rgba(180, 83, 9, 0.35); }
.badge--out { color: var(--color-danger); border-color: rgba(198, 40, 40, 0.35); }

/* --------------------------------------------------------------------------
   8. UTILITIES
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-modal);
  padding: 0.75em 1.25em;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-radius: var(--radius-md);
  font-family: var(--font-head);
  font-size: var(--text-sm);
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.no-scroll { overflow: hidden; }

.hide { display: none !important; }
@media (max-width: 860px)  { .hide\@md { display: none !important; } }
@media (min-width: 861px)  { .show\@md { display: none !important; } }

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.full-bleed { width: 100vw; margin-inline: calc(50% - 50vw); }

/* --------------------------------------------------------------------------
   9. MOTION PREFERENCES
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
