/* ============================================================
   pages.css — inner storefront pages (Products / Product / Contact)
   Brings the home-page tech aesthetic + Gen-Z motion to the rest of
   the store. Loaded on top of style.css only on these pages.
   ============================================================ */
/* Chakra Petch is loaded globally in base.html <head>. */

/* ---- Ambient crimson glow behind the page (decorative, fixed) ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42vw 42vw at 82% -6%, rgba(220, 38, 38, 0.16), transparent 70%),
    radial-gradient(38vw 38vw at -8% 108%, rgba(220, 38, 38, 0.10), transparent 70%);
}
.main { position: relative; z-index: 1; }

/* ============================================================
   Big tech page title (matches the hero headline language)
   ============================================================ */
.page-title {
  font-family: 'Chakra Petch', 'Outfit', sans-serif;
  font-size: clamp(2.2rem, 6vw, 3.6rem) !important;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0.4rem 0 1.6rem !important;
  background: linear-gradient(100deg, #ffffff 0%, #ffffff 42%, var(--accent) 62%, #ff6a6a 78%, #ffffff 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pageTitleSheen 7s linear infinite;
}
.page-title::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  margin-top: 0.7rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), transparent);
  animation: underlineGrow 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes pageTitleSheen { to { background-position: 220% center; } }
@keyframes underlineGrow { from { width: 0; opacity: 0; } to { width: 72px; opacity: 1; } }

/* ============================================================
   Catalog grid — tighter, more refined cards (were too large)
   ============================================================ */
.grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
  gap: 1.1rem !important;
}
.grid .card__media { aspect-ratio: 1 / 1; }
.grid .card__body { padding: 0.9rem 0.95rem 1rem; gap: 0.4rem; }
.grid .card__brand { font-size: 0.68rem; letter-spacing: 1px; }
.grid .card__name { font-size: 0.98rem; line-height: 1.25; }
.grid .card__specs {
  font-size: 0.78rem;
  /* Keep specs to two lines so cards stay uniform */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grid .card__price { font-size: 1.1rem; }
.grid .card .variant-select { font-size: 0.82rem; padding: 0.45rem 0.55rem; }
.grid .card .btn { padding: 0.55rem 0.9rem; font-size: 0.86rem; }
.grid .card .field__label { font-size: 0.72rem; }
.grid .chip { font-size: 0.68rem; padding: 0.12rem 0.5rem; }

/* ============================================================
   Flavour picker (product page)
   Tiles instead of a dropdown: every option and its stock state is visible at
   a glance, and each is a proper tap target. The <select> stays in the markup
   as the source of truth and the no-JS fallback — see product.html.
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.variant-select--replaced { display: none; }

/* A product can carry thirty-odd flavours, so these tiles are drawn quiet on
   purpose: at that count, full-strength borders and chunky padding read as a
   wall of boxes rather than a list of choices. Small, hairline-edged, and only
   the chosen one is allowed to be loud. */
.flavors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.4rem;
  margin: 0.45rem 0 1.1rem;
}
.flavor {
  display: flex; flex-direction: column; gap: 0.08rem;
  padding: 0.45rem 0.6rem; min-height: 46px;
  text-align: left; cursor: pointer;
  font-family: inherit; color: var(--text);
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  transition: border-color 0.18s ease, background 0.18s ease;
}
.flavor:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-2); }
.flavor:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flavor__name { font-weight: 600; font-size: 0.8rem; line-height: 1.25; }
.flavor__stock { font-size: 0.66rem; color: var(--muted-2); }
.flavor__price { font-size: 0.74rem; font-weight: 700; color: var(--accent); margin-top: 0.05rem; }

/* One signal for the chosen tile — a tinted fill and a single accent edge,
   rather than a border with an inset ring drawn on top of it. */
.flavor.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}
.flavor.is-selected .flavor__name { font-weight: 700; }
.flavor.is-selected .flavor__stock { color: rgba(255, 255, 255, 0.82); }

/* Sold-out tiles are already sorted to the end of the grid. Nothing here is
   buyable, so they recede rather than compete — the strikethrough and the
   "Sold out" label still say why. */
.flavor--out, .flavor:disabled {
  cursor: not-allowed;
  opacity: 0.35;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.04);
}
.flavor--out .flavor__name { text-decoration: line-through; font-weight: 500; }

@media (max-width: 480px) {
  .flavors { grid-template-columns: 1fr 1fr; gap: 0.35rem; }
  .flavor { padding: 0.4rem 0.55rem; min-height: 44px; }
  .flavor__name { font-size: 0.78rem; }
}

/* ---- Catalog search & filter ---- */
.shop-filters {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 2rem; padding: 0 1.1rem;
}
.shop-filters__summary { display: none; }   /* desktop shows it open, unlabelled */
.shop-filters__body {
  display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-end;
  padding: 1.1rem 0;
}
.shop-filters__body .field { margin: 0; }
.shop-filters__body .field:first-child { flex: 1 1 260px; }
.shop-filters__body .field:not(:first-child) { flex: 0 1 200px; min-width: 170px; }

/* Single-flavour products keep a real select for cart.js to read, but there is
   nothing to choose, so it is not shown. */
/* .variant-select--single now lives in style.css, which loads on every page. */
.card__onlyflavor {
  margin: 0 0 0.35rem; font-size: 0.76rem; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 0.8rem !important;
  }
  /* A tile carrying a two-line spec blurb and chips ran to 415px on a 370px
     screen — twenty-four of those is six thousand pixels of scrolling. Trim it
     to what a shopper scans for: picture, name, price, one button. */
  .grid .card__specs,
  .grid .card__meta { display: none; }
  .grid .card__body { padding: 0.6rem 0.65rem 0.7rem; gap: 0.25rem; }
  .grid .card__name { font-size: 0.9rem; }
  .grid .card__price { font-size: 1rem; }
  .grid .card .btn { padding: 0.5rem 0.7rem; font-size: 0.82rem; margin-top: 0.35rem; }

  /* Three stacked labelled fields pushed the first product most of a screen
     down. Fold them behind a tap instead. */
  .shop-filters { margin-bottom: 1.1rem; }
  .shop-filters__summary {
    display: flex; align-items: center; gap: .5rem;
    padding: .8rem 0; cursor: pointer; list-style: none;
    font-weight: 700; font-size: .9rem; color: var(--text);
  }
  .shop-filters__summary::-webkit-details-marker { display: none; }
  .shop-filters__summary i { color: var(--accent); }
  .shop-filters__summary::after {
    content: "\f078"; /* chevron-down */
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    font-size: .7rem; margin-left: auto; color: var(--muted-2);
    transition: transform .2s ease;
  }
  .shop-filters[open] .shop-filters__summary::after { transform: rotate(180deg); }
  .shop-filters[open] .shop-filters__summary { border-bottom: 1px solid var(--border); }
  .shop-filters__body {
    flex-direction: column; align-items: stretch; gap: .7rem; padding: .9rem 0;
  }
  .shop-filters__body .field,
  .shop-filters__body .field:first-child,
  .shop-filters__body .field:not(:first-child) { flex: 1 1 auto; min-width: 0; }
}

/* ============================================================
   Catalog cards — richer hover, crimson glow, image zoom + shine
   ============================================================ */
.grid .card {
  position: relative;
  border-radius: 16px;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease, box-shadow 0.4s ease;
  will-change: transform;
}
.grid .card:hover {
  transform: translateY(-8px);
  border-color: var(--border-2);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55), 0 0 34px rgba(220, 38, 38, 0.18);
}
.grid .card__media img { transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.grid .card:hover .card__media img { transform: scale(1.08); }

/* Diagonal light sweep across the media on hover */
.grid .card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.14) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
  pointer-events: none;
}
.grid .card:hover .card__media::after { transform: translateX(120%); }

/* Animated brand kicker underline */
.grid .card__brand { position: relative; display: inline-block; }
.grid .card:hover .card__brand { text-shadow: 0 0 14px rgba(220, 38, 38, 0.5); }

/* Chips: subtle pop on card hover */
.chip { transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease; }
.grid .card:hover .chip { border-color: var(--border-2); background: rgba(220, 38, 38, 0.08); }

/* Price gets the gradient-tech treatment */
.card__price { font-family: 'Chakra Petch', 'Outfit', sans-serif; }

/* ============================================================
   Search / filter bar
   ============================================================ */
.card-surface { transition: border-color 0.3s ease, box-shadow 0.3s ease; }
.card-surface:focus-within { border-color: var(--border-2); box-shadow: 0 0 26px rgba(220, 38, 38, 0.12); }

/* ============================================================
   Product detail (PDP)
   ============================================================ */
.pdp__media {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  animation: pdpFloat 7s ease-in-out infinite;
}
.pdp__media::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 18px;
  padding: 1px;
  background: linear-gradient(140deg, rgba(220, 38, 38, 0.5), transparent 45%, rgba(220, 38, 38, 0.28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.pdp__media img { transition: transform 0.6s ease; }
.pdp__media:hover img { transform: scale(1.04); }
@keyframes pdpFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.pdp__title {
  font-family: 'Chakra Petch', 'Outfit', sans-serif;
  font-size: clamp(1.9rem, 4.5vw, 2.8rem) !important;
  letter-spacing: 0.01em;
}
.pdp__info .card__price--lg {
  font-family: 'Chakra Petch', 'Outfit', sans-serif;
  background: linear-gradient(100deg, #ffffff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============================================================
   Contact page
   ============================================================ */
.contact-info-item { transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.contact-info-item:hover { transform: translateX(6px); }
.contact-info-icon {
  display: inline-grid;
  place-items: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.contact-info-item:hover .contact-info-icon { transform: scale(1.25) rotate(-8deg); }
/* Full-width Google Maps embed below the two contact cards */
.map-section { margin-top: 1.5rem; }
.map-frame {
  position: relative;
  width: 100%;
  height: 420px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow);
  transition: box-shadow 0.4s ease;
}
.map-frame::after {
  /* Crimson inner frame glow that lifts on hover */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.18), inset 0 0 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  transition: box-shadow 0.4s ease;
}
.map-frame:hover { box-shadow: var(--shadow), 0 0 34px rgba(220, 38, 38, 0.2); }
.map-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  /* Dark-mode the light Google tiles to fit the theme; true colour on hover */
  filter: invert(0.9) hue-rotate(180deg) brightness(0.95) contrast(0.9);
  transition: filter 0.5s ease;
}
.map-frame:hover iframe { filter: none; }

@media (max-width: 640px) {
  .map-frame { height: 320px; }
}

/* ============================================================
   Buttons — animated crimson glow sweep (Gen-Z touch)
   ============================================================ */
.btn--primary { position: relative; overflow: hidden; }
.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}
.btn--primary:hover::before { transform: translateX(120%); }
.btn--primary > * { position: relative; z-index: 1; }

/* ---- Page lead line under big titles ---- */
.page-lead {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 60ch;
  margin: -0.6rem 0 1.8rem;
  line-height: 1.65;
}

/* ---- Contact: other locations list ---- */
.locations-head {
  margin: 1.8rem 0 0.7rem;
  font-family: 'Chakra Petch', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.locations-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.locations-list li {
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.9rem;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}
.locations-list li:hover { transform: translateX(5px); border-color: rgba(220, 38, 38, 0.35); }
.locations-list strong { color: var(--text); }
.locations-list .pill { margin-left: 0.4rem; }

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .page-title,
  .pdp__media,
  .page-title::after { animation: none !important; }
  .grid .card,
  .grid .card__media img,
  .grid .card__media::after,
  .contact-info-item,
  .contact-info-icon,
  .btn--primary::before { transition: none !important; }
}

/* --- Centered auth (sign in / register) pages --- */
.auth-wrap { max-width: 460px; margin: 0 auto; }
.auth-wrap--wide { max-width: 920px; }
.auth-wrap--wide .checkout { margin-top: 0; }
.auth-wrap__sub { text-align: center; color: var(--text-soft, #9aa3b5); margin: -0.4rem 0 1.2rem; }
.auth-wrap .checkout__form { width: 100%; }

/* ============================================================
   Catalog: paged grid + lazy loading
   The grid holds one page at a time and grows as you scroll, so the page needs
   somewhere to say how much of the catalog is on screen and something for the
   observer to watch for.
   ============================================================ */
.catalog__count {
  margin: 0 0 1rem;
  font-size: .85rem;
  color: var(--text-soft, #9aa3b5);
}
.catalog__more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .7rem;
  margin: 2rem 0 1rem;
}
/* Just a target for the observer. How early loading starts is set by the
   observer's rootMargin in catalog.js, not by anything here. */
.catalog__sentinel {
  height: 1px;
  width: 100%;
  pointer-events: none;
}
.catalog__status {
  margin: 0;
  font-size: .85rem;
  color: var(--text-soft, #9aa3b5);
  min-height: 1.2em;
}
.catalog__more[data-loading] .btn { opacity: .55; pointer-events: none; }

/* The grid dims briefly while a filter is being applied, so a slow round trip
   reads as "working" rather than "nothing happened". */
#products-grid[data-busy] { opacity: .45; transition: opacity .18s ease; }

/* Apply exists for the no-JS path. With JS the filters submit themselves. */
.has-js .shop-filters__submit { display: none; }

@media (prefers-reduced-motion: reduce) {
  #products-grid[data-busy] { transition: none; }
}
