/* lw-brand.css — The Living Word brand layer, loaded on EVERY page.
 *
 * Scope: only what the deterministic exact-hex recolor cannot reach —
 *   (1) the page ground token, (2) the header logo render fix, (3) the added tier ladder,
 *   (4) the drawer's savings rows, (5) the ATC/checkout busy state.
 * It adds no sections and changes no template structure.
 *
 * Tokens are measured (see baseline/brand-inputs/brand-tokens.md):
 *   gold is NEVER a button and NEVER body text (white-on-gold 2.38, gold-on-cream 2.20).
 *   --rose is the cover's blush deepened until white text clears 5.07.
 */

:root {
  --lw-bg:            #FAF5F1;
  --lw-surface:       #FFFFFF;
  --lw-surface-blush: #FBEEF0;
  --lw-blush:         #F1CFD4;
  --lw-blush-deep:    #DFBBBF;
  --lw-rose:          #A85562;
  --lw-rose-deep:     #8E4450;
  --lw-gold:          #C5A369;
  --lw-gold-text:     #7A5C2E;
  --lw-ink:           #2A2124;
  --lw-ink-2:         #5A4A4E;
  --lw-ink-3:         #8A767A;
}

/* ---------------------------------------------------------------- 1. page ground
   The template's ground is pure white. Re-skinning it to our warm cream is done by moving the
   THEME'S OWN scheme variable, not by find/replacing every #ffffff — which would also have
   recoloured white type sitting on the rose bands. */
.color-background-1,
.gradient.color-background-1 { --color-background: 250, 245, 241; }
body { background-color: var(--lw-bg); }

/* ---------------------------------------------------------------- 2. header logo
   S3-4: the theme sized the logo slot for its own wordmark, so a swapped <img width:auto>
   collapses to 0 width and vanishes. Force it in-flow at a real height on every page type. */
.header__heading-link .header__heading-logo,
.header__heading-link img {
  display: block !important;
  width: auto !important;
  height: 34px !important;
  max-height: 34px !important;
  min-width: 96px !important;
  object-fit: contain !important;
}
@media screen and (min-width: 990px) {
  .header__heading-link .header__heading-logo,
  .header__heading-link img { height: 42px !important; max-height: 42px !important; min-width: 128px !important; }
}
/* ---------------------------------------------------------------- 2b. operator decision D4
   The header is stripped to logo + cart icon and the footer is gone.
   The logo is CENTRED: a three-track grid (spacer | logo | icons) puts it at the true optical
   centre of the header regardless of how wide the cart icon is — which a flex row with
   space-between cannot do with only two children.
   The theme's own `grid-template-areas: "heading navigation icons"` still names three areas, so
   the placements below are set explicitly rather than relying on source order. */
.header {
  display: grid !important;
  grid-template-areas: none !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  gap: 1rem;
  padding-top: 1rem; padding-bottom: 1rem;
}
.header__heading, .header__heading-link {
  margin: 0 !important;
  grid-area: auto !important;
  grid-column: 2 !important;
  justify-self: center !important;
}
.header__icons {
  grid-area: auto !important;
  grid-column: 3 !important;
  justify-self: end !important;
}
.lw-header-logo {
  display: block;
  height: 34px; width: auto; max-width: 62vw;
  object-fit: contain;
}
@media screen and (min-width: 750px) { .lw-header-logo { height: 44px; } }
/* NOTE: do NOT display:none the footer section-group. After removeFooter() the only thing left in
   it is screen-reader boilerplate and the theme's inline script that drives the sticky-ATC binding
   and the scroll-reveal IntersectionObserver. The <footer> element itself is already deleted. */
.footer-wrapper { display: none !important; }

/* ---------------------------------------------------------------- 3. the tier ladder
   Operator decision D1 — the ONE sanctioned addition to the template. Rendered from
   STOREFRONT_CONFIG.tiers; no price is ever hand-typed. */
.lw-tiers { display: grid; gap: .625rem; margin: 1rem 0 1.125rem; }
.lw-tier {
  /* four children — radio · thumbnail · text · price — so the grid needs four columns.
     With three, the price wrapped onto a second row under the radio. */
  position: relative; display: grid; grid-template-columns: auto auto 1fr auto;
  align-items: center; gap: .75rem;
  padding: .875rem .875rem; border: 2px solid var(--lw-blush-deep); border-radius: 10px;
  background: var(--lw-surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.lw-tier:hover { border-color: var(--lw-rose); }
.lw-tier[aria-checked="true"] { border-color: var(--lw-rose); background: var(--lw-surface-blush); }
.lw-tier__radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--lw-blush-deep); background: var(--lw-surface); flex: none;
}
.lw-tier[aria-checked="true"] .lw-tier__radio { border-color: var(--lw-rose); box-shadow: inset 0 0 0 4px var(--lw-rose); }
.lw-tier__img { width: 46px; height: 46px; object-fit: contain; flex: none; }
/* the label/sub are <span>s inside a <span>; without an explicit block they run together
   ("1 BookOne copy, for you.") */
.lw-tier__text  { display: block; min-width: 0; }
.lw-tier__text  { text-align: left; }
.lw-tier__label { display: block; font-weight: 700; color: var(--lw-ink); line-height: 1.25; }
.lw-tier__sub   { display: block; font-size: .8125rem; color: var(--lw-ink-2); line-height: 1.3; margin-top: .1rem; }
.lw-tier__price { text-align: right; white-space: nowrap; }
.lw-tier__now { display: block; font-weight: 700; color: var(--lw-ink); }
.lw-tier__was { display: block; font-size: .8125rem; color: var(--lw-ink-3); text-decoration: line-through; }
.lw-tier__badge {
  position: absolute; top: -9px; right: 12px;
  background: var(--lw-rose); color: #fff;
  font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .2rem .5rem; border-radius: 999px;
}
/* the ladder's own price bar, mirrored into any display outside .buybox */
.lw-price-bar { display: flex; align-items: baseline; gap: .5rem; margin: .25rem 0 .75rem; }
.lw-price-bar .lw-now { font-size: 1.5rem; font-weight: 700; color: var(--lw-ink); }
.lw-price-bar .lw-was { font-size: 1rem; color: var(--lw-ink-3); text-decoration: line-through; }
.lw-price-bar .lw-off {
  font-size: .75rem; font-weight: 700; color: #fff; background: var(--lw-rose);
  padding: .15rem .45rem; border-radius: 4px;
}

/* ---------------------------------------------------------------- 3b. drawer empty-state gate
   The theme decides "empty" from its own `is-empty` classes, which never update on a static clone.
   We drive it from the real cart instead: lw-cart.js puts `lw-has-items` on <cart-drawer>, and
   these rules win over the theme's. Without this a full cart renders into a display:none form and
   the drawer shows "Continue shopping" over a populated subtotal. */
cart-drawer.lw-has-items .drawer__inner-empty { display: none !important; }
cart-drawer.lw-has-items .cart-drawer__form,
cart-drawer.lw-has-items .cart__contents { display: flex !important; }
cart-drawer.lw-has-items .drawer__inner { display: flex !important; flex-direction: column; }
cart-drawer.lw-has-items #CartDrawer-CartItems { display: block !important; }
/* operator: no account/login prompt anywhere in the drawer */
.cart__login-title, .cart__login-paragraph { display: none !important; }

/* ---------------------------------------------------------------- 4. drawer savings (D6) */
.lw-lines { display: grid; gap: .875rem; }
.lw-line { display: grid; grid-template-columns: 72px 1fr auto; gap: .75rem; align-items: center; }
.lw-line__img { border-radius: 8px; background: var(--lw-surface-blush); object-fit: contain; }
.lw-line__title { margin: 0 0 .35rem; font-weight: 600; color: var(--lw-ink); line-height: 1.3; }
.lw-line__qty { display: inline-flex; align-items: center; gap: .5rem; }
.lw-qty {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--lw-blush-deep);
  background: var(--lw-surface); color: var(--lw-ink); line-height: 1; cursor: pointer;
}
.lw-line__price { text-align: right; }
.lw-was { display: block; font-size: .8125rem; color: var(--lw-ink-3); }
.lw-paid { display: block; font-weight: 700; color: var(--lw-ink); }
.lw-savings {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 .4rem; font-weight: 700; color: var(--lw-rose);
}
.lw-was-total { margin-right: .4rem; color: var(--lw-ink-3); font-weight: 400; }

/* ---------------------------------------------------------------- 5. click feedback
   Our interception suppresses the theme's native ATC feedback, so we replicate it. A button with
   no response to a click reads as broken. */
.lw-busy { position: relative; pointer-events: none; opacity: .85; }
.lw-busy::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,.55); border-top-color: #fff; border-radius: 50%;
  animation: lw-spin .7s linear infinite;
}
@keyframes lw-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 6. sticky ATC gate
   The template's own trigger misfires on the clone (it appeared during the product carousel), so
   we drive it deterministically off a body class set from the buy box's rect. */
body:not(.lw-past-buybox) .sticky-atc,
body:not(.lw-past-buybox) [class*="sticky-atc"] { opacity: 0 !important; pointer-events: none !important; }
body.lw-past-buybox .sticky-atc,
body.lw-past-buybox [class*="sticky-atc"] { opacity: 1 !important; pointer-events: auto !important; }

/* ---------------------------------------------------------------- 7. scripture treatment */
.lw-scripture { font-style: italic; color: var(--lw-gold-text); }
.lw-scripture cite { font-style: normal; font-variant: small-caps; letter-spacing: .04em; }
