/* "Draw it up": the deck and patio planner. Its own section, stylesheet and script, so it lifts out cleanly. */
.plan-grid { display: grid; gap: 18px; }
.plan-fig {
  position: sticky; top: calc(var(--head) - 6px); z-index: 4; margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 6px;
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.plan-draw svg { width: 100%; max-height: 33vh; margin: 0 auto; }
.plan-fig figcaption { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.plan-fig figcaption b { color: var(--espresso); }
.eg-dim text { font-family: var(--sans); }
@media (min-width: 1000px) {
  .plan-grid { grid-template-columns: 7fr 5fr; gap: 48px; align-items: start; }
  .plan-fig { top: calc(var(--head) + 20px); margin: 0; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
  .plan-draw svg { max-height: 68vh; }
}

/* the build-up the first time the drawing is seen: footings, frame, boards, then the rest */
@media (prefers-reduced-motion: no-preference) {
  .plan-draw.is-building .eg-stage { animation: eg-rise .6s var(--ease) both; }
  .plan-draw.is-building .eg-s2 { animation-delay: .35s; }
  .plan-draw.is-building .eg-s3 { animation-delay: .7s; }
  .plan-draw.is-building .eg-s4 { animation-delay: 1.05s; }
  .plan-draw.is-building .eg-s5 { animation-delay: 1.45s; }
  .plan-draw.is-building .eg-s6 { animation-delay: 1.75s; }
  .plan-draw.is-building .eg-s7 { animation-delay: 2.05s; }
  .plan-draw .eg-glow { animation: eg-glow 2.6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
  .plan-draw .eg-fan { animation: eg-fan 4s linear infinite; transform-box: fill-box; transform-origin: center; }
}
@keyframes eg-rise { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes eg-glow { from { opacity: .7; } to { opacity: 1; } }
@keyframes eg-fan { to { transform: rotate(360deg) scaleY(1); } }

/* the controls, set out like a job sheet */
.plan-form { margin: 0; }
.plan-form fieldset { border: 0; margin: 0; padding: 10px 0 12px; border-top: 1px solid var(--rule); min-width: 0; }
.plan-form fieldset:first-of-type { border-top: 2px solid var(--espresso); }
.plan-form legend { float: left; width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 0; margin-bottom: 8px; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.plan-form legend + * { clear: both; }
.plan-form legend small { font-size: .78rem; color: var(--muted); font-weight: 800; letter-spacing: .04em; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 12px; border-radius: 999px;
  border: 1.5px solid var(--rule-strong); background: var(--card); font-weight: 600; font-size: .92rem; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:checked + span .swatch { box-shadow: 0 0 0 1.5px var(--yellow); }
.seg input:checked + span:not(:has(.swatch))::before { content: ""; width: 9px; height: 8px; background: var(--yellow); clip-path: polygon(50% 0, 100% 42%, 100% 100%, 0 100%, 0 42%); }
.seg input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
.seg.tiles { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg.tiles label { display: flex; }
.seg.tiles span { flex-direction: column; justify-content: center; gap: 6px; border-radius: 10px; padding: 8px 6px; min-height: 62px; width: 100%; text-align: center; font-size: .88rem; line-height: 1.1; }
.seg.tiles .swatch { width: 100%; height: 12px; }
.seg.tiles input:checked + span::before { display: none; }
.swatch { width: 18px; height: 14px; border-radius: 3px; background: repeating-linear-gradient(180deg, var(--c) 0 6px, rgba(0, 0, 0, .45) 6px 7px); flex: none; }
.swatch.gum { --c: #B98A57; } .swatch.merbau { --c: #8E4429; } .swatch.composite { --c: #8C857C; }

/* sizes: a tape along a board */
.size { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 12px; margin-bottom: 2px; }
.size label { font-weight: 600; font-size: .95rem; }
.size output { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; min-width: 4.2ch; text-align: right; }
.size input[type=range] { grid-column: 1 / -1; width: 100%; height: 44px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.size input[type=range]::-webkit-slider-runnable-track {
  height: 14px; border-radius: 3px; border: 1px solid var(--espresso);
  background: repeating-linear-gradient(90deg, var(--espresso) 0 1px, transparent 1px 10%) 0 0 / 100% 6px no-repeat, linear-gradient(#C9975F, #B07B48);
}
.size input[type=range]::-moz-range-track { height: 14px; border-radius: 3px; border: 1px solid var(--espresso); background: repeating-linear-gradient(90deg, var(--espresso) 0 1px, transparent 1px 10%) 0 0 / 100% 6px no-repeat, linear-gradient(#C9975F, #B07B48); }
.size input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 32px; margin-top: -10px; background: var(--yellow); border: 2px solid var(--ink); clip-path: polygon(50% 0, 100% 34%, 100% 100%, 0 100%, 0 34%); border-radius: 0; }
.size input[type=range]::-moz-range-thumb { width: 24px; height: 30px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 3px; }
.size input[type=range]:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

/* things people forget: ticks, each with the reason in a line */
.forget { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.forget label { display: grid; grid-template-columns: 24px 1fr; gap: 0 8px; align-items: center; min-height: 46px; padding: 8px 10px; border: 1.5px solid var(--rule); border-radius: 10px; background: var(--card); cursor: pointer; transition: border-color .2s, background .2s; }
.forget input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.forget b { font-size: .93rem; line-height: 1.2; }
.tip { margin: 8px 0 0; font-size: .88rem; color: var(--muted); border-left: 3px solid var(--yellow); padding-left: 10px; min-height: 2.6em; }
.forget label:has(input:checked) { border-color: var(--ink); background: #FFFBEA; }
.forget label:has(input:disabled) { opacity: .45; cursor: not-allowed; }

/* the sheet: the job, written up like the top of a quote */
.sheet { margin: 16px 0 14px; background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 14px 16px 6px; }
.sheet h3 { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.sheet ol li { display: grid; grid-template-columns: 1.8rem 1fr auto; gap: 8px; padding: 6px 0; border-top: 1px dashed var(--rule); font-size: .95rem; }
.sheet ol li:first-child { border-top: 0; }
.sheet .n { color: var(--muted); font-weight: 800; font-size: .8rem; padding-top: 2px; }
.sheet .v { font-weight: 800; text-align: right; white-space: nowrap; }
.sheet .note { font-size: .84rem; color: var(--muted); border-top: 1px solid var(--rule); padding: 8px 0 6px; margin: 4px 0 0; }
.plan-send { width: 100%; }
.plan-nojs { font-size: .95rem; color: var(--muted); border-left: 3px solid var(--yellow); padding-left: 12px; }
