/*
 * Shell CSS — Global layout, header, footer, and design tokens.
 * Redesigned for a high-end tech/electronics retailer look.
 *
 * @package wc-store
 */

/* ─── Design Tokens (Fluid & Thematic) ─────────────────────────────────────── */

:root {
  /* Colors - Light Theme (Default) */
  --wcstore-surface:        #ffffff;
  --wcstore-bg:             #f5f5f7; /* Apple-like light gray */
  --wcstore-text:           #1d1d1f;
  --wcstore-text-muted:     #86868b;
  --wcstore-text-light:     #f5f5f7;
  
  --wcstore-primary:        #0071e3; /* Electric tech blue */
  --wcstore-primary-dark:   #005bbf;
  --wcstore-primary-light:  rgba(0, 113, 227, 0.08);
  
  --wcstore-accent:         #ff9500;
  --wcstore-accent-dark:    #e08300;
  --wcstore-error:          #ff3b30;
  --wcstore-success:        #34c759;

  --wcstore-border:         #d2d2d7;
  --wcstore-border-light:   rgba(0, 0, 0, 0.08);
  
  /* Typography */
  --wcstore-font-heading:   'Clash Display', system-ui, sans-serif;
  --wcstore-font-body:      'Manrope', system-ui, sans-serif;
  
  /* Fluid Typographic Scale */
  --text-xs: clamp(0.75rem, 0.71rem + 0.18vw, 0.85rem);
  --text-sm: clamp(0.875rem, 0.83rem + 0.22vw, 1rem);
  --text-base: clamp(1rem, 0.96rem + 0.22vw, 1.125rem);
  --text-md: clamp(1.125rem, 1.08rem + 0.22vw, 1.25rem);
  --text-lg: clamp(1.25rem, 1.16rem + 0.43vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.32rem + 0.89vw, 2rem);
  --text-2xl: clamp(2rem, 1.64rem + 1.79vw, 3rem);
  --text-3xl: clamp(2.5rem, 1.96rem + 2.68vw, 4rem);

  /* Spacing Scale (Fluid) */
  --sp-xs:  clamp(0.25rem, 0.23rem + 0.11vw, 0.5rem);
  --sp-sm:  clamp(0.5rem, 0.46rem + 0.22vw, 0.75rem);
  --sp-md:  clamp(1rem, 0.91rem + 0.43vw, 1.5rem);
  --sp-lg:  clamp(1.5rem, 1.32rem + 0.89vw, 2.5rem);
  --sp-xl:  clamp(2.5rem, 2.14rem + 1.79vw, 4.5rem);
  --sp-2xl: clamp(4rem, 3.21rem + 3.57vw, 7rem);

  /* radii */
  --wcstore-radius-sm:      8px;
  --wcstore-radius-md:      16px;
  --wcstore-radius-lg:      24px;
  --wcstore-radius-xl:      32px;
  --wcstore-radius-full:    9999px;

  /* Shadows */
  --wcstore-shadow-sm:      0 2px 8px rgba(0,0,0,0.04);
  --wcstore-shadow-md:      0 10px 30px rgba(0,0,0,0.08);
  --wcstore-shadow-lg:      0 20px 50px rgba(0,0,0,0.12);
  --wcstore-shadow-glow:    0 0 20px rgba(0, 113, 227, 0.3);

  /* Transitions */
  --ease-out-expo:          cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:            cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast:          0.2s;
  --duration-normal:        0.4s;
  --duration-slow:          0.6s;
  
  --wcstore-transition:     var(--duration-fast) var(--ease-out-expo);

  /* Layout */
  --wcstore-max-width:      1400px;
  --wcstore-container-pad:  var(--sp-md);
  --wcstore-header-height:  80px;
  --wcstore-sidebar-width:  300px;
}

/* Dark Theme Support via prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root {
    --wcstore-surface:        #1c1c1e;
    --wcstore-bg:             #000000;
    --wcstore-text:           #f5f5f7;
    --wcstore-text-muted:     #86868b;
    --wcstore-text-light:     #ffffff;
    
    --wcstore-primary:        #2997ff;
    --wcstore-primary-dark:   #0071e3;
    --wcstore-primary-light:  rgba(41, 151, 255, 0.15);
    
    --wcstore-border:         #333336;
    --wcstore-border-light:   rgba(255, 255, 255, 0.08);

    --wcstore-shadow-sm:      0 2px 8px rgba(0,0,0,0.2);
    --wcstore-shadow-md:      0 10px 30px rgba(0,0,0,0.4);
    --wcstore-shadow-lg:      0 20px 50px rgba(0,0,0,0.6);
  }
}

/* Optional explicit toggle override */
html[data-theme='dark'] {
    --wcstore-surface:        #1c1c1e;
    --wcstore-bg:             #000000;
    --wcstore-text:           #f5f5f7;
    --wcstore-text-muted:     #86868b;
    --wcstore-text-light:     #ffffff;
    
    --wcstore-primary:        #2997ff;
    --wcstore-primary-dark:   #0071e3;
    --wcstore-primary-light:  rgba(41, 151, 255, 0.15);
    
    --wcstore-border:         #333336;
    --wcstore-border-light:   rgba(255, 255, 255, 0.08);

    --wcstore-shadow-sm:      0 2px 8px rgba(0,0,0,0.2);
    --wcstore-shadow-md:      0 10px 30px rgba(0,0,0,0.4);
    --wcstore-shadow-lg:      0 20px 50px rgba(0,0,0,0.6);
}

html[data-theme='light'] {
    --wcstore-surface:        #ffffff;
    --wcstore-bg:             #f5f5f7;
    --wcstore-text:           #1d1d1f;
    --wcstore-text-muted:     #86868b;
    --wcstore-text-light:     #f5f5f7;
    --wcstore-primary:        #0071e3;
    --wcstore-primary-dark:   #005bbf;
    --wcstore-primary-light:  rgba(0, 113, 227, 0.08);
    --wcstore-border:         #d2d2d7;
    --wcstore-border-light:   rgba(0, 0, 0, 0.08);
    --wcstore-shadow-sm:      0 2px 8px rgba(0,0,0,0.04);
    --wcstore-shadow-md:      0 10px 30px rgba(0,0,0,0.08);
    --wcstore-shadow-lg:      0 20px 50px rgba(0,0,0,0.12);
}

/* ─── Reset / Base ─────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--wcstore-font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--wcstore-text);
  background: var(--wcstore-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--wcstore-font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--sp-sm);
  color: var(--wcstore-text);
}

img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit; /* Prevent global link-blue bleed into nav/footer/notices */
  text-decoration: none;
  transition: color var(--wcstore-transition);
}

/* WooCommerce content links should be primary-coloured */
.woocommerce-page .woocommerce a:not(.button):not(.wcstore-cart-icon):not(.wcstore-shell-nav-menu a) {
  color: var(--wcstore-primary);
}

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--wcstore-primary);
  outline-offset: 2px;
}

/* ─── Page Wrapper ─────────────────────────────────────────────────────────── */

.wcstore-page-wrap {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--wcstore-header-height));
}

/* ─── Header ───────────────────────────────────────────────────────────────── */

.wcstore-shell-header {
  position: sticky;
  top: 0;
  z-index: 1300;
  height: var(--wcstore-header-height);
  background: color-mix(in srgb, var(--wcstore-surface) 80%, transparent);
  border-bottom: 1px solid var(--wcstore-border-light);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background var(--duration-normal) var(--ease-out-expo), box-shadow var(--duration-normal) var(--ease-out-expo);
}

.wcstore-shell-header.is-scrolled {
  background: color-mix(in srgb, var(--wcstore-surface) 90%, transparent);
  box-shadow: var(--wcstore-shadow-sm);
}

.wcstore-shell-header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--wcstore-max-width), 100%);
  margin: 0 auto;
  padding: 0 var(--wcstore-container-pad);
  height: 100%;
}

/* Logo */
.wcstore-shell-logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.wcstore-shell-logo {
  max-height: 38px;
  width: auto;
  object-fit: contain;
}

.wcstore-shell-logo-text {
  font-family: var(--wcstore-font-heading);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--wcstore-text);
  text-transform: uppercase;
}

/* Navigation */
.wcstore-shell-nav {
  display: flex;
  align-items: center;
}

.wcstore-shell-nav-menu,
ul.wcstore-shell-nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

.wcstore-shell-nav-menu a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--wcstore-text);
  border-radius: var(--wcstore-radius-full);
  transition: all var(--duration-fast) var(--ease-out-expo);
  position: relative;
}

.wcstore-shell-nav-menu a:hover,
.wcstore-shell-nav-menu .current-menu-item > a {
  color: var(--wcstore-primary);
}

.wcstore-shell-nav-menu a::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: calc(100% - 2rem);
  height: 2px;
  background: var(--wcstore-primary);
  border-radius: 2px;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.wcstore-shell-nav-menu a:hover::after,
.wcstore-shell-nav-menu .current-menu-item > a::after {
  transform: translateX(-50%) scaleX(1);
}

/* Header Actions */
.wcstore-shell-header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

/* Cart Icon */
.wcstore-cart-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--wcstore-radius-full);
  color: var(--wcstore-text);
  background: var(--wcstore-border-light);
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.wcstore-cart-icon:hover {
  background: var(--wcstore-primary-light);
  color: var(--wcstore-primary);
  transform: scale(1.02);
}

.wcstore-cart-icon__svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wcstore-cart-icon__count {
  font-size: var(--text-xs);
  font-weight: 800;
  line-height: 1;
}

.wcstore-cart-icon__subtotal {
  font-size: var(--text-sm);
  font-weight: 600;
  display: none; /* Hide subtotal to keep it minimalist, just show count */
}

/* Account Button */
.wcstore-shell-account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--wcstore-text);
  background: var(--wcstore-border-light);
  border-radius: 50%;
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.wcstore-shell-account-btn:hover {
  background: var(--wcstore-primary-light);
  color: var(--wcstore-primary);
  transform: scale(1.05);
}

.wcstore-shell-account-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Mobile Menu Button */
.wcstore-shell-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--wcstore-text);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out-expo);
}

.wcstore-shell-menu-btn:hover {
  background: var(--wcstore-border-light);
}

.wcstore-shell-menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
}

/* ─── Mobile Menu ──────────────────────────────────────────────────────────── */

.wcstore-shell-mobile-menu {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--wcstore-bg) 60%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1400;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-out-expo), visibility var(--duration-normal);
}

.wcstore-shell-mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
}

.wcstore-shell-mobile-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 85vw);
  background: var(--wcstore-surface);
  box-shadow: -20px 0 50px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  padding: var(--sp-md);
  transform: translateX(100%);
  transition: transform var(--duration-slow) var(--ease-out-expo);
  overflow-y: auto;
}

.wcstore-shell-mobile-menu.is-open .wcstore-shell-mobile-menu__panel {
  transform: translateX(0);
}

.wcstore-shell-mobile-menu__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--wcstore-border-light);
  color: var(--wcstore-text);
  cursor: pointer;
  margin-left: auto;
  margin-bottom: var(--sp-md);
  transition: transform var(--wcstore-transition), background var(--wcstore-transition);
}

.wcstore-shell-mobile-menu__close:hover {
  transform: rotate(90deg);
  background: var(--wcstore-border);
}

.wcstore-shell-mobile-menu__close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}

.wcstore-shell-mobile-nav-menu,
ul.wcstore-shell-mobile-nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.wcstore-shell-mobile-nav-menu a {
  display: block;
  font-family: var(--wcstore-font-heading);
  font-size: var(--text-xl); /* Reduced from --text-2xl to prevent wrapping in narrow panels */
  font-weight: 600;
  color: var(--wcstore-text);
  transition: color var(--wcstore-transition), transform var(--wcstore-transition);
}

.wcstore-shell-mobile-nav-menu a:hover {
  color: var(--wcstore-primary);
  transform: translateX(10px);
}

/* ─── Common Layout ─────────────────────────────────────────────────────────── */

.wcstore-container {
  width: min(var(--wcstore-max-width), 100%);
  margin: 0 auto;
  padding: 0 var(--wcstore-container-pad);
}

/* ─── Base Page Wrapper styling ────────────────────────────────────────────── */

.wcstore-commerce-shell {
  width: min(var(--wcstore-max-width), 100%);
  margin: 0 auto;
  padding: var(--sp-lg) var(--wcstore-container-pad) var(--sp-xl);
}

.wcstore-commerce-container {
  background: var(--wcstore-surface);
  border: 1px solid var(--wcstore-border-light);
  border-radius: var(--wcstore-radius-lg);
  box-shadow: var(--wcstore-shadow-sm);
  padding: var(--sp-xl);
}

/* ─── Utility Buttons ───────────────────────────────────────────────────────── */

.wcstore-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.8em 1.6em;
  font-family: var(--wcstore-font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--wcstore-radius-full);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-expo);
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.2;
}

.wcstore-btn--primary {
  background: var(--wcstore-text);
  color: var(--wcstore-surface);
}

.wcstore-btn--primary:hover {
  background: var(--wcstore-primary);
  color: #fff;
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--wcstore-shadow-md);
}

.wcstore-btn--outline {
  background: transparent;
  color: var(--wcstore-text);
  border-color: var(--wcstore-border);
}

.wcstore-btn--outline:hover {
  background: var(--wcstore-text);
  color: var(--wcstore-surface);
  border-color: var(--wcstore-text);
}

/* ─── Page Titles ───────────────────────────────────────────────────────────── */

.wcstore-page-title {
  font-family: var(--wcstore-font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--wcstore-text);
  margin: 0 0 var(--sp-md);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* ─── 404 Page ──────────────────────────────────────────────────────────────── */

.wcstore-404-page {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wcstore-404 {
  text-align: center;
  padding: var(--sp-xl) var(--sp-md);
  max-width: 600px;
  margin: 0 auto;
}

.wcstore-404__code {
  font-family: var(--wcstore-font-heading);
  font-size: clamp(6rem, 10vw, 12rem);
  font-weight: 700;
  color: var(--wcstore-text);
  line-height: 1;
  margin: 0 0 var(--sp-md);
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--wcstore-text), var(--wcstore-text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wcstore-404__title {
  font-size: var(--text-2xl);
  margin: 0 0 var(--sp-sm);
}

.wcstore-404__message {
  color: var(--wcstore-text-muted);
  font-size: var(--text-lg);
  margin: 0 0 var(--sp-lg);
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */

.wcstore-shell-footer {
  background: var(--wcstore-surface);
  border-top: 1px solid var(--wcstore-border-light);
  padding: var(--sp-xl) 0 var(--sp-md);
  margin-top: auto;
}

.wcstore-shell-footer__container {
  width: min(var(--wcstore-max-width), 100%);
  margin: 0 auto;
  padding: 0 var(--wcstore-container-pad);
}

.wcstore-shell-footer__content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.wcstore-shell-footer__brand-name {
  font-family: var(--wcstore-font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--wcstore-text);
  letter-spacing: -0.02em;
}

.wcstore-shell-footer__brand-text {
  font-size: var(--text-sm);
  color: var(--wcstore-text-muted);
  margin: var(--sp-sm) 0 0;
  max-width: 320px;
}

.wcstore-shell-footer__title {
  font-family: var(--wcstore-font-heading);
  color: var(--wcstore-text);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--sp-md);
}

.wcstore-shell-footer__links,
ul.wcstore-shell-footer__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.wcstore-shell-footer__links a {
  color: var(--wcstore-text-muted);
  font-size: var(--text-sm);
  transition: color var(--wcstore-transition);
}

.wcstore-shell-footer__links a:hover {
  color: var(--wcstore-primary);
}

/* Bottom bar */
.wcstore-shell-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  border-top: 1px solid var(--wcstore-border-light);
  padding-top: var(--sp-md);
  flex-wrap: wrap;
}

.wcstore-shell-footer__copyright {
  font-size: var(--text-xs);
  color: var(--wcstore-text-muted);
  margin: 0;
}

.wcstore-shell-footer__bottom-nav {
  display: flex;
  gap: var(--sp-sm);
  list-style: none;
  padding: 0;
  margin: 0;
}

.wcstore-shell-footer__bottom-nav a {
  color: var(--wcstore-text-muted);
  font-size: var(--text-xs);
}

.wcstore-shell-footer__bottom-nav a:hover {
  color: var(--wcstore-text);
}

/* ─── Scroll-to-top ─────────────────────────────────────────────────────────── */

.wcstore-scroll-top {
  position: fixed;
  right: var(--sp-md);
  bottom: var(--sp-md);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--wcstore-surface) 80%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--wcstore-border-light);
  color: var(--wcstore-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--duration-normal) var(--ease-out-expo);
  box-shadow: var(--wcstore-shadow-md);
  z-index: 999;
}

.wcstore-scroll-top svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.wcstore-scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.wcstore-scroll-top:hover {
  background: var(--wcstore-text);
  color: var(--wcstore-surface);
  transform: translateY(-5px);
}

/* ─── Screen Reader Utilities ───────────────────────────────────────────────── */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .wcstore-shell-footer__content {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-md);
  }
}

@media (max-width: 768px) {
  .wcstore-shell-menu-btn {
    display: inline-flex;
  }

  .wcstore-shell-nav,
  .wcstore-shell-header .wcstore-shell-account-btn {
    display: none;
  }

  .wcstore-commerce-container {
    padding: var(--sp-md);
    border-radius: var(--wcstore-radius-md);
  }
}

@media (max-width: 640px) {
  .wcstore-shell-footer__content {
    grid-template-columns: 1fr;
    gap: var(--sp-md);
  }

  .wcstore-shell-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
