/* ==========================================================================
   InventHelp — Site 5
   "Paper": a printed technical pamphlet. Laid-paper stock, an inset sheet,
   hairline keylines, mono folios and plate captions, generous margins.
   ========================================================================== */

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

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

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

body,
h1, h2, h3, h4, p,
figure, figcaption, blockquote,
ul, ol, li, dl, dd { 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 {
  --ink:        #17150f;
  --ink-mid:    #4d483c;
  --ink-soft:   #736c5a;
  --stock:      #e7e2d3;
  --sheet:      #faf8f1;
  --sheet-2:    #f1ecdd;
  --rule:       #cec6b0;
  --rule-soft:  #e0d9c6;
  --oxide:      #a03418;
  --oxide-deep: #7a2610;

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

  --page:      64rem;   /* width of the printed sheet */
  --mark:      5.5rem;  /* left margin column holding section marks */
  --mark-gap:  2.5rem;
  --sheet-pad: 4.25rem;
  --gutter:    1.5rem;

  --t-2: 0.68rem;
  --t-1: 0.75rem;
  --t0:  1.05rem;
  --t1:  1.24rem;
  --t2:  1.5rem;
  --t3:  1.95rem;
  --t4:  2.7rem;
}

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

body {
  background-color: var(--stock);
  background-image:
    repeating-linear-gradient(0deg,  rgba(23, 21, 15, 0.030) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(23, 21, 15, 0.018) 0 1px, transparent 1px 5px);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--t0);
  line-height: 1.72;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 3rem;
}

::selection { background: var(--oxide); color: var(--sheet); }

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

a:hover { color: var(--ink); text-decoration-color: var(--oxide); }

a:focus-visible {
  outline: 2px solid var(--oxide);
  outline-offset: 3px;
  text-decoration: none;
}

strong { font-weight: 600; }

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

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

.site-header {
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 3px 0 -2px var(--rule);   /* second hairline: a printed double rule */
  margin-bottom: 2.6rem;
}

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

.brand {
  flex: 0 0 auto;
  line-height: 0;
  text-decoration: none;
}

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

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 1.8rem;
  counter-reset: navitem;
}

.site-nav a {
  font-family: var(--mono);
  font-weight: 400;
  font-size: var(--t-1);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mid);
  text-decoration: none;
  padding-bottom: 0.25em;
  border-bottom: 2px solid transparent;
  counter-increment: navitem;
}

.site-nav a::before {
  content: counter(navitem, decimal-leading-zero) '\2009/\2009';
  color: var(--oxide);
}

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

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

/* --- 5. The sheet -------------------------------------------------------- */

.sheet {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  background-color: var(--sheet);
  background-image:
    repeating-linear-gradient(135deg, rgba(23, 21, 15, 0.014) 0 1px, transparent 1px 7px);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 48px -40px rgba(23, 21, 15, 0.55);
  padding: 0 var(--sheet-pad) 3.4rem;
}

/* Running head across the top of the sheet, printed-pamphlet style */

.running-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 3.2rem;
}

.running-head .folio { color: var(--oxide); }

/* --- 6. Title block ------------------------------------------------------ */

.title-block {
  max-width: 46rem;
  padding-bottom: 2.6rem;
  border-bottom: 3px double var(--rule);
}

.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--oxide);
  border: 1px solid var(--oxide);
  padding: 0.3em 0.7em 0.25em;
  margin-bottom: 1.6rem;
}

h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t4);
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
  max-width: 20ch;
}

.standfirst {
  font-size: var(--t1);
  line-height: 1.58;
  color: var(--ink-mid);
  margin-top: 1.4rem;
  max-width: 54ch;
}

.byline {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 1.9rem;
}

/* --- 7. Article ---------------------------------------------------------- */

.article {
  display: grid;
  grid-template-columns:
    [mark-start] var(--mark)
    [mark-end]   var(--mark-gap)
    [text-start] minmax(0, 1fr) [text-end];
  padding-top: 2.9rem;
}

.article > * { grid-column: text-start / text-end; }

.article > p { margin-bottom: 1.45rem; max-width: 68ch; }

.article > ul,
.article > ol { margin-bottom: 1.7rem; max-width: 68ch; }

.lead {
  font-size: var(--t1);
  line-height: 1.62;
  color: var(--ink);
}

.lead strong { font-weight: 600; }

/* Section marks: a hairline running out into the left margin, the section
   number sitting under it, the label aligned with the text column. */

.eyebrow {
  grid-column: mark-start / text-end;
  display: flex;
  align-items: baseline;
  border-top: 1px solid var(--rule);
  padding-top: 0.95rem;
  margin-top: 3rem;
  margin-bottom: 0.9rem;
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.eyebrow .sect {
  flex: 0 0 calc(var(--mark) + var(--mark-gap));
  color: var(--oxide);
  letter-spacing: 0.1em;
}

.article > h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t3);
  line-height: 1.19;
  letter-spacing: -0.018em;
  margin-bottom: 1.15rem;
  text-wrap: balance;
  max-width: 26ch;
}

.article > h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t2);
  line-height: 1.25;
  margin: 2.2rem 0 0.85rem;
}

/* Lists: mono markers in the margin of the text column */

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

.article ul li::before {
  content: '\25AA';
  position: absolute;
  left: 0.15rem;
  top: 0;
  color: var(--oxide);
  font-size: 0.8em;
  line-height: 2.1;
}

.article ol { counter-reset: item; }

.article ol li { counter-increment: item; }

.article ol li::before {
  content: counter(item, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--oxide);
  line-height: 2.4;
}

/* --- 8. Plates ----------------------------------------------------------- */

.plate {
  grid-column: mark-start / text-end;
  margin: 2.8rem 0 3rem;
}

.plate-inset { grid-column: text-start / text-end; }

.plate .mount {
  border: 1px solid var(--rule);
  padding: 0.55rem;
  background: var(--sheet-2);
}

.plate img { width: 100%; }

.plate figcaption {
  font-family: var(--mono);
  font-size: var(--t-2);
  line-height: 1.6;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--rule-soft);
  max-width: 58ch;
}

.plate figcaption b {
  font-weight: 500;
  color: var(--oxide);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Portrait plates sit beside their caption */

.plate-side {
  grid-column: mark-start / text-end;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0 2.2rem;
  align-items: end;
}

.plate-side figcaption {
  margin-top: 0;
  padding-top: 0.7rem;
  padding-bottom: 0.4rem;
}

/* Cover plate under the title block */

.cover-plate {
  margin: 2.9rem 0 0;
}

.cover-plate .mount {
  border: 1px solid var(--rule);
  padding: 0.6rem;
  background: var(--sheet-2);
}

.cover-plate .mount > div {
  aspect-ratio: 16 / 7;
  overflow: hidden;
  background: var(--stock);
}

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

.cover-plate figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem 1.5rem;
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 0.8rem;
}

.cover-plate figcaption span:first-child { color: var(--oxide); }

/* --- 9. Pull quotes ------------------------------------------------------ */

.article > blockquote {
  grid-column: mark-start / text-end;
  margin: 3rem 0 3.2rem;
  padding: 1.7rem 0 1.5rem;
  border-top: 3px double var(--rule);
  border-bottom: 1px solid var(--rule);
}

.article > blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: var(--t2);
  line-height: 1.44;
  color: var(--ink);
  max-width: 46ch;
  margin: 0;
}

.article > blockquote .attrib {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: var(--t-2);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--oxide);
  margin-top: 1.05rem;
}

/* --- 10. Closing --------------------------------------------------------- */

.endmark {
  grid-column: mark-start / text-end;
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.endmark::before {
  content: '\25AA';
  color: var(--oxide);
  margin-right: 0.7em;
}

/* --- 11. Colophon / footer ----------------------------------------------- */

.site-footer {
  max-width: var(--page);
  margin: 2.8rem auto 0;
  background: var(--ink);
  color: #d9d2bf;
  border: 1px solid var(--ink);
  padding: 2.8rem 0 2.2rem;
}

.site-footer .wrap { padding: 0 var(--sheet-pad); }

.site-footer a { color: #d9d2bf; text-decoration-color: rgba(217, 210, 191, 0.35); }

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

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.3rem 2.5rem;
  padding-bottom: 2.1rem;
  border-bottom: 1px solid rgba(217, 210, 191, 0.22);
}

.footer-mark {
  line-height: 0;
  text-decoration: none;
}

.footer-mark img {
  width: 170px;
  height: auto;
  filter: invert(1) grayscale(1) contrast(1.1) brightness(1.08);
}

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

.footer-nav a {
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.2em;
}

.footer-nav a:hover { border-bottom-color: #d0522f; }

/* Injected link columns */

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.4rem 2.8rem;
  padding: 2.3rem 0 2.1rem;
}

.footer-cols h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: var(--t-2);
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: #fff;
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(217, 210, 191, 0.28);
}

.footer-cols ul li {
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.footer-cols a {
  font-family: var(--sans);
  font-size: 0.81rem;
  color: rgba(217, 210, 191, 0.86);
  text-decoration: none;
}

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

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  border-top: 1px solid rgba(217, 210, 191, 0.22);
  padding-top: 1.4rem;
  font-family: var(--mono);
  font-size: var(--t-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(217, 210, 191, 0.7);
}

/* --- 12. Responsive ------------------------------------------------------ */

@media (max-width: 1080px) {
  :root { --sheet-pad: 3rem; --mark: 4rem; --mark-gap: 1.8rem; }
}

@media (max-width: 900px) {
  :root {
    --t4: 2.25rem;
    --t3: 1.72rem;
    --sheet-pad: 2.2rem;
    --mark: 2.4rem;
    --mark-gap: 1.2rem;
  }

  .site-header { margin-bottom: 1.8rem; }
  .running-head { margin-bottom: 2.4rem; }
  .cover-plate .mount > div { aspect-ratio: 16 / 9; }
  .plate-side { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .plate-side figcaption { margin-top: 0.85rem; }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root {
    --t0: 1.01rem;
    --t1: 1.14rem;
    --t2: 1.3rem;
    --t3: 1.5rem;
    --t4: 1.92rem;
    --gutter: 1rem;
    --sheet-pad: 1.25rem;
    --mark: 0rem;
    --mark-gap: 0rem;
  }

  body { line-height: 1.68; padding-bottom: 0; }

  .sheet { border-left: 0; border-right: 0; }

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

  .brand img { width: 168px; }

  .site-nav { gap: 0.35rem 1.15rem; }

  .site-nav a { font-size: 0.7rem; letter-spacing: 0.03em; }

  h1 { max-width: none; }

  .article > h2 { max-width: none; }

  .eyebrow {
    display: block;
    margin-top: 2.4rem;
  }

  .eyebrow .sect {
    display: block;
    margin-bottom: 0.25rem;
  }

  .plate,
  .plate-side { margin: 2.1rem 0 2.3rem; }

  .plate .mount,
  .cover-plate .mount { padding: 0.35rem; }

  .cover-plate .mount > div { aspect-ratio: 3 / 2; }

  .article > blockquote { margin: 2.3rem 0 2.5rem; padding-top: 1.3rem; }

  .site-footer {
    margin-top: 0;
    padding: 2.2rem 0 1.8rem;
  }

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

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

/* --- 13. 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 {
  body { background: #fff; }
  .site-nav, .site-footer { display: none; }
  .sheet { border: 0; box-shadow: none; }
}
