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

:root {
  --bg: #faf9f7;
  --surface: #fff;
  --border: rgba(0,0,0,0.1);
  --border-light: rgba(0,0,0,0.06);
  --text: #1a1208;
  --text-muted: #7a6f63;
  --text-hint: #b0a699;
  --accent: #c0614a;
  --accent-bg: rgba(192,97,74,0.08);
  --accent-border: rgba(192,97,74,0.25);
  --hero-bg: #130805;
  --radius: 8px;
  --radius-lg: 12px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Nav */
.site-nav {
  background: var(--hero-bg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: #fff;
  font-weight: 500;
}
.nav-logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.01em;
}
.nav-logo-text em {
  font-style: italic;
  color: var(--accent);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.nav-link {
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-link-cta {
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  margin-left: 8px;
}
.nav-link-cta:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.35); }
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.7);
  border-radius: 2px;
  transition: all 0.2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero */
.hero {
  background: var(--hero-bg);
  padding: 2.5rem 2rem 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(192,97,74,0.04) 40px, rgba(192,97,74,0.04) 41px);
  pointer-events: none;
}
.hero-inner { max-width: 1200px; margin: 0 auto; position: relative; }
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 400;
  color: #fff;
  line-height: 1.15;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero-sub { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 0.4rem; }

/* Filter bar */
.filter-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

/* Centred inner container — matches results-area width */
.filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Search row */
.search-row { display: flex; gap: 8px; align-items: center; }
.search-input-wrap { flex: 1; position: relative; }
.search-input-wrap input { padding-left: 34px; }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-hint);
  pointer-events: none;
}

/* Filter dropdowns row */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.filter-group label {
  display: block;
  font-size: 10px;
  color: var(--text-hint);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

/* Form elements */
select, input[type="text"], input[type="number"] {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-color: var(--bg);
  padding-right: 28px;
}

/* Buttons */
.btn-search {
  height: 36px;
  padding: 0 1.4rem;
  background: var(--hero-bg);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-search:hover { background: #2a1210; }
.btn-clear {
  height: 36px;
  padding: 0 1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}
.btn-clear:hover { border-color: var(--accent); color: var(--accent); }

/* Active filter chips */
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  gap: 5px;
}
.chip-x { cursor: pointer; opacity: 0.6; font-size: 14px; line-height: 1; }
.chip-x:hover { opacity: 1; }

/* Results */
.results-area { max-width: 1200px; margin: 0 auto; padding: 1.5rem 2rem 3rem; }
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.results-count { font-size: 13px; color: var(--text-muted); }
.sort-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.sort-wrap select { width: auto; height: 30px; font-size: 12px; }

/* Wine grid — 3 columns */
.wine-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.wine-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex;
  gap: 14px;
  align-items: stretch;
}
.wine-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.07);
}

/* Left image column */
.wine-card-image {
  width: 64px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.wine-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.wine-card-image .bottle-icon { opacity: 0.18; }

/* Right content column */
.wine-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wine-name {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
}
.wine-winery { font-size: 12px; color: var(--text-muted); }
.wine-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  background: var(--bg);
}

/* States */
.loading, .empty-state, .error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  font-size: 14px;
}
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 2rem; }
.page-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--hero-bg); color: #fff; border-color: var(--hero-bg); }
.page-btn:disabled { opacity: 0.3; cursor: default; }

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  padding: 2rem;
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px 6px;
}
.modal-close:hover { color: var(--text); }
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 4px;
}
.modal-winery { font-size: 13px; color: var(--text-muted); margin-bottom: 1.25rem; }
.modal-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1.25rem; }
.modal-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.modal-badge.accent {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-border);
  font-weight: 500;
}
.modal-section { margin-bottom: 1rem; }
.modal-section h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-hint);
  font-weight: 500;
  margin-bottom: 4px;
}
.modal-section p { font-size: 14px; line-height: 1.65; color: var(--text-muted); }
.modal-divider { border: none; border-top: 1px solid var(--border-light); margin: 1rem 0; }

/* Vintage blocks in modal */
.vintage-block { padding: 4px 0; }
.vintage-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.vintage-year {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text);
  margin-right: 4px;
}
.vintage-price { font-size: 14px; font-weight: 500; color: var(--text); }
.vintage-alc { font-size: 12px; color: var(--text-muted); }
.current-release {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-weight: 500;
}
.palate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.palate-item {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 6px 8px;
  text-align: center;
}
.palate-item span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-hint);
  margin-bottom: 2px;
}
.palate-item strong { font-size: 12px; font-weight: 500; color: var(--text); }

/* Responsive */
@media (max-width: 900px) {
  .wine-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .hero { padding: 1.5rem 1rem 1.25rem; }
  .filter-bar { padding: 1rem; }
  .results-area { padding: 1rem 1rem 2rem; }
  .wine-grid { grid-template-columns: 1fr; }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-inner { padding: 0 1rem; }
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--hero-bg);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-link { padding: 10px 12px; }
  .nav-link-cta { margin-left: 0; margin-top: 4px; text-align: center; }
}
/* ── Nav user button & dropdown ───────────────────────────────────── */
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: #fff;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  padding: 5px 10px 5px 6px;
  cursor: pointer;
  transition: background 0.15s;
  margin-left: 8px;
}
.nav-user-btn:hover { background: rgba(255,255,255,0.14); }
.nav-user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
}
.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 180px;
  padding: 6px;
  z-index: 300;
}
.nav-dropdown.open { display: block; }
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.nav-dropdown-item:hover { background: var(--bg); }
.nav-dropdown-divider { border: none; border-top: 1px solid var(--border-light); margin: 4px 0; }
.nav-dropdown-signout { color: var(--text-muted); }
.nav-dropdown-signout:hover { color: var(--accent); }

/* ── Heart / like button ──────────────────────────────────────────── */
.like-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}
.like-btn:hover { background: var(--accent-bg); transform: scale(1.1); }
.like-btn svg { pointer-events: none; }
.like-btn.liked svg { fill: var(--accent); stroke: var(--accent); }
.like-btn:not(.liked) svg { fill: none; stroke: var(--text-hint); }

/* Heart in modal header */
.modal-like-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 8px;
}
.modal-like-btn:hover { border-color: var(--accent); color: var(--accent); }
.modal-like-btn.liked { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); }
.modal-like-btn.liked svg { fill: var(--accent); }
.modal-like-btn svg { pointer-events: none; }

/* ── Auth modal ───────────────────────────────────────────────────── */
.auth-modal { max-width: 400px; }
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
  margin-bottom: -1px;
}
.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 500;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-hint { font-size: 11px; font-weight: 400; color: var(--text-hint); }
.form-group input {
  height: 40px;
  font-size: 14px;
}
.auth-error {
  font-size: 13px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 8px 12px;
  display: none;
}
.auth-error.visible { display: block; }
.btn-auth {
  height: 42px;
  background: var(--hero-bg);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.btn-auth:hover { background: #2a1210; }
.btn-auth:disabled { opacity: 0.6; cursor: default; }

/* ── Liked wines modal ────────────────────────────────────────────── */
.liked-modal { max-width: 700px; }
.liked-wines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.liked-wine-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.liked-wine-card:hover { border-color: var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.liked-wine-card-image {
  width: 44px;
  height: 56px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.liked-wine-card-image .bottle-icon { opacity: 0.18; }
.liked-wine-card-content { flex: 1; min-width: 0; }
.liked-wine-card-name {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.liked-wine-card-producer { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.liked-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 14px;
}
.liked-empty svg { opacity: 0.2; margin-bottom: 12px; }

/* ── List button on wine card ─────────────────────────────────────────────── */
.list-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  transition: background 0.15s;
  color: var(--text-hint);
  flex-shrink: 0;
}
.list-btn:hover { background: var(--accent-bg); color: var(--accent); }

/* ── Modal list button ────────────────────────────────────────────────────── */
.modal-list-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 0;
  margin-left: 6px;
}
.modal-list-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── List picker modal ────────────────────────────────────────────────────── */
.list-picker-modal { max-width: 400px; }

.list-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s;
  margin-bottom: 6px;
  background: var(--bg);
}
.list-picker-item:hover { border-color: var(--accent); background: var(--accent-bg); }
.list-picker-item.in-list { border-color: var(--accent-border); background: var(--accent-bg); }

.list-picker-icon { font-size: 18px; flex-shrink: 0; }
.list-picker-name { flex: 1; font-size: 14px; color: var(--text); font-weight: 500; }
.list-picker-count { font-size: 12px; color: var(--text-muted); }
.list-picker-check {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.list-picker-new-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.list-picker-new-btn:hover { border-color: var(--accent); color: var(--accent); }