/* ============================================================
   Design system — tokens and shared components
   Figma: Yd8ZeTmsOVdXZy64vXqLzE, pages "Foundation" (colour variables,
   text styles) and "Components" (Button, Badge, Input Field, Icon Button,
   Breadcrumb, Pagination, Product Card, Navbar, Footer).
   Loaded on every page by templates/core/base.html, before the page
   stylesheets, so they can build on these tokens.
   ============================================================ */

:root {
  /* ---- colour (Foundation / Colours) ---- */
  --neutral-white: #f8f8f8;
  --neutral-black: #0f0f0f;
  --neutral-50:  #f1f4f2;
  --neutral-100: #e0e3e1;
  --neutral-150: #d9d9d9;
  --neutral-200: #c4c2c2;
  --neutral-500: #757687;
  --neutral-600: #575757;
  --neutral-700: #414752;
  --slate-200:   #c1c7d3;
  --blue-100: #dce8ff;
  --blue-500: #007ee2;
  --blue-600: #005ca7;
  --blue-800: #00457c;
  --green-50:  #ecfdf5;
  --green-200: #a7f3d0;
  --green-500: #10b981;
  --green-600: #059669;
  --green-700: #047857;
  --shadow-ink-5:   rgba(15, 15, 15, 0.05);
  --shadow-ink-10:  rgba(15, 15, 15, 0.1);
  --shadow-ink-25:  rgba(15, 15, 15, 0.25);
  --shadow-blue-10: rgba(0, 92, 167, 0.1);

  /* ---- type (Foundation / Typography) ---- */
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-display-ds: "Plus Jakarta Sans", "Inter", sans-serif;
}

/* ---- Persian (fa) ----
   Inter and Plus Jakarta Sans have no Persian glyphs. Persian pages are set in
   Vazirmatn (loaded with them in base.html; it has Latin letters too, so a
   line keeps one typeface and even word spacing), the house fonts behind it.
   Every font token gets it, including the older ones from base.css/style.css
   (:root:lang(fa) outranks their :root). */
:root:lang(fa) {
  --font-sans: "Vazirmatn", "Inter", system-ui, -apple-system, sans-serif;
  --font-display-ds: "Vazirmatn", "Plus Jakarta Sans", "Inter", sans-serif;
  --font-body: var(--font-sans);
  --font-nav: var(--font-sans);
  --font-heading: var(--font-display-ds);
  --font-display: var(--font-display-ds);
  --font-mono-caps: "Vazirmatn", "Poppins", sans-serif;
  --font-widget: "Vazirmatn", "Manrope", "Inter", sans-serif;
}

/* ---- Simplified Chinese (zh-hans) ----
   Inter and Plus Jakarta Sans have no Chinese glyphs. Noto Sans SC (loaded in
   base.html on Chinese pages only, one variable face for 400–800) sits behind the house
   fonts in every token, so Latin text (product names, CAS numbers, the brand)
   keeps its typeface and only the Chinese characters and full-width
   punctuation come from Noto. Google's slices of Noto Sans SC leave out the
   characters of elements 104–118 (鿭, 鿫, 𬬻, …); the ones the font has are
   vendored here under the same family name, so the periodic table shows them
   too (OFL, static/vendor/noto-sans-sc/). */
@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../vendor/noto-sans-sc/noto-sans-sc-new-elements.62769c790690.woff2") format("woff2");
  unicode-range: U+9FCF, U+9FD4, U+9FEB-9FED, U+2B4E7, U+2B7FC, U+2CB2D, U+2CB3B, U+2CB4A,
    U+2CB5B, U+2CB73, U+2CB76;
}

:root:lang(zh-hans) {
  --font-sans: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-display-ds: "Plus Jakarta Sans", "Inter", "Noto Sans SC", sans-serif;
  --font-body: var(--font-sans);
  --font-nav: var(--font-sans);
  --font-heading: var(--font-display-ds);
  --font-display: var(--font-display-ds);
  --font-mono-caps: "Poppins", "Noto Sans SC", sans-serif;
  --font-widget: "Manrope", "Inter", "Noto Sans SC", sans-serif;
}

/* ---- Georgian (ka) ----
   The house fonts have no Georgian (Mkhedruli) letters. Noto Sans Georgian
   (loaded in base.html on Georgian pages only) sits behind them in every token,
   so Latin text keeps its typeface. */
:root:lang(ka) {
  --font-sans: "Inter", "Noto Sans Georgian", system-ui, -apple-system, sans-serif;
  --font-display-ds: "Plus Jakarta Sans", "Inter", "Noto Sans Georgian", sans-serif;
  --font-body: var(--font-sans);
  --font-nav: var(--font-sans);
  --font-heading: var(--font-display-ds);
  --font-display: var(--font-display-ds);
  --font-mono-caps: "Poppins", "Noto Sans Georgian", sans-serif;
  --font-widget: "Manrope", "Inter", "Noto Sans Georgian", sans-serif;
}

/* Chinese has no letter case, and tracking tuned for Latin (wide caps labels,
   tight display headings) spreads or crushes CJK characters: set it without.
   Elements in another language (the language menu's entries) keep theirs. */
:lang(zh-hans) { letter-spacing: normal !important; }
/* No Chinese italics: the browser would only slant the glyphs. */
:lang(zh-hans) :is(em, i, cite) { font-style: normal; }
/* Chinese breaks between any two characters: balance headings so a line
   doesn't end with one character on its own. */
:lang(zh-hans) :is(h1, h2, h3) { text-wrap: balance; }

/* ---- Right-to-left (Persian) ----
   <html dir="rtl"> flips the layout through logical properties
   (margin-inline-start, inset-inline-end, text-align: start, …), which every
   stylesheet uses instead of left/right. Arrows and chevrons that point along
   the reading direction carry .icon-dir and are mirrored here. */
[dir="rtl"] .icon-dir { transform: scaleX(-1); }
/* E-mail addresses, phone numbers and URLs are left-to-right text: typed (and
   their placeholders shown) that way, at the field's right edge. */
[dir="rtl"] input:is([type="email"], [type="tel"], [type="url"], [name="phone_number"]) {
  direction: ltr;
  text-align: end;  /* the right edge: "end" follows the field's own (ltr) direction */
}

/* ============================================================
   Button
   Colour: primary | ghost | outline | light | outline-light
   Size:   s (36) | m (48, default) | l (56)
   Radius: pill (default) | rounded (12px)
   <a class="button button--primary button--l">Label</a>
   An icon after the label: <svg class="button__icon">…</svg>
   ============================================================ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.14px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.button--s { height: 36px; padding: 0 16px; }
.button--l { height: 56px; padding: 0 32px; font-size: 16px; line-height: 24px; letter-spacing: 0; }
.button--rounded { border-radius: 12px; }
.button--block { display: flex; width: 100%; }

.button__icon { width: 16px; height: 16px; flex-shrink: 0; }

.button--primary { background: var(--blue-600); color: var(--neutral-white); }
.button--primary:hover { background: var(--blue-500); }
.button--primary:active { background: var(--blue-800); }

.button--ghost { color: var(--blue-600); }
.button--ghost:hover { background: var(--blue-100); }
.button--ghost:active { background: var(--blue-100); color: var(--blue-800); }

.button--outline { border-color: var(--blue-600); color: var(--blue-600); }
.button--outline:hover { background: var(--blue-100); }
.button--outline:active { background: var(--blue-100); border-color: var(--blue-800); color: var(--blue-800); }

.button--light { background: var(--neutral-white); color: var(--blue-600); }
.button--light:hover { background: var(--neutral-100); }
.button--light:active { background: var(--neutral-150); color: var(--blue-800); }

.button--outline-light { border-color: var(--neutral-200); color: var(--neutral-white); }
.button--outline-light:hover { background: rgba(248, 248, 248, 0.1); }
.button--outline-light:active { background: rgba(248, 248, 248, 0.2); border-color: var(--neutral-white); }

.button:disabled,
.button[aria-disabled="true"] { pointer-events: none; }
.button--primary:disabled { background: var(--neutral-100); color: var(--neutral-500); }
.button--outline:disabled { border-color: var(--neutral-200); color: var(--neutral-500); }
.button--ghost:disabled { color: var(--neutral-500); }

.button:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* ============================================================
   Badge (Bio-Rational)
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 9999px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0;
  text-transform: none;  /* base.css has an older uppercase .badge */
  color: var(--green-700);
  white-space: nowrap;
}

/* ============================================================
   Icon Button (Favorite)
   ============================================================ */

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: #fff;
  color: var(--neutral-500);
  cursor: pointer;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: background-color .15s ease;
}
.icon-button:hover { background: var(--neutral-100); }
.icon-button:active { background: var(--neutral-150); }

/* ============================================================
   Input Field / Textarea
   ============================================================ */

.input {
  display: block;
  width: 100%;
  padding: 17px;
  background: var(--neutral-50);
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  color: var(--neutral-black);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--neutral-500); opacity: 1; }
.input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px var(--shadow-blue-10);
}
textarea.input { min-height: 156px; resize: vertical; }

.field-label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0.7px;
  color: var(--neutral-black);
}

/* ============================================================
   Breadcrumb
   ============================================================ */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
}

.breadcrumb__item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--neutral-600);
}

.breadcrumb__item + .breadcrumb__item::before {
  content: "";
  width: 16px;
  height: 16px;
  background: url("../img/icon-chevron-right.a76e7bf2bae6.svg") center / 16px no-repeat;
}
[dir="rtl"] .breadcrumb__item + .breadcrumb__item::before { transform: scaleX(-1); }

.breadcrumb__link { color: inherit; text-decoration: none; }
.breadcrumb__link:hover { color: var(--blue-600); }

.breadcrumb__item--current {
  font-weight: 600;
  letter-spacing: 0.14px;
  color: var(--neutral-black);
}

/* ============================================================
   Pagination
   ============================================================ */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
}

.pager__button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--neutral-150);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  letter-spacing: 0.14px;
  color: var(--neutral-700);
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.pager__button svg { width: 16px; height: 16px; }
.pager__button:hover { background: var(--blue-100); border-color: var(--blue-600); color: var(--blue-600); }
.pager__button:active { background: var(--blue-100); border-color: var(--blue-800); color: var(--blue-800); }

.pager__button--current,
.pager__button--current:hover {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: var(--neutral-white);
}

.pager__button--disabled {
  border-color: var(--neutral-100);
  color: var(--neutral-500);
  pointer-events: none;
}

.pager__ellipsis {
  font-size: 14px;
  line-height: 20px;
  color: var(--neutral-500);
}
