/* IAE Designs — drafting vellum, graphite and one red pencil.
   Contents: 1 paper  2 layers panel  3 sheet + tracing layers  4 dimension lines
             5 callouts, notes, tables  6 scale tool  7 form  8 title block  9 wide screens */

/* 1 ─ paper ───────────────────────────────────────────── */
:root {
  --vellum: #F3EFE4;
  --graphite: #3A3A3A;
  --pencil: #D7372F;
  --grid: #B9D7EA;
  --trace: rgba(255, 255, 255, 0.62);
  --hand: "Architects Daughter", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --plain: "Titillium Web", "Segoe UI", Tahoma, Arial, sans-serif;
  --wobble: 255px 14px 225px 14px / 14px 225px 14px 255px;
  --topbar: 60px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--graphite);
  font: 400 1.0625rem/1.65 var(--plain);
  background-color: var(--vellum);
  background-image:
    linear-gradient(rgba(185, 215, 234, 0.75) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 215, 234, 0.75) 1px, transparent 1px),
    linear-gradient(rgba(185, 215, 234, 0.38) 1px, transparent 1px),
    linear-gradient(90deg, rgba(185, 215, 234, 0.38) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.js body { padding-top: var(--topbar); }
h1, h2, h3 { font-family: var(--hand); font-weight: 400; line-height: 1.12; margin: 0; color: var(--graphite); overflow-wrap: anywhere; }
h1 { font-size: clamp(2.3rem, 8.6vw, 4.1rem); }
h2 { font-size: clamp(1.7rem, 5.6vw, 2.3rem); color: var(--pencil); }
.h1-sheet { font-size: clamp(2rem, 7.4vw, 3.1rem); }
h3 { font-size: 1.4rem; }
p { margin: 0 0 1em; }
a { color: var(--graphite); text-decoration-color: var(--pencil); text-decoration-thickness: 2px; text-underline-offset: 4px; }
a:hover { background: rgba(185, 215, 234, 0.6); }
svg { max-width: 100%; }
:focus-visible { outline: 3px dashed var(--pencil); outline-offset: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 2 ─ layers panel (the navigation) ───────────────────── */
.layers {
  font-family: var(--plain);
  background: #FBF9F3;
  border-bottom: 1.5px solid var(--graphite);
  z-index: 40;
}
.js .layers { position: fixed; top: 0; left: 0; right: 0; max-height: 100vh; overflow-y: auto; }
.layers__bar { display: flex; align-items: stretch; justify-content: space-between; min-height: var(--topbar); }
.layers__brand {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; min-width: 0;
  font: 400 1.45rem/1 var(--hand); text-decoration: none; color: var(--graphite);
}
.layers__brand svg { width: 30px; height: 30px; flex: none; }
.layers__brand:hover { background: none; color: var(--pencil); }
.layers__toggle {
  display: flex; align-items: center; gap: 10px; min-width: 116px; min-height: 48px; padding: 0 14px;
  border: 0; border-left: 1.5px solid var(--graphite); background: var(--graphite); color: var(--vellum);
  font: 600 1rem/1 var(--plain); letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
}
.layers__toggle svg { width: 22px; height: 22px; flex: none; }
.layers__toggle .chev { margin-left: auto; width: 14px; height: 14px; transition: transform 0.2s; }
.layers__toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.layers__toggle:hover { background: #222; }
.layers__toggle:focus-visible { outline-color: var(--vellum); outline-offset: -6px; }
.layers__list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--graphite); }
.js .layers:not(.is-open) .layers__list, .js .layers:not(.is-open) .layers__foot { display: none; }
.layers__list a {
  display: grid; grid-template-columns: 30px 16px minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 50px; padding: 6px 14px; text-decoration: none; font-weight: 600;
  border-bottom: 1px solid rgba(58, 58, 58, 0.25);
}
.layers__list .eye { width: 26px; height: 26px; color: rgba(58, 58, 58, 0.55); }
.layers__list .chip { width: 14px; height: 14px; border: 1.5px solid var(--graphite); background: var(--c, var(--grid)); }
.layers__list a:hover { background: rgba(185, 215, 234, 0.55); }
.layers__list a:hover .eye { color: var(--graphite); }
.layers__list a[aria-current="page"] { background: var(--grid); box-shadow: inset 4px 0 0 var(--pencil); }
.layers__list a[aria-current="page"] .eye { color: var(--pencil); }
.layers__list a:focus-visible { outline-offset: -5px; }
.layers__foot { margin: 0; padding: 8px 14px 10px; font-size: 0.92rem; color: #555; }

/* 3 ─ sheet and tracing layers ────────────────────────── */
.desk { padding: 0 14px 40px; }
.sheet-strip {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 20px;
  padding: 14px 2px 10px; font: 400 1rem/1.3 var(--hand); border-bottom: 1.5px solid var(--graphite);
}
.sheet-strip span:last-child { color: #555; }
main { display: block; }
.trace {
  position: relative; min-width: 0;
  background: var(--trace);
  border: 1px solid rgba(58, 58, 58, 0.5);
  box-shadow: 3px 4px 0 rgba(58, 58, 58, 0.12);
  padding: 30px 18px 32px;
  margin-top: 30px;
}
.trace::before, .trace::after {
  content: ""; position: absolute; top: -9px; width: 54px; height: 18px;
  background: rgba(185, 215, 234, 0.85); border: 1px solid rgba(58, 58, 58, 0.25);
}
.trace::before { left: 18px; transform: rotate(-3deg); }
.trace::after { right: 18px; transform: rotate(2.5deg); }
.trace--over { margin-top: -14px; margin-left: 12px; margin-right: -4px; z-index: 2; background: rgba(255, 255, 255, 0.7); }
.trace--under { margin-right: 12px; }
.trace--blue { background: rgba(185, 215, 234, 0.5); }
.trace > :last-child { margin-bottom: 0; }
.trace h2 { margin-bottom: 14px; }
.tag { display: inline-block; margin: 0 0 12px; font: 400 1.05rem/1 var(--hand); padding: 6px 12px 5px; border: 1.5px solid var(--graphite); border-radius: var(--wobble); }
.lead { font-size: 1.16rem; line-height: 1.55; max-width: 56ch; }
.prose p { max-width: 64ch; }
.scribble { display: block; width: min(320px, 78%); height: 16px; margin: 6px 0 18px; color: var(--pencil); }
.hero-art { display: block; width: 100%; height: auto; margin: 18px 0 0; }
.figure { margin: 18px 0 0; }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { font: 400 1rem/1.3 var(--hand); margin-top: 6px; }
.go {
  display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 8px 20px;
  border: 2px solid var(--graphite); border-radius: var(--wobble); background: #fff; color: var(--graphite);
  font: 400 1.2rem/1.1 var(--hand); text-decoration: none; cursor: pointer;
  box-shadow: 3px 3px 0 var(--graphite); transition: transform 0.15s, box-shadow 0.15s;
}
.go:hover { background: #fff; transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--pencil); }
.go--red { border-color: var(--pencil); box-shadow: 3px 3px 0 var(--pencil); }
.go-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 20px 0 0; }

/* 4 ─ dimension lines ─────────────────────────────────── */
.dim { display: flex; align-items: center; gap: 10px; margin: 34px 0 -12px; color: var(--pencil); }
.dim i { position: relative; flex: 1; min-width: 18px; height: 0; border-top: 1.5px solid currentColor; }
.dim i::before { content: ""; position: absolute; top: -6px; border: 5px solid transparent; }
.dim i:first-child::before { left: 0; border-left: 0; border-right: 11px solid currentColor; }
.dim i:last-child::before { right: 0; border-right: 0; border-left: 11px solid currentColor; }
.dim i::after { content: ""; position: absolute; top: -11px; height: 22px; border-left: 1.5px solid currentColor; }
.dim i:first-child::after { left: 0; }
.dim i:last-child::after { right: 0; }
.dim span { font: 400 1rem/1.2 var(--hand); color: var(--graphite); text-align: center; }
.vdim { display: none; }

/* 5 ─ callouts, notes, tables ─────────────────────────── */
.callouts { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.callout { position: relative; min-width: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: start; text-decoration: none; padding: 6px 0; }
.callout:hover { background: none; }
.callout__mark {
  width: 64px; height: 64px; border: 2px solid var(--graphite); border-radius: 50%; display: grid; place-items: center;
  font: 400 1.7rem/1 var(--hand); background: #fff; position: relative; transition: background-color 0.15s, color 0.15s;
}
.callout__mark::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px solid var(--graphite); opacity: 0.25; }
.callout:hover .callout__mark { background: var(--pencil); color: #fff; border-color: var(--pencil); }
.callout h3 { text-decoration: underline; text-decoration-color: var(--pencil); text-decoration-thickness: 2px; text-underline-offset: 5px; margin-bottom: 6px; }
.callout p { margin: 0; }

.notes { margin: 0; padding: 0; list-style: none; counter-reset: note; }
.notes li { counter-increment: note; position: relative; padding: 0 0 12px 44px; }
.notes li::before { content: counter(note) "."; position: absolute; left: 0; top: -3px; width: 34px; font: 400 1.35rem/1.4 var(--hand); color: var(--pencil); text-align: right; }
.queries { margin: 0; padding: 0; list-style: none; }
.queries li { position: relative; padding: 0 0 12px 34px; }
.queries li::before { content: "?"; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border: 1.5px solid var(--pencil); border-radius: 50%; display: grid; place-items: center; font: 400 0.95rem/1 var(--hand); color: var(--graphite); }

.rev { width: 100%; border-collapse: collapse; border: 1.5px solid var(--graphite); background: rgba(255, 255, 255, 0.6); }
.rev caption { text-align: left; font: 400 1rem/1.3 var(--hand); padding-bottom: 8px; }
.rev th, .rev td { border: 1px solid rgba(58, 58, 58, 0.6); padding: 10px 12px; text-align: left; vertical-align: top; }
.rev thead th { font: 600 0.82rem/1.2 var(--plain); letter-spacing: 0.1em; text-transform: uppercase; background: rgba(185, 215, 234, 0.55); }
.rev tbody th { font: 400 1.3rem/1.2 var(--hand); color: var(--pencil); white-space: nowrap; width: 1%; }
.rev td strong { display: block; font-weight: 700; }

.sequence { list-style: none; margin: 0; padding: 0; counter-reset: seq; display: grid; gap: 0; }
.sequence li { counter-increment: seq; position: relative; padding: 0 0 22px 56px; min-width: 0; }
.sequence li::before { content: counter(seq, upper-alpha); position: absolute; left: 0; top: -4px; width: 40px; height: 40px; border: 1.5px solid var(--graphite); background: #fff; display: grid; place-items: center; font: 400 1.25rem/1 var(--hand); }
.sequence li::after { content: ""; position: absolute; left: 19px; top: 40px; bottom: 0; border-left: 1.5px dashed var(--pencil); }
.sequence li:last-child { padding-bottom: 0; }
.sequence li:last-child::after { content: none; }
.sequence strong { display: block; font: 400 1.25rem/1.25 var(--hand); }

.next { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 18px 0 0; padding: 0; list-style: none; font: 400 1.1rem/1.3 var(--hand); }

/* 6 ─ scale converter ─────────────────────────────────── */
.tool__grid { display: grid; gap: 16px; margin: 20px 0 18px; }
.tool__f { min-width: 0; }
.tool__f label { display: block; font: 600 0.84rem/1.2 var(--plain); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.tool__pair { display: flex; gap: 8px; }
.tool input, .tool select, .field input, .field select, .field textarea {
  width: 100%; min-width: 0; min-height: 50px; padding: 8px 12px; background: #fff; color: var(--graphite);
  border: 1.5px solid var(--graphite); border-radius: 0; font: 600 1.1rem/1.3 var(--plain);
}
.tool__pair select { flex: 0 0 5.2rem; }
.tool input:focus-visible, .tool select:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--pencil); outline-offset: 1px; }
.tool__eq { display: none; }
.tool__out { margin: 0 0 6px; padding: 12px 14px; background: #fff; border-left: 5px solid var(--pencil); font-size: 1.12rem; }
.tool__out b { font-weight: 700; white-space: nowrap; }
.tool__svg { display: block; width: 100%; height: auto; margin: 14px 0 6px; }
.svg-hand { font-family: var(--hand); font-size: 16px; }
.tool__fine { font-size: 0.98rem; color: #4a4a4a; margin: 0; }

/* 7 ─ form ────────────────────────────────────────────── */
.field { margin: 0 0 18px; }
.field label { display: block; font: 400 1.2rem/1.2 var(--hand); margin-bottom: 6px; }
.field input, .field select, .field textarea { font-weight: 400; font-size: 1.0625rem; }
.field textarea { min-height: 170px; resize: vertical; line-height: 1.5; background-image: linear-gradient(transparent 31px, rgba(185, 215, 234, 0.8) 32px); background-size: 100% 32px; }
.field .bad { border-color: var(--pencil); border-width: 2.5px; }
.field__msg { margin: 6px 0 0; font-weight: 700; color: #a8231c; }
.field__msg::before { content: "\2715  "; }
.errors { margin: 0 0 18px; padding: 12px 14px; border: 2px solid var(--pencil); border-radius: var(--wobble); background: #fff; }
.errors p { margin: 0 0 4px; font-weight: 700; }
.errors ul { margin: 0; padding-left: 20px; }
.send-note { margin: 14px 0 0; font-size: 0.98rem; max-width: 52ch; }
.send-status { margin: 14px 0 0; padding: 12px 14px; background: #fff; border-left: 5px solid var(--pencil); font-weight: 600; }
.info { margin: 0; }
.info > div { padding: 10px 0; border-bottom: 1px dashed rgba(58, 58, 58, 0.5); }
.info dt { font: 600 0.82rem/1.2 var(--plain); letter-spacing: 0.1em; text-transform: uppercase; }
.info dd { margin: 2px 0 0; font-size: 1.1rem; overflow-wrap: anywhere; }

/* 8 ─ title block (footer) ────────────────────────────── */
.titleblock { margin: 46px 0 0; border: 2px solid var(--graphite); background: rgba(255, 255, 255, 0.72); display: grid; }
.titleblock > * { min-width: 0; padding: 14px 16px; border-bottom: 1px solid var(--graphite); }
.titleblock > :last-child { border-bottom: 0; }
.titleblock h2 { font: 600 0.8rem/1.2 var(--plain); letter-spacing: 0.12em; text-transform: uppercase; color: #555; margin-bottom: 6px; }
.titleblock__name { font: 400 1.9rem/1.1 var(--hand); margin: 0; }
.titleblock__name + p { margin: 6px 0 0; }
.titleblock dl { margin: 0; }
.titleblock dl > div { padding: 5px 0; }
.titleblock dt { font: 600 0.8rem/1.2 var(--plain); letter-spacing: 0.12em; text-transform: uppercase; color: #555; }
.titleblock dd { margin: 0; overflow-wrap: anywhere; }
.titleblock ul { list-style: none; margin: 0; padding: 0; }
.titleblock li a { display: inline-block; padding: 7px 0; }
.titleblock li a[aria-current="page"] { font-weight: 700; text-decoration-style: double; }
.titleblock__meta p { margin: 0; font: 400 1.15rem/1.4 var(--hand); }
.titleblock__meta p + h2 { margin-top: 12px; }

/* 9 ─ wider screens ───────────────────────────────────── */
@media (min-width: 680px) {
  .desk { padding: 0 28px 56px; }
  .trace { padding: 40px 36px 42px; }
  .tilt-l { transform: rotate(-0.35deg); }
  .tilt-r { transform: rotate(0.4deg); }
  .callouts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
  .callout { grid-template-columns: minmax(0, 1fr); }
  .tool__grid { grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 0.8fr) auto minmax(0, 1fr); align-items: end; }
  .tool__eq { display: block; font: 400 1.6rem/50px var(--hand); color: var(--pencil); }
  .titleblock { grid-template-columns: 1.3fr 1.5fr 1fr 0.9fr; }
  .titleblock > * { border-bottom: 0; border-right: 1px solid var(--graphite); }
  .titleblock > :last-child { border-right: 0; }
  .pair { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
  .pair > .trace--over { margin: 70px 0 0 -26px; }
  .pair--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
  .pair--flip > .trace--over { margin: 0 -26px 0 0; order: -1; margin-top: 80px; }
  .pair > .trace--under { margin-right: 0; padding-right: 54px; }
  .pair--flip > .trace--under { padding-right: 36px; padding-left: 58px; }
  .sequence--row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
  .sequence--row li { padding: 54px 0 0; }
  .sequence--row li::after { left: 40px; right: -22px; top: 19px; bottom: auto; border-left: 0; border-top: 1.5px dashed var(--pencil); }
}
@media (min-width: 1000px) {
  body { font-size: 1.125rem; }
  .js body { padding-top: 0; }
  .layers, .js .layers {
    position: fixed; top: 22px; left: 22px; right: auto; width: 244px; max-height: calc(100vh - 44px);
    border: 1.5px solid var(--graphite); box-shadow: 5px 5px 0 rgba(58, 58, 58, 0.85);
  }
  .layers__bar { display: block; min-height: 0; }
  .layers__brand { padding: 14px 14px 12px; font-size: 1.6rem; }
  .layers__toggle { width: 100%; min-height: 44px; border-left: 0; }
  .desk { margin-left: 290px; padding: 0 44px 70px 30px; max-width: 1080px; }
  .sheet-strip { padding-top: 26px; }
  .trace { margin-top: 44px; }
  .trace--over { margin-top: -22px; }
  .vdim { display: block; position: absolute; left: -22px; top: 10px; bottom: 10px; border-left: 1.5px solid var(--pencil); }
  .vdim::before, .vdim::after { content: ""; position: absolute; left: -5.75px; border: 5px solid transparent; }
  .vdim::before { top: 0; border-top: 0; border-bottom: 11px solid var(--pencil); }
  .vdim::after { bottom: 0; border-bottom: 0; border-top: 11px solid var(--pencil); }
  .hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 30px; align-items: center; }
  .hero-art { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
