/* Bin Rack. Light and dark themes from the same tokens; every text colour meets WCAG 2.2 AA on its background. */
:root {
  --bg: #f7f4ef; --card: #ffffff; --ink: #1f1a14; --muted: #5a5147; --line: #e3dbd0;
  --brand: #8a4b14; --brand-ink: #ffffff; --link: #7a4210; --head: #5b3412; --head-ink: #ffffff; --head-soft: #f3dfc8;
  --focus: #1d4ed8; --ok-bg: #e7f4ec; --ok-ink: #14532d; --warn-bg: #fff3d4; --warn-ink: #5e4100; --err-bg: #fde8e6; --err-ink: #8a1c12;
  --tag-bg: #f1ebe2; --radius: 12px;
  --wood: #c98d4c; --wood-run: #b87a3a; --wood-edge: #6b4219; --tote: #3b4047; --lid: #e3b21b; --ply: #e4c79d; --dim: #4a4035; --hl: #b45309;
  --cut-post: #b87a3a; --cut-runner: #d9a465; --cut-connector: #8f5a24; --off: #ece6dc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15110d; --card: #201a14; --ink: #f2ebe2; --muted: #c4b7a6; --line: #3a3027;
    --brand: #f0b37a; --brand-ink: #2a1606; --link: #f4c08f; --head: #0f0b08; --head-ink: #ffffff; --head-soft: #f3dfc8;
    --focus: #93c5fd; --ok-bg: #163a24; --ok-ink: #c8efd2; --warn-bg: #3a2e0c; --warn-ink: #ffe3a3; --err-bg: #3d1611; --err-ink: #ffd2cb;
    --tag-bg: #2c241c; --dim: #d8ccbd; --hl: #fbbf24; --off: #2c241c; --ply: #b89a70;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--link); text-underline-offset: 2px; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 .6rem; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .7rem; }
h3 { font-size: 1.05rem; margin: 16px 0 6px; }
p { margin: 0 0 .8rem; }
:is(a, button, input, select, textarea, summary, svg, [tabindex]):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 2000; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 16px; }
main:focus { outline: none; }
.site-header { background: var(--head); color: var(--head-ink); }
.hbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { color: var(--head-ink); text-decoration: none; font-weight: 800; font-size: 1.2rem; padding: 8px 0; }
.brand span { margin-right: .3em; }
.head-link { color: var(--head-soft); padding: 8px 0; }
.hero { padding: 8px 0 4px; max-width: 860px; }
.lead { font-size: 1.2rem; font-weight: 600; }
.alert { background: var(--warn-bg); color: var(--warn-ink); padding: 12px 14px; border-radius: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; min-width: 0; }
.layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 980px) { .layout { grid-template-columns: minmax(330px, 400px) 1fr; } .layout > .card, .layout > .right > .card { margin: 0; } .right { position: sticky; top: 8px; } }
.layout { margin-bottom: 16px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.field { margin: 0 0 14px; }
.field > label, .field > .label { display: block; font-weight: 650; margin-bottom: 4px; }
input[type=text], input[type=number], select { width: 100%; font: inherit; font-size: 16px; padding: 9px 11px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); min-height: 44px; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 .4rem; }
.small { font-size: .9rem; }
.muted { color: var(--muted); }
.check label, .check-row, .check-inline { display: flex; gap: 8px; align-items: center; font-weight: 600; min-height: 32px; }
.check input, .check-row input, .check-inline input { width: 22px; height: 22px; flex: none; margin: 0; }
.check-row { font-weight: 500; margin: 0 0 2px; }
.units { display: flex; gap: 8px; }
.seg { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 2px 12px 2px 8px; border: 1px solid var(--line); border-radius: 99px; font-weight: 600; cursor: pointer; }
.seg input { width: 18px; height: 18px; margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.stepper { display: flex; gap: 6px; align-items: center; }
.stepper input { text-align: center; }
.with-unit { display: flex; align-items: center; gap: 6px; } .with-unit input { max-width: 9rem; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; } .inline-fields .field { margin: 0; }
details.fit { border-top: 1px solid var(--line); padding-top: 10px; }
details.fit > summary { cursor: pointer; font-weight: 700; color: var(--link); min-height: 32px; display: flex; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: var(--brand-ink); border: 2px solid var(--brand); border-radius: 10px;
  padding: 8px 16px; min-height: 44px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; color: var(--link); border-color: var(--link); }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .95rem; }
.btn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.stepper .btn { min-width: 44px; min-height: 44px; font-size: 1.2rem; }
.linkish { background: none; border: 0; padding: 4px 0; min-height: 24px; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
table.data { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.data caption { text-align: left; font-weight: 700; padding: 6px 0; }
table.data th, table.data td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.data tbody th { font-weight: 600; }
table.data .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tfoot th, table.data tfoot td { font-weight: 800; border-bottom: 0; }
table.cols input, table.cols select { min-height: 40px; padding: 6px 8px; }
table.cols input { max-width: 5rem; }
.table-wrap { overflow-x: auto; position: relative; }
.price { display: inline-flex; align-items: center; gap: 2px; } .price input { width: 6.5rem; min-height: 36px; padding: 4px 6px; text-align: right; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 0 0 10px; }
.tile { background: var(--tag-bg); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.tile .lbl { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tile .num { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.say { font-weight: 600; margin: 0 0 10px; }
.view-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 0 0 8px; }
.seg-group { display: inline-flex; gap: 4px; }
.showing { background: var(--tag-bg); border-radius: 8px; padding: 6px 10px; margin: 0 0 8px; font-weight: 600; }
.view3d { background: var(--tag-bg); border-radius: 10px; overflow: hidden; touch-action: none; }
.view3d svg { display: block; width: 100%; height: auto; cursor: grab; }
.view3d svg:active { cursor: grabbing; }
.checks { list-style: none; padding: 0; margin: 12px 0 0; }
.checks .ck { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); font-size: .95rem; }
.checks .ck:first-child { border-top: 0; }
.ck .mk { flex: none; width: 24px; height: 24px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.ck.ok .mk { background: var(--ok-bg); color: var(--ok-ink); }
.ck.bad .mk { background: var(--err-bg); color: var(--err-ink); }
.ck.bad { color: var(--err-ink); font-weight: 600; }
.ck.warn .mk { background: var(--warn-bg); color: var(--warn-ink); }
.ck.info .mk { background: var(--tag-bg); color: var(--muted); }
.step { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.step:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.step h3 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.step .num { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-weight: 800; flex: none; }
figure { margin: 10px 0 14px; }
figcaption { color: var(--muted); font-size: .88rem; margin-top: 4px; }
svg.draw { display: block; width: 100%; max-width: 760px; height: auto; }
.draw .wd { fill: var(--wood); stroke: var(--wood-edge); stroke-width: 1; }
.draw .wd.run { fill: var(--wood-run); }
.draw .wd.far { fill: var(--wood); opacity: .45; stroke-dasharray: 4 3; }
.draw .post-mark { fill: var(--wood-run); stroke: var(--wood-edge); stroke-width: 1; }
.draw .ply { fill: var(--ply); stroke: var(--wood-edge); }
.draw .tote { fill: var(--tote); stroke: #111; stroke-width: .6; }
.draw .lid { fill: var(--lid); stroke: #6b5200; stroke-width: .6; }
.draw .angle { fill: #6b7280; stroke: #111; }
.draw .dim { stroke: var(--dim); stroke-width: 1; fill: none; }
.draw .dim.hl, .draw .t.hl { stroke: var(--hl); fill: var(--hl); font-weight: 800; }
.draw .dim.hl { stroke-width: 2.5; }
.draw .floor { stroke: var(--muted); stroke-width: 2; }
.draw .t { fill: var(--ink); font: 600 13px system-ui, sans-serif; }
.draw .t.small { font-size: 11px; }
.draw .t.on { fill: #1f1a14; font-size: 12px; }
.draw .cut { stroke: var(--wood-edge); stroke-width: 1; }
.draw .cut.post { fill: var(--cut-post); } .draw .cut.runner { fill: var(--cut-runner); } .draw .cut.connector { fill: var(--cut-connector); }
.draw .off { fill: var(--off); stroke: var(--line); }
.board-row { margin: 0 0 10px; } .board-row p { margin: 0 0 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.key { display: inline-block; width: 18px; height: 12px; border: 1px solid var(--wood-edge); margin-right: 4px; vertical-align: middle; }
.key.post { background: var(--cut-post); } .key.runner { background: var(--cut-runner); } .key.connector { background: var(--cut-connector); }
.tote-fig svg { max-width: 440px; }
.link-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .link-box input { flex: 1 1 18rem; }
.site-footer { margin-top: 24px; color: var(--ink); }
.site-footer a { color: var(--ink); }

/* Email me these plans */
.email-form { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.email-form h3, #share h3 { margin-top: 0; }
.email-form .field { flex: 1 1 18rem; }
.email-form input[type=email] { width: 100%; font: inherit; font-size: 16px; padding: 9px 11px; border: 1px solid var(--muted); border-radius: 8px; background: var(--card); color: var(--ink); min-height: 44px; }
#emailSay:empty { display: none; }
#emailSay { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--tag-bg); font-weight: 600; }
#emailSay.ok { background: var(--ok-bg); color: var(--ok-ink); }
#emailSay.err { background: var(--err-bg); color: var(--err-ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.actions-bar { margin: 16px 0 0; }
.print-only { display: none; }

/* Cards that open and close (fold.js) */
.card-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 24px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; line-height: inherit; text-align: left; cursor: pointer; }
.card-toggle::after { content: ''; flex: none; margin-left: auto; margin-right: 4px; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .75; }
.card-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.card-toggle:hover { color: var(--link); }
.card.collapsed > h2 { margin-bottom: 0; }
.has-side-toggle { display: flex; align-items: center; gap: 10px; }
.card-toggle.card-toggle-side { width: auto; min-width: 32px; min-height: 32px; margin-left: auto; justify-content: center; flex: none; }
@media (prefers-reduced-motion: no-preference) { .card-toggle::after { transition: transform .15s; } }

@page { margin: 14mm 12mm; }
@media print {
  .site-header, .site-footer, .layout, #share, .hero, .linkish, .actions-bar, #how, #ways, #sizes, #safety, #faq, .card-toggle::after { display: none !important; }
  .print-only { display: block !important; }
  #printHead { break-after: page; }
  #printHead figure svg { max-height: 300px; width: auto; max-width: 100%; }
  #printHead .checks { columns: 2; column-gap: 24px; font-size: .8rem; } #printHead .checks .ck { break-inside: avoid; padding: 3px 0; }
  #printHead h2 { font-size: 1.05rem; margin: 6px 0 2px; } .ph-safe { font-size: .9rem; margin-top: 8px; }
  #shopping .field.check { display: none !important; }
  #printHead h1 { font-size: 1.6rem; margin: 4px 0 8px; } .ph-brand { color: #5a5147; font-weight: 700; margin: 0; } .ph-sum { font-size: 1.05rem; } .ph-link a { color: #1f1a14; word-break: break-all; font-size: .85rem; }
  :root { --ink: #1f1a14; --muted: #4a4035; --line: #d9cfc2; --card: #fff; --tag-bg: #f1ebe2; --dim: #4a4035; --ok-bg: #e7f4ec; --ok-ink: #14532d; --err-bg: #fde8e6; --err-ink: #8a1c12; --warn-bg: #fff3d4; --warn-ink: #5e4100; --brand: #8a4b14; --brand-ink: #fff; --off: #ece6dc; }
  #plan { break-before: auto; } #shopping, #cuts { break-before: page; }
  body { background: #fff; color: #000; } .card { border: 0; padding: 0; } .card-body[hidden] { display: block !important; } .card-toggle::after { display: none; }
  .price input { border: 0; width: 4.5rem; }
  figure, .step h3 { break-inside: avoid; } .step h3 { break-after: avoid; }
}
