/*
 * Shared components — header, footer, buttons, product card, trust badges.
 * These MUST be reused as-is across every page (home, category, PDP, search, related-products).
 * Do not fork a page-specific copy. See AGENT-RULES.md "组件复用规则".
 */

/* ---------- accessibility utilities ---------- */

/* Visually hidden but readable by screen readers/AT — standard clip-based technique
 * (not display:none, which removes it from the accessibility tree too). Used for
 * headings that fix a skipped-level document outline without changing what's on screen. */
.vt-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;
}

/* ---------- buttons ---------- */

.vt-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.vt-btn:hover { transform: translateY(-1px); }
.vt-btn:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; }

.vt-btn-solid { background: var(--ink); color: var(--paper); }
.vt-btn-solid:hover { opacity: 0.82; }

.vt-btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.vt-btn-ghost:hover { border-color: var(--ink); }

/* ---------- header ---------- */

.vt-promo-bar {
  background: var(--paper-raised);
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--paper-line);
}
.vt-promo-bar strong { color: var(--ink); font-weight: 600; }

.vt-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.4rem clamp(1.5rem, 5vw, 4rem);
  color: var(--ink);
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
  flex-wrap: wrap;
}

.vt-menu-toggle {
  display: none;
  background: none; border: none; padding: 0.5rem; margin: -0.5rem; cursor: pointer; color: var(--ink);
}
.vt-menu-toggle svg { width: 1.4rem; height: 1.4rem; }
.vt-menu-toggle svg path { stroke: currentColor; }

/* Desktop: nav + search + CTA sit inline, same row as the wordmark. */
.vt-header-collapsible {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 3rem);
  flex: 1 1 auto;
  justify-content: space-between;
  min-width: 0;
}

/* Mobile: collapse nav/search/CTA behind a hamburger — the un-collapsed row
   (logo + full nav + search + CTA button) does not fit a phone viewport. */
@media (max-width: 880px) {
  .vt-menu-toggle { display: flex; }
  .vt-header-collapsible {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 1.2rem;
    width: 100%;
    order: 3;
    padding-top: 1rem;
  }
  /* Floats over the page instead of expanding the header in normal flow — opening
     it must not push page content downward. .vt-header already has position:relative,
     so this positions against the header's own box. */
  .vt-header-collapsible.is-open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 100%);
    overflow-y: auto;
    padding: 1.2rem clamp(1.5rem, 5vw, 4rem) 1.6rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    z-index: 10;
  }
  .vt-header-actions { flex-direction: column; align-items: stretch; gap: 0.9rem; }
  .vt-nav { flex-direction: column; gap: 0.9rem; }
  .vt-search-form { border-bottom: 1px solid var(--line); padding-bottom: 0.6rem; }
  .vt-search-input { width: 100%; }
}

.vt-wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.vt-wordmark img {
  height: 28px;
  width: auto;
  display: block;
}

.vt-nav { display: flex; gap: clamp(1rem, 2.5vw, 2.2rem); list-style: none; margin: 0; padding: 0; font-size: 0.86rem; letter-spacing: 0.01em; }
.vt-nav a { text-decoration: none; color: var(--ink-soft); transition: color 0.2s ease; padding-bottom: 3px; border-bottom: 1px solid transparent; }
.vt-nav a:hover, .vt-nav a:focus-visible { color: var(--ink); }
.vt-nav a:focus-visible { outline: 1px solid var(--accent-soft); outline-offset: 4px; }
/* Active nav state (ui-ux-pro-max: Navigation/Active State, Medium) — covers the current
 * hand-built fallback (aria-current, see header.php) and a future real wp-admin menu
 * (WordPress's own current-menu-item class), so this keeps working either way. */
.vt-nav a[aria-current="page"],
.vt-nav .current-menu-item > a,
.vt-nav .current-menu-ancestor > a { color: var(--ink); font-weight: 620; border-bottom-color: var(--ink); }

/* ---------- "Shop" nav dropdown ---------- */
/* Native <details>/<summary> — no JS needed. Desktop turns the disclosure into a
   hover/click dropdown panel; mobile leaves it as a plain inline expand since it's
   already inside the collapsible mobile menu. */
.vt-nav-dropdown summary {
  cursor: pointer; list-style: none; color: var(--ink-soft);
  padding-bottom: 3px; border-bottom: 1px solid transparent; transition: color 0.2s ease;
}
.vt-nav-dropdown summary::-webkit-details-marker,
.vt-nav-dropdown summary::marker { display: none; content: ''; }
.vt-nav-dropdown summary:hover,
.vt-nav-dropdown summary:focus-visible { color: var(--ink); }
.vt-nav-dropdown summary[aria-current="page"] { color: var(--ink); font-weight: 620; border-bottom-color: var(--ink); }

/* Absolutely positioned at every width so opening it overlays instead of pushing
   surrounding nav items down (mobile panel included). header.php's JS drives the
   real `open` attribute (mouseenter/mouseleave on desktop, click on mobile,
   outside-tap to close) — Chrome does not paint a <details> panel's content
   while `open` is absent no matter what `display` an author rule sets on it, so
   a CSS-only `:hover { display:block }` trick silently does nothing; only
   toggling the actual attribute renders it. */
.vt-nav-dropdown { position: relative; }
.vt-nav-dropdown details > ul {
  list-style: none; margin: 0; padding: 1.1rem 0 0.5rem;
  position: absolute; top: 100%; left: 0; min-width: 10rem;
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: 6px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.08); z-index: 20;
}
.vt-nav-dropdown details > ul a { display: block; padding: 0.5rem 1.1rem; border-bottom: none; white-space: nowrap; }

.vt-header-actions { display: flex; align-items: center; gap: 1.2rem; }

.vt-search-form { display: flex; align-items: center; gap: 0.4rem; border-bottom: 1px solid transparent; transition: border-color 0.2s ease; }
.vt-search-form:focus-within { border-color: var(--line); }
/* Touch target ≥24px per WCAG 2.2 AA Target Size (ui-ux-pro-max: Accessibility/Target Size, High). */
.vt-search-btn { background: none; border: none; padding: 0.55rem; margin: -0.55rem; cursor: pointer; color: var(--ink-soft); display: flex; align-items: center; }
.vt-search-btn:hover { color: var(--ink); }
.vt-search-btn svg { width: 1.15rem; height: 1.15rem; }
/* The icon is a circle (lens) + path (handle) — only coloring `path` left the circle with
 * SVG's default stroke:none, so the lens was invisible and the whole icon read as a stray
 * diagonal mark instead of a magnifying glass. This is the header's search icon on every
 * page at every viewport ≥881px (desktop/tablet), so it was a sitewide, always-visible bug. */
.vt-search-btn svg circle, .vt-search-btn svg path { stroke: currentColor; }
.vt-search-input {
	width: 6.5rem; border: none; background: transparent; font-family: var(--font-body);
	font-size: 0.85rem; color: var(--ink); outline: none;
	transition: width 0.2s ease;
}
/* 6.5rem (104px) only shows ~8 characters — a real query scrolls out of view as you type,
 * with no way to see what you typed before submitting. Widen on focus/while non-empty;
 * stays compact the rest of the time so it doesn't crowd the nav/CTA. */
.vt-search-form:focus-within .vt-search-input,
.vt-search-input:not(:placeholder-shown) {
	width: 14rem;
}
.vt-search-input::placeholder { color: var(--ink-faint); }

.vt-nav-cta {
  background: var(--ink); color: var(--paper); border-radius: 999px;
  padding: 0.55rem 1.25rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em;
  white-space: nowrap; text-decoration: none; transition: opacity 0.2s ease;
}
.vt-nav-cta:hover { opacity: 0.78; }

/* ---------- trust badges ---------- */

.vt-trust {
  padding: clamp(2.4rem, 5vw, 3.2rem) clamp(1.5rem, 5vw, 4rem);
  background: var(--ink);
  color: var(--paper);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2rem);
}
@media (max-width: 860px) { .vt-trust { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.vt-trust-item { display: flex; flex-direction: column; gap: 0.5rem; }
.vt-trust-item .icon { width: 1.7rem; height: 1.7rem; opacity: 0.9; }
.vt-trust-item .icon path { stroke: var(--paper); }
.vt-trust-item p { margin: 0; font-size: 0.82rem; color: rgba(255,255,255,0.66); }
.vt-trust-item .vt-trust-item-title { font-family: var(--font-display); font-size: 0.98rem; font-weight: 620; color: var(--paper); }

/* ---------- product card ---------- */

.vt-product-card {
  background: var(--paper);
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.vt-product-card .thumb {
  aspect-ratio: 4 / 5;
  background: var(--paper-raised);
  overflow: hidden;
  position: relative;
}
.vt-product-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.25s ease; }
.vt-product-card .thumb img.hover-img { position: absolute; inset: 0; opacity: 0; }
.vt-product-card:hover .thumb img.hover-img { opacity: 1; }

.vt-product-card h3 { margin: 0.4rem 0 0; font-family: var(--font-display); font-weight: 620; font-size: 1rem; }
.vt-product-card .from-price { margin: 0; font-size: 0.86rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- wishlist ---------- */

.vt-wishlist-toggle {
  position: absolute; top: 0.7rem; right: 0.7rem; z-index: 1;
  width: 2.1rem; height: 2.1rem; padding: 0; border: none; border-radius: 50%;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--ink-soft); transition: color 0.15s ease, transform 0.15s ease;
}
.vt-wishlist-toggle:hover { color: var(--ink); transform: scale(1.06); }
.vt-wishlist-toggle svg { width: 1.05rem; height: 1.05rem; }
.vt-wishlist-toggle svg path { stroke: currentColor; transition: fill 0.15s ease; }
.vt-wishlist-toggle.is-active { color: var(--accent-strong); }
.vt-wishlist-toggle.is-active svg path { fill: currentColor; }

.vt-wishlist-toggle-pdp {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.6rem 1.1rem; margin-top: 0.9rem; cursor: pointer;
  font-size: 0.85rem; color: var(--ink-soft); position: static;
}
.vt-wishlist-toggle-pdp:hover { border-color: var(--ink-soft); color: var(--ink); }
.vt-wishlist-toggle-pdp svg { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.vt-wishlist-toggle-pdp svg path { stroke: currentColor; }
.vt-wishlist-toggle-pdp.is-active { color: var(--accent-strong); border-color: var(--accent-strong); }
.vt-wishlist-toggle-pdp.is-active svg path { fill: currentColor; }

.vt-wishlist-link, .vt-cart-link, .vt-account-link { position: relative; display: flex; align-items: center; color: var(--ink-soft); }
.vt-wishlist-link:hover, .vt-cart-link:hover, .vt-account-link:hover { color: var(--ink); }
.vt-wishlist-link svg, .vt-cart-link svg, .vt-account-link svg { width: 1.15rem; height: 1.15rem; }
.vt-wishlist-link svg path, .vt-cart-link svg path, .vt-account-link svg path,
.vt-wishlist-link svg circle, .vt-cart-link svg circle, .vt-account-link svg circle { stroke: currentColor; }
.vt-wishlist-count, .vt-cart-count {
  position: absolute; top: -0.4rem; right: -0.5rem; min-width: 1rem; height: 1rem;
  border-radius: 999px; background: var(--accent-strong); color: #fff;
  font-size: 0.62rem; line-height: 1rem; text-align: center; padding: 0 0.15rem;
}

/* ---------- cookie consent ---------- */

.vt-cookie-consent {
  position: fixed; left: 1.2rem; right: 1.2rem; bottom: 1.2rem; z-index: 60;
  max-width: 34rem; margin: 0 auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  padding: 1.1rem 1.3rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
}
.vt-cookie-consent[hidden] { display: none; }
.vt-cookie-consent p { margin: 0; flex: 1 1 16rem; font-size: 0.85rem; color: var(--ink-soft); }
.vt-cookie-consent p a { color: var(--ink); }
.vt-cookie-consent-actions { display: flex; gap: 0.6rem; flex-shrink: 0; }
.vt-cookie-consent-actions .vt-btn { padding: 0.5rem 1.1rem; font-size: 0.82rem; }
.vt-product-card .from-price strong { color: var(--ink); font-weight: 600; }

/* ---------- footer ---------- */

.vt-footer {
  border-top: 1px solid var(--line);
  padding: clamp(2.4rem, 5vw, 3.2rem) clamp(1.5rem, 5vw, 4rem);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.vt-footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.vt-footer-links a { text-decoration: none; color: var(--ink-soft); }
.vt-footer-links a:hover { color: var(--ink); }

.vt-footer-newsletter { width: 100%; order: -1; padding-bottom: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: clamp(1.6rem, 3.5vw, 2.2rem); border-bottom: 1px solid var(--line); }
.vt-footer-newsletter-title { margin: 0; font-family: var(--font-display); font-weight: 620; font-size: 1rem; color: var(--ink); }
.vt-footer-newsletter-desc { margin: 0.3rem 0 0.9rem; }
.vt-newsletter-form { display: flex; gap: 0.7rem; max-width: 26rem; }
.vt-newsletter-form input {
  flex: 1; font-family: var(--font-body); font-size: 0.85rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 0.6rem 0.8rem;
}
.vt-footer-newsletter-status { margin: 0.6rem 0 0; min-height: 1em; color: var(--accent-strong); }

.vt-footer-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px solid var(--line-soft);
  margin-top: clamp(1.6rem, 3vw, 2.2rem);
  padding-top: 1.2rem;
  font-size: 0.76rem;
}

/* ---------- pricing configurator (shared: PDP + standalone Ring Builder page) ---------- */

.vt-configurator {
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 1.4rem;
	margin: 1.2rem 0;
	display: flex;
	flex-direction: column;
	gap: 1.2rem;
	background: var(--paper-raised);
}

.vt-config-field { display: flex; flex-direction: column; gap: 0.5rem; }
.vt-config-field .field-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.vt-config-field select, .vt-config-field input[type="text"] {
	font-family: var(--font-body); font-size: 0.9rem; color: var(--ink);
	background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 0.55rem 0.7rem;
}
.vt-config-field .field-optional { text-transform: none; letter-spacing: normal; font-weight: 400; }

.metal-swatches { display: flex; gap: 1rem; }
.swatch-option { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; cursor: pointer; font-size: 0.72rem; color: var(--ink-soft); }
.swatch-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch-option .swatch {
	width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
	border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line) inset; position: relative;
}
.swatch-option input:checked + .swatch { border-color: var(--ink); }
.swatch-option input:focus-visible + .swatch { outline: 2px solid var(--accent-soft); outline-offset: 2px; }
/* Selection shown by shape (checkmark), not color alone — ui-ux-pro-max: Accessibility/Color Only, High. */
.swatch-option input:checked + .swatch::after {
	content: '';
	width: 0.5rem; height: 0.3rem;
	border-left: 2px solid var(--ink);
	border-bottom: 2px solid var(--ink);
	transform: rotate(-45deg) translateY(-1px);
	mix-blend-mode: difference;
}

.vt-config-price {
	display: flex; align-items: baseline; justify-content: space-between;
	border-top: 1px solid var(--line); padding-top: 1rem;
}
.vt-config-price .amount-label { font-size: 0.78rem; color: var(--ink-faint); }
.vt-config-price .amount { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.vt-config-price .amount[aria-busy="true"] { opacity: 0.5; }

/* ---------- section shell (shared across pages) ---------- */

.vt-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: clamp(1.6rem, 3.5vw, 2.4rem);
  flex-wrap: wrap;
}
.vt-section-head h2 { margin: 0.3rem 0 0; font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 640; }
.vt-section-head .see-all {
  font-size: 0.85rem; text-decoration: none; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); padding-bottom: 0.15rem; white-space: nowrap;
}
.vt-section-head .see-all:hover { color: var(--ink); border-color: var(--ink); }
