:root {
  --bg: #d6b6a6;
  --surface: #f8a8c3;
  --surface-soft: #ffd3e1;
  --ink: #2f150d;
  --muted: #60382b;
  --line: #df8cab;
  --brown: #4c2b1f;
  --brown-light: #b8897a;
  --accent: #a41c4d;
  --accent-strong: #7a1237;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-card:
    0 2px 4px rgba(47, 21, 13, 0.05),
    0 8px 20px rgba(47, 21, 13, 0.12),
    0 20px 40px rgba(47, 21, 13, 0.07);
  --shadow-soft:
    0 1px 2px rgba(47, 21, 13, 0.04),
    0 4px 12px rgba(47, 21, 13, 0.08);
  --shadow-checkout:
    0 2px 4px rgba(47, 21, 13, 0.05),
    0 10px 30px rgba(47, 21, 13, 0.12),
    0 30px 60px rgba(47, 21, 13, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, #e7cfc3 0%, transparent 38%),
    radial-gradient(circle at 90% 8%, #efbfd0 0%, transparent 30%),
    linear-gradient(165deg, #d6b6a6 0%, #c9a28f 100%);
}

body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  padding: 28px;
}

.topbar {
  grid-column: 1 / -1;
}

.brand-block {
  max-width: 660px;
}

.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brown);
  font-weight: 600;
}

.topbar h1 {
  margin: 8px 0 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--brown);
}

.topbar p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.55;
}

main {
  min-width: 0;
}

.gallery {
  align-self: start;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.data-status {
  margin: 0 0 14px;
  color: var(--brown);
  font-weight: 500;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 220, 220, 0.6);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  animation: cardIn 0.4s ease both;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 220, 220, 0.6);
  border-color: #d35183;
}

.card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196, 32, 80, 0.3), var(--shadow-card);
}

.select-btn {
  position: absolute;
  top: 11px;
  right: 11px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #d1d1d1;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(3px);
  cursor: pointer;
  transition: all 0.18s ease;
}

.card.is-selected .select-btn {
  background: var(--accent);
  border-color: var(--accent);
}

.card.is-selected .select-btn::after {
  content: "✓";
  color: #fff;
  font-size: 14px;
  line-height: 1;
}

.image-wrap {
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #f09aaf 25%, #fbbfd0 50%, #f09aaf 75%);
  background-size: 200% 100%;
  animation: pulse 1.4s ease infinite;
}

.image-wrap.img-loaded {
  background: none;
  animation: none;
}

.image-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.image-wrap img.img-ready {
  opacity: 1;
}

.card-body {
  padding: 14px;
}

.card h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 650;
}

.description {
  margin: 8px 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.price {
  font-weight: 700;
  color: var(--accent-strong);
}

.checkout {
  position: sticky;
  top: 24px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffe4ee;
  padding: 18px;
  box-shadow: var(--shadow-checkout);
  max-height: calc(100vh - 50px);
  overflow-y: auto;
}

.checkout h2 {
  margin: 0 0 12px;
  font-family: "Newsreader", Georgia, serif;
  font-size: 1.52rem;
  letter-spacing: -0.01em;
}

.checkout label {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  margin: 12px 0 6px;
}

.checkout input,
.checkout textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  background: #fff8fb;
}

.checkout input:focus,
.checkout textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 67, 110, 0.14);
}

.summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.selected-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #34140c;
  font-size: 0.9rem;
  min-height: 24px;
}

.whatsapp-btn {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.whatsapp-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.whatsapp-btn:disabled {
  background: var(--brown-light);
  cursor: not-allowed;
}

.whatsapp-btn.is-loading {
  cursor: wait;
  opacity: 0.95;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

.select-btn:focus-visible,
.qty-btn:focus-visible,
.whatsapp-btn:focus-visible {
  outline: 3px solid rgba(255, 196, 220, 0.7);
  outline-offset: 2px;
}

.checkout input:focus-visible,
.checkout textarea:focus-visible {
  outline: 3px solid rgba(143, 18, 58, 0.45);
  outline-offset: 1px;
}

@media (max-width: 1024px) {
  body {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .checkout {
    position: static;
    max-height: none;
  }
}

@media (max-width: 560px) {
  .gallery {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: clamp(1.7rem, 9vw, 2.4rem);
  }
}

/* Cart item with quantity controls */
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}

.cart-item:last-child { border-bottom: none; }

.cart-item-name {
  flex: 1;
  font-size: 0.87rem;
  line-height: 1.4;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s;
}

.qty-btn:hover { background: var(--line); }

.qty-value {
  min-width: 20px;
  text-align: center;
  font-size: 0.87rem;
  font-weight: 600;
}

.cart-item-price {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-strong);
  min-width: 54px;
  text-align: right;
}

/* Skeleton loading */
.card.skeleton { animation: none; }

.skeleton .image-wrap {
  background: linear-gradient(90deg, #ea83a7 25%, #ffc0d5 50%, #ea83a7 75%);
  background-size: 200% 100%;
  animation: pulse 1.4s ease infinite;
}

.skeleton-line {
  border-radius: 4px;
  background: linear-gradient(90deg, #ea83a7 25%, #ffc0d5 50%, #ea83a7 75%);
  background-size: 200% 100%;
  animation: pulse 1.4s ease infinite;
}

@keyframes pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Card entrance animation */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 999;
  white-space: nowrap;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.site-footer {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.8rem;
  color: #6d3f31;
  padding: 16px 0 8px;
  border-top: 1px solid rgba(120, 66, 51, 0.22);
}

.site-footer p { margin: 0; }
