/* Design system — Yandex Practicum course pages: white canvas, near-black ink, one violet brand,
   pastel tint tiles that carry meaning (group / sprint), big confident headings, 14–28px radii.
   No shadows beyond a hover lift, no gradients, no emoji. Source of truth: DESIGN.md.
   Per-view files live next to this one. */
:root {
  --bg: #ffffff;
  --subtle: #f4f4f6;
  --line: #e7e7ea;
  --line-strong: #d3d3d8;
  --text: #141414;
  --text-2: #4f4f58;
  --text-3: #5e5e68;
  --accent: #3b5bdb;
  --accent-soft: #eef1fd;
  --brand: #6741d9;
  --brand-hover: #5a32c8;
  --on-brand: #ffffff;        /* text on brand fills — constant in both themes */
  --on-brand-2: rgba(255, 255, 255, .75);  /* muted text on brand fills */
  --ink: #141414;            /* dark text on light surfaces inside colored cards */
  --inv-bg: #141414; --inv-fg: #ffffff; --inv-hover: #2c2c30;   /* inverted (black / white) buttons and pills */
  --glass: rgba(255, 255, 255, .78); --glass-strong: rgba(255, 255, 255, .88); --glass-hover: #ffffff;
  --track: rgba(20, 20, 20, .08);
  --header-bg: rgba(255, 255, 255, .92);
  --footer-bg: #141414; --footer-fg: #b4b4be;
  --tint-yellow: #fff6c9;
  --tint-sky: #dfeeff;
  --tint-mint: #dcf4e8;
  --tint-lilac: #ebe6ff;
  --tint-peach: #ffe7d9;
  --tint-rose: #ffe1e7;
  --ok: #1a7f45;
  --ok-soft: #eaf6ef;
  --err: #c9302c;
  --warn: #b45309;
  --radius-xl: 28px;
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
  --container: 1160px;
  --header-h: 72px;
}

/* Dark theme (Practicum dark): brand brightens a step, surfaces step down instead of being
   inverted by the browser. theme.js sets data-theme from localStorage or the system preference. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151517; --subtle: #212124; --line: #2c2c30; --line-strong: #3d3d43;
  --text: #f3f3f4; --text-2: #babac3; --text-3: #9b9ba6;
  --accent: #9fb2ff; --accent-soft: #272d4d;
  --brand: #7950f2; --brand-hover: #8a63f0;
  --ok: #4cc88a; --ok-soft: #16301f; --err: #ff6f69; --warn: #f2a652;
  --tint-yellow: #35301a; --tint-sky: #1d2b3e; --tint-mint: #17322a; --tint-lilac: #292542; --tint-peach: #3a2819; --tint-rose: #3b2029;
  --inv-bg: #f3f3f4; --inv-fg: #141414; --inv-hover: #dcdce1;
  --glass: rgba(255, 255, 255, .07); --glass-strong: rgba(255, 255, 255, .14); --glass-hover: rgba(255, 255, 255, .13);
  --track: rgba(255, 255, 255, .12);
  --header-bg: rgba(21, 21, 23, .9);
  --footer-bg: #0d0d0e; --footer-fg: #9b9ba6;
}
:root { color-scheme: light; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font); -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11"; }
h1, h2, h3, .prl-title, .card-title { text-wrap: balance; }
p, li { text-wrap: pretty; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand); color: var(--on-brand); }

h1 { font-size: 48px; line-height: 1.06; font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: 30px; line-height: 1.16; font-weight: 700; letter-spacing: -0.025em; }
h3 { font-size: 18px; line-height: 1.35; font-weight: 600; }
p + p { margin-top: 12px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--subtle); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 14px; }

/* ---- shell ---- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); }
.site-header .container { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 12px; }
.brand::before { content: "AI"; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--on-brand); flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; letter-spacing: -0.02em; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.nav::-webkit-scrollbar { display: none; }
.nav .tab { padding: 9px 14px; border-radius: 999px; color: var(--text-2); font-size: 15px; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.nav .tab:hover { color: var(--text); background: var(--subtle); }
.nav .tab.active { color: var(--inv-fg); font-weight: 600; background: var(--inv-bg); }
.lang-sw { display: flex; flex: none; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.lang-sw button { padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--text-3); background: transparent; }
.lang-sw button:hover { color: var(--text); }
.lang-sw button.on { background: var(--text); color: var(--bg); }
.header-cta { flex: none; }
.theme-sw { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2);
  border: 1px solid var(--line-strong); transition: background .15s, color .15s; }
.theme-sw:hover { background: var(--subtle); color: var(--text); }
.theme-sw svg { width: 18px; height: 18px; }
main.container { padding-top: 56px; padding-bottom: 120px; }
.tabpane { display: none; }
.tabpane.active { display: block; }
.page-head { margin-bottom: 40px; max-width: 760px; }
.page-head p { margin-top: 14px; color: var(--text-2); font-size: 18px; line-height: 1.5; }
.site-footer { background: var(--footer-bg); color: var(--footer-fg); font-size: 14px; line-height: 1.6; padding: 44px 0 56px; }
.site-footer a { color: #fff; text-decoration-color: rgba(255, 255, 255, .35); }

/* ---- in-pane sub-tabs ---- */
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.subtab { padding: 10px 14px; border-radius: 10px 10px 0 0; color: var(--text-2); font-size: 15px; font-weight: 500; border-bottom: 3px solid transparent; }
.subtab:hover { color: var(--text); }
.subtab.on { color: var(--text); font-weight: 700; border-bottom-color: var(--brand); }
.subpane { display: none; }
.subpane.active { display: block; }

/* ---- disclosures on the Program pane ---- */
.filters-discl, .legend { margin-bottom: 16px; }
.filters-discl summary, .legend summary { cursor: pointer; color: var(--text-2); font-size: 14.5px; padding: 6px 0; }
.filters-discl[open] summary, .legend[open] summary { margin-bottom: 8px; }
.legend p { font-size: 14px; color: var(--text-2); max-width: 720px; }
.danger-zone { margin-top: 40px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 24px;
  border-radius: 14px; font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .12s; }
.btn:active:not(:disabled), .prl-btn:active:not(:disabled), .pr-btn:active:not(:disabled) { transform: scale(.98); }
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--secondary { background: var(--inv-bg); color: var(--inv-fg); }
.btn--secondary:hover { background: var(--inv-hover); }
.btn--ghost { color: var(--text-2); padding: 0 12px; }
.btn--ghost:hover { color: var(--text); background: var(--subtle); }
.btn--sm { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 10px; }
.btn--lg { height: 60px; padding: 0 36px; font-size: 17px; border-radius: 18px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: default; pointer-events: none; }
.link { color: var(--accent); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }
button.link { padding: 0; font-size: inherit; }

/* ---- form controls ---- */
input[type="search"], input[type="text"], input[type="date"], input[type="number"], select {
  height: 40px; padding: 0 12px; font: inherit; font-size: 15px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--text); width: 16px; height: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 32px; }
.filters input[type="search"] { flex: 1 1 260px; }

/* ---- primitives ---- */
.card { background: var(--subtle); border-radius: var(--radius-xl); padding: 28px; }
.tile { background: var(--subtle); border-radius: var(--radius-xl); padding: 28px; }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--bg);
  color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.progress { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--inv-bg); border-radius: 4px; transition: width .3s; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 600; font-size: 13px; color: var(--text-3); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--text-3); padding: 48px 0; text-align: center; }

@media (max-width: 720px) {
  :root { --header-h: 108px; }
  h1 { font-size: 34px; } h2 { font-size: 24px; }
  .header-cta { display: none; }
  .lang-sw button { padding: 9px 12px; }
  .container { padding: 0 16px; }
  .site-header .container { gap: 8px 16px; flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 8px; }
  .brand { flex: 1; }
  .nav { order: 3; flex: 1 1 100%; }
  .prl-title { font-size: 30px; }
  main.container { padding-top: 32px; }
}

/* Touch devices: 44px minimum targets; desktop density unchanged */
@media (pointer: coarse) {
  .nav .tab, .subtab { min-height: 44px; display: inline-flex; align-items: center; }
  .btn--sm { min-height: 44px; }
  .lrow, .pg-item, .prl-step-link, .pr-trainer .tr-item { min-height: 44px; }
  .prl-lesson-link, .prl-copy, .prl-crumb .prl-link, .prl-refs a, .prl-exlist .prl-link, .prl-opt { min-height: 44px; }
  .pr-trainer .pr-x { width: 44px; height: 44px; }
  .pr-trainer .pr-x::before, .pr-trainer .pr-x::after { left: 15px; top: 21px; }
  /* jump buttons, entry-test options, dashboard next-up rows, disclosures */
  button.link, .db-next, .opt, summary, .pg-specbox summary { min-height: 44px; }
  .opt { display: flex; align-items: center; }
}

/* discipline switcher above the module catalog */
.disc-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 20px 0 8px; }
.disc-nav-lab { font-size: 14.5px; color: var(--text-2); }

/* lesson header tools (Colab export) */
.prl-tools { display: flex; gap: 8px; margin: 10px 0 6px; }

/* inline lesson figures (fig blocks) */
.prl-fig { margin: 18px 0 6px; padding: 18px 12px 10px; background: var(--subtle); border-radius: var(--radius); }
.prl-fig svg { display: block; margin: 0 auto; width: 100%; max-width: 560px; height: auto; }
.prl-fig figcaption { margin-top: 10px; font-size: 13.5px; line-height: 1.45; color: var(--text-3); text-align: center; }
