/* DrawMyPart. Palette taken from the machine shop: machined aluminium, graphite ink and
   the blue layout fluid machinists paint on parts before scribing lines into it. */
:root {
  --paper: #eef1f4;
  --sheet: #ffffff;
  --ink: #15202b;
  --graphite: #5a6672;
  --rule: #c9d0d7;
  --blue: #2338c4;
  --blue-deep: #1a2a96;
  --blue-tint: #e4e8fb;
  --amber: #a86b12;
  --red: #b42318;
  --green: #2f7a4f;
  --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --wide: 'wdth' 118;
  --measure: 68ch;
  --r: 6px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--font); font-variation-settings: 'wdth' 100; font-feature-settings: 'tnum' 0; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { font-variation-settings: var(--wide); font-weight: 760; letter-spacing: -0.012em; line-height: 1.12; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.95rem); margin-top: 1.8em; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--sheet); padding: 0.5rem 1rem; z-index: 10; }

/* Header */
.top { background: var(--sheet); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 0.7rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font-weight: 800; font-variation-settings: 'wdth' 125; font-size: 1.15rem; letter-spacing: -0.01em; }
.nav { display: flex; gap: 0.25rem 1.1rem; flex-wrap: wrap; margin-left: auto; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current] { border-bottom-color: var(--blue); }
.nav .nav-account { border: 1px solid var(--ink); border-radius: var(--r); padding: 0.25rem 0.75rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; font: inherit; font-weight: 600; font-size: 0.97rem; padding: 0.62rem 1.05rem; border-radius: var(--r); border: 1.5px solid var(--ink); background: var(--sheet); color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--paper); color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.btn.ghost { border-color: var(--rule); }
.btn.small { padding: 0.4rem 0.75rem; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.on-blue { background: #fff; border-color: #fff; color: var(--blue); }

/* Layout */
main { display: block; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }
.crumbs { max-width: 1240px; margin: 0 auto; padding: 1.1rem 1.25rem 0; font-size: 0.9rem; color: var(--graphite); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: '/'; margin-right: 0.35rem; color: var(--rule); }
.crumbs a { color: var(--graphite); }

/* Home */
.hero { padding: clamp(2.5rem, 6vw, 5rem) 0 0; }
.hero h1 { max-width: 17ch; font-size: clamp(2.4rem, 6vw, 4.6rem); font-variation-settings: 'wdth' 122; letter-spacing: -0.02em; }
.hero .lede { max-width: 56ch; font-size: 1.2rem; color: var(--graphite); }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.6rem 0 0; }
.band { margin-top: clamp(2.5rem, 5vw, 4rem); background: var(--blue); background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.07) 0 1px, transparent 1px 44px); padding: clamp(1.5rem, 4vw, 3rem) 0; }
.band figure { margin: 0; }
.sheet-img { display: block; width: 100%; background: #fff; border-radius: 2px; box-shadow: 0 1px 0 rgba(0,0,0,0.2), 0 18px 40px -18px rgba(5, 12, 60, 0.6); }
.band figcaption { color: #fff; margin-top: 0.9rem; font-size: 0.95rem; max-width: 70ch; }
.band figcaption a { color: #fff; }
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section > .wrap > h2:first-child { margin-top: 0; }
.steps-list { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 2rem 2.5rem; counter-reset: s; }
.steps-list li { counter-increment: s; border-top: 3px solid var(--ink); padding-top: 0.9rem; }
.steps-list li::before { content: counter(s); font-weight: 800; font-variation-settings: 'wdth' 125; font-size: 2.4rem; line-height: 1; display: block; color: var(--blue); margin-bottom: 0.5rem; }
.steps-list h3 { margin-top: 0; }
.steps-list p { color: var(--graphite); margin: 0; }
.checks { columns: 2 320px; column-gap: 3rem; padding: 0; margin: 1.6rem 0 0; list-style: none; }
.checks li { break-inside: avoid; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.checks strong { display: block; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 1.5rem; } }
.price-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border: 1.5px solid var(--ink); border-radius: var(--r); background: var(--sheet); margin-top: 1.5rem; }
.price-row > div { padding: 1.4rem 1.3rem; }
.price-row > div + div { border-left: 1px solid var(--rule); }
@media (max-width: 700px) { .price-row > div + div { border-left: 0; border-top: 1px solid var(--rule); } }
.price-row .amount { font-size: 2.2rem; font-weight: 800; font-variation-settings: 'wdth' 120; line-height: 1.1; margin: 0.3rem 0; }
.price-row .amount small { font-size: 1rem; font-weight: 500; color: var(--graphite); }
.price-row ul { padding-left: 1.1rem; margin: 0.8rem 0 1.2rem; color: var(--graphite); font-size: 0.95rem; }
.price-row .featured { background: var(--blue-tint); }
.link-cols { columns: 3 240px; column-gap: 2.5rem; padding: 0; list-style: none; margin: 1.2rem 0 0; }
.link-cols li { break-inside: avoid; padding: 0.35rem 0; }

/* Article */
.article { max-width: 1240px; margin: 0 auto; padding: 1.2rem 1.25rem 3rem; display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr); gap: 3rem; }
.article > .body { min-width: 0; }
.article .lede { font-size: 1.17rem; color: var(--graphite); }
.article aside.side { position: sticky; top: 5rem; align-self: start; font-size: 0.95rem; border-left: 1px solid var(--rule); padding-left: 1.5rem; }
.article aside.side h2 { font-size: 1rem; margin: 0 0 0.6rem; }
.article aside.side ul { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.article aside.side li { padding: 0.2rem 0; }
@media (max-width: 980px) { .article { grid-template-columns: 1fr; } .article aside.side { position: static; border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); padding-top: 1.5rem; } }
.body ul, .body ol { padding-left: 1.3rem; }
.body li { margin: 0.3rem 0; }
.table-wrap { overflow-x: auto; margin: 1.2rem 0 1.6rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; font-feature-settings: 'tnum' 1; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 650; background: #f6f8fa; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.callout { background: var(--sheet); border-left: 4px solid var(--blue); padding: 1rem 1.2rem; margin: 1.5rem 0; border-radius: 0 var(--r) var(--r) 0; }
.callout p:last-child { margin: 0; }
.cta-box { background: var(--blue); color: #fff; border-radius: var(--r); padding: 1.5rem; margin: 2.5rem 0 1rem; }
.cta-box h2 { margin-top: 0; font-size: 1.4rem; }
.cta-box p { color: #e6e9fb; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.4rem; margin: 1.2rem 0; padding: 1rem 1.2rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
.facts dt { font-weight: 650; }
.facts dd { margin: 0; }
.ad { max-width: 1240px; margin: 1.5rem auto; padding: 0 1.25rem; min-height: 100px; }
.ad[hidden] { display: none; }

/* Footer */
.foot { background: var(--ink); color: #cfd6de; margin-top: 3rem; }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 3rem 1.25rem 1.5rem; display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 2rem; }
@media (max-width: 860px) { .foot-in { grid-template-columns: 1fr 1fr; } }
.foot h2 { font-size: 1rem; color: #fff; margin: 0 0 0.6rem; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { padding: 0.2rem 0; }
.foot a { color: #e6eaee; }
.foot .btn { color: var(--ink); border-color: #fff; }
.foot-brand { font-weight: 800; font-variation-settings: 'wdth' 125; color: #fff; font-size: 1.2rem; margin-bottom: 0.4rem; }
.foot-legal { max-width: 1240px; margin: 0 auto; padding: 1rem 1.25rem 2rem; font-size: 0.85rem; color: #98a3ae; border-top: 1px solid #2a3846; }

/* Forms */
label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; font-weight: 600; color: var(--graphite); }
input, select, textarea { font: inherit; font-size: 0.97rem; color: var(--ink); padding: 0.5rem 0.6rem; border: 1px solid #aeb7c0; border-radius: var(--r); background: #fff; font-weight: 400; width: 100%; }
textarea { resize: vertical; }
.form { max-width: 420px; display: grid; gap: 0.9rem; }
.form-error { color: var(--red); font-weight: 600; }
.notice { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem 1.2rem; }

/* ---------- Tool ---------- */
.tool-page main { min-height: 70vh; }
.start { max-width: 1240px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.drop { border: 2px dashed #8f9aa6; border-radius: 10px; background: var(--sheet); padding: clamp(2rem, 6vw, 4.5rem) 1.5rem; text-align: center; transition: border-color 0.15s, background 0.15s; }
.drop.over { border-color: var(--blue); background: var(--blue-tint); }
.drop h1 { font-size: clamp(2rem, 4vw, 3rem); }
.drop p { color: var(--graphite); max-width: 52ch; margin: 0 auto 1.4rem; }
.drop .row { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.start-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem 2.5rem; margin-top: 2rem; color: var(--graphite); font-size: 0.95rem; }
.start-notes h2 { font-size: 1.05rem; color: var(--ink); margin: 0 0 0.3rem; }
.ws { max-width: 1440px; margin: 0 auto; padding: 1rem 1.25rem 2rem; }
.ws-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0.4rem 0 1rem; }
.ws-bar strong { font-variation-settings: var(--wide); font-size: 1.1rem; }
.ws-bar span { color: var(--graphite); font-size: 0.93rem; }
.ws-bar .btn { margin-left: auto; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 980px) { .ws-grid { grid-template-columns: 1fr; } }
.viewer { position: sticky; top: 4.6rem; height: min(72vh, 680px); background: radial-gradient(circle at 50% 40%, #fff 0, #e3e8ed 75%); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
@media (max-width: 980px) { .viewer { position: relative; top: 0; height: 52vh; } }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer-hint { position: absolute; left: 0.8rem; bottom: 0.6rem; font-size: 0.82rem; color: var(--graphite); pointer-events: none; }
.viewer-fail { padding: 2rem; color: var(--graphite); }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 0 1.25rem 1.25rem; min-width: 0; }
.steps { display: flex; border-bottom: 1px solid var(--rule); margin: 0 -1.25rem 1.2rem; position: sticky; top: 3.9rem; background: var(--sheet); z-index: 2; border-radius: var(--r) var(--r) 0 0; }
.steps button { flex: 1; font: inherit; font-weight: 650; font-size: 0.95rem; background: none; border: 0; border-bottom: 3px solid transparent; padding: 0.9rem 0.5rem; cursor: pointer; color: var(--graphite); }
.steps button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--blue); }
.fine { font-size: 0.83rem; color: var(--graphite); margin: 0.3rem 0 0; }
.lead { margin: 0.2rem 0 1rem; }
.warn { background: #fdf3e3; border-left: 3px solid var(--amber); padding: 0.5rem 0.8rem; font-size: 0.9rem; border-radius: 0 var(--r) var(--r) 0; }
/* bodies list (step 1) */
.bodies { list-style: none; padding: 0; margin: 0 0 1rem; }
.body { display: flex; align-items: center; gap: 0.8rem; border: 1px solid var(--rule); border-radius: var(--r); padding: 0.55rem 0.8rem; margin-bottom: 0.5rem; cursor: pointer; background: var(--sheet); }
.body.on { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.body.off { opacity: 0.55; }
.body .num { font-weight: 800; font-variation-settings: var(--wide); color: var(--blue); min-width: 1.4rem; text-align: center; font-size: 1.1rem; }
.body-main { flex: 1; min-width: 0; }
.body-name { font: inherit; font-weight: 650; border: 1px solid transparent; border-radius: 4px; padding: 0.15rem 0.35rem; width: 100%; background: transparent; }
.body-name:hover, .body-name:focus { border-color: var(--rule); background: #fff; }
.body .meta { margin: 0; font-size: 0.86rem; color: var(--graphite); padding-left: 0.35rem; }
.inc { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.inc input { width: 1.05rem; height: 1.05rem; margin: 0; }
/* body chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }
.chip { font: inherit; font-size: 0.86rem; font-weight: 600; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer; }
.chip.on { border-color: var(--blue); background: var(--blue-tint); }
.chip.done::before { content: '✓ '; color: var(--green); }
.chip.off { opacity: 0.5; text-decoration: line-through; }
/* template settings */
.tpl { border: 1px solid var(--rule); border-radius: var(--r); padding: 0.4rem 1rem 0.9rem; margin: 0.4rem 0 1.2rem; background: var(--paper); }
.tpl summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.tpl summary::-webkit-details-marker { display: none; }
.tpl summary::before { content: '▸'; color: var(--graphite); font-size: 0.9rem; }
.tpl[open] summary::before { content: '▾'; }
.tpl summary h2 { margin: 0.4rem 0; }
.tpl h2 small, .step h2 small { font-weight: 500; font-size: 0.8rem; color: var(--graphite); font-variation-settings: 'wdth' 100; }
.file-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.file-btn { position: relative; }
.logo-prev img { vertical-align: middle; margin-right: 0.4rem; background: #fff; padding: 2px; border: 1px solid var(--rule); border-radius: 3px; }
/* drawing status list */
.status { list-style: none; padding: 0; margin: 1rem 0 0; border-top: 1px solid var(--rule); }
.status li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); font-size: 0.92rem; }
.status button { font: inherit; background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; }
.status li.ok span { color: var(--green); font-weight: 600; }
.status li.todo span { color: var(--amber); font-weight: 600; }
.status li.off { opacity: 0.55; }
.error.info { background: var(--ink); }
.step-foot { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.step h2 { font-size: 1.15rem; margin: 1.3rem 0 0.7rem; }
.progress-line { background: var(--paper); padding: 0.6rem 0.8rem; border-radius: var(--r); }
.fields { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0.5rem 0 0.7rem; }
.fields.grid2 { grid-template-columns: 1fr 1fr; }
.fields .wide { grid-column: 1 / -1; }
.items { list-style: none; padding: 0; margin: 0; }
.item { border: 1px solid var(--rule); border-radius: var(--r); padding: 0.8rem 0.9rem; margin-bottom: 0.7rem; cursor: pointer; }
.item.ok { border-color: var(--green); background: #f3f9f5; }
.item-head { display: flex; justify-content: space-between; gap: 0.8rem; align-items: baseline; }
.item h3 { font-size: 0.98rem; margin: 0 0 0.3rem; font-variation-settings: 'wdth' 105; }
.item .state { color: var(--green); font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.item .hint { font-size: 0.9rem; color: var(--graphite); margin: 0 0 0.4rem; }
.item .callout { margin: 0.2rem 0 0.6rem; padding: 0.4rem 0.6rem; font-size: 0.9rem; background: var(--paper); border-left-width: 3px; }
.missing { padding-left: 1.2rem; }
.plan { background: var(--paper); padding: 0.6rem 0.8rem; border-radius: var(--r); font-size: 0.93rem; }
.exports { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }
.sheet-wrap { margin-top: 1.25rem; background: #fff; border: 1px solid var(--rule); border-radius: var(--r); padding: 0.75rem; overflow: auto; }
.sheet-wrap svg { width: 100%; height: auto; display: block; min-width: 720px; }
.progress { position: fixed; inset: 0; background: rgba(238, 241, 244, 0.86); display: grid; place-items: center; z-index: 20; }
.progress[hidden] { display: none; }
.progress div { width: min(420px, 80vw); text-align: center; }
.progress .bar { height: 4px; background: var(--rule); border-radius: 2px; overflow: hidden; position: relative; margin-bottom: 1rem; }
.progress .bar::after { content: ''; position: absolute; left: -40%; width: 40%; height: 100%; background: var(--blue); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress .bar::after { animation: none; left: 0; width: 100%; opacity: 0.5; } }
.error { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--red); color: #fff; padding: 0.8rem 1.1rem; border-radius: var(--r); max-width: min(560px, 92vw); z-index: 30; }
.error[hidden] { display: none; }
dialog { border: 1.5px solid var(--ink); border-radius: var(--r); padding: 1.5rem; max-width: min(760px, 94vw); }
dialog::backdrop { background: rgba(21, 32, 43, 0.45); }
dialog .price-row { margin-top: 1rem; }
.dialog-close { position: absolute; right: 1rem; top: 1rem; }
.item.warn-item { border-color: var(--amber); background: #fdf8ef; cursor: default; }
