/* ============================================================
   PRODUCT OVERLAY — shared component styles
   Used by: wines.html, index.html
   Slide-up panel that opens when a wine card is clicked.
   ============================================================ */

/* ── Scroll lock: applied to body when overlay is open ───── */
html.overlay-scroll-lock,
body.overlay-scroll-lock {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ── Overlay container ───────────────────────────────────── */
#product-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
}
#product-overlay.is-open { pointer-events: auto; }

/* ── Backdrop ────────────────────────────────────────────── */
#overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38, 35, 31, 0.45);
  opacity: 0;
  transition: opacity 0.38s ease;
}
#product-overlay.is-open #overlay-backdrop { opacity: 1; }

/* ── Panel ───────────────────────────────────────────────── */
#overlay-panel {
  position: absolute;
  top: var(--header-h, 154px);
  left: 0; right: 0; bottom: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.52s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  overflow: hidden;
  box-shadow: 0 -2px 24px rgba(38,35,31,0.07);
}
#product-overlay.is-open #overlay-panel { transform: translateY(0); }

/* ── Topbar ──────────────────────────────────────────────── */
#overlay-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  border-bottom: 1px solid var(--border-light);
  background: #fff;
  position: relative;
  z-index: 2;
}
#overlay-producer-label {
  font-family: var(--sans);
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mid);
}
#overlay-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
  cursor: pointer;
}
#overlay-close:hover { background: var(--bg-dark); border-color: var(--bg-dark); color: #fff; }
#overlay-close:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
#overlay-close:active { transform: scale(0.93); }
#overlay-close svg { width: 14px; height: 14px; pointer-events: none; }

/* ── Scrollable body ─────────────────────────────────────── */
#overlay-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}

/* ── Hero: 2-col image + detail ──────────────────────────── */
.overlay-main {
  display: grid;
  grid-template-columns: 42% 1fr;
  border-bottom: 1px solid var(--border-light);
  max-width: 1080px;
  margin: 0 auto;
}

/* ── Image column ────────────────────────────────────────── */
.overlay-image-col {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 40px;
  position: relative;
  border-right: 1px solid var(--border-light);
}
@media (min-width: 900px) {
  .overlay-image-col {
    position: sticky;
    top: 0;
    height: calc(100vh - var(--header-h, 154px) - 50px);
    align-self: start;
  }
}
.overlay-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
}
#overlay-img {
  width: auto; height: auto;
  max-height: 560px; max-width: 118%;
  object-fit: contain;
  display: block;
  position: relative; z-index: 1;
  filter: drop-shadow(0 20px 56px rgba(38,35,31,0.18)) drop-shadow(0 4px 12px rgba(38,35,31,0.08));
  transform: translateY(var(--overlay-image-offset-y, 0px)) scale(var(--overlay-image-scale, 1));
  transform-origin: center bottom;
  transition: transform 0.5s cubic-bezier(0.25,0.46,0.45,0.94);
}
.overlay-image-wrap:hover #overlay-img {
  transform: translateY(calc(var(--overlay-image-offset-y, 0px) - 6px)) scale(var(--overlay-image-hover-scale, 1.02));
}

/* ── Gallery thumbnails ──────────────────────────────────── */
#overlay-gallery {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}
.overlay-gallery-thumb {
  width: 46px; height: 70px;
  border: 1px solid var(--border-light);
  background: var(--bg);
  padding: 3px;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}
.overlay-gallery-thumb img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.overlay-gallery-thumb.is-active { border-color: var(--gold); }
.overlay-gallery-thumb:hover     { border-color: var(--border); }
.overlay-gallery-thumb:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ── Detail column ───────────────────────────────────────── */
.overlay-detail-col {
  padding: 44px 52px 44px 48px;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.overlay-wine-name {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 10px;
}
.overlay-vintage {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 12px;
}
.overlay-producer-text {
  font-family: var(--sans);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}
.overlay-price {
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  margin-bottom: 4px;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.overlay-price-vat {
  font-family: var(--sans);
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-mid);
}

/* ── Format selector ─────────────────────────────────────── */
.overlay-formats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  margin-top: 12px;
}
.overlay-format-btn {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-mid);
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.overlay-format-btn:hover { border-color: var(--text); color: var(--text); }
.overlay-format-btn.is-active { border-color: var(--text); background: var(--text); color: var(--bg); }
.overlay-format-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Purchase row ────────────────────────────────────────── */
.overlay-purchase {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.overlay-qty {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  height: 52px;
  flex-shrink: 0;
}
.overlay-qty-btn {
  width: 40px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 300;
  color: var(--text);
  background: transparent;
  border: none; cursor: pointer;
  transition: background 0.12s ease;
  line-height: 1;
}
.overlay-qty-btn:hover:not(:disabled) { background: var(--pumice); }
.overlay-qty-btn:disabled { opacity: 0.28; cursor: not-allowed; }
.overlay-qty-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.overlay-qty-val {
  width: 34px;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.82rem; font-weight: 400;
  color: var(--text);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.overlay-add-btn {
  flex: 1;
  height: 52px;
  background: var(--bg-dark);
  color: #F7F3EC;
  font-family: var(--sans);
  font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: none; cursor: pointer;
  transition: background 0.2s ease, opacity 0.15s ease;
}
.overlay-add-btn:hover { background: #000; }
.overlay-add-btn:active { opacity: 0.85; }
.overlay-add-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.overlay-add-btn.is-added { background: var(--gold); }
.overlay-stock-hint {
  font-family: var(--sans);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text-mid);
  margin-top: 8px;
  text-align: right;
}

/* ── Trust signals bar ───────────────────────────────────── */
.overlay-trust-bar {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-light);
  margin-top: 16px;
  overflow: hidden;
}
.overlay-trust-item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 8px;
  font-family: var(--sans);
  font-size: 0.57rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-mid);
  line-height: 1.3;
  text-align: center;
  border-right: 1px solid var(--border-light);
}
.overlay-trust-item:last-child { border-right: none; }
.overlay-trust-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--gold);
}

/* ── Key wine facts grid ─────────────────────────────────── */
.overlay-key-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 20px;
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.overlay-key-fact {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-right: 1px solid var(--border-light);
  background: #FAFAF8;
}
.overlay-key-fact:last-child { border-right: none; }
.overlay-key-fact-label {
  font-family: var(--sans);
  font-size: 0.49rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mid);
}
.overlay-key-fact-value {
  font-family: var(--serif);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

/* ── Shared section styles ───────────────────────────────── */
.overlay-section {
  padding: 48px 52px;
  border-bottom: 1px solid var(--border-light);
  max-width: 1080px;
  margin: 0 auto;
  background: #fff;
  width: 100%;
}
.overlay-section:last-child { border-bottom: none; }
.overlay-section-title {
  font-family: var(--sans);
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: 28px;
}
.overlay-section-title--editorial {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-transform: none;
  text-align: center;
  color: var(--text);
  margin-bottom: 24px;
}

/* ── Technical specs (inline in detail column) ──────────── */
.overlay-detail-specs {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border-light);
}
.overlay-spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.overlay-spec-row:empty { display: none; }
.overlay-spec-label {
  font-family: var(--sans);
  font-size: 0.6rem; font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mid);
  flex-shrink: 0;
}
.overlay-spec-value {
  font-family: var(--sans);
  font-size: 0.72rem; font-weight: 400;
  color: var(--text);
  text-align: right;
}
.overlay-spec-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  transition: color 0.15s ease, border-color 0.15s ease;
  padding-bottom: 1px;
}
.overlay-spec-link:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ── Description ─────────────────────────────────────────── */
.overlay-desc-text {
  font-family: var(--serif);
  font-size: 1.08rem; font-weight: 400;
  line-height: 1.85;
  color: var(--text);
  max-width: 640px;
}

/* ── Tasting notes ───────────────────────────────────────── */
.overlay-tasting-text {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 400;
  font-style: italic;
  line-height: 1.82;
  color: var(--text);
  max-width: 640px;
  position: relative;
  padding-left: 22px;
}
.overlay-tasting-text::before {
  content: '\201C';
  position: absolute;
  left: 0;
  top: -6px;
  font-family: var(--serif);
  font-size: 2.8rem;
  font-weight: 300;
  color: var(--gold);
  line-height: 1;
  opacity: 0.5;
  font-style: normal;
}
.overlay-tasting-text::after {
  content: '\201D';
  display: inline-block;
  margin-left: 4px;
  font-family: var(--serif);
  font-size: 1.35em;
  font-weight: 300;
  color: var(--gold);
  line-height: 0;
  opacity: 0.5;
  font-style: normal;
  vertical-align: -0.18em;
}

/* ── Press & reviews ─────────────────────────────────────── */
.overlay-reviews-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.overlay-review-card {
  padding: 32px 36px;
  border: 1px solid var(--border-light);
  background: #FAFAF8;
}
.overlay-review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.overlay-review-source {
  font-family: var(--sans);
  font-size: 0.58rem; font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 10px;
}
.overlay-review-score {
  font-family: var(--serif);
  font-size: 3.2rem; font-weight: 400;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  flex-shrink: 0;
}
.overlay-review-score-denom {
  font-size: 0.9rem; font-weight: 300;
  color: var(--text-mid);
  font-family: var(--sans);
  letter-spacing: 0;
}
.overlay-review-text {
  font-family: var(--serif);
  font-size: 1.05rem; font-weight: 400;
  font-style: italic;
  line-height: 1.8;
  color: var(--text-mid);
}

/* ── Other vintages ──────────────────────────────────────── */
.overlay-vintages-section .overlay-section-title--editorial {
  margin-bottom: 0;
}
.overlay-vintage-row {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-light);
}
.overlay-vintage-row:first-child { border-top: 1px solid var(--border-light); }
.overlay-vintage-img {
  width: 36px; height: 72px;
  object-fit: contain;
  flex-shrink: 0;
}
.overlay-vintage-name {
  font-family: var(--sans);
  font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  flex: 1;
}
.overlay-vintage-price {
  font-family: var(--sans);
  font-size: 0.82rem; font-weight: 400;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
  margin-right: 16px;
}
.overlay-vintage-btn {
  border: 1px solid var(--border);
  padding: 9px 18px;
  font-family: var(--sans);
  font-size: 0.58rem; font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.overlay-vintage-btn:hover { background: var(--bg-dark); color: var(--bg); border-color: var(--bg-dark); }
.overlay-vintage-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── From this producer ──────────────────────────────────── */
.overlay-producer-wines {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.overlay-producer-wines::-webkit-scrollbar { display: none; }
.overlay-prod-card {
  width: 176px;
  flex-shrink: 0;
  border: 1px solid var(--border-light);
  padding: 16px 16px 16px;
  background: #FAFAF8;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}
.overlay-prod-card:hover {
  border-color: var(--border);
  box-shadow: 0 4px 16px rgba(38,35,31,0.07);
}
.overlay-prod-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.overlay-prod-img-wrap {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  overflow: hidden;
}
.overlay-prod-img {
  height: 110px; width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(38,35,31,0.1));
}
.overlay-prod-producer {
  font-family: var(--sans);
  font-size: 0.52rem; font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.overlay-prod-name {
  font-family: var(--serif);
  font-size: 0.88rem; font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 8px;
  flex: 1;
}
.overlay-prod-price {
  font-family: var(--sans);
  font-size: 0.78rem; font-weight: 400;
  color: var(--text-mid);
  margin-top: auto;
}

/* ── Responsive: tablet ──────────────────────────────────── */
@media (max-width: 899px) {
  .overlay-main { grid-template-columns: 1fr; }
  .overlay-image-col {
    height: auto;
    padding: 40px;
    position: static;
    border-bottom: 1px solid var(--border-light);
  }
  #overlay-img { max-height: 320px; max-width: 108%; }
  .overlay-detail-col { padding: 36px 40px; }
  .overlay-wine-name { font-size: 2.2rem; }
  .overlay-section { padding: 40px; }
}

/* ── Responsive: mobile ──────────────────────────────────── */
@media (max-width: 599px) {
  #overlay-topbar { padding: 12px 20px; }
  .overlay-image-col { padding: 28px 24px; }
  #overlay-img { max-height: 250px; max-width: 104%; }
  .overlay-detail-col { padding: 28px 24px; }
  .overlay-wine-name { font-size: 1.9rem; }
  .overlay-intro { font-size: 0.95rem; }
  .overlay-section { padding: 28px 24px; }
  .overlay-specs-grid { grid-template-columns: 1fr; }
  .overlay-review-card { padding: 24px 20px; }
  .overlay-review-score { font-size: 2.4rem; }
  .overlay-highlight-item { padding: 0 12px; }
  .overlay-vintage-row { gap: 12px; }
  .overlay-vintage-price { display: none; }
  .overlay-prod-card { width: 148px; }
  /* Trust bar: stack items vertically on very small screens */
  .overlay-trust-item { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: 0.52rem; }
  /* Key facts: single column on mobile */
  .overlay-key-facts { grid-template-columns: 1fr; }
  .overlay-key-fact { border-right: none; border-bottom: 1px solid var(--border-light); }
  .overlay-key-fact:last-child { border-bottom: none; }
}
