:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --fg: #0a0a0a;
  --fg-soft: #555;
  --muted: #888;
  --line: #e7e7e7;
  --line-strong: #cfcfcf;
  --accent: #000;
  --danger: #b3261e;
  --success: #0a7d3b;
  --warn: #b07a00;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "GT Sectra", "Playfair Display", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1280px;
  --gutter: clamp(1rem, 4vw, 2.5rem);

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;

  --t-fast: 120ms cubic-bezier(0.2, 0, 0, 1);
  --t-base: 200ms cubic-bezier(0.2, 0, 0, 1);
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p  { margin: 0 0 1em; }
small, .small { font-size: 0.85rem; color: var(--fg-soft); }
.muted { color: var(--muted); }

/* ===== Layout primitives ===== */

.container {
  max-width: var(--maxw);
  padding: 0 var(--gutter);
  margin: 0 auto;
}

.stack > * + * { margin-top: var(--stack, 1rem); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.row { display: flex; gap: 1rem; align-items: center; }
.spacer { flex: 1; }

/* ===== Header / nav ===== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem var(--gutter);
  max-width: var(--maxw);
  margin: 0 auto;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.4rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  color: var(--fg);
}

.brand-mark em {
  font-style: italic;
  color: var(--muted);
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 1.75rem;
  font-size: 0.95rem;
}

.nav a {
  text-decoration: none;
  color: var(--fg);
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--t-fast);
}

.nav a::after {
  content: "";
  position: absolute;
  inset: auto 0 -2px 0;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--t-base);
}

.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0.5rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto 0;
    flex-direction: column;
    background: var(--bg);
    padding: 1rem var(--gutter) 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
  }
  .nav.is-open { display: flex; }
  .nav-toggle { display: block; }
}

/* ===== Hero ===== */

.hero {
  padding: clamp(2rem, 6vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
}

.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero__lede {
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  color: var(--fg-soft);
  max-width: 60ch;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: var(--bg);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: transform var(--t-fast), background var(--t-fast), color var(--t-fast);
}

.btn:hover { transform: translateY(-1px); background: #1f1f1f; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--ghost {
  background: transparent;
  color: var(--fg);
}
.btn--ghost:hover { background: var(--bg-soft); }

.btn--small { padding: 0.45rem 0.85rem; font-size: 0.825rem; }

/* ===== Product grid ===== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(1rem, 2vw, 2rem);
  padding: clamp(2rem, 4vw, 3rem) 0;
}

.product-card {
  text-decoration: none;
  color: var(--fg);
  display: block;
  transition: transform var(--t-base);
}

.product-card:hover .product-card__image { transform: scale(1.02); }
.product-card:hover .product-card__name { color: var(--accent); }

.product-card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  margin-bottom: 0.85rem;
}

.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2, 0, 0, 1);
}

.product-card__brand {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.product-card__name {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  line-height: 1.4;
  transition: color var(--t-fast);
}

.product-card__price {
  font-size: 0.9rem;
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}

/* ===== Product detail ===== */

.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding: clamp(1.5rem, 3vw, 3rem) 0;
}

@media (min-width: 880px) {
  .product-detail { grid-template-columns: 1.3fr 1fr; gap: 4rem; }
}

.product-gallery {
  display: grid;
  gap: 0.75rem;
}

.product-gallery__main {
  aspect-ratio: 4 / 5;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  overflow: hidden;
}

.product-gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.5rem;
}

.product-gallery__thumb {
  aspect-ratio: 1;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  transition: border-color var(--t-fast);
}

.product-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-gallery__thumb[aria-current="true"] { border-color: var(--fg); }

.product-meta__brand {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.product-meta__name {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1rem;
}

.product-meta__price {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.product-meta__description {
  color: var(--fg-soft);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.product-meta__source {
  font-size: 0.85rem;
}

/* ===== Brand directory ===== */

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: clamp(2rem, 4vw, 3rem) 0;
}

.brand-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--fg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color var(--t-fast), transform var(--t-fast);
}

.brand-card:hover {
  border-color: var(--fg);
  transform: translateY(-2px);
}

.brand-card__logo {
  height: 56px;
  width: 56px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-card__logo img { object-fit: contain; max-height: 100%; max-width: 100%; }

.brand-card__name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
}

.brand-card__origin {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--muted);
}

/* ===== Forms ===== */

.form {
  display: grid;
  gap: 1.25rem;
  max-width: 560px;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field__label {
  font-size: 0.85rem;
  font-weight: 500;
}

.field__hint { font-size: 0.78rem; color: var(--muted); }

.input, .textarea, .select {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 0.95rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

.textarea { min-height: 140px; resize: vertical; line-height: 1.5; }

.honeypot {
  position: absolute !important;
  left: -9999px !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  opacity: 0;
}

.form-status {
  padding: 0.85rem 1rem;
  border-radius: var(--r-sm);
  font-size: 0.9rem;
}
.form-status--ok    { background: #ebf6ee; color: var(--success); }
.form-status--err   { background: #fbecea; color: var(--danger); }

/* ===== Pagination ===== */

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0 4rem;
  font-variant-numeric: tabular-nums;
}

.pagination .btn { min-width: 6rem; }

/* ===== Skeletons ===== */

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 0%, #f0f0f0 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card .product-card__media { animation: shimmer 1.4s infinite; background-size: 200% 100%; background: linear-gradient(90deg, var(--bg-soft), #f0f0f0, var(--bg-soft)); background-size: 200% 100%; }

/* ===== Footer ===== */

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  color: var(--fg-soft);
  font-size: 0.85rem;
}

.site-footer__inner {
  max-width: var(--maxw);
  padding: 0 var(--gutter);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer a { text-decoration: none; color: var(--fg-soft); margin-right: 1.25rem; }
.site-footer a:hover { color: var(--fg); }

/* ===== Toast ===== */

.toast-host {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 999;
  display: grid;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--fg);
  color: var(--bg);
  padding: 0.85rem 1.1rem;
  border-radius: var(--r-md);
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  font-size: 0.88rem;
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  animation: toast-in 220ms cubic-bezier(0.2, 0, 0, 1);
}

.toast--err  { background: var(--danger); }
.toast--ok   { background: var(--success); }

@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ===== Empty / loading states ===== */

.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

/* ===== Account link ===== */

.account-link {
  font-weight: 500;
}

/* ===== Search bar ===== */

.search-bar {
  padding: 1.5rem 0 0;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  padding-left: 2.5rem;
  height: 42px;
  font-size: 0.95rem;
  border-radius: var(--r-md);
}

.search-form .btn {
  height: 42px;
  white-space: nowrap;
}

.search-meta {
  font-size: 0.85rem;
  color: var(--fg-soft);
  margin-top: 0.5rem;
}

/* ===== Reactions bar ===== */

.reactions-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--fg-soft);
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}

.reaction-btn:hover {
  border-color: var(--fg);
  color: var(--fg);
}

.reaction-btn.is-active {
  border-color: var(--fg);
  color: var(--fg);
  background: var(--bg-soft);
}

.reaction-btn--fav.is-active {
  color: var(--danger);
  border-color: var(--danger);
}

/* ===== Reviews ===== */

.review {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.review:last-child {
  border-bottom: none;
}

.review__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.review__stars {
  color: #e6a817;
  letter-spacing: 0.05em;
}

.review__body {
  color: var(--fg-soft);
  line-height: 1.6;
  font-size: 0.92rem;
}

/* ===== Star rating input ===== */

.star-rating {
  display: flex;
  gap: 0.25rem;
}

.star {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--line-strong);
  transition: color var(--t-fast), transform var(--t-fast);
}

.star.is-active,
.star.is-hover {
  color: #e6a817;
}

.star:hover {
  transform: scale(1.2);
}

/* ===== Unavailable badge ===== */

.product-card__brand + .product-card__name {
  font-size: 0.95rem;
}

/* ===== Empty / loading states ===== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
