/* ==========================================================================
   FERNWICK — shop.css
   Store chrome: announcement bar, utility header, cart drawer, category rail,
   product cards, filters, PDP, cart table, editorial bands, footer.
   ========================================================================== */

/* ==========================================================================
   Announcement + header
   ========================================================================== */

.announce {
  background: var(--forest);
  color: var(--glass);
  text-align: center;
  padding: var(--s-2) var(--gutter);
}
.announce p { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; }
.announce a { color: var(--ochre); font-weight: 500; }

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--glass) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}

.masthead__inner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  height: 70px;
}

/* Brand mark: a two-leaf sprig in SVG — not a square, not a monogram tile. */
.brand { display: flex; align-items: center; gap: var(--s-3); flex: none; }
.brand svg { width: 24px; height: 24px; color: var(--ochre); }
.brand__word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}

.shopnav { display: flex; align-items: center; gap: var(--s-5); }
.shopnav a {
  position: relative;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--forest-2);
  padding-block: 4px;
  transition: color var(--dur-fast) var(--ease);
}
.shopnav a:hover { color: var(--forest); }
.shopnav a[aria-current="page"] { color: var(--forest); font-weight: 600; }
.shopnav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--ochre);
  border-radius: var(--r-pill);
}

.masthead__tools { margin-left: auto; display: flex; align-items: center; gap: var(--s-1); }

.searchbox { position: relative; width: min(260px, 30vw); }
.searchbox svg {
  position: absolute;
  left: var(--s-3);
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--forest-3);
  pointer-events: none;
}
.searchbox .input { height: 40px; padding-left: 38px; background: var(--paper); }

/* Cart button count bubble */
.cartbtn__count {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--ochre);
  color: var(--on-ochre);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  display: grid;
  place-content: center;
  border: 2px solid var(--glass);
}

.burger { display: none; }

/* ==========================================================================
   Category rail — the shop opens on this, not on a marketing hero
   ========================================================================== */

.railwrap { position: relative; }

.rail {
  display: flex;
  gap: var(--s-3);
  overflow-x: auto;
  padding-block: var(--s-2) var(--s-4);
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.rail::-webkit-scrollbar { display: none; }

/* Fade + arrow affordance so a horizontally-scrolling rail doesn't look
   like a dead end. The fades hide themselves at either scroll extreme;
   the arrows are always clickable but dim out to match. */
.railwrap::before,
.railwrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: var(--s-4);
  width: 56px;
  pointer-events: none;
  z-index: 1;
  transition: opacity var(--dur) var(--ease);
}
.railwrap::before { left: 0; background: linear-gradient(to right, var(--glass), transparent); }
.railwrap::after  { right: 0; background: linear-gradient(to left, var(--glass), transparent); }
.railwrap[data-at-start="true"]::before { opacity: 0; }
.railwrap[data-at-end="true"]::after { opacity: 0; }

.railarrow {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% - var(--s-4) / 2));
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--paper);
  color: var(--forest);
  cursor: pointer;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.12));
  transition: opacity var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.railarrow:hover { border-color: var(--ochre); }
.railarrow--prev { left: 4px; }
.railarrow--next { right: 4px; }
.railwrap[data-at-start="true"] .railarrow--prev,
.railwrap[data-at-end="true"] .railarrow--next {
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 640px) {
  /* Touch devices swipe natively — the arrows just add clutter. */
  .railarrow { display: none; }
}

.railcard {
  flex: none;
  width: clamp(150px, 17vw, 200px);
  scroll-snap-align: start;
  display: grid;
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--paper);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.railcard:hover { border-color: var(--ochre); transform: translateY(-3px); }
.railcard img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--glass-2);
}
.railcard__meta { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.railcard__name { font-weight: 600; font-size: var(--text-sm); }
.railcard__n { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--forest-4); }

/* ==========================================================================
   Product card
   ========================================================================== */

.product { position: relative; display: grid; gap: var(--s-3); }

.product__media {
  position: relative;
  display: block;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--paper);
  aspect-ratio: 4 / 5;
}
.product__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.85s var(--ease);
}
.product:hover .product__media img { transform: scale(1.05); }

.product__flags {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  z-index: 2;
}

/* Quick-add slides up over the image on hover; always visible on touch. */
.product__quick {
  position: absolute;
  left: var(--s-3);
  right: var(--s-3);
  bottom: var(--s-3);
  z-index: 2;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.product:hover .product__quick,
.product:focus-within .product__quick { opacity: 1; transform: none; }

@media (hover: none) {
  .product__quick { opacity: 1; transform: none; }
}

.product__wish {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  z-index: 2;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  display: grid;
  place-content: center;
  color: var(--forest-2);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.product__wish svg { width: 16px; height: 16px; }
.product__wish:hover { color: var(--sale); }
.product__wish[aria-pressed="true"] { color: var(--sale); }
.product__wish[aria-pressed="true"] svg { fill: currentColor; }

.product__body { display: grid; gap: 3px; }
.product__name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); letter-spacing: -0.02em; }
.product__latin { font-size: var(--text-xs); color: var(--forest-4); font-style: italic; }
.product__foot { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-top: 2px; }

.price { display: flex; align-items: baseline; gap: var(--s-2); }
.price__now { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: var(--text-sm); }
.price__was { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--forest-4); text-decoration: line-through; }
.price--sale .price__now { color: var(--sale); }

/* Care meta strip on the card (light / water) */
.caremeta { display: flex; align-items: center; gap: var(--s-3); }
.caremeta span { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--forest-3); }
.caremeta svg { width: 13px; height: 13px; flex: none; }

/* ==========================================================================
   Shop page — filter sidebar + toolbar
   ========================================================================== */

.shoplayout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: var(--s-6);
  align-items: start;
}

.filters { display: grid; gap: var(--s-5); position: sticky; top: 90px; }
.filters__group { display: grid; gap: var(--s-3); padding-bottom: var(--s-5); border-bottom: 1px solid var(--hairline); }
.filters__group:last-child { border-bottom: 0; }
.filters__title { font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm); }
.filters__row { display: flex; align-items: center; gap: var(--s-3); font-size: var(--text-sm); color: var(--forest-2); cursor: pointer; }
.filters__row .count { margin-left: auto; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--forest-4); }

.shoptoolbar {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--s-5);
}
.shoptoolbar__count { font-size: var(--text-sm); color: var(--forest-3); }

.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 32px;
  padding: 0 var(--s-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--paper);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--forest-2);
  transition: all var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--forest-4); }
.chip[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: var(--paper); }

.empty {
  display: grid;
  gap: var(--s-3);
  justify-items: center;
  text-align: center;
  padding: var(--s-8) var(--s-5);
}
.empty svg { width: 34px; height: 34px; color: var(--forest-4); }
.empty p { color: var(--forest-3); font-size: var(--text-sm); max-width: 36ch; }

/* ==========================================================================
   Product detail
   ========================================================================== */

.pdp { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s-7); align-items: start; }

.gallery { display: grid; gap: var(--s-3); }
.gallery__main {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--paper);
  aspect-ratio: 1;
}
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); }
.gallery__thumb {
  border-radius: var(--r-md);
  overflow: hidden;
  aspect-ratio: 1;
  border: 2px solid transparent;
  background: var(--paper);
  transition: border-color var(--dur-fast) var(--ease);
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb[aria-current="true"] { border-color: var(--ochre); }

.pdp__info { display: grid; gap: var(--s-4); position: sticky; top: 90px; }
.pdp__price { display: flex; align-items: baseline; gap: var(--s-3); }
.pdp__price .price__now { font-size: var(--text-xl); }

/* Variant swatches (pot size) */
.variants { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.variant {
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--paper);
  font-size: var(--text-sm);
  text-align: left;
  transition: all var(--dur-fast) var(--ease);
}
.variant small { display: block; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--forest-4); }
.variant:hover { border-color: var(--forest-4); }
.variant[aria-pressed="true"] { border-color: var(--forest); background: var(--forest); color: var(--paper); }
.variant[aria-pressed="true"] small { color: color-mix(in srgb, var(--paper) 70%, transparent); }

/* Care spec table */
.specs { border-top: 1px solid var(--hairline); }
.specs__row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: var(--text-sm);
}
.specs__row dt { color: var(--forest-3); }
.specs__row dd { color: var(--forest); }

/* Accordion */
.acc { border-top: 1px solid var(--hairline); }
.acc__item { border-bottom: 1px solid var(--hairline); }
.acc__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  width: 100%;
  padding: var(--s-4) 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  text-align: left;
}
.acc__btn svg { width: 16px; height: 16px; flex: none; transition: transform var(--dur) var(--ease); color: var(--forest-3); }
.acc__btn[aria-expanded="true"] svg { transform: rotate(45deg); }
.acc__panel { padding-bottom: var(--s-4); color: var(--forest-2); font-size: var(--text-sm); line-height: 1.7; }

/* ==========================================================================
   Cart drawer
   ========================================================================== */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 37, 26, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
  z-index: var(--z-drawer);
}
.scrim[data-open="true"] { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--glass);
  border-left: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
  z-index: calc(var(--z-drawer) + 1);
  display: flex;
  flex-direction: column;
}
.drawer[data-open="true"] { transform: none; }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--hairline);
  flex: none;
}
.drawer__body { flex: 1; overflow-y: auto; padding: var(--s-5); display: grid; gap: var(--s-4); align-content: start; }
.drawer__foot { flex: none; padding: var(--s-5); border-top: 1px solid var(--hairline); display: grid; gap: var(--s-3); }

.lineitem { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: var(--s-3); align-items: start; }
.lineitem img { width: 68px; height: 82px; object-fit: cover; border-radius: var(--r-md); background: var(--paper); }
.lineitem__name { font-weight: 600; font-size: var(--text-sm); }
.lineitem__meta { font-size: var(--text-xs); color: var(--forest-3); margin-top: 2px; }
.lineitem__price { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-sm); font-weight: 600; }

.totalrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--text-sm);
}
.totalrow--grand { font-size: var(--text-md); font-weight: 700; padding-top: var(--s-3); border-top: 1px solid var(--hairline); }
.totalrow .num { font-weight: 600; }

/* ==========================================================================
   Editorial bands
   ========================================================================== */

.band {
  background: var(--forest);
  color: var(--glass);
  border-radius: var(--r-lg);
  padding: clamp(var(--s-5), 3vw, var(--s-7));
}
.band h2, .band h3 { color: var(--glass); }
.band .label { color: var(--ochre); }
.band p { color: color-mix(in srgb, var(--glass) 78%, transparent); }

.guide { display: grid; gap: var(--s-3); }
.guide img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--r-lg); background: var(--glass-2); transition: transform 0.8s var(--ease); }
.guide:hover img { transform: scale(1.03); }
.guide__meta { display: flex; gap: var(--s-3); align-items: center; }

.trust { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-5); }
.trust__item { display: grid; gap: var(--s-2); }
.trust__item svg { width: 22px; height: 22px; color: var(--ochre); }
.trust__item h3 { font-size: var(--text-sm); }
.trust__item p { font-size: var(--text-xs); color: var(--forest-3); }

@media (max-width: 860px) { .trust { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   Footer
   ========================================================================== */

.foot { border-top: 1px solid var(--hairline); margin-top: var(--s-8); padding-block: var(--s-7) var(--s-5); }
.foot__grid { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
.foot h3 { font-size: var(--text-sm); margin-bottom: var(--s-3); }
.foot ul { display: grid; gap: var(--s-2); }
.foot a { font-size: var(--text-sm); color: var(--forest-2); }
.foot a:hover { color: var(--ochre); }
.foot__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--hairline);
}

.newsletter { display: flex; gap: var(--s-2); max-width: 380px; }
.newsletter .input { flex: 1; }

/* ==========================================================================
   Toast
   ========================================================================== */

.toasts {
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--s-2);
  justify-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  background: var(--forest);
  color: var(--glass);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  pointer-events: auto;
  animation: toast-in var(--dur) var(--ease);
}
.toast svg { width: 16px; height: 16px; color: var(--ochre); flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Reveal
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--delay, 0ms);
}
[data-reveal][data-shown="true"] { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; } }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1000px) {
  .shoplayout { grid-template-columns: minmax(0, 1fr); }
  .filters {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    padding-bottom: var(--s-5);
    border-bottom: 1px solid var(--hairline);
  }
  .pdp { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
  .pdp__info { position: static; }
}

@media (max-width: 860px) {
  .foot__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
  .masthead__inner { height: 62px; gap: var(--s-3); }
  .shopnav {
    position: fixed;
    inset: 62px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--glass);
    border-bottom: 1px solid var(--hairline);
    padding: var(--s-3) var(--gutter) var(--s-5);
    transform: translateY(-120%);
    transition: transform var(--dur) var(--ease);
    z-index: 40;
    box-shadow: var(--shadow-md);
  }
  .shopnav[data-open="true"] { transform: none; }
  .shopnav a { padding: var(--s-3) 0; border-bottom: 1px solid var(--hairline-soft); font-size: var(--text-md); }
  .shopnav a[aria-current="page"]::after { display: none; }
  .burger { display: inline-grid; }
  .searchbox { display: none; }
}

@media (max-width: 560px) {
  .foot__grid { grid-template-columns: minmax(0, 1fr); }
  .lineitem { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .gallery__thumbs { grid-template-columns: repeat(4, 1fr); }
}
