/* Layout: the page is a plan sheet lying on a desk. One elevation, drawn to scale, carries the
   top of it; a title block states the terms; the work is listed as a schedule; the request form
   is a second sheet laid on the first. Blue is the new work, as on a drawing; grey is the house. */
:root {
  --paper: #e9edec; /* the desk, and the room in the drawing */
  --sheet: #fafbfa; /* white melamine */
  --ink: #17212b;
  --ink-2: #4a5a66;
  --line: #c3ccd0;
  --dot: #d3dadc;
  --chalk: #1d4ed8; /* chalk-line blue: the new work, and the one thing to press */
  --chalk-ink: #ffffff;
  --chalk-wash: #e3eafb;
  --mark: #b42318; /* the red pencil: mistakes only */

  --display: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --step-2: clamp(1.625rem, 1.2rem + 1.7vw, 2.5rem);
  --step-3: clamp(2.125rem, 1.1rem + 4.4vw, 4.25rem);

  --pad: clamp(1rem, 0.2rem + 3.4vw, 3rem);
  --section: clamp(3rem, 1.8rem + 5vw, 6rem);
  --fast: 150ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d151d;
    --sheet: #15202b;
    --ink: #e6ecef;
    --ink-2: #9fb0bc;
    --line: #2f4050;
    --dot: #1b2835;
    --chalk: #8cb0ff;
    --chalk-ink: #0b1420;
    --chalk-wash: #1b2c4a;
    --mark: #ff8a7a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0d151d;
  --sheet: #15202b;
  --ink: #e6ecef;
  --ink-2: #9fb0bc;
  --line: #2f4050;
  --dot: #1b2835;
  --chalk: #8cb0ff;
  --chalk-ink: #0b1420;
  --chalk-wash: #1b2c4a;
  --mark: #ff8a7a;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 400 var(--step-0) / 1.55 var(--body);
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--display);
  text-wrap: balance;
}

a {
  color: var(--chalk);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 2px solid var(--chalk);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--sheet);
  font: 500 var(--step--1) / 1 var(--mono);
  transition: top var(--fast) var(--ease);
}

.skip:focus {
  top: calc(env(safe-area-inset-top, 0px) + 0.5rem);
}

/* --- the sheet --------------------------------------------------------------------------- */
.wrap {
  max-width: 78rem;
  margin-inline: auto;
  padding-block: clamp(0.75rem, 2.4vw, 2rem);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.sheet {
  background: var(--sheet);
  border: 1.5px solid var(--ink);
}

.top,
.hero,
.work,
.steps-section,
.request,
.foot {
  padding-inline: var(--pad);
}

.eyebrow,
.titleblock dt,
.drawing figcaption,
.nav a,
.optional,
.hint,
.fineprint,
.copy,
.copy-status,
.status {
  font-family: var(--mono);
}

.eyebrow {
  color: var(--ink-2);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --- header ------------------------------------------------------------------------------ */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--ink);
}

.wordmark,
.foot-name {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4em;
  color: var(--ink);
  font-family: var(--display);
  font-size: var(--step-1);
  line-height: 1;
  text-decoration: none;
}

.wm-meg {
  font-stretch: 125%;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.wm-res {
  font-stretch: 100%;
  font-weight: 450;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
}

.nav a {
  color: var(--ink);
  font-size: var(--step--1);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}

.nav a:hover {
  color: var(--chalk);
  text-decoration: underline;
}

.nav .nav-cta {
  padding: 0.5rem 0.8rem;
  border: 1.5px solid var(--ink);
  transition:
    background-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.nav .nav-cta:hover {
  background: var(--ink);
  color: var(--sheet);
  text-decoration: none;
}

/* --- hero -------------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding-block: clamp(2rem, 1rem + 5vw, 4.5rem);
}

.hero-copy {
  display: grid;
  gap: 1.25rem;
  min-width: 0;
}

.hero h1 {
  font-size: var(--step-3);
  font-stretch: 112%;
  font-weight: 780;
  letter-spacing: -0.022em;
  line-height: 1;
}

.lead {
  max-width: 34rem;
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.5rem;
  margin-top: 0.5rem;
}

.tel {
  color: var(--ink-2);
}

.num {
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 500;
  text-decoration-color: var(--ink-2);
  text-decoration-thickness: 1px;
  white-space: nowrap;
}

.num:hover {
  color: var(--chalk);
  text-decoration-color: currentColor;
}

.btn {
  display: inline-block;
  padding: 0.95rem 1.35rem;
  border: 0;
  background: var(--chalk);
  box-shadow: 0 0 0 var(--ink);
  color: var(--chalk-ink);
  cursor: pointer;
  font: 700 var(--step-0) / 1 var(--display);
  font-stretch: 108%;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition:
    transform var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

.btn:hover {
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.btn:active {
  box-shadow: 0 0 0 var(--ink);
  transform: none;
}

/* While a request is being sent the button stays in the tab order, so the keyboard keeps its
   place, and says it is busy. */
.btn[aria-disabled="true"],
.btn[aria-disabled="true"]:hover {
  box-shadow: none;
  cursor: progress;
  opacity: 0.65;
  transform: none;
}

/* The second thing to press is drawn in outline, so the blue one stays first. */
.btn-line {
  padding: calc(0.95rem - 1.5px) calc(1.35rem - 1.5px);
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

/* A link that leaves for another site in a new tab carries a small arrow, and says so. */
.away {
  width: 0.68em;
  height: 0.68em;
  margin-left: 0.45em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-width: 1.7;
}

.unseen {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.drawing {
  min-width: 0;
}

.elevation {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.drawing figcaption {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dw-room {
  fill: var(--paper);
  stroke: var(--ink-2);
  stroke-width: 1.2;
}

.dw-floor {
  stroke: var(--ink);
  stroke-width: 2.2;
}

/* what is already there, or the owner supplies: the window, the refrigerator, the range */
.dw-given {
  fill: var(--sheet);
  stroke: var(--ink-2);
  stroke-width: 1;
}

.dw-top {
  fill: var(--chalk-wash);
  stroke: var(--chalk);
  stroke-width: 1.1;
}

.dw-new {
  fill: var(--sheet);
  stroke: var(--chalk);
  stroke-width: 1.1;
}

.dw-rod {
  stroke: var(--chalk);
  stroke-linecap: round;
  stroke-width: 2.2;
}

.dw-pull {
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-width: 1.7;
}

.dw-ghost {
  fill: none;
  stroke: var(--ink-2);
  stroke-dasharray: 3 3;
  stroke-width: 0.7;
}

.dw-dimline,
.dw-ext {
  stroke: var(--ink-2);
  stroke-width: 0.7;
}

.dw-tick {
  stroke: var(--ink);
  stroke-width: 1.3;
}

.dw-dim {
  fill: var(--ink);
  font: 500 10.5px var(--mono);
}

.dw-label {
  fill: var(--ink-2);
  font: 500 9px var(--mono);
  letter-spacing: 0.08em;
}

/* --- title block ------------------------------------------------------------------------- */
.titleblock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1.5px solid var(--ink);
}

.titleblock > div {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-width: 0;
  padding: 1rem var(--pad) 1.15rem;
}

.titleblock > div + div {
  border-left: 1px solid var(--ink);
  padding-left: clamp(0.9rem, 1.6vw, 1.5rem);
}

.titleblock dt {
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.titleblock dd {
  font-weight: 560;
  line-height: 1.3;
}

/* --- sections ---------------------------------------------------------------------------- */
.work,
.steps-section,
.request {
  padding-block: var(--section);
}

.section-head {
  display: grid;
  gap: 0.5rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

h2 {
  font-size: var(--step-2);
  font-stretch: 112%;
  font-weight: 760;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

h3 {
  font-size: var(--step-1);
  font-stretch: 104%;
  font-weight: 680;
  line-height: 1.2;
}

/* the schedule: a mark, the work, what is in it — the way a plan set lists doors or finishes */
.schedule li {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 17rem) minmax(0, 1fr);
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding-block: 1.05rem;
  border-top: 1px solid var(--line);
}

.schedule li:last-child {
  border-bottom: 1px solid var(--line);
}

.schedule p {
  max-width: 38rem;
  color: var(--ink-2);
}

.mark {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1.5px solid var(--chalk);
  border-radius: 50%;
  color: var(--chalk);
  font: 500 var(--step--1) / 1 var(--mono);
}

.aside {
  max-width: 38rem;
  margin-top: 1.5rem;
  color: var(--ink-2);
}

/* the steps: a real sequence, so they are numbered, strung on one dimension line */
.steps-section {
  background: var(--paper);
  border-block: 1px solid var(--ink);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem clamp(1rem, 2.4vw, 2.5rem);
  counter-reset: step;
}

.steps li {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.5rem;
  min-width: 0;
  padding-top: 1.4rem;
  border-top: 1.5px solid var(--chalk);
  counter-increment: step;
}

.steps li::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 0;
  width: 1.5px;
  height: 13px;
  background: var(--chalk);
  transform: rotate(45deg);
  transform-origin: center;
}

.steps h3::before {
  content: counter(step);
  display: block;
  margin-bottom: 0.35rem;
  color: var(--chalk);
  font: 800 clamp(2rem, 1.4rem + 2vw, 3rem) / 1 var(--display);
  font-stretch: 125%;
}

.steps p {
  color: var(--ink-2);
}

/* --- the request ------------------------------------------------------------------------- */
.request {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: start;
  gap: clamp(1.75rem, 4vw, 4rem);
}

.request-copy {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.request-copy > p {
  max-width: 30rem;
}

.side-drawing {
  max-width: 24rem;
  margin-top: 1rem;
}

/* The other two ways to start, ruled like rows of a schedule. */
.reach {
  max-width: 30rem;
  border-top: 1px solid var(--line);
}

.reach li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.reach-link {
  font-weight: 600;
}

.copy {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--ink-2);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.75rem;
  transition:
    background-color var(--fast) var(--ease),
    color var(--fast) var(--ease);
}

.copy:hover {
  background: var(--ink);
  color: var(--sheet);
}

.copy-status {
  color: var(--ink-2);
  font-size: 0.75rem;
}

.fineprint {
  color: var(--ink-2);
  font-size: 0.75rem;
  line-height: 1.5;
}

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 1.25rem;
  min-width: 0;
  padding: clamp(1.1rem, 2.6vw, 2rem);
  border: 1.5px solid var(--ink);
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--line);
}

.field {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
}

.field.wide {
  grid-column: 1 / -1;
}

.field label {
  font-weight: 620;
}

.optional {
  margin-left: 0.35rem;
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 1.5px solid var(--ink-2);
  border-radius: 0;
  background: var(--sheet);
  color: var(--ink);
  font: inherit;
  transition:
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

.field textarea {
  min-height: 8rem;
  resize: vertical;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: var(--ink);
}

.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  border-color: var(--chalk);
  box-shadow: 4px 4px 0 var(--chalk-wash);
  outline: 2px solid var(--chalk);
  outline-offset: 0;
}

.field [aria-invalid="true"] {
  border-color: var(--mark);
}

.hint {
  color: var(--ink-2);
  font-size: 0.75rem;
}

.error {
  color: var(--mark);
  font-size: var(--step--1);
  font-weight: 560;
}

/* a field people never see: anything typed in it marks the request as not from a person */
.trap {
  position: absolute;
  left: -200vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.submit-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.status {
  min-width: 0;
  font-size: var(--step--1);
}

.status[data-kind="error"] {
  color: var(--mark);
}

.status .num {
  color: inherit;
  text-decoration-color: currentColor;
}

.done {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.6rem;
}

.done h3 {
  font-size: var(--step-2);
}

/* --- footer ------------------------------------------------------------------------------ */
.foot {
  display: grid;
  gap: 0.6rem;
  padding-block: 1.75rem 2rem;
  border-top: 1.5px solid var(--ink);
}

.foot .fineprint {
  max-width: 44rem;
}

/* --- narrower sheets --------------------------------------------------------------------- */
@media (max-width: 62rem) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .titleblock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .titleblock > div:nth-child(3) {
    border-left: 0;
    padding-left: var(--pad);
  }

  .titleblock > div:nth-child(n + 3) {
    border-top: 1px solid var(--ink);
  }
}

@media (max-width: 54rem) {
  .hero,
  .request {
    grid-template-columns: minmax(0, 1fr);
  }

  .drawing {
    max-width: 30rem;
  }

  .side-drawing {
    display: none; /* on a phone the form comes straight after the words */
  }

  .schedule li {
    grid-template-columns: 2.75rem minmax(0, 1fr);
  }

  .schedule p {
    grid-column: 2;
  }
}

@media (max-width: 34rem) {
  .nav a:not(.nav-cta) {
    display: none;
  }

  .titleblock,
  .steps,
  .form {
    grid-template-columns: minmax(0, 1fr);
  }

  .titleblock > div + div {
    border-left: 0;
    border-top: 1px solid var(--ink);
    padding-left: var(--pad);
  }

  .form {
    box-shadow: 5px 5px 0 var(--line);
  }

  .submit-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }

  .btn:hover {
    transform: none;
  }
}
