/*
 * THE LESSON PAGES (learn/…), written by the build from Usta's manual
 * (src/seo/learnPages.ts).
 *
 * They are plain documents, not the app: no JavaScript beyond the theme line,
 * so they load at once, read well on a phone and print. The colours are the
 * app's own tokens (src/styles/index.css), dark by default and light when the
 * reader chose light in the app or the system asks for it.
 */
:root {
  --surface-0: #101216;
  --surface-1: #16191f;
  --surface-2: #1d2129;
  --ink: #d6dae2;
  --muted: #b2b7c0;
  --faint: #8a92a1;
  --edge: #2e3440;
  --run: #34d17b;
  --warn: #d9a13c;
  --accent: #5993e9;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --surface-0: #f4f6f9;
  --surface-1: #ffffff;
  --surface-2: #eef1f5;
  --ink: #14171c;
  --muted: #363d48;
  --faint: #525a67;
  --edge: #c3cad4;
  --run: #146b3a;
  --warn: #7d5300;
  --accent: #1d5bb8;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--surface-0);
  color: var(--ink);
  font:
    17px/1.65 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
img {
  max-width: 100%;
}

/* ---- the bar at the top ------------------------------------------------ */
.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--edge);
  font-size: 14px;
}
.brand {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
}
.site nav {
  display: flex;
  gap: 16px;
}
.site nav a {
  color: var(--muted);
  text-decoration: none;
}
.site nav a:hover,
.site nav a[aria-current='page'] {
  color: var(--ink);
}
.spacer {
  flex: 1;
}
.lang {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
}
.lang a,
.lang span {
  padding: 2px 9px;
  color: var(--muted);
  text-decoration: none;
}
.lang span {
  background: var(--surface-2);
  color: var(--ink);
}
.cta {
  display: inline-block;
  border-radius: 4px;
  background: var(--accent);
  color: var(--surface-0);
  font-weight: 600;
  padding: 7px 14px;
  text-decoration: none;
}
.cta:hover {
  filter: brightness(1.1);
}
.cta.big {
  padding: 12px 26px;
  font-size: 17px;
}

/* ---- the page ---------------------------------------------------------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 20px 64px;
}
.crumbs {
  color: var(--faint);
  font-size: 14px;
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover {
  text-decoration: underline;
}
.hero {
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 8px;
}
.hero img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: right;
}
.eyebrow {
  margin: 22px 0 0;
  color: var(--warn);
  font:
    600 13px/1.4 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1 {
  margin: 8px 0 0;
  font-size: 32px;
  line-height: 1.2;
}
.lead {
  margin: 14px 0 0;
  font-size: 19px;
}
.story {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
}
.toc {
  margin: 28px 0 0;
  padding: 14px 18px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface-1);
}
.toc h2 {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}
.toc ol {
  margin: 8px 0 0;
  padding-left: 22px;
}
.chapter > section {
  margin-top: 40px;
}
h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.3;
}
h3 {
  margin: 26px 0 4px;
  font-size: 19px;
}
p,
ul,
ol {
  margin: 12px 0 0;
}
li + li {
  margin-top: 4px;
}
strong {
  color: var(--ink);
}
code {
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--surface-2);
  font:
    0.9em ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
}
pre {
  overflow-x: auto;
  padding: 12px 14px;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--surface-1);
  font-size: 14px;
  line-height: 1.5;
}
pre code {
  padding: 0;
  background: none;
}
blockquote {
  margin: 16px 0 0;
  padding: 2px 16px;
  border-left: 3px solid var(--warn);
  color: var(--muted);
}
table {
  width: 100%;
  margin: 16px 0 0;
  border-collapse: collapse;
  font-size: 15px;
}
.table-wrap {
  overflow-x: auto;
}
th,
td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--edge);
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 600;
}
td.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}
.other {
  display: block;
  color: var(--faint);
  font-size: 13px;
}
svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 16px auto 0;
  color: var(--ink);
}
hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--edge);
}

/* ---- practise, and the way on ------------------------------------------ */
.practice {
  margin: 48px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface-1);
}
.practice h2 {
  margin: 0;
}
.practice .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.cta.ghost {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
}
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin: 32px 0 0;
  font-size: 15px;
}
.cards {
  display: grid;
  gap: 12px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}
.cards li {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface-1);
}
.cards a {
  font-size: 18px;
  font-weight: 600;
  text-decoration: none;
}
.cards a:hover {
  text-decoration: underline;
}
.cards .num {
  margin-right: 6px;
  color: var(--warn);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cards p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}
footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px 40px;
  border-top: 1px solid var(--edge);
  color: var(--faint);
  font-size: 13px;
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  h1 {
    font-size: 26px;
  }
  .hero img {
    height: 150px;
  }
}
@media print {
  .site,
  .practice,
  .pager,
  .toc {
    display: none;
  }
}
