/* ==========================================================================
   FLUX PRIME — 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: "Inter", "PP Neue Montreal", system-ui, -apple-system, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;  /* headings, nav, UI labels */
  --font-display: "Cormorant Garamond", serif;                   /* hero titles ONLY */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;    /* code, part numbers */

  /* --- Colour --- */
  --color-bg: #0a0a0a;
  --color-surface: #101012;
  --color-surface-2: #17171a;
  --color-surface-3: #1f1f23;

  --color-text: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.7);
  --color-text-light: rgba(255, 255, 255, 0.5);
  --color-text-faint: rgba(255, 255, 255, 0.32);

  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-strong: rgba(255, 255, 255, 0.2);

  /* Brand blue, sampled from the FluxPrime logo. Swap --color-accent to
     this value if you want the whole UI to match the logo instead of gold. */
  --color-brand: #0085fb;
  --color-brand-deep: #0057d9;

  --color-accent: #d4af37;
  --color-accent-hover: #e6c65a;
  --color-accent-ink: #0a0a0a; /* text placed on top of the accent */

  --color-success: #4ade80;
  --color-warning: #fbbf24;
  --color-danger: #f87171;

  /* --- 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-wide: 1560px;   /* catalogue / listing pages */
  --container-narrow: 820px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --header-h: 72px;
  --header-h-scrolled: 60px;
  --announce-h: 36px;

  /* --- Shape --- */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --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(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);

  /* --- 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: 300;
  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(255,255,255,0.18) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border: 3px solid var(--color-bg);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 500;
  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: 500;
  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--wide { max-width: var(--container-wide); }
.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:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.btn--primary {
  --btn-bg: var(--color-accent);
  --btn-fg: var(--color-accent-ink);
  --btn-border: var(--color-accent);
}
.btn--primary { font-weight: 600; }
.btn--primary:hover {
  --btn-bg: var(--color-accent-hover);
  --btn-border: var(--color-accent-hover);
}

.btn--solid {
  --btn-bg: var(--color-text);
  --btn-fg: var(--color-bg);
  --btn-border: var(--color-text);
}
.btn--solid:hover { --btn-bg: rgba(255,255,255,0.88); }

.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-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  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-surface-3);
}
.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(74, 222, 128, 0.35); }
.badge--low { color: var(--color-warning); border-color: rgba(251, 191, 36, 0.35); }
.badge--out { color: var(--color-danger); border-color: rgba(248, 113, 113, 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;
  }
}

/* --------------------------------------------------------------------------
   Server-rendered status messages
   One-off notices the backend passes through the session: a coupon applied,
   an item added, a form that could not be saved.
   -------------------------------------------------------------------------- */
.site-flash {
  display: grid;
  gap: var(--space-2);
  /* The header is fixed, so the first thing inside <main> has to clear it
     or the message hides behind the navigation. */
  padding-top: calc(var(--header-h) + var(--announce-h) + var(--space-4));
}
/* ...and when it does, the page head below it must not add the gap twice. */
.site-flash + .page-head { padding-top: var(--space-6); }
.note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.note--success {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.35);
  color: var(--color-success);
}
.note--error {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--color-danger);
}
.note--info {
  background: rgba(0, 133, 251, 0.08);
  border-color: rgba(0, 133, 251, 0.32);
  color: var(--color-text);
}


/* --------------------------------------------------------------------------
   Page head
   Used by every page except the home page, whose hero fills this space.
   The top padding clears the fixed header and the announcement strip.
   -------------------------------------------------------------------------- */
.page-head {
  padding-top: calc(var(--header-h) + var(--announce-h) + var(--space-7));
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background:
    radial-gradient(90% 140% at 12% 0%, rgba(212, 175, 55, 0.07), transparent 60%),
    var(--color-bg);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-faint);
}
.breadcrumb a { color: var(--color-text-light); }
.breadcrumb a:hover { color: var(--color-text); }
.breadcrumb li[aria-current] { color: var(--color-text-muted); }
.breadcrumb__sep { color: var(--color-border-strong); }

.page-head__title {
  margin-top: var(--space-4);
  font-size: var(--text-3xl);
}
.page-head__intro {
  margin-top: var(--space-3);
  max-width: 68ch;
  color: var(--color-text-muted);
  font-size: var(--text-base);
}
