/* ==========================================================================
   layout.css — header, navigation, mobile drawer, footer
   ========================================================================== */

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: 200;
  padding: .8rem 1.5rem;
  background: var(--nisarga);
  color: var(--cream);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: top .3s var(--ease);
}
.skip-link:focus { top: 0; }

/* ---------- Header ----------
   Two tiers, the way a marketplace does it: utility row (logo, search,
   account, bag) above a category strip. Solid at all times so it never
   competes with the page behind it. */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: var(--cream);
  box-shadow: 0 1px 0 var(--sand-deep);
}

.header__inner {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "logo actions"
    "search search";
  align-items: center;
  gap: .7rem 1rem;
  padding-block: .7rem;
}

/* ---------- Logo ---------- */
.logo { grid-area: logo; display: inline-flex; align-items: center; gap: .7rem; }
.logo__mark { width: 40px; height: 40px; flex: none; transition: transform .5s var(--ease-out); }
.logo:hover .logo__mark { transform: rotate(-8deg); }
.logo__text { display: flex; flex-direction: column; line-height: 1; }
.logo__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--nisarga);
}
.logo__rule { height: 1px; background: var(--sage); margin: .3rem 0 .28rem; opacity: .6; }
.logo__sub {
  font-size: .55rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--sage);
}

/* ---------- Search ---------- */
.search {
  grid-area: search;
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-radius: var(--radius-pill);
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--sand-deep);
  overflow: hidden;
  transition: box-shadow .25s var(--ease);
}
.search:focus-within { box-shadow: inset 0 0 0 1.8px var(--kavi); }

.search__cat {
  flex: none;
  width: 5.6rem;
  padding: 0 1.6rem 0 .95rem;
  border: 0;
  background: var(--sand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%236B6355' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right .7rem center;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
  appearance: none;
  cursor: pointer;
}
.search__cat:focus { outline: none; }

.search__input {
  flex: 1;
  min-width: 0;
  padding: .72rem 1rem;
  border: 0;
  background: none;
  color: var(--ink);
}
.search__input:focus { outline: none; }
.search__input::placeholder { color: #A79E8E; }
.search__input::-webkit-search-cancel-button { display: none; }

.search__btn {
  flex: none;
  width: 3.1rem;
  display: grid;
  place-items: center;
  background: var(--kavi);
  color: var(--white);
  transition: background-color .3s var(--ease);
}
.search__btn:hover { background: var(--kavi-deep); }

/* ---------- Utility actions ---------- */
.actions { grid-area: actions; display: flex; align-items: center; gap: .2rem; }

.util {
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: .35rem .7rem;
  border-radius: var(--radius);
  line-height: 1.25;
  transition: background-color .25s var(--ease);
}
.util:hover { background: var(--sand); }
.util small { font-size: .62rem; color: var(--muted); }
.util b { font-size: var(--fs-sm); font-weight: 600; color: var(--nisarga); white-space: nowrap; }

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--nisarga);
  transition: background-color .3s var(--ease), color .3s var(--ease), transform .3s var(--ease);
}
.icon-btn:hover { background: var(--sand); color: var(--kavi); transform: translateY(-1px); }

.cart-badge {
  position: absolute;
  top: 4px; right: 3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--kavi);
  color: var(--white);
  font-size: .66rem;
  font-weight: 700;
  line-height: 1;
  transform: scale(0);
  transition: transform .4s var(--ease-out);
}
.cart-badge.is-visible { transform: scale(1); }
.cart-badge.is-bump { animation: badge-bump .5s var(--ease-out); }

.nav-toggle { display: grid; }

/* Hamburger that morphs into a cross */
.nav-toggle__bars { position: relative; width: 20px; height: 14px; }
.nav-toggle__bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.75px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .4s var(--ease-out), opacity .25s var(--ease);
}
.nav-toggle__bars span:nth-child(1) { top: 0; }
.nav-toggle__bars span:nth-child(2) { top: 6.1px; }
.nav-toggle__bars span:nth-child(3) { top: 12.2px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { transform: translateY(6.1px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(3) { transform: translateY(-6.1px) rotate(-45deg); }

/* ---------- Category strip ---------- */
.catbar { background: var(--nisarga); }
.catbar__list {
  display: flex;
  gap: .1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.catbar__list::-webkit-scrollbar { display: none; }
.catbar a {
  display: block;
  padding: .68rem .95rem;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .02em;
  white-space: nowrap;
  color: rgba(250, 246, 238, .82);
  box-shadow: inset 0 -2px 0 transparent;
  transition: color .25s var(--ease), background-color .25s var(--ease), box-shadow .25s var(--ease);
}
.catbar a:hover { background: rgba(250, 246, 238, .09); color: var(--cream); }
.catbar a[aria-current="page"] {
  color: var(--kavi-soft);
  box-shadow: inset 0 -2px 0 var(--kavi-soft);
}

/* ---------- Mobile drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  align-content: center;
  padding: var(--header-h) var(--pad-x) 2rem;
  background: var(--cream);
  clip-path: circle(0% at calc(100% - 44px) 42px);
  transition: clip-path .65s var(--ease-out);
  pointer-events: none;
}
.drawer.is-open { clip-path: circle(150% at calc(100% - 44px) 42px); pointer-events: auto; }

.drawer__list { display: grid; gap: .35rem; }
.drawer__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .55rem 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.2rem + 3.6vw, 2.9rem);
  color: var(--nisarga);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .5s var(--ease), transform .5s var(--ease-out), color .3s var(--ease);
}
.drawer.is-open .drawer__link {
  opacity: 1;
  transform: none;
  transition-delay: calc(.16s + var(--i, 0) * .06s);
}
.drawer__link:hover { color: var(--kavi); }
.drawer__link span {
  font-family: var(--font-body);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--sage);
}
.drawer__foot {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--sand-deep);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.75rem;
  font-size: var(--fs-sm);
  color: var(--muted);
}

body.is-locked { overflow: hidden; }

/* ---------- Footer ---------- */
.footer {
  background: var(--nisarga);
  color: rgba(250, 246, 238, .74);
  padding-top: clamp(3.5rem, 2rem + 5vw, 6rem);
}
.footer h4 {
  color: var(--cream);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-bottom: 1.35rem;
}
.footer__grid {
  display: grid;
  gap: clamp(2.25rem, 1rem + 4vw, 3.5rem);
  grid-template-columns: 1fr;
  padding-bottom: clamp(2.5rem, 1.5rem + 3vw, 4rem);
}
.footer__brand { max-width: 30rem; }
.footer__brand .logo__name { color: var(--cream); }
.footer__brand .logo__sub  { color: var(--kavi-soft); }
.footer__brand .logo__rule { background: rgba(232, 147, 95, .5); }
.footer__blurb { margin-top: 1.4rem; font-size: var(--fs-sm); line-height: 1.75; }

.footer__links { display: grid; gap: .8rem; }
.footer__links a {
  font-size: var(--fs-sm);
  transition: color .3s var(--ease), transform .3s var(--ease);
  display: inline-block;
}
.footer__links a:hover { color: var(--kavi-soft); transform: translateX(4px); }

.socials { display: flex; gap: .6rem; margin-top: 1.75rem; }
.socials a {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--cream);
  box-shadow: inset 0 0 0 1px rgba(250, 246, 238, .22);
  transition: transform .35s var(--ease-out), background-color .3s var(--ease), color .3s var(--ease);
}
.socials a:hover { background: var(--kavi); color: var(--white); transform: translateY(-4px); box-shadow: none; }

.footer__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  border-top: 1px solid rgba(250, 246, 238, .14);
  font-size: var(--fs-xs);
  letter-spacing: .04em;
}
.pay-row { display: flex; align-items: center; gap: .5rem; }
.pay-row span {
  padding: .3rem .6rem;
  border-radius: 5px;
  background: rgba(250, 246, 238, .1);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--cream);
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 300;
  display: grid;
  gap: .6rem;
  justify-items: end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .7rem;
  max-width: min(92vw, 24rem);
  padding: .9rem 1.25rem;
  border-radius: var(--radius);
  background: var(--nisarga);
  color: var(--cream);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-lg);
  animation: toast-in .45s var(--ease-out) both;
}
.toast.is-leaving { animation: toast-out .3s var(--ease) forwards; }
.toast svg { flex: none; color: var(--kavi-soft); }

/* ---------- Breakpoints ---------- */
@media (min-width: 768px) {
  .footer__grid { grid-template-columns: repeat(2, 1fr); }
  .footer__brand { grid-column: 1 / -1; }
}

@media (min-width: 1024px) {
  .nav { display: block; }
  .nav-toggle { display: none; }
  .drawer { display: none; }
  .footer__grid { grid-template-columns: 1.7fr repeat(3, 1fr); }
  .footer__brand { grid-column: auto; }
}

/* ---------- Header breakpoints ---------- */
@media (min-width: 640px) {
  .search__cat { width: 6.6rem; }
}

@media (min-width: 900px) {
  :root { --header-h: 122px; }
  .header__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo search actions";
    gap: 1.5rem;
    height: 78px;
    padding-block: 0;
  }
  .search { max-width: 42rem; }
  .util { display: flex; }
  .nav-toggle { display: none; }
  .drawer { display: none; }
}

/* Account is an icon on small screens, a labelled link on large ones. */
.icon-btn--account { display: grid; }
@media (min-width: 900px) { .icon-btn--account { display: none; } }
