/* ------------------------------------------------------------------
   Fonts: self-hosted, no third-party requests.
   Drop IBM Plex Sans .woff2 files (SIL Open Font License) into /fonts
   and uncomment. Until then the system font stack is used.
------------------------------------------------------------------- */
/*
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/IBMPlexSans-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
*/

:root {
  --paper:   #FDFDFB;   /* sheet */
  --mat:     #EEF1EC;   /* page background, like a cutting mat */
  --grid:    #DCE2DA;   /* mat grid lines */
  --ink:     #1B2330;   /* text */
  --pencil:  #5E6772;   /* secondary text */
  --rule:    #C9CFC7;   /* borders */
  --accent:  #2E6B4E;   /* cutting-mat green: links, sheet numbers */

  --font: "IBM Plex Sans", "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 62ch;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 600; }
h2 { font-size: 2rem; letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; margin: 1.4rem 0 0.5rem; }
h3:first-child { margin-top: 0; }
p, ul { margin: 0 0 0.8rem; max-width: var(--measure); }
ul { padding-left: 1.2rem; }
li { margin-bottom: 0.45rem; }
li::marker { color: var(--pencil); }

/* ---------------- Menu bar ---------------- */
.site-nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 0.75rem clamp(1rem, 4vw, 2.5rem);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.nav-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; max-width: none; }
.site-nav li { margin: 0; }
.site-nav ul a { color: var(--ink); text-decoration: none; padding: 0.25rem 0; border-bottom: 2px solid transparent; }
.site-nav ul a:hover { border-bottom-color: var(--accent); }

/* ---------------- Sheets ---------------- */
main { padding: clamp(1rem, 4vw, 3rem) clamp(0.75rem, 4vw, 3rem); }

.sheet {
  display: grid;
  grid-template-rows: 1fr auto;
  max-width: 1100px;
  min-height: min(85vh, 780px);
  margin: 0 auto 2rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  outline: 1px solid var(--rule);       /* double border, like a drawing frame */
  outline-offset: -10px;
}
.sheet-body { padding: clamp(1.5rem, 4vw, 3.25rem); }
.print-only, .sn-print { display: none; }

/* Title block: the drawing-sheet convention, bottom right */
.title-block {
  justify-self: end;
  display: grid;
  grid-template-columns: auto minmax(10rem, 1fr) auto auto;
  margin: 0 10px 10px 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  font-size: 0.8rem;
  max-width: calc(100% - 20px);
}
.title-block > div {
  padding: 0.35rem 0.75rem 0.45rem;
  border-right: 1px solid var(--rule);
  white-space: nowrap;
}
.title-block > div:last-child { border-right: 0; }
.tb-label { display: block; font-size: 0.68rem; color: var(--pencil); }
.sheet-no { color: var(--accent); font-weight: 600; }

/* ---------------- Cover ---------------- */
.cover-body { display: flex; flex-direction: column; justify-content: center; }
.cover-kicker { color: var(--pencil); margin-bottom: 1rem; }
.cover h1 { font-size: clamp(3rem, 9vw, 6.5rem); letter-spacing: -0.03em; line-height: 0.95; margin-bottom: 1.5rem; }
.cover-line { font-size: 1.2rem; }
.cover-pitch { color: var(--pencil); max-width: 48ch; }

/* ---------------- Contents ---------------- */
.toc { list-style: none; padding: 0; margin-top: 2rem; max-width: 52rem; counter-reset: none; }
.toc li {
  display: grid; grid-template-columns: 1fr auto; column-gap: 1rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--rule); margin: 0;
}
.toc a { color: var(--ink); text-decoration: none; font-size: 1.2rem; font-weight: 600; }
.toc-note { grid-column: 1; color: var(--pencil); font-size: 0.95rem; }
.toc-page { grid-column: 2; grid-row: 1; color: var(--accent); font-weight: 600; }

/* ---------------- About ---------------- */
.about { display: grid; grid-template-columns: minmax(180px, 280px) 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.about h2 { margin-bottom: 1.25rem; }
.portrait { margin: 0; }
.portrait .fig-placeholder { aspect-ratio: 4 / 5; }

/* ---------------- Samples ---------------- */
.sample-head { margin-bottom: 1.75rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.sample-meta { color: var(--pencil); margin: 0.4rem 0 0; }
.sample-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }

.fig { margin: 0; }
.fig img, .portrait img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.fig-placeholder {
  display: grid; place-items: center;
  aspect-ratio: 4 / 3;
  border: 1.5px dashed var(--rule);
  color: var(--pencil); font-size: 0.9rem; text-align: center; padding: 1rem;
}
figcaption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--pencil); max-width: 60ch; }
.fig-no { color: var(--ink); font-weight: 600; }

/* Text above, two figures side by side below */
.sample-stack { display: grid; gap: 1.25rem; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.fig-pair img { aspect-ratio: 16 / 9; object-fit: contain; background: #fff; }

/* ---------------- Contact ---------------- */
.contact-body { display: flex; flex-direction: column; justify-content: center; }
.contact-lead { font-size: 1.2rem; margin: 1rem 0 2rem; }
.contact-list { margin: 0; display: grid; gap: 0; max-width: 40rem; }
.contact-list > div { display: grid; grid-template-columns: 7rem 1fr; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.contact-list dt { color: var(--pencil); }
.contact-list dd { margin: 0; overflow-wrap: anywhere; }

/* ---------------- Small screens ---------------- */
@media (max-width: 720px) {
  .about, .sample-grid, .fig-pair { grid-template-columns: 1fr; }
  .portrait { max-width: 240px; }
  .sheet { min-height: 0; }
  .title-block { grid-template-columns: 1fr auto; justify-self: stretch; }
  .title-block > div:nth-child(1), .title-block > div:nth-child(3) { display: none; }
}

/* ---------------- Print / PDF: one landscape sheet per page ---------------- */
@page { size: 11in 8.5in; margin: 0; }

@media print {
  html, body { background: var(--paper); }
  body { font-size: 11pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-nav { display: none; }
  .print-only { display: grid; }
  .sn-print { display: inline; }
  .sn-screen { display: none; }
  main { padding: 0; }
  .sheet {
    width: 11in; height: 8.5in; max-width: none; min-height: 0;
    margin: 0; border: 0;
    outline-offset: -0.3in;
    break-after: page; page-break-after: always;
    overflow: hidden;
  }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .sheet-body { padding: 0.65in 0.75in 0.2in; }
  .title-block { margin: 0 0.3in 0.3in 0; font-size: 8pt; }
  .tb-label { font-size: 6.5pt; }
  h2 { font-size: 22pt; }
  .cover h1 { font-size: 54pt; }
  .fig-placeholder, .fig img { max-height: 4.6in; }
  .fig img { object-fit: contain; }
  .fig-pair img { max-height: 2.9in; }
  .sample-stack { gap: 0.6rem; }
  a { text-decoration: none; }
}
