/* =========================================================================
   The CraftingTable — Premium UI Layer
   Glassmorphism · depth · animated mesh · 3D tilt · AI flourishes ·
   micro-interactions. Additive: layered on top of style.css / dashboard.css.
   All heavy motion is gated by prefers-reduced-motion and pointer/size queries.
   ========================================================================= */

:root {
  /* Elevation — deep, soft shadows for floating glass panels */
  --e1: 0 2px 8px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.14);
  --e2: 0 8px 24px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.18);
  --e3: 0 20px 60px rgba(0, 0, 0, 0.25), 0 16px 48px rgba(0, 0, 0, 0.22);
  --e4: 0 24px 60px rgba(0, 0, 0, 0.4), 0 40px 90px rgba(0, 0, 0, 0.3);

  /* Frosted glass */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.1);
  --glass-brd: rgba(255, 255, 255, 0.12);
  --glass-blur: 30px;

  /* Soft white sheen (no color) */
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.22), 0 20px 60px rgba(0, 0, 0, 0.35);
  --grad-1: #ffffff;
  --grad-2: #e6e8eb;
  --grad-3: #ffffff;
  --grad-4: #c8ccd2;

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Let the animated mesh show through the page. */
body {
  background: transparent !important;
}

/* No page gradient — the BG.mp4 video is the only background. */
html {
  background: transparent;
}

/* ---------------------------------------------------------------------- */
/*  Glass theme tokens (storefront — html.tct-immersive)                  */
/*  The single site-wide background is the BG.mp4 video (see end of file). */
/* ---------------------------------------------------------------------- */
html.tct-immersive {
  --bg: transparent;
  --surface: rgba(255, 255, 255, 0.06);
  --foreground: #ffffff;
  --muted: rgba(255, 255, 255, 0.75);
  --border: rgba(255, 255, 255, 0.12);
  --input: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-bg-strong: rgba(255, 255, 255, 0.12);
  --glass-brd: rgba(255, 255, 255, 0.12);
  --accent-text: #ffffff;
  color: var(--foreground);
  background: transparent;
}

/* ====================================================================== */
/*  Glassmorphism — applied to existing surfaces via .glass / selectors    */
/* ====================================================================== */
.glass,
.cart-summary,
.checkout-summary,
.checkout-card,
.modal__box {
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(160%) blur(var(--glass-blur));
  backdrop-filter: saturate(160%) blur(var(--glass-blur));
  border: 1px solid var(--glass-brd);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Frosted glass cards — floating panels above the video. */
.card,
.why-card,
.review,
.stat,
.faq-item,
.dropzone,
.cart-item,
.cart-summary,
.checkout-summary,
.checkout-card,
.orders-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: saturate(150%) blur(30px);
  backdrop-filter: saturate(150%) blur(30px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* Hover: gentle lift, accent glow + border. */
.card:hover,
.why-card:hover,
.review:hover,
.stat:hover,
.faq-item:hover {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35), 0 0 32px rgba(255, 255, 255, 0.18);
}

/* ====================================================================== */
/*  Floating elevation + 3D tilt                                          */
/* ====================================================================== */
.tilt {
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.4s var(--ease, ease), box-shadow 0.4s ease;
  will-change: transform;
}
.tilt.is-tilting {
  transition: box-shadow 0.4s ease;
  box-shadow: var(--e3);
}
/* Lift inner media slightly for parallax depth inside the card */
.tilt .card__media,
.tilt .stat__icon,
.tilt .why-card__icon {
  transform: translateZ(28px);
}

.card:hover,
.why-card:hover,
.review:hover,
.stat:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35), 0 0 32px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.45);
}

/* Soft ambient glow around active / focused elements */
.glow,
.btn:focus-visible,
.cart-btn:focus-visible,
input:focus-visible,
textarea:focus-visible {
  box-shadow: var(--glow);
  outline: none;
}

/* ====================================================================== */
/*  Animated gradient borders                                            */
/* ====================================================================== */
.grad-border {
  position: relative;
  isolation: isolate;
}
.grad-border::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--ang, 0deg),
    var(--grad-1),
    var(--grad-3),
    var(--grad-2),
    var(--grad-4),
    var(--grad-1)
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin-ang 6s linear infinite;
  z-index: -1;
}
@property --ang {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes spin-ang {
  to { --ang: 360deg; }
}

/* ====================================================================== */
/*  Magnetic buttons + ripple + press                                    */
/* ====================================================================== */
.btn,
.admin-btn,
.chip,
.ofilter {
  transform: translate3d(var(--magx, 0), var(--magy, 0), 0) scale(var(--press, 1));
  transition: transform 0.25s var(--spring), box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  overflow: hidden;
}
/* Keep the magnetic transform during hover (overrides base hover lift). */
.btn:hover,
.admin-btn:hover {
  transform: translate3d(var(--magx, 0), var(--magy, 0), 0) scale(var(--press, 1));
}
.btn:active,
.admin-btn:active {
  --press: 0.96;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
  mix-blend-mode: overlay;
}
@keyframes ripple {
  to { transform: scale(2.6); opacity: 0; }
}

/* ====================================================================== */
/*  Tooltips                                                             */
/* ====================================================================== */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px) scale(0.92);
  background: rgba(14, 19, 28, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-brd);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  border-radius: 9px;
  white-space: nowrap;
  box-shadow: var(--e2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s var(--spring);
  z-index: 200;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ====================================================================== */
/*  Loading skeletons + image reveal                                     */
/* ====================================================================== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--sand);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to { transform: translateX(100%); }
}
img.fx-img {
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.02);
  transition: opacity 0.6s ease, filter 0.7s ease, transform 0.7s ease;
}
img.fx-img.loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

/* ====================================================================== */
/*  Page leave transition (fade + scale on internal navigation)          */
/* ====================================================================== */
body.is-leaving main {
  opacity: 0;
  transform: scale(0.99);
  transition: opacity 0.32s ease, transform 0.32s ease;
}

/* ====================================================================== */
/*  3D floating sidebar (dashboard)                                      */
/* ====================================================================== */
.admin-top {
  perspective: 1200px;
}
.admin-top .admin-top__inner {
  transform: translateZ(0);
}

/* ====================================================================== */
/*  Mobile / reduced-motion guards                                       */
/* ====================================================================== */
@media (prefers-reduced-motion: reduce) {
  .grad-border::before {
    animation: none !important;
  }
  img.fx-img { opacity: 1; filter: none; transform: none; }
  .tilt { transform: none !important; }
}

/* ====================================================================== */
/*  Immersive dark theme — component readability overrides                */
/*  (variables above already flip most surfaces; these fix the light      */
/*   exceptions and tune accent contrast.)                                */
/* ====================================================================== */

/* On-background sections become transparent so the layers show through. */
html.tct-immersive .hero,
html.tct-immersive .section--alt,
html.tct-immersive .custom-hero {
  background: transparent;
}

/* Headline accent + price/accent text → bright white for contrast */
html.tct-immersive .hero h1 .hl,
html.tct-immersive .hl,
html.tct-immersive .brand span b,
html.tct-immersive .card__price,
html.tct-immersive .product__price,
html.tct-immersive .cart-item__price,
html.tct-immersive .summary-row--total span:last-child {
  color: var(--accent-text);
}

/* Premium eyebrow chip on dark */
html.tct-immersive .eyebrow {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-text);
  border: 1px solid var(--border);
}

/* Inputs: dark fields, light text, dark focus */
html.tct-immersive .field input,
html.tct-immersive .field textarea,
html.tct-immersive .field select {
  color: var(--foreground);
}
html.tct-immersive .field input::placeholder,
html.tct-immersive .field textarea::placeholder,
html.tct-immersive .shop__search input::placeholder {
  color: var(--muted);
}
html.tct-immersive .field input:focus,
html.tct-immersive .field textarea:focus,
html.tct-immersive .field select:focus {
  background: rgba(255, 255, 255, 0.06);
}

/* Chips (shop) hover contrast */
html.tct-immersive .chip:hover {
  color: var(--accent-text);
  border-color: var(--accent-text);
}

/* Ghost button hover must stay readable on dark */
html.tct-immersive .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
  color: var(--foreground);
}
html.tct-immersive .cart-summary__cont:hover,
html.tct-immersive .checkout-summary__back:hover {
  color: var(--accent-text);
}

/* Selected payment option → tinted glass instead of light fill */
html.tct-immersive .pay-option.selected {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--primary);
}

/* ====================================================================== */
/*  Live video background (Video/BG.mp4) — the single site-wide background */
/*  Replaces every generated gradient / particle / mesh / SVG background.  */
/*  Injected once by premium.js as <video id="bg-video"> on every page.    */
/* ====================================================================== */

/* No page-level gradient anywhere — the video is the only background. */
html,
html.tct-immersive {
  background: transparent !important;
}

/* Remove the immersive corner-glow gradient spots. */
html.tct-immersive::before,
html.tct-immersive::after {
  content: none !important;
  display: none !important;
}

/* Fixed fullscreen video, covering the viewport, behind everything. */
#bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
  border: 0;
}

/* Cinematic overlay above the video, below all content: an even scrim plus a
   soft vignette that darkens the edges and keeps the centre clear — adds depth
   without becoming the background itself (the video stays primary). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 120% at 50% 38%, transparent 40%, rgba(0, 0, 0, 0.55) 100%),
    rgba(0, 0, 0, 0.34);
  z-index: -1;
  pointer-events: none;
}

/* All page / section bands stay clear so the video remains visible. */
.section,
.section--alt,
.hero,
.page-hero,
.custom-hero,
.custom-band,
.closing {
  background: transparent !important;
}

/* Footer + closing panel become translucent dark glass over the video. */
.footer {
  background: rgba(8, 12, 22, 0.55) !important;
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  backdrop-filter: saturate(150%) blur(18px);
  border-top: 1px solid var(--glass-brd);
}
.closing__inner {
  background: rgba(16, 22, 40, 0.42) !important;
  border: 1px solid var(--glass-brd);
  -webkit-backdrop-filter: saturate(150%) blur(16px);
  backdrop-filter: saturate(150%) blur(16px);
}

/* Legibility for text that floats directly over the video (no glass panel). */
.hero__inner,
.hero__stats,
.section-head,
.page-hero,
.custom-hero__inner {
  text-shadow: 0 1px 24px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Accent text highlight used across headings. */
.hl {
  color: var(--primary);
  text-shadow: 0 0 28px rgba(255, 255, 255, 0.5);
}

/* ====================================================================== */
/*  Liquid Glass reflections + cinematic product cards                    */
/* ====================================================================== */

/* A crisp top reflection line on every glass surface (the "liquid" sheen). */
.nav__inner,
.card,
.why-card,
.review,
.stat,
.faq-item,
.dropzone,
.cart-item,
.cart-summary,
.checkout-summary,
.checkout-card,
.closing__inner,
.glass {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* Product / content cards: floating glass with a diagonal glass reflection. */
.card,
.why-card,
.review {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: transform 0.5s var(--spring), box-shadow 0.5s var(--ease),
    backdrop-filter 0.5s var(--ease), -webkit-backdrop-filter 0.5s var(--ease),
    border-color 0.5s var(--ease);
}

/* Moving glass reflection that sweeps as the card tilts under the cursor. */
.card::after,
.why-card::after,
.review::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0) 36%,
    rgba(255, 255, 255, 0) 62%,
    rgba(255, 255, 255, 0.07)
  );
  mix-blend-mode: screen;
  opacity: 0.5;
  transition: opacity 0.5s var(--ease);
}

/* Hover: lift, deepen the shadow, and increase the frosted blur. */
.card:hover,
.why-card:hover,
.review:hover {
  transform: translateY(-8px);
  -webkit-backdrop-filter: saturate(160%) blur(46px);
  backdrop-filter: saturate(160%) blur(46px);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 40px rgba(255, 255, 255, 0.08);
}
.card:hover::after,
.why-card:hover::after,
.review:hover::after {
  opacity: 0.92;
}

/* Keep the floating lift even while the 3D tilt engine is driving rotation. */
.card.tilt:hover,
.why-card.tilt:hover,
.review.tilt:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-8px) translateZ(10px);
}
