/* ---------------------------------------------------------------------------
   MAJDA — storefront styles
--------------------------------------------------------------------------- */

:root {
  --ivory:   #E6EDE8;   /* TEST COLOUR - original was #FAF8F4 */
  --paper:   #FFFFFF;
  --sand:    #EFE8DC;
  --sand-2:  #E3D9C8;
  --ink:     #1B1815;
  --muted:   #7C7268;
  --saddle:  #5E4128;
  --brass:   #A6843C;
  --line:    #E1D9CC;

  /* Active category tab underline. Try --saddle or --brass instead. */
  --tab-active: #2F5D50;

  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --pad: clamp(16px, 4vw, 48px);
  --radius: 2px;
}

* { box-sizing: border-box; }

/* An author `display` rule beats the UA rule for [hidden]; make it stick. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.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;
}

/* --- Header ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ivory);
  /* Tracks --ivory automatically, so the header always matches the page. */
  background: color-mix(in srgb, var(--ivory) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad) 12px;
}

.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  line-height: 1;
}

.brand-logo {
  width: clamp(42px, 7vw, 58px);
  height: auto;
  object-fit: contain;
}

.brand-word {
  font-family: var(--serif);
  font-size: clamp(15px, 2.2vw, 19px);
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  font-weight: 500;
  color: var(--ink);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 14px);
  padding-top: 6px;
}

.select-wrap select {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.select-wrap select:hover,
.select-wrap select:focus-visible {
  color: var(--ink);
  border-color: var(--line);
  outline: none;
}

.cart-button {
  position: relative;
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
  color: var(--ink);
  display: inline-flex;
}

.cart-button svg { width: 24px; height: 24px; }

.cart-count {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--saddle);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
}

/* --- Category tabs --------------------------------------------------------- */

.tabs {
  display: flex;
  gap: clamp(14px, 2.6vw, 32px);
  padding: 0 var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  background: none;
  border: 0;
  border-bottom: 1.5px solid transparent;
  padding: 15px 0 16px;
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--tab-active);
}

/* --- Catalogue ------------------------------------------------------------- */

.hero {
  padding: clamp(40px, 8vw, 84px) var(--pad) clamp(28px, 5vw, 48px);
  max-width: 780px;
}

.hero h1 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.hero p {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 15px;
  font-weight: 300;
}

.grid-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--pad) 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(20px, 3vw, 32px);
}

.grid-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 3vw, 26px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(20px, 3vw, 40px) clamp(12px, 2.4vw, 32px);
  padding: 0 var(--pad) clamp(56px, 9vw, 96px);
}

.card { display: block; cursor: pointer; }

.card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--sand);
  overflow: hidden;
  border-radius: var(--radius);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .7s cubic-bezier(.2,.7,.3,1);
}

.card:hover .card-media img { transform: scale(1.045); }

.card-flag {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: rgba(255,255,255,.93);
  color: var(--saddle);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: var(--radius);
}

.card-body { padding-top: 14px; }

.card-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  margin: 0 0 4px;
}

.card-tagline {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 300;
  color: var(--muted);
}

.card-price {
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

/* --- Product detail -------------------------------------------------------- */

.back-link {
  display: inline-block;
  padding: clamp(20px, 3vw, 32px) var(--pad) 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.back-link:hover { color: var(--ink); }

.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(20px, 3vw, 36px) var(--pad) clamp(56px, 9vw, 100px);
  align-items: start;
}

@media (min-width: 860px) {
  .detail { grid-template-columns: 1.05fr 1fr; }
  .detail-info { position: sticky; top: 130px; }
}

.detail-media {
  aspect-ratio: 4 / 5;
  background: var(--sand);
  border-radius: var(--radius);
  overflow: hidden;
}
.detail-media img { width: 100%; height: 100%; object-fit: cover; }

.detail-info { max-width: 44ch; }

.detail-eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
}

.detail-info h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 4.4vw, 42px);
  line-height: 1.12;
}

.detail-price {
  font-size: 17px;
  margin: 0 0 22px;
}

.detail-desc {
  margin: 0 0 24px;
  color: #423B34;
  font-weight: 300;
}

.detail-details {
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.detail-details li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 300;
  color: #4A423A;
}

.field-label {
  display: block;
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.size-pill {
  min-width: 48px;
  min-height: 44px;
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.size-pill:hover { border-color: var(--sand-2); }

.size-pill[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ivory);
}

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stepper button {
  width: 40px;
  height: 42px;
  background: none;
  border: 0;
  font-size: 17px;
  cursor: pointer;
  color: var(--ink);
}
.stepper button:disabled { color: var(--sand-2); cursor: not-allowed; }

.stepper input {
  width: 46px;
  height: 42px;
  border: 0;
  border-inline: 1px solid var(--line);
  background: transparent;
  text-align: center;
  font: inherit;
  font-size: 16px;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.line-total { text-align: end; }

.line-total .line-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}

.line-total .line-value {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
}

.btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  background: var(--ink);
  color: var(--ivory);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s, color .2s;
}

.btn:hover { background: var(--saddle); border-color: var(--saddle); }

.btn:disabled {
  background: var(--sand);
  border-color: var(--sand);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--ivory); }

.note {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* --- Basket drawer --------------------------------------------------------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(27, 24, 21, .38);
  animation: fade .25s ease;
}

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.drawer {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  z-index: 70;
  width: min(420px, 100vw);
  height: 100%;
  height: 100dvh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: -18px 0 50px rgba(27,24,21,.14);
  animation: slide .3s cubic-bezier(.2,.7,.3,1);
}

@keyframes slide { from { transform: translateX(var(--from, 100%)) } to { transform: none } }
[dir="rtl"] .drawer { --from: -100%; }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
}

.icon-button {
  background: none;
  border: 0;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}
.icon-button:hover { color: var(--ink); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px;
}

.drawer-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
  font-weight: 300;
}

.cart-item {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.cart-item img {
  width: 68px;
  height: 85px;
  object-fit: cover;
  background: var(--sand);
  border-radius: var(--radius);
}

.cart-item-name {
  font-family: var(--serif);
  font-size: 16px;
  margin: 0 0 2px;
}

.cart-item-meta {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.qty-mini {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.qty-mini button {
  width: 26px; height: 26px;
  background: none; border: 0; cursor: pointer; line-height: 1;
}
.qty-mini span { min-width: 24px; text-align: center; font-size: 12.5px; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--ink); }

.cart-item-price { font-size: 13.5px; white-space: nowrap; }

.drawer-foot { padding: 20px 24px; border-top: 1px solid var(--line); }

.subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.subtotal-row .label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.subtotal-row .value { font-family: var(--serif); font-size: 24px; }

/* --- Footer ---------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--sand);
}

.footer-inner {
  padding: clamp(36px, 6vw, 60px) var(--pad);
  text-align: center;
}

.footer-mark {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.footer-line { margin: 0 0 6px; font-size: 13px; color: #554C43; font-weight: 300; }
.footer-fine { margin: 0; font-size: 11.5px; color: var(--muted); }

/* --- Toast ----------------------------------------------------------------- */

.toast {
  position: fixed;
  z-index: 90;
  bottom: 28px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--ivory);
  padding: 13px 22px;
  border-radius: var(--radius);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fade .2s ease;
}
[dir="rtl"] .toast { transform: translateX(50%); }

/* --- RTL ------------------------------------------------------------------- */

[dir="rtl"] body { font-family: 'Segoe UI', var(--sans); }
[dir="rtl"] .brand-word,
[dir="rtl"] .footer-mark { text-indent: 0; }
