/* =========================================================================
   Custom bag builder
   ========================================================================= */

.builder {
  display: grid;
  gap: clamp(24px, 3vw, 52px);
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  align-items: start;
}
@media (max-width: 1040px) { .builder { grid-template-columns: minmax(0, 1fr); } }

/* ---------- preview stage ---------- */
.stage-wrap { position: sticky; top: 94px; display: grid; gap: 16px; }
@media (max-width: 1040px) {
  .stage-wrap {
    top: 74px;
    z-index: 20;
    margin-inline: calc(var(--gutter) * -1);
    padding: 12px var(--gutter);
    background: color-mix(in oklab, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vw, 26px);
  border-radius: var(--r-lg);
  /* Deliberately light in both themes so fabric colours read true. */
  background:
    radial-gradient(120% 86% at 50% 8%, #FDFAF4 0%, #F0E8DA 62%, #E4D9C5 100%);
  border: 1px solid #DCCFB8;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.stage::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 62%, rgba(90, 72, 48, .07));
  pointer-events: none;
}
.bag-svg { width: 100%; height: auto; max-height: min(58vh, 560px); }
/* Small screens: the preview stays pinned while you scroll the options, so it
   has to stay short enough to leave most of the screen for choosing. */
@media (max-width: 1040px) { .bag-svg { max-height: 28vh; } }

.stage__empty { color: var(--muted); padding: 60px 20px; text-align: center; }

.stage__title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: var(--step-2); line-height: 1.1;
}
.stage__title span { font-family: "Newsreader", Georgia, serif; font-size: var(--step--1); color: var(--muted); letter-spacing: .04em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin-top: 10px; }
.chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 13px 6px 6px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--panel);
  font-size: var(--step--1); line-height: 1.25;
}
.chip__sw {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%; background-size: cover;
  border: 1px solid var(--line-strong);
}
.chip b { display: block; font-weight: 400; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 1040px) {
  .stage__title { font-size: var(--step-1); }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
}

/* ---------- options panel ---------- */
.panel { display: grid; gap: clamp(22px, 2.6vw, 34px); }

.field { display: grid; gap: 12px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > legend {
  display: flex; align-items: baseline; gap: 10px;
  padding: 0; margin-bottom: 2px;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: var(--step-1);
}
.field > legend em { font-family: "Newsreader", Georgia, serif; font-style: normal; font-size: var(--step--1); color: var(--muted); }

.field__step {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  background: var(--indigo);
  color: light-dark(#FBF8F2, #131A23);
  font-family: "Newsreader", Georgia, serif;
  font-size: .82rem;
}

/* hide the real inputs, style the labels */
.opt-card input, .seg input, .sw input, .swatch-mini input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}

/* style cards */
.opt-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.opt-card {
  display: grid; gap: 3px; cursor: pointer;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.opt-card b { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 1.22rem; }
.opt-card span { font-size: var(--step--1); color: var(--muted); line-height: 1.4; }
.opt-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.opt-card.is-on { border-color: var(--indigo); box-shadow: 0 0 0 1.5px var(--indigo) inset; }
.opt-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }

/* segmented sizes */
.seg-group { display: flex; flex-wrap: wrap; gap: 8px; }
.seg {
  display: grid; gap: 1px; cursor: pointer;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--panel);
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.seg b { font-weight: 400; }
.seg span { font-size: .78rem; color: var(--muted); }
.seg.is-on { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.seg.is-on span { color: color-mix(in oklab, var(--bone) 72%, transparent); }
.seg:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }

/* fabric swatches live in site.css — the shop page uses them too */

/* small colour/finish swatches */
.mini-group { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-mini {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 7px 15px 7px 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--panel);
  font-size: .92rem;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.swatch-mini__dot {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%;
  background-size: cover;
  border: 1px solid rgba(0, 0, 0, .18);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .35);
}
.swatch-mini.is-on { border-color: var(--indigo); box-shadow: 0 0 0 1.5px var(--indigo) inset; }
.swatch-mini:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }

/* checkbox + text inputs */
.check {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  padding: 14px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--panel);
}
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--indigo); flex: none; }
.check b { display: block; font-weight: 400; }
.check span { font-size: var(--step--1); color: var(--muted); }

.input, .textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
}
.input::placeholder, .textarea::placeholder { color: color-mix(in oklab, var(--muted) 75%, transparent); }
.textarea { min-height: 104px; resize: vertical; }
.field__hint { font-size: var(--step--1); color: var(--muted); }

.mono-row { display: flex; gap: 12px; align-items: center; }
.mono-row .input { max-width: 140px; text-transform: uppercase; letter-spacing: .25em; text-align: center; font-size: 1.15rem; }

/* ---------- summary + actions ---------- */
.summary-card {
  display: grid; gap: 18px;
  padding: clamp(22px, 2.6vw, 30px);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--panel);
}
.sum { display: grid; gap: 7px; margin: 0; }
.sum__row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: baseline; }
.sum__row dt { font-size: var(--step--1); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.sum__row dd { margin: 0; }

.price {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.price__label { font-size: var(--step--1); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.price__value { font-family: "Instrument Serif", Georgia, serif; font-size: var(--step-3); line-height: 1; }
.price__note { flex-basis: 100%; font-size: var(--step--1); color: var(--muted); }

.actions { display: grid; gap: 10px; }
.actions__row { display: flex; flex-wrap: wrap; gap: 10px; }
.actions__row .btn { flex: 1 1 160px; }

/* ---------- notices ---------- */
.notice {
  padding: 14px 18px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: var(--step--1);
}
.notice--draft { border-color: color-mix(in oklab, var(--sage) 55%, transparent); }
.notice--warn { border-color: color-mix(in oklab, var(--clay) 55%, transparent); }
.notice a { color: var(--indigo); }
