/* ------------------------------------------------------------------
   Anthony Ward — Mechanical Design
   One stylesheet for every page. Colors and type live in :root.
------------------------------------------------------------------- */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-italic.woff2") format("woff2-variations");
}

:root {
  --paper: #f1f2ee;      /* drawing sheet */
  --paper-2: #e7e9e3;    /* shaded cells */
  --ink: #1b2431;        /* object lines, text */
  --ink-2: #4a5563;      /* secondary text */
  --line: #9aa6b4;       /* centerlines, hidden lines, construction */
  --rule: #cfd3cb;       /* hairlines between rows */
  --red: #c1291b;        /* redline: calls to action, focus, revisions */

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.3rem;
  --step-4: clamp(2.5rem, 5.4vw, 4.1rem);

  --measure: 64ch;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --rail: 26px;
}

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

html {
  font-size: 112.5%; /* 18px */
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-stretch: 100%;
  font-weight: 400;
  line-height: 1.55;
  font-feature-settings: "tnum" 0;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--red); }

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

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

/* ---------- Sheet frame: border with drawing zones ---------- */

.sheet {
  margin: 14px;
  border: 1.5px solid var(--ink);
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail);
  grid-template-rows: var(--rail) 1fr var(--rail);
  min-height: calc(100vh - 28px);
}

.zones-x, .zones-y {
  display: flex;
  color: var(--ink-2);
  font-size: 0.66rem;
  font-stretch: 115%;
  user-select: none;
}
.zones-x { grid-column: 2; }
.zones-x span {
  flex: 1;
  display: grid; place-items: center;
  border-left: 1px solid var(--line);
}
.zones-x span:first-child { border-left: 0; }
.zones-x.top { grid-row: 1; border-bottom: 1px solid var(--ink); }
.zones-x.bottom { grid-row: 3; border-top: 1px solid var(--ink); }

.zones-y { flex-direction: column; grid-row: 2; }
.zones-y span {
  flex: 1;
  display: grid; place-items: center;
  border-top: 1px solid var(--line);
}
.zones-y span:first-child { border-top: 0; }
.zones-y.left { grid-column: 1; border-right: 1px solid var(--ink); }
.zones-y.right { grid-column: 3; border-left: 1px solid var(--ink); }

.corner { border-color: var(--ink); }
.corner.tl { grid-area: 1 / 1; border-right: 1px solid; border-bottom: 1px solid; }
.corner.tr { grid-area: 1 / 3; border-left: 1px solid; border-bottom: 1px solid; }
.corner.bl { grid-area: 3 / 1; border-right: 1px solid; border-top: 1px solid; }
.corner.br { grid-area: 3 / 3; border-left: 1px solid; border-top: 1px solid; }

.sheet-body { grid-area: 2 / 2; min-width: 0; }

@media (max-width: 760px) {
  .sheet {
    margin: 8px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr;
  }
  .zones-x, .zones-y, .corner { display: none; }
  .sheet-body { grid-area: 1 / 1; }
}

/* ---------- Layout ---------- */

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

section { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--ink); }
section:first-of-type { border-top: 0; }

h1, h2, h3 {
  font-stretch: 82%;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.012em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); line-height: 1.25; }

p { margin: 0 0 1em; max-width: var(--measure); }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink); max-width: 46ch; }
.muted { color: var(--ink-2); }
.small { font-size: var(--step--1); }

.section-head { display: grid; gap: 0.25rem; margin-bottom: 2.25rem; max-width: 62ch; }
.section-head p { color: var(--ink-2); margin: 0; }

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--ink);
}
.brand {
  text-decoration: none;
  display: grid;
  line-height: 1.15;
}
.brand strong { font-stretch: 82%; font-weight: 700; font-size: 1.15rem; }
.brand span { font-size: var(--step--1); color: var(--ink-2); }
.site-nav ul { list-style: none; display: flex; gap: 1.4rem; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-size: 0.94rem; }
@media (max-width: 520px) {
  .site-nav ul { gap: 0.4rem 0.95rem; }
  .site-nav a { font-size: 0.86rem; }
}
.site-nav a:hover { text-decoration: underline; }

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

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.btn {
  display: inline-block;
  padding: 0.78rem 1.25rem;
  border: 1.5px solid var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: center;
  padding-block: clamp(2.5rem, 6vw, 5rem);
}
.hero h1 { max-width: 13ch; }
.hero-drawing { width: 100%; height: auto; }
.hero-drawing .obj { stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linejoin: round; }
.hero-drawing .hid { stroke: var(--ink-2); stroke-width: 1.3; fill: none; stroke-dasharray: 7 5; }
.hero-drawing .ctr { stroke: var(--line); stroke-width: 1; fill: none; stroke-dasharray: 18 4 3 4; }
.hero-drawing .dim { stroke: var(--ink-2); stroke-width: 0.9; fill: none; }
.hero-drawing .arrow { fill: var(--ink-2); }
.hero-drawing text { font-family: "Archivo", sans-serif; font-size: 13px; fill: var(--ink-2); font-stretch: 90%; }
.hero-drawing .red { stroke: var(--red); fill: none; stroke-width: 1.6; }
.hero-drawing text.redtxt { fill: var(--red); font-weight: 600; }

/* One load sequence: object lines draw in, then dimensions appear. */
@media (prefers-reduced-motion: no-preference) {
  .hero-drawing .obj { stroke-dasharray: var(--len, 900); stroke-dashoffset: var(--len, 900); animation: draw 1.4s cubic-bezier(.6,.1,.3,1) forwards; }
  .hero-drawing .obj:nth-of-type(2) { animation-delay: .15s; }
  .hero-drawing .obj:nth-of-type(3) { animation-delay: .3s; }
  .hero-drawing .later { opacity: 0; animation: appear .6s ease 1.3s forwards; }
  .hero-drawing .latest { opacity: 0; animation: appear .5s ease 2s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-figure { max-width: 560px; }
}

/* ---------- Services table ---------- */

.services { width: 100%; border-collapse: collapse; }
.services th, .services td {
  text-align: left;
  vertical-align: top;
  padding: 1.2rem 1.25rem 1.2rem 0;
  border-top: 1px solid var(--rule);
}
.services thead th {
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--ink-2);
  border-top: 0;
  padding-block: 0 0.6rem;
  border-bottom: 1px solid var(--ink);
}
.services tbody tr:first-child td,
.services tbody tr:first-child th { border-top: 0; }
.services tbody th { width: 24%; }
.services tbody th h3 { margin: 0 0 0.2rem; }
.services tbody th span { font-weight: 400; color: var(--ink-2); font-size: 0.92rem; }
.services td { color: var(--ink); }
.services td:last-child { width: 26%; color: var(--ink-2); font-size: 0.92rem; padding-right: 0; }
.services p { margin: 0; }

@media (max-width: 760px) {
  .services thead { display: none; }
  .services, .services tbody, .services tr, .services th, .services td { display: block; width: auto !important; }
  .services tr { border-top: 1px solid var(--ink); padding-block: 1.1rem; }
  .services tbody tr:first-child { border-top: 0; }
  .services th, .services td { border: 0; padding: 0 0 0.6rem; }
}

/* ---------- Work grid ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
}
.work-item {
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  text-decoration: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-width: 0;
}
.work-item figure { margin: 0; aspect-ratio: 16 / 10; display: grid; place-items: center; padding: 1.25rem; border-bottom: 1px solid var(--rule); }
.work-item figure img { width: 100%; height: 100%; object-fit: contain; }
.work-item .cap { padding: 1.1rem 1.25rem 1.3rem; }
.work-item h3 { margin: 0 0 0.3rem; }
.work-item p { margin: 0; color: var(--ink-2); font-size: 0.94rem; }
.work-item .sells { margin-top: 0.6rem; font-size: var(--step--1); color: var(--ink-2); }
.work-item:hover { background: var(--paper-2); color: var(--ink); }
.work-item:hover h3 { text-decoration: underline; text-decoration-color: var(--red); }

@media (max-width: 760px) {
  .work-grid { grid-template-columns: 1fr; }
}

/* ---------- Process ---------- */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  counter-reset: step;
}
.steps li { counter-increment: step; border-top: 1.5px solid var(--ink); padding-top: 0.9rem; }
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.9rem; height: 1.9rem;
  border: 1.2px solid var(--ink);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}
.steps h3 { margin-bottom: 0.35rem; }
.steps p { color: var(--ink-2); font-size: 0.94rem; margin: 0; }

@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: var(--gap);
}
.facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.facts li { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; }
.facts li span { display: block; color: var(--ink-2); font-size: var(--step--1); }

@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ---------- Contact: form + title block ---------- */

.contact {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }

form.quote { display: grid; gap: 1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.92rem; }
.field .hint { font-size: var(--step--1); color: var(--ink-2); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .row-2 { grid-template-columns: 1fr; } }

input, select, textarea {
  font: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: #fbfbf9;
  border: 1px solid var(--ink-2);
  border-radius: 0;
  padding: 0.65rem 0.75rem;
  width: 100%;
}
textarea { min-height: 9rem; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }

.form-note { font-size: var(--step--1); color: var(--ink-2); margin: 0; }
.form-status { font-size: 0.94rem; margin: 0; min-height: 1.4em; }
.form-status.err { color: var(--red); }

.title-block {
  border: 1.5px solid var(--ink);
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.title-block > div {
  padding: 0.6rem 0.8rem 0.7rem;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  min-width: 0;
}
.title-block > div:nth-child(2n) { border-right: 0; }
.title-block > .wide { grid-column: 1 / -1; border-right: 0; }
.title-block > div:last-child { border-bottom: 0; }
.title-block dt { font-size: 0.7rem; color: var(--ink-2); font-stretch: 110%; margin-bottom: 0.15rem; }
.title-block dd { margin: 0; font-size: 0.98rem; overflow-wrap: anywhere; }
.title-block .name dd { font-stretch: 82%; font-weight: 700; font-size: 1.5rem; line-height: 1.1; }
.title-block .shade { background: var(--paper-2); }

/* ---------- Footer: revision block ---------- */

.site-footer { border-top: 1px solid var(--ink); padding-block: 1.25rem 1.5rem; }
.rev {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  color: var(--ink-2);
}
.rev th, .rev td { border: 1px solid var(--rule); padding: 0.35rem 0.6rem; text-align: left; }
.rev th { font-weight: 500; }
.rev td.r { color: var(--red); font-weight: 600; width: 3rem; text-align: center; }
.footer-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0.9rem; font-size: var(--step--1); color: var(--ink-2); }
.footer-line p { margin: 0; }

/* ---------- Case study pages ---------- */

.case-head { padding-block: clamp(2.25rem, 5vw, 4rem) 2rem; }
.case-head .back { font-size: 0.92rem; display: inline-block; margin-bottom: 1.5rem; }
.case-head h1 { font-size: clamp(2.1rem, 4.4vw, 3.3rem); max-width: 20ch; }

.case-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1.5px solid var(--ink);
  margin: 1.75rem 0 0;
}
.case-meta div { padding: 0.55rem 0.8rem 0.65rem; border-right: 1px solid var(--ink); }
.case-meta div:last-child { border-right: 0; }
.case-meta dt { font-size: 0.7rem; color: var(--ink-2); font-stretch: 110%; }
.case-meta dd { margin: 0; font-size: 0.94rem; }
@media (max-width: 760px) {
  .case-meta { grid-template-columns: 1fr 1fr; }
  .case-meta div:nth-child(2) { border-right: 0; }
  .case-meta div:nth-child(-n+2) { border-bottom: 1px solid var(--ink); }
}

.case-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap) calc(var(--gap) * 1.5);
  align-items: start;
}
.case-body .text h2 { font-size: var(--step-2); margin-top: 2.25rem; }
.case-body .text h2:first-child { margin-top: 0; }
.case-body .text ul { padding-left: 1.1rem; margin: 0 0 1em; max-width: var(--measure); }
.case-body .text li { margin-bottom: 0.35rem; }
.case-body .figs { display: grid; gap: 1.25rem; position: sticky; top: 1.25rem; }
@media (max-width: 900px) {
  .case-body { grid-template-columns: 1fr; }
  .case-body .figs { position: static; }
}

.fig { margin: 0; }
.fig .frame { border: 1px solid var(--ink); background: #f7f8f5; aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 1rem; }
.fig .frame img { width: 100%; height: 100%; object-fit: contain; }
.fig .frame.placeholder {
  border-style: dashed;
  border-color: var(--line);
  color: var(--ink-2);
  font-size: 0.9rem;
  text-align: center;
}
.fig figcaption { font-size: var(--step--1); color: var(--ink-2); margin-top: 0.45rem; }

.placeholder-text { background: #f6e3df; padding: 0 0.2em; }

.next-case { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; align-items: center; }
.next-case p { margin: 0; }

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

.plain { padding-block: clamp(4rem, 12vw, 8rem); }
.plain h1 { max-width: 16ch; }

@media (max-width: 520px) {
  .site-nav .nav-opt { display: none; }
}
