:root {
  --bg: #f4f7f7;
  --surface: #ffffff;
  --text: #172326;
  --muted: #617073;
  --line: #dfe8e8;
  --accent: #0f8b8d;
  --accent-dark: #0a5d61;
  --gold: #d39c2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--accent-dark);
  color: white;
  border-radius: 8px;
  font-weight: 800;
}

.brand small,
.eyebrow,
.hero-panel span,
.product-meta,
.message {
  color: var(--muted);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.topbar a {
  color: inherit;
  text-decoration: none;
}

.cart-button,
.drawer button,
.checkout button,
.product button,
.product-detail button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 11px 16px;
  font-weight: 700;
}

.cart-button span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  background: white;
  color: var(--accent-dark);
  border-radius: 999px;
}

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: end;
  min-height: 280px;
  margin-bottom: 22px;
  padding: clamp(28px, 5vw, 56px);
  background: linear-gradient(135deg, #ffffff 0%, #e8f4f3 62%, #fff7e5 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1;
}

.hero p {
  max-width: 620px;
  font-size: 18px;
  line-height: 1.6;
}

.hero-panel {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 240px 160px;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar input,
.toolbar select,
.checkout input,
.checkout textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 13px 14px;
  color: var(--text);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.product {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.product img {
  width: 100%;
  aspect-ratio: 1.14;
  object-fit: contain;
  padding: 18px;
  background: #f9fbfb;
}

.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.product h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.product-meta {
  min-height: 20px;
  font-size: 14px;
}

.product-price {
  margin-top: auto;
  font-weight: 800;
  color: var(--accent-dark);
}

.product-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.product button.secondary {
  background: #edf4f4;
  color: var(--accent-dark);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(460px, 100vw);
  height: 100vh;
  padding: 20px;
  background: white;
  box-shadow: -18px 0 50px rgba(13, 35, 38, 0.18);
  transform: translateX(105%);
  transition: transform 0.2s ease;
}

.product-detail {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(13, 35, 38, 0.24);
  transform: translate(-50%, -45%) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.product-detail.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

#productDetailContent {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 24px;
  padding: 20px;
}

.product-detail-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 18px;
  background: #f9fbfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-detail-body {
  display: grid;
  align-content: start;
  gap: 14px;
}

.product-detail-body h2,
.product-detail-body p {
  margin: 0;
}

.product-detail-body h2 {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.1;
}

.product-detail-body p {
  color: var(--muted);
  line-height: 1.6;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-header button,
.cart-row button {
  background: #edf4f4;
  color: var(--accent-dark);
}

.cart-items {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding: 16px 0;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkout {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.checkout h2 {
  margin: 0;
}

.checkout label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(10, 22, 24, 0.35);
}

.overlay.open {
  display: block;
}

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

  .topbar nav {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .hero,
  .toolbar,
  #productDetailContent {
    grid-template-columns: 1fr;
  }

  .product-detail {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
}
