/* AIWine.co.nz — shared styles */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Manrope:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* palette — warm bone, claret, aged brass */
  --bg: #F4EFE5;
  --bg-alt: #EDE6D8;
  --card: #FAF6EE;
  --ink: #1B1410;
  --ink-soft: #4A3D34;
  --muted: #8B7E6E;
  --line: #D8CFBE;
  --claret: #5C1B27;
  --claret-deep: #3A0E18;
  --brass: #A98654;
  --brass-soft: #C9A878;

  /* wine-label tint palette by variety */
  --t-pinot: #6B1F2A;
  --t-syrah: #2A0E18;
  --t-chard: #C9A45A;
  --t-sauv: #B8C28A;
  --t-pinotg: #D9B58C;
  --t-ries: #E0CC74;
  --t-rose: #D9889A;
  --t-merlot: #4A1722;
  --t-cab: #2E0A14;
  --t-sparkling: #E8DDB0;

  /* type scale */
  --t-display: clamp(48px, 7vw, 96px);
  --t-h1: clamp(40px, 5vw, 64px);
  --t-h2: clamp(28px, 3vw, 40px);
  --t-h3: clamp(20px, 2vw, 24px);
  --t-body: 17px;
  --t-small: 14px;
  --t-tiny: 11px;

  /* spacing */
  --pad-x: clamp(24px, 5vw, 80px);
  --pad-y: clamp(56px, 8vw, 120px);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; overflow-x: hidden; }

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }

.serif { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 400; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: var(--t-tiny);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ============ NAV ============ */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad-x);
  background: rgba(244, 239, 229, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  display: flex; align-items: baseline; gap: 8px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 500;
  letter-spacing: -0.01em;
}
.nav-logo .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--claret); display: inline-block; transform: translateY(-3px); }
.nav-logo .tld { color: var(--muted); font-size: 18px; font-style: italic; }

.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-link {
  font-size: 14px; font-weight: 500;
  position: relative;
  padding: 6px 0;
  color: var(--ink-soft);
  transition: color 0.2s;
}
.nav-link:hover { color: var(--claret); }
.nav-link.active { color: var(--ink); }
.nav-link.active::after {
  content: ''; position: absolute; bottom: -3px; left: 0; right: 0;
  height: 1px; background: var(--claret);
}

.nav-actions { display: flex; gap: 12px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.04em;
  background: transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-primary {
  background: var(--claret); color: var(--bg);
  border-color: var(--claret);
}
.btn-primary:hover { background: var(--claret-deep); border-color: var(--claret-deep); color: var(--bg); }
.btn-ghost { border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-small { padding: 8px 14px; font-size: 11px; }

.cart-btn { position: relative; }
.cart-btn .count {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--claret); color: var(--bg);
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
}

/* account nav control */
.nav-account {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 14px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.nav-account:hover { border-color: var(--ink); color: var(--ink); }
.nav-account .acct-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--claret); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif; font-size: 15px; font-weight: 600;
}
.nav-account .acct-icon {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
}
.nav-account .acct-name { white-space: nowrap; }

/* ============ MOBILE NAV ============ */
/* Hidden on desktop; the inline links/actions show instead. */
.nav-toggle { display: none; }
.nav-panel { display: none; }

@media (max-width: 980px) {
  /* hide the wide desktop nav; logo + hamburger remain */
  .nav > .nav-links,
  .nav > .nav-actions { display: none !important; }

  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 11px;
    border: 1px solid var(--line); background: var(--card);
    color: var(--ink); flex-shrink: 0;
    transition: background .2s, color .2s, border-color .2s;
  }
  .nav-toggle:hover { border-color: var(--ink); }
  .nav-toggle .i-close { display: none; }
  .nav.open .nav-toggle { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .nav.open .nav-toggle .i-open { display: none; }
  .nav.open .nav-toggle .i-close { display: inline; }

  .nav-panel {
    display: block;
    position: absolute; top: calc(100% + 8px); right: var(--pad-x);
    width: min(320px, calc(100vw - 32px));
    background: var(--card);
    border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 26px 70px rgba(0,0,0,0.22);
    padding: 12px;
    opacity: 0; transform: translateY(-10px) scale(0.97); transform-origin: top right;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
    z-index: 60;
    max-height: calc(100vh - 90px); overflow-y: auto;
  }
  /* transparent bridge so hover survives the gap between toggle and panel */
  .nav-panel::before {
    content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 14px;
  }
  /* reveal on hover (hover-capable devices) OR when toggled open (touch) */
  .nav-toggle:hover + .nav-panel,
  .nav-panel:hover,
  .nav.open .nav-panel {
    opacity: 1; transform: translateY(0) scale(1); pointer-events: auto;
  }

  .nav-panel .nav-links {
    display: flex; flex-direction: column; gap: 2px; align-items: stretch;
  }
  .nav-panel .nav-link {
    padding: 13px 14px; border-radius: 9px; font-size: 16px; color: var(--ink-soft);
  }
  .nav-panel .nav-link:hover,
  .nav-panel .nav-link.active { background: var(--bg-alt); color: var(--ink); }
  .nav-panel .nav-link.active::after { display: none; }

  .nav-panel .nav-actions {
    display: flex; flex-direction: column; gap: 9px; align-items: stretch;
    margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line);
  }
  .nav-panel .btn,
  .nav-panel .nav-account { width: 100%; justify-content: center; }
  .nav-panel .nav-account { padding: 11px 14px; }
  .nav-panel .cart-btn .count { top: 4px; right: auto; left: calc(50% + 30px); }
}

/* wishlist heart (on wine label cards) */
.wish-btn {
  position: absolute; top: 14px; left: 14px; z-index: 3;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.95);
  transition: all 0.2s;
}
.wish-btn svg { fill: none; stroke: currentColor; stroke-width: 1.6; transition: all 0.2s; }
.wish-btn:hover { background: rgba(255,255,255,0.32); transform: scale(1.08); }
.wish-btn.on { background: var(--bg); border-color: var(--bg); color: var(--claret); }
.wish-btn.on svg { fill: var(--claret); stroke: var(--claret); }

/* ============ AGE GATE ============ */
.age-gate {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(27, 20, 16, 0.75);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 1; transition: opacity 0.4s;
}
.age-gate.hidden { opacity: 0; pointer-events: none; }
.age-gate-card {
  background: var(--card);
  max-width: 520px; width: 100%;
  padding: 56px 48px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
}
.age-gate-mark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px;
  letter-spacing: 0.02em;
  margin-bottom: 32px;
}
.age-gate-mark .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--claret); display: inline-block; margin: 0 6px; transform: translateY(-4px); }
.age-gate-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 36px; font-weight: 400; font-style: italic;
  line-height: 1.15;
  margin-bottom: 16px;
}
.age-gate-text {
  font-size: 15px; color: var(--ink-soft);
  margin-bottom: 36px; line-height: 1.6;
}
.age-gate-actions {
  display: flex; gap: 12px; flex-direction: column;
}
.age-gate-actions .btn { justify-content: center; padding: 16px 24px; }
.age-gate-foot {
  margin-top: 28px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}

/* ============ DRAWER ============ */
.drawer-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(27, 20, 16, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(520px, 100vw);
  background: var(--card);
  z-index: 70;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.15);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}
.drawer-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px; font-style: italic; font-weight: 400;
}
.drawer-close {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  font-size: 18px;
  transition: all 0.2s;
}
.drawer-close:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px 28px; }
.drawer-foot { padding: 20px 28px; border-top: 1px solid var(--line); background: var(--bg-alt); }

/* ============ AI SOMMELIER ============ */
.somm-intro {
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.somm-intro p { color: var(--ink-soft); font-size: 15px; }

.somm-suggest {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 4px;
}
.somm-chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  background: var(--bg);
  transition: all 0.2s;
  text-align: left;
}
.somm-chip:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.somm-msgs { display: flex; flex-direction: column; gap: 20px; }
.somm-msg { max-width: 92%; }
.somm-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: 18px 18px 4px 18px;
  font-size: 15px;
}
.somm-msg.bot { align-self: flex-start; }
.somm-msg.bot .bubble {
  background: var(--bg);
  padding: 16px 18px;
  border-radius: 4px 18px 18px 18px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}
.somm-msg.bot .bubble strong { font-weight: 600; }
.somm-msg.bot .speaker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--claret); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.somm-msg.bot .speaker::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--claret);
}
.somm-recs {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.somm-rec {
  display: flex; gap: 14px; align-items: center;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.somm-rec-tint {
  width: 44px; height: 60px; flex-shrink: 0;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--tint, var(--claret)), color-mix(in oklab, var(--tint, var(--claret)), black 30%));
}
.somm-rec-info { flex: 1; min-width: 0; }
.somm-rec-info .label { margin-bottom: 2px; }
.somm-rec-info h4 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 18px; line-height: 1.2; }
.somm-rec-info .price { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.somm-rec button {
  padding: 8px 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
  transition: all 0.2s;
  white-space: nowrap;
}
.somm-rec button:hover { background: var(--ink); color: var(--bg); }
.somm-rec button.added { background: var(--claret); color: var(--bg); border-color: var(--claret); }

.somm-typing {
  display: inline-flex; gap: 4px; padding: 14px 18px;
  background: var(--bg); border-radius: 4px 18px 18px 18px;
}
.somm-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: typing 1.2s infinite;
}
.somm-typing span:nth-child(2) { animation-delay: 0.15s; }
.somm-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.somm-input {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 18px;
}
.somm-input input {
  flex: 1; background: none; border: none; outline: none;
  font: inherit; font-size: 14px;
  padding: 8px 0;
  color: var(--ink);
}
.somm-input input::placeholder { color: var(--muted); }
.somm-input button {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--claret); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.somm-input button:hover { background: var(--claret-deep); }
.somm-input button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============ CART ============ */
.cart-empty {
  text-align: center; padding: 60px 20px;
  color: var(--muted);
}
.cart-empty .serif { font-size: 28px; color: var(--ink); display: block; margin-bottom: 8px; font-style: italic; }
.cart-empty p { font-size: 14px; }

.cart-items { display: flex; flex-direction: column; gap: 14px; }
.cart-item {
  display: flex; gap: 14px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.cart-item-tint {
  width: 50px; height: 70px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--tint, var(--claret)), color-mix(in oklab, var(--tint, var(--claret)), black 30%));
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info .label { font-size: 10px; margin-bottom: 2px; }
.cart-item-info h4 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 18px; line-height: 1.15; }
.cart-item-info .winery { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.cart-item-controls {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
  gap: 8px;
}
.qty {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card);
}
.qty button { width: 26px; height: 26px; border-radius: 50%; font-size: 14px; }
.qty button:hover { background: var(--ink); color: var(--bg); }
.qty span { width: 24px; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.cart-remove {
  font-size: 11px; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px;
}
.cart-remove:hover { color: var(--claret); }
.cart-price { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 500; }

.case-progress {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.case-progress-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.case-progress-head .ttl { font-size: 13px; font-weight: 600; }
.case-progress-head .count { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.case-progress-bar {
  height: 4px; background: var(--line); border-radius: 99px;
  overflow: hidden;
}
.case-progress-bar .fill {
  height: 100%; background: var(--claret);
  transition: width 0.4s;
}
.case-progress-hint { font-size: 11px; color: var(--muted); margin-top: 8px; }
.case-progress.complete .ttl { color: var(--claret); }

.cart-totals { display: flex; justify-content: space-between; margin-bottom: 14px; }
.cart-totals .label { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.1em; }
.cart-total-amt { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 500; }

.cart-checkout {
  width: 100%; justify-content: center;
}

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg);
  padding: 12px 22px; border-radius: 999px;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast::before { content: '✓'; color: var(--brass-soft); font-weight: 700; }

/* ============ UTILITY ============ */
.divider-rule {
  display: flex; align-items: center; gap: 16px;
  margin: 8px 0 20px;
}
.divider-rule::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============ STOCK ============ */
.wine-stockline { margin-top: -2px; }
.stock-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
}
.stock-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.stock-tag.in { background: color-mix(in oklab, #1F8A5B, var(--bg) 84%); color: #1F6B49; }
.stock-tag.in::before { background: #1F8A5B; }
.stock-tag.low { background: color-mix(in oklab, var(--brass), var(--bg) 78%); color: #8A6A2E; }
.stock-tag.low::before { background: var(--brass); }
.stock-tag.out { background: var(--bg-alt); color: var(--muted); }
.stock-tag.out::before { background: var(--muted); }

.wine-card.is-sold-out .wine-label { filter: grayscale(0.5) opacity(0.7); }
.label-soldout {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  background: rgba(27,20,16,0.82); color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 8px 18px; z-index: 2;
}
.wine-add.sold-out, .somm-rec button.sold-out {
  border-color: var(--line); color: var(--muted);
  cursor: not-allowed; background: var(--bg-alt);
}
.wine-add.sold-out:hover, .somm-rec button.sold-out:hover {
  background: var(--bg-alt); color: var(--muted);
}
