/* ==========================================================================
   3 DRIP — storefront design system · core
   --------------------------------------------------------------------------
   Swiss editorial minimalism × Algerian streetwear × restrained glass.

   One stylesheet family replaces the inherited frodix-core / frodix-pages /
   frodix / three-drip layers on the public shop. Component names are `td-*`;
   nothing here relies on forced priority or on specificity tricks.

   Tokens read the values saved in Govix → Site Settings first (`--bg`,
   `--text`, `--brand`, `--brand-3`, `--font-*`, `--r-*` …) and fall back to
   the brand defaults, so the merchant's colour and font choices still apply.

   Brand: logo violet #7F66FF is an accent (focus, markers, hover) — never a
   page wash. Surfaces are near-white, ink is charcoal.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- palette ---- */
  --td-canvas: var(--bg, #FAFAFA);
  --td-surface: var(--surface, #FFFFFF);
  --td-tint: #F5F2FA;
  --td-tint: color-mix(in srgb, var(--td-accent) 6%, #FAFAFB);
  --td-ink: var(--text, #17171B);
  --td-ink-2: #3C3C46;
  --td-muted: var(--muted, #6B6B77);
  --td-line: #E8E8ED;
  --td-line-strong: #D9D3E4;
  --td-primary: var(--brand, #17171B);
  --td-on-primary: var(--on-brand, #FFFFFF);
  --td-accent: var(--brand-3, #7F66FF);
  --td-accent-ink: #5B44D6;
  --td-accent-ink: color-mix(in srgb, var(--td-accent) 72%, #000);
  --td-accent-soft: #F1EEFF;
  --td-accent-soft: color-mix(in srgb, var(--td-accent) 14%, #fff);
  --td-ok: #14724B;
  --td-ok-soft: #E5F4EC;
  --td-warn: #8A5A00;
  --td-warn-soft: #FBF1DC;
  --td-bad: #B42343;
  --td-bad-soft: #FCE9ED;

  /* ---- glass ---- */
  --td-glass: rgba(250, 248, 255, .78);
  --td-glass-strong: rgba(252, 250, 255, .92);
  --td-glass-edge: rgba(23, 23, 27, .08);
  --td-blur: saturate(180%) blur(16px);

  /* ---- shape (rounded storefront, still informed by Site Settings) ---- */
  --td-r-xs: 9px;
  --td-r-sm: clamp(14px, calc(var(--r-sm, 8px) * 1.6), 20px);
  --td-r-md: clamp(20px, calc(var(--r-md, 12px) * 1.7), 28px);
  --td-r-lg: clamp(28px, calc(var(--r-lg, 16px) * 1.8), 36px);
  --td-action-gradient: linear-gradient(112deg, #765BDF 0%, var(--td-accent-ink) 48%, #342679 100%);

  /* ---- type ---- */
  --td-font: 'Raleway', 'Tajawal', system-ui, sans-serif;
  --td-font-head: 'Raleway', 'Tajawal', system-ui, sans-serif;
  --td-font-ar: 'Tajawal', 'Raleway', sans-serif;

  /* ---- layout ---- */
  --td-max: min(var(--max, 1360px), 1360px);
  --td-gutter: clamp(16px, 3.2vw, 40px);
  --td-section: clamp(52px, 7vw, 104px);
  --td-header-h: 68px;
  --td-announce-h: 34px;

  /* ---- motion ---- */
  --td-ease: cubic-bezier(.2, .8, .2, 1);
  --td-fast: 180ms;
  --td-base: 280ms;
  --td-slow: 560ms;

  --td-z-header: 40;
  --td-z-bar: 45;
  --td-z-scrim: 60;
  --td-z-panel: 70;
  --td-z-toast: 90;
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
b, strong, h1, h2, h3, h4, h5, h6 { font-weight: 300; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
[hidden] { display: none !important; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
summary { cursor: pointer; }

body.td {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--td-font);
  font-size: 1rem;
  font-weight: 300;
  font-synthesis: none;
  line-height: 1.55;
  color: var(--td-ink);
  background: var(--td-canvas);
  font-feature-settings: "lnum" 1, "pnum" 1;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#site-content { flex: 1 0 auto; }
html[dir="rtl"] body.td { font-family: var(--td-font-ar); }
html[dir="rtl"] body.td * { letter-spacing: 0; }

h1, h2, h3, h4 {
  font-family: var(--td-font-head);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -.02em;
  text-wrap: balance;
}
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4 {
  font-family: var(--td-font-ar);
  font-weight: 300;
  line-height: 1.3;
}
p { text-wrap: pretty; }
::selection { background: var(--td-accent); color: #fff; }

/* One visible focus treatment everywhere. */
:focus-visible {
  outline: 2px solid var(--td-accent-ink);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---------------------------------------------------------- utilities */
.td-wrap {
  width: min(100% - 2 * var(--td-gutter), var(--td-max));
  margin-inline: auto;
}
.td-sr {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.td-skip {
  position: fixed; inset-block-start: 8px; inset-inline-start: 8px; z-index: 200;
  padding: 10px 16px; border-radius: var(--td-r-sm);
  background: var(--td-ink); color: #fff; font-weight: 300;
  transform: translateY(-200%);
}
.td-skip:focus { transform: none; }
.td-num { font-variant-numeric: lining-nums tabular-nums; }
.i { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-xs { width: 14px; height: 14px; }
/* Directional icons mirror in Arabic. */
html[dir="rtl"] .i-dir { transform: scaleX(-1); }

/* Small uppercase label — short strings only. */
.td-label-xs {
  font-size: .75rem; font-weight: 300; letter-spacing: .09em; text-transform: uppercase;
  color: var(--td-muted);
}
html[dir="rtl"] .td-label-xs { letter-spacing: 0; text-transform: none; font-size: .8125rem; }

/* ----------------------------------------------------------- buttons */
.td-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  min-height: 48px; padding: 0 24px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--td-action-gradient); background-size: 130% 100%; background-position: 0 50%; color: #fff;
  font-size: .9375rem; font-weight: 300; line-height: 1; white-space: nowrap;
  transition: background-color var(--td-fast) ease, background-position var(--td-base) var(--td-ease),
              color var(--td-fast) ease, border-color var(--td-fast) ease,
              box-shadow var(--td-base) ease, transform .12s ease;
}
.td-btn:hover { background-position: 100% 50%; box-shadow: 0 7px 19px rgba(63, 43, 148, .18); }
.td-btn:active { transform: translateY(1px); }
.td-btn[disabled], .td-btn[aria-disabled="true"] { opacity: .42; cursor: not-allowed; transform: none; }
.td-btn[disabled]:hover { box-shadow: none; background-position: 0 50%; }
.td-btn--ghost {
  background: transparent; background-size: auto; color: var(--td-ink); border-color: var(--td-line-strong);
}
.td-btn--ghost:hover { background: var(--td-surface); border-color: var(--td-ink); color: var(--td-ink); box-shadow: none; }
.td-btn--light { background: #fff; background-size: auto; color: var(--td-ink); }
.td-btn--light:hover { background: var(--td-accent-soft); color: var(--td-ink); }
.td-btn--block { width: 100%; }
.td-btn--sm { min-height: 40px; padding: 0 16px; font-size: .875rem; }
@media (pointer: coarse) { .td-btn--sm { min-height: 44px; } }
.td-btn.is-busy { pointer-events: none; opacity: .7; }

.td-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 300; font-size: .9375rem; color: var(--td-ink);
  text-decoration: underline; text-decoration-color: var(--td-line-strong);
  text-underline-offset: 5px; text-decoration-thickness: 1px;
  transition: text-decoration-color var(--td-fast) ease, color var(--td-fast) ease;
}
.td-link:hover { color: var(--td-accent-ink); text-decoration-color: currentColor; }

.td-icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%; color: var(--td-ink);
  transition: background-color var(--td-fast) ease;
}
.td-icon-btn:hover { background: rgba(23, 23, 27, .06); }

/* ------------------------------------------------------------- forms */
.td-field { display: grid; gap: 6px; min-width: 0; }
.td-label { font-size: .8125rem; font-weight: 300; color: var(--td-ink); }
.td-label .td-req { color: var(--td-accent-ink); margin-inline-start: 2px; }
.td-input, .td-select, .td-textarea {
  width: 100%; min-height: 48px; padding: 0 14px;
  border: 1px solid var(--td-line-strong); border-radius: var(--td-r-sm);
  background-color: var(--td-surface); color: var(--td-ink);
  font-size: 1rem; font-weight: 300; line-height: 1.4;
  transition: border-color var(--td-fast) ease, box-shadow var(--td-fast) ease;
}
.td-input::placeholder, .td-textarea::placeholder { color: #8A8A96; opacity: 1; }
.td-textarea { padding: 12px 14px; min-height: 104px; resize: vertical; }
.td-select {
  appearance: none; -webkit-appearance: none; padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2317171B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
html[dir="rtl"] .td-select { background-position: left 14px center; }
.td-input:hover, .td-select:hover, .td-textarea:hover { border-color: #B9B9C4; }
.td-input:focus, .td-select:focus, .td-textarea:focus {
  outline: none; border-color: var(--td-accent-ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--td-accent) 26%, transparent);
}
.td-input[aria-invalid="true"], .td-select[aria-invalid="true"], .td-textarea[aria-invalid="true"] {
  border-color: var(--td-bad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--td-bad) 14%, transparent);
}
.td-input:disabled, .td-select:disabled { background: var(--td-tint); color: var(--td-muted); cursor: not-allowed; }
.td-err { font-size: .8125rem; font-weight: 300; color: var(--td-bad); }
.td-help { font-size: .8125rem; color: var(--td-muted); }
.td-form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.td-form-grid .td-span { grid-column: 1 / -1; }
@media (max-width: 560px) { .td-form-grid { grid-template-columns: 1fr; } }

.td-alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--td-r-sm);
  font-size: .9375rem; font-weight: 300; line-height: 1.45;
}
.td-alert .i { margin-top: 2px; }
.td-alert--bad { background: var(--td-bad-soft); color: var(--td-bad); }
.td-alert--ok { background: var(--td-ok-soft); color: var(--td-ok); }
.td-alert--info { background: var(--td-accent-soft); color: var(--td-accent-ink); }

/* Quantity stepper */
.td-qty {
  display: inline-flex; align-items: center;
  border: 1px solid var(--td-line-strong); border-radius: var(--td-r-sm);
  background: var(--td-surface); height: 48px;
}
.td-qty button { width: 44px; height: 100%; display: grid; place-items: center; color: var(--td-ink); }
.td-qty button:hover:not(:disabled) { color: var(--td-accent-ink); }
.td-qty button:disabled { color: #B4B4BE; cursor: not-allowed; }
.td-qty input {
  width: 42px; height: 100%; border: 0; background: transparent; text-align: center;
  font-weight: 300; font-size: 1rem; -moz-appearance: textfield; appearance: textfield;
  font-variant-numeric: tabular-nums;
}
.td-qty input::-webkit-outer-spin-button, .td-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.td-qty--sm { height: 38px; }
.td-qty--sm button { width: 34px; }
.td-qty--sm input { width: 32px; font-size: .9375rem; }
@media (pointer: coarse) { .td-qty--sm { height: 44px; } .td-qty--sm button { width: 40px; } }

/* ----------------------------------------------- chips / badges / tags */
.td-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--td-line-strong); border-radius: var(--td-r-sm);
  background: var(--td-surface); font-size: .875rem; font-weight: 300; color: var(--td-ink);
  transition: border-color var(--td-fast) ease, background-color var(--td-fast) ease, color var(--td-fast) ease;
  white-space: nowrap;
}
.td-chip:hover { border-color: var(--td-accent-ink); background: var(--td-accent-soft); }
.td-chip[aria-current="page"], .td-chip[aria-pressed="true"], .td-chip.is-on {
  background: var(--td-accent-ink); border-color: var(--td-accent-ink); color: #fff;
}
.td-chip small { font-size: .75rem; font-weight: 300; opacity: .65; }
.td-chip--remove { padding-inline-end: 10px; background: var(--td-accent-soft); border-color: transparent; color: var(--td-accent-ink); }

.td-badge {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px;
  border-radius: var(--td-r-xs); font-size: .75rem; font-weight: 300; line-height: 1;
  background: var(--td-ink); color: #fff; letter-spacing: .02em;
}
.td-badge--accent { background: var(--td-accent-ink); color: #fff; }
.td-badge--soft { background: var(--td-surface); color: var(--td-ink); border: 1px solid var(--td-line); }

/* ------------------------------------------------ image frame + empty */
.td-frame { position: relative; overflow: hidden; background: var(--td-tint); }
.td-frame > img { width: 100%; height: 100%; object-fit: cover; }
/* A missing photograph falls back to the wordmark tint, never a broken icon. */
.td-frame[data-noimage] > img { visibility: hidden; }
.td-frame[data-noimage]::after {
  content: "3 DRIP"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .8125rem; font-weight: 300; letter-spacing: .2em; color: #B3B3BF;
}

.td-empty {
  display: grid; justify-items: center; gap: 14px; text-align: center;
  padding: clamp(40px, 8vw, 88px) 20px;
}
.td-empty .i { width: 28px; height: 28px; color: var(--td-muted); }
.td-empty h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.65rem); }
.td-empty p { color: var(--td-muted); max-width: 46ch; }
.td-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 6px; }

/* ------------------------------------------------------- page heading */
.td-crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: .8125rem; font-weight: 300; color: var(--td-muted);
}
.td-crumbs a:hover { color: var(--td-ink); }
.td-crumbs [aria-current="page"] { color: var(--td-ink); }
.td-page-head { padding-block: clamp(28px, 4vw, 52px) clamp(20px, 3vw, 36px); }
.td-page-head h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.1rem); margin-top: 14px; }
.td-page-head .td-lede { margin-top: 12px; max-width: 58ch; color: var(--td-ink-2); font-size: 1.0625rem; }

/* Section heading: hairline rule, title left, link right (Swiss index row). */
.td-section { padding-block: var(--td-section); }
.td-section--tight { padding-block: clamp(32px, 4.5vw, 64px); }
.td-section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px 28px; flex-wrap: wrap;
  padding-top: 16px; margin-bottom: clamp(20px, 3vw, 32px);
  border-top: 1px solid var(--td-ink);
}
.td-section-head h2 { font-size: clamp(1.35rem, 1rem + 1.1vw, 1.9rem); }
.td-section-head .td-label-xs { display: block; margin-bottom: 6px; }

/* ----------------------------------------------------------- accordion */
.td-acc { border-top: 1px solid var(--td-line); }
.td-acc details { border-bottom: 1px solid var(--td-line); }
.td-acc summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding-block: 14px; font-weight: 300; font-size: 1rem; list-style: none;
}
.td-acc summary::-webkit-details-marker { display: none; }
.td-acc summary .i { transition: transform var(--td-base) var(--td-ease); }
.td-acc details[open] summary .i { transform: rotate(180deg); }
.td-acc-body { padding-bottom: 20px; color: var(--td-ink-2); max-width: 70ch; }
.td-acc-body > * + * { margin-top: 12px; }

/* --------------------------------------------------------------- toasts */
.td-toasts {
  position: fixed; inset-inline: 0; bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: var(--td-z-toast); display: grid; justify-items: center; gap: 8px; pointer-events: none;
  padding-inline: 16px;
}
.td-toast {
  display: flex; align-items: center; gap: 10px; max-width: min(92vw, 440px);
  padding: 12px 16px; border-radius: var(--td-r-md);
  background: var(--td-ink); color: #fff; font-size: .9375rem; font-weight: 300;
  box-shadow: 0 12px 32px -12px rgba(23, 23, 27, .45);
  animation: td-toast-in var(--td-base) var(--td-ease) both; pointer-events: auto;
}
.td-toast--error { background: var(--td-bad); }
.td-toast[data-leaving="true"] { animation: td-toast-out 200ms ease both; }
@keyframes td-toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes td-toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------ reveal on scroll
   Content is fully visible without JS; `.js` only enables the entrance. */
.js [data-reveal] { opacity: 1; transform: translateY(8px); }
.js [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity var(--td-slow) var(--td-ease), transform var(--td-slow) var(--td-ease);
  transition-delay: calc(var(--td-i, 0) * 70ms);
}

/* ------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; transition-delay: 0ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --td-glass: #fff; --td-glass-strong: #fff; --td-blur: none; }
}
