:root {
  color-scheme: light;
  --ink: #181713;
  --muted: #6d6a61;
  --line: #e1ded5;
  --paper: #f7f4ed;
  --panel: #fffdf8;
  --accent: #d9472f;
  --accent-dark: #ae2d20;
  --forest: #1f4d3a;
  --blue: #245f84;
  --gold: #c98e2b;
  --shadow: 0 18px 50px rgba(37, 33, 24, 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;
  letter-spacing: 0;
}

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

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

img {
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 5vw, 64px);
  border-bottom: 1px solid rgba(24, 23, 19, 0.08);
  background: rgba(247, 244, 237, 0.92);
  backdrop-filter: blur(18px);
}

.brand,
.nav,
.hero-actions,
.toolbar,
.price-row,
.product-meta,
.product-actions,
.dialog-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  min-width: 0;
  font-size: 20px;
  font-weight: 800;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
}

.nav {
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
}

.nav a:hover {
  color: var(--ink);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.header-brand-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid rgba(217, 71, 47, 0.32);
  border-radius: 8px;
  background: rgba(217, 71, 47, 0.08);
  padding: 0 10px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.header-brand-filter select {
  min-width: 170px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
  text-transform: none;
}

.lang-select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 800;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

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

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fffdf8;
  border-color: var(--line);
  color: var(--ink);
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.95fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: clamp(28px, 5vw, 60px) clamp(18px, 5vw, 64px) 28px;
}

.hero-copy h1,
.section-heading h2,
.story-band h2 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 700px;
  font-size: clamp(36px, 4.6vw, 60px);
}

.hero-text {
  max-width: 620px;
  margin: 22px 0 28px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

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

.hero-actions {
  gap: 12px;
  flex-wrap: wrap;
}

.hero-product {
  min-height: 440px;
  border-radius: 12px;
  overflow: hidden;
  background: #e8e3d6;
  box-shadow: var(--shadow);
  position: relative;
}

.hero-product img {
  width: 100%;
  height: 100%;
  min-height: 440px;
  display: block;
  object-fit: cover;
}

.hero-card-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
}

.hero-card-overlay h2 {
  margin: 5px 0 10px;
  font-size: 24px;
  line-height: 1.18;
}

.hero-merchant-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.price-row,
.product-meta {
  gap: 10px;
  flex-wrap: wrap;
}

.price {
  font-weight: 900;
  color: var(--forest);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(217, 71, 47, 0.12);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.category-bar {
  display: flex;
  gap: 10px;
  padding: 0 clamp(18px, 5vw, 64px) 26px;
  overflow-x: auto;
}

.category-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  background: #fffdf8;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.category-chip.active {
  background: var(--ink);
  color: white;
}

.section {
  padding: 48px clamp(18px, 5vw, 64px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading h2,
.story-band h2 {
  font-size: clamp(26px, 3vw, 38px);
}

.section-heading p {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.55;
}

.top-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.top-card,
.product-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.top-card:hover,
.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(24, 23, 19, 0.16);
  box-shadow: 0 14px 32px rgba(37, 33, 24, 0.1);
}

.top-card {
  display: grid;
  grid-template-columns: 40% 1fr;
  min-height: 188px;
  overflow: hidden;
}

.top-card img,
.product-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #ece6da;
}

.top-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.product-card-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
}

.top-card h3,
.product-card h3 {
  margin: 0;
  line-height: 1.25;
}

.top-card p,
.product-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.product-meta span {
  display: inline-flex;
  align-items: center;
}

.product-meta span + span::before {
  content: "·";
  margin: 0 6px;
  color: var(--line);
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 18px clamp(18px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.feature-strip div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: #fffdf8;
}

.feature-strip span {
  color: var(--muted);
  line-height: 1.45;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.blueprint-card {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.blueprint-card h3 {
  margin: 0 0 12px;
  line-height: 1.15;
}

.blueprint-card p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.blueprint-card span {
  display: block;
  margin-top: auto;
  color: var(--forest);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
}

.seo-band {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
  gap: 28px;
  align-items: center;
  margin: 28px clamp(18px, 5vw, 64px);
  padding: 34px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid var(--line);
}

.seo-band h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

.seo-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.seo-pill-grid span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 15px;
  background: rgba(36, 95, 132, 0.1);
  color: var(--blue);
  font-weight: 900;
}

.toolbar {
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar select {
  min-width: 190px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--muted);
}

.search-box input,
.toolbar select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box input {
  min-width: 180px;
}

.toolbar select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fffdf8;
}

.toolbar select:first-of-type {
  min-width: 220px;
  border-color: rgba(217, 71, 47, 0.36);
  background: rgba(217, 71, 47, 0.08);
  font-weight: 900;
}

.brand-filter-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: -8px 0 24px;
  background: var(--line);
}

.brand-filter-summary > div {
  min-width: 0;
  background: #fffdf8;
  padding: 18px;
}

.brand-filter-summary span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-filter-summary strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-filter-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-summary {
  margin: -18px 0 20px;
  color: var(--muted);
  font-size: 14px;
}

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

.product-card {
  overflow: hidden;
}

.product-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.product-card-content {
  min-height: 0;
}

.product-card h3 {
  font-size: 15px;
}

.product-card .price-row {
  margin-top: 2px;
}

.product-card .price,
.top-card .price {
  font-size: 15px;
}

.product-actions {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
  align-items: stretch;
}

.product-actions .primary-button,
.product-actions .secondary-button {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  text-align: center;
  white-space: normal;
}

.story-band {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 30px;
  align-items: center;
  margin: 28px clamp(18px, 5vw, 64px);
  padding: 36px;
  border-radius: 8px;
  background: var(--forest);
  color: white;
}

.story-band .eyebrow {
  color: #f1c76f;
}

.story-band p:last-child {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.7;
  font-size: 18px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(18px, 5vw, 64px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap;
}

.site-footer > div:first-child {
  display: grid;
  gap: 4px;
}

.site-footer > div:first-child span:first-child {
  color: var(--ink);
  font-weight: 900;
}

.footer-brand-logos {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(720px, 100%);
}

.footer-brand-label {
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-logo-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  padding: 4px 11px 4px 5px;
  color: var(--ink);
}

.brand-logo-image,
.brand-logo-pill b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
}

.brand-logo-image {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(24, 23, 19, 0.08);
  background: white;
}

.brand-logo-image img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  background: white;
}

.brand-logo-pill b {
  background: var(--ink);
  color: #fffaf0;
  font-size: 10px;
  letter-spacing: 0;
}

.brand-logo-pill em {
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
}

.loading-card,
.empty-state,
.error-box {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.error-box {
  border: 1px solid rgba(217, 71, 47, 0.22);
  border-radius: 8px;
  background: rgba(217, 71, 47, 0.08);
  color: var(--accent-dark);
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(24, 23, 19, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.product-dialog {
  width: min(920px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(24, 23, 19, 0.3);
}

.product-dialog::backdrop {
  background: rgba(24, 23, 19, 0.48);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
}

.dialog-layout img {
  width: 100%;
  height: 100%;
  min-height: 440px;
  object-fit: cover;
  background: #ece6da;
}

.dialog-copy {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 34px;
}

.dialog-copy h2,
.dialog-copy p {
  margin: 0;
}

.dialog-copy h2 {
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
}

.dialog-copy p {
  color: var(--muted);
  line-height: 1.65;
}

.dialog-actions {
  gap: 10px;
  flex-wrap: wrap;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

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

@media (max-width: 860px) {
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .header-controls {
    width: 100%;
    order: 2;
  }

  .header-brand-filter {
    flex: 1;
  }

  .header-brand-filter select {
    min-width: 0;
    width: 100%;
  }

  .hero-section,
  .seo-band,
  .story-band,
  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
  }

  .hero-copy h1 {
    font-size: clamp(38px, 13vw, 58px);
  }

  .hero-product,
  .hero-product img {
    min-height: 420px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .feature-strip,
  .blueprint-grid,
  .brand-filter-summary {
    grid-template-columns: 1fr;
  }

  .dialog-layout img {
    min-height: 300px;
    max-height: 420px;
  }
}

@media (max-width: 620px) {
  .top-grid {
    grid-template-columns: 1fr;
  }

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

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

  .top-card img {
    aspect-ratio: 4 / 3;
  }

  .toolbar,
  .search-box,
  .toolbar select {
    width: 100%;
  }

  .search-box input {
    min-width: 0;
    width: 100%;
  }

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

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-brand-logos {
    justify-content: flex-start;
  }
}

/* Diagnostic detail inside the API error box */
.error-box code {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.78rem;
  line-height: 1.4;
  max-width: 100%;
  word-break: break-all;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(24, 23, 19, 0.06);
  color: var(--accent-dark);
}

.error-box .error-detail {
  background: rgba(217, 71, 47, 0.12);
}

.error-box .secondary-button {
  margin-top: 4px;
}
