/* ===== NestHaus — tokens, base, shared components, shop page =====
   /admin loads this file too, so tokens, .btn and .chip live here once. */

:root {
  --brown-950: #2c150c;
  --brown-900: #3a1c10;
  --brown-800: #5c2e1a;
  --brown-700: #6e3a21;
  --gold-600: #8f5a1f; /* AA-contrast gold for text on light backgrounds */
  --gold-500: #b8894f;
  --gold-300: #ddc094;
  --cream-100: #fbf7f0;
  --cream-200: #f5ede0;
  --cream-300: #ece0cc;
  --ink: #241a13;
  --white: #ffffff;
  --danger: #8b1c1c;

  --font-display: "Cormorant Garamond", "Cormorant Fallback", Georgia, serif;
  --font-body: "Jost", "Jost Fallback", Arial, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --gutter: clamp(16px, 4vw, 32px);
  --section: clamp(24px, 5vw, 48px);

  --radius-sm: 4px;
  --radius: 8px;
  --radius-pill: 999px;
  --shadow: 0 14px 32px -22px rgba(44, 21, 12, 0.45);

  --header-h: 60px;
  --z-sticky: 20;
  --z-toast: 50;

  --container: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Fonts — self-hosted variable woff2, Latin only =====
   The fallbacks are scaled so the swap from system font to web font barely moves the layout. */
@font-face { font-family: "Jost"; src: url("/fonts/jost-latin.woff2") format("woff2"); font-weight: 300 600; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Jost Fallback"; src: local("Arial"); size-adjust: 94%; ascent-override: 106%; }
@font-face { font-family: "Cormorant Fallback"; src: local("Georgia"); size-adjust: 86%; ascent-override: 108%; }

/* ===== Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; accent-color: var(--brown-800); caret-color: var(--brown-800); }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--cream-100);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
[hidden] { display: none !important; }
::selection { background: var(--gold-300); color: var(--brown-950); }
:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--white) inset; -webkit-text-fill-color: var(--ink); }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; color: var(--brown-900); line-height: 1.15; }

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

/* ===== Button ===== */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 12px 24px;
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.btn-sm { padding: 8px 14px; font-size: 11.5px; letter-spacing: 0.08em; }
.btn-primary { background: var(--brown-800); color: var(--cream-100); border-color: var(--brown-800); }
.btn-primary:hover { background: var(--brown-950); border-color: var(--brown-950); }
.btn-outline { background: transparent; color: var(--brown-900); border-color: var(--brown-800); }
.btn-outline:hover { background: var(--brown-900); color: var(--cream-100); border-color: var(--brown-900); }
.btn:disabled { opacity: 0.55; pointer-events: none; }

/* ===== Chip (filters, pickers) ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  position: relative;
  font: inherit; font-size: 13px; white-space: nowrap;
  padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer;
  border: 1px solid var(--cream-300); background: var(--white); color: var(--brown-800);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.chip:hover { border-color: var(--gold-500); }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip:has(input:checked) {
  background: var(--brown-800); border-color: var(--brown-800); color: var(--cream-100);
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.chip .count { opacity: 0.6; margin-left: 4px; }
.chip-sm { font-size: 12px; padding: 3px 10px; }

/* ===== Shell: header + footer ===== */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--white);
  border-bottom: 1px solid var(--cream-300);
}
.header-row { display: flex; align-items: center; gap: var(--space-5); height: var(--header-h); }
.main-nav { margin-left: clamp(24px, 4vw, 64px); }
.brand { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.brand img { width: 34px; height: 35px; }
.brand strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--brown-900); }
.main-nav { display: flex; gap: clamp(20px, 2.6vw, 36px); font-size: 14px; letter-spacing: 0.02em; }
.main-nav a { color: var(--brown-700); transition: color 0.2s ease; }
.main-nav a:hover, .main-nav a:first-child { color: var(--gold-600); }

.search {
  display: flex; align-items: center; margin-left: auto;
  width: min(320px, 100%); height: 38px;
  border: 1px solid var(--cream-300); border-radius: var(--radius-sm); background: var(--cream-100);
}
.search:focus-within { border-color: var(--gold-500); }
.search input {
  flex: 1; min-width: 0; height: 100%; padding: 0 var(--space-3);
  font: inherit; font-size: 13.5px; color: var(--ink); background: transparent; border: none; outline: none;
}
.search input::-webkit-search-cancel-button { filter: sepia(1) hue-rotate(-20deg); }
.search button {
  width: 38px; height: 38px; flex-shrink: 0; margin: -1px -1px -1px 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--brown-900); color: var(--cream-100); cursor: pointer;
}
.icon-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--cream-300); color: var(--brown-800);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.icon-btn:hover { background: var(--brown-800); border-color: var(--brown-800); color: var(--cream-100); }

.site-footer { background: var(--brown-950); color: var(--cream-300); font-size: 13.5px; margin-top: var(--section); }
.site-footer .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-5); }
.site-footer a { color: var(--gold-300); }
.site-footer a:hover { color: var(--cream-100); }

h2 { font-size: clamp(24px, 3vw, 30px); }
.eyebrow { font-size: 11.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-600); font-weight: 600; margin-bottom: var(--space-3); }
.link-arrow { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brown-900); border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.link-arrow:hover { color: var(--gold-600); }

/* ===== Hero slider — light room photo, copy on a soft cream fade ===== */
.hero {
  position: relative; overflow: hidden;
  height: clamp(540px, calc(100svh - var(--header-h)), 780px);
  background: var(--cream-100);
}
.hero-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 0.9s ease, visibility 0.9s; }
.hero-slide.is-active { opacity: 1; visibility: visible; }
.hero-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 70% center;
  transform: scale(1.04); transition: transform 6s ease-out;
}
.hero-slide.is-active .hero-bg { transform: scale(1); }
.hero-slide::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(251, 247, 240, 0.94) 0%, rgba(251, 247, 240, 0.8) 32%, rgba(251, 247, 240, 0) 62%);
}
.hero-copy {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding-bottom: 64px;
}
.hero-copy > * { max-width: 460px; opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s var(--ease); }
.hero-slide.is-active .hero-copy > * { opacity: 1; transform: none; }
.hero-slide.is-active .hero-copy > :nth-child(2) { transition-delay: 0.08s; }
.hero-slide.is-active .hero-copy > :nth-child(3) { transition-delay: 0.16s; }
.hero-slide.is-active .hero-copy > :nth-child(4) { transition-delay: 0.24s; }
.hero-slide.is-active .hero-copy > :nth-child(5) { transition-delay: 0.32s; }
.hero .eyebrow { font-size: 11px; letter-spacing: 0.18em; color: var(--brown-700); margin-bottom: var(--space-2); }
.hero h1, .hero h2 {
  font-family: var(--font-body); font-weight: 300;
  font-size: clamp(36px, 4.6vw, 58px); line-height: 1.05; letter-spacing: -0.01em;
  color: var(--brown-700); opacity: 0.85;
  margin-bottom: var(--space-3);
}
.hero h1 strong, .hero h2 strong { font-weight: 400; color: var(--ink); }
.hero h1, .hero h2 { margin-bottom: var(--space-5); }

.btn-pill { border-radius: var(--radius-pill); padding: 10px 22px; font-size: 11.5px; background: var(--brown-800); color: var(--cream-100); border-color: var(--brown-800); }
.btn-pill:hover { background: var(--brown-950); border-color: var(--brown-950); }

.hero-ui {
  position: absolute; left: 0; right: 0; bottom: clamp(20px, 4vw, 40px); z-index: 2;
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-5);
  pointer-events: none;
}
.hero-ui > * { pointer-events: auto; }
.hero-nav { display: flex; align-items: center; gap: var(--space-4); }
.round-btn {
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; line-height: 1; padding-bottom: 2px;
  border: 1px solid var(--brown-700); background: transparent; color: var(--brown-800);
  transition: background 0.2s ease, color 0.2s ease;
}
.round-btn:hover { background: var(--brown-800); color: var(--cream-100); }
.hero-dots { display: flex; gap: 10px; }
.hero-dots button {
  width: 6px; height: 6px; padding: 0; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(110, 58, 33, 0.3); transition: background 0.2s ease, transform 0.2s ease;
}
.hero-dots button[aria-selected="true"] { background: var(--brown-800); transform: scale(1.3); }


/* ===== Categories ===== */
.categories { display: grid; grid-template-columns: 200px 1fr; gap: var(--space-5); padding-top: var(--section); }
.cat-intro h2 { margin-bottom: var(--space-3); }
.cat-intro h2::after { content: ""; display: block; width: 36px; height: 2px; background: var(--gold-500); margin-top: var(--space-3); }
.cat-total { display: flex; align-items: center; gap: var(--space-2); color: var(--brown-700); font-size: 13px; margin-bottom: var(--space-4); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-4); }
.cat-card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  font: inherit; color: inherit; background: var(--white);
  border: 1px solid var(--cream-300); border-radius: var(--radius);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.cat-card:hover { border-color: var(--gold-500); transform: translateY(-2px); }
.cat-card img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: var(--cream-300); }
.cat-card span { padding: var(--space-3); font-size: 14px; font-weight: 500; }
.cat-card small { display: block; font-size: 12px; font-weight: 400; color: var(--brown-700); }

/* ===== Products ===== */
.shop { padding-top: var(--section); scroll-margin-top: var(--header-h); }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.shop-head h2::after { content: ""; display: block; width: 36px; height: 2px; background: var(--gold-500); margin-top: var(--space-2); }
.tabs { display: flex; gap: var(--space-5); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 6px 0; font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer;
  color: var(--brown-700); background: none; border: none; border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 500; border-bottom-color: var(--brown-900); }
.search-note { margin: calc(-1 * var(--space-3)) 0 var(--space-4); color: var(--brown-700); font-size: 14px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6) var(--space-5);
}
.product { display: flex; flex-direction: column; }
.product-img { display: block; width: 100%; padding: 0; border: none; cursor: pointer; aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--radius); background: var(--cream-200); }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.product:hover .product-img img { transform: scale(1.04); }
.product-body { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); padding-top: var(--space-3); }
.product-cat { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-600); }
.product-name { font-family: var(--font-body); font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.3; }
.product-name button { font: inherit; color: inherit; background: none; border: none; padding: 0; text-align: left; cursor: pointer; }
.product-name button:hover { color: var(--gold-600); }
.product-price { margin-top: 2px; font-weight: 600; color: var(--brown-900); }
.product-price span { font-weight: 400; font-size: 12.5px; color: var(--brown-700); margin-left: 4px; }

.cart-btn {
  flex-shrink: 0; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brown-800); color: var(--cream-100);
  transition: background 0.2s ease, transform 0.2s ease;
}
.cart-btn:hover { background: var(--gold-500); transform: translateY(-1px); }

.skeleton { animation: skeleton-pulse 1.4s ease-in-out infinite; }
.product.skeleton .product-body { height: 56px; }
@keyframes skeleton-pulse { 50% { opacity: 0.5; } }

.grid-message { grid-column: 1 / -1; padding: var(--space-6) var(--space-4); text-align: center; color: var(--brown-700); }

/* ===== Product details window ===== */
.product-dialog {
  width: min(880px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 0;
  border: none; border-radius: var(--radius); background: var(--cream-100); color: var(--ink);
  box-shadow: 0 30px 80px -30px rgba(28, 14, 8, 0.6); overflow: auto;
}
.product-dialog[open] { display: grid; grid-template-columns: 1fr 1fr; }
.product-dialog::backdrop { background: rgba(20, 10, 6, 0.6); }
.pd-media img { width: 100%; height: 100%; min-height: 100%; object-fit: cover; aspect-ratio: 1; }
.pd-info { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6) var(--space-5); }
.pd-info h2 { font-size: clamp(24px, 3vw, 32px); }
.pd-price { font-size: 20px; font-weight: 600; color: var(--brown-900); margin-top: calc(-1 * var(--space-2)); }
.pd-price span { font-size: 13px; font-weight: 400; color: var(--brown-700); margin-left: 6px; }
.pd-options { display: flex; flex-direction: column; gap: var(--space-4); }
.pd-options:empty { display: none; }
.pd-option { border: none; }
.pd-option legend { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--brown-700); margin-bottom: var(--space-2); }
.pd-error { color: var(--danger); font-size: 14px; }
.pd-order { align-self: flex-start; margin-top: auto; }
.dialog-close {
  position: absolute; top: var(--space-3); right: var(--space-3); z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--white); color: var(--brown-900); font-size: 22px; line-height: 1; box-shadow: var(--shadow);
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .main-nav { display: none; }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .categories { grid-template-columns: 1fr; }
  .cat-intro { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); }
  .cat-intro h2 br { display: none; }
  .cat-intro h2 { margin-bottom: 0; }
  .cat-total { display: none; }
}
@media (max-width: 760px) {
  .product-dialog[open] { grid-template-columns: 1fr; width: calc(100vw - 24px); }
  .pd-media img { aspect-ratio: 4 / 3; }
  .pd-info { padding: var(--space-5) var(--space-4); }
  .header-row { gap: var(--space-3); }
  .brand strong { font-size: 20px; }
  .hero { height: auto; }
  .hero-slide { position: relative; display: none; }
  .hero-slide.is-active { display: block; }
  .hero-slide::after { display: none; }
  .hero-bg { position: relative; height: auto; aspect-ratio: 4 / 3; object-position: 72% center; }
  .hero-copy { height: auto; padding: var(--space-5) var(--gutter) 84px; }
  .hero-ui { bottom: var(--space-5); }
  .cat-grid { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 42%; overflow-x: auto; scrollbar-width: none; }
  .cat-grid::-webkit-scrollbar { display: none; }
}
@media (max-width: 600px) {
  .search { width: auto; flex: 1; min-width: 0; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-5) var(--space-3); }
  .product-name { font-size: 14px; }
  .product-cat { display: none; }
  .cart-btn { width: 36px; height: 36px; }
  .shop-head .btn { display: none; }
  .tabs { width: 100%; order: 3; }
}

@media (max-width: 420px) {
  .brand strong { display: none; }
  .hero h1, .hero h2 { font-size: 34px; }
  .categories, .shop { padding-top: var(--space-6); }
}

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