/* ============================================================================
   "next" theme — a clean fashion-retail design system inspired by the layout
   language of large UK apparel storefronts: lots of white space, near-square
   corners, uppercase tracked labels, black primary actions, dense product
   grids, and a slide-in cart drawer. All first-party; no external assets.

   Design tokens live on :root so a merchant's accent_color (injected inline in
   the layout as --accent) flows through buttons/links without touching CSS.
   ========================================================================== */
:root {
  --fg: #111111;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --line-strong: #111111;
  --bg: #ffffff;
  --bg-alt: #f6f6f6;
  --bg-dark: #111111;
  --accent: #111111;          /* overridden inline by settings.accent_color */
  --danger: #b3261e;
  --radius: 3px;
  --header-h: 3.5rem;
  /* Full-bleed like large apparel storefronts — content runs edge to edge with
     responsive side gutters rather than a narrow centred column. */
  --gutter: clamp(1rem, 3.5vw, 2.75rem);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }

.container {
  max-width: 100%;
  margin: 0;
  padding: 0 var(--gutter);
}
/* Opt-in narrow column for long-form text (article/page bodies) that shouldn't
   run the full width. */
.container--narrow { max-width: 46rem; margin: 0 auto; }

main.container { padding-top: 0; padding-bottom: 3rem; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--bg-dark);
  background: var(--bg-dark);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
  text-align: center;
  line-height: 1;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn--block { width: 100%; }
.btn--accent { background: var(--accent); border-color: var(--accent); }
.btn--outline { background: #fff; color: var(--fg); border-color: var(--line-strong); }
.btn--outline:hover { background: var(--fg); color: #fff; opacity: 1; }
.btn--sm { padding: 0.6rem 1rem; font-size: 0.72rem; }

/* ---- Forms ---------------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="tel"], select, textarea {
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--fg);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--fg); outline-offset: -1px; }

/* ============================================================================
   Header
   ========================================================================== */
.site-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 40; }

.utility-bar {
  background: var(--bg-dark);
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.utility-bar .container { display: flex; align-items: center; justify-content: space-between; min-height: 2rem; gap: 1rem; }
.utility-bar a { color: #fff; opacity: 0.85; }
.utility-bar a:hover { opacity: 1; }
.utility-bar__group { display: flex; gap: 1.25rem; align-items: center; }

.header-main .container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.site-logo {
  grid-column: 2;
  font-weight: 800;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  justify-self: center;
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; }

.header-search { grid-column: 1; grid-row: 1; max-width: 24rem; width: 100%; }
.header-search form { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.header-search input { border: 0; }
.header-search input:focus { outline: none; }
.header-search button { border: 0; background: #fff; padding: 0 0.9rem; cursor: pointer; }

.header-actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 1.25rem; }
.header-action {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; background: none; border: 0; cursor: pointer; color: inherit; white-space: nowrap;
}
.header-action:hover { text-decoration: none; opacity: 0.7; }
.header-action .count { font-weight: 700; }
.header-action .count[data-cart-count]:empty::before { content: "0"; }

/* Hamburger — desktop-hidden, shown on mobile to toggle the nav. */
.nav-toggle { display: none; grid-column: 1; justify-self: start; background: none; border: 0; cursor: pointer; padding: 0.25rem; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 22px; height: 2px; background: var(--fg); transition: transform 0.2s var(--ease);
}
.nav-toggle span::before { transform: translateY(-6px); }
.nav-toggle span::after { transform: translateY(4px); }

/* Primary nav with mega dropdowns */
.site-nav { border-top: 1px solid var(--line); }
.site-nav__list { display: flex; gap: 0; list-style: none; margin: 0; padding: 0; justify-content: center; flex-wrap: wrap; }
.site-nav__item { position: relative; }
.site-nav__item > a {
  display: block; padding: 0.85rem 1.1rem;
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 600;
}
.site-nav__item > a:hover { text-decoration: none; color: var(--accent); }
.site-nav__item[aria-current] > a, .site-nav__item > a[aria-current] { border-bottom: 2px solid var(--fg); }
.site-nav__submenu {
  list-style: none; margin: 0; padding: 0.5rem 0;
  position: absolute; top: 100%; left: 0; min-width: 14rem;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(0,0,0,0.1);
  z-index: 30; display: none;
}
.site-nav__item.has-children:hover > .site-nav__submenu,
.site-nav__item.has-children:focus-within > .site-nav__submenu { display: block; }
.site-nav__submenu a { display: block; padding: 0.5rem 1.1rem; font-size: 0.85rem; white-space: nowrap; }
.site-nav__submenu a:hover { background: var(--bg-alt); text-decoration: none; }
.site-nav__item.has-children > a::after { content: " \25BE"; font-size: 0.7em; opacity: 0.6; }

.pill {
  display: inline-flex; align-items: center; padding: 0.25rem 0.7rem;
  background: var(--bg-alt); border-radius: 999px; font-size: 0.72rem;
}

/* ============================================================================
   Flash banner
   ========================================================================== */
.flash {
  margin: 1rem var(--gutter) 0; padding: 0.75rem 1.25rem;
  border-radius: var(--radius); font-size: 0.9rem;
}
.flash-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.flash-info { background: #f0f9ff; border: 1px solid #bae6fd; color: #0c4a6e; }

/* ============================================================================
   Hero
   ========================================================================== */
.hero { position: relative; background: var(--bg-alt); }
.hero__inner { padding: 5rem 0; text-align: center; }
.hero--image .hero__inner { padding: 8rem 0; }
.hero__title { font-size: clamp(2rem, 5vw, 3.25rem); margin-bottom: 1rem; }
.hero__sub { font-size: 1.1rem; color: var(--muted); max-width: 34rem; margin: 0 auto 1.75rem; }
.hero--image .hero__title, .hero--image .hero__sub { color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,0.35); }

/* ============================================================================
   Section shell
   ========================================================================== */
.section { padding: 3.5rem 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.section__title { font-size: 1.5rem; }
.section__link { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid currentColor; }

/* ============================================================================
   Product grid + card
   ========================================================================== */
.product-grid {
  display: grid;
  /* Auto-fit with a clamped min so phones land on 2 columns (~42vw), tablets 3,
     desktop 4–5 — no per-breakpoint column counts needed. */
  grid-template-columns: repeat(auto-fill, minmax(clamp(9rem, 42vw, 15rem), 1fr));
  gap: 1.75rem 1.25rem;
}
.product-grid--tight { grid-template-columns: repeat(auto-fill, minmax(clamp(8rem, 40vw, 12rem), 1fr)); }

.product-card { position: relative; display: flex; flex-direction: column; }
.product-card__media {
  position: relative; display: block; overflow: hidden;
  background: var(--bg-alt); border-radius: var(--radius); aspect-ratio: 3 / 4;
}
.product-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.product-card:hover .product-card__media img { transform: scale(1.04); }
.product-card__body { padding: 0.75rem 0.15rem 0; display: flex; flex-direction: column; gap: 0.25rem; }
.product-card__vendor { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.product-card__title { font-size: 0.9rem; font-weight: 500; line-height: 1.35; }
.product-card__variant { font-size: 0.8rem; color: var(--muted); }
.product-card__price { font-weight: 700; font-size: 0.95rem; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.product-card__price s { color: var(--muted); font-weight: 400; }
.badge-sale { background: var(--danger); color: #fff; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; padding: 0.1rem 0.4rem; border-radius: var(--radius); text-transform: uppercase; }
.product-card__stock { font-size: 0.75rem; color: var(--danger); }
.product-card__sold { font-size: 0.8rem; color: var(--muted); }

/* Wishlist heart */
.wishlist-toggle {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
  border: 0; background: rgba(255,255,255,0.9); border-radius: 999px;
  width: 2.1rem; height: 2.1rem; cursor: pointer; font-size: 1.05rem; line-height: 1;
  color: var(--danger); box-shadow: 0 1px 4px rgba(0,0,0,0.14);
  display: inline-flex; align-items: center; justify-content: center;
}
.wishlist-toggle:hover { transform: scale(1.08); }

/* Colour swatches */
.swatches { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.15rem; }
.swatch {
  width: 1.4rem; height: 1.4rem; border-radius: 999px; padding: 0; cursor: pointer;
  overflow: hidden; border: 1px solid var(--line); box-shadow: inset 0 0 0 2px #fff;
}
.swatch.is-active { border-color: var(--fg); box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--fg); }
.swatch[disabled] { opacity: 0.35; cursor: not-allowed; }

/* Quick add revealed on hover (desktop) */
.product-card__cta { margin-top: 0.6rem; }
@media (hover: hover) {
  .product-card__cta { opacity: 0; transform: translateY(4px); transition: opacity 0.15s var(--ease), transform 0.15s var(--ease); }
  .product-card:hover .product-card__cta, .product-card:focus-within .product-card__cta { opacity: 1; transform: none; }
}

/* ============================================================================
   Listing layout (shop / category with filter sidebar)
   ========================================================================== */
.listing { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 2.5rem; align-items: start; padding: 2rem 0; }
.listing__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-title { font-size: 1.75rem; margin-bottom: 0.25rem; }
@media (max-width: 48rem) { .listing { grid-template-columns: 1fr; } }

/* ============================================================================
   Cart page + drawer (shared .cart-line styling)
   ========================================================================== */
.cart-page { padding: 2.5rem 0; }
.cart-layout { display: grid; grid-template-columns: minmax(0,1fr) 22rem; gap: 3rem; align-items: start; }
@media (max-width: 52rem) { .cart-layout { grid-template-columns: 1fr; } }

.cart-lines { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.cart-line { display: grid; grid-template-columns: 4.5rem 1fr auto; gap: 1rem; align-items: start; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.cart-line__media { width: 4.5rem; height: 5.5rem; background: var(--bg-alt); border-radius: var(--radius); object-fit: cover; }
.cart-line__title { font-weight: 600; font-size: 0.95rem; }
.cart-line__meta { list-style: none; padding: 0; margin: 0.3rem 0 0; color: var(--muted); font-size: 0.8rem; }
.cart-line__unit { margin: 0.35rem 0 0.6rem; color: var(--muted); font-size: 0.85rem; }
.cart-line__price { font-weight: 700; white-space: nowrap; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.qty button { width: 2rem; height: 2rem; border: 0; background: #fff; cursor: pointer; font-size: 1rem; line-height: 1; }
.qty button:hover { background: var(--bg-alt); }
.qty input { width: 2.6rem; text-align: center; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0.35rem 0; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.link-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 0.8rem; text-decoration: underline; padding: 0; margin-top: 0.5rem; }
.link-remove:hover { color: var(--danger); }

.cart-summary { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.cart-summary__row { display: flex; justify-content: space-between; margin-bottom: 0.6rem; font-size: 0.9rem; }
.cart-summary__total { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.15rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }

/* Slide-in drawer */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); opacity: 0; visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s var(--ease); z-index: 60;
}
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(26rem, 92vw);
  background: #fff; z-index: 70; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s var(--ease);
  box-shadow: -12px 0 40px rgba(0,0,0,0.12);
}
[dir="rtl"] .drawer { right: auto; left: 0; transform: translateX(-100%); box-shadow: 12px 0 40px rgba(0,0,0,0.12); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-overlay { opacity: 1; visibility: visible; }
body.drawer-open { overflow: hidden; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line); }
.drawer__title { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; font-weight: 700; }
.drawer__close { border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.drawer__body { flex: 1; overflow-y: auto; padding: 0 1.5rem; }
.drawer__foot { padding: 1.25rem 1.5rem; border-top: 1px solid var(--line); }
.drawer__empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }
.drawer .cart-line { grid-template-columns: 3.5rem 1fr auto; }
.drawer .cart-line__media { width: 3.5rem; height: 4.5rem; }
.is-busy { opacity: 0.5; pointer-events: none; }

/* ============================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--bg-dark); color: #cfcfcf; margin-top: 4rem; }
.site-footer a { color: #cfcfcf; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 2rem; padding: 3.5rem 0 2.5rem; }
@media (max-width: 48rem) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-col h4 { color: #fff; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.85rem; }
.footer-brand__name { color: #fff; font-size: 1.35rem; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase; }
.footer-brand p { color: #9a9a9a; font-size: 0.85rem; margin-top: 0.75rem; max-width: 22rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding: 1.25rem 0; text-align: center; font-size: 0.78rem; color: #8a8a8a; }

/* ============================================================================
   Product detail page
   ========================================================================== */
.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3rem;
  align-items: start;
  padding: 2rem 0;
}
.product-media img { border-radius: var(--radius); width: 100%; }
.product-info h1 { font-size: clamp(1.5rem, 4vw, 2rem); }

/* ---- Utilities ------------------------------------------------------------ */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[dir="rtl"] body { text-align: right; }

/* ============================================================================
   Responsive — tablet & mobile
   ========================================================================== */
@media (max-width: 60rem) {
  .product-layout { grid-template-columns: 1fr; gap: 1.5rem; }
}

@media (max-width: 48rem) {
  /* Header collapses to: hamburger · logo · actions, with search on its own row
     and the nav hidden behind the hamburger. */
  .header-main .container {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "burger logo actions" "search search search";
    gap: 0.75rem 0.5rem;
  }
  .nav-toggle { display: block; grid-area: burger; }
  .site-logo { grid-area: logo; grid-column: auto; }
  .header-actions { grid-area: actions; grid-column: auto; gap: 0.9rem; }
  .header-search { grid-area: search; grid-column: auto; max-width: none; }

  /* Trim the action labels to icons to save room; keep icon + count. */
  .header-action__label { display: none; }
  .header-action { font-size: 1.05rem; gap: 0.2rem; }
  .header-action .count { font-size: 0.72rem; }

  .utility-bar { font-size: 0.68rem; }
  .utility-bar__group:first-child { display: none; }

  /* Mobile nav: hidden until toggled; then a vertical stacked panel. */
  .site-nav { display: none; }
  body.nav-open .site-nav { display: block; }
  .site-nav__list { flex-direction: column; align-items: stretch; }
  .site-nav__item > a { padding: 0.9rem 0.25rem; border-bottom: 1px solid var(--line); }
  .site-nav__submenu {
    position: static; display: block; border: 0; box-shadow: none; padding: 0 0 0.5rem 1rem; min-width: 0;
  }
  .site-nav__item.has-children > a::after { content: ""; }

  /* Sections tighten up. */
  .section { padding: 2.5rem 0; }
  .section__title { font-size: 1.25rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}

@media (max-width: 30rem) {
  .footer-grid { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}
