/* ==========================================================================
   Base: reset, typography, layout primitives, buttons, forms, motion
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* Smooth scrolling (anchor links) is switched on only after load, so the browser's scroll restoration on refresh
   jumps instantly instead of animating from the bottom of the page. */
html.smooth-scroll { scroll-behavior: smooth; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.53;
  letter-spacing: -0.011em;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* Smooth theme change: enabled only while switching (see main.js) */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 450ms var(--ease-in-out), border-color 450ms var(--ease-in-out),
    color 450ms var(--ease-in-out), fill 450ms var(--ease-in-out), box-shadow 450ms var(--ease-in-out) !important;
}

/* ---------- Layout ---------- */
.shell {
  width: min(var(--container), 100% - 2 * var(--gutter));
  margin-inline: auto;
}
.shell-narrow { width: min(var(--container-narrow), 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: var(--section-space); }
.surface-band { background: var(--surface); }
.section--flush-top { padding-top: 0; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-contrast); font-size: var(--fs-small); font-weight: 600;
  transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: 12px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Typography ---------- */
.display {
  font-size: var(--fs-display); line-height: 1.02; font-weight: 700;
  letter-spacing: var(--tracking-display); text-wrap: balance;
}
.h1 {
  font-size: var(--fs-h1); line-height: 1.05; font-weight: 700;
  letter-spacing: var(--tracking-display); text-wrap: balance;
}
.h2 {
  font-size: var(--fs-h2); line-height: 1.07; font-weight: 700;
  letter-spacing: var(--tracking-heading); text-wrap: balance;
}
.h3 { font-size: var(--fs-h3); line-height: 1.14; font-weight: 650; letter-spacing: var(--tracking-title); }
.title { font-size: var(--fs-title); line-height: 1.26; font-weight: 600; letter-spacing: var(--tracking-title); }
.lead {
  font-size: var(--fs-lead); line-height: 1.42; color: var(--text-secondary);
  letter-spacing: -0.016em; text-wrap: pretty; max-width: 40ch;
}
.body-copy { color: var(--text-secondary); text-wrap: pretty; }
.caption { font-size: var(--fs-caption); line-height: 1.38; color: var(--text-secondary); letter-spacing: -0.006em; }
.muted { color: var(--text-secondary); }
.gradient-text {
  background: linear-gradient(100deg, var(--accent) 10%, light-dark(#5a4bff, #8f86ff) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--fs-caption); font-weight: 600; line-height: 1.2;
  color: var(--text-secondary); letter-spacing: 0; margin-bottom: 14px;
}
.eyebrow-accent { color: var(--accent); }
.overline {
  font-size: var(--fs-micro); font-weight: 600; letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase; color: var(--text-tertiary);
}

/* Section header */
.section-head { max-width: 720px; margin-bottom: clamp(2.5rem, 1.8rem + 3vw, 4.5rem); }
.section-head .h2 + p { margin-top: 18px; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .lead { margin-inline: auto; }
.section-head--split {
  max-width: none; display: flex; flex-wrap: wrap; gap: 20px 40px;
  justify-content: space-between; align-items: flex-end;
}
.section-head--split > div { max-width: 680px; }

/* ---------- Icons ---------- */
.icon {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 28px; height: 28px; stroke-width: 1.6; }

.icon-tile {
  --tile-size: 44px;
  width: var(--tile-size); height: var(--tile-size); flex: none;
  display: grid; place-items: center; border-radius: 12px;
  color: #fff;
  background: linear-gradient(160deg, var(--tile-from), var(--tile-to));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.28), 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.icon-tile .icon { width: 22px; height: 22px; stroke-width: 1.8; }
.icon-tile--soft { color: var(--accent); background: var(--accent-soft); box-shadow: none; }

/* ---------- Buttons ---------- */
.button {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bg-hover: var(--surface-sunken);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-body); font-weight: 500; line-height: 1.1; letter-spacing: -0.016em;
  white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease,
    transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.button:hover { background: var(--btn-bg-hover); }
.button:active { transform: scale(0.97); transition-duration: 80ms; }
.button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.button .icon { width: 18px; height: 18px; transition: transform var(--dur) var(--ease-out); }
.button:hover .icon-trail { transform: translateX(3px); }
.button[disabled], .button[aria-disabled="true"] {
  cursor: not-allowed; opacity: 0.45; transform: none; pointer-events: none;
}

.button-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-contrast); --btn-bg-hover: var(--accent-hover); }
.button-primary:active { background: var(--accent-pressed); }
.button-quiet { --btn-bg: var(--surface); --btn-bg-hover: var(--surface-sunken); }
.button-outline {
  --btn-bg: transparent; --btn-fg: var(--accent); --btn-bg-hover: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.button-inverse { --btn-bg: #f5f5f7; --btn-fg: #1d1d1f; --btn-bg-hover: #ffffff; }
.button-sm { min-height: 36px; padding: 8px 16px; font-size: var(--fs-small); }
.button-block, .full { width: 100%; }

.text-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-weight: 500; font-size: var(--fs-body);
  border-radius: 6px;
}
.text-link .icon { width: 16px; height: 16px; transition: transform var(--dur) var(--ease-out); }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.text-link:hover .icon { transform: translateX(3px); }
.text-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.text-button, .remove-button {
  border: 0; background: transparent; padding: 4px 0; cursor: pointer; border-radius: 6px;
  font-weight: 500;
}
.text-button { color: var(--accent); font-size: var(--fs-small); }
.text-button:hover { color: var(--accent-hover); }
.remove-button { color: var(--text-secondary); font-size: var(--fs-caption); }
.remove-button:hover { color: var(--danger); }
.text-button:focus-visible, .remove-button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------- Pills & badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: var(--fs-micro); font-weight: 600; line-height: 1.2; letter-spacing: 0;
  background: var(--surface); color: var(--text-secondary); white-space: nowrap;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
/* status label used across pages */
.unavailable, .mini-label {
  display: inline-flex; align-items: center; padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: var(--fs-micro); font-weight: 600; line-height: 1.2;
  background: var(--surface); color: var(--text-secondary); white-space: nowrap;
}

/* ---------- Notice ---------- */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text);
  font-size: var(--fs-small); line-height: 1.45;
}
.notice .icon { color: var(--accent); width: 18px; height: 18px; margin-top: 1px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 8px; font-size: var(--fs-small); font-weight: 500; }
.input {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: var(--fs-body);
  outline: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease-out);
}
.password-control { position: relative; }
.password-control .input { padding-right: 76px; }
.password-toggle { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); border: 0; border-radius: 8px; padding: 5px 8px; background: transparent; color: var(--accent); font: inherit; font-size: var(--fs-caption); font-weight: 650; cursor: pointer; }
.password-toggle:hover { background: var(--accent-soft); }
.password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input:hover { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.input:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.field-error { margin: 7px 0 0; color: var(--danger); font-size: var(--fs-caption); }
/* shared by account, admin and product configurator forms */
.field label { display: flex; align-items: baseline; gap: 8px; }
.field-optional { font-size: var(--fs-micro); font-weight: 500; color: var(--text-tertiary); }
.field-hint-text { margin: 7px 0 0; font-size: var(--fs-caption); color: var(--text-secondary); }
.has-error .input { border-color: var(--danger); }
.input-select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }

.field-hint { margin: -8px 0 18px; color: var(--text-secondary); font-size: var(--fs-caption); }
.form-link { display: block; margin: 20px 0 0; text-align: center; color: var(--accent); font-size: var(--fs-small); }
.form-foot { margin: 18px 0 0; text-align: center; color: var(--text-secondary); font-size: var(--fs-small); }
.form-foot a, .form-link { font-weight: 500; }
.form-foot a { color: var(--accent); }
.form-link:hover, .form-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Flash messages ---------- */
.flash-stack {
  position: fixed; z-index: 60; top: calc(var(--header-h) + 14px); left: 50%;
  transform: translateX(-50%); width: min(520px, 100% - 32px);
  display: grid; gap: 8px;
  pointer-events: none;   /* the empty stack must never block clicks (e.g. the header search results under it) */
}
.flash {
  display: flex; gap: 10px; align-items: center;
  padding: 13px 18px; border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-raised) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  font-size: var(--fs-small);
  min-width: 0; overflow-wrap: anywhere; line-height: 1.4;
  pointer-events: auto;
  animation: flash-in 600ms var(--ease-spring) both, flash-out 500ms var(--ease-out) 6s forwards;
}
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.flash-success::before { background: var(--success); }
.flash-error::before { background: var(--danger); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-12px) scale(0.97); } }
@keyframes flash-out { to { opacity: 0; transform: translateY(-8px); visibility: hidden; pointer-events: none; } }

/* ---------- Page entrance (plays without JS, ends fully visible) ---------- */
[data-hero] { animation: hero-rise 1100ms var(--ease-out) both; animation-delay: calc(var(--d, 0) * 100ms + 60ms); }
@keyframes hero-rise { from { opacity: 0; transform: translate3d(0, 22px, 0); filter: blur(6px); } }

/* ---------- Scroll reveal ----------
   Content is only hidden once JS has marked <html class="js">, so it is
   always visible when scripts fail. */
.page-home.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 900ms var(--ease-out), transform 1100ms var(--ease-out);
  transition-delay: calc(var(--reveal-index, 0) * 80ms);
  will-change: opacity, transform;
}
.page-home.js [data-reveal="scale"] { transform: translate3d(0, 20px, 0) scale(0.97); }
.page-home.js [data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html.smooth-scroll { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0ms !important;
  }
  .page-home.js [data-reveal] { opacity: 1; transform: none; }
}

/* Short pages (e.g. a bag with one item on a tall screen): the content area grows so the footer sits at the
   bottom of the window instead of leaving an empty band under it. */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
body > main#content { flex: 1 0 auto; }
body > .site-footer, body > .share-strip { flex-shrink: 0; }
