:root {
  --paper: #f3efe7;
  --card: #fffdf9;
  --ink: #17211c;
  --muted: #66706a;
  --line: #dcd6cb;
  --accent: #1f5c45;
  --accent-dark: #174635;
  --accent-soft: #dfe9e3;
  --warm: #b7773c;
  --shadow: 0 12px 35px rgb(37 45 40 / 8%);
  --radius: 18px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 92% 5%, rgb(183 119 60 / 12%), transparent 26rem),
    var(--paper);
}

a {
  color: inherit;
}

.hero {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 34px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--warm);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.7rem, 6vw, 4.7rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}

.list-meta {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.category-nav {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.category-pill {
  padding: 8px 13px;
  color: var(--accent);
  background: rgb(255 253 249 / 72%);
  border: 1px solid rgb(31 92 69 / 25%);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.category-pill:hover {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.catalog {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 100px;
}

.category-list {
  display: grid;
  gap: 68px;
}

.category-section {
  scroll-margin-top: 20px;
}

.category-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgb(23 33 28 / 18%);
}

.category-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.category-count {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

.product-grid,
.loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  align-items: stretch;
}

.product-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgb(23 33 28 / 10%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 45px rgb(37 45 40 / 12%);
}

.image-link {
  display: block;
  text-decoration: none;
}

.image-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgb(31 92 69 / 9%), rgb(183 119 60 / 10%)),
    #ebe8df;
}

.product-image {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 22px;
  object-fit: contain;
  background: #f8f6f0;
}

.product-image[hidden] {
  display: none;
}

.image-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.fallback-mark {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid rgb(31 92 69 / 18%);
  border-radius: 50%;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.card-body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.shop-name {
  margin: 0 0 10px;
  color: var(--warm);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.product-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.38rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.23;
}

.product-title a {
  text-decoration: none;
}

.product-title a:hover {
  text-decoration: underline;
  text-decoration-color: rgb(183 119 60 / 55%);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.product-description {
  margin: 16px 0 0;
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.58;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.quantity-note {
  align-self: flex-start;
  margin: 12px 0 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 750;
}

.card-footer {
  margin-top: auto;
  padding-top: 24px;
}

.product-price,
.dialog-price {
  display: block;
  min-height: 1.5em;
  margin-bottom: 17px;
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: 780;
}

.product-price:empty::after {
  content: "Price varies";
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.card-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button,
.details-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  padding: 0 18px;
  color: white;
  background: var(--accent);
  border: 1px solid var(--accent);
  transition:
    background 150ms ease,
    border-color 150ms ease;
}

.button-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.details-button {
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-decoration-color: rgb(102 112 106 / 40%);
  text-underline-offset: 3px;
}

.details-button:hover {
  color: var(--ink);
}

.message-panel {
  padding: 80px 30px;
  text-align: center;
  background: rgb(255 253 249 / 72%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.message-panel p:last-child {
  color: var(--muted);
}

.skeleton-card {
  height: 510px;
  border-radius: var(--radius);
  background:
    linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 62%) 50%, transparent 70%)
      0 0 / 220% 100%,
    #e5e0d6;
  animation: shimmer 1.35s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

.details-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: min(760px, calc(100% - 32px));
  padding: 34px;
  color: var(--ink);
  background: var(--card);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 30px 90px rgb(0 0 0 / 30%);
}

.details-dialog::backdrop {
  background: rgb(15 23 19 / 58%);
  backdrop-filter: blur(4px);
}

.details-dialog h2 {
  margin: 0;
  padding-right: 34px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.dialog-description {
  margin: 24px 0;
  white-space: pre-line;
  color: #4e5953;
  line-height: 1.65;
}

.dialog-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--paper);
  border: 0;
  border-radius: 50%;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-actions {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.dialog-price {
  margin: 0;
}

:focus-visible {
  outline: 3px solid rgb(183 119 60 / 55%);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .product-grid,
  .loading-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .catalog,
  .hero {
    width: min(100% - 28px, 1180px);
  }

  .hero {
    padding: 34px 0 24px;
  }

  .hero h1 {
    font-size: clamp(2.35rem, 12vw, 3.3rem);
  }

  .product-grid,
  .loading-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .category-list {
    gap: 48px;
  }

  .category-header {
    margin-bottom: 14px;
  }

  .category-header h2 {
    font-size: 1.55rem;
  }

  .card-body {
    padding: 22px;
  }

  .image-frame {
    aspect-ratio: 16 / 11;
  }

  .details-dialog {
    padding: 28px 22px 24px;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-price {
    align-self: flex-start;
  }

  .dialog-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
