/* 27beauty storefront — design system.
   Tokens first, then layout, then components. Mobile-first throughout.
   Most visitors arrive on a phone, mid-scan of a QR card, deciding in seconds
   whether this is a real shop worth buying from directly. */

:root {
  --ink: #1b1620;
  --ink-soft: #574f5d;
  --ink-faint: #6f6674; /* darkened from the original #8b8391 — that failed 4.5:1 on paper */
  --paper: #fffdfb;
  --surface: #ffffff;
  --surface-2: #f7f3f0;
  --line: #e8e1dc;
  --line-soft: #f1ebe5;
  --brand: #6d2350;
  --brand-ink: #4a1636;
  --brand-soft: #fbeef5;
  --accent: #c8873c;
  --accent-ink: #8a5717; /* accent, darkened for use as text/links — #c8873c alone is ~3:1 */
  --accent-soft: #fdf3e6;
  --ok: #216c4b;
  --ok-soft: #e8f5ee;
  --warn: #8a5a11;
  --warn-soft: #fdf1dc;
  --bad: #a32626;
  --bad-soft: #fbebeb;

  /* spacing scale — use these instead of one-off pixel values */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(27, 22, 32, .06), 0 1px 3px rgba(27, 22, 32, .05);
  --shadow-md: 0 10px 24px rgba(27, 22, 32, .10);
  --tap: 44px; /* minimum touch target */

  --wrap: 1180px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .4em;
  letter-spacing: -.015em;
}
h1 { font-size: clamp(1.65rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem); }
h3 { font-size: 1.1rem; letter-spacing: -.005em; }
p { margin: 0 0 1em; }
small, .small { font-size: .86rem; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* visible, consistent focus ring everywhere — never rely on colour alone for state */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--space-4); }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
main { flex: 1 0 auto; padding-block: var(--space-5) var(--space-7); }

/* ---------- header ---------- */
.topbar {
  background: var(--brand-ink);
  color: #f6ecf2;
  font-size: .8rem;
  letter-spacing: .01em;
}
.topbar .wrap { display: flex; justify-content: center; gap: 18px; padding-block: 7px; text-align: center; }
.topbar a { color: #fff; text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 253, 251, .97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; gap: var(--space-3); padding-block: 10px;
  /* Phone: wordmark and basket share the top row, search gets its own beneath.
     Squeezing all three onto one row leaves a search field too narrow to read. */
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--brand);
  letter-spacing: -.02em; flex: none; display: inline-flex; align-items: center; min-height: var(--tap);
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent-ink); }

.search-form { order: 3; flex: 1 0 100%; display: flex; min-width: 0; margin-bottom: 4px; }
@media (min-width: 720px) {
  .search-form { order: 0; flex: 1 1 240px; max-width: 460px; margin-bottom: 0; }
}
.search-form input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); padding: 10px 14px; font-size: .95rem;
  background: var(--surface); min-height: var(--tap);
}
.search-form button {
  border: 0; background: var(--brand); color: #fff; padding: 0 16px; min-height: var(--tap);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; cursor: pointer; font-size: .95rem; font-weight: 600;
}
.search-form button:hover { background: var(--brand-ink); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex: none; }

.cart-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font-weight: 600; font-size: .92rem;
}
.cart-link:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.cart-count {
  background: var(--brand); color: #fff; border-radius: 999px;
  min-width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: .74rem; padding: 0 6px;
  font-weight: 700;
}

.catnav { border-bottom: 1px solid var(--line); background: var(--surface); }
.catnav .wrap { display: flex; gap: 2px; overflow-x: auto; padding-block: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.catnav a {
  white-space: nowrap; display: inline-flex; align-items: center; padding: 0 13px; min-height: var(--tap);
  border-radius: 999px; color: var(--ink-soft); font-size: .88rem; font-weight: 500;
}
.catnav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.catnav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

/* ---------- buttons + forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; min-height: var(--tap); border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff; font: inherit; font-weight: 600; font-size: .95rem;
  cursor: pointer; text-align: center; transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--brand-ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink-faint); }
.btn-accent { background: var(--accent); color: #2b1b06; }
.btn-accent:hover { background: #b2762f; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #8a1f1f; }
.btn-sm { padding: 7px 14px; min-height: 36px; font-size: .86rem; }
.btn-block { width: 100%; }

label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=url], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 12px; min-height: var(--tap); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; font-size: .95rem; background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: var(--space-4); }
.field-hint { font-size: .82rem; color: var(--ink-faint); margin-top: 4px; }
/* the reassurance line that sits right before the checkout submit button */
.field-hint:has(+ .btn-block) {
  display: flex; align-items: center; gap: 6px; color: var(--ink-soft);
  margin: var(--space-3) 0; font-size: .85rem;
}
.field-hint:has(+ .btn-block)::before { content: "🔒"; font-size: .95em; }
.grid-2 { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- notices ---------- */
.notice { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); font-size: .92rem; }
.notice-ok { background: var(--ok-soft); border-color: #bfe3d0; color: var(--ok); }
.notice-warn { background: var(--warn-soft); border-color: #f0dcb4; color: var(--warn); }
.notice-bad { background: var(--bad-soft); border-color: #f0c9c9; color: var(--bad); }

/* ---------- cards + product grid ---------- */
/* The product card is the workhorse of the site — dozens per page, scanned
   fast on a phone. Image, title, price, saving, stock: nothing decorative. */
.product-grid {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
}
@media (min-width: 720px) { .product-grid { gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease;
  height: 100%;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--line-soft); }
.card:focus-within { box-shadow: var(--shadow-md); }
.card-media { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-3); }
.card-body { padding: var(--space-3) var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card-title {
  font-family: var(--font); font-size: .93rem; font-weight: 600; line-height: 1.35; margin: 0;
  min-height: calc(1.35em * 2); /* reserve two lines so cards in a row line up even when titles vary */
}
.card-title a {
  color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title a:hover { color: var(--brand); }
.card-meta { font-size: .74rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.price {
  font-size: 1.1rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.price-was { font-size: .84rem; color: var(--ink-faint); text-decoration: line-through; font-variant-numeric: tabular-nums; }

.badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--accent); color: #2b1b06; font-size: .72rem; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; letter-spacing: .02em;
}
.badge-out { background: var(--ink-soft); color: #fff; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 700; background: var(--surface-2); color: var(--ink-soft); line-height: 1.4;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-ok::before { content: "✓"; }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- hero + category tiles ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand-ink) 0%, var(--brand) 55%, #94406f 100%);
  color: #fff; border-radius: var(--radius-lg);
  padding: clamp(26px, 6vw, 44px) clamp(20px, 5vw, 36px);
  margin-bottom: var(--space-6);
}
.hero h1 { color: #fff; margin-bottom: .3em; }
.hero p { color: #f3e3ec; max-width: 54ch; margin-inline: auto; }
.hero.center p { margin-left: auto; margin-right: auto; }
.hero .btn-accent { margin-top: var(--space-2); }

.cat-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cat-tile {
  display: flex; flex-direction: column; gap: 4px; padding: var(--space-4); border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease;
  min-height: var(--tap);
}
.cat-tile:hover { border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow-md); }
.cat-tile .emoji { font-size: 1.6rem; }
.cat-tile strong { font-size: .96rem; font-weight: 600; }

/* ---------- product detail ---------- */
.product-layout { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 860px) { .product-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--space-7); } }
.gallery { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gallery-main { aspect-ratio: 1 / 1; display: grid; place-items: center; background: var(--surface); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-4); }
.gallery-thumbs { display: flex; gap: var(--space-2); padding: var(--space-3); overflow-x: auto; border-top: 1px solid var(--line); }
.gallery-thumbs img {
  width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px; cursor: pointer; background: var(--surface); flex: none;
}
.gallery-thumbs img:hover { border-color: var(--brand); }
.price-lg { font-size: clamp(1.7rem, 1.4rem + 1vw, 2.1rem); font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.qty-row { display: flex; gap: var(--space-3); align-items: end; flex-wrap: wrap; }
.qty-row input { width: 88px; }
.trust-list { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: var(--space-2); font-size: .9rem; color: var(--ink-soft); }
.trust-list li { display: flex; align-items: flex-start; gap: 8px; }
.trust-list li::before { content: "✓"; color: var(--ok); font-weight: 700; flex: none; }
.breadcrumbs { font-size: .85rem; color: var(--ink-faint); margin-bottom: var(--space-3); }
.breadcrumbs a { color: var(--ink-soft); }

/* ---------- QR landing offer panel ----------
   The single most important screen on the site: someone scanned a card in a
   parcel, is holding it right now, and lands here on a phone. The discounted
   price must read instantly and Add to basket must be one thumb-tap away. */
/* The code ticket sits inside .hero, whose `.hero p` rule would otherwise win
   on specificity and paint this near-white on white — hence the .hero prefix.
   The customer is comparing it letter by letter against a printed card, so it
   has to stay on one line and stay dark. */
.qr-code-display,
.hero .qr-code-display {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font);
  font-size: clamp(.95rem, 4.4vw, 1.3rem);
  font-weight: 700; letter-spacing: .08em; white-space: nowrap;
  color: var(--brand-ink); background: #fff;
  border: 2px dashed var(--accent); border-radius: var(--radius-sm);
  padding: 10px 18px; margin-block: var(--space-3);
  max-width: 100%; overflow-x: auto;
}

.qr-offer {
  display: flex; flex-direction: column; gap: var(--space-4);
  border: 1px solid var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 60%);
}
@media (min-width: 560px) { .qr-offer { flex-direction: row; align-items: stretch; gap: var(--space-5); } }

.qr-offer-media {
  flex: none; width: 100%; aspect-ratio: 1 / 1; max-height: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
@media (min-width: 560px) { .qr-offer-media { width: 200px; max-height: none; } }
.qr-offer-media img { width: 100%; height: 100%; object-fit: contain; padding: var(--space-3); }

.qr-offer-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-2); justify-content: center; }
.qr-offer-body h2 { margin-bottom: 0; }
.qr-offer-body .price-row { margin-top: var(--space-1); align-items: center; }
.qr-offer-body .qty-row { margin-top: var(--space-2); align-items: center; }
.qr-offer-body .qty-row .btn { flex: 1 1 auto; }
@media (min-width: 420px) { .qr-offer-body .qty-row .btn { flex: 0 0 auto; } }

/* ---------- cart + checkout ---------- */
.checkout-layout { display: grid; gap: var(--space-5); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .checkout-layout { grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr); gap: var(--space-6); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: var(--space-4); }
.panel h2, .panel h3 { margin-top: 0; }
.summary { position: sticky; top: 88px; }
.line { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line img { width: 64px; height: 64px; object-fit: contain; background: var(--surface-2); border-radius: 8px; flex: none; }
.line-body { flex: 1; min-width: 0; }
.line-title { font-weight: 600; font-size: .95rem; }
.totals { list-style: none; padding: 0; margin: var(--space-3) 0 0; font-size: .95rem; }
.totals li { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: var(--space-3); font-size: 1.15rem; font-weight: 700; }
.coupon-form { display: flex; gap: 8px; }
.coupon-form input { text-transform: uppercase; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- pagination + empty ---------- */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: var(--space-6); flex-wrap: wrap; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap);
  padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-soft); font-size: .9rem;
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pagination a[aria-current="page"], .pagination span[aria-current="page"] { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.empty { text-align: center; padding: var(--space-7) var(--space-4); color: var(--ink-soft); }
.empty .emoji { font-size: 2.4rem; display: block; margin-bottom: var(--space-2); }

/* ---------- footer ---------- */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--line); padding-block: var(--space-6); font-size: .9rem; margin-top: auto; }
.footer-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.site-footer h4 { font-family: var(--font); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: var(--space-2); font-weight: 700; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--line); margin-top: var(--space-5); padding-top: var(--space-4); color: var(--ink-faint); font-size: .84rem; }
.footer-bottom .faint::before { content: "🔒 "; }

.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;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 10px 14px; border-radius: 8px; }

@media print {
  .site-header, .catnav, .topbar, .site-footer, .no-print { display: none !important; }
  body { background: #fff; }
}

/* ---------- neutral image placeholder (missing product/category images) ---------- */
.ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--ink-faint); }
