/* The Lamp & Oil Co. store styles. Uses the colors and fonts from styles.css. Mobile-first. */

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- buttons and small controls (44px minimum tap size) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0 1.5rem;
  font: inherit; font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { border-color: var(--gold); background: #2a221b; }
.btn:disabled, .btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.text-link {
  display: inline-block; font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase;
  text-decoration: none; padding: 0.75rem 0 0.35rem; border-bottom: 1px solid var(--ink-soft);
}
.text-link:hover { border-color: var(--gold); }


/* ---------- header additions (home page and shop pages) ---------- */
.header-actions { display: flex; align-items: center; gap: 1rem; }
.header-actions a { text-decoration: none; font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.9; }
.header-actions a:hover { opacity: 1; }

/* Shop pages: a deliberate solid bar that stays at the top while you scroll */
.shop-page .site-header {
  position: sticky; top: 0; color: var(--ink); background: var(--paper);
  border-bottom: 1px solid var(--line);
}

/* ---------- shop page ---------- */
.page-head { padding: 4rem 0 0; }
.page-head h1 { font-size: clamp(2.25rem, 8vw, 4rem); }
.product-grid { display: grid; gap: 3.5rem 2rem; margin-top: 3rem; }
/* Every picture sits in the same 4:5 frame (max ~420px wide, centered) so the grid lines up.
   object-fit: contain never crops or stretches: the 3-pack's wider photo gets dark bands above and below. */
.product img {
  width: 100%; max-width: 420px; height: auto; margin-inline: auto;
  aspect-ratio: 4 / 5; object-fit: contain; background: #17110d;
}
.product-body { width: 100%; max-width: 420px; margin-inline: auto; padding-top: 1.25rem; }
.product-body h3 { margin: 0.35rem 0 0.6rem; font-size: 2rem; }
.product-desc { color: var(--ink-soft); }
.product-notes { color: var(--ink-soft); font-size: 0.9rem; margin-top: 0.4rem; }
.product-price { font-family: var(--serif); font-size: 1.75rem; margin-top: 1rem; }
.buy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.out-of-stock { display: inline-flex; align-items: center; min-height: 2.75rem; color: #b3261e; font-weight: 600; font-size: 1rem; }
.pack-list { list-style: none; margin: 0.75rem 0 0; padding: 0; color: var(--ink-soft); }
.facts { list-style: none; margin: 3rem 0 0; padding: 1.5rem 0 0; border-top: 1px solid var(--gold); display: grid; gap: 0.4rem; color: var(--ink-soft); }

.policies { display: grid; gap: 2rem; margin-top: 2.5rem; }
.policy h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.policy p + p { margin-top: 0.75rem; }
.policy p { color: var(--ink-soft); }
.policy a, .pay-soon a { color: inherit; }

/* Candle Burning Instructions (homepage) */
.instructions { background: var(--sand); }
.burn-list { margin: 2rem 0 0; padding-left: 1.25rem; display: grid; gap: 0.9rem; color: var(--ink-soft); }
.instructions h3 { font-size: 1.75rem; margin: 3rem 0 0.75rem; }
.instructions h3 + p { color: var(--ink-soft); }

/* Shipping Policy page */
.policy-page h2 { font-size: 1.5rem; margin: 2.5rem 0 0.5rem; }
.policy-page p, .policy-page li { color: var(--ink-soft); }
.policy-page ul { margin: 0; padding-left: 1.25rem; }
.policy-page p + p { margin-top: 1.25rem; }
.policy-page a { color: inherit; }

/* Product grid: 1 across on phones, 2 on tablets, 4 on desktop */
@media (min-width: 40rem) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 56rem) {
  .policies { grid-template-columns: 1fr 1fr; gap: 3rem; }   /* restored: Shipping and Returns side by side */
}
@media (min-width: 64rem) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- cart: header icon, badge and slide-out drawer ---------- */
body.cart-open { overflow: hidden; }
.cart-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; padding: 0; background: transparent; color: inherit; border: 0; cursor: pointer;
}
.cart-btn:hover { color: var(--gold); }
.cart-badge {
  position: absolute; top: 0.15rem; right: 0.05rem; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
  background: var(--gold); color: var(--ink); font-size: 0.7rem; font-weight: 700; line-height: 1;
}
.cart-badge.is-empty { display: none; }

.cart-overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(20, 16, 13, 0.55);
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0s 0.3s;
}
.cart-overlay.is-open { opacity: 1; visibility: visible; transition: opacity 0.3s; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(100%, 26rem); display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  transform: translateX(100%); visibility: hidden; transition: transform 0.3s ease, visibility 0s 0.3s;
}
.cart-drawer.is-open { transform: none; visibility: visible; transition: transform 0.3s ease; }
.cart-head { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.5rem 0.5rem 1.5rem; border-bottom: 1px solid var(--line); }
.cart-head h2 { font-size: 1.6rem; }
.cart-close { width: 2.75rem; height: 2.75rem; background: none; border: 0; cursor: pointer; font-size: 1.75rem; line-height: 1; color: inherit; }
.cart-body { flex: 1; overflow-y: auto; padding: 0.5rem 1.5rem; }
.cart-empty { padding: 2rem 0; color: var(--ink-soft); }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 4rem 1fr auto; gap: 0.25rem 1rem; align-items: start; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 4rem; height: 5rem; object-fit: cover; background: var(--sand); }
.cart-line-name { font-family: var(--serif); font-size: 1.2rem; line-height: 1.2; }
.cart-line-price { font-size: 0.85rem; color: var(--ink-soft); }
.cart-line-total { font-variant-numeric: tabular-nums; }
.cart-qty { display: inline-flex; align-items: center; border: 1px solid var(--line); background: #fffdf9; margin-top: 0.6rem; }
.cart-qty-btn { width: 2.75rem; height: 2.75rem; background: none; border: 0; cursor: pointer; font: inherit; font-size: 1.25rem; color: var(--ink); }
.cart-qty-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.cart-qty-val { min-width: 2.25rem; text-align: center; font-variant-numeric: tabular-nums; }
.cart-remove { display: block; min-height: 2.75rem; padding: 0; background: none; border: 0; cursor: pointer; font: inherit; font-size: 0.8rem; color: var(--ink-soft); text-decoration: underline; text-align: left; }
.cart-notice { margin-top: 1rem; font-size: 0.85rem; color: var(--ink-soft); }
.cart-foot { padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--gold); background: var(--paper); display: grid; gap: 0.75rem; }
.cart-foot .btn { width: 100%; min-height: 3.25rem; }
.cart-foot.is-empty .cart-ship { display: none; }
.cart-subtotal { display: flex; justify-content: space-between; font-size: 1.05rem; }
.cart-ship-text { font-size: 0.9rem; color: var(--ink-soft); }
.cart-ship-track { height: 4px; margin-top: 0.4rem; background: var(--line); }
.cart-ship-fill { height: 100%; width: 0; background: var(--gold); transition: width 0.3s ease; }
.cart-error { color: #b3261e; font-size: 0.9rem; }
.cart-error:empty { display: none; }

/* ---------- calls to action (homepage) ---------- */
.cta-block { background: var(--paper); color: var(--ink); padding: 2.5rem var(--gutter); }
.cta-inner { display: grid; justify-items: center; gap: 1rem; text-align: center; }
.cta-line { font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; }

.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: flex; align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--ink); color: var(--paper); border-top: 1px solid var(--gold);
  transform: translateY(100%); visibility: hidden;
  transition: transform 0.3s ease, visibility 0s 0.3s;
  contain: layout paint; /* the bar's repaints stay inside the bar */
}
.cta-bar.is-visible { transform: none; visibility: visible; transition: transform 0.3s ease; }
.cta-bar.is-moving { will-change: transform; } /* only while sliding (set by store.js) */
.cta-bar-link {
  flex: 1; min-height: 2.75rem; display: flex; align-items: center; justify-content: center;
  padding: 0 0.5rem 0 2.75rem; /* left padding balances the close button so the text stays centered */
  color: inherit; text-decoration: none; text-align: center;
  font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
}
.cta-bar-link:hover { color: var(--gold); }
.cta-bar-close {
  width: 2.75rem; height: 2.75rem; background: none; border: 0; cursor: pointer;
  color: inherit; font-size: 1.5rem; line-height: 1;
}
body.has-cta-bar { padding-bottom: 3.25rem; }

@media (min-width: 40rem) {
  .cta-inner { grid-auto-flow: column; justify-content: center; align-items: center; gap: 1.75rem; }
}
@media (min-width: 48rem) {
  /* On larger screens the bar sits at the top of the window instead */
  .cta-bar { top: 0; bottom: auto; padding-bottom: 0; border-top: 0; border-bottom: 1px solid var(--gold); transform: translateY(-100%); }
  .cta-bar.is-visible { transform: none; }
  /* No page padding for the top bar: it only appears after the hero has scrolled away, so nothing
     is waiting underneath it, and changing padding would re-lay-out the whole page. */
  body.has-cta-bar { padding-bottom: 0; }
  html { scroll-padding-top: 3.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cta-bar, .cart-drawer, .cart-overlay, .cart-ship-fill { transition: none; }
}
