:root {
  color-scheme: light;
  --ink: #182433;
  --muted: #495b70;
  --blue: #0655d8;
  --brand-blue: #065df1;
  --pale: #edf3ff;
  --line: #ccd6e3;
  --input-edge: #7c8ca0;
  --error: #a32d24;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: white;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-size: 1.125rem; line-height: 1.5; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: rgba(6, 93, 241, .14); }
::selection { color: #fff; background: #094cbe; }
:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 4px; }
main:focus { outline: none; }
.shell { width: min(70rem, calc(100% - 4rem)); margin-inline: auto; }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: absolute; z-index: 2; inset: .75rem auto auto 1rem; padding: .6rem 1rem; color: white; background: var(--blue); }

.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; justify-content: space-between; align-items: center; gap: 2rem; min-height: 4.5rem; padding-block: .65rem; }
.brand { display: block; width: 11.875rem; height: auto; max-width: 100%; }
.guide-link { display: inline-flex; align-items: center; gap: .6rem; min-height: 2.75rem; color: var(--blue); font-size: 1rem; font-weight: 650; text-underline-offset: .24em; text-decoration-thickness: 1px; }
.guide-link:hover { color: #073580; text-decoration-thickness: 2px; }
.link-arrow { position: relative; flex: none; width: .7rem; height: .7rem; border-top: 1.5px solid; border-right: 1.5px solid; }
.link-arrow::before { content: ""; position: absolute; top: 0; right: 0; width: .9rem; border-top: 1.5px solid; transform: rotate(-45deg); transform-origin: right top; }

.intro { background: var(--pale); border-bottom: 1px solid #d9e4f7; }
.intro-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; align-items: center; padding-block: 2.5rem; }
h1 { font-size: 3.5rem; font-weight: 720; line-height: 1.02; letter-spacing: -.04em; }
.intro-copy p { margin-top: 1rem; max-width: 39rem; color: #364c69; }
.view-estimate { display: none; }
.drawing {
  position: relative;
  width: 16rem;
  height: 10.5rem;
  margin-inline-end: 2rem;
  color: #315784;
  font-size: 1rem;
  line-height: 1;
  --frame: #345273;
}
.window-frame { position: absolute; inset: 1.75rem 2.85rem 0 .4rem; border: 1px solid var(--frame); padding: .4rem; background: #dce7f6; }
.window-glass {
  width: 100%;
  height: 100%;
  border: 1px solid var(--frame);
  background-color: #d6e8ff;
  background-image: linear-gradient(125deg, transparent 33%, #eef6ff 33% 38%, transparent 38% 42%, #eef6ff 42% 44%, transparent 44%);
}
.dimension-width, .dimension-height { position: absolute; display: grid; place-items: center; }
.dimension-width { top: .45rem; left: .86rem; right: 3.31rem; height: .7rem; border-inline: 1px solid; }
.dimension-height { top: 2.21rem; bottom: .46rem; right: 1.15rem; width: .7rem; border-block: 1px solid; }
.dimension-width::before, .dimension-height::before { content: ""; position: absolute; }
.dimension-width::before { inset-inline: 0; top: 50%; border-top: 1px solid; }
.dimension-height::before { inset-block: 0; left: 50%; border-left: 1px solid; }
.dimension-width span, .dimension-height span { z-index: 1; background: var(--pale); }
.dimension-width span { padding-inline: .5rem; }
.dimension-height span { position: absolute; padding: 0 .45rem; transform: rotate(-90deg); }

.worksheet { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(17rem, .95fr); align-items: start; gap: 4.25rem; padding-block: 2.75rem 4rem; }
.entry { min-width: 0; }
h2 { font-size: 1.65rem; line-height: 1.22; font-weight: 700; letter-spacing: -.025em; }
.section-help { color: var(--muted); margin-top: .45rem; max-width: 57ch; }
.pane-group { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.group-heading { min-height: 2.75rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: .45rem; }
h3 { font-size: 1.125rem; font-weight: 700; line-height: 1.3; }
.remove-button { padding: .5rem .25rem; min-height: 2.75rem; border: 0; background: transparent; color: var(--blue); font-size: 1rem; text-decoration: underline; text-underline-offset: .24em; }
.remove-button:hover { color: var(--error); }
.dimensions, .cost-fields { display: grid; align-items: start; gap: .9rem; }
.dimensions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(5.5rem, .65fr); }
.field { min-width: 0; }
.field label { display: block; margin-bottom: .4rem; font-size: 1rem; font-weight: 640; }
.control { display: flex; align-items: center; min-height: 3rem; border: 1px solid var(--input-edge); border-radius: .3rem; background: white; }
.control:focus-within { outline: 2px solid var(--brand-blue); outline-offset: 2px; border-color: var(--brand-blue); }
.control:has([aria-invalid="true"]) { border-color: var(--error); }
.control input { width: 100%; min-width: 0; min-height: 2.9rem; padding: .5rem .7rem; border: 0; outline: 0; background: transparent; color: var(--ink); caret-color: var(--blue); font-variant-numeric: tabular-nums; }
.control span { flex: none; padding-right: .7rem; font-size: 1rem; color: var(--muted); }
.field-error { margin-top: .45rem; font-size: 1rem; line-height: 1.4; color: var(--error); }
.add-button { display: inline-flex; gap: .65rem; align-items: center; min-height: 2.75rem; margin-top: 1.1rem; padding: .5rem .95rem; border: 1px solid var(--blue); border-radius: .3rem; background: white; color: var(--blue); font-size: 1rem; font-weight: 650; }
.add-button:hover { background: var(--pale); }
.add-button:active { color: white; background: var(--blue); }
.plus { position: relative; width: .8rem; height: .8rem; }
.plus::before, .plus::after { content: ""; position: absolute; background: currentColor; }
.plus::before { inset: calc(50% - 1px) 0 auto; height: 2px; }
.plus::after { inset: 0 auto 0 calc(50% - 1px); width: 2px; }
.cost-section { margin-top: 2rem; padding-top: 1.55rem; border-top: 1px solid var(--line); }
.cost-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.1rem; }
.optional, .field-note { color: var(--muted); font-weight: 400; }
.field-note { margin-top: .65rem; font-size: 1rem; }

.estimate { position: sticky; top: 1.5rem; padding: 1.75rem; background: #11345e; border-radius: .7rem; color: white; }
.estimate h2 { color: #dbeaff; font-size: 1.125rem; letter-spacing: 0; font-weight: 600; }
.total { margin-top: .35rem; font-size: 3.25rem; line-height: 1.1; letter-spacing: -.035em; font-weight: 700; overflow-wrap: anywhere; }
.total, .breakdown dd { font-variant-numeric: tabular-nums; }
.breakdown { margin-top: 1.45rem; border-top: 1px solid #6b86a8; }
.breakdown div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: .55rem; }
.breakdown div:first-child, .breakdown .cost-line { padding-top: .65rem; }
.breakdown .cost-line { border-top: 1px solid #5d799b; margin-top: 1rem; }
.breakdown dt { color: #deebfc; }
.breakdown dd { font-weight: 650; text-align: end; min-width: 0; overflow-wrap: anywhere; }
.estimate-note { margin-top: 1.25rem; color: #dbeaff; font-size: 1rem; line-height: 1.5; }
.no-script { padding-block: 2rem; }

@media (max-width: 57rem) {
  .worksheet { gap: 2rem; grid-template-columns: minmax(0, 1.35fr) minmax(16rem, .9fr); }
  .estimate { padding: 1.3rem; }
  .drawing { margin-inline-end: 0; }
}
@media (max-width: 47rem) {
  .shell { width: min(38rem, calc(100% - 2.5rem)); }
  .masthead-inner { gap: 1rem; }
  .brand { width: 9.75rem; }
  .guide-link { font-weight: 600; }
  .intro-inner { grid-template-columns: 1fr; gap: 0; padding-block: 1.85rem; }
  h1 { font-size: 2.65rem; }
  .drawing { display: none; }
  .view-estimate { display: inline-flex; align-items: center; min-height: 2.75rem; margin-top: .35rem; color: var(--blue); font-size: 1rem; font-weight: 650; text-underline-offset: .24em; }
  #estimate-heading:focus-visible { outline-color: white; }
  .worksheet { grid-template-columns: 1fr; gap: 1.75rem; padding-block: 1.85rem 2.5rem; }
  .estimate { position: static; padding: 1.5rem; }
  .cost-section { margin-top: 1.65rem; }
}
@media (max-width: 28rem) {
  .masthead-inner { flex-wrap: wrap; gap: 0 1rem; }
  .brand { width: 8.875rem; }
  .guide-link { margin-left: auto; }
  .dimensions, .cost-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
  .cost-fields .optional { display: block; }
  .cost-fields { align-items: end; }
  .total { font-size: 2.75rem; }
}
@media (max-width: 23rem) {
  .masthead-inner { gap: .3rem 1rem; padding-block: .8rem .4rem; }
  .guide-link { margin-left: 0; }
  .cost-fields { grid-template-columns: 1fr; }
  .cost-fields .optional { display: inline; }
}
