/* Nolowiz learn pages: shared design tokens and base styles (light theme).
   Served at https://nolowiz.com/learn/assets/nolowiz.css.
   Matched to nolowiz.com (GeneratePress): grey page, one white content box, JetBrains Mono for all text.
   Pages load JetBrains Mono from Google Fonts (ital,wght@0,400;0,600;0,700;1,400) before this file.
   After you change this file, raise ?v= in the <link> of every page that uses it, so browsers fetch it again.
   Styles for one page's own widgets stay in that page's <style> block. */

/* ---- design tokens ---- */
:root {
  /* surfaces and text */
  --bg: #f7f8f9;
  --card: #ffffff;
  --fg: #222222;
  --text: #222222;
  --muted: #595959;
  --hair: #e3e6ea;
  --field: #cccccc;
  --code-bg: rgba(0, 0, 0, 0.05);

  /* brand, links, buttons */
  --brand: #2098ff;
  --link: #0f85ff;
  --link-line: #ccebff;
  --link-line-hover: #1a98ee;
  --btn: #55555e;
  --btn-hover: #3f4047;
  --btn-disabled: #c9ccd1;
  --footer: #00539a;
  --hover-bg: #e8f3ff;    /* light blue: hover on choices */
  --hover-line: #7fbfff;

  /* colours with one meaning each (as in the videos) */
  --blue: #0b6bcb;        /* the main object */
  --yellow: #8a5a00;      /* look here / the result (amber: yellow can't be read on white) */
  --yellow-bg: #fff6cc;
  --yellow-line: #d9a400;
  --green: #1a7f37;       /* correct / allowed */
  --green-bg: #eaf6ec;
  --red: #cf222e;         /* problem / attacker */
  --red-bg: #fdecec;
  /* two more, when a lesson needs them (like TEAL/PURPLE/GOLD in the videos): one meaning each, per lesson */
  --purple: #8250df;
  --purple-bg: #f3eefc;
  --gold: #b35900;
  --gold-bg: #fff1e5;

  /* type: one font for the whole site (the user's choice, 2026-12-05) */
  --mono: "JetBrains Mono", Consolas, monospace;
  --sans: var(--mono);
}

/* ---- base ---- */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 18px/1.7 var(--sans);
       display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }   /* footer at the bottom on short pages */
main { width: 100%; max-width: 820px; margin: 20px auto 40px; padding: 40px; background: var(--card); }
footer { margin-top: auto; }
h1, h2, h3 { color: var(--fg); font-weight: 400; line-height: 1.25; }
h1 { font-size: clamp(34px, 8vw, 54px); margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: clamp(24px, 5.5vw, 30px); margin: 72px 0 12px; }
h2 .n { font: inherit; color: var(--muted); margin-right: 14px; }   /* section number */
h3 { font-size: 19px; margin: 28px 0 8px; }
p { margin: 12px 0; }
b { color: var(--fg); font-weight: 600; }
a { color: var(--link); text-decoration: none; border-bottom: 1px solid var(--link-line); transition: border-color .5s; }
a:hover { border-bottom-color: var(--link-line-hover); }
ul, ol { padding-left: 22px; }
li { margin: 6px 0; }
code { font: 400 0.86em var(--mono); color: var(--fg); overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.c-blue { color: var(--blue); } .c-yellow { color: var(--yellow); }
.c-green { color: var(--green); } .c-red { color: var(--red); }
.c-purple { color: var(--purple); } .c-gold { color: var(--gold); }

/* ---- header ---- */
.site-header { background: #fff; }
.site-header .inner { max-width: 1200px; margin: 0 auto; padding: 24px 40px; display: flex; flex-wrap: wrap;
                      justify-content: space-between; align-items: center; gap: 6px 20px; }
.brand { font-size: 25px; font-weight: 700; color: var(--brand); border: 0; }
.brand:hover { color: var(--brand); }
.crumb { font-size: 15px; color: #515151; }
.crumb a { color: inherit; border: 0; text-decoration: underline; text-decoration-color: #b8bcc2; text-underline-offset: 4px;
           display: inline-block; padding: 10px 0; margin: -10px 0; }   /* 41px tap area, same layout */
.crumb a:hover { color: var(--link); text-decoration-color: var(--link-line-hover); }

/* ---- lesson list (the /learn/ hub) ---- */
.lessons { list-style: none; padding: 0; margin: 24px 0 0; }
.lessons li { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--hair); }
.lessons li:first-child { border-top: 1px solid var(--hair); }
.lessons p { margin: 4px 0 0; font-size: 16px; line-height: 1.5; color: var(--muted); }   /* one-line description */

/* ---- intro ---- */
.intro { margin-top: 0; }
.lede { font-size: 20px; }
.example { margin: 36px 0 8px; text-align: center; font-size: clamp(21px, 5.6vw, 28px); color: var(--fg); }

/* ---- figures and code ---- */
figure { margin: 28px 0; padding: 22px 0 14px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
figcaption { font-size: 14px; line-height: 1.5; color: var(--muted); margin-top: 16px; }
figcaption b { color: var(--fg); }
pre { font: 400 14px/1.6 var(--mono); color: var(--fg); margin: 16px 0; padding: 14px 16px; background: var(--code-bg);
      white-space: pre-wrap; overflow-wrap: anywhere; }
pre .k { color: var(--yellow); font-weight: 600; }   /* the part to look at */

/* ---- buttons ---- */
button {
  font: 400 15px var(--sans); color: #fff; background: var(--btn); cursor: pointer;
  border: 0; border-radius: 0; padding: 9px 16px; min-height: 40px;
}
button:hover { background: var(--btn-hover); }
button:disabled { background: var(--btn-disabled); cursor: default; }
button[aria-pressed="true"] { background: var(--brand); }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 16px; margin: 16px 0; }
th, td { text-align: left; padding: 9px 8px 9px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
th { color: var(--muted); font: 400 13px var(--mono); }
td:first-child { white-space: nowrap; }
td:last-child { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---- quiz ---- */
.quiz ol { padding-left: 0; list-style: none; counter-reset: q; }
.quiz > ol > li { counter-increment: q; margin: 34px 0; }
.quiz .qtext { color: var(--fg); font-weight: 600; }
.quiz .qtext::before { content: counter(q) ". "; font-family: var(--mono); color: var(--muted); font-weight: 400; }
.opts { display: grid; gap: 8px; margin-top: 10px; }
.opts button { text-align: left; color: var(--fg); background: #fafafa; border: 1px solid var(--field); }
.opts button:hover { background: var(--hover-bg); border-color: var(--hover-line); }   /* light blue */
.opts button.right { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.opts button.wrong { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.fb { font-size: 16px; min-height: 26px; margin-top: 8px; }
.score { font: 600 15px var(--mono); color: var(--yellow); }

/* ---- ads (AdSense display unit from web/adcode.txt, between sections only) ---- */
.ad { margin: 56px 0; padding: 8px 0 12px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.ad::before { content: "Advertisement"; display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.ad ins.adsbygoogle { min-height: 280px; }   /* reserve the space, so the text doesn't jump when the ad loads */
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }   /* no ad to show: no empty box */

/* ---- footer ---- */
footer { background: var(--footer); color: #fff; font-size: 15px; }
footer .inner { max-width: 1200px; margin: 0 auto; padding: 20px 40px; text-align: center; }

/* ---- phones ---- */
@media (max-width: 768px) {
  main { margin: 0 auto 20px; padding: 30px 20px; }
  .site-header .inner { padding: 18px 20px; }
  footer .inner { padding: 20px; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  table { font-size: 15px; }
  td:first-child { white-space: normal; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
