:root {
  --color-text: #111;
  --color-muted: #666;
  --color-border: #e5e5e5;
  --color-bg: #fff;
  --color-surface: #f6f6f6;
  --max-width: 1200px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
}

.logo {
  display: block;
  width: auto;
  height: 40px;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px 24px;
  padding: 48px 0;
}

.product-card {
  display: block;
  color: inherit;
  text-decoration: none;
}

.product-card:hover .product-title {
  text-decoration: underline;
}

.product-image {
  aspect-ratio: 1;
  background: var(--color-surface);
  overflow: hidden;
}

.product-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-title {
  margin: 12px 0 4px;
  font-size: 15px;
  font-weight: 500;
}

.product-price {
  margin: 0;
  color: var(--color-muted);
  font-size: 15px;
}

/* Product page */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  padding: 48px 0;
  align-items: start;
}

.product-detail-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

.product-detail-price {
  margin: 0 0 24px;
  font-size: 20px;
}

.buy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 32px;
}

.variant-select {
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  font: inherit;
  background: var(--color-bg);
  color: var(--color-text);
}

.buy-button {
  min-width: 240px;
  padding: 14px 32px;
  border: 0;
  background: var(--color-text);
  color: var(--color-bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.buy-button:hover:not(:disabled) {
  opacity: 0.85;
}

.buy-button:disabled {
  background: var(--color-border);
  color: var(--color-muted);
  cursor: not-allowed;
}

.buy-error {
  margin: 0;
  color: #c00;
  font-size: 14px;
}

.buy-error:empty {
  display: none;
}

.product-description {
  color: var(--color-muted);
  line-height: 1.6;
}

.product-not-found {
  padding: 48px 0;
}

/* Password gate */
.locked body > :not(.gate) {
  display: none;
}

.gate {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin: auto;
  padding: 48px 16px;
}

.gate-logo {
  align-self: center;
  width: auto;
  height: 40px;
  margin-bottom: 24px;
}

.gate label {
  font-size: 14px;
  color: var(--color-muted);
}

.gate input {
  padding: 12px;
  border: 1px solid var(--color-border);
  font: inherit;
}

.gate button {
  padding: 14px 32px;
  border: 0;
  background: var(--color-text);
  color: var(--color-bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.gate-error {
  margin: 0;
  color: #c00;
  font-size: 14px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
  color: var(--color-muted);
  font-size: 14px;
}

@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 16px;
  }

  .product-detail {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 0;
  }

  .logo {
    height: 32px;
  }
}
