*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: #faf8f4 url("site_background_pattern_v2.png") repeat center top;
  background-size: 100vw auto;
  background-attachment: scroll;
  color: #3a3530;
  font-family: "calder-lc", sans-serif;
  font-weight: 300;
  letter-spacing: 0.06em;
}

/* Hide system cursor ONLY when custom cursor is active (Applied via JS based on input type) */
body.custom-cursor-active,
body.custom-cursor-active * {
  cursor: none !important;
}

/* Custom cursor base styling */
#swan-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  left: -200px;
  top: -200px;
  transform: translate(-2px, -2px);
}

#swan-cursor img {
  width: 45px;
  height: auto;
  display: block;
}


/* ── IFRAME CURSOR TRACKING FIX ── */
.iframe-cursor-wrapper {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  cursor: none !important; /* Hide default cursor on this container */
}

.iframe-cursor-wrapper .iframe-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Let clicks pass through to the iframe */
  z-index: 10;
}

.iframe-cursor-wrapper iframe {
  cursor: none !important; /* Attempt to hide cursor even on iframe if possible */
}


/* ── ANNOUNCEMENT BAR ── */
#announcementBar {
  background: #3a3530;
  color: #faf8f4;
  text-align: center;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  padding: 9px 1rem;
}

/* ── HEADER ── */
#header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 2rem 0;
}

.hamburger {
  display: none;
}

#logo img {
  width: 240px;
  height: auto;
  max-height: 140px;
  object-fit: contain;
  display: block;
  margin-bottom: 18px;
}

nav {
  position: relative;
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: center;
}

nav::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  /* Width of the strip */
  height: 100px;
  background: url('nav_banner.png') no-repeat center top;
  background-size: 100% auto;
  z-index: -1;
  pointer-events: none;
  opacity: 0.95;
}

body.home-page nav::before {
  display: none !important;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2.4rem;
  align-items: center;
  padding-bottom: 14px;
}

nav a {
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 0.25em;
  text-transform: lowercase;
  color: #3a3530;
  text-decoration: none;
  transition: color 0.2s;
}

nav a:hover {
  color: #b5906a;
}

nav li {
  position: relative;
}


.subnav {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #faf8f4;
  border: 1px solid #ddd8d0;
  min-width: 170px;
  z-index: 100;
  padding: 6px 0;
}

/* Base bridge to prevent hover gap issues */
.subnav::before {
  content: "";
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  height: 15px;
}

.subnav a {
  display: block;
  padding: 6px 16px;
  white-space: nowrap;
}

nav li:hover .subnav {
  display: block;
}

/* social icons */
#socialLinks {
  position: absolute;
  top: 24px;
  right: 2rem;
  display: flex;
  gap: 1.2rem;
  align-items: center;
}

#socialLinks svg {
  width: 20px;
  height: 20px;
  fill: #3a3530;
  transition: fill 0.2s;
  display: block;
}

#socialLinks a:hover svg {
  fill: #b5906a;
}

#socialLinks .cart-link {
  font-size: 1.1rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: #3a3530;
  text-decoration: none;
  transition: color 0.2s;
  margin-left: 0.5rem;
}

#socialLinks .cart-link:hover {
  color: #b5906a;
}

/* ── CATEGORY FILTER ── */
#categoryNav {
  display: flex;
  justify-content: center;
  gap: 1.8rem;
  padding: 14px 2rem;
  flex-wrap: wrap;
  list-style: none;
}

#categoryNav li {
  list-style: none;
}

#categoryNav a {
  font-size: 1.24rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
  color: #9e9185;
  text-decoration: none;
  transition: color 0.2s;
}

#categoryNav a:hover {
  color: #3a3530;
}

#categoryNav .active-link a {
  color: #3a3530;
  border-bottom: 1px solid #3a3530;
  padding-bottom: 2px;
}

/* ── PRODUCT GRID ── */
#productList {
  max-width: 1100px;
  margin: 3rem auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2.8rem 2rem;
}

.product {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.product-image {
  position: relative;
  overflow: hidden;
  background: #f0ece5;
  margin-bottom: 0.8rem;
  width: 100%;
}

.intrinsic {
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  /* clip the hover scale so it doesn't bleed */
  width: 100%;
}

.product-image img {
  /* absolute fill so height resolves correctly against the aspect-ratio parent */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.product:hover .product-image img {
  transform: scale(1.04);
}

.product-mark {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  padding: 3px 9px;
  color: #faf8f4;
}

.product-mark.sale {
  background: #b5906a;
}

.product-mark.sold-out {
  background: #9e9185;
}

.product-title {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  margin-bottom: 5px;
  line-height: 1.5;
}

.product-price {
  font-family: "calder-lc", sans-serif;
  font-size: 0.95rem;
  color: #9e9185;
}

.original-price {
  text-decoration: line-through;
  margin-left: 5px;
  font-size: 0.85rem;
}

/* ── FOOTER ── */
#footer {
  padding: 2rem;
  text-align: center;
  margin-top: 2rem;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: #9e9185;
}

#footer a {
  color: inherit;
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-block;
  background: #3a3530;
  color: #faf8f4;
  padding: 16px 40px;
  text-decoration: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: background 0.3s;
  border: none;
  cursor: pointer;
  text-align: center;
}

.btn-primary:hover {
  background: #b5906a;
}

/* ── RESPONSIVE ── */

/* Large tablet: 3 columns */
@media (max-width: 1024px) {
  #productList {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem 1.5rem;
  }
}

/* Small tablet / large phone: 2 columns */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
  }

  body {
    background: #faf8f4 url("mobile_background.jpg") repeat-y center top;
    background-size: 100% auto;
    background-attachment: scroll;
  }

  #categoryNav {
    display: none;
  }


  #announcementBar {
    font-size: 0.63rem;
    letter-spacing: 0.08em;
    padding: 8px 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Fallback if still too long on tiny screens */
  }

  #header {
    padding-top: 0 !important;
  }

   #socialLinks {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 0 0;
    margin-top: 10px;
    margin-bottom: 10px;
  }

  #socialLinks a:not(.cart-link) {
    display: none; /* Hide header social icons on mobile */
  }

  #socialLinks a, 
  #socialLinks .cart-link {
    height: 32px;
    width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hamburger {
    height: 38px;
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .hamburger {
    margin-right: 0.8rem;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    color: #333;
    z-index: 1000;
    transform: translateY(4px); /* Increased nudge for perfect optical alignment */
  }

  #socialLinks .cart-link {
    margin-left: auto;
    width: auto; /* Cart link needs to be wider for text */
    padding-left: 10px;
    padding-right: 0;
    transform: translateY(1px);
  }

  #productList {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 1rem;
    padding: 0 1.2rem;
  }

  #menuOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
  }

  #menuOverlay.open {
    display: block;
  }

  nav ul {
    flex-direction: column;
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px; /* Use fixed width for reliability */
    max-width: 85vw;
    height: 100vh;
    background: #faf8f4 url("mobile_background.jpg") repeat-y center top;
    background-size: 100% auto;
    box-shadow: 2px 0 15px rgba(0,0,0,0.15);
    padding: 6rem 2rem 0; /* Unified bottom padding to 0, controlled by socials */
    z-index: 1001;
    transform: translateX(-105%); /* Slightly more for shadow */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: none;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  nav ul.open {
    transform: translateX(0);
  }

  nav ul li {
    margin-bottom: 2rem;
    position: static; /* Force subnav to use nav ul as containing block on mobile */
  }

  /* Slide main menu list out when a submenu is active */
  nav ul.slide-out {
    transform: translateX(-105%) !important;
  }

  /* Completely hide original subnav to prevent duplicates/conflicts */
  nav li .subnav {
    display: none !important;
  }

  /* Independent Mobile Submenu Drawer */
  .mobile-subnav-drawer {
    display: flex;
    flex-direction: column;
    align-items: center; /* Match main drawer inherited centering */
    position: fixed;
    top: 0;
    left: 0; /* Align directly over the main menu's resting spot */
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background: #faf8f4 url("mobile_background.jpg") repeat-y center top;
    background-size: 100% auto;
    padding: 6rem 2rem 0; /* Unified bottom padding to 0, controlled by socials */
    z-index: 1002;
    transform: translateX(100vw); /* Safely offscreen to the right */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 15px rgba(0,0,0,0.15); /* Match main drawer shadow */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
  }

  .mobile-subnav-drawer.slide-in {
    transform: translateX(0); /* Slides perfectly into the exact same position as main menu */
  }

  .mobile-subnav-drawer.slide-out-left {
    transform: translateX(-105%) !important;
  }

  .mobile-subnav-drawer a {
    margin-bottom: 1.5rem;
    display: block;
    font-size: 1.1rem;
    color: #333;
    text-decoration: none;
    text-transform: lowercase;
  }

  /* Back and Next Arrows */
  .submenu-arrow {
    margin-left: auto;
    font-size: 1.2rem;
    color: #9e9185;
  }

  .back-link {
    display: flex;
    align-items: center;
    margin-bottom: 2.5rem;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 400;
    cursor: pointer;
    color: #b5906a;
  }

  /* Social links at bottom of drawer (Icons above line) */
  .drawer-socials {
    margin-top: auto;
    display: flex;
    gap: 1.2rem;
    padding-top: 0;
    padding-bottom: 1.2rem; /* Small padding between icons and line */
    border-bottom: 1px solid #ddd8d0;
    margin-bottom: 3.2rem;   /* Raised slightly higher from the absolute bottom */
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }

  .drawer-socials a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin-bottom: 0 !important;
    width: 32px;
    height: 32px;
    text-decoration: none;
  }

  .drawer-socials svg {
    width: 24px;
    height: 24px;
    fill: #3a3530;
  }

  /* Hide top icons when menu is open to reduce clutter if needed, 
     but let's keep them and just show them in drawer too as requested */
}

/* Mobile: 2 tight columns */
@media (max-width: 480px) {
  #productList {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 0.6rem;
    padding: 0 0.8rem;
    margin: 1.5rem auto;
  }

  .product-title {
    font-size: 0.65rem;
  }

  nav ul {
    gap: 0.9rem;
  }
}


/* ── DESKTOP RESTORATION (Min-width: 769px) ── */
@media (min-width: 769px) {
  /* Hide the redundant social icons and mobile drawers injected via JS */
  .drawer-socials,
  .mobile-subnav-drawer,
  .back-link,
  .submenu-arrow {
    display: none !important;
  }

  /* Ensure the subnav shows on hover and is correctly positioned */
  nav li:hover .subnav {
    display: block !important;
  }
}