/* =========================================================
   Component styles.
   Tailwind (Play CDN) handles utilities; this file holds the
   component classes, glass nav, ad units and animations.

   NO brand colours are hardcoded here - every colour is a CSS
   custom property that theme.js writes from config.js. Re-skinning
   the store therefore never requires touching this file.
   Fallback values keep the page readable if JS is blocked.
   ========================================================= */

:root {
  --c-surface: #fcf8fb;
  --c-surface-2: #f6f2f5;
  --c-card: #ffffff;
  --c-primary: #0a0d24;
  --c-secondary: #412ae7;
  --c-secondary-hover: #3620c9;
  --c-secondary-soft: rgba(65, 42, 231, .08);
  --c-secondary-ring: rgba(65, 42, 231, .18);
  --c-secondary-shadow: rgba(65, 42, 231, .24);
  --c-secondary-shadow-lg: rgba(65, 42, 231, .32);
  --c-accent: #ff5c7a;
  --c-gold: #c9a227;
  --c-gold-soft: rgba(201, 162, 39, .12);
  --c-gold-line: rgba(201, 162, 39, .4);
  --c-gold-text: #a5851f;
  --c-muted: #5b6472;
  --c-line: #e7e3ea;
  --c-text: #1c1b1e;
  --c-input-line: #e0dce6;
  --glass-bg: rgba(252, 248, 251, .72);
  --stripe-bg: rgba(65, 42, 231, .05);

  --c-d-bg: #0b0e16;
  --c-d-2: #1b2030;
  --c-d-line: #28304a;
  --c-d-muted: #98a2b8;
  --c-d-text: #eef1f8;
  --c-d-secondary: #a99cff;
  --c-d-secondary-soft: rgba(91, 76, 255, .16);
  --c-d-gold: #e6c65a;
  --glass-bg-dark: rgba(11, 14, 22, .72);

  --font-display: "Plus Jakarta Sans", sans-serif;
  --container: 1440px;
  --ad-label: #9aa1ad;
}

/* Keep off-canvas/translated elements from creating horizontal scroll.
   `clip` (not `hidden`) keeps position:sticky working. */
html { overflow-x: clip; }
body { overflow-x: clip; max-width: 100%; }

/* Product grid - cards keep a minimum size and wrap responsively
   (2 cols on phones, up to ~5 on wide desktop) instead of being squashed. */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
@media (min-width: 768px) { .product-grid { gap: 24px; } }

/* =========================================================
   Ad units (filled by AdManager / Google AdSense)
   ========================================================= */
.ad-unit { width: 100%; margin: 0 auto; }
.ad-unit.ad-grid { grid-column: 1 / -1; }         /* in-feed ad spans the whole grid row */
.ad-label {
  display: block; text-align: center;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ad-label); margin-bottom: 6px;
}
/* Transparent, centred container - empty area reads as page background,
   never as a wasted grey box. */
.ad-mount { width: 100%; }

/* PRODUCTION only: if AdSense returns no ad, collapse the whole unit so there's
   no empty gap on the live site. In TEST mode every slot stays visible. */
html:not(.ad-test-mode) .ad-unit:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none !important; }
html:not(.ad-test-mode) .ad-mount:has(ins.adsbygoogle[data-ad-status="unfilled"]) { min-height: 0 !important; }

/* TEST mode: draw every slot as a visible box so you can see exactly where the
   ads sit - filled slots show the test ad inside the frame; unfilled slots stay
   as a labelled dashed box instead of vanishing. */
html.ad-test-mode .ad-mount {
  position: relative;
  border: 2px dashed #b7bccb;
  border-radius: 12px;
  background: repeating-linear-gradient(45deg, var(--stripe-bg), var(--stripe-bg) 12px, transparent 12px, transparent 24px);
}
/* AdSense collapses UNFILLED slots with an inline `min-height:0`. In test mode
   force the natural size back per ad type (!important beats the inline style). */
html.ad-test-mode .ad-mount[data-ad="native"]     { min-height: 250px !important; }
html.ad-test-mode .ad-mount[data-ad="banner"]     { min-height: 90px  !important; }
html.ad-test-mode .ad-mount[data-ad="skyscraper"] { min-height: 600px !important; }
/* Centred "Advertisement" label INSIDE the box. It's a pseudo-element, so it
   survives when the ad script replaces the box's innerHTML; a filled ad paints
   on top of it. The top label is hidden in test mode in favour of this one. */
html.ad-test-mode .ad-mount::before {
  content: "Advertisement";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ad-label); pointer-events: none;
}
html.ad-test-mode .ad-unit > .ad-label { display: none; }

/* Outer-margin side-rail ads. Hidden until the viewport is wide enough to fit a
   rail beside the content container, so they NEVER overlap content. */
.ad-rail { display: none; }
@media (min-width: 1820px) {
  /* Constrain the top banner, header and footer to the content width so the
     full-height rails in the margins never overlap them. */
  body > #top-ad, body > header, body > footer {
    max-width: var(--container); margin-left: auto; margin-right: auto;
  }
  .ad-rail {
    display: block; position: fixed; top: 16px; bottom: 16px;
    width: calc((100vw - var(--container)) / 2 - 24px); max-width: 300px; z-index: 30;
  }
  .ad-rail-left  { left: 12px; }
  .ad-rail-right { right: 12px; }
  .ad-rail .ad-unit  { max-width: none; height: 100%; }
  .ad-rail .ad-mount { height: 100% !important; align-items: center; }
}

/* =========================================================
   Components
   ========================================================= */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 24px;
  line-height: 1;
  user-select: none;
}

/* Glassmorphism header */
.glass-nav {
  background-color: var(--glass-bg);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
html.dark .glass-nav { background-color: var(--glass-bg-dark); }

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Header icon buttons */
.nav-icon {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 9999px;
  color: inherit; transition: background .18s, color .18s;
}
.nav-icon:hover { background: var(--c-secondary-soft); color: var(--c-secondary); }
html.dark .nav-icon:hover { background: var(--c-d-secondary-soft); color: var(--c-d-secondary); }
/* Small phones: tighten the icon buttons so the brand name keeps its space. */
@media (max-width: 400px) {
  .nav-icon { width: 38px; height: 38px; }
  .nav-icon .material-symbols-outlined { font-size: 22px; }
}

/* Notification / count badge */
.badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--c-accent); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 9999px;
  border: 2px solid var(--c-surface);
}
html.dark .badge { border-color: var(--c-d-bg); }

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-secondary); color: #fff;
  font-weight: 600; font-size: 15px;
  padding: 12px 22px; border-radius: 9999px;
  transition: transform .12s, box-shadow .18s, background .18s;
  box-shadow: 0 10px 24px var(--c-secondary-shadow);
}
.btn-primary:hover {
  background: var(--c-secondary-hover);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px var(--c-secondary-shadow-lg);
}
.btn-primary:active { transform: translateY(0) scale(.99); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: inherit;
  border: 1px solid var(--c-input-line); font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 9999px; transition: all .18s;
}
.btn-ghost:hover { border-color: var(--c-secondary); color: var(--c-secondary); }
html.dark .btn-ghost { border-color: var(--c-d-line); }
html.dark .btn-ghost:hover { border-color: var(--c-d-secondary); color: var(--c-d-secondary); }

/* Footer helpers */
.footer-h {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-muted); opacity: .85; margin-bottom: 14px;
}
.footer-a { display: block; color: var(--c-muted); font-size: 15px; margin-bottom: 10px; transition: color .18s; }
.footer-a:hover { color: var(--c-secondary); }
html.dark .footer-h { color: var(--c-d-muted); }
html.dark .footer-a { color: var(--c-d-muted); }
html.dark .footer-a:hover { color: var(--c-d-secondary); }

/* Section title */
.sec-title { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }

/* Sponsored tag */
.tag-sponsored {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--c-gold-soft);
  border: 1px solid var(--c-gold-line);
  color: var(--c-gold-text);
  backdrop-filter: blur(6px);
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 9999px;
}
html.dark .tag-sponsored { color: var(--c-d-gold); background: var(--c-gold-soft); }

/* Product card image zoom on hover */
.card-img { transition: transform .7s cubic-bezier(.2,.6,.2,1); }
.group:hover .card-img { transform: scale(1.06); }

/* Second product photo, cross-faded in on hover (only rendered when the
   product actually has more than one image). */
.card-img-alt { transition: opacity .45s ease, transform .7s cubic-bezier(.2,.6,.2,1); }
.group:hover .card-img-alt { opacity: 1; transform: scale(1.06); }
@media (hover: none) { .card-img-alt { display: none; } }

/* Detail-page gallery thumbnails */
.thumb { cursor: pointer; opacity: .65; transition: opacity .2s, border-color .2s; }
.thumb:hover { opacity: 1; }
.thumb.is-active { opacity: 1; border-color: var(--c-secondary); }

/* Fade-up on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Toast */
#toast.show { opacity: 1; visibility: visible; transform: translate(-50%, -8px); }

/* Two-line clamp for card titles */
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* FAQ accordions - native <details>, so they work without JS */
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { content: ''; }
.faq-item summary:hover { color: var(--c-secondary); }
.faq-item[open] { border-color: var(--c-secondary); }
html.dark .faq-item[open] { border-color: var(--c-d-secondary); }

/* Form fields (checkout + contact) */
.field label { font-size: 13px; font-weight: 600; color: var(--c-muted); }
html.dark .field label { color: var(--c-d-muted); }
.field textarea {
  width: 100%; margin-top: 5px;
  border: 1px solid var(--c-input-line); background: var(--c-card); color: var(--c-text);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none;
  font-family: inherit; resize: vertical;
  transition: border .15s, box-shadow .15s;
}
html.dark .field textarea { background: var(--c-d-2); border-color: var(--c-d-line); color: var(--c-d-text); }
.field textarea:focus { border-color: var(--c-secondary); box-shadow: 0 0 0 3px var(--c-secondary-ring); }
.field.invalid textarea { border-color: var(--c-accent); }

.field input, .field select {
  width: 100%; margin-top: 5px;
  border: 1px solid var(--c-input-line); background: var(--c-card); color: var(--c-text);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; outline: none;
  transition: border .15s, box-shadow .15s;
}
html.dark .field input, html.dark .field select {
  background: var(--c-d-2); border-color: var(--c-d-line); color: var(--c-d-text);
}
.field input:focus, .field select:focus {
  border-color: var(--c-secondary); box-shadow: 0 0 0 3px var(--c-secondary-ring);
}
.field.invalid input { border-color: var(--c-accent); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .01ms !important; }
}
