:root {
  --ink: #14171b;
  --ink-soft: #454b52;
  --muted: #666d75;
  --line: rgba(20, 23, 27, .14);
  --line-strong: rgba(20, 23, 27, .55);
  --paper: #f3f4f5;
  --paper-deep: #e5e7ea;
  --bg: #fff;
  --accent: #c8102e;        /* crimson */
  --accent-deep: #9c0c24;
  --accent-soft: #fbe9ec;
  --ok: #2f6247;
  --ok-bg: #e7f0eb;
  --sans: "Jost", Futura, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); scrollbar-color: var(--paper-deep) transparent; }
body { margin: 0; font: 300 .9375rem/1.55 var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent); color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 90rem; margin: 0 auto; padding: 0 var(--gutter); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Small letter-spaced label used for field names and table heads. */
.label { font-size: .6875rem; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.announce { margin: 0; background: var(--ink); color: #fff; text-align: center; padding: .55rem 1rem; font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; }
.header { border-bottom: 1px solid var(--line); }
.header .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 4.5rem; gap: 1rem; }
.header__note { font-size: .8125rem; color: var(--ink-soft); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 500; font-size: 1.05rem; letter-spacing: .22em; text-transform: uppercase; text-decoration: none; color: var(--ink); }
.brand svg { width: 1.6rem; height: 1.6rem; }
.header__actions { justify-self: end; }
.pill { text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--ink); border-radius: 999px; padding: .5rem 1.1rem; font-size: .8125rem; font-weight: 400; background: var(--ink); color: #fff; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.pill:hover { background: #fff; color: var(--ink); }
.pill svg, .icon { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

h1 { font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.15; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h2 { font-weight: 400; font-size: 1.35rem; line-height: 1.2; margin: 0; }

/* Empty state */
.start { text-align: center; padding: 4rem 0 5rem; }
.start p { margin: .9rem auto 2.5rem; max-width: 34rem; color: var(--ink-soft); }
.dropzone { display: grid; place-items: center; gap: .35rem; margin: 0 auto; max-width: 72rem; padding: 3.5rem 1.5rem; background: var(--paper);
  border: 1.5px dashed var(--line-strong); border-radius: 1.25rem; cursor: pointer; transition: background .25s var(--ease), border-color .25s var(--ease); }
.dropzone:hover, .dropping .dropzone { background: var(--accent-soft); border-color: var(--accent); }
.dropzone__icon { width: 3.5rem; height: 3.5rem; margin-bottom: .75rem; }
.dropzone__icon .arrow { transition: transform .35s var(--ease); }
.dropzone:hover .arrow, .dropping .arrow { transform: translateY(-3px); }
.dropzone strong { font-weight: 400; font-size: 1.5rem; }
.dropzone span { color: var(--muted); font-size: .875rem; }
.dropzone u { color: var(--ink); text-underline-offset: 3px; }
#files:focus-visible ~ main .dropzone, #files:focus-visible ~ main .addtile { outline: 2px solid var(--accent); outline-offset: 3px; }
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; max-width: 72rem; margin: 3rem auto 0; padding: 0; list-style: none; text-align: left; }
.points li { border-top: 1px solid var(--line); padding-top: 1rem; color: var(--ink-soft); font-size: .875rem; }
.points strong { display: block; font-weight: 400; color: var(--ink); font-size: 1rem; margin-bottom: .2rem; }

/* Quote layout */
.quote { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 2.5rem; align-items: start; padding: 2.5rem 0 5rem; }
.quote__head { margin-bottom: 1.5rem; }
.quote__head p { margin: .4rem 0 0; color: var(--ink-soft); }

.partstrip { display: flex; flex-wrap: wrap; gap: .75rem; list-style: none; margin: 0 0 2rem; padding: 0; }
.pcard { position: relative; width: 10.5rem; }
.pcard__btn { display: grid; gap: .1rem; width: 100%; height: 100%; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: .9rem; padding: .6rem .6rem .7rem; transition: border-color .2s var(--ease); }
.pcard__btn:hover { border-color: var(--line-strong); }
.pcard--on .pcard__btn { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pcard__thumb { display: grid; place-items: center; height: 5.5rem; background: var(--paper); border-radius: .5rem; margin-bottom: .5rem; }
.pcard__thumb svg { width: 2.75rem; height: 2.75rem; }
.pcard__name { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard__meta { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pcard--bad .pcard__meta { color: var(--accent-deep); }
.pcard__x { position: absolute; top: .9rem; right: .9rem; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 0; padding: 0; background: #fff; color: var(--ink-soft); opacity: 0; transition: opacity .15s; }
.pcard:hover .pcard__x, .pcard__x:focus-visible { opacity: 1; }
.pcard__x:hover { background: var(--ink); color: #fff; }
@media (hover: none) { .pcard__x { opacity: 1; } }
.addtile { display: grid; place-items: center; align-content: center; gap: .4rem; width: 10.5rem; min-height: 9.5rem; height: 100%; border: 1px dashed var(--line-strong); border-radius: .9rem; cursor: pointer; color: var(--ink-soft); font-size: .875rem; transition: background .2s var(--ease), border-color .2s var(--ease); }
.addtile:hover, .dropping .addtile { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.addtile .icon { width: 1.25rem; height: 1.25rem; }

.config { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.problem { background: var(--accent-soft); border-radius: 1rem; padding: 1.5rem; }
.problem p { margin: .4rem 0 0; color: var(--ink-soft); }

.viewer { position: relative; background: var(--paper); border-radius: 1rem; overflow: hidden; }
.viewer canvas { display: block; width: 100%; height: 26rem; }
.viewer__state { display: grid; place-items: center; align-content: center; gap: .9rem; height: 26rem; padding: 2rem; text-align: center; color: var(--ink-soft); }
.viewer__state strong { font-weight: 400; font-size: 1.1rem; color: var(--ink); }
.track { width: 9rem; height: 2px; background: var(--paper-deep); overflow: hidden; border-radius: 2px; }
.track i { display: block; width: 40%; height: 100%; background: var(--ink); animation: slide 1.4s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
.viewer__top, .viewer__bottom { position: absolute; left: .75rem; display: flex; gap: .4rem; flex-wrap: wrap; pointer-events: none; }
.viewer__top { top: .75rem; }
.viewer__bottom { bottom: .75rem; }
.chip { background: #fff; border-radius: 999px; padding: .2rem .7rem; font-size: .75rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.chip--ok { background: var(--ok-bg); color: var(--ok); }
.layers { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center; margin-top: .6rem; padding: .8rem 1rem .9rem; border: 1px solid var(--line); border-radius: 1rem; font-size: .8125rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.layers input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }

.panel { border: 1px solid var(--line); border-radius: 1rem; background: #fff; }
.field { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); }
.field__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .7rem; }
.field__value { font-size: .875rem; color: var(--ink-soft); }
.matgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .5rem; }
.matopt { display: grid; gap: .1rem; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: .7rem; padding: .7rem .8rem; transition: border-color .2s var(--ease); }
.matopt:hover { border-color: var(--line-strong); }
.matopt[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.matopt b { font-weight: 400; }
.matopt small { color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.matopt span { margin-top: .5rem; font-size: .8125rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.swatches { display: flex; flex-wrap: wrap; gap: .55rem; }
.swatch { width: 2rem; height: 2rem; border-radius: 50%; border: 1px solid rgba(20, 23, 27, .25); padding: 0; box-shadow: inset 0 0 0 3px #fff; transition: box-shadow .15s; }
.swatch[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff, 0 0 0 1px var(--ink); }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button { flex: 1 1 auto; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; font-size: .8125rem; font-weight: 400; transition: background .2s var(--ease), color .2s var(--ease), border-color .2s; }
.seg button:hover { border-color: var(--line-strong); }
.seg button[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.num { width: 4.5rem; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .7rem; text-align: center; background: #fff; font-variant-numeric: tabular-nums; }
.infill { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.infill .seg { flex: 1 1 15rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { width: 2.4rem; height: 2.2rem; background: none; border: 0; border-radius: 999px; display: grid; place-items: center; padding: 0; }
.stepper button:hover { background: var(--paper); }
.stepper input { width: 3rem; border: 0; text-align: center; background: none; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }

.partprice { padding: 1.25rem; }
.partprice__main { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.partprice__main dd { margin: .1rem 0 0; font-size: 1.6rem; font-weight: 400; line-height: 1.2; font-variant-numeric: tabular-nums; }
.partprice__main dd span { padding: 0 .15rem; }
/* An estimate is hatched like sparse infill; a sliced price is solid. */
.est { background: repeating-linear-gradient(45deg, transparent 0 5px, var(--accent-soft) 5px 8px); border-radius: .3rem; }
.partprice__state { margin: .7rem 0 0; font-size: .875rem; color: var(--ink-soft); }
.partprice__state.done { color: var(--ok); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; margin: 1.1rem 0 0; padding-top: 1.1rem; border-top: 1px solid var(--line); }
dl, dd { margin: 0; }
.facts dd { font-weight: 400; font-variant-numeric: tabular-nums; }
.facts__note { grid-column: 1 / -1; margin: 0; font-size: .8125rem; color: var(--muted); }

.summary { position: sticky; top: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; padding: 1.4rem 1.25rem; }
.summary h2 { margin-bottom: 1rem; }
.slines { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.sline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem 1rem; width: 100%; text-align: left; background: var(--paper); border: 1px solid transparent; border-radius: .7rem; padding: .7rem .8rem; }
.sline:hover { border-color: var(--line-strong); }
.sline[aria-current=true] { border-color: var(--ink); background: #fff; }
.sline__name { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sline__price { font-weight: 400; font-variant-numeric: tabular-nums; }
.sline__meta { grid-column: 1 / -1; font-size: .8125rem; color: var(--muted); }
.totals { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; }
.totals dt { color: var(--ink-soft); }
.totals dd { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { margin-top: .6rem; padding-top: .8rem; border-top: 1px solid var(--line); font-weight: 400; font-size: 1.1rem; color: var(--ink); }
.split { margin-top: 1rem; }
.split__bar { display: flex; height: .4rem; border-radius: 999px; overflow: hidden; background: var(--paper); }
.split__bar i { display: block; height: 100%; }
.split__key { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .25rem; font-size: .8125rem; color: var(--ink-soft); }
.split__key li { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; font-variant-numeric: tabular-nums; }
.split__key i { width: .55rem; height: .55rem; border-radius: 50%; }
.summary__note { margin: 1rem 0 0; font-size: .8125rem; color: var(--muted); }

footer { border-top: 1px solid var(--line); padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .8125rem; }

@media (max-width: 68rem) {
  .quote { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 48rem) {
  .header .wrap { grid-template-columns: auto 1fr; height: 4rem; }
  .header__note { display: none; }
  .brand { letter-spacing: .14em; font-size: .95rem; }
  .config { grid-template-columns: 1fr; }
  .points { grid-template-columns: 1fr; gap: 1rem; }
  .start { padding: 2.5rem 0 3.5rem; }
  .partstrip > li { width: calc(50% - .375rem); }
  .pcard, .addtile { width: 100%; }
  .viewer canvas, .viewer__state { height: 19rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .track i { animation: none; width: 100%; }
}

/* Buttons and form fields (checkout, order page) */
.btn { display: block; width: 100%; text-align: center; text-decoration: none; border: 1px solid var(--ink); border-radius: 999px; padding: .7rem 1.2rem; background: var(--ink); color: #fff; font-weight: 400; transition: background .2s var(--ease), color .2s var(--ease); }
.btn:hover:not(:disabled) { background: #fff; color: var(--ink); }
.btn:disabled { background: var(--paper-deep); border-color: var(--paper-deep); color: var(--muted); cursor: not-allowed; }
.checkout { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.checkoutform { display: grid; gap: .9rem; }
.formrow { display: grid; gap: .3rem; min-width: 0; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem .6rem; }
.formgrid .formrow:first-child { grid-column: 1 / -1; }
.input { width: 100%; border: 1px solid var(--line-strong); border-radius: .6rem; padding: .55rem .7rem; background: #fff; }
textarea.input { resize: vertical; min-height: 3.5rem; }
.input[aria-invalid=true] { border-color: var(--accent); }
.err { color: var(--accent-deep); font-size: .8125rem; }
.err:empty { display: none; }

/* Order page */
.order { padding-top: 2.5rem; padding-bottom: 5rem; }
.order__head { margin-bottom: 2rem; }
.order__head p, .order__loading { margin: .4rem 0 0; color: var(--ink-soft); }
.order__grid { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 2.5rem; align-items: start; }
.order__status h2 { font-size: 1.6rem; }
.order__status h2[data-status=paid] { color: var(--ok); }
.order__status h2[data-status=cancelled] { color: var(--accent-deep); }
.order__status > p { margin: .5rem 0 1.5rem; max-width: 34rem; color: var(--ink-soft); }
.order__status .btn { max-width: 20rem; }
.keeplink { margin-top: 2rem; padding: 1.1rem 1.25rem; background: var(--paper); border-radius: 1rem; max-width: 34rem; }
.keeplink p { margin: 0 0 .7rem; }
.keeplink__row { display: flex; gap: .5rem; }
.keeplink__row .input { min-width: 0; font-size: .8125rem; color: var(--ink-soft); }
.keeplink__row .pill { flex: none; }
.order__summary { position: static; }
.sline--static:hover { border-color: transparent; }
#missing { padding: 2rem 0; }
#missing p { margin: .8rem 0 1.5rem; max-width: 34rem; color: var(--ink-soft); }
@media (max-width: 68rem) { .order__grid { grid-template-columns: 1fr; } }
