:root {
  color-scheme: light;
  --ink: #172321;
  --muted: #64706d;
  --line: #dce4df;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --sage: #6f947d;
  --teal: #6f4054;
  --coral: #c97872;
  --mint: #f4e7eb;
  --shell: #f6f1ec;
  --shadow: 0 18px 50px rgba(23, 35, 33, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(251, 252, 250, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand,
.nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: 116px;
  height: 64px;
}

.nav a,
.ghost-btn,
.text-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.nav a:hover,
.ghost-btn:hover,
.text-btn:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 620px;
  display: grid;
  align-items: end;
  padding: clamp(26px, 5vw, 64px);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 35, 33, 0.1), rgba(23, 35, 33, 0.54));
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  color: #fff;
  padding-bottom: 54px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(54px, 9vw, 118px);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  max-width: 520px;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f7c4b5;
}

.primary-link,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
}

.primary-link:hover,
.primary-btn:hover {
  background: #54303f;
}

.shop-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 28px;
  padding: 56px clamp(18px, 4vw, 56px);
}

.filters,
.summary,
.checkout-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(23, 35, 33, 0.06);
}

.filters {
  position: sticky;
  top: 86px;
  align-self: start;
  padding: 20px;
}

.filter-head,
.section-title,
.modal-head,
.summary-row,
.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.field input[type="range"] {
  padding: 0;
  accent-color: var(--teal);
}

.catalog-area {
  min-width: 0;
}

.section-title {
  margin-bottom: 22px;
}

#resultCount,
.muted {
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
  align-items: stretch;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-height: 520px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.product-card:hover,
.product-card:focus-within {
  border-color: rgba(23, 79, 85, 0.36);
  box-shadow: 0 16px 46px rgba(23, 35, 33, 0.14);
  z-index: 8;
}

.product-open {
  display: grid;
  grid-template-rows: 260px 1fr;
  gap: 14px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  outline: none;
}

.product-open:focus-visible {
  border-radius: 8px;
  box-shadow: 0 0 0 3px rgba(23, 79, 85, 0.18);
}

.product-visual {
  position: relative;
  display: grid;
  min-height: 260px;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f6f2;
}

.product-visual img {
  width: 100%;
  height: 260px;
  object-fit: contain;
  padding: 18px;
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.product-meta {
  display: grid;
  gap: 8px;
  align-items: start;
}

.product-meta h3 {
  display: -webkit-box;
  min-height: 66px;
  max-height: 66px;
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.product-meta p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.product-brand {
  min-height: 20px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 800;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.price {
  font-size: 16px;
  font-weight: 850;
  color: var(--teal);
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.38fr) minmax(0, 1fr);
  gap: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.detail-row dt {
  color: var(--teal);
  font-weight: 800;
}

.detail-row dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-row dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.38;
}

.cart-section {
  padding: 28px clamp(18px, 4vw, 56px) 70px;
  background: #eef4ef;
}

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 22px;
}

.cart-items {
  display: grid;
  gap: 12px;
}

.empty {
  padding: 26px;
  border: 1px dashed #b9c7c0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.cart-line {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cart-thumb {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: #f3f6f2;
}

.cart-line h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.cart-line p {
  margin: 0;
  color: var(--muted);
}

.quantity {
  display: grid;
  grid-template-columns: 38px 42px 38px;
  align-items: center;
  gap: 4px;
}

.icon-btn,
.qty-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
}

.qty-value {
  text-align: center;
  font-weight: 800;
}

.summary {
  align-self: start;
  padding: 20px;
}

.summary-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.summary-row.total {
  border: 0;
  font-size: 22px;
}

.summary .primary-btn {
  width: 100%;
  margin-top: 12px;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(23, 35, 33, 0.46);
  backdrop-filter: blur(4px);
}

.product-modal {
  width: min(920px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  border-radius: 8px;
  overflow: auto;
}

.product-modal-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.product-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
}

.product-modal-media {
  display: grid;
  min-height: 420px;
  place-items: center;
  border-radius: 8px;
  background: #f3f6f2;
}

.product-modal-media img {
  width: 100%;
  height: 420px;
  object-fit: contain;
  padding: 20px;
}

.product-modal-content {
  min-width: 0;
  padding: 8px 42px 4px 0;
}

.product-modal-content h2 {
  overflow-wrap: anywhere;
}

.product-modal-description {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.58;
}

.product-modal-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.product-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.product-modal-actions strong {
  color: var(--teal);
  font-size: 18px;
}

.checkout-card {
  padding: 22px;
}

.modal-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--mint);
}

.checkout-card .primary-btn {
  width: 100%;
}

.form-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
}

.status {
  min-height: 22px;
  color: var(--teal);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 860px) {
  .topbar,
  .nav {
    flex-wrap: wrap;
  }

  .hero {
    min-height: 560px;
  }

  .shop-shell,
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .product-modal-card {
    grid-template-columns: 1fr;
  }

  .product-modal-media {
    min-height: 280px;
  }

  .product-modal-media img {
    height: 280px;
  }

  .product-modal-content {
    padding: 0;
  }
}

@media (max-width: 560px) {
  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    min-height: 500px;
    padding-inline: 18px;
  }

  .cart-line {
    align-items: start;
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .cart-line .quantity,
  .cart-line strong {
    grid-column: 2;
  }

  .cart-thumb {
    width: 50px;
    height: 50px;
  }

  .detail-row {
    grid-template-columns: 1fr;
  }
}
