:root {
  --bg: #fafaf8;
  --fg: #1d1d1b;
  --muted: #6b6b66;
  --accent: #1d1d1b;
  --gold: #b8924a;
  --card: #ffffff;
  --line: #e6e4de;
  --serif: "Cormorant Garamond", "Times New Roman", Georgia, serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}
button {
  font: inherit; cursor: pointer; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); border-radius: 8px; padding: 8px 12px;
}
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); width: 100%; padding: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* header: logo + cart, then page tabs */
.chrome { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 6px; }
.brand { display: inline-flex; line-height: 0; }
.brand img { height: 52px; width: auto; display: block; }
.cart-btn span {
  display: inline-block; min-width: 1.4em; text-align: center;
  background: var(--accent); color: #fff; border-radius: 99px; padding: 0 6px; margin-left: 4px;
}
.tabs { display: flex; gap: 4px; padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: 0 0 auto; padding: 10px 12px; color: var(--muted); text-decoration: none;
  text-transform: uppercase; letter-spacing: .14em; font-size: .78rem;
  border-bottom: 2px solid transparent;
}
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--gold); }
.tab-count {
  display: inline-block; margin-left: 6px; min-width: 1.4em; padding: 0 5px; text-align: center;
  background: var(--gold); color: #fff; border-radius: 99px; letter-spacing: 0; font-size: .72rem;
}
.tab-count[hidden] { display: none; }

main { padding: 16px; max-width: 1000px; margin: 0 auto; }
.page-head { text-align: center; padding: 18px 0 20px; }
.page-head h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 2rem; letter-spacing: .04em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; letter-spacing: .04em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.35rem; letter-spacing: .03em; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; }
.card .add { background: var(--accent); color: #fff; border-color: var(--accent); padding: 10px; }
.price { font-weight: 600; }

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 16px; }
.link-btn { display: inline-block; margin-top: 4px; padding: 10px 18px; border: 1px solid var(--fg); border-radius: 8px; color: var(--fg); text-decoration: none; }

.notice { background: #eef7ee; border: 1px solid #cfe5cf; padding: 10px 12px; border-radius: 8px; }
.notice.warn { background: #fff6e5; border-color: #f0dfb5; }

/* product photo, 3D badge, wishlist heart, rank */
.media { position: relative; }
.imgbtn { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; }
.badge3d { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.72); color: #fff; border-radius: 99px; padding: 3px 12px; font-size: .78rem; letter-spacing: .06em; }
.heart {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--fg);
  box-shadow: 0 1px 6px rgba(0,0,0,.18);
}
.heart svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.heart.on { color: #b3202e; }
.heart.on svg { fill: #b3202e; }
.rank {
  position: absolute; top: 10px; left: 10px; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gold); color: #fff; font-family: var(--serif); font-weight: 600; font-size: 1.25rem;
  box-shadow: 0 1px 6px rgba(0,0,0,.25);
}

/* cart drawer */
.cart {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 380px);
  background: var(--bg); border-left: 1px solid var(--line); z-index: 10;
  display: flex; flex-direction: column; box-shadow: -8px 0 24px rgba(0,0,0,.08);
}
.cart[hidden] { display: none; }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cart-head h2 { margin: 0; font-size: 1.1rem; }
#cart-items { flex: 1; overflow: auto; padding: 8px 16px; }
.line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; }
.line .info { flex: 1; font-size: .9rem; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { padding: 2px 8px; }
.cart-foot { padding: 16px; border-top: 1px solid var(--line); }
.small { color: var(--muted); font-size: .85rem; margin: 4px 0 12px; }

.foot { text-align: center; color: var(--muted); padding: 32px 16px 40px; font-size: .85rem; }
.foot p { margin: 8px 0 0; }
.foot-logo { height: 35px; width: auto; opacity: .55; }
.center { text-align: center; max-width: 480px; margin: 14vh auto; padding: 0 16px; }
.center .brand { margin-bottom: 18px; }
.center a { color: var(--fg); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--fg); color: #fff; padding: 10px 18px; border-radius: 99px; z-index: 30;
  font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.25); white-space: nowrap;
}
.toast[hidden] { display: none; }

/* 3D viewer: the photo (bottle removed) is the animated background, only the bottle is 3D */
.viewer {
  --v-dark: #0d0c0a; --v-glow: #8a6a2f; --v-smoke: #d9b96a;
  position: fixed; inset: 0; z-index: 20; color: #f3ead8; overflow: hidden;
  background: var(--v-dark);
  animation: viewer-in .15s ease-out;
}
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .viewer { animation: none; } }
.viewer[hidden] { display: none; }
.viewer-stage { position: absolute; inset: 0; touch-action: none; }
.viewer-stage img { display: block; }
.viewer-stage > img:not(.vp-fill):not(.vp-photo):not(.vp-plate) { width: 100%; height: 100%; object-fit: contain; }
.vp-fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(28px) brightness(.55); transform: scale(1.15); }
.vp-photo, .vp-plate { position: absolute; top: 0; left: 50%; height: 100%; width: auto; max-width: none; transform: translateX(-50%); transform-origin: 50% 50%; }
.vp-bg { position: absolute; top: 0; left: 50%; height: 100%; transform: translateX(-50%); }
.vp-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.vp-canvas:active { cursor: grabbing; }
.viewer-head, .viewer-foot, .viewer-hint { position: relative; z-index: 2; pointer-events: none; }
.viewer-head button, .viewer-foot button, .viewer-foot .price { pointer-events: auto; }
.viewer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; position: absolute; top: 0; left: 0; right: 0; background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0)); }
.viewer-head strong { text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.viewer-head button { background: rgba(0,0,0,.35); color: #fff; border-color: rgba(255,255,255,.35); }
.viewer-hint { position: absolute; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); text-align: center; color: #e8dcc2; font-size: .85rem; margin: 0; text-shadow: 0 1px 6px rgba(0,0,0,.8); }
.viewer-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 28px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.7)); }
.viewer-foot .price { font-size: 1.2rem; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.viewer-foot .primary { width: auto; padding: 12px 22px; background: #d9b96a; color: #1d1d1b; border-color: #d9b96a; }
