/* ============================================================
   GLOBAL BASE & SHARED STYLES
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100%;
}

body {
  margin: 0;
  display: block !important;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  max-width: 100%;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  box-sizing: border-box;
}

.page-wrapper {
  min-height: 80vh;
  padding-top: 1.75rem;
  padding-bottom: 4rem;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .page-wrapper {
    padding-top: 1.25rem;
    padding-bottom: 2.5rem;
  }
  .container {
    padding-inline: 1rem;
  }
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  text-align: center;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
}

.btn-accent {
  background: linear-gradient(120deg, #c6a052, #e6dfd3);
  color: #1a1206;
}

.btn-accent:hover {
  box-shadow: 0 10px 30px rgba(198, 160, 82, 0.35);
}

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

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==================== NAVBAR ==================== */
.nav, #navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;
  line-height: normal !important;
  z-index: 1000;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

body.home .nav,
body.home #navbar,
body.page-template-page-overview .nav,
body.page-template-page-overview #navbar,
body.page-template-front-page .nav,
body.page-template-front-page #navbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom-color: transparent;
}

body.home .nav.scrolled,
body.home #navbar.scrolled,
body.page-template-page-overview .nav.scrolled,
body.page-template-page-overview #navbar.scrolled,
body.page-template-front-page .nav.scrolled,
body.page-template-front-page #navbar.scrolled {
  background: var(--nav-bg);
  border-bottom-color: var(--border);
}

body.admin-bar .nav,
body.admin-bar #navbar {
  top: 32px;
}

@media screen and (max-width: 782px) {
  body.admin-bar .nav,
  body.admin-bar #navbar {
    top: 46px;
  }
}

.nav-inner {
  height: 56px !important;
  min-height: 56px !important;
  max-height: 56px !important;
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem;
  padding: 0 clamp(1.5rem, 4vw, 3.5rem);
  box-sizing: border-box !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Logo swapping based on active theme */
.nav-logo, .footer .logo {
  display: inline-flex !important;
  align-items: center !important;
  height: 100% !important;
}

.nav-logo img {
  height: 26px !important;
  max-height: 26px !important;
  width: auto !important;
  display: block !important;
}

.footer .logo img {
  height: 22px;
  width: auto;
  display: block;
}

.logo-light {
  display: none !important;
}

.logo-dark {
  display: block !important;
}

[data-theme="dark"] .logo-light {
  display: none !important;
}

[data-theme="dark"] .logo-dark {
  display: block !important;
}

[data-theme="light"] .logo-dark {
  display: none !important;
}

[data-theme="light"] .logo-light {
  display: block !important;
}

.nav-links {
  display: flex !important;
  align-items: center !important;
  gap: clamp(1.1rem, 2.4vw, 2rem);
  list-style: none !important;
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  height: 100% !important;
  max-height: 56px !important;
  box-sizing: border-box !important;
}

body.home .nav-account-link,
body.page-template-page-overview .nav-account-link,
body.page-template-front-page .nav-account-link,
body.page-id-overview .nav-account-link,
body.home .nav-cart-link,
body.page-template-page-overview .nav-cart-link,
body.page-template-front-page .nav-cart-link,
body.page-id-overview .nav-cart-link {
  display: none !important;
}

body.home .theme-toggle,
body.page-template-page-overview .theme-toggle,
body.page-template-front-page .theme-toggle {
  display: none !important;
}

.nav-links li {
  display: inline-flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 100% !important;
  list-style: none !important;
}

.nav-links a {
  display: inline-flex !important;
  align-items: center !important;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1 !important;
  transition: color 0.2s var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-actions {
  display: flex !important;
  align-items: center !important;
  height: 100% !important;
  max-height: 56px !important;
  gap: 0.75rem;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
}

.nav-cart-link {
  position: relative;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem;
  height: 32px !important;
  max-height: 32px !important;
  line-height: 1 !important;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0 0.8rem !important;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  text-decoration: none;
  box-sizing: border-box !important;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.nav-cart-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-cart-badge {
  background: var(--accent);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.1rem 0.42rem;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
}

/* ==================== MOBILE NAVIGATION ==================== */
@media (max-width: 768px) {
  .nav, #navbar {
    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
  }

  .nav-inner {
    height: 56px !important;
    min-height: 56px !important;
    max-height: 56px !important;
    padding: 0 1rem !important;
    gap: 0.5rem !important;
  }

  .nav-logo img {
    height: 22px !important;
    max-height: 22px !important;
  }

  .nav-actions {
    gap: 0.5rem !important;
    height: 100% !important;
  }

  .nav-cart-link {
    height: 30px !important;
    max-height: 30px !important;
    padding: 0 0.6rem !important;
    font-size: 0.82rem !important;
    gap: 0.35rem !important;
  }

  .nav-cart-badge {
    font-size: 0.7rem;
    padding: 0.08rem 0.38rem;
    min-width: 16px;
  }

  .theme-toggle,
  .nav-toggle {
    display: inline-flex !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    font-size: 0.88rem !important;
  }

  /* Slide-down mobile drawer */
  .nav-links {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    width: 100%;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1.25rem;
    gap: 0.35rem;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s var(--ease);
    z-index: 999;
    box-sizing: border-box;
  }

  [data-theme="light"] .nav-links {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
  }

  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-links li {
    display: block;
    width: 100%;
  }

  .nav-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
  }

  [data-theme="light"] .nav-links a:hover,
  [data-theme="light"] .nav-links a.active {
    background: rgba(0, 0, 0, 0.04);
  }

  .nav-links a.active::after {
    content: "•";
    color: var(--accent);
    font-size: 1.2rem;
    line-height: 1;
  }
}

@media (max-width: 380px) {
  .nav-inner {
    padding: 0 0.75rem;
  }

  .nav-logo img {
    height: 18px;
  }

  .nav-actions {
    gap: 0.35rem;
  }

  .nav-cart-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    gap: 0.25rem;
  }

  .theme-toggle,
  .nav-toggle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
}

/* ---------- Theme Toggle (exact match from origin-o5.html) ---------- */
.theme-toggle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  max-width: 36px;
  max-height: 36px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  font-family: var(--font);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  transition:
    border-color 0.2s var(--ease),
    transform 0.2s var(--ease),
    color 0.2s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(12deg);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Footer (exact match from origin-o5.html) ---------- */
.footer {
  width: 100%;
  border-top: 1px solid var(--border);
  padding-block: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: var(--bg);
  transition: background 0.3s var(--ease);
}

.footer .logo {
  display: inline-block;
  margin-bottom: 0.75rem;
}

.footer .logo img {
  height: 22px;
  width: auto;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
}

.footer-links a:hover {
  color: var(--text);
}

.social-icon {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.footer-links a:hover .social-icon {
  stroke: var(--accent);
}

.footer-policy-links {
  margin-top: 1.25rem;
  font-size: 0.82rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  opacity: 0.85;
}

.footer-policy-links a {
  color: var(--text-muted);
  text-decoration: underline;
  transition: color 0.2s var(--ease);
}

.footer-policy-links a:hover {
  color: var(--text);
}
