/* ============================================================
   InnerWell — Shopify-style one-page / one-step checkout
   Vanilla CSS, no framework. Mirrors Shopify Checkout One layout:
   - 2 columns: form (left, white) + summary (right, grey w/ left rule)
   - floating labels, single accent button, mobile summary collapse
   Charcoal / gold InnerWell brand.
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-summary: #f5f5f4;       /* faint warm grey (no hue, won't read pink/purple) */
  --ink: #2A2E33;              /* charcoal */
  --ink-soft: #565b61;         /* mid grey */
  --ink-faint: #7c8088;        /* light grey */
  --line: #d7d9dc;             /* grey */
  --line-soft: #e6e7e9;        /* grey */
  --field-bg: #ffffff;
  --accent: #2A2E33;           /* charcoal — checkbox accent + confirm button */
  --accent-ink: #ffffff;
  --focus: #2A2E33;            /* charcoal focus ring */
  --error: #d20f0f;
  --green: #00b67a;            /* trust / secure marks */
  --gold: #ffcd5b;             /* brand gold (accents only) */
  --radius: 6px;
  --maxw: 1180px;
  --form-w: 560px;
  --sum-w: 380px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.4;
}

/* ---------- Layout shell ----------
   Two full-height halves like Shopify: white form (left) + grey summary (right),
   each content block hugging the center divider. */
.checkout {
  display: flex;
  min-height: 100vh;
}
.checkout__main {
  flex: 1 1 56%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;              /* push content toward the center divider */
  padding: 28px 44px 64px;
}
.checkout__main > * { width: 100%; max-width: var(--form-w); }
.checkout__summary {
  flex: 1 1 44%;
  background: var(--bg-summary);
  border-left: 1px solid var(--line-soft);
  padding: 44px 44px 64px;
}
.summary__inner { position: sticky; top: 44px; max-width: var(--sum-w); }

/* ---------- Top bar (full-width, centered logo + divider) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: center;
  padding: 22px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
}
.topbar__logo { width: 300px; max-width: 82%; height: auto; display: block; }
@media (max-width: 480px) { .topbar { padding: 16px; } .topbar__logo { width: 240px; } }

/* ---------- Blocks ---------- */
.block { border: 0; margin: 0 0 22px; padding: 0; }
.block__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 0 12px;
}
.block__head h2 { font-size: 18px; font-weight: 600; margin: 0; }
.secure-sub { font-size: 14px; color: var(--ink-soft); line-height: 1.5; margin: -4px 0 16px; }

/* ---------- Fields w/ floating labels ---------- */
.field { position: relative; margin: 0 0 12px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field-row--3 { flex-wrap: wrap; }
.field-row--3 .field { flex: 1 1 30%; min-width: 90px; }

.field input,
.field select {
  width: 100%;
  height: 52px;
  padding: 18px 12px 4px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  appearance: none;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field select { padding-top: 16px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c8088' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input:focus,
.field select:focus,
.sp-field.focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 1px var(--focus);
}
.field input::placeholder { color: transparent; }

.field label {
  position: absolute; left: 13px; top: 16px;
  font-size: 15px; color: var(--ink-faint);
  pointer-events: none; transition: all .12s ease;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field select:valid + label,
.field select:focus + label { top: 7px; font-size: 11px; color: var(--ink-faint); }

/* ---- Payment card fields: clean placeholder style (matches Shopify's card iframes) ---- */
.card-input,
.card__body .sp-field {
  width: 100%; height: 52px; box-sizing: border-box;
  margin: 0 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--field-bg);
  transition: border-color .12s, box-shadow .12s;
}
.card-input {
  padding: 0 12px; font-size: 15px; font-family: inherit; color: var(--ink); outline: none;
}
.card-input::placeholder { color: var(--ink-faint); opacity: 1; }
.card-input:focus { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
/* Spreedly renders an <input> inside the iframe; we size + vertically center the frame */
.card__body .sp-field { padding: 0 12px; }
/* iframe fills the whole field so the entire box is clickable (not just a center band) */
.sp-field iframe { width: 100% !important; height: 50px; border: 0; display: block; }
/* Card-number lock + CVV help icon (positioned in a reserved right gutter so they don't overlap input) */
.sp-wrap { position: relative; }
.sp-wrap .sp-field { margin: 0; }
.sp-wrap--num { margin: 0 0 12px; }
.sp-wrap--num .sp-field, .sp-wrap--cvv .sp-field { padding-right: 42px; }
.sp-lock { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.cvv-help {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink-faint); cursor: help;
  font-size: 12px; line-height: 16px; text-align: center; font-weight: 700; outline: none;
}
.cvv-tip {
  position: absolute; bottom: calc(100% + 10px); right: -6px; width: 230px;
  background: var(--ink); color: #fff; font-size: 13px; line-height: 1.45; font-weight: 400;
  padding: 10px 12px; border-radius: 8px; text-align: left;
  opacity: 0; visibility: hidden; transition: opacity .12s ease; z-index: 30;
}
.cvv-tip::after {
  content: ''; position: absolute; top: 100%; right: 12px;
  border: 6px solid transparent; border-top-color: var(--ink);
}
.cvv-help:hover .cvv-tip, .cvv-help:focus .cvv-tip { opacity: 1; visibility: visible; }
.card__body .sp-field.focus { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.card-grid { display: flex; gap: 12px; }
.card-grid > * { flex: 1; }
.field.invalid input,
.field.invalid select,
.card-input.invalid,
.sp-field.invalid { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }

/* ---------- Checkboxes ---------- */
.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; color: var(--ink-soft); margin: 4px 0 2px; cursor: pointer;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Shipping methods ---------- */
.ship-methods { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ship-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.ship-opt:last-child { border-bottom: 0; }
.ship-opt.selected { background: #eef0f1; box-shadow: inset 0 0 0 1px var(--focus); }
.ship-opt input { width: 18px; height: 18px; accent-color: var(--focus); }
.ship-opt__name { flex: 1; }
.ship-opt__price { font-weight: 600; }

/* ---------- Card block ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card__bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #f6f6f5; border-bottom: 1px solid var(--line-soft);
  padding: 11px 14px; font-size: 13px; color: var(--ink-soft);
}
.card__brands { display: flex; gap: 6px; align-items: center; }
.card__brands img { height: 24px; width: auto; display: block; }
.card__body { padding: 14px; }

/* ---------- Errors ---------- */
.errors {
  background: #fdecec; border: 1px solid #f4bcbc; color: var(--error);
  border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin: 0 0 14px;
}
.errors ul { margin: 0; padding-left: 18px; }

/* ---------- Pay button ---------- */
.pay-btn {
  width: 100%; height: 54px; margin-top: 6px;
  background: #2A2E33; color: #fff;
  border: 0; border-radius: var(--radius);
  font-size: 17px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: opacity .12s, transform .02s;
}
.pay-btn:hover:not(:disabled) { opacity: .9; }
.pay-btn:active:not(:disabled) { transform: translateY(1px); }
.pay-btn:disabled { opacity: .45; cursor: not-allowed; }
.pay-btn.loading .pay-btn__label { opacity: .65; }
.pay-btn__spin {
  width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; display: none;
  animation: spin .7s linear infinite;
}
.pay-btn.loading .pay-btn__spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.terms-note { font-size: 13px; line-height: 1.5; color: var(--ink-faint); text-align: center; margin: 16px 0 0; }
.terms-note a { color: var(--ink-soft); text-decoration: underline; }

/* ---------- Billing address (revealed when "same as shipping" is unchecked) ---------- */
.billing { margin: 14px 0 2px; }
.billing__title { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
#checkoutForm:has(#billingSame:checked) #billingForm { display: none; }

/* ---------- Footer ---------- */
.foot {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--ink-soft);
}
.foot a { color: var(--ink-soft); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- Order summary ---------- */
.summary__lines { list-style: none; margin: 0 0 18px; padding: 0; }
.summary__skeleton { color: var(--ink-faint); font-size: 14px; }
.line { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.line__media { position: relative; flex: 0 0 64px; }
.line__img {
  width: 64px; height: 64px; object-fit: cover;
  border: 1px solid var(--line-soft); border-radius: 8px; background: #fff;
}
.line__qty {
  position: absolute; top: -8px; right: -8px;
  min-width: 20px; height: 20px; padding: 0 5px;
  background: #565b61; color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.line__info { flex: 1; }
.line__name { font-size: 14px; font-weight: 500; }
.line__price { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; text-align: right; }
.line__compare { color: var(--error); text-decoration: line-through; font-size: 13px; }
.line__real { color: var(--ink); font-weight: 700; font-size: 15px; }
.line__save { color: var(--ink-faint); font-size: 12px; }

.summary__totals { margin: 16px 0 0; }
.summary__totals .row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 10px; font-size: 14px; color: var(--ink-soft);
}
.summary__totals .row[hidden] { display: none; }   /* flex above otherwise overrides [hidden] */
.summary__totals .row--total {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft);
  color: var(--ink); align-items: baseline;
}
.row--total dt { font-size: 16px; font-weight: 600; }
.row--total dd { font-size: 22px; font-weight: 700; }
.row--total .cur { font-size: 12px; color: var(--ink-faint); font-weight: 500; margin-right: 4px; }
.summary__totals dt, .summary__totals dd { margin: 0; }
.summary__totals .row.row--recurring { margin-top: 12px; font-size: 12px; color: var(--ink-faint); }
.summary__totals .row--recurring dt, .summary__totals .row--recurring dd { font-weight: 400; }

/* ---------- Mobile summary toggle ---------- */
.summary-toggle {
  display: none;
  width: 100%; padding: 16px 20px;
  background: var(--bg-summary);
  border: 0; border-bottom: 1px solid var(--line-soft);
  align-items: center; justify-content: space-between;
  font-size: 15px; color: var(--ink-soft); cursor: pointer;
}
.summary-toggle__label { display: inline-flex; align-items: center; gap: 8px; }
.summary-toggle__chev { transition: transform .18s; }
.summary-toggle[aria-expanded="true"] .summary-toggle__chev { transform: rotate(180deg); }
.summary-toggle__total { color: var(--ink); font-weight: 700; font-size: 17px; }

/* ============================ Responsive ============================ */
@media (max-width: 920px) {
  .checkout { flex-direction: column; }
  .checkout__main {
    align-items: stretch;            /* stop hugging the divider once stacked */
    padding-left: 20px; padding-right: 20px;
  }
  .checkout__main > * { max-width: 100%; }
  .checkout__summary {
    max-width: 100%; width: 100%; padding-left: 20px; padding-right: 20px;
    order: -1; border-left: 0; border-bottom: 1px solid var(--line-soft);
    display: none; padding-top: 20px; padding-bottom: 20px;
  }
  .checkout__summary.open { display: block; }
  .summary__inner { position: static; max-width: 100%; }
  .summary-toggle { display: flex; }
  .checkout__main { padding-top: 20px; }
}

@media (max-width: 480px) {
  .field-row { flex-direction: column; gap: 0; }
  .field-row--3 { flex-direction: row; flex-wrap: nowrap; gap: 8px; }
  .checkout__main { padding-bottom: 48px; }
}

/* ==================== 17px minimum — readable for older eyes ==================== */
body,
.field input, .field select, .card-input, .field label,
.ship-opt, .check,
.line__name, .line__real, .line__compare, .line__save,
.card__bar, .errors, .errors ul, .errors li, .secure-sub, .foot,
.summary__skeleton, .summary-toggle,
.row--total dt, .summary__totals .row { font-size: 17px; }
/* Kept smaller on purpose (layout, not body text): floated field labels, qty badge, card-brand chips */
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field select:valid + label, .field select:focus + label,
.line__qty, .card__brands img { font-size: 11px; }
.line__qty { font-size: 12px; }
.terms-note, .terms-note a { font-size: 13px; }
