:root {
  color-scheme: light;
  --paper: #f7f3e9;
  --card: #fffdf7;
  --ink: #241e19;
  --muted: #65594f;
  --line: #ddd2c0;
  --green: #25483c;
  --green-dark: #18352c;
  --rust: #913b31;
  --pad: clamp(1.125rem, 3vw, 1.75rem);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.5 system-ui, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 3px solid #a4533b; outline-offset: 3px; }
.shell { width: min(71rem, calc(100% - 3rem)); margin-inline: auto; }
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .75rem; min-height: 4rem; color: var(--green); font: 700 1.375rem Georgia, serif; }
.quilt-mark { display: grid; grid-template: repeat(2, 1fr) / repeat(2, 1fr); gap: 2px; width: 1.65rem; height: 1.65rem; }
.quilt-mark i { background: linear-gradient(135deg, #e4ba88 50%, #a75039 50%); }
.quilt-mark i:nth-child(2), .quilt-mark i:nth-child(3) { background: linear-gradient(45deg, #345a4c 50%, #a9bd9f 50%); }
.quilt-mark i:last-child { rotate: 180deg; }
.intro { padding-block: clamp(1.75rem, 5.2vw, 3.9rem) clamp(1.5rem, 4vw, 2.25rem); }
h1, h2, h3 { font-family: Georgia, serif; line-height: 1.12; margin: 0; }
h1 { font-size: clamp(2.25rem, 6vw, 4.1rem); letter-spacing: -.052em; }
h2 { font-size: 1.65rem; letter-spacing: -.026em; }
h3 { font-size: 1.2rem; }
p { margin: 0; }
.intro p { color: var(--muted); max-width: 42rem; margin-top: .85rem; }
.workbench { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.16fr); gap: clamp(1rem, 2.4vw, 1.6rem); align-items: start; padding-bottom: 3rem; }
.card { min-width: 0; padding: var(--pad); background: var(--card); border: 1px solid var(--line); border-radius: 1rem; }
.form-hint, .small-note, #plan-empty { color: var(--muted); font-size: .875rem; }
.form-hint { margin-block: .65rem 1.2rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.fields label { display: grid; align-content: end; gap: .35rem; font-size: .875rem; font-weight: 650; min-width: 0; }
.measure { position: relative; display: block; }
.measure span { position: absolute; inset: 0 .75rem 0 auto; display: grid; align-items: center; pointer-events: none; color: var(--muted); font-weight: 450; }
input, select { width: 100%; min-height: 2.75rem; padding: .45rem .7rem; background: #fffefa; border: 1px solid #bfb4a4; border-radius: .45rem; font-size: 1rem; font-weight: 450; }
input { padding-right: 2rem; }
input[aria-invalid="true"] { border: 2px solid var(--rust); }
form .small-note { margin-top: .5rem; }
.settings { margin-top: 1rem; }
.wide-field { grid-column: 1 / -1; }
.form-error { color: var(--rust); font-size: .9rem; margin-top: .85rem; }
.primary, .secondary { min-height: 2.75rem; border-radius: .45rem; padding: .5rem .8rem; font-weight: 650; }
.primary { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 1.1rem; background: var(--green); border: 1px solid var(--green); color: #fffdf7; }
.primary:hover { background: var(--green-dark); }
.secondary { background: var(--card); border: 1px solid #a99c89; color: var(--green); font-size: .875rem; }
.secondary:hover { background: #f0eadc; }
.secondary:disabled { opacity: .55; cursor: default; }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1rem; }
.purchase { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: .75rem 1rem; padding: .95rem 1.1rem; background: #e8eee2; border-radius: .65rem; color: var(--green-dark); }
.purchase-label { display: block; font-size: .875rem; font-weight: 650; }
.yardage { display: block; font: 700 clamp(2.15rem, 5vw, 3.2rem)/1.12 Georgia, serif; overflow-wrap: anywhere; }
.purchase p { max-width: 15rem; font-size: .85rem; padding-bottom: .2rem; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: .2rem 0 0; font-size: .94rem; font-weight: 680; overflow-wrap: anywhere; }
.plan-details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7rem, .69fr); gap: 1rem; padding-top: 1.2rem; border-top: 1px solid var(--line); align-items: start; }
table { width: 100%; margin: .55rem 0; border-collapse: collapse; text-align: left; font-size: .85rem; }
th, td { border-bottom: 1px solid var(--line); padding: .4rem .25rem .4rem 0; }
th { font-weight: 650; color: var(--muted); }
td { font-weight: 650; font-variant-numeric: tabular-nums; }
figure { margin: 0; text-align: center; }
.diagram { display: flex; min-height: 4rem; max-height: 11rem; width: min(100%, var(--diagram-width, 100%)); margin-inline: auto; overflow: hidden; border: 1px solid #7e6451; border-radius: .2rem; background: #f5e8d3; }
.diagram.horizontal { flex-direction: column; }
.panel { flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; color: #39281e; font-size: clamp(.7rem, 1.8vw, 1.25rem); font-weight: 800; background-color: #e7cbaa; background-image: repeating-linear-gradient(135deg, transparent 0 7px, #9b6d4229 7px 8px, transparent 8px 12px); }
.panel:nth-child(even) { background-color: #d9e3d1; }
.diagram.vertical .panel + .panel { border-left: 2px dashed #624834; }
.diagram.horizontal .panel + .panel { border-top: 2px dashed #624834; }
figcaption, .scope-note { margin-top: .45rem; font-size: .82rem; color: var(--muted); }
.scope-note { border-top: 1px solid var(--line); padding-top: .7rem; margin-top: .9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 49rem) {
  .workbench { grid-template-columns: 1fr; }
}
@media (max-width: 26rem) {
  .shell { width: calc(100% - 1.5rem); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-details { grid-template-columns: 1fr; }
  figure { max-width: 13rem; }
}
@page { margin: 16mm; }
@media print {
  body { background: white; color: black; font-size: 11pt; }
  .site-header, .input-card, .intro p, #print-plan { display: none; }
  .shell { width: 100%; }
  .intro { padding: 0 0 1rem; }
  h1 { font-size: 24pt; }
  .workbench { display: block; padding: 0; }
  .result-card { padding: 0; border: 0; background: white; }
  .purchase { border: 1px solid #888; background: white; color: black; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .plan-details { grid-template-columns: 1.5fr 1fr; break-inside: avoid; }
  .panel { background: white; }
}
