/* safeyt.org. Tokens follow the Learning Watch site (cream paper with a fibre texture from
   img/paper.svg, warm ink, teal accent, serif headings). No web fonts, no network assets. */
:root {
  --paper: #fefcf6;
  --paper-img: url("img/paper.svg");
  --ink: #241d15;
  --ink-2: #6b5f52;
  --rule: rgba(132, 111, 83, .22);
  --rule-strong: rgba(132, 111, 83, .45);
  --field: rgba(255, 255, 255, .72);
  --code-bg: rgba(132, 111, 83, .08);
  --accent: #0f7c72;
  --accent-ink: #ffffff;
  --accent-text: #1f5b53;
  --good: #2e6a3a;
  --bad: #a8402c;
  --focus: #241d15;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Georgia, serif;
  --sans: "Avenir Next", Avenir, "Helvetica Neue", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --r-1: 2px; --r-2: 3px; --r-3: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1915;
    --paper-img: none;
    --ink: #f1ece4;
    --ink-2: #c4b8aa;
    --rule: rgba(241, 236, 228, .16);
    --rule-strong: rgba(241, 236, 228, .40);
    --field: rgba(255, 255, 255, .05);
    --code-bg: rgba(255, 255, 255, .05);
    --accent: #3fb3a6;
    --accent-ink: #0e1f1c;
    --accent-text: #7fd3c8;
    --good: #9fd29a;
    --bad: #f2a493;
    --focus: #f1ece4;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink);
  font: 16px/1.65 var(--sans); font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image: var(--paper-img);
  background-size: 600px 600px;
  overflow-wrap: break-word;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 10; padding: 8px 14px;
  background: var(--ink); color: var(--paper); border-radius: var(--r-2); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* top bar */
.top { border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 16px; padding-bottom: 14px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; font-weight: 600; }
.top nav a { text-decoration: none; color: var(--ink); }
.top nav a:hover, .top nav a[aria-current=page] { text-decoration: underline; }
.mark {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  font: 600 18px/1 var(--serif); letter-spacing: -.005em;
}
.mark::before { content: ""; width: 9px; height: 9px; background: var(--accent); }

/* type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.015em; line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(40px, 7vw, 64px); margin: 0 0 16px; }
h2 { font-size: clamp(27px, 4vw, 34px); margin: 0 0 14px; }
h3 { font-size: 21px; margin: 34px 0 10px; }
p { margin: 0 0 14px; }
.lede { font-size: clamp(19px, 2.4vw, 23px); line-height: 1.45; max-width: 36em; margin-bottom: 26px; }
.muted { color: var(--ink-2); }
.eyebrow {
  margin: 0 0 8px; font: 600 13px/1.4 var(--sans); font-variant-caps: all-small-caps; letter-spacing: .09em;
  font-size: 15px; color: var(--accent-text);
}
code, kbd { font: .88em/1.4 var(--mono); background: var(--code-bg); padding: 1px 4px; border-radius: var(--r-1); }
pre {
  margin: 0 0 18px; padding: 14px 16px; overflow-x: auto; background: var(--code-bg);
  border: 1px solid var(--rule); border-radius: var(--r-3); font: 13px/1.55 var(--mono); tab-size: 2;
}
pre code { background: none; padding: 0; font-size: inherit; }

/* hero */
.hero { padding: 64px 0 56px; }
.hero h1 .wm { display: inline-flex; align-items: center; gap: .22em; }
.hero h1 .wm::before { content: ""; width: .28em; height: .28em; background: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.btn {
  display: inline-block; font: 600 15px/1.2 var(--sans); padding: 12px 20px; border-radius: var(--r-2);
  border: 1px solid var(--rule-strong); color: var(--ink); text-decoration: none; background: transparent;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.dot { position: relative; padding-left: 14px; font-size: 14px; color: var(--ink-2); margin: 0; }
.dot::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; background: var(--good); }

/* sections */
section.s { padding: 52px 0 40px; border-top: 1px solid var(--rule-strong); }
section.s > .wrap > p { max-width: 44em; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 26px; margin: 26px 0 0; }
.gallery figure { margin: 0; }
.gallery figure.wide { grid-column: 1 / -1; }
.gallery img { width: 100%; border: 1px solid var(--rule); border-radius: var(--r-3); background: var(--field); }
.gallery img.match { aspect-ratio: 640 / 269; object-fit: cover; } /* same height as the channel card beside it; the crop is margin only */
figcaption { font-size: 14px; color: var(--ink-2); margin-top: 8px; line-height: 1.5; }
figcaption b { color: var(--ink); font-weight: 600; }

/* video */
.video { margin: 24px 0 18px; }
.video video { width: 100%; aspect-ratio: 16 / 10; background: #000; border-radius: var(--r-3); border: 1px solid var(--rule); }

/* rule order */
ol.rules { counter-reset: r; list-style: none; padding: 0; margin: 20px 0 8px; border-top: 1px solid var(--rule); max-width: 50em; }
ol.rules li { counter-increment: r; display: grid; grid-template-columns: 40px 1fr; gap: 0 10px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
ol.rules li::before { content: counter(r); font: 600 24px/1.1 var(--serif); color: var(--accent-text); }
ol.rules b { display: block; }
ol.rules span { color: var(--ink-2); font-size: 15px; }
.v-play { color: var(--good); font-weight: 600; }
.v-block { color: var(--bad); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 22px 0 18px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat { padding: 12px 14px 14px 0; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.stat + .stat { padding-left: 16px; border-left: 1px solid var(--rule); }
.stat b { display: block; font: 600 32px/1.1 var(--serif); letter-spacing: -.02em; color: var(--ink); margin-bottom: 4px; }

/* tables */
.scroll { overflow-x: auto; margin: 20px 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 600; font-variant-caps: all-small-caps; letter-spacing: .06em; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--rule-strong); vertical-align: bottom; }
td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
td:first-child { white-space: nowrap; }
td code { white-space: nowrap; }

/* setup steps */
.steps-nav { margin: 0 0 10px; padding: 0 0 0 20px; columns: 2; column-gap: 30px; font-size: 15px; }
.steps-nav li { margin: 3px 0; break-inside: avoid; }
.step { padding: 42px 0 18px; border-top: 1px solid var(--rule); }
.step h2 { font-size: clamp(24px, 3.4vw, 30px); }
.step ol, .step ul { padding-left: 22px; margin: 0 0 16px; }
.step li { margin: 5px 0; }
.note { border-left: 3px solid var(--accent); padding: 10px 0 10px 16px; margin: 0 0 18px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
ul.check { list-style: none; padding-left: 0; }
ul.check li { position: relative; padding-left: 26px; }
ul.check li::before { content: ""; position: absolute; left: 0; top: .32em; width: 14px; height: 14px; border: 1.5px solid var(--rule-strong); border-radius: var(--r-1); }

/* footer */
footer.foot { border-top: 1px solid var(--rule-strong); padding: 28px 0 40px; font-size: 14px; color: var(--ink-2); }
footer.foot p { margin: 0 0 8px; }
footer.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }

@media (max-width: 760px) {
  .gallery { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .steps-nav { columns: 1; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 16px; }
  body { font-size: 15px; }
  .hero { padding: 40px 0 36px; }
  section.s { padding: 40px 0 28px; }
  table { font-size: 14px; }
  td:first-child { white-space: normal; }
  ol.rules li { grid-template-columns: 30px 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
/* Phones: two-column tables become stacked rows (field, then its explanation). */
@media (max-width: 560px) {
  table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  td { border: 0; padding: 0; }
  td:first-child { font-weight: 600; margin-bottom: 3px; white-space: normal; }
  td code { white-space: normal; overflow-wrap: anywhere; }
}
