/* BacWaters — RUO bacteriostatic-water storefront
 * Design tokens: clinical white + lab blue + soft slate.
 * Original styling (no third-party CSS frameworks).
 */

:root {
  --bg:          #FFFFFF;
  --bg-soft:     #F5F8FB;
  --bg-elev:     #ECF1F6;
  --line:        #DDE5EE;
  --gold:        #1F6FB2;       /* primary lab blue (kept var name for compat) */
  --gold-deep:   #155A93;
  --gold-soft:   rgba(31,111,178,.10);
  --accent:      #5BB8E6;
  --ivory:       #16242F;       /* dark slate text on light bg */
  --ivory-mute:  #5A6B7B;
  --rose:        #C28F88;
  --danger:      #C1392B;
  --ok:          #1F8F4E;

  --serif: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --w-max: 1320px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 18px;
  --shadow-1: 0 1px 2px rgba(20,40,70,.04), 0 8px 24px rgba(20,40,70,.07);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--ivory); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.05; margin: 0 0 .5em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); line-height: 1.15; margin: 0 0 .5em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }

.eyebrow { font-family: var(--sans); font-size: .72rem; font-weight: 600;
           letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: var(--w-max); margin: 0 auto; padding: 0 var(--gutter); }
.section   { padding: clamp(2.4rem, 6vw, 5.5rem) 0; }
.divider   { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-deep), transparent); margin: 0; opacity: .6; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 920px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 0; gap: 1.25rem;
}
.site-header .brand {
  font-family: var(--sans); font-size: 1.25rem; letter-spacing: .04em;
  font-weight: 700; color: var(--ivory);
  display: inline-flex; align-items: center; gap: .55rem;
}
.site-header .brand .b-mark { font-size: 1.45rem; line-height: 1; }
.site-header .brand .b-word { color: var(--gold); }
.site-header nav { display: flex; gap: 1.4rem; align-items: center; }
.site-header nav a { font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--ivory-mute); }
.site-header nav a:hover { color: var(--gold); }
.site-header .icons { display: flex; gap: 1rem; }
.site-header .icons button {
  background: none; border: 0; color: var(--ivory); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; gap: .25rem;
}
.site-header .icons button:hover { color: var(--gold); }
.cart-count {
  display: inline-block; min-width: 1.2em; padding: 0 .35em;
  background: var(--gold); color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.4em; text-align: center;
}
.cart-count.hidden { display: none; }
.menu-toggle { display: none; background: none; border: 0; color: var(--ivory); cursor: pointer; }
@media (max-width: 920px) {
  .site-header nav { display: none; }
  .menu-toggle { display: inline-block; }
}

.site-header .announcement {
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--accent));
  color: #fff; font-size: .76rem; letter-spacing: .14em;
  text-transform: uppercase; text-align: center; padding: .45rem 0; font-weight: 700;
}

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  min-height: 60vh; display: grid; place-items: center; text-align: center;
  background:
    radial-gradient(ellipse at top, rgba(91,184,230,.18), transparent 60%),
    linear-gradient(180deg, #FFFFFF 0%, #ECF4FB 100%);
  padding: 4rem 0;
  border-bottom: 1px solid var(--line);
}
.hero .eyebrow { margin-bottom: 1rem; }
.hero h1 { max-width: 22ch; margin-inline: auto; color: var(--ivory); }
.hero p  { max-width: 56ch; margin: 1rem auto 1.6rem; color: var(--ivory-mute); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .9rem 1.6rem; font-family: var(--sans); font-weight: 600;
  font-size: .85rem; letter-spacing: .12em; text-transform: uppercase;
  border: 1px solid var(--gold); background: transparent; color: var(--gold);
  border-radius: var(--r-sm); cursor: pointer; transition: .15s ease;
}
.btn:hover { background: var(--gold); color: #fff; }
.btn-primary {
  background: var(--gold); color: #fff; border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-deep); border-color: var(--gold-deep); color: #fff;
}
.btn-block { display: flex; width: 100%; }
.btn-ghost { border-color: var(--line); color: var(--ivory); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--gold); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Product card ───────────────────────────────────────────────────────── */
.card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden; transition: .2s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--gold-deep); box-shadow: var(--shadow-1); }
.card .ph { aspect-ratio: 4/5; background: var(--bg-elev); position: relative; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: .4s ease; }
.card:hover .ph img { transform: scale(1.04); }
.card .ribbon {
  position: absolute; top: .8rem; left: .8rem;
  background: var(--gold); color: #fff;
  padding: .2rem .55rem; font-size: .65rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; border-radius: 2px;
}
.card .body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.card .title { font-family: var(--sans); font-weight: 600; font-size: 1rem; line-height: 1.3; color: var(--ivory); }
.card .price { color: var(--gold); font-weight: 600; letter-spacing: .04em; }
.card .compare { color: var(--ivory-mute); text-decoration: line-through; font-size: .85rem; margin-left: .5em; }
.card .meta { font-size: .78rem; color: var(--ivory-mute); }

/* ── PDP ────────────────────────────────────────────────────────────────── */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
@media (max-width: 900px) { .pdp { grid-template-columns: 1fr; gap: 1.5rem; } }
.gallery { display: grid; grid-template-columns: 80px 1fr; gap: 1rem; }
.gallery .thumbs { display: flex; flex-direction: column; gap: .5rem; max-height: 580px; overflow-y: auto; }
.gallery .thumbs img { width: 80px; height: 100px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); border-radius: var(--r-sm); }
.gallery .thumbs img.active { border-color: var(--gold); }
.gallery .main img { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); }
@media (max-width: 540px) {
  .gallery { grid-template-columns: 1fr; }
  .gallery .thumbs { flex-direction: row; max-height: none; overflow-x: auto; }
}

.pdp .price { font-size: 1.6rem; color: var(--gold); }
.option { display: flex; flex-direction: column; gap: .4rem; margin: 1rem 0; }
.option label { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ivory-mute); }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch {
  padding: .55rem 1rem; border: 1px solid var(--line); background: var(--bg-soft);
  color: var(--ivory); cursor: pointer; font-size: .85rem; border-radius: var(--r-sm); transition: .15s;
}
.swatch:hover { border-color: var(--gold); }
.swatch.active { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); }
.swatch[disabled] { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

.tabs { border-top: 1px solid var(--line); margin-top: 2rem; }
.tabs .tab-bar { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); }
.tabs .tab { padding: 1rem 0; cursor: pointer; font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ivory-mute); border-bottom: 2px solid transparent; }
.tabs .tab.active { color: var(--gold); border-color: var(--gold); }
.tab-panel { display: none; padding: 1.5rem 0; }
.tab-panel.active { display: block; }

.sticky-buy {
  position: fixed; bottom: 0; left: 0; right: 0; padding: .75rem var(--gutter);
  background: rgba(10,10,10,.96); border-top: 1px solid var(--gold-deep); z-index: 40;
  display: none;
}
@media (max-width: 720px) { .sticky-buy { display: flex; gap: .75rem; align-items: center; } }
.sticky-buy .price { color: var(--gold); font-weight: 700; }

/* ── Cart / drawer ──────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 90; display: none;
}
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw);
  background: var(--bg-soft); border-left: 1px solid var(--line); z-index: 91;
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer .head { display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.drawer .body { flex: 1; overflow: auto; padding: 1rem 1.25rem; }
.drawer .foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); }
.line-item { display: grid; grid-template-columns: 70px 1fr auto; gap: .75rem; padding: .75rem 0;
             border-bottom: 1px solid var(--line); }
.line-item img { width: 70px; height: 88px; object-fit: cover; border-radius: var(--r-sm); }
.line-item .li-meta { font-size: .82rem; color: var(--ivory-mute); }
.qty { display: inline-flex; align-items: center; gap: .35rem; }
.qty button { background: var(--bg-elev); border: 1px solid var(--line); color: var(--ivory);
              width: 28px; height: 28px; border-radius: var(--r-sm); cursor: pointer; }
.qty input { width: 38px; background: transparent; border: 1px solid var(--line); color: var(--ivory);
             text-align: center; padding: .25rem; border-radius: var(--r-sm); }

.free-ship-bar {
  background: var(--bg-elev); padding: .55rem .75rem; border-radius: var(--r-sm);
  font-size: .8rem; color: var(--ivory-mute); margin-bottom: .75rem;
}
.free-ship-bar .progress { height: 4px; background: var(--line); border-radius: 999px; margin-top: .35rem; overflow: hidden; }
.free-ship-bar .progress > div { height: 100%; background: var(--gold); transition: width .3s; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
input, select, textarea {
  width: 100%; padding: .75rem .9rem; background: var(--bg-elev); color: var(--ivory);
  border: 1px solid var(--line); border-radius: var(--r-sm); font-family: inherit; font-size: .95rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft);
}
label.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
label.field span { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ivory-mute); }

/* ── Filters ────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center;
  padding: 1rem 0; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem;
}
.filter-bar select { width: auto; min-width: 160px; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--line); padding: 3rem 0 1.5rem; margin-top: 4rem;
  background: var(--bg-soft);
}
footer .cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
@media (max-width: 720px) { footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { footer .cols { grid-template-columns: 1fr; } }
footer h4 { letter-spacing: .14em; text-transform: uppercase; font-size: .82rem; color: var(--gold); }
footer ul { list-style: none; padding: 0; margin: 0; }
footer li { padding: .25rem 0; font-size: .9rem; color: var(--ivory-mute); }
footer .legal { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
                 display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
                 font-size: .8rem; color: var(--ivory-mute); }

/* ── Utility ────────────────────────────────────────────────────────────── */
.muted { color: var(--ivory-mute); }
.gold { color: var(--gold); }
.center { text-align: center; }
.hidden { display: none !important; }
.skeleton { background: linear-gradient(90deg, var(--bg-soft), var(--bg-elev), var(--bg-soft));
            background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.flash { padding: .75rem 1rem; border-radius: var(--r-sm); margin: 1rem 0; }
.flash.ok    { background: rgba(111,207,126,.1); border: 1px solid var(--ok); color: var(--ok); }
.flash.err   { background: rgba(226,92,92,.1);  border: 1px solid var(--danger); color: var(--danger); }

/* Stripe / Square element wrappers */
#stripe-card, #square-card-container {
  padding: .75rem .9rem; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: var(--r-sm); min-height: 48px;
}
