:root {
  color-scheme: light;
  --bg: #f7f8f3;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6f746f;
  --line: #dfe4dc;
  --moss: #435743;
  --brick: #9f3d2e;
  --clay: #c6a27a;
  --shadow: 0 24px 70px rgba(20, 25, 20, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "SF Pro Display", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  width: min(1520px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(34px, 5vw, 74px);
  line-height: 0.94;
  letter-spacing: 0;
}

.header-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: end;
  margin-bottom: 22px;
}

.header-stats span,
.chip,
.option-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 420px) 1fr minmax(180px, 230px);
  gap: 14px;
  align-items: end;
  padding: 18px 0;
  background: rgba(247, 248, 243, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.search-box,
.sort-box,
.control-group {
  display: grid;
  gap: 8px;
}

.search-box span,
.sort-box span,
.control-group > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(67, 87, 67, 0.12);
}

.segmented {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.segment-button {
  flex: 0 0 auto;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.segment-button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.featured-product {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 28px;
  align-items: stretch;
  min-height: 430px;
  margin: 28px 0;
}

.featured-media {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #e9ece4;
}

.featured-media img {
  width: 100%;
  height: 100%;
  min-height: 430px;
  object-fit: cover;
}

.featured-copy {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.featured-copy h2 {
  margin-bottom: 22px;
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1.04;
  letter-spacing: 0;
}

.featured-copy p {
  color: var(--muted);
  line-height: 1.8;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 18px 0 0;
}

.price-main {
  color: var(--brick);
  font-size: 28px;
  font-weight: 900;
}

.primary-button {
  width: fit-content;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 0 18px;
  font-weight: 900;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(67, 87, 67, 0.55);
  box-shadow: var(--shadow);
}

.product-card button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: inherit;
}

.card-media {
  aspect-ratio: 4 / 5;
  background: #e7ebe2;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  display: grid;
  gap: 12px;
  min-height: 196px;
  padding: 16px;
}

.card-title {
  min-height: 48px;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.55;
  letter-spacing: 0;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.chip {
  padding: 7px 9px;
  font-size: 11px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 54px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
  color: var(--muted);
}

.detail-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.detail-view.open {
  display: block;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 14, 0.48);
}

.detail-panel {
  position: absolute;
  inset: 20px 20px 20px auto;
  width: min(1120px, calc(100% - 40px));
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.close-button {
  position: sticky;
  top: 16px;
  z-index: 2;
  float: right;
  width: 42px;
  height: 42px;
  margin: 16px 16px 0 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 420px);
  gap: 28px;
  padding: 28px;
}

.detail-gallery {
  display: grid;
  gap: 12px;
}

.detail-hero {
  overflow: hidden;
  border-radius: 8px;
  background: #e9ece4;
}

.detail-hero img {
  width: 100%;
  max-height: 760px;
  object-fit: contain;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.thumb-grid button {
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f5ef;
  padding: 0;
}

.thumb-grid button.active {
  border-color: var(--brick);
}

.thumb-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-info {
  position: static;
  align-self: start;
  display: grid;
  gap: 22px;
}

.detail-info h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.option-group {
  display: grid;
  gap: 10px;
}

.option-group h3,
.detail-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-chip {
  background: #f7f8f3;
  color: var(--ink);
}

.detail-section {
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
}

.size-chart-block {
  display: grid;
  gap: 14px;
  grid-column: 1 / -1;
  padding-top: 8px;
}

.size-chart-block h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.size-chart-block img {
  width: min(100%, 820px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f3;
}

body.detail-open {
  overflow: hidden;
}

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

@media (max-width: 920px) {
  .toolbar,
  .featured-product,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .detail-info {
    position: static;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1520px);
    padding-top: 18px;
  }

  .site-header {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .header-stats {
    justify-content: start;
    margin-bottom: 16px;
  }

  .featured-copy {
    min-height: auto;
    padding: 22px;
  }

  .featured-media img {
    min-height: 320px;
  }

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

  .detail-panel {
    inset: 10px;
    width: auto;
  }

  .detail-layout {
    padding: 18px;
  }

  .thumb-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
