/* AvoryX — drafting sheet world. Restricted ink: vellum, two graphites, blue pencil, china-marker red. */

/* ---------- Fonts (self-hosted, latin subset, variable) ---------- */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
}
@font-face {
  font-family: "Archivo Expanded";
  src: url("../fonts/archivo-expanded-latin.woff2") format("woff2");
  font-weight: 600 800;
  font-stretch: 100% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Spline Sans Mono";
  src: url("../fonts/spline-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* ---------- Ink set ---------- */
:root {
  --vellum: #e8ecf1;        /* cool drafting ground */
  --vellum-2: #eef2f6;      /* lighter panel */
  --sheet: #f3f6f9;         /* raised sheet */
  --graphite: #171a1e;      /* primary ink */
  --graphite-2: #474e57;    /* secondary ink */
  --graphite-3: #555c64;    /* faint ink, AA-safe on vellum */
  --blue: #175fb0;          /* blue pencil */
  --blue-ink: #124a8a;
  --grid: rgba(23, 95, 176, 0.11);
  --grid-strong: rgba(23, 95, 176, 0.2);
  --red: #c62a16;           /* china-marker, text-safe fill */
  --red-mark: #e2341d;      /* brighter, non-text ticks/marks */
  --rule: rgba(23, 26, 30, 0.22);
  --rule-strong: rgba(23, 26, 30, 0.42);
  --pad: clamp(1.25rem, 4vw, 4.5rem);
  --maxw: 1360px;

  --f-display: "Archivo Expanded", "Archivo", sans-serif;
  --f-sans: "Archivo", system-ui, sans-serif;
  --f-mono: "Spline Sans Mono", ui-monospace, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--f-sans);
  color: var(--graphite);
  background: var(--vellum);
  line-height: 1.55;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.12rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* engineering-paper grid: minor cells + accented major lines every 5th */
  background-image:
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 140px 140px, 140px 140px, 28px 28px, 28px 28px;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--red-mark); color: #fff; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* custom scrollbar themed from palette */
html { scrollbar-color: var(--graphite-3) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--graphite-3); border: 3px solid var(--vellum); border-radius: 0; }
::-webkit-scrollbar-track { background: transparent; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

/* mono annotation label */
.tag {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-ink);
}
.tag-red { color: var(--red); }
.tag-ink { color: var(--graphite-2); }

/* ---------- Dimension line (drawing furniture) ---------- */
.dim {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite-2);
}
.dim::before, .dim::after {
  content: "";
  height: 7px;
  border-left: 1px solid var(--rule-strong);
}
.dim .line {
  flex: 1;
  height: 1px;
  background: var(--rule-strong);
  position: relative;
  transform-origin: left center;
}
.dim .line::before, .dim .line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px; height: 1px;
  background: var(--rule-strong);
}
/* draw-in on reveal */
.reveal .line { transform: scaleX(0); transition: transform 0.9s cubic-bezier(.16,1,.3,1) 0.1s; }
.reveal.drawn .line { transform: scaleX(1); }

/* ---------- Header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--vellum) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 58px;
}
.brand-mark {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.brand-mark .logo {
  font-family: var(--f-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--graphite);
}
.brand-mark .sheetno { color: var(--graphite-3); }
.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav a.navlink {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--graphite-2);
  position: relative;
  padding-block: 0.3rem;
}
.nav a.navlink::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--blue);
  transform: scaleX(0); transform-origin: left; transition: transform 0.28s ease;
}
.nav a.navlink:hover::after, .nav a.navlink:focus-visible::after { transform: scaleX(1); }
.nav-cta {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--red);
}
.nav-cta:hover { background: var(--graphite); border-color: var(--graphite); }
.nav-links-m { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--f-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.85rem 1.3rem;
  border: 1px solid var(--graphite);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.btn .arrow { transition: transform 0.25s ease; }
.btn:hover .arrow { transform: translate(3px, -3px); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--graphite); border-color: var(--graphite); }
.btn-ghost { background: transparent; color: var(--graphite); }
.btn-ghost:hover { background: var(--graphite); color: var(--vellum); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-top: clamp(2rem, 5vw, 4.5rem); padding-bottom: clamp(2.5rem, 5vw, 4rem); }
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: end;
}
.hero-eyebrow { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.6rem; flex-wrap: wrap; }
.hero-eyebrow .sep { width: 34px; height: 1px; background: var(--rule-strong); }
.hero h1 {
  font-family: var(--f-display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: clamp(2.6rem, 1.3rem + 5.6vw, 5.4rem);
  line-height: 0.96;
  letter-spacing: -0.025em;
  color: var(--graphite);
  max-width: 14ch;
}
.hero h1 .k { color: var(--red); }
.hero-lede {
  margin-top: 1.5rem;
  max-width: 46ch;
  font-size: clamp(1.02rem, 0.95rem + 0.45vw, 1.2rem);
  color: var(--graphite-2);
}
.hero-dim { margin-top: 1.8rem; max-width: 420px; }
.hero-actions { margin-top: 2rem; display: flex; gap: 0.9rem; flex-wrap: wrap; }

/* title block */
.titleblock {
  border: 1.5px solid var(--graphite);
  background: var(--sheet);
  position: relative;
}
.titleblock .tb-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.titleblock .tb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.tb-cell {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.tb-cell:nth-child(odd) { border-right: 1px solid var(--rule); }
.tb-cell .k { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--graphite-3); }
.tb-cell .v { font-family: var(--f-display); font-stretch: 125%; font-weight: 700; font-size: 1.05rem; color: var(--graphite); margin-top: 0.2rem; }
.tb-cell .v.pending { color: var(--graphite-3); font-style: normal; }
.tb-action { padding: 0.9rem; }
.tb-action .btn { width: 100%; justify-content: center; }

/* hero drawing */
.hero-draw { position: relative; margin-top: 2.6rem; border-top: 1px solid var(--rule); padding-top: 1.1rem; }
.hero-draw .elev { width: 100%; height: auto; }
.hero-draw .cap { display: flex; justify-content: space-between; margin-top: 0.7rem; }

/* self-drawing ink */
.ink, .ink-blue, .ink-red { stroke: var(--graphite); stroke-width: 1.4; fill: none; vector-effect: non-scaling-stroke; }
.ink-blue { stroke: var(--blue); }
.ink-red { stroke: var(--red-mark); }
.ink-fill { fill: var(--graphite); stroke: none; }
.ink-fill-red { fill: var(--red-mark); stroke: none; }
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.drawing .draw { animation: draw 1.5s cubic-bezier(.6,0,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Section frame ---------- */
section { position: relative; }
.sec {
  padding-top: clamp(3.5rem, 8vw, 7rem);
  padding-bottom: clamp(3.5rem, 8vw, 7rem);
  border-top: 1px solid var(--rule);
}
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; flex-wrap: wrap; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.sec-head h2 {
  font-family: var(--f-display);
  font-weight: 700;
  font-stretch: 125%;
  font-size: clamp(1.8rem, 1.1rem + 2.6vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.sec-head p { max-width: 42ch; color: var(--graphite-2); }

/* ---------- Measures (stats as dimensions, not metric cards) ---------- */
.measures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--rule); }
.measure { padding: 1.6rem 1.4rem 1.4rem; border-right: 1px solid var(--rule); position: relative; }
.measure:last-child { border-right: none; }
.measure .mval {
  font-family: var(--f-display); font-stretch: 125%; font-weight: 800;
  font-size: clamp(1.8rem, 1.2rem + 1.8vw, 2.8rem);
  line-height: 1; letter-spacing: -0.02em; color: var(--graphite);
}
.measure .mval .u { color: var(--red); }
.measure .mlabel { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue-ink); margin-top: 0.9rem; }
.measure .mnote { margin-top: 0.5rem; font-size: 0.92rem; color: var(--graphite-2); }
.measure .mdim { position: absolute; top: 1.1rem; right: 1.4rem; font-family: var(--f-mono); font-size: 0.72rem; color: var(--graphite-3); letter-spacing: 0.08em; }

/* ---------- Build stages ---------- */
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--rule); }
.stage { padding: clamp(1.4rem, 2.5vw, 2.2rem); border-right: 1px solid var(--rule); }
.stage:last-child { border-right: none; }
.stage .st-tag { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.4rem; }
.stage .st-tag .n { font-family: var(--f-mono); font-size: 0.72rem; color: var(--red); letter-spacing: 0.12em; }
.stage h3 { font-family: var(--f-display); font-stretch: 125%; font-weight: 700; font-size: clamp(1.25rem, 1rem + 0.9vw, 1.6rem); line-height: 1.05; letter-spacing: -0.015em; margin-bottom: 0.7rem; }
.stage p { color: var(--graphite-2); font-size: 0.98rem; max-width: 34ch; }
.stage .st-svg { margin-bottom: 1.3rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.2rem; }
.chip { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--graphite-2); border: 1px solid var(--rule); padding: 0.28rem 0.55rem; }
.timeline-note { margin-top: 1.6rem; display: flex; gap: 1.4rem; flex-wrap: wrap; }

/* ---------- Work (plates) ---------- */
.plates { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border: 1px solid var(--rule); }
.plate {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: clamp(1.2rem, 2vw, 1.8rem);
  display: flex; flex-direction: column;
  position: relative;
  transition: background 0.25s ease;
}
.plate:nth-child(2n) { border-right: none; }
.plate:nth-last-child(-n+2) { border-bottom: none; }
.plate:hover { background: var(--sheet); }
.plate .pl-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.plate .pl-trade { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--blue-ink); }
.plate .pl-no { font-family: var(--f-mono); font-size: 0.72rem; color: var(--graphite-3); }
.plate .pl-frame { border: 1px solid var(--rule); background: var(--vellum-2); margin-bottom: 1.1rem; }
.plate .pl-frame svg { width: 100%; height: auto; }
.plate h3 { font-family: var(--f-display); font-stretch: 125%; font-weight: 700; font-size: 1.35rem; letter-spacing: -0.015em; margin-bottom: 0.45rem; }
.plate p { color: var(--graphite-2); font-size: 0.95rem; flex: 1; }
.plate .pl-visit { margin-top: 1.1rem; display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--graphite); border-bottom: 1px solid var(--red); padding-bottom: 0.2rem; align-self: flex-start; }
.plate .pl-visit .arrow { transition: transform 0.25s ease; }
.plate:hover .pl-visit .arrow { transform: translate(3px, -3px); }
.plates-note { margin-top: 1.4rem; }

/* ---------- Process (revision table) ---------- */
.revtable { border: 1.5px solid var(--graphite); }
.rev-row { display: grid; grid-template-columns: 72px 1fr 2fr; border-bottom: 1px solid var(--rule); }
.rev-row:last-child { border-bottom: none; }
.rev-row.head { background: var(--graphite); color: var(--vellum); }
.rev-row.head .rc { color: var(--vellum); }
.rc { padding: 1rem 1.1rem; border-right: 1px solid var(--rule); }
.rc:last-child { border-right: none; }
.rev-row.head .rc { border-right-color: rgba(255,255,255,0.18); }
.rc.rno { font-family: var(--f-mono); font-size: 0.8rem; color: var(--red); display: flex; align-items: center; }
.rev-row.head .rc.rno { color: var(--vellum); }
.rc.rstage { font-family: var(--f-display); font-stretch: 125%; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; display: flex; align-items: center; }
.rc.rwhat { color: var(--graphite-2); font-size: 0.97rem; }
.rc.rwhat .h { color: var(--vellum); font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; }
.rev-row:not(.head):hover { background: var(--sheet); }

/* ---------- CTA + form ---------- */
.cta { border-top: 1px solid var(--rule); }
.cta-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.cta h2 { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: clamp(2.2rem, 1.3rem + 3.6vw, 4rem); line-height: 0.98; letter-spacing: -0.025em; }
.cta h2 .k { color: var(--red); }
.cta p { margin-top: 1.3rem; max-width: 38ch; color: var(--graphite-2); font-size: 1.08rem; }
.cta .trust { margin-top: 2rem; display: flex; flex-direction: column; gap: 0.7rem; }
.cta .trust li { display: flex; align-items: center; gap: 0.7rem; font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--graphite-2); }
.cta .trust li .mk { color: var(--red); font-weight: 700; }

.pform { border: 1.5px solid var(--graphite); background: var(--sheet); }
.pform .pf-head { padding: 0.6rem 0.95rem; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: center; }
.pform-body { padding: clamp(1.1rem, 2vw, 1.5rem); display: grid; gap: 1rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--graphite-2); }
.field input, .field textarea {
  font-family: var(--f-sans); font-size: 1rem; color: var(--graphite);
  background: var(--vellum); border: 1px solid var(--rule-strong);
  padding: 0.7rem 0.8rem; border-radius: 0; width: 100%;
}
.field input::placeholder, .field textarea::placeholder { color: var(--graphite-3); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: inset 0 -2px 0 var(--blue); }
.field textarea { resize: vertical; min-height: 92px; }
.pform .btn { width: 100%; justify-content: center; }
.form-status { font-family: var(--f-mono); font-size: 0.74rem; letter-spacing: 0.04em; min-height: 1.1rem; }
.form-status.ok { color: var(--blue-ink); }
.form-status.err { color: var(--red); }

/* ---------- Footer ---------- */
.site-foot { border-top: 1.5px solid var(--graphite); background: var(--vellum-2); }
.foot-top { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem; padding-block: clamp(2.5rem, 5vw, 4rem); }
.foot-brand .logo { font-family: var(--f-display); font-stretch: 125%; font-weight: 800; font-size: 1.5rem; letter-spacing: 0.01em; }
.foot-brand p { margin-top: 0.9rem; max-width: 34ch; color: var(--graphite-2); font-size: 0.95rem; }
.foot-brand .loc { margin-top: 1.1rem; }
.foot-col h4 { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--graphite-3); margin-bottom: 1rem; }
.foot-col ul { list-style: none; display: grid; gap: 0.6rem; }
.foot-col a { color: var(--graphite-2); font-size: 0.95rem; }
.foot-col a:hover { color: var(--graphite); }
.foot-bottom { border-top: 1px solid var(--rule); padding-top: 1.3rem; padding-bottom: 1.3rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.foot-bottom .cp { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--graphite-2); }
.foot-bottom .legal { display: flex; gap: 1.2rem; }
.foot-bottom .legal a { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--graphite-2); }
.foot-bottom .legal a:hover { color: var(--graphite); }

/* back to top */
.to-top {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 40;
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--graphite); color: var(--vellum);
  border: 1px solid var(--graphite);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--red); border-color: var(--red); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.7s cubic-bezier(.16,1,.3,1), transform 0.7s cubic-bezier(.16,1,.3,1); }
.reveal.drawn { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.06s; }
.reveal.d2 { transition-delay: 0.12s; }
.reveal.d3 { transition-delay: 0.18s; }
.reveal.d4 { transition-delay: 0.24s; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  .titleblock { max-width: 520px; }
  .cta-grid { grid-template-columns: 1fr; gap: 2.5rem; }
  .foot-top { grid-template-columns: 1fr 1fr; gap: 1.8rem 2rem; }
  .foot-brand { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .nav-links-m { display: flex; }
  .measures { grid-template-columns: 1fr 1fr; }
  .measure:nth-child(2n) { border-right: none; }
  .measure:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .stages { grid-template-columns: 1fr; }
  .stage { border-right: none; border-bottom: 1px solid var(--rule); }
  .stage:last-child { border-bottom: none; }
  .plates { grid-template-columns: 1fr; }
  .plate { border-right: none; }
  .plate:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .plate:last-child { border-bottom: none; }
  .rev-row { grid-template-columns: 56px 1fr; }
  .rev-row .rc.rwhat { grid-column: 1 / -1; border-right: none; border-top: 1px solid var(--rule); }
  .rev-row.head .rc.rwhat { display: none; }
}
@media (max-width: 440px) {
  .tb-grid { grid-template-columns: 1fr; }
  .tb-cell:nth-child(odd) { border-right: none; }
  .foot-top { grid-template-columns: 1fr; }
  .foot-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .draw { stroke-dashoffset: 0; }
  .dim .line { transform: scaleX(1); }
}
