/*
 * Vitrine — VeloCMS theme (slug: "vitrine")
 * 1:1 port of the founder's Claude-Design canvas "Vitrine Theme.dc.html".
 *
 * "Collector's museum theme." Square corners, hairline rules, grayscale-to-color
 * specimen reveal, catalogue-plate captions.
 * Palette: ivory #F4F1EA · ink #14161A · smoke #3A3E44 · silver #C7CCD1 ·
 *          steel-blue #2E4257 (accent) · ivory-2 #EDEAE1 (niche band panel)
 * Display: Marcellus (single 400 weight) · Body: Source Serif 4 (400/600 + italics)
 *
 * All values below are copied verbatim from the design's inline styles and its
 * 1h engineering-notes spec (color tokens, spacing/radius scale, hover table,
 * motion keyframes, mobile-drawer spec). No rounding, no reinterpretation.
 *
 * Scoped to [data-theme="vitrine"] (NOT main-scoped) so /shop and /products/*
 * resolve the same tokens. P-094 token bridge at the bottom.
 */

/* ═══════════════════ COLOR TOKENS (1h §01) ═══════════════════ */
[data-theme="vitrine"] {
  /* canonical (source :root --vb-* names, ported as --vt-*) */
  --vt-bg: #F4F1EA;              /* oklch(0.954 0.011 96) — ivory, page ground */
  --vt-ink: #14161A;             /* oklch(0.205 0.012 264) — text, footer bg, filled CTA */
  --vt-accent: #2E4257;          /* oklch(0.375 0.049 249) — steel-blue: links, active nav, cat numbers, blockquote rule, focus ring */
  --vt-smoke: #3A3E44;           /* oklch(0.363 0.012 262) — secondary text, meta rows */
  --vt-silver: #C7CCD1;          /* oklch(0.842 0.008 240) — hairlines, plate frames, footer text on ink */
  --vt-ivory-2: #EDEAE1;         /* oklch(0.933 0.012 97) — niche-band panel, hover fill on prev/next */
  --vt-hairline: #D8D4C9;        /* outer screen border in the design (canvas-only, kept for parity) */

  /* fonts (registered — getThemeFontVars("vitrine")) */
  --vt-heading-font: var(--font-marcellus), "Iowan Old Style", "Times New Roman",
    Times, serif;
  --vt-body-font: var(--font-source-serif-4), "Source Serif Pro", Georgia,
    "Noto Serif", serif;
  --vt-mono-font: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas,
    monospace;

  /* layout scale (1h §03) */
  --vt-container: 1312px;   /* 1440 - 2*64 gutter */
  --vt-gutter: 64px;
  --vt-gutter-mobile: 20px;
  --vt-prose: 65ch;

  /* engine palette aliases — any shared component that reads --velo-bg /
     --velo-fg / --velo-border / --velo-accent resolves the Vitrine palette.
     (The mobile drawer is now the bespoke VitrineMobileMenu, which reads
     --vt-* directly; these are kept for other shared consumers.) */
  --velo-bg: var(--vt-bg);
  --velo-fg: var(--vt-ink);
  --velo-border: var(--vt-silver);
  --velo-accent: var(--vt-accent);
}

/* Body font inheritance for the whole theme surface */
[data-theme="vitrine"] {
  font-family: var(--vt-body-font);
  color: var(--vt-ink);
  background: var(--vt-bg);
}

/* ═══════════════════ MOTION — entrances only (1h §05) ═══════════════════ */
@keyframes vitrine-rise {
  from { transform: translateY(12px); }
  to   { transform: translateY(0); }
}
@keyframes vitrine-settle {
  from { transform: scale(1.012); }
  to   { transform: scale(1); }
}

/* NB: opacity is never animated — SSR content is fully visible on first frame
   (P-068). Animations mutate transform only, applied on load (no IO gate). */
[data-theme="vitrine"] .vt-anim-rise {
  animation: vitrine-rise 550ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
[data-theme="vitrine"] .vt-anim-settle {
  animation: vitrine-settle 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  [data-theme="vitrine"] * {
    animation: none !important;
    transition: none !important;
  }
}

/* ═══════════════════ CHROME — sticky header ═══════════════════ */
[data-theme="vitrine"] .vt-header {
  background: var(--vt-bg);
  position: sticky;
  top: 0;
  z-index: 80;
  border-block-end: 1px solid var(--vt-silver);
}
[data-theme="vitrine"] .vt-nav-inner {
  max-width: var(--vt-container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 22px var(--vt-gutter);
}
[data-theme="vitrine"] .vt-brand {
  font-family: var(--vt-heading-font);
  font-size: 22px;
  letter-spacing: 0.2em;
  color: var(--vt-ink);
  text-decoration: none;
}
[data-theme="vitrine"] .vt-nav-links {
  display: flex;
  gap: 36px;
}
[data-theme="vitrine"] .vt-nav-link {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--vt-smoke);
  text-decoration: none;
  transition: color 150ms ease-out;
}
[data-theme="vitrine"] .vt-nav-link:hover {
  color: var(--vt-accent);
}
[data-theme="vitrine"] .vt-nav-link.is-active {
  color: var(--vt-accent);
  border-block-end: 1px solid var(--vt-accent);
  padding-block-end: 2px;
}
[data-theme="vitrine"] .vt-nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
[data-theme="vitrine"] .vt-cart-link {
  position: relative;
  color: var(--vt-ink);
  display: inline-flex;
  transition: color 150ms ease-out;
}
[data-theme="vitrine"] .vt-cart-link:hover {
  color: var(--vt-accent);
}
/* cart count badge — steel-blue accent, ivory label (design L57/L800) */
[data-theme="vitrine"] .vt-cart-badge {
  position: absolute;
  inset-block-start: -7px;
  inset-inline-end: -9px;
  background: var(--vt-accent);
  color: #f4f1ea;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════ MOBILE HEADER + DRAWER (design 1g, L307-359) ═══════════════════ */
/* mobile controls cluster (cart + hamburger) — hidden ≥ lg, shown < lg */
[data-theme="vitrine"] .vt-nav-mobile {
  display: none;
  align-items: center;
  gap: 16px;
}
/* hamburger trigger — matches design mobile header button (L889) */
[data-theme="vitrine"] .vt-hamburger {
  background: none;
  border: none;
  padding: 8px;
  margin: -8px;
  color: var(--vt-ink);
  display: inline-flex;
  cursor: pointer;
}
/* in-drawer circular close button (L325) — 36×36, 1px ink ring, ink→ivory hover */
[data-theme="vitrine"] .vt-drawer-close {
  background: none;
  border: 1px solid var(--vt-ink);
  border-radius: 9999px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--vt-ink);
  cursor: pointer;
  transition: background 150ms ease-out, color 150ms ease-out;
}
[data-theme="vitrine"] .vt-drawer-close:hover {
  background: var(--vt-ink);
  color: var(--vt-bg);
}
/* in-drawer nav item label hover: ink → accent (non-active rows, L334) */
[data-theme="vitrine"] .vt-drawer-nav-item:hover {
  color: var(--vt-accent);
}
[data-theme="vitrine"] .vt-account-chip {
  width: 32px;
  height: 32px;
  border: 1px solid var(--vt-ink);
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--vt-ink);
  text-decoration: none;
  transition: background 150ms ease-out, color 150ms ease-out;
}
[data-theme="vitrine"] .vt-account-chip:hover {
  background: var(--vt-ink);
  color: var(--vt-bg);
}
[data-theme="vitrine"] .vt-login {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--vt-ink);
  text-decoration: none;
  transition: color 150ms ease-out;
}
[data-theme="vitrine"] .vt-login:hover {
  color: var(--vt-accent);
}

/* ═══════════════════ BUTTONS / CTAs (1h §04) ═══════════════════ */
[data-theme="vitrine"] .vt-cta-filled {
  background: var(--vt-ink);
  color: var(--vt-bg);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 16px 32px;
  border-radius: 0;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 150ms ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
[data-theme="vitrine"] .vt-cta-filled:hover {
  opacity: 0.88;
}
[data-theme="vitrine"] .vt-cta-filled:active {
  transform: translateY(1px);
}
[data-theme="vitrine"] .vt-cta-outline {
  border: 1px solid var(--vt-ink);
  color: var(--vt-ink);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 15px 32px;
  border-radius: 0;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
[data-theme="vitrine"] .vt-cta-outline:hover {
  background: rgba(46, 66, 87, 0.08);
}
/* outline variant tinted with the accent (Buy now) */
[data-theme="vitrine"] .vt-cta-outline-accent {
  border: 1px solid var(--vt-accent);
  color: var(--vt-accent);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 15px 32px;
  border-radius: 0;
  text-decoration: none;
  background: transparent;
  cursor: pointer;
  transition: background 150ms ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
[data-theme="vitrine"] .vt-cta-outline-accent:hover {
  background: rgba(46, 66, 87, 0.08);
}
[data-theme="vitrine"] .vt-cta-outline-accent:active,
[data-theme="vitrine"] .vt-cta-outline:active,
[data-theme="vitrine"] .vt-cta-filled:active {
  transform: translateY(1px);
}

/* category pill */
[data-theme="vitrine"] .vt-pill {
  padding: 9px 20px;
  border: 1px solid var(--vt-silver);
  border-radius: 9999px;
  color: var(--vt-smoke);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 150ms ease-out, color 150ms ease-out;
  background: transparent;
  white-space: nowrap;
}
[data-theme="vitrine"] .vt-pill:hover {
  border-color: var(--vt-ink);
  color: var(--vt-ink);
}
[data-theme="vitrine"] .vt-pill.is-active {
  border: 1px solid var(--vt-ink);
  background: var(--vt-ink);
  color: var(--vt-bg);
}

/* ═══════════════════ FOCUS (all) — 1h §04 ═══════════════════ */
[data-theme="vitrine"] a:focus-visible,
[data-theme="vitrine"] button:focus-visible,
[data-theme="vitrine"] input:focus-visible,
[data-theme="vitrine"] textarea:focus-visible {
  outline: 2px solid var(--vt-accent);
  outline-offset: 2px;
}

/* ═══════════════════ SPECIMEN PLATE (grayscale reveal) ═══════════════════ */
[data-theme="vitrine"] .vt-plate {
  display: block;
  border: 1px solid var(--vt-silver);
  padding: 6px;
  background: var(--vt-bg);
  transition: border-color 200ms ease-out;
}
[data-theme="vitrine"] .vt-plate-ink {
  display: block;
  border: 1px solid var(--vt-ink);
  padding: 8px;
  background: var(--vt-bg);
}
[data-theme="vitrine"] .vt-specimen {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(0.85) contrast(1.04);
  transition: filter 300ms ease;
}
[data-theme="vitrine"] .vt-card:hover .vt-plate {
  border-color: var(--vt-ink);
}
[data-theme="vitrine"] .vt-card:hover .vt-specimen {
  filter: grayscale(0) contrast(1);
}

/* ═══════════════════ CARDS / ENTRIES ═══════════════════ */
[data-theme="vitrine"] .vt-card {
  display: block;
  color: inherit;
  text-decoration: none;
}
[data-theme="vitrine"] .vt-card-title {
  font-family: var(--vt-heading-font);
  transition: color 150ms ease-out;
}
[data-theme="vitrine"] .vt-card:hover .vt-card-title {
  color: var(--vt-accent);
}

/* prev/next adjacent-entries cell hover */
[data-theme="vitrine"] .vt-adjacent-cell {
  transition: background 150ms ease-out;
}
[data-theme="vitrine"] .vt-adjacent-cell:hover {
  background: var(--vt-ivory-2);
}

/* ═══════════════════ PROSE (post / page body) ═══════════════════ */
[data-theme="vitrine"] .vt-prose {
  font-size: 17px;
  line-height: 1.8;
  max-width: 65ch;
  color: var(--vt-ink);
}
[data-theme="vitrine"] .vt-prose p {
  margin: 24px 0 0;
}
[data-theme="vitrine"] .vt-prose p:first-child {
  margin-top: 0;
}
[data-theme="vitrine"] .vt-prose h2 {
  font-family: var(--vt-heading-font);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.25;
  margin: 56px 0 0;
}
[data-theme="vitrine"] .vt-prose h3 {
  font-family: var(--vt-heading-font);
  font-weight: 400;
  font-size: 23px;
  line-height: 1.3;
  margin: 48px 0 0;
}
[data-theme="vitrine"] .vt-prose blockquote {
  margin: 40px 0 0;
  padding-inline-start: 28px;
  border-inline-start: 2px solid var(--vt-accent);
  font-style: italic;
  font-size: 21px;
  line-height: 1.65;
  color: var(--vt-smoke);
}
[data-theme="vitrine"] .vt-prose pre {
  margin: 28px 0 0;
  background: var(--vt-ink);
  color: var(--vt-silver);
  font-family: var(--vt-mono-font);
  font-size: 14px;
  line-height: 1.7;
  padding: 24px 28px;
  border-radius: 0;
  overflow-x: auto;
}
[data-theme="vitrine"] .vt-prose img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(0.85) contrast(1.04);
}
[data-theme="vitrine"] .vt-prose a {
  color: var(--vt-accent);
}

/* ═══════════════════ FOOTER (ink) ═══════════════════ */
[data-theme="vitrine"] .vt-footer {
  background: var(--vt-ink);
  color: var(--vt-silver);
  padding: 64px var(--vt-gutter) 0;
}
[data-theme="vitrine"] .vt-footer-inner {
  max-width: var(--vt-container);
  margin: 0 auto;
}
[data-theme="vitrine"] .vt-footer-brand {
  font-family: var(--vt-heading-font);
  font-size: 24px;
  letter-spacing: 0.2em;
  color: var(--vt-bg);
}
[data-theme="vitrine"] .vt-footer-link {
  font-size: 14px;
  color: var(--vt-silver);
  text-decoration: none;
  transition: color 150ms ease-out;
}
[data-theme="vitrine"] .vt-footer-link:hover {
  color: var(--vt-bg);
}
[data-theme="vitrine"] .vt-footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-block: 20px;
  border-block-start: 1px solid rgba(199, 204, 209, 0.25);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  flex-wrap: wrap;
}

/* ═══════════════════ INPUTS (subscribe) ═══════════════════ */
[data-theme="vitrine"] .vt-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--vt-silver);
  border-radius: 2px;
  background: #FFFFFF;
  padding: 14px 16px;
  font-family: var(--vt-body-font);
  font-size: 15px;
  color: var(--vt-ink);
  outline: none;
}

/* ═══════════════════ RESPONSIVE (mobile 390) ═══════════════════ */
@media (max-width: 1023px) {
  [data-theme="vitrine"] .vt-nav-links,
  [data-theme="vitrine"] .vt-nav-right {
    display: none;
  }
  [data-theme="vitrine"] .vt-nav-mobile {
    display: flex;
  }
  [data-theme="vitrine"] .vt-nav-inner {
    padding: 16px 20px;
  }
  /* mobile brand wordmark scale (design L883: 17px .18em) */
  [data-theme="vitrine"] .vt-brand {
    font-size: 17px;
    letter-spacing: 0.18em;
  }
}

/* wide strips never overflow the document (P-140) */
[data-theme="vitrine"] .vt-pill-scroll {
  overflow-x: auto;
}

/*
 * ═══════════════════ RESPONSIVE — mobile ≤767px (1h §03/§02) ═══════════════════
 * Every grid/hero/type-scale component is authored with inline `style={}`
 * (fixed desktop px values) per the design's 1:1 port convention. Non-!important
 * @media rules lose to those inline styles under normal CSS cascade specificity
 * (inline > any selector), so mobile silently keeps the desktop grid/font-size —
 * the systemic bug this pass fixes. `!important` here is the deliberate,
 * scoped override needed to win against React inline styles; it does not leak
 * outside [data-theme="vitrine"]. Section padding 48/20 mobile per 1h §03;
 * H1 scale 76/56/48/44 desktop → 42/34/31/32/31 mobile per 1h §02.
 */
@media (max-width: 767px) {
  /* ── Home hero: 2-col grid → stack, 76px → 42px h1 ── */
  [data-theme="vitrine"] .vt-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding: 48px 20px 40px !important;
  }
  [data-theme="vitrine"] .vt-hero-grid h1 {
    font-size: 42px !important;
    line-height: 1.08 !important;
  }
  [data-theme="vitrine"] .vt-hero-grid > div:first-child > p:first-child {
    font-size: 10px !important;
  }

  /* ── "The cabinet" specimen grid: 4-col → 2-col ── */
  [data-theme="vitrine"] .vt-cabinet {
    padding: 40px 20px !important;
  }
  [data-theme="vitrine"] .vt-cabinet-h2 {
    font-size: 26px !important;
    margin-block-end: 24px !important;
  }
  [data-theme="vitrine"] .vt-specimen-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }

  /* ── Blog grid: 3-col → 1-col; product grid: 3-col → 2-col ── */
  [data-theme="vitrine"] .vt-blog-grid {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
    padding: 32px 20px 48px !important;
  }
  [data-theme="vitrine"] .vt-shop-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 28px 16px !important;
  }
  /* mobile shop card kicker/dek: source 1e mobile (lines 899-922) shows only
     the catalogue ref (no category name) and drops the italic dek line */
  [data-theme="vitrine"] .vt-shop-grid .vt-card-catref {
    width: 100% !important;
  }
  [data-theme="vitrine"] .vt-shop-grid .vt-card-catref ~ span {
    display: none !important;
  }
  [data-theme="vitrine"] .vt-shop-grid .vt-card-dek {
    display: none !important;
  }

  /* ── Product detail gallery+info grid: side-by-side → stacked ── */
  [data-theme="vitrine"] .vt-product-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }

  /* ── Home "Latest entries" row list: 96px/1fr/220px 3-col → stacked ── */
  [data-theme="vitrine"] .vt-entry-row {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding-block: 18px !important;
  }
  [data-theme="vitrine"] .vt-entry-row > span:last-child {
    text-align: start !important;
  }

  /* ── Footer 4-col → single column ── */
  [data-theme="vitrine"] .vt-footer-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    padding-block-end: 32px !important;
  }
  [data-theme="vitrine"] .vt-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* ── Section padding 64px → 20px gutter (1h §03) ── */
  [data-theme="vitrine"] .vt-footer {
    padding: 40px 20px 0;
  }
  [data-theme="vitrine"] .vt-prose {
    font-size: 16px;
  }

  /* ── Generic 64px-gutter → 20px override for section wrappers (1h §03) ── */
  [data-theme="vitrine"] .vt-gutter {
    padding-inline: 20px !important;
  }
  [data-theme="vitrine"] .vt-masthead {
    padding: 44px 20px 20px !important;
  }

  /* ── Per-surface H1 scale (1h §02: "H1 76/56/48/44 desktop → 42/34/31/32/31 mobile") ── */
  [data-theme="vitrine"] .vt-h1-blog {
    font-size: 34px !important;
    line-height: 1.12 !important;
  }
  [data-theme="vitrine"] .vt-h1-post {
    font-size: 31px !important;
    line-height: 1.18 !important;
  }
  [data-theme="vitrine"] .vt-h1-page {
    font-size: 32px !important;
    line-height: 1.15 !important;
  }
  [data-theme="vitrine"] .vt-h1-shop {
    font-size: 32px !important;
    line-height: 1.15 !important;
  }
  [data-theme="vitrine"] .vt-h1-product {
    font-size: 31px !important;
    line-height: 1.15 !important;
  }

}

/* ═══════════════════ RTL (1h §06) ═══════════════════ */
/* tracking breaks connected Arabic script — zero it on labels under rtl */
[dir="rtl"] [data-theme="vitrine"] .vt-nav-link,
[dir="rtl"] [data-theme="vitrine"] .vt-login,
[dir="rtl"] [data-theme="vitrine"] .vt-pill,
[dir="rtl"] [data-theme="vitrine"] .vt-footer-bottom,
[dir="rtl"] [data-theme="vitrine"] .vt-cta-filled,
[dir="rtl"] [data-theme="vitrine"] .vt-cta-outline,
[dir="rtl"] [data-theme="vitrine"] .vt-cta-outline-accent,
[dir="rtl"] [data-theme="vitrine"] .vt-brand,
[dir="rtl"] [data-theme="vitrine"] .vt-drawer-brand,
[dir="rtl"] [data-theme="vitrine"] .vt-drawer-est,
[dir="rtl"] [data-theme="vitrine"] .vt-footer-brand {
  letter-spacing: 0;
}

/*
 * ═══════════════════ P-094 TOKEN BRIDGE ═══════════════════
 * The commerce archetype + shared components consume the universal
 * --vb-color-* vocabulary. Map Vitrine palette → --vb-color-* at the
 * global [data-theme="vitrine"] scope (NOT main-scoped) so /shop and
 * /products/* resolve. No currentColor, no circular refs (1h §01).
 */
[data-theme="vitrine"] {
  --vb-color-primary: #14161A;      /* ink — filled CTA fill (source --vb-color-primary == --vb-color-text) */
  --vb-color-primary-fg: #F4F1EA;   /* ivory label on ink — 15.2:1 */
  --vb-color-bg: #F4F1EA;           /* ivory */
  --vb-color-fg: #14161A;           /* ink — 15.2:1 on ivory */
  --vb-color-accent: #2E4257;       /* steel-blue — 7.6:1 on ivory */
}
