/* DiMarzio General Contracting — site styles
   Direction A, "Drawing set": the site reads like a set of construction drawings.
   Palette: Cyanotype, Deep cyanotype, Vellum, Pencil, Redline, Lamplight.
   Redline is reserved for calls to action. The self-drawing house is the one bold element. */

/* ---------- Fonts (self-hosted, SIL OFL 1.1) ---------- */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../assets/fonts/bricolage-grotesque-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --cyan: #17357a;
  --cyan-deep: #0f2660;
  --vellum: #f4f6f9;
  --pencil: #23262b;
  --red: #d1342a;
  --red-dark: #b02a21;
  --lamp: #ffd27a;

  --trace: #dfe8ff;      /* light text and lines on cyanotype */
  --trace-dim: #b9c8ea;  /* labels on cyanotype */
  --muted: #4a505a;      /* secondary text on vellum */
  --rule: #c9d1de;
  --ph-bg: #e6eaf1;

  --sans: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --grid: 24px;
  --gutter: 1.25rem;
  --max: 76rem;
}

@media (min-width: 48rem) {
  :root {
    --gutter: 2.5rem;
  }
}

/* ---------- Base ---------- */

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--vellum);
  color: var(--pencil);
  font-family: var(--sans);
  font-optical-sizing: auto;
  font-size: 1.125rem;
  line-height: 1.6;
}

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

h1,
h2,
h3 {
  font-weight: 800;
  font-stretch: 88%;
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 4.5rem);
}

h2 {
  font-size: clamp(1.875rem, 4vw, 2.75rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

p,
ul,
ol,
dl,
address {
  margin: 0 0 1em;
}

address {
  font-style: normal;
}

a {
  color: var(--cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.on-dark :focus-visible {
  outline-color: var(--lamp);
}

.on-dark a {
  color: var(--vellum);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--lamp);
  color: var(--pencil);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure {
  max-width: 40rem;
}

.lead {
  font-size: 1.3rem;
  line-height: 1.5;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
}

.tel {
  font-variant-numeric: tabular-nums;
}

/* Drawing-sheet background: cyanotype with a faint 24px grid.
   Header heights are multiples of the grid so the lines meet at the seam. */
.blueprint {
  background-color: var(--cyan);
  background-image:
    linear-gradient(rgba(223, 232, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(223, 232, 255, 0.07) 1px, transparent 1px);
  background-size: var(--grid) var(--grid);
  color: var(--vellum);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.7rem 1.3rem;
  border: 2px solid transparent;
  border-radius: 0;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.btn--red,
.on-dark .btn--red {
  background: var(--red);
  color: #fff;
}

.btn--red:hover {
  background: var(--red-dark);
}

@media (prefers-reduced-motion: no-preference) {
  .btn {
    transition: background-color 0.15s ease;
  }
}

.call-link {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid rgba(223, 232, 255, 0.25);
}

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1rem;
}

.header-bar > .brand,
.header-bar > .header-actions {
  height: calc(var(--grid) * 3);
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--vellum);
  font-size: 1.25rem;
  font-weight: 800;
  font-stretch: 85%;
  line-height: 1.05;
  text-decoration: none;
}

.on-dark .brand {
  color: var(--vellum);
}

.brand__sub {
  font-size: 0.8rem;
  font-weight: 400;
  font-stretch: 100%;
  color: var(--trace-dim);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.header-phone {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(223, 232, 255, 0.55);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.on-dark .header-phone {
  color: var(--vellum);
}

.header-phone:hover {
  border-color: var(--vellum);
}

.header-phone__full {
  display: none;
}

.header-cta {
  display: none;
}

.nav-toggle {
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid rgba(223, 232, 255, 0.55);
  background: transparent;
  color: var(--vellum);
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: var(--vellum);
}

.site-nav {
  order: 3;
  width: 100%;
}

.js .site-nav {
  display: none;
}

.js .site-nav.is-open {
  display: block;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.75rem;
  border-top: 1px solid rgba(223, 232, 255, 0.25);
}

.site-nav a {
  display: block;
  padding: 0.7rem 0;
  font-weight: 550;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--lamp);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}

@media (min-width: 40rem) {
  .header-phone__short {
    display: none;
  }

  .header-phone__full {
    display: inline;
  }
}

@media (min-width: 64rem) {
  .header-bar {
    flex-wrap: nowrap;
    gap: 2rem;
  }

  .header-bar > .brand,
  .header-bar > .header-actions {
    height: calc(var(--grid) * 4);
  }

  .site-nav,
  .js .site-nav {
    display: block;
    order: 0;
    width: auto;
    margin-left: auto;
  }

  .site-nav ul {
    display: flex;
    gap: 1.75rem;
    padding: 0;
    border-top: 0;
  }

  .header-actions {
    margin-left: 0;
  }

  .header-cta {
    display: inline-flex;
  }

  .nav-toggle {
    display: none;
  }
}

/* ---------- Photo placeholders ----------
   Stand-ins until approved, metadata-stripped photos exist in assets/img/.
   Swap each for an <img> with width, height, alt, and loading="lazy" below the fold. */

.ph {
  display: grid;
  place-items: center;
  aspect-ratio: var(--ratio, 4 / 3);
  width: 100%;
  background-color: var(--ph-bg);
  background-image: repeating-linear-gradient(
    135deg,
    rgba(23, 53, 122, 0.08) 0 1px,
    transparent 1px 12px
  );
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.ph--wide {
  --ratio: 16 / 9;
}

.ph--tall {
  --ratio: 4 / 5;
}

figure {
  margin: 0;
}

figcaption {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* ---------- Title block (drawing-sheet info strip) ---------- */

.titleblock {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 0;
  border-top: 1px solid rgba(223, 232, 255, 0.35);
}

.titleblock > div {
  padding: 0.85rem var(--gutter) 0.95rem;
  border-bottom: 1px solid rgba(223, 232, 255, 0.2);
}

.titleblock > div:nth-child(odd) {
  border-right: 1px solid rgba(223, 232, 255, 0.35);
}

.titleblock dt,
.tb-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--trace-dim);
}

.titleblock dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

.titleblock .tb-wide {
  grid-column: 1 / -1;
  border-right: 0;
}

@media (min-width: 56rem) {
  .titleblock {
    grid-template-columns: 2fr repeat(3, 1fr);
  }

  .titleblock > div,
  .titleblock > div:nth-child(odd) {
    border-bottom: 0;
    border-right: 1px solid rgba(223, 232, 255, 0.35);
  }

  .titleblock > div:last-child {
    border-right: 0;
  }

  .titleblock .tb-wide {
    grid-column: auto;
  }
}

/* ---------- Homepage: hero ---------- */

.hero__grid {
  display: grid;
  gap: 1.5rem;
  padding-top: calc(var(--grid) * 2);
}

.hero h1 {
  margin-bottom: 0.45em;
  font-size: clamp(3.25rem, 10vw, 6.5rem);
  line-height: 0.92;
}

.hero h1 span {
  display: block;
}

.hero h1 span:last-child {
  color: var(--lamp);
}

.hero__tagline {
  max-width: 30ch;
  font-size: 1.3rem;
  line-height: 1.45;
}

.hero__scope {
  max-width: 36ch;
  color: var(--trace);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 1.75rem 0 0;
}

.hero__drawing {
  align-self: end;
  margin-inline: -0.5rem;
}

.hero {
  padding-bottom: calc(var(--grid) * 2);
}

@media (min-width: 56rem) {
  .hero__grid {
    grid-template-columns: 1fr 1.2fr;
    align-items: end;
    gap: 2rem;
    padding-top: calc(var(--grid) * 3);
  }

  .hero__text {
    padding-bottom: calc(var(--grid) * 2);
  }
}

/* ---------- Homepage: stages (the self-drawing house) ----------
   Default (no JavaScript, small screens, reduced motion): three blue frames, each with its
   own drawing. With .is-scrolly (set by main.js on wide screens when motion is allowed):
   one sticky drawing that changes stage as each step scrolls into the middle of the screen. */

.stages {
  padding-block: 4.5rem 4rem;
}

.stages__intro {
  margin-bottom: 2.5rem;
}

.stages__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.stage {
  padding: 0.9rem 0.9rem 1.5rem;
}

.stage:last-child {
  background-color: var(--cyan-deep);
}

.stage__frame {
  margin-bottom: 1rem;
}

.stage__count {
  margin: 0 0.4rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--trace-dim);
}

.stage__word {
  margin: 0 0.4rem 0.35em;
  font-size: clamp(2rem, 5vw, 2.75rem);
}

.stage p:last-child {
  margin: 0 0.4rem;
  color: var(--trace);
}

.stages__sticky {
  display: none;
}

.stages__end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 2.5rem;
}

.stages__end p {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

@media (min-width: 56rem) {
  .stages__list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 64rem) {
  .stages.is-scrolly .stages__layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: start;
  }

  .stages.is-scrolly .stages__sticky {
    display: block;
    position: sticky;
    top: 10vh;
    height: 80vh;
    max-height: 40rem;
  }

  .stages__sticky img {
    position: absolute;
    inset: 0;
    margin: auto;
    width: calc(100% - 3rem);
    height: auto;
    opacity: 0;
    transition: opacity 0.5s ease;
  }

  .stages__sticky[data-active="0"] img[data-stage="0"],
  .stages__sticky[data-active="1"] img[data-stage="1"],
  .stages__sticky[data-active="2"] img[data-stage="2"] {
    opacity: 1;
  }

  .stages__sticky[data-active="2"] {
    background-color: var(--cyan-deep);
  }

  .stages.is-scrolly .stages__list {
    display: block;
  }

  .stages.is-scrolly .stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70vh;
    padding: 0 0 0 1.5rem;
    border-left: 3px solid var(--rule);
    background: none;
    color: var(--pencil);
    opacity: 0.4;
    transition: opacity 0.4s ease, border-color 0.4s ease;
  }

  .stages.is-scrolly .stage.is-active {
    border-left-color: var(--red);
    opacity: 1;
  }

  .stages.is-scrolly .stage__frame {
    display: none;
  }

  .stages.is-scrolly .stage__count {
    color: var(--muted);
    margin-inline: 0;
  }

  .stages.is-scrolly .stage__word {
    margin-inline: 0;
    font-size: clamp(3rem, 6vw, 4.75rem);
  }

  .stages.is-scrolly .stage p:last-child {
    margin-inline: 0;
    color: var(--pencil);
    max-width: 28rem;
  }
}

/* ---------- Homepage: recent work ---------- */

.recent {
  padding-block: 1rem 4.5rem;
}

.recent__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 2.5rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--rule);
}

.recent__head h2 {
  margin: 0;
}

.recent__grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 48rem) {
  .recent__grid {
    grid-template-columns: 1.6fr 1fr;
  }

  .recent__grid figure:first-child {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
  }

  .recent__grid figure:first-child .ph {
    flex: 1;
    aspect-ratio: auto;
  }
}

.more-link {
  font-weight: 650;
}

/* ---------- Interior pages ---------- */

.sheet-head {
  padding-block: calc(var(--grid) * 2) calc(var(--grid) * 2);
}

.sheet-head__grid {
  display: grid;
  gap: 1.5rem;
}

.sheet-head h1 {
  margin-bottom: 0.4em;
}

.sheet-head .lead {
  color: var(--trace);
  margin-bottom: 0;
}

.sheet-no {
  justify-self: start;
  align-self: end;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(223, 232, 255, 0.45);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--trace-dim);
  white-space: nowrap;
}

.sheet-no b {
  display: block;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--vellum);
}

@media (min-width: 56rem) {
  .sheet-head {
    padding-block: calc(var(--grid) * 3) calc(var(--grid) * 2);
  }

  .sheet-head__grid {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .sheet-no {
    justify-self: end;
  }
}

.section {
  padding-block: 3rem;
}

.section + .section {
  padding-top: 0;
}

/* Divider sits inside .wrap so it lines up with the content, not the viewport edge. */
.section + .section > .wrap::before {
  content: "";
  display: block;
  grid-column: 1 / -1;
  margin-bottom: 3rem;
  border-top: 1px solid var(--rule);
}

.split {
  display: grid;
  gap: 1.5rem 3.5rem;
}

@media (min-width: 56rem) {
  .split {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .split--narrow-media {
    grid-template-columns: 2fr 1fr;
  }
}

.mini-stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.mini-stages li {
  padding: 0.6rem 0.6rem 1rem;
}

.mini-stages li:last-child {
  background-color: var(--cyan-deep);
}

.mini-stages strong {
  display: block;
  margin: 0.5rem 0.3rem 0.2rem;
  font-size: 1.4rem;
  font-weight: 800;
  font-stretch: 88%;
}

.mini-stages span {
  display: block;
  margin: 0 0.3rem;
  color: var(--trace);
  font-size: 1rem;
  line-height: 1.45;
}

@media (min-width: 48rem) {
  .mini-stages {
    grid-template-columns: repeat(3, 1fr);
  }
}

.closing {
  padding-block: 1rem 4.5rem;
}

.closing__inner {
  display: grid;
  gap: 1rem 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--rule);
}

.closing__inner h2 {
  margin-bottom: 0.3em;
}

.closing__inner p {
  margin-bottom: 0;
}

@media (min-width: 56rem) {
  .closing__inner {
    grid-template-columns: 1fr auto;
    align-items: end;
  }
}

/* ---------- Photos page ---------- */

.gallery {
  display: grid;
  gap: 2rem 1.5rem;
}

@media (min-width: 48rem) {
  .gallery {
    grid-template-columns: repeat(6, 1fr);
  }

  .gallery > :nth-child(1) {
    grid-column: span 4;
  }

  .gallery > :nth-child(2) {
    grid-column: span 2;
  }

  .gallery > :nth-child(3),
  .gallery > :nth-child(4),
  .gallery > :nth-child(5) {
    grid-column: span 2;
  }

  .gallery > :nth-child(6) {
    grid-column: span 6;
  }
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ---------- Contact page ---------- */

.contact-grid {
  display: grid;
  align-items: start;
  gap: 3rem;
  padding-block: 3rem 4.5rem;
}

@media (min-width: 56rem) {
  .contact-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}

.form-field {
  margin-bottom: 1.25rem;
}

.form-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 650;
}

.form-field .hint {
  font-weight: 400;
  color: var(--muted);
}

.form-field input,
.form-field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--pencil);
  border-radius: 0;
  background: #fff;
  color: var(--pencil);
  font: inherit;
}

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

.form-field input:focus-visible,
.form-field textarea:focus-visible {
  border-color: var(--cyan);
}

.form-note {
  margin-top: 1rem;
}

.honeypot {
  display: none;
}

.contact-details {
  padding: 1.5rem var(--gutter) 0.5rem;
}

@media (min-width: 56rem) {
  .contact-details {
    padding-inline: 1.75rem;
  }
}

.contact-details h2 {
  font-size: 1.5rem;
}

.contact-details dt {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--trace-dim);
}

.contact-details dd {
  margin: 0.15rem 0 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(223, 232, 255, 0.25);
  font-weight: 650;
}

.contact-details dd:last-child {
  border-bottom: 0;
}

/* ---------- 404 ---------- */

.notfound__drawing {
  max-width: 34rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--cyan-deep);
  color: var(--vellum);
  font-size: 1rem;
}

.footer-grid {
  display: grid;
  gap: 2rem;
  padding-block: 3rem 2.5rem;
}

@media (min-width: 48rem) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-name {
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
  font-weight: 800;
  font-stretch: 88%;
}

.footer-motif {
  color: var(--lamp);
  font-weight: 650;
}

.footer-label {
  margin-bottom: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--trace-dim);
}

.footer-list {
  list-style: none;
  padding: 0;
}

.footer-list li {
  margin-bottom: 0.4rem;
}

.site-footer .titleblock {
  border-bottom: 1px solid rgba(223, 232, 255, 0.35);
}

.footer-base {
  padding-block: 1rem 1.5rem;
  color: var(--trace-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.footer-base p {
  margin: 0;
}
