/* Team duffel configurator.
   The one loud element is the webbing strap between the stage and the build sheet: it takes the
   webbing, edging and thread colours the visitor picks. Everything else stays quiet. */

:root {
  --stage: #d5d9da;        /* rink-hall grey the bag stands on */
  --stage-lit: #eceeee;
  --sheet: #f7f8f8;
  --ink: #000;
  --ink-soft: #414a50;
  --line: #b7bdc0;
  /* live, set from the configuration */
  --accent: #efb22a;
  --trim: #0c0c0d;
  --stitch: #0a0a0a;

  --sans: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --strap-w: 46px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--sheet);
  /* no rubber-band past the end of the page: that showed up as an empty white area */
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--sheet);
}

h1, h2, p { margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--strap-w) minmax(340px, 432px);
  height: 100vh;
  height: 100dvh;
}

/* ------------------------------------------------------------------ stage */

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 62%, var(--stage-lit) 0%, var(--stage) 62%, #c4c9cb 100%);
}

.viewer {
  position: absolute;
  inset: 0;
  cursor: grab;
}
.viewer:active { cursor: grabbing; }

.stage-name {
  position: absolute;
  top: 22px; left: 28px;
  z-index: 2;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.stage-hint {
  position: absolute;
  top: 26px; right: 28px;
  z-index: 2;
  font-size: 14px;
  color: var(--ink-soft);
  pointer-events: none;
  transition: opacity 0.4s;
}
.stage-hint.is-used { opacity: 0; }

.stage-foot {
  position: absolute;
  left: 28px; right: 28px; bottom: 22px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  pointer-events: none;
}
.stage-foot > * { pointer-events: auto; }
.stage::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 96px;
  z-index: 1;
  background: linear-gradient(to bottom, rgba(213, 217, 218, 0.94) 0 30%, rgba(213, 217, 218, 0));
  pointer-events: none;
}
/* keeps the readout legible when a close-up puts dark tarpaulin behind it */
.stage::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 150px;
  z-index: 1;
  background: linear-gradient(to top, rgba(213, 217, 218, 0.96) 0 44%, rgba(213, 217, 218, 0));
  pointer-events: none;
}

.spec {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.spec-vol {
  display: block;
  margin-top: 6px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-soft);
}

.views {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.views button {
  font: 500 14px/1 var(--sans);
  color: var(--ink);
  padding: 9px 12px;
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}
.views button:hover { border-color: var(--ink); }
.views button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.views .spin {
  margin-left: 10px;
  background: transparent;
  border-color: var(--ink);
}
.views .spin[aria-pressed="true"] { background: transparent; color: var(--ink); }
.views .spin:hover { background: #fff; }

/* ------------------------------------------------------------------ the strap */

.strap {
  position: relative;
  background-color: var(--accent);
  /* woven texture */
  background-image:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 2px, transparent 2px 4px);
  border-inline: 6px solid var(--trim);
  box-shadow: -10px 0 24px -12px rgba(0, 0, 0, 0.35);
  z-index: 3;
}
.strap::before,
.strap::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  border-left: 2px dashed var(--stitch);
  opacity: 0.85;
}
.strap::before { left: 3px; }
.strap::after { right: 3px; }
.tack {
  position: absolute;
  left: 3px; right: 3px;
  top: 21%;
  width: calc(100% - 6px);
  height: 42px;
  fill: none;
  stroke: var(--stitch);
  stroke-width: 2;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  opacity: 0.85;
}

/* ------------------------------------------------------------------ build sheet */

.sheet {
  min-width: 0;
  overflow-y: auto;
  padding: 34px 30px 40px 30px;
  background: var(--sheet);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.sheet-head h1 {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 46px;
  line-height: 0.98;
  letter-spacing: -0.005em;
  max-width: 9em;
}
.sheet-head p {
  margin-top: 14px;
  color: var(--ink-soft);
  max-width: 34em;
}

.group {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1.5px solid var(--ink);
}
.group h2 {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.05;
  margin-bottom: 14px;
}

.field { margin-top: 14px; }
.field:first-of-type { margin-top: 0; }
.field-label,
.text-field > span,
.slider > span {
  display: block;
  font-weight: 500;
  font-size: 15px;
}
.field-label { margin-bottom: 8px; }

.note {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* swatches: cut like samples in a fabric book */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 7px;
}
.swatch {
  position: relative;
  width: 34px; height: 28px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.28);
  border-radius: 2px;
  background: var(--c);
  cursor: pointer;
}
.swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px dashed var(--ink);
  border-radius: 4px;
}
.swatch-custom {
  display: grid;
  place-items: center;
  background:
    conic-gradient(from 210deg, #e23b3b, #efb22a, #3fae5a, #2a6fd6, #8a4fd0, #e23b3b);
  overflow: hidden;
}
.swatch-custom input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}
.swatch-custom[data-set="true"] { background: var(--c); }
.swatch-custom:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 500 15px/1.15 var(--sans);
  color: var(--ink);
  padding: 9px 13px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.chip small { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: var(--ink-soft); }
.chip-dots { display: inline-flex; }
.chip-dots i {
  width: 14px; height: 20px;
  border: 1px solid rgba(0, 0, 0, 0.28);
  background: var(--c);
}
.chip-dots i + i { margin-left: -1px; }
.chip-metal {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.3);
  background: radial-gradient(circle at 32% 28%, #fff 0 8%, var(--c) 46%, color-mix(in srgb, var(--c) 55%, #000) 100%);
}

/* sliders */
.sliders { margin-top: 18px; display: grid; gap: 12px; }
.slider {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 62px;
  align-items: center;
  gap: 12px;
}
.group > .slider { margin-top: 16px; grid-template-columns: 88px minmax(0, 1fr) auto; }
.group > .slider output { font-size: 18px; white-space: nowrap; min-width: 62px; }
.slider output {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 20px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--ink);
  height: 28px;
  cursor: pointer;
}

/* text inputs */
.text-field { display: block; }
.text-field > span { margin-bottom: 6px; }
.text-field input {
  width: 100%;
  font: 600 20px/1.2 var(--cond);
  letter-spacing: 0.02em;
  color: var(--ink);
  padding: 10px 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 3px;
}
.text-field input:hover { border-color: var(--ink); }
.text-field + .field { margin-top: 16px; }
.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.upload {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.upload .note { margin-top: 0; }

.btn {
  display: inline-block;
  font: 500 15px/1 var(--sans);
  color: var(--ink);
  padding: 11px 15px;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  cursor: pointer;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn-solid { background: var(--ink); color: #fff; padding: 14px 20px; font-size: 16px; }
.btn-solid:hover { background: #2b3237; }
.drop-actions:has(input[type="file"]:focus-visible) .btn { outline: 2px solid var(--ink); outline-offset: 3px; }

.btn-quiet {
  font: 500 15px/1 var(--sans);
  color: var(--ink);
  padding: 6px 0;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.btn-quiet:hover { text-decoration-thickness: 2px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
}
.group h2 + .check { margin-top: 0; }
.check input {
  width: 20px; height: 20px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.sheet-foot {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1.5px solid var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}
.status {
  flex-basis: 100%;
  min-height: 1.45em;
  font-size: 14px;
  color: var(--ink-soft);
}


/* ------------------------------------------------------------------ logo upload */

.drop {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 14px;
  align-items: center;
  padding: 16px;
  background: #fff;
  border: 2px dashed var(--ink);
  border-radius: 4px;
}
.drop.is-over { background: #e9eced; }
.drop-thumb {
  width: 72px; height: 72px;
  object-fit: contain;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background:
    repeating-conic-gradient(#e3e6e8 0 25%, #f7f8f8 0 50%) 0 0 / 14px 14px;
}
.drop-thumb[hidden] { display: none; }
.drop-thumb[hidden] + .drop-text { grid-column: 1 / -1; }
.drop-title {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.drop .note { margin-top: 4px; }
.drop-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}
.drop-actions .btn-solid { padding: 12px 18px; }
#logo-options { margin-top: 16px; }
#sample-fields { margin-top: 16px; }
.sample-note { margin: 0 0 12px; }
.group .slider + .check { margin-top: 12px; }

.stage-drop {
  position: absolute;
  inset: 14px;
  z-index: 6;
  display: none;
  place-items: center;
  border: 3px dashed var(--ink);
  border-radius: 6px;
  background: rgba(236, 238, 238, 0.82);
  pointer-events: none;
}
.stage-drop span {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.05;
  text-align: center;
  padding: 0 24px;
}
body.is-dragging .stage-drop { display: grid; }

/* ------------------------------------------------------------------ narrow screens */

@media (max-width: 1180px) {
  .stage-hint { display: none; }
  .views button { padding: 8px 10px; }
}

@media (max-width: 900px) {
  :root { --strap-w: 30px; }
  .layout {
    display: block;
    height: auto;
  }
  .stage {
    position: sticky;
    top: 0;
    z-index: 4;
    height: 50vh;
    height: 50svh;
    min-height: 300px;
  }
  /* small stage: keep the model clear of the readout instead of fading it out */
  .stage::before, .stage::after { display: none; }
  .viewer { top: 30px; bottom: 84px; }
  .stage-name { top: 14px; left: 16px; font-size: 22px; }
  .stage-foot { left: 12px; right: 12px; bottom: 10px; gap: 8px; }
  .spec { font-size: 22px; }
  .spec-vol { display: inline; margin: 0 0 0 10px; }
  .views {
    flex-wrap: nowrap;
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .views button { flex: none; }
  .views .spin { margin-left: 4px; }
  .strap {
    position: sticky;
    top: 50svh;
    z-index: 5;
    height: var(--strap-w);
    border-inline: 0;
    border-block: 5px solid var(--trim);
    box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.4);
  }
  .strap::before, .strap::after {
    top: auto; bottom: auto; left: 0; right: 0;
    border-left: 0;
    border-top: 2px dashed var(--stitch);
  }
  .strap::before { top: 2px; }
  .strap::after { bottom: 2px; }
  .tack { top: 2px; left: 18%; right: auto; width: 34px; height: calc(100% - 4px); }
  .sheet { overflow: visible; padding: 26px 18px 44px; }
  .sheet-head h1 { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-hint { transition: none; }
}
