/* یادگیری آخر هفته: one quiet, typographic stylesheet for the hub and every
   lesson. Colours follow mohammadi.cv and the newsletter covers. Nothing
   here loads from another site; the only font is Vazirmatn, next to this file. */

@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-NL-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #fafaf7;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #444444;
  --muted: #6e6e6e;
  --rule: #e3e1dc;
  --accent: #1e3a5f;
  --accent-hover: #2d5080;
  --on-accent: #fafaf7;
  --track: #eceae4;
  --bar: #1e3a5f;
  --tint: #f2f1ec;
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, sans-serif;
  --column: 680px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181d;
    --surface: #1b2027;
    --ink: #ecebe6;
    --ink-2: #cfcec8;
    --muted: #a3a6aa;
    --rule: #2e343c;
    --accent: #a4c0e4;
    --accent-hover: #c7d9f0;
    --on-accent: #14181d;
    --track: #262c34;
    --bar: #8fb0d6;
    --tint: #1d232a;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.9;
  border-top: 6px solid var(--accent);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

::selection { background: var(--accent); color: var(--on-accent); }

.col {
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- header and footer ---------- */

.site-head { padding-block: 18px 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
}
.brand img { width: 32px; height: 32px; border-radius: 4px; display: block; }
.brand:hover { color: var(--accent); }

.site-foot {
  margin-top: 64px;
  padding-block: 20px 40px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-foot p { margin: 0.2em 0; }

/* ---------- text ---------- */

main { padding-block: 28px 0; }

h1, h2, h3 { color: var(--ink); line-height: 1.45; font-weight: 800; }
h1 { font-size: clamp(1.85rem, 1.45rem + 2vw, 2.55rem); margin: 0.1em 0 0.35em; line-height: 1.35; }
h2 { font-size: clamp(1.25rem, 1.15rem + 0.6vw, 1.45rem); margin: 2.2em 0 0.6em; }
h3 { font-size: 1.15rem; margin: 0 0 0.3em; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-inline-start: 1.4em; }
li { margin-bottom: 0.35em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5em 0; }

.kicker { color: var(--muted); font-weight: 500; font-size: 0.95rem; margin: 0; }
.standfirst { font-size: 1.2rem; line-height: 1.8; color: var(--ink-2); font-weight: 500; }
.note { color: var(--muted); font-size: 0.92rem; line-height: 1.8; }

.ways {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0;
  margin: 1.2em 0 0;
  list-style: none;
  font-size: 0.95rem;
}
.ways a {
  display: inline-block;
  padding: 2px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  text-decoration: none;
  background: var(--surface);
}
.ways a:hover { border-color: var(--accent); }

.glossary li { margin-bottom: 0.7em; }

.next { border-top: 1px solid var(--rule); padding-top: 1em; margin-top: 2.2em; }

/* ---------- the hub ---------- */

.four { list-style: none; padding: 0; }
.four li { padding-inline-start: 0; margin-bottom: 0.6em; }

.lessons { list-style: none; padding: 0; margin: 0; }
.lessons > li { border-top: 1px solid var(--rule); padding-block: 18px; margin: 0; }
.lessons > li:last-child { border-bottom: 1px solid var(--rule); }
.lessons h3 a { color: var(--ink); text-decoration: none; }
.lessons h3 a:hover { color: var(--accent); }
.lessons p { margin-bottom: 0.4em; }
.lessons .ways { margin-top: 0.6em; }

/* ---------- interactive sections ---------- */

.lab {
  margin: 2.4em 0;
  padding: 20px var(--gutter) 22px;
  background: var(--tint);
  border-top: 3px solid var(--accent);
  margin-left: calc(-1 * var(--gutter));
  margin-right: calc(-1 * var(--gutter));
}
.lab h2 { margin-top: 0.2em; }

.lab-label { display: block; font-size: 0.9rem; color: var(--muted); font-weight: 500; margin: 0.9em 0 0.4em; }

.picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; padding: 0; list-style: none; }
.picker li { margin: 0; }

button,
input,
textarea { font: inherit; color: inherit; }

.chip,
.btn {
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.chip:hover,
.btn:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn[disabled] { opacity: 0.45; cursor: default; }

.result { margin-top: 18px; }
.prompt-line { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5em; line-height: 1.7; }
.blank {
  display: inline-block;
  width: 2.2em;
  margin-inline-start: 0.3em;
  border-bottom: 2px dashed var(--accent);
  transform: translateY(-0.2em);
}

.bars { list-style: none; padding: 0; margin: 0 0 1em; }
.bars li {
  display: grid;
  grid-template-columns: 6.2em minmax(0, 1fr) 5.4em;
  align-items: center;
  column-gap: 10px;
  margin: 0;
  padding-block: 3px;
}
.piece { font-weight: 700; line-height: 1.45; min-width: 0; }
.piece .desc { font-weight: 500; color: var(--muted); font-size: 0.9rem; }
.piece small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.track { position: relative; height: 12px; background: var(--track); border-radius: 2px; overflow: hidden; }
.fill {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0; /* the start of the line, since every page is right to left */
  min-width: 2px;
  background: var(--bar);
  transition: width 0.25s ease;
}
.pct { font-size: 0.88rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* a count label («۱۲ بار، کمتر از ۱٪») may take two lines at 360px */
[data-counts] .pct { white-space: normal; line-height: 1.4; }

.facts { margin: 0; }
.facts p { margin: 0.35em 0; }
.said { color: var(--muted); font-weight: 500; }
.facts .end { color: var(--accent); font-weight: 400; }

/* bigram counter */
.field { display: block; width: 100%; }
textarea.field {
  min-height: 8.5em;
  padding: 10px 12px;
  line-height: 1.9;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  resize: vertical;
}
.word-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.word-row input {
  width: 9em;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  line-height: 1.6;
}
.bars .word {
  font: inherit;
  font-weight: 700;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-align: start;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.chain { font-size: 1.15rem; font-weight: 700; margin: 0.6em 0; }

textarea.field:focus,
.word-row input:focus { border-color: var(--accent); }

@media (min-width: 720px) {
  .lab { margin-left: 0; margin-right: 0; padding-left: 24px; padding-right: 24px; border-radius: 0 0 4px 4px; }
  .bars li { grid-template-columns: 7.5em minmax(0, 1fr) 6em; }
}

@media (prefers-reduced-motion: reduce) {
  .fill { transition: none; }
}

@media print {
  body { border-top: 0; }
  .lab, .ways, .site-head { display: none; }
}

/* hub only */
.hub-logo { display: block; width: 64px; height: 64px; border-radius: 6px; margin: 8px 0 14px; }
.lessons .ways span { color: var(--muted); font-size: 0.85rem; }

/* keeps a Latin name and its parentheses on one line */
.nw { white-space: nowrap; }
