/* Sweep: drafting film by day, blueprint by night. The one loud thing is the tape measure. */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(../fonts/barlow-400.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url(../fonts/barlow-500.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(../fonts/barlow-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url(../fonts/barlow-semi-condensed-600.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; font-display: swap; src: url(../fonts/barlow-semi-condensed-700.woff2) format('woff2'); }

:root {
  --paper: #f3f6f4;      /* drafting film */
  --panel: #fbfcfb;
  --grid: #dde5e1;
  --room: #e9eeeb;
  --ink: #1e2638;        /* graphite blue */
  --ink-2: #5b6577;
  --rule: #c9d2cf;
  --tape: #f5c400;       /* tape-measure yellow */
  --tape-ink: #15130a;
  --mark: #c8261b;       /* the red of a stud mark */
  --object: #dfe5e2;
  --beam-fade: rgba(200, 38, 27, 0.16);
  --focus: #1f5fd1;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --narrow: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f2b55;    /* blueprint */
    --panel: #12336a;
    --grid: #1c3f77;
    --room: #143566;
    --ink: #eaf1ff;
    --ink-2: #a9bbda;
    --rule: #2f5592;
    --mark: #ff6b57;
    --object: #1d4580;
    --beam-fade: rgba(255, 107, 87, 0.2);
    --focus: #ffd34d;
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  color: var(--ink);
  font: 400 16px/1.5 var(--body);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1, h2, h3 { font-family: var(--narrow); font-weight: 700; line-height: 1.1; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(34px, 7.2vw, 56px); max-width: 15ch; text-wrap: balance; }
h2 { font-size: 24px; }
h3 { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 12px; max-width: 64ch; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* header and the tape */
.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1180px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 16px 8px;
}
.brand { font: 700 26px/1 var(--narrow); text-decoration: none; letter-spacing: .01em; }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--ink); display: grid; place-items: center; }
.icon-btn:hover { background: var(--grid); }

.tape {
  height: 18px;
  background-color: var(--tape);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 63px, rgba(200, 38, 27, .9) 63px 65px, transparent 65px 128px),
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1.5px, transparent 1.5px 64px),
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 16px),
    repeating-linear-gradient(90deg, var(--tape-ink) 0 1px, transparent 1px 8px);
  background-size: 100% 100%, 100% 12px, 100% 8px, 100% 5px;
  background-repeat: repeat-x;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .18);
}

main { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.screen { padding: 22px 0 28px; }

/* buttons */
.primary, .secondary, .quiet {
  border-radius: var(--radius); padding: 11px 18px; min-height: 46px; cursor: pointer;
  font: 600 17px/1.1 var(--narrow); letter-spacing: .01em; border: 2px solid transparent;
}
.primary { background: var(--tape); color: var(--tape-ink); border-color: var(--tape-ink); }
.primary:hover { filter: brightness(1.04); }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
.secondary:hover { background: var(--grid); }
.quiet { background: none; border-color: transparent; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; padding-inline: 6px; }
.quiet:hover { color: var(--ink); }
.danger { color: var(--mark); }
.big { width: 100%; min-height: 60px; font-size: 22px; }
.row { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row > .primary, .row > .secondary { flex: 1 1 auto; }

/* home */
.hero { display: grid; gap: 22px; align-items: center; padding: 6px 0 26px; }
.lede { font-size: 18px; color: var(--ink-2); margin-top: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 10px; }
.actions .primary, .actions .secondary { flex: 1 1 200px; }
.support { font-size: 15px; color: var(--ink-2); }
.support strong { color: var(--ink); }
.hero-plan { margin: 0; aspect-ratio: 4 / 3; max-width: 520px; width: 100%; justify-self: center; }
.hero-plan svg { width: 100%; height: 100%; display: block; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.05fr 1fr; padding-top: 18px; } }

.rooms { border-top: 2px solid var(--ink); padding-top: 14px; }
.room-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 0; }
.room-list li { border-bottom: 1px solid var(--rule); }
.room-list a { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px 4px; text-decoration: none; }
.room-list a:hover { background: color-mix(in srgb, var(--grid) 60%, transparent); }
.thumb { width: 76px; height: 60px; display: block; }
.thumb svg { width: 100%; height: 100%; display: block; }
.room-name { font: 600 19px/1.15 var(--narrow); display: block; }
.room-meta { color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; display: block; }
.empty, .total { color: var(--ink-2); margin-top: 12px; }
.total { font-family: var(--narrow); font-weight: 600; color: var(--ink); font-size: 17px; }
@media (min-width: 720px) { .room-list { grid-template-columns: 1fr 1fr; column-gap: 28px; } }

/* bars */
.bar { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 8px; }
.back { background: none; border: 0; padding: 8px 10px 8px 0; cursor: pointer; font: 600 17px/1 var(--narrow); color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.back::before { content: ''; width: 9px; height: 9px; border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); margin-right: 4px; }
.back:hover { color: var(--ink); }
.bar-title { font: 700 22px/1.1 var(--narrow); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font: 600 13px/1 var(--narrow); padding: 6px 9px; border-radius: 99px; border: 1.5px solid var(--ink-2); color: var(--ink-2); }
.name-input { flex: 1; min-width: 0; font: 700 24px/1.1 var(--narrow); background: transparent; border: 0; border-bottom: 2px dashed var(--rule); padding: 6px 2px; }
.name-input:focus { border-bottom-color: var(--ink); outline: none; }

/* scan */
.scan-grid, .plan-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .scan-grid { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); align-items: start; }
  .plan-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; }
  .radar-wrap, .plan-main { position: sticky; top: 12px; }
}
.radar-wrap { position: relative; aspect-ratio: 1; width: calc(100% - 18px); max-width: 640px; justify-self: center; border-radius: 50%; background: var(--panel); box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 7px var(--panel), 0 0 0 8.5px var(--rule); margin: 9px; }
#radar { width: 100%; height: 100%; display: block; border-radius: 50%; }
.countdown { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; border-radius: 50%; background: color-mix(in srgb, var(--panel) 82%, transparent); padding: 18%; }
#count-num { font: 700 clamp(64px, 18vw, 120px)/1 var(--narrow); font-variant-numeric: tabular-nums; }
#count-text { font: 600 18px/1.25 var(--narrow); color: var(--ink-2); }
.readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 12px; }
.readouts div { border-top: 2px solid var(--ink); padding-top: 6px; }
.readouts dt { font-size: 14px; color: var(--ink-2); }
.readouts dd { margin: 0; font: 600 22px/1.15 var(--narrow); font-variant-numeric: tabular-nums; }
.hint, .note, .small { color: var(--ink-2); font-size: 15px; }
.note { border-left: 3px solid var(--tape); padding-left: 10px; }
.device { border-top: 1px solid var(--rule); padding-top: 8px; margin-top: 8px; }
.device summary { cursor: pointer; font: 600 17px/1.4 var(--narrow); padding: 4px 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 8px 0; font-size: 15px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* plan */
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 2px 0 12px; }
.tape-label {
  font: 700 clamp(24px, 6vw, 34px)/1 var(--narrow); font-variant-numeric: tabular-nums;
  background: var(--tape); color: var(--tape-ink); padding: 9px 16px 8px; border-radius: 4px;
  background-image: repeating-linear-gradient(90deg, rgba(21, 19, 10, .55) 0 1px, transparent 1px 10px);
  background-size: 100% 6px; background-repeat: repeat-x; background-position: 0 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.area { font: 600 22px/1.1 var(--narrow); font-variant-numeric: tabular-nums; }
.tape-label, .area { white-space: nowrap; }
.looks { color: var(--ink-2); font-size: 15px; margin-bottom: 14px; }
.notice { border: 2px solid var(--mark); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; background: var(--panel); }
.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }
.plan-wrap { background: var(--panel); border: 1.5px solid var(--ink); border-radius: 4px; }
.plan-svg { width: 100%; aspect-ratio: 1; }
.plan-svg svg { display: block; width: 100%; height: 100%; }
.plan-side section { margin-bottom: 18px; }
.walls { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.walls li { border-bottom: 1px solid var(--rule); }
.walls button { width: 100%; display: flex; justify-content: space-between; gap: 12px; background: none; border: 0; padding: 9px 4px; cursor: pointer; text-align: left; font-size: 16px; }
.walls button:hover, .walls button[aria-pressed="true"] { background: color-mix(in srgb, var(--grid) 70%, transparent); }
.walls .len { font: 600 18px/1.2 var(--narrow); font-variant-numeric: tabular-nums; white-space: nowrap; }
.walls .sub { color: var(--ink-2); font-size: 14px; }
.walls li.static { display: flex; justify-content: space-between; padding: 9px 4px; }
.toggle { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-size: 16px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--ink); }

/* dialogs */
.sheet { border: 0; border-radius: 14px 14px 0 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; background: var(--panel); color: var(--ink); max-height: 92vh; }
.sheet::backdrop { background: rgba(10, 16, 28, .45); }
@media (min-width: 640px) { .sheet { border-radius: 14px; margin: auto; } }
.sheet form { padding: 20px 18px max(18px, env(safe-area-inset-bottom)); }
.sheet h2 { margin-bottom: 12px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; display: flex; gap: 16px; flex-wrap: wrap; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; width: 100%; }
fieldset label { display: flex; gap: 8px; align-items: center; }
.field { display: grid; gap: 6px; margin: 0 0 14px; font-weight: 600; }
.field select, .field input { font-weight: 400; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--ink-2); background: var(--paper); width: 100%; }
.field .value { font-weight: 400; color: var(--ink-2); }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }

.toast {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.jd-foot { text-align: center; font-size: 14px; color: var(--ink-2); padding: 18px 16px max(22px, env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: center; }
.jd-foot a { color: var(--ink-2); text-decoration: none; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; color: var(--ink); }
.noscript { padding: 16px; }
