:root {
  --ink: #151515; --muted: #6a6a65; --line: #e6e6e3; --surface: #fff; --panel: #f1f0ec;
  --accent: #1f45c4; --accent-soft: #e3e9fb; --warn: #c2410c; --warn-soft: #fbe6dc; --ok: #3f8f66;
  --floor: #fcfcfb; --grid: #f0f0ee; --wall: #151515; --piece: #efefec; --piece-line: #8b8b85; --kept: #a5a59f; --window: #6aa6dc; --swing: #f3f3f1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 16px/1.6 var(--sans); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 14px; z-index: 20; padding: 10px 16px; border-radius: 6px; background: var(--ink); color: #fff; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.grow { flex: 1; }

/* ---------- page ---------- */
.topbar, .page, .foot { width: min(1080px, 100% - 56px); margin-inline: auto; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding: 18px 0; font-size: 14px; }
.brand { font-family: var(--serif); font-size: 17px; text-decoration: none; }
.links { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.links a { color: var(--muted); text-decoration: none; }
.links a:hover, .links a[aria-current] { color: var(--ink); }
.links a[aria-current] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.title { padding: 54px 0 34px; text-align: center; }
.title h1 { margin-bottom: 16px; font: 500 48px/1.15 var(--serif); letter-spacing: -.01em; }
.authors { margin-bottom: 8px; font-size: 17px; }
.meta { font-size: 14px; color: var(--muted); }
.abstract { max-width: 760px; margin: 0 auto 56px; font-size: 17px; line-height: 1.7; color: #2a2a28; }
.feature { padding: 40px 0 46px; border-top: 1px solid var(--line); }
.feature h2 { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; font: 500 27px/1.2 var(--serif); }
.feature h2 span { font: 13px var(--mono); color: var(--muted); }
.feature > p { max-width: 760px; margin-bottom: 26px; font-size: 15.5px; line-height: 1.7; color: #3a3a37; }
.figure { margin: 0; }
.figure > img { display: block; width: 100%; max-width: 640px; border-radius: 4px; }
.pair { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: center; gap: 26px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.checks { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 34px; }
.side { display: grid; gap: 18px; padding-top: 8px; }
.actions { display: flex; align-items: center; gap: 14px; }
.capture-steps { margin-top: 16px; }
.page-title { padding: 52px 0 30px; font: 500 40px/1.15 var(--serif); }
.team { padding: 40px 0 56px; border-top: 1px solid var(--line); }
.team h2 { margin-bottom: 26px; font: 500 27px/1.2 var(--serif); }
.team-groups { display: flex; flex-wrap: wrap; gap: 36px 56px; }
.team-group h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.people { display: flex; flex-wrap: wrap; gap: 20px; margin: 0; padding: 0; list-style: none; }
.person { display: grid; align-content: start; gap: 3px; width: 172px; }
.portrait { display: grid; place-items: center; aspect-ratio: 4 / 5; margin-bottom: 9px; overflow: hidden; border-radius: 10px; background: var(--panel); }
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.person .name { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.person .role { font-size: 13px; color: var(--muted); }
.no-photo .portrait img { display: none; }
.no-photo .portrait::before { content: attr(data-initials); font: 500 32px var(--serif); color: var(--muted); }
.foot { padding: 26px 0 50px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- plan ---------- */
.plan { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.plan.editable { touch-action: none; }
.plan .floor { fill: var(--floor); }
.plan .grid { stroke: var(--grid); stroke-width: .8; }
.plan .wall { stroke: var(--wall); stroke-width: 7; stroke-linecap: square; }
.plan .wall.ext { stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: butt; opacity: .5; }
.plan .win { fill: var(--surface); stroke: var(--wall); stroke-width: 1.2; }
.plan .win-line { stroke: var(--window); stroke-width: 2.5; }
.plan .swing { fill: var(--swing); stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.plan .leaf { stroke: var(--wall); stroke-width: 2.5; }
.plan .dim { fill: var(--muted); font-family: var(--mono); }
.plan .dimline, .plan .scale { stroke: var(--muted); stroke-width: 1; }
.plan .cam { fill: var(--wall); }
.plan .hatch { stroke: var(--kept); stroke-width: 1.4; }
.plan .piece { stroke: var(--piece-line); stroke-width: 1.4; stroke-linejoin: round; }
.plan .piece:not(.kept) { fill: var(--piece); }
.plan .piece.kept { stroke: var(--kept); stroke-dasharray: 4 3; }
.plan .piece.art { fill: var(--piece-line); stroke: none; }
.plan .piece.sel { stroke: var(--accent); stroke-width: 2.6; fill: var(--accent-soft); }
.plan .piece.art.sel { fill: var(--accent); }
.plan .piece.bad { stroke: var(--warn); fill: var(--warn-soft); }
.plan .piece.art.bad { fill: var(--warn); }
.plan .lock { fill: none; stroke: var(--kept); stroke-width: 1.6; }
.plan .num circle { fill: var(--surface); stroke: var(--wall); stroke-width: 1.4; }
.plan .num text { fill: var(--ink); font-family: var(--mono); font-weight: 700; pointer-events: none; }
.plan .num .tick { stroke: var(--muted); stroke-width: 1; }
.plan .num.sel circle { fill: var(--accent); stroke: var(--accent); }
.plan .num.bad circle { fill: var(--warn); stroke: var(--warn); }
.plan .num.sel text, .plan .num.bad text { fill: #fff; }
.plan .tag { pointer-events: none; }
.plan .tag rect { fill: var(--warn); }
.plan .tag text { fill: #fff; font-weight: 600; }
.plan .walk { fill: var(--accent); opacity: .08; shape-rendering: crispEdges; pointer-events: none; }
.plan .handle line { stroke: var(--accent); stroke-width: 1.5; }
.plan .handle circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2; cursor: grab; }
.plan .handle .hit { fill: transparent; stroke: none; }
.plan .handle text { fill: var(--accent); font-weight: 700; pointer-events: none; }
.plan [data-id] { cursor: pointer; }
.plan.editable [data-id] { cursor: grab; }
.plan .ring { fill: none; stroke: var(--accent); stroke-width: 2; }
.plan .ring.hidden { stroke-dasharray: 3 3; }
.plan .ptap { fill: var(--accent); }
.plan:focus-visible { outline-offset: 6px; }

/* ---------- photo ---------- */
.photo { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: #e8e5df; user-select: none; -webkit-user-select: none; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: filter .35s, opacity .35s; }
.photo svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.photo svg:focus-visible { outline-offset: -4px; }
.photo.stale img { filter: grayscale(.9) brightness(1.06); opacity: .78; }
.photo.busy img { opacity: .5; }
.photo .pin { cursor: pointer; }
.photo .pin:focus { outline: none; }
.photo .pin circle { fill: #fff; stroke: rgba(0, 0, 0, .12); stroke-width: 1.5; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35)); }
.photo .pin:focus-visible circle { stroke: var(--accent); stroke-width: 5; }
.photo .pin text { fill: var(--ink); font-family: var(--mono); font-weight: 700; pointer-events: none; }
.photo .pin.sel circle { fill: var(--accent); stroke: #fff; }
.photo .pin.bad circle { fill: var(--warn); stroke: #fff; }
.photo .pin.sel text, .photo .pin.bad text { fill: #fff; }
.photo .outline { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; pointer-events: none; }
.photo .ghost { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 10 8; opacity: .8; pointer-events: none; }
.photo.capture svg { cursor: crosshair; }
.afloor circle { fill: #fff; opacity: .6; }
.aline { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.acorner { fill: none; stroke: #fff; stroke-width: 4; }
.acorner.hidden { stroke-dasharray: 7 6; }
.ahigh line { stroke: #fff; stroke-width: 3; }
.ahigh circle { fill: #fff; }
.ahigh rect { fill: rgba(18, 22, 28, .78); }
.ahigh text { fill: #fff; font-family: var(--mono); font-weight: 600; }
.aopen { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.akeep line { stroke: #fff; stroke-width: 3; stroke-dasharray: 9 6; }
.atap { fill: #fff; stroke: var(--accent); stroke-width: 3; }
.target .pulse { fill: none; stroke: #fff; stroke-width: 4; transform-box: fill-box; transform-origin: center; animation: pulse 1.5s ease-out infinite; }
.target .core { fill: #fff; stroke: var(--accent); stroke-width: 4; }
.shutter .o { fill: rgba(255, 255, 255, .3); stroke: #fff; stroke-width: 5; }
.shutter .i { fill: #fff; }
.photo.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .5s ease-out forwards; pointer-events: none; }
@keyframes pulse { from { transform: scale(.35); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }

/* ---------- controls ---------- */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; }
.chip i { width: 8px; height: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.chip.active { border-color: var(--ink); color: var(--ink); }
.chip.active i { border-color: var(--accent); background: var(--accent); }
.chip.done { color: var(--ink); }
.chip.done i { border-color: var(--ink); background: var(--ink); }
.chip-reset { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 15px; }
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.seg-label { padding: 0 8px 0 7px; font-size: 12px; color: var(--muted); }
.seg button { min-width: 34px; height: 30px; border: 0; border-radius: 6px; background: none; font: 600 13px var(--mono); }
.seg button.on { background: var(--ink); color: var(--surface); }
.unplaced { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px dashed var(--muted); border-radius: 9px; font-size: 12px; color: var(--muted); }
.unplaced i { width: 11px; height: 11px; border: 1.5px dashed var(--muted); border-radius: 2px; }
.unplaced b { font-weight: 600; color: var(--ink); }
.selinfo { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 30px; font-size: 13px; }
.selinfo .n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font: 700 11px var(--mono); }
.selinfo .k { color: var(--muted); }
.selinfo .dims { font: 12px var(--mono); color: var(--muted); }
.button { padding: 10px 16px; border: 1px solid var(--ink); border-radius: 6px; background: var(--surface); font-size: 13px; font-weight: 600; }
.button.primary { background: var(--ink); color: #fff; }
.button[aria-disabled="true"] { border-color: var(--line); background: var(--surface); color: var(--muted); cursor: default; }
.button.busy { cursor: progress; opacity: .6; }
.text-button { padding: 6px 4px; border: 0; background: none; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.text-button[aria-disabled="true"] { opacity: .4; cursor: default; }
.rules { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.rules li { display: flex; align-items: center; gap: 11px; font-size: 14px; }
.rules li i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.rules li.bad { font-weight: 600; color: var(--warn); }
.rules li.bad i { background: var(--warn); }

/* ---------- documents ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 34px 26px; margin: 0; padding: 0 0 80px; list-style: none; }
.docs-empty { padding-bottom: 80px; color: var(--muted); }
.doc { display: grid; gap: 10px; text-decoration: none; }
.doc-face { display: grid; place-items: center; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 10px; background: var(--panel); transition: background .2s; }
.doc-face::before { content: ""; width: 58%; aspect-ratio: 1 / 1.414; background: #fff; opacity: .7; }
html.js .doc-face::before { animation: breathe 1.4s ease-in-out infinite alternate; }
.doc.ready .doc-face::before, .doc.failed .doc-face::before { content: none; }
.doc.failed .doc-face::after { content: "PDF"; font: 600 15px var(--mono); color: var(--muted); }
.doc-face canvas { max-width: 82%; max-height: 84%; width: auto; height: auto; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 8px 22px rgba(0, 0, 0, .1); transition: transform .25s ease, box-shadow .25s ease; }
.doc:hover .doc-face { background: #eae8e2; }
.doc:hover .doc-face canvas { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 16px 34px rgba(0, 0, 0, .16); }
.doc:focus-visible { outline: none; }
.doc:focus-visible .doc-face { outline: 2px solid var(--accent); outline-offset: 3px; }
.doc-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.doc-meta { margin-top: -5px; font: 12px var(--mono); color: var(--muted); }
@keyframes breathe { to { opacity: .35; } }

/* ---------- viewer ---------- */
html:has(dialog.viewer[open]) { overflow: hidden; }
.viewer { width: calc(100vw - 40px); height: calc(100vh - 40px); max-width: none; max-height: none; margin: auto; padding: 0; overflow: hidden; border: 0; border-radius: 12px; background: #e8e7e3; color: var(--ink); box-shadow: 0 24px 70px rgba(0, 0, 0, .35); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(22, 22, 20, .56); }
.v-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 10px 9px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.v-title { flex: 1; min-width: 0; overflow: hidden; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.v-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; }
.v-btn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: none; font-size: 17px; text-decoration: none; }
.v-btn:hover { background: #f0efec; }
.v-btn[aria-disabled="true"] { opacity: .35; cursor: default; }
.v-count, .v-zoom { min-width: 62px; font: 12px var(--mono); color: var(--muted); text-align: center; }
.v-download { height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.v-scroll { position: relative; flex: 1; overflow: auto; }
.v-list { display: flex; flex-direction: column; align-items: safe center; gap: 18px; min-width: fit-content; padding: 26px; }
.v-page { width: calc(min(860px, 100vw - 112px) * var(--zoom, 1)); background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 10px 28px rgba(0, 0, 0, .08); }
.v-page canvas { display: block; width: 100%; height: 100%; }
.v-error { margin: auto; padding: 40px 24px; text-align: center; color: var(--muted); }
.v-error a { color: var(--accent); }

/* ---------- 404 ---------- */
.error-page { padding: 100px 0; }
.error-page h1 { margin: 18px 0 14px; font: 500 46px/1.15 var(--serif); }
.error-page .button { display: inline-block; margin-top: 26px; text-decoration: none; }

@media (max-width: 760px) {
  .pair, .checks { grid-template-columns: 1fr; }
  .pair > .plan, .pair > .plan-box, .checks > .plan-box { width: 100%; max-width: 560px; justify-self: center; }
}
@media (max-width: 700px) {
  .topbar, .page, .foot { width: calc(100% - 32px); }
  .title { padding-top: 34px; }
  .title h1 { font-size: 36px; }
  .abstract { margin-bottom: 40px; font-size: 16px; }
  .feature { padding: 32px 0 38px; }
  .feature h2 { font-size: 24px; }
  .page-title { padding: 34px 0 24px; font-size: 32px; }
  .team-groups { gap: 28px; }
  .people { gap: 16px; }
  .person { width: calc((100vw - 48px) / 2); }
  .docs { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 26px 16px; }
  .viewer { width: 100vw; height: 100dvh; border-radius: 0; }
  .v-title { flex: 1 0 calc(100% - 60px); }
  .v-close { order: -1; }
  .v-title { order: -2; }
  .v-list { padding: 16px; }
  .v-page { width: calc((100vw - 32px) * var(--zoom, 1)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .target .pulse, html.js .doc-face::before { animation: none; }
  .photo img, .doc-face canvas { transition: none; }
}
