/* Natures Loom storefront — styled after store.html */

:root {
  --bg: #faf4e6;
  --hdr: #f3e5c8;
  --card: #fffbf2;
  --ink: #2b2418;
  --mute: #7b6a4a;
  --line: #e5d6b4;
  --accent: #2a5a26;
  --gold: #b88a26;
  --rose: #b01e4a;
  --gap: 14px;
  --serif: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(14px, 4vw, 40px);
  background: var(--hdr);
  border-bottom: 2px solid var(--gold);
}

#logo { flex: none; height: 64px; display: flex; align-items: center; }
#logo:empty { display: none; }
@media (min-width: 700px) { #logo { height: 84px; } }
#logo img { height: 100%; width: auto; object-fit: contain; mix-blend-mode: multiply; }

.brand { min-width: 0; color: inherit; text-decoration: none; }

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--accent);
}
/* the logo already carries the name, so the text is kept for screen readers only */
.has-logo .brand h1 {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.brand p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: .95rem;
  line-height: 1.3;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #8a6414;
}
.brand p i {
  flex: none;
  width: 6px; height: 6px;
  background: var(--gold);
  transform: rotate(45deg);
}
@media (max-width: 600px) {
  .brand p { flex-direction: column; align-items: flex-start; gap: 0; font-size: .78rem; letter-spacing: .16em; }
  .brand p i { display: none; }
}

.social { margin-left: auto; display: flex; gap: 8px; flex: none; }
.soc {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
}
.soc svg {
  width: 21px; height: 21px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.soc.whatsapp { background: #25d366; }
.soc.instagram { background: linear-gradient(45deg, #f09433, #dc2743 55%, #bc1888); }

/* ---------- Layout ---------- */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 32px) clamp(14px, 4vw, 40px) 32px;
}

footer { text-align: center; padding: 0 0 32px; font-size: .8rem; color: var(--mute); }
footer:empty { display: none; }
footer a { color: var(--mute); }

#msg { color: var(--mute); padding: 24px 0; }
#msg.err { color: #b3261e; }
#msg button {
  font: inherit; color: var(--accent); background: none; border: 0;
  padding: 0; text-decoration: underline; cursor: pointer;
}

/* ---------- Search and filters ---------- */
.search { margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.search input {
  flex: 1 1 220px;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.search select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
#count { margin-bottom: 10px; min-height: 1.2em; }
.count { color: var(--mute); font-size: .8rem; }

/* ---------- Product grid ---------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1360px) { .grid { grid-template-columns: repeat(5, 1fr); } }

.card {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.card img, .shot img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #efe2c2;
}
.card.sold-out img { filter: grayscale(.6); opacity: .7; }

.ph {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  background: #efe2c2;
  color: var(--mute);
  font-size: .8rem;
}

.meta { padding: 9px 11px 11px; }
.t { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { color: var(--mute); font-size: .8rem; letter-spacing: .02em; }
.p { color: var(--rose); font-size: .9rem; font-weight: 600; }

/* ---------- Status badges ---------- */
.badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 2px 9px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge.inline { position: static; display: inline-block; margin: 0 0 4px; font-size: .8rem; }
.badge.ok   { background: #e3f3e8; color: #1b6b3a; border-color: #bfe0c9; }
.badge.sold { background: #ece4d4; color: #6b5f4c; border-color: #d6c9ae; }
.badge.soon { background: #fdf1d8; color: #8a5a00; border-color: #efd9a6; }
.badge.new  { background: #f8e1e8; color: #8f1840; border-color: #ecbccb; }

/* ---------- Loading skeleton ---------- */
.skeleton { pointer-events: none; }
.skeleton .ph, .skeleton .line {
  background: linear-gradient(100deg, #efe2c2 30%, #f7edd3 50%, #efe2c2 70%);
  background-size: 250% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton .line { height: .9rem; border-radius: 6px; margin-top: 8px; }
.skeleton .line.s { width: 45%; }
.skeleton .line.m { width: 75%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- Item page ---------- */
.back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.detail h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.15;
  color: var(--accent);
}
.detail .code { font-size: .95rem; margin: 0 0 2px; }
.detail .price { margin: 2px 0 6px; color: var(--rose); font-size: 1.2rem; font-weight: 600; }
.detail .desc { max-width: 60ch; margin: 0 0 18px; color: var(--mute); white-space: pre-line; }

.specs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 10px; font-size: .9rem; }
.specs:empty { display: none; }
.specs b { color: var(--mute); font-weight: 600; }

.sizes { margin: 0 0 14px; padding: 0; border: 0; }
.sizes legend { padding: 0; margin-bottom: 6px; font-size: .9rem; font-weight: 600; }
.size-list { display: flex; flex-wrap: wrap; gap: 8px; }
.size-opt { position: relative; }
.size-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.size-opt span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 42px;
  padding: 0 14px;
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
}
.size-opt input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.size-opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.enq { margin: 0 0 6px; }
.enq:empty { display: none; }
.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}
.btn-wa svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.btn-wa[aria-disabled="true"] { background: #cdbf9d; color: #fff; cursor: not-allowed; }
.hint { min-height: 1.3em; margin: 0 0 14px; color: var(--rose); font-size: .9rem; }

.shot {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

/* ---------- Lightbox ---------- */
#lb {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(35, 25, 12, .92);
}
#lb.on { display: flex; }
#lb img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
#lb button {
  position: absolute;
  width: 42px; height: 42px;
  background: #fff;
  border: 0;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}
#lb .x  { top: 12px; right: 14px; }
#lb .pv { left: 10px; top: 50%; }
#lb .nx { right: 10px; top: 50%; }
#lb.single .pv, #lb.single .nx { display: none; }

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