/* Natural Textile Wallpaper — Loro Piana heirloom mill aesthetic
   Warm cream/oatmeal/charcoal — Montserrat (futura-feel) + Cormorant Garamond
   Dark/light toggle: only surface vars flip; accents constant */

:root {
  --bg:        #f5ede0;        /* warm oatmeal */
  --ink:       #1e1810;        /* deep charcoal */
  --ink-soft:  #6b5f52;        /* warm mid-tone */
  --ink-faint: #a89b8a;        /* muted stone */
  --line:      rgba(30,24,16,0.10);
  --card-bg:   #fdf8f1;        /* cream white */
  --header-bg: rgba(245,237,224,0.96);
  --accent:    #8b6f47;        /* warm oak */
  --accent-soft: #c4a27a;      /* sand dune */
  --accent-deep: #5c3d1e;      /* dark bark */
  --pill-bg:   rgba(139,111,71,0.10);
  --pill-active-bg: #8b6f47;
  --pill-active-ink: #fdf8f1;
  --card-min:  220px;          /* density slider target */
  --sans: 'Montserrat', -apple-system, system-ui, sans-serif;
  --serif: 'Cormorant Garamond', 'Playfair Display', Georgia, serif;
  --radius: 2px;               /* restraint — almost no rounding, like a swatchbook */
}

[data-theme="dark"] {
  --bg:        #1a1410;
  --ink:       #f0e8d8;
  --ink-soft:  #c0a98a;
  --ink-faint: #7a6a55;
  --line:      rgba(240,232,216,0.12);
  --card-bg:   #231e17;
  --header-bg: rgba(26,20,16,0.96);
  --pill-bg:   rgba(196,162,122,0.15);
  --pill-active-bg: #c4a27a;
  --pill-active-ink: #1a1410;
}

html { background: var(--bg); color-scheme: light dark; }
html[data-theme="dark"] { color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}
a { color: inherit; text-decoration: none; }

/* ---- HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.brand-mark {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.25;
}
.brand-sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-link {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.15s;
}
.nav-link:hover { color: var(--ink); }

/* ---- THEME TOGGLE ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---- SEARCH BAR ---- */
.search-bar-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 32px 0;
}
.search-form { width: 100%; }
.search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: var(--ink-faint);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 36px 10px 38px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--ink-faint); }
.search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 14px;
  padding: 4px;
}
.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ctrl-select {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  appearance: none;
  min-width: 130px;
}
.density-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-faint);
}
.density-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.density-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ---- MATERIAL PILLS ---- */
.material-pills {
  max-width: 1400px;
  margin: 16px auto 0;
  padding: 0 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  padding: 6px 16px;
  background: var(--pill-bg);
  border: 1px solid transparent;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.pill:hover {
  background: var(--pill-active-bg);
  color: var(--pill-active-ink);
}
.pill-active {
  background: var(--pill-active-bg);
  color: var(--pill-active-ink);
  border-color: transparent;
}

/* ---- HERO ---- */
.hero {
  position: relative;
  height: 70vh;
  min-height: 480px;
  max-height: 700px;
  overflow: hidden;
  margin-top: 24px;
}
.hero-image-wrap {
  position: absolute;
  inset: 0;
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(0.85) brightness(0.88);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20,16,10,0.1) 0%, rgba(20,16,10,0.55) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 60px 60px;
  max-width: 900px;
}
.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  margin: 0 0 14px;
  font-weight: 400;
}
.hero-headline {
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 80px);
  font-weight: 300;
  color: #f0e8d8;
  margin: 0 0 16px;
  line-height: 1.08;
  letter-spacing: -0.01em;
}
.hero-sub {
  font-size: 14px;
  color: rgba(240,232,216,0.80);
  margin: 0 0 28px;
  line-height: 1.7;
  max-width: 500px;
  font-weight: 300;
  letter-spacing: 0.02em;
}
.hero-cta {
  display: inline-block;
  padding: 12px 28px;
  background: transparent;
  border: 1px solid rgba(240,232,216,0.7);
  color: #f0e8d8;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 0.2s;
  width: fit-content;
}
.hero-cta:hover {
  background: rgba(240,232,216,0.15);
  border-color: #f0e8d8;
}

/* ---- CATALOG ---- */
.catalog-wrap {
  max-width: 1400px;
  margin: 32px auto 0;
  padding: 0 32px;
}
.catalog-meta {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
  height: 18px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 220px), 1fr));
  gap: 2px;
}
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  z-index: 1;
}
.card-img-wrap {
  aspect-ratio: 1 / 1.1;
  overflow: hidden;
  background: var(--line);
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.product-card:hover .card-img { transform: scale(1.04); }
.card-info {
  padding: 12px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.card-material {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.card-title {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 400;
  letter-spacing: 0.01em;
}
.card-price {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
  font-weight: 500;
}
.sample-cta {
  display: block;
  padding: 8px 12px;
  background: transparent;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}
.sample-cta:hover {
  background: var(--accent);
  color: var(--card-bg);
}

/* ---- GRID END + LOADER ---- */
.grid-sentinel { height: 1px; }
.grid-end {
  text-align: center;
  padding: 48px 0;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.grid-loader {
  display: none;
  justify-content: center;
  padding: 32px 0;
}
.loader-dots { display: flex; gap: 6px; }
.loader-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-soft);
  animation: dot-blink 1.2s infinite;
}
.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-blink {
  0%,80%,100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ---- DETAIL PAGE ---- */
.detail-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}
.breadcrumb {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 32px;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 60px;
  align-items: start;
}
.detail-images {}
.detail-hero-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--line);
}
.detail-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.detail-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--line);
  opacity: 0.75;
  transition: opacity 0.15s;
}
.detail-thumb:hover { opacity: 1; }
.detail-info { padding-top: 8px; }
.detail-material-pill {
  display: inline-block;
  padding: 4px 12px;
  background: var(--pill-bg);
  border-radius: 20px;
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 16px;
}
.detail-title {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 300;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.detail-vendor {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 16px;
}
.detail-price {
  font-size: 18px;
  color: var(--ink);
  margin: 0 0 24px;
}
.detail-ctas {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
}
.btn-primary {
  display: block;
  padding: 14px 24px;
  background: var(--accent);
  color: #fdf8f1;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-deep); }
.btn-secondary {
  display: block;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius);
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.detail-spec-panel {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 16px;
  align-items: baseline;
}
.spec-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
  margin: 0;
}
.spec-value {
  font-size: 13px;
  color: var(--ink);
  margin: 0;
}
.spec-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.spec-tag {
  padding: 2px 8px;
  background: var(--pill-bg);
  border-radius: 10px;
  font-size: 11px;
  color: var(--ink-soft);
}
.detail-sample-note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.7;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.detail-back { margin-top: 48px; }
.back-link {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.back-link:hover { text-decoration: underline; }

/* ---- FOOTER ---- */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  background: var(--card-bg);
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink);
}
.footer-tagline {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}
.footer-links a {
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--accent); }
.footer-legal {
  width: 100%;
  font-size: 11px;
  color: var(--ink-faint);
  margin: 0;
  line-height: 1.6;
}
.footer-legal a { color: var(--accent); }

/* ---- LOADING TEXT ---- */
.loading-text { color: var(--ink-faint); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .header-inner { padding: 0 16px; }
  .header-nav .nav-link:not(:last-child):not(:nth-last-child(2)) { display: none; }
  .catalog-wrap, .search-bar-wrap, .material-pills, .detail-wrap { padding-left: 16px; padding-right: 16px; }
  .detail-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-content { padding: 0 24px 40px; }
  .footer-inner { padding: 24px 16px; }
}
@media (max-width: 600px) {
  .product-grid { gap: 1px; }
  .controls-row { flex-wrap: wrap; }
  .density-wrap { display: none; }
}
