/* ============================================================
   Fentucci — fentucci.com
   Natural fiber wallcovering storefront
   DW-family design system: earthy naturals palette
   ============================================================ */

/* ── Design tokens ───────────────────────────────────────────── */
:root {
  /* Palette — earthy naturals / grasscloth warmth */
  --bg:          #faf7f2;
  --ink:         #1c1a17;
  --ink-soft:    #5a5448;
  --ink-faint:   #8a8075;
  --line:        rgba(28, 26, 23, 0.10);
  --card-bg:     #ffffff;
  --header-bg:   rgba(250, 247, 242, 0.94);

  /* Brand accent — warm khaki/earth */
  --accent:      #8B6F47;
  --accent-dark: #6b5235;
  --accent-bg:   #f4ede4;

  /* Functional */
  --hover-bg:    #f0ebe3;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --radius-sm:   4px;
  --radius-md:   8px;

  /* Layout */
  --container:   1280px;
  --cols:        4;
}

/* ── Dark mode overrides ──────────────────────────────────────── */
[data-theme="dark"] {
  --bg:          #141210;
  --ink:         #f0ece3;
  --ink-soft:    #b6ad9a;
  --ink-faint:   #7a7365;
  --line:        rgba(240, 236, 227, 0.12);
  --card-bg:     #1d1a16;
  --header-bg:   rgba(20, 18, 16, 0.94);
  --hover-bg:    #221e18;
  --accent-bg:   #2a2219;
}

/* accent + status stays constant across themes */

/* ── Reset + base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: light dark; scroll-behavior: smooth; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ── Container ────────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  line-height: 1;
}
.brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.site-nav a {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--accent); }

/* ── Dark/light toggle ────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: color 0.15s, background 0.15s;
}
.theme-toggle:hover { background: var(--hover-bg); color: var(--ink); }
/* Show sun in dark, moon in light */
html:not([data-theme="dark"]) .icon-sun { display: none; }
html[data-theme="dark"]       .icon-moon { display: none; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--hover-bg); }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #3d2f1e 0%, #6b5235 40%, #8B6F47 70%, #b8956a 100%);
  z-index: 0;
}
/* Product images rotate in via JS */
.hero-bg.has-images { background: none; }
.hero-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hero-bg img.active { opacity: 1; }

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 5rem 2rem 4rem;
  /* Stronger scrim — the room renders vary from very light (straw/ivory) to
     dark (jute blue), so the wordmark needs a reliable contrast floor. */
  background: linear-gradient(to top, rgba(18,15,11,0.82) 0%, rgba(18,15,11,0.55) 38%, rgba(18,15,11,0.18) 72%, transparent 100%);
}
.hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.82);
  margin-bottom: 0.6rem;
  text-shadow: 0 1px 6px rgba(0,0,0,0.45);
}
.hero-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 600;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55), 0 1px 3px rgba(0,0,0,0.4);
}
.hero-tagline {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: rgba(255,255,255,0.92);
  margin-bottom: 2rem;
  text-shadow: 0 1px 10px rgba(0,0,0,0.5);
}
.hero-ctas {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
/* Ghost CTA sits on the (often dark) hero image — force light treatment so it
   stays legible regardless of which room render is showing. */
.hero-ctas .btn-ghost {
  color: #fff;
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(2px);
}
.hero-ctas .btn-ghost:hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.85);
  color: #fff;
}
.hero-service {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.62);
  letter-spacing: 0.03em;
}

/* ── Brand statement ──────────────────────────────────────────── */
.brand-statement {
  padding: 4rem 0;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.brand-statement h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 400;
  margin-bottom: 1rem;
}
.brand-statement p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ── Catalog section ──────────────────────────────────────────── */
.catalog-section {
  padding: 3rem 0 5rem;
}

/* Controls bar */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.search-wrap { flex: 1; min-width: 200px; }
.search-input {
  width: 100%;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--ink-faint); }

.sort-density-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}
.ctrl-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ctrl-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}
.ctrl-select:focus { border-color: var(--accent); }

.density-slider {
  width: 90px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Results meta */
.results-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin-bottom: 1.25rem;
}

/* ── Product grid ─────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 1.25rem;
}

/* Grid loading */
.grid-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem;
  color: var(--ink-soft);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Product card */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s;
}
.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-image-wrap {
  position: relative;
  aspect-ratio: 3/4;
  background: var(--accent-bg);
  overflow: hidden;
}
.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.product-card:hover .card-img { transform: scale(1.04); }
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.card-body {
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}
.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sku {
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-family: 'Inter', monospace;
  letter-spacing: 0.04em;
}
.card-price {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: auto;
  padding-top: 0.4rem;
}
.card-price .sample-price { color: var(--accent); font-weight: 600; }
.card-actions {
  padding: 0 0.9rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.card-btn {
  display: block;
  text-align: center;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background 0.15s, color 0.15s;
}
.card-btn-sample {
  background: var(--accent-bg);
  color: var(--accent-dark);
  border: 1px solid var(--accent);
}
.card-btn-sample:hover { background: var(--accent); color: #fff; }
.card-btn-shop {
  background: var(--hover-bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.card-btn-shop:hover { background: var(--hover-bg); color: var(--ink); }

/* Empty / no results */
.grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem;
  color: var(--ink-soft);
}
.grid-empty h3 { margin-bottom: 0.5rem; font-weight: 500; }

/* ── Pagination / infinite scroll ─────────────────────────────── */
.pagination {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2.5rem;
}
/* Invisible IntersectionObserver trigger near the grid bottom */
.infinite-sentinel { width: 100%; height: 1px; }
.load-more-btn {
  padding: 0.7rem 2rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  background: var(--accent-bg);
  color: var(--accent-dark);
  transition: background 0.15s, color 0.15s;
}
.load-more-btn:hover { background: var(--accent); color: #fff; }
.infinite-loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 1rem 0;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; margin: 0; }
.infinite-end {
  color: var(--ink-faint);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 1.25rem 0;
}

/* ── Footer ───────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0;
  margin-top: 2rem;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.footer-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  display: block;
  letter-spacing: 0.05em;
}
.footer-tagline {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a { font-size: 0.85rem; color: var(--ink-soft); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { font-size: 0.78rem; color: var(--ink-faint); }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 2rem;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-md);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--hover-bg); }
.modal-box h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}
.modal-intro { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 1.5rem; }

.form-row { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.form-row label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.03em; }
.form-row input, .form-row textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s;
  outline: none;
}
.form-row input:focus, .form-row textarea:focus { border-color: var(--accent); }
.form-row textarea { resize: vertical; min-height: 70px; }
.form-row-inline { flex-direction: row; gap: 0.75rem; }
.form-row-inline > div { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.form-row-inline > div:first-child { flex: 2; }
.form-row-inline label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.form-row-inline input { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; font-size: 0.9rem; outline: none; }
.form-row-inline input:focus { border-color: var(--accent); }
.form-submit { width: 100%; margin-top: 0.5rem; }
.form-status { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.75rem; min-height: 1.2em; text-align: center; }
.form-status.success { color: #1f6f3e; }
.form-status.error   { color: #b94a48; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1100px) { :root { --cols: 3; } }
@media (max-width: 780px) {
  :root { --cols: 2; }
  .site-header { padding: 0.75rem 1rem; }
  .container { padding: 0 1rem; }
  .controls-bar { flex-direction: column; align-items: stretch; }
  .sort-density-wrap { flex-wrap: wrap; gap: 0.4rem; }
  .hero-content { padding: 3rem 1rem 2.5rem; }
}
@media (max-width: 480px) {
  :root { --cols: 1; }
  .hero-ctas { flex-direction: column; }
  .footer-links { flex-direction: column; gap: 0.6rem; }
}

/* ── Utility ──────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
