/* devcentric: "Software, made to measure"
   Pattern-cutting table: dot-and-cross pattern paper, pattern-ink indigo, tape-measure yellow.
   One family (Archivo, with a width axis) plus JetBrains Mono for real code only.
   Strict CSP: no external resources, no inline styles. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-var.woff2") format("woff2-variations"), url("/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-var.woff2") format("woff2-variations"), url("/fonts/jetbrains-mono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  /* palette */
  --paper: #f6f7f4;        /* pattern paper */
  --sheet: #ffffff;        /* a fresh sheet laid on the table */
  --ink: #1b2350;          /* pattern ink */
  --ink-soft: #4a5070;
  --ink-faint: #6f7590;
  --grid: #c3c9d6;         /* printed dot grid */
  --rule: #1b235033;
  --tape: #f5c518;         /* tape-measure yellow: the only accent */
  --thread: #3a5bd9;       /* tracing-wheel blue: links and focus */
  --ok: #1d7a4c;
  --warn: #b3261e;

  /* type: one family on a modular scale */
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.375rem;
  --step-2: 1.875rem;
  --step-3: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);

  --measure: 64ch;
  --wrap: min(1200px, 100% - clamp(2rem, 6vw, 5rem));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1330;
    --sheet: #151b40;
    --ink: #eef0f6;
    --ink-soft: #c2c7da;
    --ink-faint: #9298b3;
    --grid: #2a3263;
    --rule: #eef0f62e;
    --thread: #9db0ff;
    --ok: #63d69a;
    --warn: #ff8a80;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  /* dot-and-cross pattern paper: a dot every 24px, a cross every 96px */
  background-image: url("/paper.svg"), radial-gradient(circle, var(--grid) 1px, transparent 1.3px);
  background-size: 96px 96px, 24px 24px;
  background-position: 0 0, 0 0;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  font-kerning: normal;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--thread); text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
a:hover { color: var(--thread); }
:focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; }
s { text-decoration-thickness: 1.5px; }
kbd {
  font-family: var(--mono); font-size: 0.8em; padding: 0.05em 0.4em; border-radius: 3px;
  border: 1px solid var(--rule); border-bottom-width: 2px; background: var(--sheet);
}

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; }
.skip:focus { top: 1rem; }

/* ---------- Masthead ---------- */
.masthead {
  width: var(--wrap); margin: 0 auto; padding: 1.5rem 0 0;
  display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem 2rem; flex-wrap: wrap;
}
.brand { font-weight: 800; font-stretch: 112%; letter-spacing: -0.02em; font-size: var(--step-1); text-decoration: none; }
.brand:hover { color: inherit; }
.nav { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; margin: 0; padding: 0; }
.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.nav a.nav__cta { color: var(--ink); font-weight: 650; box-shadow: inset 0 -0.45em 0 var(--tape); }
@media (prefers-color-scheme: dark) { .nav a.nav__cta { box-shadow: inset 0 -0.18em 0 var(--tape); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 650;
  padding: 0.8rem 1.4rem; border-radius: 3px; border: 2px solid var(--ink);
  text-decoration: none; cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--tape); color: #1b2350; border-color: var(--tape); }
.btn--primary:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--quiet { background: transparent; color: var(--ink); border-color: transparent; text-decoration: underline; text-decoration-color: var(--thread); padding-inline: 0.4rem; }
.btn--quiet:hover { color: var(--thread); }
.btn[disabled] { opacity: 0.55; cursor: progress; }

/* ---------- Hero: the fitted headline ---------- */
.hero { width: var(--wrap); margin: 0 auto; padding: clamp(3rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem); }
.fit {
  margin: 0; font-weight: 780; line-height: 0.86; letter-spacing: -0.02em;
  font-size: clamp(3.4rem, 15vw, 13rem); /* no-JS fallback */
}
.fit__line { display: block; white-space: nowrap; font-stretch: 100%; }
.fit.is-tailoring .fit__line { transition: font-stretch 1.1s cubic-bezier(.16, .84, .3, 1), letter-spacing 1.1s cubic-bezier(.16, .84, .3, 1); }

.dimension { display: grid; gap: 0.4rem; margin-top: clamp(1rem, 2.5vw, 1.75rem); color: var(--ink-soft); font-size: var(--step--1); }
.dimension__rule { position: relative; height: 13px; border-left: 1.5px solid currentColor; border-right: 1.5px solid currentColor; }
.dimension__rule::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 1.5px solid currentColor; }
.dimension__rule::after { /* the tape: grows to full width while the headline is fitted */
  content: ""; position: absolute; left: 0; top: 4px; height: 5px; width: var(--tape-progress, 100%); background: var(--tape);
  transition: width 1.1s cubic-bezier(.16, .84, .3, 1);
}
.dimension__label { justify-self: end; }
.dimension__label b { color: var(--ink); font-weight: 650; }

.hero__foot { display: grid; grid-template-columns: minmax(0, 36rem) auto; gap: 2rem 4rem; align-items: end; justify-content: space-between; margin-top: clamp(2rem, 5vw, 3.5rem); }
.hero__lede { margin: 0; font-size: var(--step-1); line-height: 1.45; color: var(--ink-soft); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }
@media (max-width: 52rem) { .hero__foot { grid-template-columns: 1fr; } }

/* ---------- Sections (shared rhythm) ---------- */
.section { width: var(--wrap); margin: 0 auto; padding: clamp(3.5rem, 8vw, 6.5rem) 0; border-top: 1.5px solid var(--ink); }
.section__title { margin: 0; font-size: var(--step-3); font-weight: 750; font-stretch: 88%; line-height: 1.02; letter-spacing: -0.015em; max-width: 20ch; }
.section__intro { margin: 1rem 0 0; max-width: var(--measure); color: var(--ink-soft); font-size: var(--step-1); line-height: 1.45; }

/* ---------- Off the rack vs made for you ---------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; margin-top: clamp(2rem, 4vw, 3rem); }
.compare__col { padding: 0.25rem clamp(1rem, 4vw, 3rem) 0.25rem 0; }
.compare__col + .compare__col { padding: 0.25rem 0 0.25rem clamp(1rem, 4vw, 3rem); border-left: 2px dashed var(--rule); } /* cutting line */
.compare h3 { margin: 0 0 1rem; font-size: var(--step-1); font-weight: 700; }
.compare ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.7rem; font-size: var(--step-1); line-height: 1.35; }
.compare__col--rack { color: var(--ink-faint); }
.compare__col--rack s { text-decoration-color: var(--ink-faint); }
.compare__col--bespoke li { padding-left: 1.4rem; position: relative; }
.compare__col--bespoke li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 0.6rem; height: 0.6rem; background: var(--tape); }
@media (max-width: 46rem) {
  .compare { grid-template-columns: 1fr; gap: 2rem; }
  .compare__col, .compare__col + .compare__col { padding: 0; border-left: 0; }
  .compare__col + .compare__col { border-top: 2px dashed var(--rule); padding-top: 2rem; }
}

/* ---------- Process (a real sequence, so it's numbered) ---------- */
.steps { list-style: none; margin: clamp(2rem, 4vw, 3rem) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem clamp(1rem, 2.5vw, 2rem); counter-reset: step; }
.step { counter-increment: step; padding-top: 1rem; border-top: 1.5px solid var(--ink); }
.step::before {
  content: counter(step); display: block; margin-bottom: 0.5rem;
  font-size: var(--step-3); font-weight: 300; font-stretch: 62%; line-height: 1; color: var(--ink-faint);
}
.step__title { margin: 0 0 0.6rem; font-size: var(--step-1); font-weight: 700; }
.step p { margin: 0 0 0.9rem; color: var(--ink-soft); max-width: 34ch; }
.step p.step__out { color: var(--ink); font-weight: 550; }
@media (max-width: 62rem) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 34rem) { .steps { grid-template-columns: 1fr; } }

/* ---------- Terminal ---------- */
.terminal { margin: clamp(2.5rem, 5vw, 4rem) 0 0; max-width: 46rem; }
.terminal__bar, .terminal__body { background: #111733; color: #dfe3f2; }
.terminal__bar { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.6rem 0.5rem 1rem; border-radius: 6px 6px 0 0; border-bottom: 1px solid #ffffff14; }
.terminal__title { font-family: var(--mono); font-size: 0.8rem; color: #8c92ad; }
.terminal__run { font: 600 0.8rem var(--mono); color: #111733; background: var(--tape); border: 0; border-radius: 3px; padding: 0.3rem 0.75rem; cursor: pointer; }
.terminal__run:hover { background: #ffd84d; }
.terminal__run[disabled] { opacity: 0.6; cursor: progress; }
.terminal__body { margin: 0; padding: 1.1rem 1.25rem 1.3rem; border-radius: 0 0 6px 6px; overflow-x: auto; font: 400 clamp(0.75rem, 0.7rem + 0.25vw, 0.9rem)/1.75 var(--mono); min-height: 13.5em; }
.t-prompt { color: var(--tape); }
.t-dim { color: #8c92ad; }
.t-ok { color: #63d69a; }
.t-strong { color: #fff; font-weight: 700; }
.terminal__cursor { display: inline-block; width: 0.55em; height: 1.1em; vertical-align: text-bottom; background: var(--tape); }
.terminal__caption { margin-top: 0.6rem; font-size: var(--step--1); color: var(--ink-faint); }

/* ---------- What we build: cloth list ---------- */
.cloths { list-style: none; margin: clamp(2rem, 4vw, 3rem) 0 0; padding: 0; }
.cloth {
  display: grid; grid-template-columns: 3.25rem minmax(10rem, 18rem) minmax(0, 1fr); gap: 0.5rem 2rem; align-items: baseline;
  padding: 1.4rem 0; border-bottom: 1px solid var(--rule);
}
.cloth:first-child { border-top: 1px solid var(--rule); }
.cloth__chip { width: 2.6rem; height: 2.6rem; align-self: center; border-radius: 2px; box-shadow: inset 0 0 0 1px #00000022; }
.cloth__name { margin: 0; font-size: var(--step-2); font-weight: 700; font-stretch: 90%; line-height: 1.1; letter-spacing: -0.01em; }
.cloth p { margin: 0; color: var(--ink-soft); max-width: var(--measure); }
@media (max-width: 46rem) {
  .cloth { grid-template-columns: 3.25rem 1fr; }
  .cloth p { grid-column: 2; }
}
.cloth__chip--pinstripe { background: repeating-linear-gradient(90deg, #26305e 0 7px, #c9d0ea 7px 8px); }
.cloth__chip--herringbone { background:
    linear-gradient(135deg, #5a4632 25%, transparent 25%) -5px 0 / 10px 10px,
    linear-gradient(225deg, #5a4632 25%, transparent 25%) -5px 0 / 10px 10px,
    linear-gradient(315deg, #5a4632 25%, transparent 25%) 0 0 / 10px 10px,
    linear-gradient(45deg, #5a4632 25%, #8a6c4e 25%) 0 0 / 10px 10px; }
.cloth__chip--check { background:
    linear-gradient(90deg, #f5c51888 50%, transparent 50%) 0 0 / 12px 12px,
    linear-gradient(#f5c51888 50%, transparent 50%) 0 0 / 12px 12px, #2f3a6b; }
.cloth__chip--weave { background: repeating-linear-gradient(0deg, #3a5bd9aa 0 4px, transparent 4px 8px), repeating-linear-gradient(90deg, #e8e2cf 0 4px, #d4ccb3 4px 8px); }
.cloth__chip--dot { background: radial-gradient(#f6f7f4 1.6px, transparent 2px) 0 0 / 8px 8px, #1f5c49; }

.tools { margin: 2rem 0 0; color: var(--ink-soft); max-width: var(--measure); }

/* ---------- Contact ---------- */
.section--contact { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 2.5rem clamp(2rem, 6vw, 5rem); align-items: start; }
.contact__alt { margin: 1.5rem 0 0; color: var(--ink-soft); }
.contact__alt strong { color: var(--ink); font-weight: 650; }
@media (max-width: 58rem) { .section--contact { grid-template-columns: 1fr; } }

/* The form is a fresh sheet laid on the pattern table */
.slip {
  background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 2px;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: var(--step--1); font-weight: 600; }
.opt { color: var(--ink-faint); font-weight: 400; }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink); background: transparent; width: 100%;
  border: 0; border-bottom: 1.5px solid var(--ink-faint); border-radius: 0; padding: 0.5rem 0.1rem;
}
.field textarea { resize: vertical; min-height: 9rem; border: 1.5px solid var(--ink-faint); border-radius: 2px; padding: 0.65rem 0.75rem; line-height: 1.5; }
.field textarea::placeholder { color: var(--ink-faint); }
.field select {
  appearance: none; padding-right: 1.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%), linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.field select option { color: #1b2350; background: #fff; }
.field input:focus, .field select:focus { outline: none; border-color: var(--thread); box-shadow: 0 1.5px 0 var(--thread); }
.field textarea:focus { outline: none; border-color: var(--thread); box-shadow: 0 0 0 1.5px var(--thread); }
.field [aria-invalid="true"] { border-color: var(--warn); }
.field__error { font-size: var(--step--1); color: var(--warn); min-height: 1.2em; }
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.slip__foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 0.25rem; }
.slip__note { margin: 0; font-size: var(--step--1); color: var(--ink-faint); }
.slip__status { grid-column: 1 / -1; margin: 0; min-height: 1.5em; font-weight: 550; }
.slip__status.is-ok { color: var(--ok); }
.slip__status.is-error { color: var(--warn); }
@media (max-width: 36rem) { .slip { grid-template-columns: 1fr; } }
.noscript { color: var(--ink-soft); }

/* ---------- Footer ---------- */
.footer { width: var(--wrap); margin: 0 auto; padding: 3rem 0 2.5rem; border-top: 1.5px solid var(--ink); }
.footer__line { margin: 0 0 2rem; font-size: var(--step-2); font-weight: 700; font-stretch: 115%; letter-spacing: -0.01em; }
.specs { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 0 0 2rem; }
.specs dt { font-size: var(--step--1); color: var(--ink-faint); }
.specs dd { margin: 0.1rem 0 0; font-weight: 650; }
.footer__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; font-size: var(--step--1); color: var(--ink-soft); }
.footer__hint { color: var(--ink-faint); }
@media (hover: none) { .footer__hint { display: none; } }

/* ---------- Show seams ---------- */
.seams-toggle {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 40;
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 0.85rem var(--sans); color: var(--paper); background: var(--ink);
  border: 0; border-radius: 3px; padding: 0.55rem 0.8rem; cursor: pointer;
}
.seams-toggle__glyph { font-family: var(--mono); }
.seams-toggle__label { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width 0.2s ease; }
.seams-toggle:hover .seams-toggle__label, .seams-toggle:focus-visible .seams-toggle__label, .seams-toggle[aria-pressed="true"] .seams-toggle__label { max-width: 10rem; }
.seams-toggle[aria-pressed="true"] { background: var(--tape); color: #1b2350; }

body.show-seams main *, body.show-seams header *, body.show-seams footer * { outline: 1px dashed color-mix(in srgb, var(--thread) 60%, transparent); outline-offset: -1px; }
body.show-seams [data-tag] { position: relative; outline: 1.5px solid var(--thread); }
body.show-seams [data-tag]::after {
  content: attr(data-tag); position: absolute; top: 0; left: 0; z-index: 30; pointer-events: none;
  font: 500 11px/1 var(--mono); color: #fff; background: var(--thread); padding: 3px 5px;
}

/* ---------- Shortcuts dialog ---------- */
.shortcuts { border: 1.5px solid var(--ink); border-radius: 2px; padding: 1.5rem 1.75rem; max-width: 28rem; width: calc(100% - 2rem); background: var(--sheet); color: var(--ink); }
.shortcuts::backdrop { background: #0e133099; }
.shortcuts h2 { margin: 0 0 1rem; font-size: var(--step-1); font-weight: 700; }
.shortcuts dl { margin: 0; display: grid; gap: 0.5rem; }
.shortcuts dl > div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--ink-soft); text-align: right; }
.shortcuts__hint { margin: 1rem 0; color: var(--ink-faint); font-size: var(--step--1); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 60; transform: translate(-50%, 0.75rem); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 3px; font-size: var(--step--1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Blueprint mode (Konami code) ---------- */
body.blueprint {
  --paper: #123c86; --sheet: #164594; --ink: #f2f6ff; --ink-soft: #c9d8f7; --ink-faint: #a9bfea;
  --grid: #ffffff40; --rule: #f2f6ff40; --thread: #ffffff; --ok: #b6f5cf; --warn: #ffd0cc;
  color-scheme: dark;
}
body.blueprint .fit, body.blueprint .section__title { font-weight: 300; }
body.blueprint .cloth__chip { filter: grayscale(1) brightness(1.6); mix-blend-mode: screen; }

/* ---------- 404 ---------- */
.lost { width: var(--wrap); margin: 0 auto; min-height: 75vh; display: grid; align-content: center; gap: 1rem; }
.lost h1 { margin: 0; font-size: clamp(2.6rem, 1.6rem + 5vw, 5.5rem); line-height: 0.95; font-weight: 780; font-stretch: 80%; letter-spacing: -0.02em; max-width: 14ch; }
.lost p { margin: 0; color: var(--ink-soft); max-width: 40ch; font-size: var(--step-1); }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
