/* =============================================================================
   Sombrio Supplements — luxury storefront
   Palette: deep navy ground, soft cream surface, restrained gold accent.
   Type: serif headings (Cormorant via @font-face), system sans body.
   ============================================================================= */
:root {
  --navy: #0a1628;
  --navy-2: #142440;
  --cream: #faf7f2;
  --cream-2: #f3ece0;
  --gold: #c9a961;
  --gold-deep: #a88b48;
  --ink: #1a1a1a;
  --ink-2: #444;
  --line: #d8cfc0;
  --radius: 4px;
  --shadow: 0 12px 32px rgba(10, 22, 40, 0.12);
}

@font-face {
  font-family: 'Cormorant Garamond';
  src: local('Cormorant Garamond'), local('Cormorant');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
}
a { color: var(--navy); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-deep); }

h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin: 0 0 0.6em;
  color: var(--navy);
}
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; display: block; }

/* ---- Layout ---- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section.narrow { padding: 48px 0; }

/* ---- Header ---- */
.site-header {
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; max-width: 1180px; margin: 0 auto;
}
.brand-link {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px; letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--navy);
}
.brand-link img { height: 36px; vertical-align: middle; margin-right: 8px; }
.nav-links { display: flex; gap: 28px; }
.nav-links a { font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; }
.cart-link { position: relative; }
.cart-count {
  background: var(--gold); color: var(--navy);
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 10px;
  margin-left: 4px;
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--cream); padding: 16px 24px; border-bottom: 1px solid var(--line); }
  .hamburger { display: block; }
}
.hamburger { display: none; background: none; border: none; cursor: pointer; font-size: 22px; }

/* ---- Hero ---- */
.hero {
  background: var(--navy);
  color: var(--cream);
  padding: 120px 0 100px;
  position: relative;
  overflow: hidden;
}
/* Gradient overlay — keeps text readable on left, reveals photo on right */
.hero::after {
  content: '';
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(
    to right,
    rgba(10,22,40,0.82) 0%,
    rgba(10,22,40,0.55) 45%,
    rgba(10,22,40,0.15) 75%,
    rgba(10,22,40,0.05) 100%
  );
}
.hero h1 { color: var(--cream); max-width: 720px; }
.hero p.lede { color: rgba(250, 247, 242, 0.90); font-size: 1.15rem; max-width: 560px; margin-bottom: 32px; }
.hero .hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  opacity: 1;
  z-index: 0;
}
.hero .container { position: relative; z-index: 2; }
@media (max-width: 768px) {
  .hero::after { background: rgba(10,22,40,0.65); }
}

/* ---- About banner ---- */
.about-banner-section {
  width: 100%;
  margin: 0;
  background: var(--navy);
}
.about-banner {
  width: 100%;
  height: clamp(220px, 38vw, 420px);
  object-fit: cover;
  display: block;
  margin: 0;
}

/* ---- Optional footer logo ---- */
/* Hidden by default; revealed by render.js when an operator uploads logo.footer.
   When present, hides the plain text "Sombrio" brand below it. */
.footer-logo { display: none; max-width: 140px; height: auto; margin-bottom: 8px; }
.footer-logo.has-image { display: block; }
.footer-grid div.has-image-child .footer-text-brand { display: none; }

/* ---- Button ---- */
.btn {
  display: inline-block;
  padding: 14px 32px;
  font-size: 13px; letter-spacing: 0.15em; text-transform: uppercase;
  background: var(--gold); color: var(--navy);
  border: 1px solid var(--gold); border-radius: 2px;
  cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s;
  font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--gold-deep); color: var(--cream); transform: translateY(-1px); }
.btn.outline { background: transparent; color: var(--cream); }
.btn.outline:hover { background: var(--cream); color: var(--navy); }
.btn.dark { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.btn.dark:hover { background: var(--navy-2); color: var(--gold); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm { padding: 8px 16px; font-size: 12px; }

/* ---- Value props ---- */
.value-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px; margin-top: 32px;
}
.value-item { text-align: center; }
.value-item .icon { font-size: 28px; color: var(--gold); margin-bottom: 12px; }

/* ---- Product grid ---- */
.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 32px;
}
.product-card {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.product-card .photo {
  background: var(--cream); aspect-ratio: 1; display: grid; place-items: center;
}
.product-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 20px; }
.product-card h3 { margin-bottom: 8px; font-size: 1.25rem; }
.product-card .price { color: var(--gold-deep); font-weight: 600; font-size: 1.1rem; }
.product-card .muted { color: var(--ink-2); font-size: 14px; }

/* ---- Product detail ---- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
@media (max-width: 768px) { .product-detail { grid-template-columns: 1fr; } }
.product-detail .gallery { background: var(--cream-2); aspect-ratio: 1; display: grid; place-items: center; border-radius: var(--radius); overflow: hidden; }
.product-detail .gallery img { width: 100%; height: 100%; object-fit: cover; }
.product-detail .info h1 { font-size: 2.2rem; }
.product-detail .price-row { font-size: 1.4rem; color: var(--gold-deep); margin: 16px 0; }
.tier-selector { display: grid; gap: 12px; margin: 24px 0; }
.tier-option {
  border: 1px solid var(--line); padding: 16px; border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.tier-option:hover { border-color: var(--gold); }
.tier-option.selected { border-color: var(--gold); background: rgba(201,169,97,0.08); }
.tier-option .label { font-weight: 600; }
.tier-option .saving { font-size: 12px; color: var(--gold-deep); }

/* ---- Forms ---- */
.form { display: grid; gap: 16px; max-width: 480px; }
.form label { display: block; font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 4px; }
.form input, .form select, .form textarea {
  width: 100%; padding: 12px 14px;
  background: var(--cream); border: 1px solid var(--line); border-radius: 2px;
  font-size: 15px; font-family: inherit; color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--gold); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form .row { grid-template-columns: 1fr; } .form { max-width: 100%; } }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---- Cart ---- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: 16px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.cart-table th { color: var(--ink-2); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.cart-summary { background: var(--cream-2); padding: 24px; border-radius: var(--radius); margin-top: 24px; }
.cart-summary .row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.cart-summary .total { font-size: 1.3rem; color: var(--navy); font-weight: 600; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }

/* ---- Footer ---- */
.site-footer {
  background: var(--navy); color: var(--cream); padding: 64px 0 32px;
  margin-top: 80px;
}
.site-footer a { color: rgba(250, 247, 242, 0.8); }
.site-footer a:hover { color: var(--gold); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 32px; margin-bottom: 32px; }
.footer-grid h4 { color: var(--gold); font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 12px; font-family: inherit; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; font-size: 14px; }
.footer-bottom {
  border-top: 1px solid rgba(250, 247, 242, 0.15);
  padding-top: 24px; font-size: 12px; color: rgba(250, 247, 242, 0.6);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

/* ---- Misc ---- */
.notice { padding: 16px; border-radius: var(--radius); margin: 16px 0; }
.notice.warn { background: rgba(201,169,97,0.15); border: 1px solid var(--gold); color: var(--navy); }
.notice.ok { background: rgba(46,160,67,0.1); border: 1px solid #46a86b; color: #2a6e44; }
.notice.error { background: rgba(220,80,80,0.1); border: 1px solid #c44; color: #a22; }

.disclaimer {
  background: var(--cream-2); padding: 16px 24px; font-size: 12px;
  color: var(--ink-2); text-align: center; line-height: 1.5;
}

/* Accessibility */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Print: kill nav/footer for receipt printing if ever needed */
@media print { .site-header, .site-footer, .hamburger { display: none; } }

/* =============================================================================
   Category nav, banners, featured + variant cards (added in product L4 build)
   ============================================================================= */

/* Category nav: horizontal pills, scrollable on mobile */
.category-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 24px;
  padding: 0;
}
.cat-pill {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--cream-2);
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.cat-pill:hover { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.cat-pill.active { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.cat-pill .cat-count { font-size: 11px; opacity: 0.7; margin-left: 2px; }

@media (max-width: 768px) {
  .category-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .cat-pill { flex: 0 0 auto; }
}

/* Category banner */
.category-banner {
  margin: 0 0 32px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cream-2);
}
.category-banner img {
  width: 100%;
  height: clamp(160px, 28vw, 320px);
  object-fit: cover;
  display: block;
}
.category-banner > div {
  padding: 12px 16px;
  color: var(--ink-2);
  font-size: 15px;
}

/* Featured badge on product card */
.product-card { position: relative; }
.badge-featured {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--gold);
  color: var(--navy);
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
  font-weight: 700;
  z-index: 1;
}

/* Bundle marker on product detail */
.bundle-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--navy);
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 2px;
  margin: 8px 0;
}

/* Variant (tier) card — extended layout */
.tier-option {
  gap: 12px;
  align-items: stretch;
}
.tier-option.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.tier-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.tier-body { flex: 1; min-width: 0; }
.tier-body .label { font-weight: 600; }
.tier-body .muted { font-size: 13px; }
.tier-desc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.tier-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.tier-price { font-weight: 600; color: var(--ink); }
.tier-oos {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a22;
}
.tier-low {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-deep);
}

/* =============================================================================
   Chatbot widget
   Pulled into the same palette as the rest of the storefront so theme
   changes flow through. Mobile = full-screen panel.
   ============================================================================= */
.sombrio-chatbot { position: fixed; right: 20px; bottom: 20px; z-index: 9999; font-family: inherit; }

.sombrio-chatbot-button {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--navy); color: var(--cream);
  border: 1px solid var(--gold); box-shadow: var(--shadow);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, background 0.2s;
  padding: 0;
}
.sombrio-chatbot-button:hover { background: var(--navy-2); transform: translateY(-2px); }
.sombrio-chatbot-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.sombrio-chatbot-panel {
  position: absolute; right: 0; bottom: 72px;
  width: 360px; height: 500px; max-height: calc(100vh - 100px);
  background: var(--cream); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}

.sombrio-chatbot-header {
  background: var(--navy); color: var(--cream);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gold-deep);
}
.sombrio-chatbot-title { font-weight: 600; letter-spacing: 0.02em; }
.sombrio-chatbot-close {
  background: transparent; color: var(--cream); border: 0;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.sombrio-chatbot-close:hover { color: var(--gold); }

.sombrio-chatbot-messages {
  flex: 1; overflow-y: auto; padding: 12px;
  background: var(--cream); display: flex; flex-direction: column; gap: 8px;
}
.sombrio-chatbot-msg {
  max-width: 85%; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; line-height: 1.4; word-wrap: break-word;
}
.sombrio-chatbot-msg p { margin: 0 0 6px; }
.sombrio-chatbot-msg p:last-child { margin-bottom: 0; }
.sombrio-chatbot-msg.visitor {
  align-self: flex-end; background: var(--navy); color: var(--cream);
  border-bottom-right-radius: 2px;
}
.sombrio-chatbot-msg.visitor a { color: var(--gold); }
.sombrio-chatbot-msg.bot {
  align-self: flex-start; background: var(--cream-2); color: var(--ink);
  border: 1px solid var(--line); border-bottom-left-radius: 2px;
}
.sombrio-chatbot-msg.bot a { color: var(--navy); text-decoration: underline; }
.sombrio-chatbot-msg.typing { display: flex; gap: 4px; padding: 12px; }
.sombrio-chatbot-msg.typing span {
  width: 6px; height: 6px; background: var(--ink-2); border-radius: 50%;
  opacity: 0.6; animation: somChatBlink 1s infinite;
}
.sombrio-chatbot-msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.sombrio-chatbot-msg.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes somChatBlink {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-2px); }
}

.sombrio-chatbot-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 12px 8px;
}
.sombrio-chatbot-pill {
  background: transparent; color: var(--navy);
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; padding: 4px 10px; cursor: pointer;
}
.sombrio-chatbot-pill:hover { background: var(--gold); color: var(--navy); border-color: var(--gold); }

.sombrio-chatbot-email-row { padding: 0 12px 6px; }
.sombrio-chatbot-email {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 4px;
  background: #fff; font-size: 13px; font-family: inherit;
}

.sombrio-chatbot-inputrow {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--line); background: var(--cream);
}
.sombrio-chatbot-input {
  flex: 1; resize: none; min-height: 36px; max-height: 100px;
  padding: 8px 10px; font-family: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 4px;
  background: #fff; color: var(--ink);
}
.sombrio-chatbot-input:focus { outline: 1px solid var(--gold); }
.sombrio-chatbot-send {
  background: var(--gold); color: var(--navy);
  border: 1px solid var(--gold-deep); border-radius: 4px;
  padding: 0 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.sombrio-chatbot-send:hover { background: var(--gold-deep); color: var(--cream); }
.sombrio-chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; }

.sombrio-chatbot-footer {
  padding: 6px 12px 8px; font-size: 10px; color: var(--ink-2);
  text-align: center; background: var(--cream-2); border-top: 1px solid var(--line);
}

@media (max-width: 600px) {
  .sombrio-chatbot { right: 12px; bottom: 12px; }
  .sombrio-chatbot-panel {
    position: fixed; inset: 0;
    width: 100%; height: 100%; max-height: none;
    border-radius: 0; bottom: 0;
  }
}
