:root {
  --paper: #ece3cf;
  --paper-2: #f4efe3;
  --ink: #1e2621;
  --muted: #5f5a4b;
  --rust: #8a4f12;
  --rule-soft: #c9b48f;
  --serif: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --sans: Cabin, "Gill Sans", "Gill Sans MT", "Trebuchet MS", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 48px clamp(14px, 3vw, 28px) 64px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

/* small caps label used everywhere */
.kick, .meta, .dek, .onpage a, .status, .seg button, .primary, .ghost, .lbl, .glance-head, .readout dt {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: .2em; font-size: 12px;
}

/* masthead */
.mast { border-top: 2px solid var(--ink); }
.meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--ink); font-size: 11px; font-weight: 600; }
.mast h1 { font-family: var(--serif); font-weight: 400; text-align: center; font-size: clamp(48px, 9vw, 116px); line-height: .98; letter-spacing: -.015em; margin: 22px 0 26px; }
.dek { color: var(--rust); text-align: center; margin: 0; padding: 10px 0; border-top: 1px solid var(--ink); border-bottom: 4px double var(--ink); font-size: 13px; }

/* in-page nav */
.onpage { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; padding: 12px 0; border-bottom: 1px solid var(--ink); position: sticky; top: 0; background: var(--paper); z-index: 5; }
.onpage a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 11.5px; }
.onpage a:hover { color: var(--rust); }
.status { margin-left: auto; font-size: 11px; color: var(--muted); }
.status.ready { color: var(--rust); }

.lede { font-family: var(--serif); font-style: italic; font-size: clamp(21px, 2.2vw, 27px); line-height: 1.3; max-width: 34em; margin: 30px 0 34px; }
.lede::first-letter { float: left; font-style: normal; color: var(--rust); font-size: 4.1em; line-height: .78; margin: .06em .1em 0 0; }

/* layout */
.layout { display: grid; grid-template-columns: 280px minmax(340px, 1fr) 300px; gap: 36px; align-items: start; border-top: 2px solid var(--ink); padding-top: 22px; }
.layout > section + section, .layout > aside { border-left: 1px solid var(--rule-soft); padding-left: 36px; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr 1fr; }
  .plan { grid-column: 1 / -1; order: -1; border-left: 0 !important; padding-left: 0 !important; }
  .controls { border-left: 0; padding-left: 0; }
}
@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; }
  .layout > * { border-left: 0 !important; padding-left: 0 !important; }
}

.kick { color: var(--rust); font-weight: 700; display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.kick::after { content: ""; flex: 1; height: 1px; background: var(--rule-soft); }
.controls .kick:not(:first-child), .side .glance { margin-top: 30px; }

/* samples */
.samples { border-top: 1px solid var(--ink); }
.samples button {
  width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--rule-soft); background: transparent;
  padding: 10px 10px 10px 14px; cursor: pointer; display: flex; flex-direction: column; position: relative;
}
.samples button span { font-family: var(--serif); font-size: 21px; line-height: 1.15; }
.samples button small { color: var(--muted); font-size: 13px; }
.samples button:hover { background: var(--paper-2); }
.samples button.on { background: var(--paper-2); }
.samples button.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--rust); }
.samples button.on span { color: var(--rust); }

.upload { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); cursor: pointer; }
.upload input { display: block; margin-bottom: 6px; max-width: 100%; font-size: 12px; }
#uploadMsg { margin: 4px 0 0; min-height: 1em; }
#uploadMsg.error { color: #a2361f; }
body.dropping .controls { outline: 2px dashed var(--rust); outline-offset: 8px; }

.primary { background: var(--ink); color: var(--paper); border: 0; padding: 13px 22px; cursor: pointer; font-weight: 600; min-width: 130px; }
.primary:hover { background: #2f3a33; }
.primary:disabled { opacity: .4; cursor: wait; }
.ghost { margin-top: 10px; width: 100%; border: 1px solid var(--ink); background: transparent; padding: 9px; cursor: pointer; font-size: 11px; font-weight: 600; }
.ghost:hover, .ghost.on { background: var(--ink); color: var(--paper); }
.transport { display: flex; align-items: center; gap: 16px; }
.check { display: flex; gap: 8px; align-items: baseline; font-size: 14px; flex-wrap: wrap; margin-top: 12px; }
.check input { accent-color: var(--rust); }
.check .hint { flex-basis: 100%; padding-left: 22px; }
.hint, .caption { font-size: 13px; color: var(--muted); line-height: 1.45; }
.caption { font-style: italic; margin: 8px 0 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--ink); margin-top: 16px; }
.seg4 { grid-template-columns: repeat(4, 1fr); margin-top: 6px; }
.seg button { border: 0; border-right: 1px solid var(--ink); background: transparent; padding: 9px 4px; cursor: pointer; font-size: 11px; font-weight: 600; letter-spacing: .14em; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--paper-2); }
.seg button.on { background: var(--ink); color: var(--paper); }

.row { display: grid; gap: 4px; margin-top: 18px; }
.lbl { font-size: 11px; font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--rust); }
.meter { height: 3px; background: var(--rule-soft); overflow: hidden; margin-top: 6px; }
.meter div { height: 100%; width: 0; background: var(--rust); transition: width 60ms linear; }

/* floor plan + side view */
#floor { width: 100%; max-width: 560px; margin: 0 auto; height: auto; display: block; touch-action: none; user-select: none; }
#floor .listener { cursor: grab; }
#floor .listener:focus { outline: none; }
#floor .listener:focus-visible .ring { stroke: var(--rust); stroke-width: 3; }
#floor.dragging .listener { cursor: grabbing; }
.plan .caption { text-align: center; }
svg text { font-family: var(--sans); }
#elev { width: 100%; height: auto; display: block; }
#elev .hopt { cursor: pointer; }

/* "at a glance" box */
.glance { background: var(--paper-2); border: 1px solid var(--ink); }
.glance-head { background: var(--ink); color: var(--paper); padding: 9px 14px; font-size: 11px; font-weight: 600; }
.readout { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; padding: 14px; }
.readout dt { color: var(--rust); font-size: 10.5px; font-weight: 700; padding-top: 4px; }
.readout dd { margin: 0; font-family: var(--serif); font-size: 17px; line-height: 1.25; }
#env { width: calc(100% - 28px); height: 90px; display: block; margin: 0 14px; background: var(--paper); border-top: 1px solid var(--ink); }
.glance .caption { padding: 0 14px 14px; }

/* how it works */
.how { margin-top: 56px; border-top: 2px solid var(--ink); padding-top: 22px; }
.how h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4vw, 48px); line-height: 1.05; margin: 0 0 18px; }
.how .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.how .cols p { margin: 0; font-size: 17px; line-height: 1.6; }
.how .cols p + p { border-left: 1px solid var(--rule-soft); padding-left: 36px; }
@media (max-width: 700px) { .how .cols { grid-template-columns: 1fr; } .how .cols p + p { border: 0; padding: 0; } }
.readout dd small { display: block; font-family: var(--sans); font-size: 12px; color: var(--muted); }
.readout { font-variant-numeric: lining-nums; }
.ghost + .hint { margin: 6px 0 0; }
