/* ── Textile order builder (textile.js) ─────────────────────────────────── */

.tx {
  padding: 5rem 1.5rem 4rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.tx-inner { max-width: 1240px; margin: 0 auto; }
.tx-head { margin-bottom: 2rem; }
.tx-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 900;
  color: var(--text);
  margin: 0 0 0.4rem;
}
.tx-head p { color: var(--text-mid); margin: 0; font-size: 1.05rem; }

.tx-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 2rem;
  align-items: start;
}

/* One order line */
.tx-main { display: flex; flex-direction: column; gap: 1rem; }
.tx-line {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.6rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}
.tx-line.is-closed { padding: 1rem 1.4rem; box-shadow: none; }
.tx-line-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px dashed var(--border);
}
.tx-line.is-closed .tx-line-head { padding: 0; margin: 0; border: 0; }
.tx-line-head b { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--text); }
.tx-line-head span { color: var(--text-dim); font-size: 0.92rem; }
.tx-line-actions { display: flex; gap: 0.5rem; }
.tx-line-actions button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-mid);
  cursor: pointer;
}
.tx-line-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* Steps */
.tx-step { padding: 0.4rem 0 1.6rem; }
.tx-step + .tx-step { border-top: 1px solid var(--border); padding-top: 1.6rem; }
.tx-step.is-locked .tx-step-head { opacity: 0.5; }
.tx-step-head { display: flex; gap: 0.9rem; align-items: flex-start; margin-bottom: 1.1rem; }
.tx-num {
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-family: var(--font-display);
}
.tx-step-head h3 { margin: 0.15rem 0 0.15rem; font-family: var(--font-display); font-size: 1.2rem; color: var(--text); }
.tx-step-head p { margin: 0; color: var(--text-dim); font-size: 0.92rem; }
.tx-hint { color: var(--text-dim); font-size: 0.9rem; margin: 0.6rem 0 0; line-height: 1.6; }
.tx-picked { margin: 0.9rem 0 0; color: var(--text-mid); }

/* Colours */
.tx-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.6rem; }
.tx-color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 0.4rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.tx-color:hover { border-color: rgba(232, 97, 26, 0.45); transform: translateY(-1px); }
.tx-color.is-on { border-color: var(--accent); background: var(--accent-glow); }
.tx-dot {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.15);
  overflow: hidden;
  background: var(--bg-card);
}
.tx-dot img { width: 100%; height: 100%; object-fit: cover; }

/* Sizes */
.tx-sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 0.6rem; }
.tx-size {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
}
.tx-size.is-off { opacity: 0.35; }
.tx-size-name { font-weight: 800; font-family: var(--font-display); }
.tx-size small { color: var(--text-dim); font-size: 0.78rem; }
.tx-stepper { display: flex; align-items: center; gap: 0.25rem; }
.tx-stepper button {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
}
.tx-stepper button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.tx-stepper button:disabled { opacity: 0.35; cursor: default; }
.tx-stepper input {
  width: 3.2rem;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.2rem;
  font: inherit;
  font-weight: 700;
  -moz-appearance: textfield;
}
.tx-stepper input::-webkit-inner-spin-button,
.tx-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.tx-total-line { margin: 0.9rem 0 0; color: var(--text-mid); }

/* Choice cards */
.tx-grid2, .tx-grid3 { display: grid; gap: 0.6rem; }
.tx-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tx-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tx-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  padding: 1rem 0.8rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tx-choice:hover { border-color: rgba(232, 97, 26, 0.45); }
.tx-choice.is-on { border-color: var(--accent); background: var(--accent-glow); }
.tx-choice b { font-family: var(--font-display); font-size: 1.02rem; }
.tx-choice small { color: var(--text-dim); font-size: 0.82rem; }
.tx-sub { margin: 1.4rem 0 0.6rem; font-family: var(--font-display); font-size: 1.05rem; color: var(--text); }
.tx-box {
  margin-top: 1.2rem;
  padding: 1.2rem;
  border-radius: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.tx-box h4 { margin: 0 0 0.8rem; font-family: var(--font-display); font-size: 1.05rem; color: var(--text); }
.tx-label { margin: 0.9rem 0 0.5rem; font-weight: 700; color: var(--text-mid); font-size: 0.92rem; }
.tx-label:first-of-type { margin-top: 0; }
.tx-note {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-mid);
  font-size: 0.88rem;
  line-height: 1.6;
}
.tx-opt { font-weight: 400; color: var(--text-dim); font-size: 0.85em; }

/* A tiny shirt that shows where the print goes. */
.tx-shirt {
  position: relative;
  width: 44px;
  height: 40px;
  margin-bottom: 0.3rem;
  background: var(--text-mid);
  clip-path: polygon(30% 0, 70% 0, 100% 18%, 88% 40%, 78% 34%, 78% 100%, 22% 100%, 22% 34%, 12% 40%, 0 18%);
}
.tx-shirt::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 2px;
}
.tx-shirt--large::after { left: 34%; right: 34%; top: 30%; height: 30%; }
.tx-shirt--small::after { left: 30%; width: 14%; top: 28%; height: 13%; }

/* Design: upload, text and the live preview */
.tx-design-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.tx-tools { display: flex; flex-direction: column; gap: 0.8rem; }
.tx-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1.2rem 1rem;
  border: 2px dashed rgba(232, 97, 26, 0.45);
  border-radius: 14px;
  background: var(--bg);
  text-align: center;
  cursor: pointer;
}
.tx-drop:hover { background: var(--accent-glow); }
.tx-drop.is-busy { opacity: 0.6; pointer-events: none; }
.tx-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tx-drop-icon { color: var(--accent); font-size: 1.4rem; }
.tx-drop b { color: var(--text); word-break: break-all; }
.tx-drop small { color: var(--text-dim); }
.tx-field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 700; color: var(--text-mid); font-size: 0.9rem; }
.tx-field input[type="text"], .tx-field textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.tx-textrow { display: flex; gap: 0.4rem; }
.tx-textrow input[type="color"] { flex: none; width: 2.8rem; height: auto; padding: 0.2rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.tx-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.6rem; }
.tx-tabs button {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font: inherit;
  cursor: pointer;
}
.tx-tabs button.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tx-stage {
  position: relative;
  container-type: inline-size;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  touch-action: none;
}
.tx-base { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.tx-layer {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
  outline: 1px dashed rgba(232, 97, 26, 0);
  transition: outline-color 0.15s;
}
.tx-layer:hover, .tx-layer:active { outline-color: rgba(232, 97, 26, 0.8); }
.tx-layer:active { cursor: grabbing; }
.tx-layer-text { white-space: nowrap; font-family: var(--font-display); font-weight: 700; line-height: 1; padding: 0.1em 0.2em; }
.tx-range { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.7rem; font-size: 0.88rem; color: var(--text-mid); }
.tx-range input { flex: 1; accent-color: var(--accent); }

.tx-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1.1rem;
  border: 2px dashed var(--border);
  border-radius: 18px;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.tx-more:hover { border-color: var(--accent); color: var(--accent); }
.tx-more small { color: var(--text-dim); }

/* Summary */
.tx-summary {
  position: sticky;
  top: 90px;
  background: var(--bg);
  border: 2px solid var(--text);
  border-radius: 20px;
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.tx-summary h3 { margin: 0; font-family: var(--font-display); font-size: 1.25rem; color: var(--text); }
.tx-sum-line, .tx-sum-prints { display: flex; flex-direction: column; gap: 0.25rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--border); }
.tx-sum-line small, .tx-sum-prints small { color: var(--text-dim); font-size: 0.82rem; }
.tx-sum-row { display: flex; justify-content: space-between; gap: 0.6rem; color: var(--text-mid); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.tx-sum-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 0.2rem; }
.tx-sum-total span { font-weight: 700; color: var(--text); }
.tx-sum-total b { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.tx-vat { color: var(--text-dim); font-size: 0.8rem; line-height: 1.5; }
.tx-missing { background: #fff7e8; border: 1px solid #f3d9a6; border-radius: 12px; padding: 0.7rem 0.9rem; font-size: 0.88rem; color: #7a4b00; }
.tx-missing ul { margin: 0.3rem 0 0; padding-inline-start: 1.1rem; }
.tx-error { margin: 0; color: #b42318; font-size: 0.9rem; }
.tx-add { width: 100%; justify-content: center; border: 0; cursor: pointer; font-size: 1.05rem; padding: 1rem; }
.tx-add:disabled { opacity: 0.45; cursor: not-allowed; }

@media (max-width: 980px) {
  .tx-layout { grid-template-columns: 1fr; }
  .tx-summary { position: static; }
  .tx-design-grid { grid-template-columns: 1fr; }
  .tx-preview { order: -1; }
}
@media (max-width: 560px) {
  .tx { padding: 3.5rem 1rem 3rem; }
  .tx-line { padding: 1.1rem; }
  .tx-grid3 { grid-template-columns: 1fr; }
  .tx-colors { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .tx-sizes { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .tx-color, .tx-choice, .tx-layer { transition: none; }
}

/* Product page bits that only exist when the builder is on. */
.c-price-row .val small {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-dim);
}
/* The chapter rail belongs to the product story; it steps aside over the builder. */
.side-nav { transition: opacity 0.2s, visibility 0.2s; }
body.tx-in-view .side-nav { opacity: 0; visibility: hidden; pointer-events: none; }

/* ── Theme button defaults off ──────────────────────────────────────────
   The parent theme paints every <button> pink-red on hover and focus and
   pads it. Each builder button sets its own states instead. */
.tx button {
  -webkit-appearance: none;
  appearance: none;
  text-transform: none;
  letter-spacing: normal;
  text-decoration: none;
  box-shadow: none;
}
.tx .tx-choice:hover, .tx .tx-choice:focus,
.tx .tx-color:hover, .tx .tx-color:focus {
  background: var(--bg);
  color: var(--text);
  border-color: rgba(232, 97, 26, 0.45);
}
.tx .tx-choice.is-on, .tx .tx-choice.is-on:hover, .tx .tx-choice.is-on:focus,
.tx .tx-color.is-on, .tx .tx-color.is-on:hover, .tx .tx-color.is-on:focus {
  background: var(--accent-glow);
  color: var(--text);
  border-color: var(--accent);
}
.tx .tx-line-actions button:hover, .tx .tx-line-actions button:focus { background: none; color: var(--accent); border-color: var(--accent); }
.tx .tx-tabs button:hover, .tx .tx-tabs button:focus { background: var(--bg); color: var(--accent); border-color: var(--accent); }
.tx .tx-tabs button.is-on, .tx .tx-tabs button.is-on:hover, .tx .tx-tabs button.is-on:focus { background: var(--accent); color: #fff; border-color: var(--accent); }
.tx .tx-more:hover, .tx .tx-more:focus { background: transparent; color: var(--accent); border-color: var(--accent); }
.tx .tx-add:hover:not(:disabled), .tx .tx-add:focus:not(:disabled) { background: var(--accent); color: #fff; filter: brightness(0.95); }
.tx button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Plus and minus are drawn, not typed, so they sit dead centre in any font. */
.tx .tx-stepper button {
  position: relative;
  display: inline-block;
  flex: none;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  font-size: 0;
  line-height: 0;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
}
.tx .tx-stepper button::before,
.tx .tx-stepper button[data-act="inc"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.75rem;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.tx .tx-stepper button[data-act="inc"]::after { width: 2px; height: 0.75rem; }
.tx .tx-stepper button:hover:not(:disabled),
.tx .tx-stepper button:focus-visible:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.tx .tx-stepper button:focus:not(:focus-visible) { background: var(--bg-elevated); color: var(--text); }
.tx .tx-stepper button:disabled,
.tx .tx-stepper button:disabled:hover { background: var(--bg-elevated); color: var(--text); opacity: 0.35; }
/* Room for − 0 + inside each size card. */
.tx .tx-sizes { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.tx .tx-stepper { gap: 0.3rem; }
.tx .tx-stepper input { width: 2.8rem; }
@media (max-width: 560px) { .tx .tx-sizes { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); } }
