/* =========================================================================
   WeddWedding — package builder wizard
   Loaded only on the /build route (head.php). Extends the main design system:
   warm cream canvas · charcoal ink · bronze/gold accents · Cormorant + Mulish.
   Progressive enhancement: the base layout is a usable stacked form; the
   `.build.is-live` class (added by builder.js) unlocks the stepped wizard,
   the progress bar, the nav and the sticky/drawer summary.
   ========================================================================= */

/* keep the honeypot label reachable-but-hidden text tidy */
.build [hidden] { display: none !important; }

/* ---- Shell + asymmetric grid ------------------------------------------- */
.build__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.6rem, 1rem + 2vw, 3rem);
  align-items: start;
}
.build__main { min-width: 0; }

@media (min-width: 901px) {
  .build.is-live .build__grid { grid-template-columns: minmax(0, 1fr) 20.5rem; }
}

/* ---- Progress (enhanced only) ------------------------------------------ */
.build__progress { display: none; }
.build.is-live .build__progress {
  display: block;
  margin-bottom: clamp(1.6rem, 1.1rem + 1.6vw, 2.6rem);
}
.build__ptrack {
  height: 4px; border-radius: 100px; overflow: hidden;
  background: color-mix(in srgb, var(--bronze) 16%, var(--sand));
}
.build__pfill {
  display: block; height: 100%; width: 16%; border-radius: 100px;
  background: linear-gradient(90deg, var(--gold), var(--bronze));
  transition: width .5s var(--ease);
}
.build__pnote {
  margin-top: .65rem; font-size: var(--fs-sm); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--text-mut);
}
.build__pnote b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Step ---------------------------------------------------------------
   Every step is visible by default (no-JS long form). builder.js sets the
   `hidden` attribute on inactive steps. */
.bstep { margin-bottom: clamp(2rem, 1.4rem + 2vw, 3.4rem); }
.bstep:last-of-type { margin-bottom: 0; }
.bstep__head {
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
  margin-bottom: clamp(1.2rem, .9rem + 1vw, 2rem);
  padding-bottom: .85rem; border-bottom: 1px solid var(--hair);
}
.bstep__no {
  font-family: var(--f-display); font-weight: 500; line-height: 1;
  font-size: clamp(1.5rem, 1.15rem + 1.1vw, 2.2rem);
  color: var(--bronze); font-variant-numeric: tabular-nums;
}
.bstep__no span { color: color-mix(in srgb, var(--text-mut) 65%, transparent); font-size: .58em; }
.bstep__title { font-size: clamp(1.55rem, 1.2rem + 1.5vw, 2.3rem); line-height: 1.05; }
.bstep__title:focus-visible { outline: 2px solid var(--bronze); outline-offset: 4px; }
.bstep__lead {
  color: var(--text-mut); font-size: var(--fs-lead); line-height: 1.5;
  max-width: 54ch; margin-bottom: clamp(1.3rem, 1rem + 1vw, 2rem); text-wrap: pretty;
}

/* ---- Category (fieldset + legend) -------------------------------------- */
.bcat {
  border: 0; padding: 0; min-inline-size: 0;
  margin: 0 0 clamp(1.7rem, 1.2rem + 1.6vw, 2.8rem);
}
.bcat:last-child { margin-bottom: 0; }
.bcat__legend {
  padding: 0; width: 100%;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .45rem .9rem;
}
.bcat__title {
  font-family: var(--f-display); font-weight: 500;
  font-size: clamp(1.25rem, 1.05rem + .7vw, 1.7rem);
  color: var(--ink); letter-spacing: -.005em; text-wrap: balance;
}
.bcat__hint {
  font-size: var(--fs-sm); font-weight: 700; letter-spacing: .02em;
  color: var(--bronze-deep);
}
.bcat__hint--opt { color: var(--text-mut); font-weight: 600; font-style: italic; letter-spacing: 0; }
.bcat__help {
  color: var(--text-mut); font-size: .98rem; line-height: 1.55;
  margin-top: .4rem; max-width: 60ch; text-wrap: pretty;
}

/* ---- Options grid ------------------------------------------------------ */
.bopts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15.5rem), 1fr));
  gap: clamp(.65rem, .45rem + .5vw, 1rem);
  margin-top: clamp(.9rem, .7rem + .6vw, 1.3rem);
}

/* the card is a <label>; the real input is visually hidden but focusable */
.bopt { position: relative; z-index: 0; display: block; height: 100%; cursor: pointer; }
.bopt__input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  margin: 0; padding: 0; pointer-events: none;
}
.bopt__inner {
  position: relative; height: 100%;
  display: flex; flex-direction: column; gap: .4rem;
  padding: clamp(1rem, .85rem + .5vw, 1.4rem);
  padding-right: clamp(2.5rem, 2rem + 1vw, 3.1rem);
  border: 1.5px solid var(--hair); border-radius: var(--radius);
  background: var(--paper);
  transition: border-color .35s var(--ease), background-color .35s var(--ease),
              box-shadow .35s var(--ease), transform .35s var(--ease);
}
.bopt:hover .bopt__inner {
  border-color: color-mix(in srgb, var(--bronze) 55%, transparent);
  transform: translateY(-2px);
  box-shadow: 0 14px 34px -24px rgba(28, 26, 23, .5);
}
.bopt__input:focus-visible ~ .bopt__inner {
  outline: 2px solid var(--bronze); outline-offset: 3px;
}
.bopt__input:checked ~ .bopt__inner {
  border-color: var(--ink); background: var(--cream);
  box-shadow: inset 0 0 0 1.5px var(--ink), 0 16px 36px -24px rgba(28, 26, 23, .6);
}

/* selection tick (top-right) */
.bopt__check {
  position: absolute; top: clamp(.85rem, .7rem + .4vw, 1.15rem); right: clamp(.85rem, .7rem + .4vw, 1.15rem);
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--bronze) 45%, var(--hair));
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.bopt__check::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 5px; height: 9px; border: solid var(--paper); border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg) scale(0);
  transition: transform .3s var(--ease);
}
.bopt__input:checked ~ .bopt__inner .bopt__check { background: var(--ink); border-color: var(--ink); }
.bopt__input:checked ~ .bopt__inner .bopt__check::after { transform: translateY(-1px) rotate(45deg) scale(1); }

.bopt__text { display: flex; flex-direction: column; gap: .3rem; }
.bopt__label {
  font-family: var(--f-display); font-weight: 500; line-height: 1.15;
  font-size: clamp(1.12rem, 1rem + .35vw, 1.32rem); color: var(--ink);
  text-wrap: balance;
}
.bopt__desc { color: var(--text-mut); font-size: .9rem; line-height: 1.45; text-wrap: pretty; }

/* tier badges */
.bopt__badge {
  display: inline-flex; align-items: center; vertical-align: middle;
  margin-left: .55rem; padding: .18em .62em; border-radius: 100px;
  font-family: var(--f-body); font-size: .58rem; font-weight: 800;
  letter-spacing: .11em; text-transform: uppercase; white-space: nowrap;
}
.bopt__badge--basic     { background: color-mix(in srgb, var(--sand-deep) 55%, var(--cream)); color: var(--ink-soft); }
.bopt__badge--signature { background: color-mix(in srgb, var(--bronze) 20%, var(--cream)); color: var(--bronze-deep); }
.bopt__badge--premium   { background: linear-gradient(100deg, var(--gold-soft), var(--gold)); color: var(--ink); box-shadow: 0 2px 10px -4px rgba(201, 164, 107, .85); }

/* ---- Premium tier: tasteful animated gold glow ------------------------- */
.bopt--premium .bopt__inner { border-color: color-mix(in srgb, var(--gold) 42%, var(--hair)); }
.bopt--premium .bopt__inner::before {
  content: ''; position: absolute; inset: -1px; z-index: -1;
  border-radius: inherit; pointer-events: none;
  animation: boptGlow 3.6s ease-in-out infinite;
}
@keyframes boptGlow {
  0%, 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 42%, transparent), 0 8px 26px -18px rgba(201, 164, 107, .55); }
  50%      { box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 88%, transparent), 0 16px 42px -14px rgba(201, 164, 107, .8); }
}

/* inline required-category error */
.bcat__err {
  margin-top: .9rem; font-size: .9rem; font-weight: 700; color: #a53c26;
  display: flex; align-items: center; gap: .5rem;
}
.bcat__err::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none;
}
.bcat.is-invalid .bopt__inner { border-color: color-mix(in srgb, #b5442e 55%, var(--hair)); }

/* ---- Final step: details form ------------------------------------------ */
.bform { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; max-width: 660px; }
.bform .field--full { grid-column: 1 / -1; }
.bform .form__consent, .bform .form__submit { grid-column: 1 / -1; }
@media (max-width: 560px) { .bform { grid-template-columns: 1fr; } }

/* ---- Step nav (enhanced only) ------------------------------------------ */
.build__nav { display: none; }
.build.is-live .build__nav {
  display: flex; gap: .8rem; justify-content: space-between; align-items: center;
  margin-top: clamp(1.6rem, 1.1rem + 1.6vw, 2.6rem);
  padding-top: clamp(1.2rem, .9rem + 1vw, 1.8rem);
  border-top: 1px solid var(--hair);
}
.build__nav .btn { min-width: 8.5rem; }
.build__nav [data-next] { margin-left: auto; }

/* ---- Summary (enhanced only) ------------------------------------------- */
.bsum { display: none; }
.build.is-live .bsum { display: block; }

.bsum__bar {
  width: 100%; display: flex; align-items: center; gap: .6rem; text-align: left;
}
.bsum__title { font-family: var(--f-display); font-weight: 500; font-size: 1.25rem; line-height: 1; }
.bsum__count {
  display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem;
  padding: 0 .45rem; border-radius: 100px; background: var(--gold); color: var(--ink);
  font-size: .74rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.bsum__chev {
  margin-left: auto; width: .62rem; height: .62rem; flex: none;
  border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold);
  transform: rotate(-45deg); transition: transform .4s var(--ease);
}
.bsum__empty { color: var(--text-inv-mut); font-size: .95rem; line-height: 1.5; text-wrap: pretty; }
.bsum__list { display: grid; gap: .85rem; }
.bsum__row {
  display: grid; gap: .18rem; padding-bottom: .85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 22%, transparent);
}
.bsum__row:last-child { border-bottom: 0; padding-bottom: 0; }
.bsum__cat { font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.bsum__val { color: var(--text-inv); font-size: .98rem; line-height: 1.4; text-wrap: pretty; }

/* Desktop: sticky ink sidebar, panel always open, toggle is a plain heading */
@media (min-width: 901px) {
  .build.is-live .bsum {
    position: sticky; top: 92px; align-self: start;
    background: var(--ink); color: var(--text-inv);
    border-radius: var(--radius-lg);
    padding: clamp(1.4rem, 1.1rem + 1vw, 2rem);
    box-shadow: 0 26px 54px -32px rgba(28, 26, 23, .65);
  }
  .bsum__bar { cursor: default; pointer-events: none; }
  .bsum__title { color: var(--text-inv); }
  .bsum__count { margin-left: auto; }
  .bsum__chev { display: none; }
  .bsum__panel { margin-top: 1.1rem; }
}

/* Mobile: fixed bottom drawer, collapsed to the bar until tapped */
@media (max-width: 900px) {
  .build.is-live .bsum {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    display: flex; flex-direction: column; max-height: 74vh;
    background: var(--ink); color: var(--text-inv);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -18px 46px -24px rgba(28, 26, 23, .7);
    transform: translateY(calc(100% - 3.7rem));
    transition: transform .45s var(--ease);
  }
  .build.is-live .bsum.is-open { transform: translateY(0); }
  .bsum__bar {
    min-height: 3.7rem; padding: 1rem var(--gutter);
    color: var(--text-inv);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--gold) 22%, transparent);
  }
  .bsum__title { color: var(--text-inv); }
  .bsum__panel {
    overflow-y: auto;
    padding: .2rem var(--gutter) calc(1.4rem + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }
  /* keep the fixed bar from covering the final submit button */
  .build.is-live .build__main { padding-bottom: 4.6rem; }
}

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .bopt--premium .bopt__inner::before {
    animation: none;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 60%, transparent);
  }
  .bopt__inner, .bopt__check, .bopt__check::after,
  .build__pfill, .bsum, .bsum__chev { transition: none; }
  .bopt:hover .bopt__inner { transform: none; }
}

/* ---- Venue sub-variants (Yacht → Gulet/Motor/Sailing …) ---- */
.bvariants-wrap { margin-top: clamp(0.8rem, 0.5rem + 0.8vw, 1.3rem); }
.bvariants { margin-top: 0.9rem; padding: clamp(0.9rem, 0.6rem + 1vw, 1.4rem); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--sand) 40%, transparent); border-left: 3px solid var(--gold); animation: bvIn 0.35s var(--ease); }
@keyframes bvIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .bvariants { animation: none; } }
.bvariants__lead { font-family: var(--f-body); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bronze-deep); margin: 0 0 0.7rem; }
.bopts--sub { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 0.7rem; }
.bopt--sub .bopt__inner { padding: 0.85rem 1rem; }
.bopt--sub .bopt__label { font-size: 1rem; }
