/* Gate & Shift Guides — a field handbook for supervisors reading on a phone.
   Warm paper, one humanist sans, generous spacing, a pinned shelf bar,
   and supplier requests set as sheets that can be copied whole. */

:root {
  color-scheme: light;
  --paper: #faf6ee;
  --sheet: #fffdf8;
  --ink: #26221d;
  --text: #322d27;
  --muted: #62594e;
  --rule: #ddd3c2;
  --rule-strong: #b9ab95;
  --green: #1d5940;
  --green-dark: #123d2b;
  --green-wash: #edf0e4;
  --ochre: #b07a22;
  --blank: #f4e2b8;
  --focus: #b5470c;
  --sans: Seravek, "Gill Sans Nova", "Segoe UI", Candara, "Noto Sans", Ubuntu, "DejaVu Sans", sans-serif;
  --measure: 37rem;
  --side: clamp(1.1rem, 5vw, 2rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 1.125rem/1.62 var(--sans);
  font-variant-numeric: lining-nums;
}

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--green-dark); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, .table-wrap:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px;
}

.skip {
  position: absolute; left: 1rem; top: -10rem; z-index: 20;
  background: var(--ink); color: var(--paper); padding: .7rem 1rem; font-weight: 600;
}
.skip:focus { top: .75rem; color: var(--paper); }

.masthead, .shelves-inner, .ownership, main, .colophon {
  max-width: calc(var(--measure) + 2 * var(--side));
  margin-inline: auto;
  padding-inline: var(--side);
}

/* Masthead */
.masthead { padding-top: 1.5rem; padding-bottom: .9rem; }
.brand {
  display: inline-block; color: var(--ink); text-decoration: none;
  font-size: 1.42rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.15;
}
.brand:hover { color: var(--green-dark); }
.masthead p { margin: .3rem 0 0; color: var(--muted); font-size: .98rem; line-height: 1.4; }

/* Shelf bar: pinned on scroll so the reader can always return to a guide category. */
.shelves {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule-strong);
}
.shelves-inner {
  display: flex; gap: 1rem;
  overflow-x: auto; scrollbar-width: none;
  white-space: nowrap;
  font-size: .98rem;
}
.shelves-inner::-webkit-scrollbar { display: none; }
.shelves .sep { display: none; }
.shelves a {
  display: block; padding: .72rem .2rem .62rem;
  color: var(--muted); text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.shelves a:hover { color: var(--ink); }
.shelves a[aria-current] { color: var(--ink); font-weight: 600; border-bottom-color: var(--green); }
.shelves a:focus-visible { outline-offset: -3px; border-radius: 3px; }

.ownership {
  font-size: .86rem; line-height: 1.5; color: var(--muted);
  padding-top: .9rem;
}
.ownership a { color: var(--muted); }

/* Reading column */
main { padding-top: clamp(1.6rem, 5vw, 2.6rem); padding-bottom: 3.5rem; }
main > * { max-width: var(--measure); }

h1, h2, h3 { color: var(--ink); line-height: 1.18; text-wrap: balance; }
h1 { font-size: clamp(1.95rem, 1.4rem + 2.6vw, 2.75rem); font-weight: 700; letter-spacing: -.018em; margin: 0 0 .85rem; }
h2 { font-size: 1.44rem; font-weight: 700; letter-spacing: -.01em; margin: 2.9rem 0 .8rem; }
h3 { font-size: 1.14rem; font-weight: 700; margin: 2rem 0 .45rem; }

p { margin: 0 0 1.1rem; }
ul { padding-left: 1.2rem; margin: 0 0 1.3rem; }
li { margin-bottom: .55rem; padding-left: .2rem; }
li::marker { color: var(--green); }
strong { color: var(--ink); }
code { font-size: .88em; background: #efe8da; padding: .05em .3em; border-radius: 2px; }

h2, h3, section[id], .brief { scroll-margin-top: 4.25rem; }

.date { white-space: nowrap; }
.meta { color: var(--muted); font-size: .9rem; line-height: 1.5; margin-bottom: 2rem; }

/* Quick picks: a summary panel */
.pick {
  display: block; margin: 1.8rem 0;
  padding: 1.05rem 1.2rem 1.1rem;
  background: var(--green-wash);
  border-left: 4px solid var(--green);
  line-height: 1.58;
}

/* Supplier request: a sheet to copy, with its blanks marked */
.brief {
  display: block; margin: 1.6rem 0 1.4rem;
  padding: 1.25rem 1.3rem 1.1rem;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-top: 4px solid var(--ochre);
  box-shadow: 0 1px 0 var(--rule);
  font-size: 1.06rem; line-height: 1.66; color: var(--ink);
}
.brief-text { display: block; }
.blank {
  background: var(--blank);
  padding: .02em .12em; border-radius: 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  white-space: nowrap;
}
.brief-actions {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--rule-strong);
}
.brief-copy {
  font: 600 .95rem/1 var(--sans);
  color: var(--green); background: var(--paper);
  border: 1.5px solid var(--green); border-radius: 3px;
  min-height: 2.75rem; padding: 0 1rem; cursor: pointer;
}
.brief-copy:hover { background: var(--green); color: var(--sheet); }
.brief-status { color: var(--muted); font-size: .9rem; }

/* Tables */
.table-wrap {
  overflow-x: auto; margin: 1.6rem 0 2.2rem;
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; width: 100%; font-size: .95rem; line-height: 1.5; }
thead th {
  text-align: left; vertical-align: bottom;
  font-size: .84rem; font-weight: 700; color: var(--ink);
  padding: .55rem .9rem .55rem 0;
  border-bottom: 2px solid var(--ink);
}
tbody th, tbody td {
  text-align: left; vertical-align: top;
  padding: .85rem .9rem .9rem 0;
  border-bottom: 1px solid var(--rule);
}
tbody th { font-weight: 700; color: var(--ink); }
th:last-child, td:last-child { padding-right: 0; }
.cols-2 tbody th { width: 38%; }

/* Fact traceability and footer */
.trace {
  margin-top: 3rem; padding-top: 1.1rem;
  border-top: 2px solid var(--ink);
  font-size: .92rem; color: var(--muted);
}
.trace h2 { font-size: 1.02rem; margin: 0 0 .4rem; }
.trace p { margin: 0; }

.colophon {
  font-size: .9rem; color: var(--muted);
  padding-top: 1.5rem; padding-bottom: 3rem;
  border-top: 1px solid var(--rule-strong);
}
.colophon nav { line-height: 2.1; }
.colophon nav a { color: var(--ink); }
.colophon nav a[aria-current] { font-weight: 600; text-decoration-thickness: 2px; text-decoration-color: var(--green); }
.colophon p { margin: .7rem 0 0; max-width: 34rem; }

/* Category and home listings */
.catalog { list-style: none; padding: 0; margin: 1rem 0 0; }
.catalog li { padding: 1.15rem 0 1.2rem; margin: 0; border-top: 1px solid var(--rule); }
.catalog li:last-child { border-bottom: 1px solid var(--rule); }
.catalog a {
  display: block; color: var(--ink); text-decoration: none;
  font-size: 1.18rem; font-weight: 700; line-height: 1.3; letter-spacing: -.005em;
}
.catalog a:hover { color: var(--green); text-decoration: underline; text-decoration-thickness: 2px; }
.catalog p { margin: .35rem 0 .3rem; color: var(--text); font-size: 1rem; line-height: 1.5; }
.catalog small { color: var(--muted); font-size: .84rem; }

/* Ledger of numbered facts */
main > section[id] { padding-top: .2rem; }
main > section[id] h2 { font-size: 1.05rem; margin: 1.8rem 0 .3rem; color: var(--green); letter-spacing: .02em; }
main > section[id]:target { background: var(--green-wash); box-shadow: 0 0 0 .7rem var(--green-wash); }

/* Phones: wide tables become one ruled record per row */
@media (max-width: 47.99rem) {
  body { font-size: 1.0625rem; }
  .cols-3 table, .cols-3 tbody, .cols-3 tr, .cols-3 th, .cols-3 td,
  .cols-4 table, .cols-4 tbody, .cols-4 tr, .cols-4 th, .cols-4 td { display: block; width: auto; }
  .cols-3 thead, .cols-4 thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .cols-3, .cols-4 { overflow: visible; border-top: 2px solid var(--ink); }
  .cols-3 tbody tr, .cols-4 tbody tr { padding: 1rem 0 .6rem; border-bottom: 1px solid var(--rule-strong); }
  .cols-3 tbody th, .cols-4 tbody th { border: 0; padding: 0 0 .5rem; font-size: 1.06rem; }
  .cols-3 tbody td, .cols-4 tbody td { border: 0; padding: 0 0 .7rem; }
  .cols-3 td::before, .cols-4 td::before {
    content: attr(data-label); display: block;
    font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: .01em;
    margin-bottom: .1rem;
  }
  .brief { margin-inline: calc(-1 * var(--side) + .35rem); padding-inline: 1.05rem; }
}

/* Wider screens: tables may use more width than the reading column */
@media (min-width: 48rem) {
  .table-wrap {
    width: min(56rem, calc(100vw - 4rem));
    max-width: none;
    margin-left: calc((var(--measure) - min(56rem, calc(100vw - 4rem))) / 2);
  }
  .cols-4 thead th:first-child { width: 17%; }
  .shelves-inner { gap: 1.75rem; }
}

@media print {
  .shelves, .skip, .brief-actions { display: none; }
  body { background: #fff; }
}
