/* Appily Twenty — header, footer, navigation (at-) */

.at-theme {
  --at-plum: #4A1A5C;
  --at-plum-dark: #3A1248;
  --at-rose: #C44569;
  --at-amber: #E8A54B;
  --at-sage: #6B8F71;
  --at-ink: #1E1926;
  --at-cream: #F7F3EF;
  --at-line: #E8E2DC;
  --at-white: #fff;
  --at-sans: 'DM Sans', system-ui, sans-serif;
  --at-serif: 'Playfair Display', Georgia, serif;
}

/* Ribbon bar */
.at-ribbon {
  background: #2A2230;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
}

.at-ribbon-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 36px;
}

.at-ribbon-left,
.at-ribbon-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.at-ribbon a {
  color: inherit;
  opacity: 0.92;
  transition: opacity 0.2s;
}

.at-ribbon a:hover { opacity: 1; color: var(--at-amber); }

/* Header */
.at-header {
  background: var(--at-white);
  border-bottom: 1px solid var(--at-line);
  position: sticky;
  top: 0;
  z-index: 200;
}

.at-header-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 18px 0;
}

.at-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.at-brand-leaf {
  font-size: 1.6rem;
  color: var(--at-amber);
  line-height: 1;
}

.at-brand-copy strong {
  font-family: var(--at-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--at-ink);
  letter-spacing: -0.02em;
}

.at-search {
  display: flex;
  align-items: stretch;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--at-line);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--at-cream);
}

.at-search input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 18px;
  min-width: 0;
}

.at-search button {
  border: 0;
  background: var(--at-amber);
  color: #fff;
  padding: 0 22px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.at-search button:hover { background: #d4923f; }

.at-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.at-header-phone {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.at-header-phone strong { font-weight: 600; color: var(--at-ink); }

.at-header-divider {
  width: 1px;
  height: 28px;
  background: var(--at-line);
}

.at-header-account {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
}

.at-header-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.at-icon-link {
  position: relative;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.at-icon-circle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--at-sage);
  color: #fff;
  font-size: 0.95rem;
}

.at-icon-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--at-amber);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.at-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--at-line);
  border-radius: 8px;
  background: var(--at-white);
  cursor: pointer;
  padding: 8px;
}

.at-menu-btn span {
  display: block;
  height: 2px;
  background: var(--at-ink);
  border-radius: 2px;
  transition: transform 0.2s;
}

/* Navbar */
.at-navbar {
  background: var(--at-cream);
  border-top: 1px solid var(--at-line);
  position: relative;
}

.at-navbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 52px;
}

.at-categories-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--at-plum);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background 0.2s;
}

.at-categories-btn:hover { background: var(--at-plum-dark); color: #fff; }

.at-categories-icon { font-size: 1rem; }

.at-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.at-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--at-ink);
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.at-nav-link:hover,
.at-nav-link.is-active {
  color: var(--at-plum);
  background: rgba(74, 26, 92, 0.06);
}

.at-navbar-promo {
  margin: 0 0 0 auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--at-ink-soft, #5A5366);
  white-space: nowrap;
}

/* Mega menu */
.at-mega-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--at-white);
  border: 1px solid var(--at-line);
  border-top: 0;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  padding: 24px 0;
}

.at-nav-dropdown { position: relative; }

/* Drawer shell — mobile only content */
.at-drawer { display: none; }

.at-nav-caret {
  font-size: 0.65rem;
  opacity: 0.55;
  margin-left: 2px;
}

.at-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 25, 38, 0.45);
  z-index: 180;
}

.at-cart-wrap { position: relative; }
.at-cart-wrap.is-open .vg-cart-dropdown { display: block; }

@media (max-width: 1100px) {
  .at-header-phone,
  .at-header-divider,
  .at-header-account { display: none; }
}

@media (max-width: 900px) {
  .at-header-main {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    padding: 12px 0;
  }

  .at-brand-copy strong { font-size: 1.25rem; }

  .at-search { display: none; }

  .at-menu-btn {
    display: flex;
  }

  .at-menu-btn.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .at-menu-btn.is-open span:nth-child(2) {
    opacity: 0;
  }

  .at-menu-btn.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .at-navbar-inner { position: relative; }

  .at-categories-btn { display: none; }

  .at-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: min(360px, 92vw);
    height: 100dvh;
    max-height: 100vh;
    background: linear-gradient(180deg, #faf8f5 0%, #fff 28%);
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
    transform: translateX(-105%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 190;
    overflow: hidden;
    box-shadow: 8px 0 40px rgba(45, 27, 46, 0.18);
  }

  .at-nav.is-open { transform: translateX(0); }

  .at-nav > .at-nav-link,
  .at-nav > .at-nav-dropdown { display: none !important; }

  .at-drawer {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .at-drawer-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 1.25rem 1.15rem 1rem;
    background: linear-gradient(135deg, #2d1b2e 0%, #4a3048 55%, #3d7568 100%);
    color: #fff;
  }

  .at-drawer-brand {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    min-width: 0;
  }

  .at-drawer-mark {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(126, 184, 164, 0.45);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .at-drawer-kicker {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(126, 184, 164, 0.95);
    margin-bottom: 0.15rem;
  }

  .at-drawer-brand strong {
    display: block;
    font-family: var(--at-serif);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
  }

  .at-drawer-user {
    display: block;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.2rem;
    line-height: 1.35;
  }

  .at-drawer-close {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    display: grid;
    place-items: center;
  }

  .at-drawer-quick {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0.85rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--at-line);
  }

  .at-drawer-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.25rem;
    border-radius: 10px;
    background: var(--at-cream);
    border: 1px solid var(--at-line);
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    color: var(--at-ink);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
  }

  .at-drawer-tile:hover {
    border-color: rgba(126, 184, 164, 0.55);
    background: #fff;
  }

  .at-drawer-tile-icon {
    font-size: 1.1rem;
    line-height: 1;
  }

  .at-drawer-tile em {
    display: inline-block;
    min-width: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--at-amber);
    color: #fff;
    font-style: normal;
    font-size: 0.6rem;
    margin-left: 2px;
  }

  .at-drawer-search {
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--at-line);
  }

  .at-drawer-search form {
    display: flex;
    border: 1px solid var(--at-line);
    border-radius: 999px;
    overflow: hidden;
    background: var(--at-cream);
  }

  .at-drawer-search input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 0.7rem 0.9rem;
    font-size: 16px;
    min-width: 0;
  }

  .at-drawer-search button {
    border: 0;
    background: var(--at-sage);
    color: #fff;
    padding: 0 1rem;
    font-size: 1rem;
    cursor: pointer;
  }

  .at-drawer-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 1rem 0.75rem;
    flex: 1;
  }

  .at-drawer-list > li + li {
    margin-top: 6px;
  }

  .at-drawer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--at-line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--at-ink);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  }

  .at-drawer-item:hover,
  .at-drawer-item.is-active {
    border-color: rgba(74, 26, 92, 0.25);
    background: rgba(74, 26, 92, 0.04);
  }

  .at-drawer-item.is-active {
    box-shadow: inset 3px 0 0 var(--at-plum);
  }

  .at-drawer-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--at-cream);
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
  }

  .at-drawer-item-label { flex: 1; }

  .at-drawer-item-arrow,
  .at-drawer-item-caret {
    color: var(--at-sage);
    font-size: 0.85rem;
    flex-shrink: 0;
  }

  .at-drawer-toggle[aria-expanded="true"] .at-drawer-item-caret {
    transform: rotate(180deg);
  }

  .at-drawer-sub {
    margin: 6px 0 0;
    padding: 0.5rem 0.65rem 0.65rem;
    border: 1px dashed rgba(126, 184, 164, 0.45);
    border-radius: 10px;
    background: rgba(126, 184, 164, 0.06);
    display: grid;
    gap: 0.25rem;
  }

  .at-drawer-sub[hidden] { display: none !important; }

  .at-drawer-sub a {
    display: block;
    padding: 0.45rem 0.55rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #5a5366;
    text-decoration: none;
  }

  .at-drawer-sub a:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--at-plum);
  }

  .at-drawer-sub-all {
    font-weight: 700 !important;
    color: var(--at-plum) !important;
    margin-bottom: 0.15rem;
  }

  .at-drawer-support {
    margin-top: auto;
    padding: 1rem;
    background: var(--at-cream);
    border-top: 1px solid var(--at-line);
  }

  .at-drawer-support-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--at-ink);
    text-decoration: none;
    margin-bottom: 0.45rem;
  }

  .at-drawer-support-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
  }

  .at-drawer-support-links a {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--at-line);
    background: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--at-ink);
    text-decoration: none;
  }

  /* Mega menu inside mobile drawer */
  .at-nav-dropdown .at-mega-menu,
  .at-mega-menu {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 0.5rem 0 0;
    background: transparent;
  }

  .at-mega-menu[hidden] { display: none !important; }

  .at-navbar-promo { display: none; }

  body.at-nav-open { overflow: hidden; }
}

@media (max-width: 480px) {
  .at-ribbon-left a:nth-child(n+3) { display: none; }
}
