/* ==========================================================================
   Floating navbar
   At rest it is a rounded shell inset from the top and sides; once the page
   scrolls it snaps flush to the top and runs the full width.
   Loaded after style.css, so it deliberately overrides the header rules there.
   ========================================================================== */

:root {
  --nav-gold: #C9A961;
  --nav-gold-2: #D4A574;
  --nav-brown: #6B4423;
  --nav-ink: #2C1810;
  --nav-line: rgba(44, 24, 16, .09);
  --nav-ease: cubic-bezier(.4, 0, .2, 1);
  --nav-inset: 16px;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: transparent;
  box-shadow: none;
  padding: var(--nav-inset);
  transition: padding .35s var(--nav-ease), background .35s var(--nav-ease), box-shadow .35s var(--nav-ease);
}

header .nav-shell {
  max-width: 1320px;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1px solid var(--nav-line);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(44, 24, 16, .12);
  transition: max-width .4s var(--nav-ease), border-radius .35s var(--nav-ease),
              box-shadow .35s var(--nav-ease), background .35s var(--nav-ease),
              border-color .35s var(--nav-ease);
}

/* scrolled: flush to the top, edge to edge */
header.is-stuck {
  padding: 0;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 22px rgba(44, 24, 16, .1);
}

header.is-stuck .nav-shell {
  max-width: none;
  border-radius: 0;
  border-color: transparent;
  border-bottom-color: var(--nav-line);
  background: transparent;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Bar contents
   -------------------------------------------------------------------------- */
header .navbar {
  padding: 0;
}

header .nav-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 22px;
  transition: padding .35s var(--nav-ease);
}

header.is-stuck .nav-inner {
  padding: 9px 26px;
}

/* logo ---------------------------------------------------------------- */
header .navbar-brand {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
  gap: 0;
}

header .navbar-brand img {
  /* taller than the old mark: this logo carries a second line (INTERIOR) */
  height: 50px;
  width: auto;
  display: block;
  transition: height .35s var(--nav-ease);
}

header.is-stuck .navbar-brand img {
  height: 40px;
}

/* links --------------------------------------------------------------- */
header .navbar-nav {
  align-items: center;
  gap: 4px;
}

header .nav-link {
  position: relative;
  margin: 0;
  padding: 9px 16px !important;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--nav-ink) !important;
  white-space: nowrap;
  transition: color .25s var(--nav-ease), background .25s var(--nav-ease);
}

/* the underline from the old design would fight the pill */
header .nav-link::after {
  display: none;
}

header .nav-link:hover {
  color: var(--nav-brown) !important;
  background: rgba(201, 169, 97, .14);
}

header .nav-link.active {
  color: #FFFFFF !important;
  background: linear-gradient(135deg, var(--nav-gold), var(--nav-gold-2));
  box-shadow: 0 6px 16px rgba(201, 169, 97, .34);
}

header .nav-link.active:hover {
  color: #FFFFFF !important;
}

header .dropdown-toggle::after {
  margin-left: 7px;
  vertical-align: 1px;
  border-top-color: currentColor;
}

/* dropdowns ------------------------------------------------------------ */
header .dropdown-menu {
  border: 1px solid var(--nav-line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 16px 38px rgba(44, 24, 16, .16);
}

header .dropdown-item {
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--nav-ink);
}

header .dropdown-item:hover,
header .dropdown-item:focus {
  background: rgba(201, 169, 97, .16);
  color: var(--nav-brown);
}

/* actions -------------------------------------------------------------- */
header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
}

header .header-actions .icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--nav-line);
  border-radius: 50%;
  background: #FBF8F4;
  font-size: 17px;
  color: var(--nav-ink);
  transition: background .25s var(--nav-ease), color .25s var(--nav-ease),
              border-color .25s var(--nav-ease), transform .25s var(--nav-ease);
}

header .header-actions .icon-btn:hover {
  background: rgba(201, 169, 97, .18);
  border-color: rgba(201, 169, 97, .45);
  color: var(--nav-brown);
  transform: none;
}

/* search gets the accent treatment, like the reference */
header .header-actions .icon-btn.icon-btn--accent {
  border-color: transparent;
  background: linear-gradient(135deg, var(--nav-gold), var(--nav-gold-2));
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(201, 169, 97, .32);
}

header .header-actions .icon-btn.icon-btn--accent:hover {
  background: linear-gradient(135deg, var(--nav-brown), #8B5A3C);
  color: #FFFFFF;
}

header .header-actions .dropdown-toggle::after {
  display: none;
}

header .cart-badge {
  top: -3px;
  right: -3px;
  width: 19px;
  height: 19px;
  border: 2px solid #FFFFFF;
  font-size: 10px;
}

/* burger --------------------------------------------------------------- */
header .navbar-toggler {
  order: 3;
  width: 42px;
  height: 42px;
  display: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--nav-line);
  border-radius: 12px;
  background: #FBF8F4;
  box-shadow: none;
}

header .navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(201, 169, 97, .3);
}

header .navbar-toggler-icon {
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%232C1810' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.6' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* --------------------------------------------------------------------------
   Below the lg breakpoint the menu collapses into a panel
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  :root { --nav-inset: 12px; }

  header .navbar-toggler { display: grid; }

  header .nav-inner {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  header.is-stuck .nav-inner { padding: 8px 14px; }

  header .navbar-brand img { height: 42px; }
  header.is-stuck .navbar-brand img { height: 36px; }

  header .header-actions {
    order: 2;
    margin-left: auto;
    gap: 8px;
  }

  header .header-actions .icon-btn {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  /* the collapsing panel sits on its own row inside the shell */
  header .navbar-collapse {
    order: 4;
    flex: 0 0 100%;
    width: 100%;
  }

  header .navbar-collapse.show,
  header .navbar-collapse.collapsing {
    margin-top: 4px;
    border-top: 1px solid var(--nav-line);
    padding-top: 10px;
  }

  header .navbar-nav {
    align-items: stretch;
    gap: 2px;
    margin: 0 0 6px !important;
    max-height: min(62vh, 460px);
    overflow-y: auto;
  }

  header .nav-link {
    padding: 11px 14px !important;
    border-radius: 12px;
  }

  header .nav-link.active {
    box-shadow: none;
  }

  /* nested category menus open in place rather than flying out sideways */
  header .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin: 2px 0 6px;
    border: 0;
    border-left: 2px solid rgba(201, 169, 97, .35);
    border-radius: 0;
    padding: 2px 0 2px 12px;
    box-shadow: none;
    background: transparent;
  }

  header .dropdown-submenu > .dropdown-menu {
    margin-left: 0;
    margin-top: 2px;
  }

  /* on touch the hover-to-open trick does not work, so only .show opens */
  header .dropdown-menu > li:hover > .dropdown-menu {
    display: none;
  }

  header .dropdown-menu > li > .dropdown-menu.show {
    display: block;
  }

  header .cart-menu {
    width: 100% !important;
    max-width: 100%;
  }
}

@media (max-width: 575.98px) {
  :root { --nav-inset: 8px; }

  header .nav-shell { border-radius: 14px; }
  header .navbar-brand img { height: 36px; }
  header.is-stuck .navbar-brand img { height: 32px; }

  header .header-actions { gap: 6px; }

  header .header-actions .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  header .navbar-toggler { width: 38px; height: 38px; }
}

/* very narrow phones: drop the account icon so the row never wraps badly */
@media (max-width: 359.98px) {
  header .header-actions .account-action { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  header,
  header .nav-shell,
  header .nav-inner,
  header .navbar-brand img { transition: none; }
}
