/* ==========================================================================
   InventHelp — Working Papers
   Site 4 · muted stone, single claret accent, ruled annual-report rhythm
   ========================================================================== */

/* --- 1. Reset ------------------------------------------------------------ */

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

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

body,
h1, h2, h3, p, figure, figcaption, blockquote, ul, ol, li, dl, dd, dt {
  margin: 0;
  padding: 0;
}

ul, ol { list-style: none; }

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

a { color: inherit; }

/* --- 2. Tokens ----------------------------------------------------------- */

:root {
  --stone:       #f5f4f0;
  --stone-panel: #ebe8e0;
  --stone-deep:  #dedad0;
  --rule:        #cfcabd;
  --rule-fine:   #e0dcd2;

  --ink:         #22241f;
  --ink-mid:     #4d5049;
  --ink-soft:    #6d7068;

  --claret:      #6d2230;
  --claret-lift: #8d3947;

  --night:       #1c1e1a;
  --night-mid:   #2a2d27;
  --night-text:  #c9c6bb;

  --serif: 'Libre Baskerville', 'Baskerville', Georgia, 'Times New Roman', serif;
  --sans:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --mono:  'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --rail:    12rem;
  --railgap: 3.25rem;
  --measure: 41rem;
  --gutter:  1.6rem;
  --sheet:   74rem;

  --step-2: 0.68rem;
  --step-1: 0.79rem;
  --step0:  1.0rem;
  --step1:  1.16rem;
  --step2:  1.42rem;
  --step3:  1.85rem;
  --step4:  2.55rem;
}

/* --- 3. Base ------------------------------------------------------------- */

body {
  background: var(--stone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step0);
  line-height: 1.72;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--claret);
  color: var(--stone);
}

a {
  color: var(--claret);
  text-decoration: none;
  box-shadow: inset 0 -1px 0 0 rgba(109, 34, 48, 0.35);
}

a:hover {
  color: var(--claret-lift);
  box-shadow: inset 0 -2px 0 0 var(--claret-lift);
}

a:focus-visible {
  outline: 2px solid var(--claret);
  outline-offset: 3px;
  box-shadow: none;
}

strong { font-weight: 600; }

.wrap {
  width: 100%;
  max-width: var(--sheet);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Shared small-caps label treatment */

.kicker,
.eyebrow,
.byline,
.plate-label,
.pull cite,
.ledger-key,
.endnote {
  font-family: var(--sans);
  font-variant-caps: all-small-caps;
  font-feature-settings: 'c2sc' 1, 'smcp' 1;
  letter-spacing: 0.13em;
  font-weight: 600;
}

/* --- 4. Masthead --------------------------------------------------------- */

.site-header {
  background: var(--stone);
  border-top: 3px solid var(--claret);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 3rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  flex: 0 0 auto;
  line-height: 0;
  box-shadow: none;
}

.brand img { width: 196px; height: auto; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 2.1rem;
}

.site-nav a {
  font-family: var(--sans);
  font-size: var(--step-1);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-mid);
  box-shadow: none;
  padding-bottom: 0.2em;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }

.site-nav a[aria-current='page'] {
  color: var(--claret);
  border-bottom-color: var(--claret);
}

/* --- 5. Cover ------------------------------------------------------------ */

.cover {
  border-bottom: 1px solid var(--rule);
  padding: 3.4rem 0 3.6rem;
}

.cover-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: 3.4rem;
  align-items: center;
}

.kicker {
  display: block;
  font-size: var(--step-1);
  color: var(--claret);
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: var(--step4);
  line-height: 1.18;
  letter-spacing: -0.014em;
  text-wrap: balance;
}

.standfirst {
  font-size: var(--step1);
  line-height: 1.62;
  color: var(--ink-mid);
  margin-top: 1.4rem;
  max-width: 34rem;
}

.byline {
  display: inline-block;
  font-size: var(--step-1);
  color: var(--ink-soft);
  margin-top: 1.9rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.cover-figure { margin: 0; }

.cover-frame {
  width: 100%;
  aspect-ratio: 17 / 9;
  overflow: hidden;
  background: var(--stone-panel);
  border: 1px solid var(--rule);
  padding: 0.5rem;
}

.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* --- 6. Article ---------------------------------------------------------- */

.article {
  width: 100%;
  max-width: calc(var(--rail) + var(--railgap) + var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 3.2rem var(--gutter) 4rem;
}

.summary {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  gap: 0 var(--railgap);
  padding-bottom: 0.6rem;
}

.summary > * { grid-column: 2; }

.summary > .eyebrow { grid-column: 1; grid-row: 1; }

.summary p { margin-bottom: 1.35rem; }

.summary p:first-of-type {
  font-family: var(--serif);
  font-size: var(--step1);
  line-height: 1.62;
  color: var(--ink);
}

.eyebrow {
  font-size: var(--step-1);
  color: var(--claret);
  line-height: 1.5;
}

.chapter {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  gap: 0 var(--railgap);
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
  margin-top: 3.1rem;
}

.chapter > * { grid-column: 2; }

.chapter > .eyebrow {
  grid-column: 1;
  grid-row: 1;
  padding-top: 0.55rem;
}

.chapter > h2 {
  grid-row: 1;
  font-family: var(--serif);
  font-weight: 700;
  font-size: var(--step3);
  line-height: 1.26;
  letter-spacing: -0.01em;
  margin-bottom: 1.15rem;
  text-wrap: balance;
}

.chapter > p { margin-bottom: 1.35rem; }

.chapter > h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: var(--step2);
  line-height: 1.32;
  margin: 1.9rem 0 0.85rem;
}

/* Lists */

.chapter > ul,
.chapter > ol { margin: 0 0 1.6rem; }

.chapter li {
  position: relative;
  padding-left: 2.1rem;
  margin-bottom: 0.7rem;
}

.chapter > ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 1.1rem;
  height: 1px;
  background: var(--claret);
}

.chapter > ol { counter-reset: item; }

.chapter > ol li { counter-increment: item; }

.chapter > ol li::before {
  content: counter(item, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--claret);
}

/* Ledger: ruled figures panel */

.ledger {
  grid-column: 1 / -1;
  background: var(--stone-panel);
  border-top: 2px solid var(--claret);
  padding: 1.5rem 1.7rem 0.6rem;
  margin: 0.6rem 0 2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.6rem;
}

.ledger li {
  padding-left: 0;
  margin: 0;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.ledger li::before { content: none; }

.ledger-key {
  display: block;
  font-family: var(--mono);
  font-variant-caps: normal;
  font-feature-settings: normal;
  font-size: var(--step1);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--claret);
  margin-bottom: 0.15rem;
}

.ledger-note {
  display: block;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-mid);
}

/* Plates */

.chapter > figure,
.article > figure {
  grid-column: 1 / -1;
  margin: 2.2rem 0 2.4rem;
}

.plate-frame {
  width: 100%;
  overflow: hidden;
  background: var(--stone-panel);
  border: 1px solid var(--rule);
  padding: 0.5rem;
}

.plate-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.ratio-wide  { aspect-ratio: 3 / 2; }
.ratio-broad { aspect-ratio: 16 / 9; }
.ratio-tall  { aspect-ratio: 4 / 5; }

.plate-tall { max-width: 27rem; margin-left: auto; margin-right: auto; }

figcaption {
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
  margin-top: 0.75rem;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
}

.plate-label {
  flex: 0 0 auto;
  font-size: var(--step-1);
  color: var(--claret);
}

/* Pull quote */

.pull {
  grid-column: 1 / -1;
  background: var(--stone-panel);
  border-left: 3px solid var(--claret);
  padding: 1.7rem 2rem 1.6rem;
  margin: 2.3rem 0 2.5rem;
}

.pull p {
  font-family: var(--serif);
  font-size: var(--step2);
  line-height: 1.44;
  letter-spacing: -0.008em;
  color: var(--ink);
  margin: 0;
}

.pull cite {
  display: block;
  font-style: normal;
  font-size: var(--step-1);
  color: var(--ink-soft);
  margin-top: 0.95rem;
}

/* Closing line */

.endnote {
  grid-column: 2;
  font-size: var(--step-1);
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  margin-top: 2.6rem;
  padding-top: 1.1rem;
}

/* --- 7. Footer ----------------------------------------------------------- */

.site-footer {
  background: var(--night);
  color: var(--night-text);
  padding: 3.2rem 0 2.4rem;
  margin-top: 1rem;
}

.site-footer a { color: var(--night-text); box-shadow: none; }

.site-footer a:hover { color: #fff; }

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.3rem 3rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--night-mid);
}

.footer-mark {
  line-height: 0;
  box-shadow: none;
}

.footer-mark img {
  width: 172px;
  height: auto;
  filter: grayscale(1) brightness(0) invert(1) opacity(0.86);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.9rem;
}

.footer-nav a {
  font-family: var(--sans);
  font-size: var(--step-1);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Injected three-column link block */

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.4rem 3rem;
  padding: 2.4rem 0 2rem;
  border-bottom: 1px solid var(--night-mid);
}

.footer-cols h2 {
  font-family: var(--sans);
  font-variant-caps: all-small-caps;
  font-feature-settings: 'c2sc' 1, 'smcp' 1;
  letter-spacing: 0.13em;
  font-weight: 600;
  font-size: var(--step-1);
  color: #efece4;
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--night-mid);
}

.footer-cols ul li {
  margin-bottom: 0.55rem;
  padding-left: 0;
}

.footer-cols a {
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.5;
  color: #a9a69c;
}

.footer-cols a:hover { color: #fff; text-decoration: underline; }

.copyright {
  font-family: var(--sans);
  font-size: var(--step-2);
  letter-spacing: 0.08em;
  color: #8b887f;
  padding-top: 1.6rem;
}

/* --- 8. Responsive ------------------------------------------------------- */

@media (max-width: 1100px) {
  :root { --rail: 9.5rem; --railgap: 2.2rem; }
}

@media (max-width: 900px) {
  :root {
    --step4: 2.1rem;
    --step3: 1.66rem;
    --gutter: 1.4rem;
  }

  .cover { padding: 2.6rem 0 2.8rem; }

  .cover-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.1rem;
  }

  .cover-frame { aspect-ratio: 16 / 9; }

  .standfirst { max-width: none; }

  .article {
    max-width: 46rem;
    padding-top: 2.5rem;
  }

  .summary,
  .chapter {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .summary > *,
  .chapter > *,
  .endnote { grid-column: 1; }

  .summary > .eyebrow,
  .chapter > .eyebrow {
    grid-row: auto;
    padding-top: 0;
    margin-bottom: 0.6rem;
  }

  .chapter > h2 { grid-row: auto; }

  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root {
    --step0: 0.99rem;
    --step4: 1.82rem;
    --step3: 1.44rem;
    --step2: 1.24rem;
    --step1: 1.08rem;
    --gutter: 1.15rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .brand img { width: 164px; }

  .site-nav { gap: 0.3rem 1.3rem; }

  .site-nav a { font-size: 0.76rem; }

  .cover-frame { aspect-ratio: 3 / 2; padding: 0.35rem; }

  .article { padding-top: 2rem; }

  .chapter { margin-top: 2.4rem; padding-top: 1.6rem; }

  .ledger {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.3rem 1.2rem 0.4rem;
  }

  .plate-frame { padding: 0.35rem; }

  .plate-tall { max-width: none; }

  .ratio-tall { aspect-ratio: 4 / 5; }

  figcaption { flex-direction: column; gap: 0.25rem; }

  .pull { padding: 1.3rem 1.3rem 1.2rem; margin: 1.9rem 0 2.1rem; }

  .footer-top { flex-direction: column; align-items: flex-start; }

  .footer-cols { grid-template-columns: minmax(0, 1fr); gap: 1.8rem; }
}

/* --- 9. Motion & print --------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-nav,
  .site-footer { display: none; }

  body { background: #fff; }

  .chapter { break-inside: avoid-page; }
}
