/* Jobsizing. Layout idea: a tool first, like a page torn from a tradesman's notebook.
   Worksheet on the left, margin notes on the right, ruled lines instead of cards.
   Each section of the site takes the colour of a site material. */
@font-face { font-family: "Zilla Slab"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/zilla-slab-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/zilla-slab-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --paper: #eceee9;
  --panel: #f8f9f5;
  --ink: #17191b;
  --muted: #55595e;
  --rule: #c3c8c0;
  --pencil: #f4c20d;
  --blue: #1d4f8c;
  --brick: #a24a36;
  --slate: #3e5b52;
  --cement: #8a8d89;
  --wood: #8a6a43;
  --amber: #b38600;
  --accent: var(--blue);
  --font-display: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
body.sec-area { --accent: var(--blue); }
body.sec-roofs { --accent: var(--brick); }
body.sec-floors { --accent: var(--slate); }
body.sec-walls { --accent: var(--wood); }
body.sec-conv { --accent: var(--cement); }
body.sec-pay { --accent: var(--amber); }

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 18px; line-height: 1.55; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* masthead */
.mast { border-bottom: 4px solid var(--ink); }
.mast .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 10px; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 30px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; background: linear-gradient(transparent 62%, var(--pencil) 62%); padding: 0 3px; }
.nav { display: flex; gap: 6px 20px; flex-wrap: wrap; font-size: 16px; }
.nav a { color: var(--ink); text-decoration: none; border-bottom: 3px solid var(--rule); padding-bottom: 1px; }
.nav a.n-area { border-bottom-color: var(--blue); }
.nav a.n-roofs { border-bottom-color: var(--brick); }
.nav a.n-floors { border-bottom-color: var(--slate); }
.nav a.n-walls { border-bottom-color: var(--wood); }
.nav a.n-conv { border-bottom-color: var(--cement); }
.nav a.n-pay { border-bottom-color: var(--amber); }
.nav a[aria-current] { font-weight: 700; background: linear-gradient(transparent 70%, var(--pencil) 70%); }

.crumbs { font-size: 15px; color: var(--muted); margin: 14px 0 0; }
.crumbs a { color: var(--muted); }

/* page grid */
.page { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; padding-top: 14px; padding-bottom: 64px; }
h1 { font-family: var(--font-display); font-size: 44px; line-height: 1.08; margin: 8px 0 10px; text-wrap: balance; }
h2 { font-family: var(--font-display); font-size: 27px; line-height: 1.15; margin: 44px 0 10px; text-wrap: balance; }
h3 { font-family: var(--font-display); font-size: 20px; margin: 22px 0 6px; }
p { margin: 0 0 14px; max-width: 66ch; }
.lede { font-size: 20px; max-width: 60ch; margin-bottom: 22px; }

/* worksheet */
.sheet { background: var(--panel); border: 2px solid var(--ink); border-top: 10px solid var(--accent); padding: 14px 18px 18px; }
.sheet-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; padding-bottom: 10px; }
.sheet-head h2 { margin: 0; font-size: 22px; }
.unit-pick { font-size: 15px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
select, input[type="text"] { font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #8d938a; border-radius: 0; padding: 6px 8px; width: 100%; min-width: 0; }
input[type="text"] { font-family: var(--font-mono); font-size: 15px; }
input[type="text"]:disabled { background: #eceee9; color: var(--muted); }
input.bad { border-color: #a4262c; background: #fbeeee; }
.unit-pick select { width: auto; }

.row { display: grid; grid-template-columns: 1.4rem 7.6rem repeat(3, minmax(6.6rem, 1fr)) 6.2rem 6.2rem 2rem; gap: 8px; align-items: end; padding: 12px 0; border-top: 1px solid var(--rule); }
.row.v-nomode { grid-template-columns: 1.4rem 7.6rem repeat(3, minmax(6.6rem, 1fr)) 6.6rem 2rem; }
.row.v-named.v-nomode { grid-template-columns: 8rem 7.6rem repeat(3, minmax(6.2rem, 1fr)) 6.4rem 2rem; }
.row.v-roof { grid-template-columns: 1.4rem minmax(6.6rem, 1fr) minmax(6.6rem, 1fr) 11.5rem 6.6rem 2rem; }
.row.v-wall { grid-template-columns: 1.4rem repeat(2, minmax(6.6rem, 1fr)) 7rem 2rem; }
.row.v-wall.v-qty { grid-template-columns: 1.4rem repeat(2, minmax(6.6rem, 1fr)) 5rem 7rem 2rem; }
.row .idx { font-family: var(--font-mono); color: var(--muted); padding-bottom: 8px; }
.f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.f .lab { font-size: 13px; color: var(--muted); text-transform: lowercase; }
.f.off { visibility: hidden; }
.res { font-family: var(--font-mono); font-size: 15px; text-align: right; padding-bottom: 8px; white-space: nowrap; }
.res small { color: var(--muted); font-size: 12px; }
.rm { font: inherit; font-size: 20px; line-height: 1; background: none; border: 1px solid var(--rule); color: var(--muted); height: 34px; cursor: pointer; }
.rm:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.rm:disabled { opacity: .35; cursor: default; }
.add { font: inherit; font-size: 16px; font-weight: 600; background: none; border: 2px dashed #8d938a; color: var(--ink); padding: 8px 14px; cursor: pointer; margin-top: 4px; }
.add:hover { border-color: var(--ink); }
.hint { font-size: 14px; color: var(--muted); margin: 8px 0 0; max-width: none; }
.list-h { font-size: 17px; margin: 18px 0 4px; border-top: 2px solid var(--ink); padding-top: 12px; }
.list-h:first-of-type { margin-top: 6px; }
.preset-lab { font-size: 14px; color: var(--muted); margin: 0 6px 0 12px; }
.preset { width: auto; display: inline-block; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 8px; }

.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 2px solid var(--ink); }

/* result */
.out { margin-top: 16px; padding-top: 14px; border-top: 2px solid var(--ink); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.out.one { grid-template-columns: minmax(0, 1fr); }
.big { font-family: var(--font-mono); font-weight: 500; font-size: 46px; line-height: 1.05; letter-spacing: -0.02em; }
.big span { background: linear-gradient(transparent 58%, var(--pencil) 58%); padding: 0 4px; }
.big em { font-style: normal; font-size: 20px; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.out .sub { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.out .sub b { color: var(--ink); }
.out .sub:empty { display: none; }
.conv { width: 100%; border-collapse: collapse; font-size: 16px; }
.conv td { padding: 4px 0; border-bottom: 1px solid var(--rule); }
.conv td:last-child { text-align: right; font-family: var(--font-mono); font-size: 15px; }
.copy { font: inherit; font-size: 15px; font-weight: 600; background: var(--ink); color: #fff; border: 0; padding: 8px 14px; cursor: pointer; margin-top: 12px; }
.copy:hover { background: var(--accent); }
body.sec-conv .copy:hover { background: var(--ink); outline: 2px solid var(--cement); }
.status { font-size: 14px; color: var(--muted); margin-left: 10px; }
.warn { color: #8a1c21; font-size: 15px; margin: 8px 0 0; }
.lot .sub { margin-top: 10px; font-size: 16px; color: var(--ink); }

/* content */
table.ref { border-collapse: collapse; margin: 10px 0 18px; font-size: 16px; }
table.ref th, table.ref td { text-align: left; padding: 6px 18px 6px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.ref th { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 2px solid var(--ink); }
table.ref td.n { font-family: var(--font-mono); font-size: 15px; white-space: nowrap; }
.scroll { overflow-x: auto; }
.mono { font-family: var(--font-mono); font-size: .92em; }
ul.plain { margin: 0 0 14px; padding-left: 20px; max-width: 66ch; }
ul.plain li { margin-bottom: 8px; }
.eg { border-left: 6px solid var(--pencil); padding: 4px 0 4px 16px; margin: 12px 0 18px; }
.eg p { margin-bottom: 6px; }
details { border-top: 1px solid var(--rule); padding: 10px 0; max-width: 70ch; }
details:last-of-type { border-bottom: 1px solid var(--rule); }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 2px; }
figure { margin: 14px 0 22px; }
figcaption { font-size: 15px; color: var(--muted); margin-top: 6px; max-width: 66ch; }
svg.plan { width: 100%; max-width: 520px; height: auto; background: #f3f6fa; border: 1px solid var(--rule); }
.related { list-style: none; padding: 0; margin: 0 0 14px; }
.related li { border-top: 1px solid var(--rule); padding: 8px 0; max-width: 70ch; }
.related li:last-child { border-bottom: 1px solid var(--rule); }
.related a { font-weight: 600; }
.related span { color: var(--muted); font-size: 16px; display: block; }

/* margin notes */
aside { align-self: start; position: sticky; top: 16px; font-size: 16px; }
aside section { border-top: 3px solid var(--accent); padding-top: 8px; margin-bottom: 26px; }
aside h2 { font-size: 18px; margin: 0 0 6px; }
aside p, aside li { font-size: 15px; max-width: none; }
aside ul { padding-left: 18px; margin: 0 0 8px; }
aside code { font-family: var(--font-mono); font-size: 14px; background: #fff; border: 1px solid var(--rule); padding: 0 4px; }

/* home */
.cats { margin-top: 8px; }
.cat { border-left: 10px solid var(--c, var(--blue)); padding: 2px 0 2px 18px; margin: 0 0 28px; }
.cat h2 { margin: 0 0 6px; font-size: 26px; }
.cat p { margin-bottom: 8px; }
.c-area { --c: var(--blue); } .c-roofs { --c: var(--brick); } .c-floors { --c: var(--slate); }
.c-walls { --c: var(--wood); } .c-conv { --c: var(--cement); } .c-pay { --c: var(--amber); }
.legal { max-width: 70ch; }
.legal h2 { font-size: 22px; margin-top: 30px; }

footer { border-top: 4px solid var(--ink); padding: 18px 0 40px; font-size: 15px; color: var(--muted); }
footer p { max-width: 70ch; margin-bottom: 8px; }
footer a { color: var(--muted); }

@media (max-width: 900px) {
  .page { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  aside { position: static; }
  h1 { font-size: 34px; }
}
@media (max-width: 720px) {
  body { font-size: 17px; }
  .row, .row.v-nomode, .row.v-named.v-nomode, .row.v-roof, .row.v-wall, .row.v-wall.v-qty { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row .idx { display: none; }
  .row .shape, .row .nm { grid-column: 1 / -1; }
  .row .mode { grid-column: 1 / 3; }
  .row .rm { grid-column: 3; }
  .row .res { grid-column: 1 / -1; text-align: left; padding-bottom: 0; }
  .row.v-roof .f:nth-of-type(4) { grid-column: 1 / -1; }
  .out { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .big { font-size: 38px; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.legal form { max-width: 34rem; margin: 0 0 1.5rem; }
.legal label { display: block; margin: 14px 0 4px; font-weight: 600; }
.legal textarea, .legal input[type="email"] { font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #8d938a; border-radius: 0; padding: 8px; width: 100%; }
.legal .btn { margin-top: 14px; font: inherit; font-weight: 700; background: var(--ink); color: #fff; border: 0; padding: 9px 20px; cursor: pointer; }
.legal .btn:hover { background: var(--blue); }
