/* Lesson pages — same şəbəkə world as the home page, tuned for reading. Tokens mirror index.html. */
@font-face {
  font-family: "Unbounded";
  src: url("/fonts/unbounded.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --wood: #3a2415;
  --wood-2: #5b3a22;
  --ink: #24160d;
  --clear: #eef3f0;
  --clear-2: #dfe9e4;
  --ruby: #b4152f;
  --cobalt: #1d4fb5;
  --emerald: #178a4a;
  --amber: #eaa514;
  --amber-hi: #f4b935;
  --lead: 6px;
  --gutter: clamp(1rem, 4vw, 3rem);
  --display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
  scrollbar-color: var(--wood-2) var(--clear);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 1.0938rem/1.7 var(--text); color: var(--ink); background: var(--clear); caret-color: var(--ruby); }
::selection { background: var(--amber); color: var(--ink); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

/* Top bar: a strip of the lattice, then the path back home. */
.topbar { background: var(--wood); color: var(--clear); }
.topbar::before { content: ""; display: block; height: 2.25rem; background: url("/lattice.svg") center / cover; border-bottom: 6px solid var(--wood); }
.topbar nav { padding: 0.75rem var(--gutter) 0.9rem; display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; align-items: baseline; font-size: 0.95rem; }
.topbar a { color: var(--amber-hi); }
.topbar .home { font: 700 1rem var(--display); color: var(--clear); text-decoration: none; margin-right: 0.4rem; }

.draft { background: var(--amber); padding: 0.85rem var(--gutter); font-size: 0.95rem; }
.draft p { max-width: 72rem; margin-inline: auto; }

.head { padding: clamp(2rem, 6vw, 4rem) var(--gutter) clamp(1.5rem, 4vw, 2.5rem); }
.head .wrap { max-width: 72rem; margin-inline: auto; display: grid; gap: 1rem; }
.head .subject { font: 700 0.95rem var(--display); color: var(--cobalt); }
.head h1 { font-size: clamp(1.8rem, 5vw, 3.1rem); max-width: 22ch; }
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.75rem), 1fr)); gap: var(--lead); background: var(--wood); border: 10px solid var(--wood); margin: 0.75rem 0 0; padding: 0; list-style: none; }
.toc li { background: var(--clear-2) linear-gradient(160deg, rgb(255 255 255 / 0.45), transparent 50%); padding: 0.7rem 0.8rem; min-height: 4.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 0.3rem; font-weight: 600; line-height: 1.3; font-size: 0.95rem; }
.toc li small { font-weight: 400; font-size: 0.78rem; color: #5a4535; }
.toc li.here { background-color: var(--amber); }
.toc a { text-decoration: none; }

/* The lesson itself. */
article { padding: 0 var(--gutter) clamp(3rem, 8vw, 5rem); }
article .wrap { max-width: 44rem; margin-inline: auto; display: grid; gap: 1.15rem; }
article h2 { font-size: clamp(1.35rem, 3.4vw, 1.85rem); margin-top: 1.6rem; }
article h3 { font-size: 1.1rem; margin-top: 0.8rem; }
article ul, article ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.35rem; }
dfn { font-style: normal; font-weight: 700; }

.key { border: 6px solid var(--wood); background: #fff8e6; padding: 1rem 1.15rem; display: grid; gap: 0.5rem; }
.key b.label { font: 700 0.85rem var(--display); color: var(--wood-2); }
.formula { font: 600 1.3rem/1.4 var(--text); text-align: center; background: var(--clear-2); padding: 0.9rem 1rem; letter-spacing: 0.02em; }
.formula small { display: block; font-size: 0.9rem; font-weight: 400; letter-spacing: 0; margin-top: 0.3rem; }
figure { margin: 0.4rem 0; display: grid; gap: 0.5rem; }
figure svg { width: 100%; height: auto; border: 6px solid var(--wood); background: #fff; }
figcaption { font-size: 0.9rem; color: #4a3626; }
.example { background: var(--cobalt); color: #f3f6ff; padding: 1.2rem 1.25rem; display: grid; gap: 0.6rem; }
.example .formula { background: rgb(255 255 255 / 0.12); color: #fff; }
.example b.label { font: 700 0.85rem var(--display); color: var(--amber-hi); }

.check { display: grid; gap: var(--lead); background: var(--wood); border: 8px solid var(--wood); }
.check details { background: var(--clear); padding: 0.85rem 1rem; }
.check summary { cursor: pointer; font-weight: 600; }
.check summary::marker { color: var(--ruby); }
.check details[open] { background: #fff8e6; }
.check details p { margin-top: 0.6rem; }

.more { display: grid; gap: 0.6rem; }
.more a.btn { display: inline-flex; align-items: center; min-height: 3rem; padding: 0.7rem 1.1rem; border: 3px solid var(--wood); background: var(--amber); font: 700 0.92rem/1.25 var(--display); text-decoration: none; width: fit-content; max-width: 100%; }
.more small { color: #4a3626; }
@media (hover: hover) { .more a.btn:hover { background: var(--amber-hi); } }

footer { background: var(--wood); color: var(--clear); padding: 2rem var(--gutter) max(2rem, env(safe-area-inset-bottom)); font-size: 0.92rem; }
footer .wrap { max-width: 72rem; margin-inline: auto; display: grid; gap: 0.6rem; }
footer a { color: var(--amber-hi); }
