/* ==========================================================================
   Alexander Dade — site styles
   Set in Helvetica.
   ========================================================================== */

:root {
  --paper: #f3f4f0;
  --ink: #1c2326;
  --graphite: #5b6469;
  --rule: #cdd1cb;
  --green: #3e5c4e;
  --green-deep: #2c4438;
  --sheet: #ffffff;
  --sheet-rule: #d9dcd6;

  --serif: var(--sans);
  --sans: "Helvetica Neue", Helvetica, "TeX Gyre Heros", Arial, sans-serif;

  --measure: 36rem;
  --gutter: 7.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15191b;
    --ink: #e2e5df;
    --graphite: #9aa3a6;
    --rule: #2f3639;
    --green: #8fb3a0;
    --green-deep: #b4d0c1;
    --sheet: #1c2124;
    --sheet-rule: #2f3639;

  }
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem; /* 18px */
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p, li, dd { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }

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

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

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

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.8rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.skip:focus { left: 0.5rem; }

/* ---------- Page frame ---------- */

.frame {
  max-width: calc(var(--measure) + var(--gutter) + 4rem);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.5rem 0 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}

.masthead .home {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.masthead nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.masthead nav a {
  color: var(--graphite);
  text-decoration: none;
}
.masthead nav a:hover,
.masthead nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* Home page: the cover carries the name, so the masthead drops it.
   On desktop the tabs handle navigation and the masthead goes entirely. */
.masthead--home { justify-content: flex-end; }
@media (min-width: 960px) {
  .masthead--home { display: none; }
  .masthead--home + .tabs + main .cover { margin-top: 4rem; }
}

/* ---------- Binder thumb tabs ----------
   Printed index tabs on the right edge of the page. They peek out at rest,
   slide out on hover, and the tab for the section on screen stays pulled. */

.tabs { display: none; }

@media (min-width: 960px) {
  .masthead nav { display: none; }

  .tabs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: fixed;
    right: 0;
    top: 22vh;
    z-index: 10;
  }

  .tab {
    --tab-bg: var(--green);
    display: block;
    width: 3.1rem;
    padding: 1.15rem 0 1.15rem 0.9rem;
    border-radius: 9px 0 0 9px;
    background: var(--tab-bg);
    color: var(--paper);
    text-decoration: none;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,.18), -1px 1px 2px rgba(0,0,0,.12);
    transform: translateX(1.15rem);
    transition: transform 220ms cubic-bezier(.2,.7,.2,1), background-color 220ms ease;
  }
  .tab span { writing-mode: vertical-rl; transform: rotate(180deg); display: block; }

  .tab-samples { --tab-bg: #3e5c4e; }
  .tab-record  { --tab-bg: #57766a; }
  .tab-contact { --tab-bg: #2c3a35; }

  .tab:hover,
  .tab:focus-visible { transform: translateX(0.35rem); color: var(--paper); }
  .tab[aria-current] { transform: translateX(0); }
  .tab:focus-visible { outline-offset: -4px; outline-color: var(--paper); }
}

@media (min-width: 960px) and (prefers-color-scheme: dark) {
  .tab { color: #15191b; }
  .tab:hover, .tab:focus-visible { color: #15191b; }
  .tab-samples { --tab-bg: #8fb3a0; }
  .tab-record  { --tab-bg: #a9c4b6; }
  .tab-contact { --tab-bg: #c9d6cd; }
}

@media (prefers-reduced-motion: reduce) {
  .tab { transition: none; }
}

@media print { .tabs { display: none !important; } }

/* ---------- Sections: reading column with a hanging margin ---------- */

.section {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, var(--measure));
  column-gap: 2rem;
  padding: 3.25rem 0 0;
}

.section > h2 {
  grid-column: 1;
  margin: 0.32rem 0 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--graphite);
  line-height: 1.3;
}

.section > .body { grid-column: 2; }
.section > .body > :first-child { margin-top: 0; }
.section > .body > :last-child { margin-bottom: 0; }

@media (max-width: 760px) {
  .section {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 2.75rem;
  }
  .section > h2 { margin: 0 0 0.75rem; }
  .section > .body { grid-column: 1; }
}

/* ---------- Cover: the manual's title page (the one loud thing) ---------- */

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

.cover {
  margin: 2.5rem 0 0;
  padding: 0 0 0;
}

.cover-band {
  height: 0.9rem;
  background: var(--green);
  /* a printed band: solid colour with a thin keyline under it */
  box-shadow: 0 0.45rem 0 -0.3rem var(--paper), 0 0.5rem 0 -0.3rem var(--green);
  margin-bottom: 3.25rem;
}

.cover-main {
  display: grid;
  padding-top: 0.9rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 2.5rem;
  margin-top: 0.4rem;
}

.cover h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(3.2rem, 1.2rem + 7.6vw, 7.4rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.86;
  color: var(--ink);
}

.cover-sub {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(1.6rem, 1.1rem + 1.7vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--green);
}

.cover-scope {
  max-width: 27rem;
  margin: 1.4rem 0 0;
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--graphite);
}

.cover-fig {
  margin: 0;
  width: clamp(12rem, 22vw, 17rem);
}
.cover-fig img { width: 100%; }
.cover-fig figcaption {
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--graphite);
}

.doc-control {
  width: 100%;
  margin: 3rem 0 0;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.doc-control th,
.doc-control td {
  border: 1px solid var(--ink);
  padding: 0.35rem 0.6rem 0.4rem;
  text-align: left;
  vertical-align: top;
}
.doc-control th {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--graphite);
  border-bottom: 0;
  padding-bottom: 0;
}
.doc-control td { border-top: 0; font-weight: 600; }

@media (max-width: 760px) {
  .cover { margin-top: 1.75rem; }
  .cover-band { margin-bottom: 2.25rem; }
  .cover-main { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .cover-fig { width: min(16rem, 70%); }
}
@media (max-width: 520px) {
  .doc-control thead { display: none; }
  .doc-control, .doc-control tbody, .doc-control tr { display: block; }
  .doc-control td { display: grid; grid-template-columns: 6.5rem 1fr; border-top: 1px solid var(--ink); border-bottom: 0; }
  .doc-control tr td:last-child { border-bottom: 1px solid var(--ink); }
  .doc-control td::before { font-weight: 500; color: var(--graphite); }
  .doc-control td:nth-child(1)::before { content: "Doc. no."; }
  .doc-control td:nth-child(2)::before { content: "Revision"; }
  .doc-control td:nth-child(3)::before { content: "Effective"; }
  .doc-control td:nth-child(4)::before { content: "Location"; }
}

/* One orchestrated moment: the cover band prints in on load. */
@media (prefers-reduced-motion: no-preference) {
  .cover-band { transform-origin: left; animation: print-band 900ms cubic-bezier(.65,0,.2,1) both; }
  @keyframes print-band { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* Revision numbers in the history */
.record .rev {
  display: block;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.85rem;
}

/* ---------- Home: lead, record, writing ---------- */

.lead { font-size: 1.4rem; line-height: 1.42; letter-spacing: -0.012em; }

.record {
  margin: 0;
  padding: 0;
  list-style: none;
}

.record li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  column-gap: 1.25rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}
.record li:last-child { border-bottom: 1px solid var(--rule); }

.record .when {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--graphite);
  padding-top: 0.28rem;
}

.record .what { margin: 0; }
.record .role { display: block; font-weight: 700; letter-spacing: -0.005em; }
.record .org { color: var(--graphite); }
.record .line { display: block; margin-top: 0.15rem; }

@media (max-width: 520px) {
  .record li { grid-template-columns: minmax(0, 1fr); }
  .record .when { padding: 0 0 0.15rem; }
}

.credentials {
  margin: 1.5rem 0 0;
  font-size: 1rem;
  color: var(--graphite);
}

.samples {
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}

.samples li { padding: 1rem 0; border-top: 1px solid var(--rule); }
.samples li:last-child { border-bottom: 1px solid var(--rule); }

.samples a {
  font-family: var(--sans);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.012em;
  text-decoration: none;
}
.samples a:hover { text-decoration: underline; }

.samples .kind {
  display: block;
  margin: 0.1rem 0 0.3rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--graphite);
}
.samples p { margin: 0; }

.contact-list { margin: 0; padding: 0; list-style: none; }
.contact-list li { margin: 0.2rem 0; }

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

.colophon {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, var(--measure));
  column-gap: 2rem;
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--graphite);
}
.colophon p { grid-column: 2; margin: 0 0 0.35rem; }
@media (max-width: 760px) {
  .colophon { grid-template-columns: minmax(0, 1fr); }
  .colophon p { grid-column: 1; }
}

/* ---------- Writing sample pages ---------- */

.sample-head { padding: 3rem 0 0; }

.sample-head .crumb {
  font-family: var(--sans);
  font-size: 0.9rem;
}

.sample-head h1 {
  margin: 0.6rem 0 0.4rem;
  font-family: var(--sans);
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.sample-head .kind {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--graphite);
}

.notes { margin: 0; padding-left: 1.1rem; }
.notes li { margin: 0.35rem 0; }
.notes li::marker { color: var(--graphite); }

.tools { font-family: var(--sans); font-size: 0.95rem; color: var(--graphite); }

/* The document itself sits on its own sheet, set in the sans,
   so the sample reads as an artifact rather than as site copy. */

.sheet-wrap { padding: 3rem 0 0; }

.sheet-label {
  margin: 0 0 0.75rem calc(var(--gutter) + 2rem);
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--graphite);
}

.sheet {
  margin-left: calc(var(--gutter) + 2rem);
  max-width: 44rem;
  background: var(--sheet);
  border: 1px solid var(--sheet-rule);
  border-top: 5px solid var(--green);
  padding: 2.25rem 2.5rem 2.5rem;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
}

@media (max-width: 760px) {
  .sheet-label { margin-left: 0; }
  .sheet { margin-left: 0; padding: 1.5rem 1.15rem 1.75rem; }
}

.sheet h2 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
}
.sheet h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.sheet p { margin: 0 0 0.9rem; }

.sheet ol.steps { margin: 1.5rem 0 0; padding: 0; list-style: none; counter-reset: step; }
.sheet ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.1rem;
  margin: 0 0 1.4rem;
}
.sheet ol.steps > li::before {
  content: counter(step) ".";
  position: absolute;
  left: 0;
  top: -0.08rem;
  font-weight: 700;
  font-size: 1.12rem;
  font-variant-numeric: tabular-nums;
}
.sheet ol.steps > li > .step-title { display: block; font-weight: 700; margin-bottom: 0.35rem; }

.sheet ul { margin: 0.35rem 0 0.6rem; padding-left: 1.15rem; }
.sheet ul li { margin: 0.3rem 0; }
.sheet ol.plain { margin: 0.35rem 0 0.8rem; padding-left: 1.4rem; }
.sheet ol.plain li { margin: 0.3rem 0; }
.sheet ol.plain ol { list-style: lower-alpha; margin: 0.25rem 0; }

.sheet figure { margin: 0.75rem 0 0.9rem; }
.sheet figure img {
  border: 1px solid var(--sheet-rule);
  background: #fff;
}
.sheet figure.small img { max-width: 18rem; }
.sheet figure.button img { max-width: 14rem; border: 0; }
.sheet figure.photo img { max-width: 20rem; }

.sheet .inline-icon {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  vertical-align: -0.3em;
  margin: 0 0.1em;
}

.sheet .note { margin: 0.4rem 0 0.4rem; }
.sheet .tip { margin-top: 1.25rem; padding-top: 0.9rem; border-top: 1px solid var(--sheet-rule); }

.sheet table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.5rem;
  font-size: 0.92rem;
}
.sheet th, .sheet td {
  border: 1px solid var(--sheet-rule);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.sheet thead th { font-weight: 700; }
.sheet caption {
  caption-side: top;
  text-align: left;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--sheet-rule);
  border-bottom: 0;
}

@media (max-width: 560px) {
  .sheet .table-scroll { overflow-x: auto; }
  .sheet table { min-width: 30rem; }
}

.pager {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 44rem);
  column-gap: 2rem;
  padding: 3rem 0 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.pager div { grid-column: 2; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pager span { display: block; color: var(--graphite); font-size: 0.85rem; }
.pager .next { text-align: right; margin-left: auto; }
@media (max-width: 760px) {
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager div { grid-column: 1; }
}

/* ---------- Print: the site prints like a clean document ---------- */

@media print {
  :root { --paper: #fff; --ink: #000; --graphite: #444; --rule: #bbb; --sheet: #fff; }
  .masthead nav, .skip, .pager { display: none; }
  .cover-band { animation: none; }
  .sheet { border: 0; padding: 0; margin-left: 0; }
  a { color: inherit; }
}