@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&display=swap');

:root {
  --paper: #ffffff;
  --white: #ffffff;
  --ink: #1a1b18;
  --muted: #5c5e57;
  --line: #e4e2dc;
  --soft: #f3f2ee;
  --vermilion: #c2452f;
  --forest: #245c4a;
  --mustard: #d7a629;
  --rail-width: 300px;
  --gutter: clamp(16px, 3vw, 40px);
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; overflow-x: hidden; }
body.drawer-open { overflow: hidden; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--vermilion);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-height: 64px;
  padding: 0 var(--gutter);
}

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

/* Logo: MALABIS with a small, letter-spaced STUDIO centred beneath it
   (negative right margins cancel the trailing letter-spacing). */
.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
}
.wordmark-name { letter-spacing: .18em; margin-right: -.18em; }
.wordmark-studio {
  margin-top: .34em;
  margin-right: -.86em;
  font-size: .36em;
  font-weight: 500;
  letter-spacing: .86em;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
}

/* The brand menu button is the ☰ icon alone on every screen size (its
   aria-label says "Browse brands"). */
.rail-open { justify-content: center; width: 38px; height: 38px; padding: 0; }
.rail-open:hover { border-color: var(--ink); }
.rail-open-label { display: none; }


.hamburger-icon { display: inline-flex; flex-direction: column; gap: 3px; width: 14px; }
.hamburger-icon span { display: block; height: 2px; background: currentColor; }

.search-box {
  flex: 0 1 220px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
}
.search-box svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search-box:focus-within { border-color: var(--ink); }

.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.location { color: var(--forest); font-size: 12px; font-weight: 600; white-space: nowrap; }
.account-button {
  padding: 8px 16px;
  border: 1px solid var(--forest);
  border-radius: 999px;
  background: transparent;
  color: var(--forest);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.account-button:hover { background: var(--forest); color: var(--white); }

.audience-tabs {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 4vw, 44px);
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.audience-tabs::-webkit-scrollbar { display: none; }
.audience-tabs a {
  flex: none;
  padding: 10px 2px 12px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.audience-tabs a:hover { color: var(--ink); }
.audience-tabs a.is-current { color: var(--ink); border-bottom-color: var(--vermilion); }

/* ---------- Shell: brand rail + main ---------- */
/* The brand menu is a drawer on every screen size, opened by the Brands button. */
.shell { display: block; }

.brand-rail {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 60;
  width: min(var(--rail-width), 86vw);
  overflow-y: auto;
  padding: 20px 16px 32px;
  background: var(--paper);
  box-shadow: 8px 0 32px rgba(0, 0, 0, .18);
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
}
.brand-rail.is-open { transform: translateX(0); visibility: visible; transition: transform .25s ease; }

.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rail-close {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
  font-size: 20px;
}
.brand-list { display: grid; gap: 2px; }

.rail-link, .rail-section {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  border-radius: 6px;
}
.rail-link { padding: 9px 10px; font-family: var(--font-display); font-size: 17px; }
.rail-link:hover { background: var(--soft); }
.rail-link.is-current { background: var(--ink); color: var(--white); }
.rail-link.is-current .rail-count { color: rgba(255, 255, 255, .7); }
.rail-count { color: var(--muted); font-family: var(--font-body); font-size: 12px; font-variant-numeric: tabular-nums; }

.rail-sections { list-style: none; margin: 4px 0 10px; padding: 0 0 0 12px; border-left: 2px solid var(--vermilion); margin-left: 10px; }
.rail-section { padding: 6px 10px; font-size: 14px; color: var(--muted); }
.rail-section:hover { color: var(--ink); background: var(--soft); }
.rail-section.is-current { color: var(--ink); font-weight: 600; background: var(--soft); }
.rail-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(26, 27, 24, .5); }

.main { min-width: 0; padding: 28px var(--gutter) 80px; }

/* ---------- Home ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; margin-bottom: 56px; }

/* ---------- Home: blocks ---------- */
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.block-head h2 { margin: 0; font: 500 clamp(24px, 2.4vw, 32px)/1.1 var(--font-display); letter-spacing: -.01em; }
.block-link { flex: none; padding: 0; border: 0; background: transparent; cursor: pointer; color: var(--forest); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; }
.block-link:hover { color: var(--ink); }
.brand-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.brand-card {
  position: relative;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--ink);
  cursor: pointer;
  color: var(--white);
  text-align: left;
}
.brand-card img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; opacity: .78; transition: opacity .3s ease, transform .6s ease; }
.brand-card:hover img { opacity: .9; transform: scale(1.04); }
.brand-card-name { position: absolute; left: 14px; right: 14px; bottom: 34px; font: 500 24px/1 var(--font-display); text-shadow: 0 1px 12px rgba(0, 0, 0, .4); }
.brand-card-count { position: absolute; left: 14px; bottom: 14px; font-size: 12px; font-weight: 600; opacity: .9; }
.brand-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.brand-row + .brand-row { padding-top: 40px; border-top: 1px solid var(--line); }
.block-note { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Listing ---------- */
.listing-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 16px; }
.listing-head h1 { margin: 0; font: 500 clamp(28px, 3vw, 40px)/1.1 var(--font-display); letter-spacing: -.01em; }

.active-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.active-chip, .clear-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.active-chip { border: 0; background: var(--ink); color: var(--white); }
.active-chip span { opacity: .7; }
.clear-all { border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.section-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.section-chips::-webkit-scrollbar { display: none; }
.section-chip {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.section-chip span { color: var(--muted); font-size: 12px; margin-left: 2px; }
.section-chip:hover { border-color: var(--ink); }
.section-chip.is-current { background: var(--forest); border-color: var(--forest); color: var(--white); }
.section-chip.is-current span { color: rgba(255, 255, 255, .75); }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  margin-bottom: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.result-count { margin: 0; color: var(--muted); font-size: 13px; }
.toolbar-controls { display: flex; gap: 8px; }
.toolbar select {
  padding: 8px 30px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23686c66' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 20px; }
.product-card { min-width: 0; cursor: pointer; }
.product-card figure {
  position: relative;
  margin: 0;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--soft);
}
.product-card figure img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; transition: opacity .35s ease, transform .5s ease; }
.product-card .alt-image { opacity: 0; }
@media (hover: hover) {
  .product-card:hover figure.has-alt img:first-child { opacity: 0; }
  .product-card:hover .alt-image { opacity: 1; }
  .product-card:hover figure:not(.has-alt) img { transform: scale(1.03); }
}
.image-fallback { position: absolute; inset: 0; display: grid; place-items: center; font: 500 40px var(--font-display); color: var(--muted); }
.badge {
  position: absolute;
  top: 10px; left: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.badge-sale { background: var(--vermilion); color: var(--white); }
.product-info { padding: 10px 2px 0; }
.product-brand { margin: 0 0 2px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.product-card h3 { margin: 0 0 4px; font: 500 16px/1.3 var(--font-display); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-price { display: flex; gap: 8px; align-items: baseline; margin: 0; font-size: 14px; font-weight: 600; }
.product-price del { color: var(--muted); font-size: 12px; font-weight: 400; }

.more-wrap { display: flex; justify-content: center; margin-top: 36px; }
.more-button { padding: 12px 26px; border: 1px solid var(--ink); border-radius: 999px; background: transparent; cursor: pointer; font-weight: 600; }
.more-button:hover { background: var(--ink); color: var(--white); }

.empty {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.empty strong { font: 500 24px var(--font-display); }
.empty span { color: var(--muted); }
.notice { padding: 40px; text-align: center; color: var(--muted); }
.notice.error { color: var(--vermilion); }

body > footer {
  padding: 32px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--ink);
  color: rgba(255, 255, 255, .6);
  font-size: 12px;
}
body > footer p { margin: 0; }
.footer-mark { color: var(--white); font-size: 18px; }

/* ---------- Product detail (unchanged) ---------- */
/* Product Piece Modal & Slideshow */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 25, 22, 0.75);
  backdrop-filter: blur(4px);
}

.drawer-panel {
  position: relative;
  width: min(1080px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--white);
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.22);
}

.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: all 150ms ease;
}

.drawer-close:hover {
  background: var(--paper);
  border-color: var(--ink);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(320px, 1fr);
  min-height: 600px;
  background: var(--white);
}

.detail-gallery-container {
  display: flex;
  flex-direction: column;
  background: #f0f2eb;
  border-right: 1px solid var(--line);
  position: relative;
}

.detail-slider {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #f0f2eb;
  touch-action: pan-y;
  user-select: none;
}

.detail-slides-track {
  width: 100%;
  height: 100%;
  position: relative;
}

.detail-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
  transform: scale(.98);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f2eb;
}

.detail-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  z-index: 1;
}

.detail-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  transition: all 180ms ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.slider-arrow:hover {
  background: var(--white);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.slider-prev { left: 16px; }
.slider-next { right: 16px; }

.slider-counter {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 5;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.68);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

.detail-thumbnails {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}

.detail-thumb {
  flex: 0 0 68px;
  aspect-ratio: 3/4;
  padding: 0;
  border: 2px solid transparent;
  background: #f0f2eb;
  cursor: pointer;
  overflow: hidden;
  border-radius: 2px;
  transition: border-color 150ms ease, opacity 150ms ease;
  opacity: .65;
}

.detail-thumb:hover { opacity: .9; }
.detail-thumb.is-active { border-color: var(--forest); opacity: 1; }
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Product Details & Formatted Description */
.detail-copy {
  padding: 48px 38px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.detail-copy h2 {
  margin: 0 0 12px;
  font: 500 30px/1.2 var(--font-display);
  letter-spacing: -.01em;
}

.detail-price {
  margin: 0 0 24px;
  font-size: 22px;
  font-weight: 600;
  color: var(--forest);
}

.detail-delivery { margin: -16px 0 24px; color: var(--muted); font-size: 13px; }

.product-description-formatted {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 14px;
  line-height: 1.65;
  color: #383b35;
}

.desc-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--soft);
}

.desc-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.desc-heading {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink);
}

.desc-paragraph { margin: 0; }

.desc-bullet-list {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.desc-bullet-list li { margin: 0; }

.desc-keyval {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  font-size: 13px;
}

.desc-key { font-weight: 600; color: var(--ink); }
.desc-val { color: var(--muted); text-align: right; }

.variant-list { margin: 0 0 28px; border-top: 1px solid var(--line); }
.variant-heading { margin: 16px 0 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.variant-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.variant-row span:nth-child(2) { color: var(--muted); }

.detail-actions { display: grid; gap: 10px; margin-top: auto; }
.shop-link { display: block; padding: 14px 18px; text-align: center; text-decoration: none; background: var(--vermilion); color: var(--white); font-weight: 600; font-size: 14px; border: 0; cursor: pointer; border-radius: 2px; transition: background 150ms ease; }
.shop-link:hover { background: #b33a26; }
.size-link { display: block; padding: 12px 18px; text-align: center; color: var(--forest); border: 1px solid var(--forest); font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 2px; transition: background 150ms ease; }
.size-link:hover { background: #eef3ef; }
.detail-note { color: var(--muted); text-align: center; font-size: 11px; margin: 10px 0 0; }

/* ---------- Auth ---------- */
.auth-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(23, 25, 22, 0.72); backdrop-filter: blur(3px); }
.auth-panel { position: relative; width: min(440px, 100%); padding: 42px 34px 32px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15); }
.auth-panel h2 { margin: 0 0 12px; font: 500 34px/1.1 var(--font-display); }
.auth-message { min-height: 24px; color: var(--muted); font-size: 13px; }
.auth-form { display: grid; gap: 14px; margin: 24px 0 12px; }
.auth-form label { display: grid; gap: 5px; }
.auth-form label span { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.auth-form input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 2px; }
.google-button { width: 100%; padding: 12px; border: 1px solid var(--ink); background: var(--white); color: var(--ink); cursor: pointer; font-weight: 600; border-radius: 2px; }
.auth-switch { width: 100%; margin-top: 18px; border: 0; background: transparent; color: var(--forest); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }

button.size-link { width: 100%; background: transparent; cursor: pointer; font-family: inherit; }

/* ---------- Bag, account and checkout ---------- */
.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.button-primary:hover:not(:disabled) { background: #33352f; }
.bag-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
}
.bag-button svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linejoin: round; }
.bag-button:hover { border-color: var(--ink); }
.bag-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--vermilion);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.side-panel { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; background: rgba(26, 27, 24, .45); }
.side-panel-inner { width: min(440px, 100%); height: 100%; display: flex; flex-direction: column; background: var(--white); box-shadow: -8px 0 32px rgba(0, 0, 0, .14); }
.side-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.side-panel-head h2 { margin: 0; font: 500 22px/1.2 var(--font-display); }
.side-panel-close { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); cursor: pointer; font-size: 20px; line-height: 1; }
.side-panel-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.side-panel-foot { display: grid; gap: 10px; padding: 16px 22px 22px; border-top: 1px solid var(--line); }
.side-panel-foot:empty { display: none; }
.panel-empty { display: grid; gap: 6px; padding: 40px 8px; text-align: center; }
.panel-empty strong { font: 500 20px/1.3 var(--font-display); }
.panel-empty span, .panel-note { color: var(--muted); font-size: 13px; }
.panel-note { margin: 0; }

.bag-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.bag-line { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 14px; align-items: start; }
.bag-line img, .bag-thumb { width: 76px; aspect-ratio: 2 / 3; object-fit: cover; object-position: top; border-radius: 6px; background: var(--soft); }
.bag-line.is-unavailable img { opacity: .45; }
.bag-line-info p { margin: 0; }
.bag-line-title { font: 500 15px/1.3 var(--font-display); }
.bag-line-info .bag-line-meta { margin-top: 2px; color: var(--muted); font-size: 13px; }
.bag-line-warning { margin: 4px 0 0; color: var(--vermilion); font-size: 13px; font-weight: 600; }
.bag-line-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.bag-line-total { font-size: 14px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.qty button { width: 32px; height: 30px; border: 0; background: transparent; cursor: pointer; font-size: 16px; }
.qty button:disabled { color: var(--line); cursor: default; }
.qty span { min-width: 22px; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }
.text-link { padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.text-link:hover { color: var(--ink); }
.button-block { width: 100%; justify-content: center; border: 0; cursor: pointer; }
.button-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.bag-subtotal { display: flex; justify-content: space-between; font-size: 16px; }

.checkout-form { display: grid; gap: 12px; }
.checkout-form h3 { margin: 10px 0 0; font: 500 18px/1.3 var(--font-display); }
.form-field { display: grid; gap: 4px; }
.form-field span { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.form-field input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); font-size: 15px; }
.form-field input:focus { border-color: var(--ink); outline: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.form-error { margin: 0; color: var(--vermilion); font-size: 14px; }
.checkout-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.checkout-lines li { display: flex; justify-content: space-between; gap: 12px; }

.account-hello { display: grid; margin: 0 0 16px; font: 500 20px/1.3 var(--font-display); }
.account-hello span { color: var(--muted); font: 400 13px var(--font-body); }
.account-tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.account-tabs button { padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); }
.account-tabs button.is-current { color: var(--ink); border-bottom-color: var(--vermilion); }
.account-tab-body { display: grid; gap: 16px; margin-bottom: 24px; }
.order-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 12px; }
.order-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.order-card header div { display: grid; }
.order-card header div span { color: var(--muted); font-size: 13px; }
.order-status { padding: 3px 10px; border-radius: 999px; background: var(--soft); font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-delivered { background: #e5f1ec; color: var(--forest); }
.status-cancelled { background: #f8e6e2; color: var(--vermilion); }
.order-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.order-items li { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.order-items img { width: 48px; aspect-ratio: 2 / 3; object-fit: cover; object-position: top; border-radius: 4px; }
.order-items p { margin: 0; }
.order-items span { color: var(--muted); font-size: 12px; }
.order-card footer { display: flex; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); }
.order-timeline { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.order-timeline span { display: block; color: var(--muted); }

.size-picker { margin: 0 0 18px; }
.size-picker .variant-heading { margin-top: 0; }
.size-options { display: flex; flex-wrap: wrap; gap: 8px; }
.size-option { min-width: 48px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); cursor: pointer; font-weight: 600; font-size: 14px; }
.size-option:hover:not(:disabled) { border-color: var(--ink); }
.size-option[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--white); }
.size-option:disabled { color: var(--muted); text-decoration: line-through; cursor: not-allowed; background: var(--soft); }
.size-guide { display: inline-block; margin-top: 10px; color: var(--forest); font-size: 13px; font-weight: 600; }
.size-guide-panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }
.size-guide-panel summary { padding: 11px 14px; cursor: pointer; font-weight: 600; font-size: 14px; list-style-position: inside; }
.size-guide-panel[open] summary { border-bottom: 1px solid var(--line); }
.size-chart { margin: 0; padding: 12px 14px 0; }
.size-chart figcaption { margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.size-chart-scroll { overflow-x: auto; }
.size-chart table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.size-chart th, .size-chart td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.size-chart thead th { font-weight: 600; background: var(--soft); }
.size-chart tbody th { text-align: left; font-weight: 500; color: var(--muted); }
.size-chart .is-chosen { background: #e7efe9; color: var(--forest); font-weight: 600; }
.size-chart img { display: block; width: 100%; height: auto; margin-top: 10px; border-radius: 6px; }
.size-chart-note { margin: 10px 14px 12px; color: var(--muted); font-size: 12px; }
.size-chart-note .size-guide { margin: 0; font-size: 12px; }
.detail-actions { margin: 0 0 28px; }
.shop-link:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }

.auth-forgot { justify-self: end; padding: 0; border: 0; background: transparent; color: var(--forest); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.auth-message.is-error { color: var(--vermilion); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--white);
  font-size: 14px;
  transform: translateX(-50%);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .2);
}
.toast button { flex: none; padding: 0; border: 0; background: transparent; color: #f2c64b; cursor: pointer; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .location { display: none; }
}

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 14px; }
}

@media (max-width: 720px) {
  .header-bar { grid-template-columns: 1fr auto 1fr; grid-template-rows: 56px auto; column-gap: 12px; row-gap: 0; min-height: 0; padding: 0 16px 12px; }
  .header-left { display: contents; }
  .wordmark { font-size: 18px; }
  .wordmark-name { letter-spacing: .14em; margin-right: -.14em; }
  .rail-open { grid-column: 1; grid-row: 1; justify-self: start; }
  .header-actions { grid-column: 3; grid-row: 1; }
  .account-button { height: 38px; padding: 0 12px; }
  .header-actions { gap: 8px; }
  .side-panel-inner { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .search-box { grid-column: 1 / -1; grid-row: 2; height: 40px; }
  .audience-tabs { justify-content: center; gap: 28px; padding: 0 16px; }
  .audience-tabs a { font-size: 12px; padding: 10px 2px 12px; }

  .main { padding: 20px 16px 56px; }
  .brand-strip { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 40%; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scroll-padding-inline: 16px; scrollbar-width: none; }
  .brand-card-name { font-size: 19px; }
  .home { gap: 40px; margin-bottom: 40px; }


  .toolbar { flex-wrap: wrap; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 10px; }
  .product-card h3 { font-size: 14px; }
  .product-price { font-size: 13px; }

  body > footer { flex-direction: column; align-items: flex-start; padding: 28px 16px; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 720px) {
  /* Polished Mobile Product Detail View */
  .drawer {
    padding: 0;
    display: block;
    position: fixed;
    inset: 0;
    z-index: 60;
    overflow: hidden;
    background: rgba(23, 25, 22, 0.85);
  }
  .drawer-panel {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--white);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  .drawer-close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 100;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(23, 25, 22, 0.85);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    font-size: 22px;
  }
  .detail-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    min-height: auto;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  .detail-gallery-container {
    width: 100%;
    max-width: 100vw;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-sizing: border-box;
    background: #f0f2eb;
  }
  .detail-slider {
    width: 100%;
    max-width: 100vw;
    height: 52vh;
    min-height: 340px;
    max-height: 480px;
    aspect-ratio: auto;
    background: #f0f2eb;
    box-sizing: border-box;
  }
  .detail-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2eb;
  }
  .detail-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center center;
    display: block;
  }
  .slider-arrow {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }
  .slider-prev { left: 10px; }
  .slider-next { right: 10px; }
  .slider-counter { bottom: 12px; right: 12px; }

  .detail-thumbnails {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    padding: 10px 14px;
    gap: 8px;
  }
  .detail-thumb {
    flex: 0 0 54px;
    height: 72px;
    aspect-ratio: auto;
    background: #f0f2eb;
  }
  .detail-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .detail-copy {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    padding: 24px 16px 40px;
    overflow-x: hidden;
  }
  .detail-copy h2 {
    font-size: 22px;
    line-height: 1.25;
    margin-bottom: 8px;
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .detail-price { font-size: 19px; margin-bottom: 16px; }

  /* Mobile formatted description layout */
  .product-description-formatted {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 14px;
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 20px;
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .desc-block {
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 10px;
  }
  .desc-heading { font-size: 10px; letter-spacing: .08em; }
  .desc-keyval {
    width: 100%;
    box-sizing: border-box;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 3px 0;
  }
  .desc-val { text-align: left; }
  .desc-bullet-list { padding-left: 14px; gap: 4px; }

  .variant-list {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
  }
  .variant-row {
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    padding: 8px 0;
    word-break: break-word;
  }

  .detail-actions {
    width: 100%;
    box-sizing: border-box;
  }
  .shop-link, .size-link {
    width: 100%;
    box-sizing: border-box;
  }
}
