/* Thee Scholar Enterprise — modern storefront theme */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #6b7280;
  --line: #e7e9ef;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --ok: #16a34a;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(20, 24, 31, 0.07);
  --shadow-lg: 0 18px 50px rgba(20, 24, 31, 0.18);
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* Announcement */
.announce {
  background: var(--ink);
  color: #fff;
  text-align: center;
  font-size: 13px;
  letter-spacing: .02em;
  padding: 9px 16px;
}

/* Header */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-crest { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.brand-name { font-weight: 700; font-size: 17px; line-height: 1.1; }
.brand-tag { display: block; font-size: 11px; color: var(--muted); }
.spacer { flex: 1; }
.cart-btn {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 9px 16px 9px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cart-btn:hover { border-color: #cfd3df; }
.cart-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hero */
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 20px 24px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
}
.hero-title {
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.05;
  margin: 0 0 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.hero-sub { color: var(--muted); max-width: 54ch; font-size: 16px; margin: 0; }

/* Catalogue */
.catalogue { max-width: 1180px; margin: 0 auto; padding: 24px 20px 80px; }
.cat-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.cat-title { font-size: 22px; margin: 0; font-weight: 700; }
.cat-tools { display: flex; align-items: center; gap: 14px; }
.cat-count { font-size: 13px; color: var(--muted); white-space: nowrap; }
.search {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-size: 14px;
  width: 280px;
  max-width: 100%;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Category filter chips */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: .15s;
}
.chip:hover { border-color: #cfd3df; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Product grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: .18s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f1f2f6;
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card.is-soldout .card-img img { filter: grayscale(1); opacity: .55; }
.soldout-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-cat {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  font-weight: 600;
}
.card-name { font-size: 15px; margin: 0; font-weight: 600; line-height: 1.3; }
.card-price { font-size: 17px; font-weight: 700; margin: 0; }
.card-low { margin: 0; font-size: 12px; font-weight: 600; color: #b45309; }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.size-select {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  background: var(--surface);
}
.size-select.needs-size { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.15); }
.add-btn {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.add-btn:hover { filter: brightness(1.08); }
.add-btn-full { width: 100%; }
.add-btn:disabled {
  background: #c7ccd6;
  cursor: not-allowed;
  width: 100%;
}
.no-results { text-align: center; color: var(--muted); padding: 60px 0; }

/* Footer */
.site-foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  padding: 40px 20px;
}
.foot-crest { width: 48px; height: 48px; border-radius: 10px; margin: 0 auto 12px; object-fit: cover; }
.foot-name { font-weight: 700; margin: 0 0 4px; }
.foot-tag, .foot-meta { color: var(--muted); margin: 2px 0; font-size: 14px; }

/* Cart drawer */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, .45);
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 40;
}
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .25s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-close { border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-empty { color: var(--muted); text-align: center; padding: 50px 0; }
.cart-line {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line-info { flex: 1; }
.cart-line-name { margin: 0 0 3px; font-weight: 600; font-size: 14px; }
.cart-line-meta { margin: 0; color: var(--muted); font-size: 13px; }
.qty { display: inline-flex; align-items: center; gap: 10px; }
.qty button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.drawer-foot { border-top: 1px solid var(--line); padding: 18px 20px; }
.phone-field { display: block; margin-bottom: 14px; }
.phone-field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.phone-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  font-weight: 600;
}
.total-amt { font-size: 22px; font-weight: 800; }
.checkout {
  display: block;
  text-align: center;
  background: var(--ok);
  color: #fff;
  text-decoration: none;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
}
.checkout.is-disabled { background: #c7ccd6; pointer-events: none; }
.checkout-note { font-size: 12px; color: var(--muted); text-align: center; margin: 10px 0 0; }

/* Photo-count badge on cards with a gallery */
.photo-count {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  background: rgba(20, 24, 31, .72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 4px 9px;
  border-radius: 999px;
  pointer-events: none;
}
.card-img[data-open], .card-name[data-open] { cursor: pointer; }
.card-name[data-open]:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Quick-view modal */
.qv-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 24, .55);
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  z-index: 60;
}
.qv-scrim.show { opacity: 1; pointer-events: auto; }
.quickview {
  position: fixed;
  z-index: 61;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(.98);
  opacity: 0;
  pointer-events: none;
  width: min(900px, calc(100% - 32px));
  max-height: 90vh;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  transition: opacity .2s, transform .2s;
}
.quickview.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.qv-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
  border: 0;
  background: rgba(255, 255, 255, .85);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
}
.qv-gallery { background: #f1f2f6; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.qv-main { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #e9eaf0; }
.qv-main img { width: 100%; height: 100%; object-fit: cover; }
.qv-thumbs { display: flex; gap: 10px; flex-wrap: wrap; }
.qv-thumb {
  width: 62px;
  height: 62px;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: #e9eaf0;
}
.qv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qv-thumb.active { border-color: var(--accent); }
.qv-info { padding: 34px 30px; overflow-y: auto; display: flex; flex-direction: column; }
.qv-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 600; }
.qv-name { font-size: 26px; font-weight: 800; letter-spacing: -.01em; margin: 8px 0 6px; line-height: 1.15; }
.qv-price { font-size: 22px; font-weight: 700; margin: 0; }
.qv-low { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: #b45309; }
.qv-desc { margin: 16px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; white-space: pre-line; }
.qv-actions { display: flex; gap: 10px; margin-top: 24px; }
.qv-actions .size-select { max-width: 160px; }

/* ---------- Tablet ---------- */
@media (max-width: 720px) {
  .masthead-inner { padding: 12px 16px; }
  .brand-tag { display: none; }
  .brand-crest { width: 38px; height: 38px; }
  .brand-name { font-size: 16px; }
  .cart-btn { padding: 8px 14px; font-size: 13px; }

  .hero { padding: 36px 16px 18px; }
  .hero-sub { font-size: 15px; }

  .catalogue { padding: 18px 16px 64px; }
  .cat-head { gap: 12px; margin-bottom: 14px; }
  .cat-title { font-size: 20px; }
  .cat-tools { width: 100%; }
  .search { width: 100%; }

  /* Filters become a single swipeable row instead of wrapping */
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -16px 22px;
    padding: 2px 16px 6px;
  }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }

  .grid { gap: 16px 12px; grid-template-columns: repeat(2, 1fr); }

  /* Quick-view stacks: gallery on top, details below, whole thing scrolls */
  .quickview { grid-template-columns: 1fr; overflow-y: auto; }
  .qv-gallery { overflow: visible; }
  .qv-main { aspect-ratio: 4 / 3; }
  .qv-info { padding: 22px 20px 26px; }
  .qv-name { font-size: 22px; }
}

/* ---------- Phone ---------- */
@media (max-width: 480px) {
  .hero { padding-top: 28px; }
  .hero-title { font-size: 30px; }
  .catalogue { padding: 16px 14px 56px; }
  .grid { gap: 14px 10px; }

  .card-body { padding: 12px 12px 14px; gap: 6px; }
  .card-name { font-size: 14px; }
  .card-price { font-size: 16px; }

  /* Stack the selector and button so neither gets squeezed */
  .card-actions { flex-direction: column; gap: 8px; }
  .size-select { width: 100%; }
  .add-btn { width: 100%; padding: 11px 16px; }

  .site-foot { padding: 32px 16px; }
}

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