/* GRAPHIX base — reset, fonts, typography scale, layout primitives.
   Depends on tokens.css. Loads before components.css. */

/* ------------------------------------------------------------------ fonts */
/* Self-hosted and subset (Latin + Latin Ext + Cyrillic + the modifier letters
   Uzbek needs). Variable, so one file covers every weight. The old site pulled
   Inter from rsms.me — a third-party render-blocking request on every page. */
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-var.86f37a2e3806.woff2") format("woff2-variations");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Onest";
  src: url("../fonts/onest-var.535942824a36.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Declared but never preloaded: no storefront page uses mono, so the browser
   only fetches it if a page actually sets it (the admin panel, Phase 7). */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-400.752a81249c89.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

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

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--f-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);      /* 500 floor — see §17 #46 */
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
/* Phase 12 put the first <fieldset> on the site and the browser drew its own
   box around it — a 2 px groove border and 12 px of padding, in the middle of a
   design where no other field has an outline. `min-inline-size: min-content` is
   the other half of the UA default and is a known overflow trap inside a flex
   or grid parent, so it goes at the same time rather than waiting to be found. */
fieldset { margin: 0; padding: 0; border: 0; min-inline-size: 0; }
legend { padding: 0; }
a { color: inherit; text-decoration: none; }
/* A long unbreakable string — an email address, a URL — must never be what makes
   the page scroll sideways. Found at 360 px on the contact page, where
   abdurahmonboboyev.magic@gmail.com pushed the layout 21 px over.
   `anywhere` rather than `break-word` on purpose: only `anywhere` reduces the
   element's min-content width, and min-content is what a grid column sizes to.
   `break-word` stops the visual overflow but still lets the column grow, which
   is exactly how the first attempt at this fix failed. Paragraphs keep the
   gentler rule, since a long word there is not a layout risk. */
a, address, dd { overflow-wrap: anywhere; }
p { overflow-wrap: break-word; }
table { border-collapse: collapse; width: 100%; }
address { font-style: normal; }
[hidden] { display: none !important; }

::selection { background: var(--c-brand); color: var(--c-brand-fg); }

:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* One global guard, wired once (plan §9 Phase 2 item 8). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------- typography */
.h1, .h2, .h3 {
  font-family: var(--f-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}
.h1 { font-size: clamp(var(--fs-4xl), 8vw, var(--fs-5xl)); }
.h2 { font-size: clamp(var(--fs-2xl), 5vw, var(--fs-3xl)); }
.h3 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--ls-normal); }

.lede  { font-size: var(--fs-lg); color: var(--c-fg-muted); line-height: var(--lh-normal); }
.body  { max-width: 62ch; color: var(--c-fg-muted); }
.small { font-size: var(--fs-sm); }
.muted { color: var(--c-fg-muted); }
.subtle{ color: var(--c-fg-hint); }

/* Small uppercase label. Used for every field label and section eyebrow. */
.eyebrow, .label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--c-fg-muted);
}

/* Prices, quantities, measurements — anything that lines up in a column. */
.num { font-variant-numeric: tabular-nums; }

.link {
  color: var(--c-brand);
  border-bottom: 1px solid color-mix(in srgb, var(--c-brand) 40%, transparent);
  padding-bottom: 1px;
  transition: border-color var(--t-fast);
}
.link:hover { border-bottom-color: var(--c-brand); }

/* --------------------------------------------------------- layout helpers */
.wrap      { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--pad-x); }

.stack     { display: flex; flex-direction: column; gap: var(--s-4); }
.stack--sm { gap: var(--s-2); }
.stack--lg { gap: var(--s-6); }

.row        { display: flex; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.row--wrap  { flex-wrap: wrap; }

.section    { padding-block: var(--s-7); }
.section--tight { padding-block: var(--s-4); }

.rule { border: 0; border-top: 1px solid var(--c-line); margin: 0; }

/* Wide content never makes the page scroll sideways (plan §5). */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Icons come from one inline SVG sprite; no icon fonts (plan §9 item 9). */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
     stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i--sm { width: 16px; height: 16px; }
.i--lg { width: 24px; height: 24px; }
.i--solid { fill: currentColor; stroke: none; }
