/* Envelope Field Notes website: article and library pages.
   Tokens from the design system (Envelope Field Notes/project/tokens.json). Sheet ground, ink text,
   square corners, no shadows, gradients or glows. One load colour per page, set by the template as --load/--tint. */
:root {
  --sheet: #F6F7F4; --ink: #1C2633; --graphite: #4A5666; --rule: #C9CEC6; --marker: #B8322A;
  --load: #1C2633; --tint: #C8E2BE; --air-tint: #C8E2BE;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif; --sans: Barlow, Arial, sans-serif; --hand: Kalam, cursive;
  --measure: 44rem;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sheet); color: var(--ink); font: 400 1.125rem/1.65 var(--sans); font-variant-numeric: tabular-nums; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--sheet); padding: 8px 12px; z-index: 9; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cap { font-size: .875rem; color: var(--graphite); line-height: 1.45; }

/* header and footer */
header.site, footer.site { max-width: 72rem; margin: 0 auto; padding: 20px 16px; }
header.site { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--ink); }
header.site nav a { font: 600 1rem/1 var(--cond); text-transform: uppercase; letter-spacing: .02em; text-decoration: none; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.wm-name { display: block; font: 600 1.15rem/1 var(--cond); text-transform: uppercase; }
.wm-by { display: block; font: 400 .8rem/1.2 var(--sans); color: var(--graphite); margin-top: 3px; text-transform: none; }
footer.site { border-top: 2px solid var(--ink); margin-top: 64px; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.loadtag { display: inline-flex; align-items: center; gap: 8px; font: 600 1.15rem/1 var(--cond); text-transform: uppercase; }
.loadtag.sm { font-size: 1rem; }
.ref { font-size: .9rem; color: var(--graphite); }
.draft { max-width: 72rem; margin: 0 auto; padding: 10px 16px; border-bottom: 2px solid var(--marker); color: var(--marker); font-size: .95rem; }

/* article head */
main { max-width: 72rem; margin: 0 auto; padding: 0 16px; }
.a-head { max-width: 52rem; padding: 40px 0 28px; border-bottom: 1px solid var(--ink); }
.a-id { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font: 600 clamp(2.4rem, 6vw, 4.2rem)/.98 var(--cond); text-transform: uppercase; margin: 0; }
.hl { background: linear-gradient(var(--tint), var(--tint)) no-repeat 0 87%/100% 37%; color: inherit; padding: 0 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.dek { font-size: 1.3rem; line-height: 1.5; margin: 18px 0 10px; max-width: var(--measure); }
.byline { font-size: .9rem; color: var(--graphite); margin: 0; }

/* layout: contents + body */
.a-grid { display: grid; grid-template-columns: 1fr; gap: 24px; padding-top: 28px; }
@media (min-width: 64rem) { .a-grid { grid-template-columns: 14rem minmax(0, 1fr); gap: 48px; } .toc { position: sticky; top: 24px; align-self: start; } }
.toc h2 { font: 600 .95rem/1 var(--cond); text-transform: uppercase; margin: 0 0 10px; color: var(--graphite); }
.toc ol { margin: 0; padding-left: 1.2rem; font-size: .92rem; line-height: 1.45; }
.toc li { margin-bottom: 6px; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.a-body { max-width: var(--measure); min-width: 0; }
.a-body h2 { font: 600 2rem/1.05 var(--cond); text-transform: uppercase; margin: 52px 0 14px; padding-top: 12px; border-top: 2px solid var(--ink); }
.a-body h3 { font: 600 1.4rem/1.15 var(--cond); text-transform: uppercase; margin: 32px 0 8px; }
.a-body p, .a-body li { max-width: var(--measure); }
.a-body ul, .a-body ol { padding-left: 1.4rem; }
.a-body li { margin-bottom: 6px; }
sup.cite { font-size: .72em; line-height: 0; }
sup.cite a { text-decoration: none; color: var(--graphite); }
code { font: inherit; background: var(--rule); padding: 0 4px; }
.fieldnote { font: 400 1.5rem/1.35 var(--hand); color: var(--marker); text-transform: lowercase; margin: 28px 0; }

/* boxes: square, ink lines, no shadows */
.box { border: 1px solid var(--ink); padding: 18px 22px; margin: 28px 0; }
.box-h { font: 600 1.1rem/1 var(--cond); text-transform: uppercase; margin: 0 0 10px; border: 0; padding: 0; }
.box p:last-child, .box ul:last-child { margin-bottom: 0; }
.summary { border: 2px solid var(--ink); }
.callout { border-left: 6px solid var(--load); }
.limits { border: 2px solid var(--marker); }
.limits .box-h { color: var(--marker); }

/* figures and tables */
.fig { margin: 32px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 16px 0; }
@media (min-width: 64rem) { .fig { margin-right: -6rem; } }
.fig-svg { display: block; width: 100%; height: auto; max-height: 34rem; }
.fig figcaption { font-size: .9rem; color: var(--graphite); line-height: 1.5; margin-top: 10px; }
.fig figcaption b { color: var(--ink); font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 24px 0; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
caption { text-align: left; font-size: .9rem; color: var(--graphite); margin-bottom: 8px; }
th { font: 600 1rem/1.2 var(--cond); text-transform: uppercase; text-align: left; border-bottom: 2px solid var(--ink); padding: 8px 10px; }
td { border-bottom: 1px solid var(--rule); padding: 8px 10px; vertical-align: top; }

/* references, about, disclaimer */
.refs { margin-top: 48px; }
.refs ol { font-size: .95rem; line-height: 1.5; }
.refs li:target { background: var(--tint); }
.about dl { display: grid; grid-template-columns: 11rem 1fr; gap: 8px 16px; margin: 0; font-size: .95rem; }
.about dt { font: 600 .95rem/1.4 var(--cond); text-transform: uppercase; color: var(--graphite); }
.about dd { margin: 0; }
.about dd ul { margin: 0; padding-left: 1.1rem; }
@media (max-width: 36rem) { .about dl { grid-template-columns: 1fr; } }
.disclaimer { font-size: .9rem; color: var(--graphite); border-top: 1px solid var(--ink); padding-top: 14px; }

/* library */
.lib h1 { margin-top: 40px; }
.lib-tools { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin: 24px 0 8px; }
.lib-tools input { font: inherit; font-size: 1rem; padding: 10px 12px; border: 2px solid var(--ink); background: var(--sheet); min-width: min(100%, 24rem); border-radius: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button { background: none; border: 1px solid var(--ink); padding: 6px 10px; cursor: pointer; border-radius: 0; }
.filters button[aria-pressed="true"] { border-width: 2px; background: var(--rule); }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: 24px; }
.card { border: 2px solid var(--ink); padding: 18px 20px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card h2 { font: 600 1.6rem/1.05 var(--cond); text-transform: uppercase; margin: 14px 0 8px; }
.card h2 a { text-decoration: none; }
.card p { margin: 0 0 8px; font-size: 1rem; }

@media print {
  header.site nav, .toc, .skip { display: none; }
  .a-grid { display: block; }
  .fig { break-inside: avoid; margin-right: 0; }
  body { font-size: 11pt; }
  a { text-decoration: none; }
}

/* box headings keep their own style inside the article body */
.a-body .box .box-h { font: 600 1.1rem/1 var(--cond); margin: 0 0 10px; padding: 0; border: 0; }
.limits .box-h { color: var(--marker); }

/* the hint shows only on small screens */
.fig-hint { display: none; }

/* small screens: keep diagram labels readable; the figure scrolls sideways, the caption stays put */
@media (max-width: 40rem) {
  .fig-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .fig-scroll .fig-svg { min-width: 38rem; max-height: none; }
  .fig-hint { display: block; font-size: .8rem; color: var(--graphite); margin-top: 4px; }
}

.cards .empty { list-style: none; color: var(--graphite); }
