:root {
  --page: #eef6ff;
  --page-2: #f7fbff;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-solid: #ffffff;
  --ink: #071633;
  --heading: #0b1f4a;
  --muted: #405273;
  --soft: #6b7894;
  --line: rgba(31, 85, 200, 0.16);
  --line-strong: rgba(31, 85, 200, 0.28);
  --primary: #1f55c8;
  --primary-strong: #153a8a;
  --primary-soft: #edf5ff;
  --primary-glow: rgba(31, 85, 200, 0.18);
  --accent: #dc6e3c;
  --accent-soft: #fff5ed;
  --success: #1f8a5b;
  --success-soft: #effaf5;
  --warning: #b64b2f;
  --warning-soft: #fff4ef;
  --shadow: 0 18px 48px rgba(15, 55, 130, 0.10);
  --shadow-soft: 0 10px 26px rgba(15, 55, 130, 0.075);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, "Noto Sans Hebrew", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 14% 0%, rgba(79, 142, 247, 0.18), transparent 28rem),
    radial-gradient(circle at 86% 4%, rgba(31, 85, 200, 0.12), transparent 34rem),
    linear-gradient(180deg, var(--page) 0%, #eaf2ff 44%, var(--page-2) 100%);
  color: var(--ink);
  line-height: 1.85;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -54px;
  z-index: 20;
  background: var(--ink);
  color: #fff;
  padding: 9px 14px;
  border-radius: 999px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(247, 251, 255, 0.82);
  border-bottom: 1px solid rgba(31, 85, 200, 0.12);
  backdrop-filter: blur(18px);
  box-shadow: 0 10px 28px rgba(15, 55, 130, 0.055);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--primary-strong), #5a8fd6);
  box-shadow: 0 8px 18px rgba(31, 85, 200, 0.28);
}

.top-nav,
.hero-actions,
.lesson-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.top-nav a,
.nav-button,
.hero-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid rgba(31, 85, 200, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--primary-strong);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(31, 85, 200, 0.065);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.top-nav a:hover,
.nav-button:hover,
.hero-actions a:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 85, 200, 0.38);
  background: linear-gradient(135deg, var(--primary-strong), #4f8df7);
  color: #fff;
  box-shadow: 0 14px 30px rgba(31, 85, 200, 0.20);
}

.nav-button.disabled {
  color: #8793aa;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: none;
  pointer-events: none;
}

.course-page,
.lesson-page {
  width: min(1220px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.course-hero,
.lesson-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(280px, 0.72fr);
  gap: clamp(24px, 4vw, 46px);
  align-items: center;
  min-height: 430px;
  padding: clamp(34px, 6vw, 72px);
  border: 1px solid rgba(31, 85, 200, 0.16);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.96)),
    radial-gradient(circle at 12% 18%, rgba(79, 141, 247, 0.16), transparent 18rem);
  box-shadow: var(--shadow);
}

.lesson-hero {
  grid-template-columns: 1fr;
  min-height: 0;
  align-items: start;
}

.course-hero::before,
.lesson-hero::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 7px;
  background: linear-gradient(180deg, var(--primary-strong), #4f8df7);
}

.course-hero::after,
.lesson-hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -120px;
  inset-block-start: -120px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 141, 247, 0.20), transparent 66%);
  pointer-events: none;
}

.hero-copy,
.lesson-hero > * {
  position: relative;
  z-index: 1;
}

.course-label,
.breadcrumb {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 14px;
  padding: 7px 14px;
  border: 1px solid rgba(31, 85, 200, 0.18);
  border-radius: 999px;
  background: rgba(31, 85, 200, 0.10);
  color: var(--primary-strong);
  font-size: 14px;
  font-weight: 900;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.22;
  letter-spacing: 0;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 900;
}

h2 {
  margin: 0 0 20px;
  font-size: clamp(27px, 3.3vw, 40px);
  font-weight: 850;
}

h3 {
  margin: 30px 0 12px;
  font-size: 23px;
  font-weight: 800;
}

h4 {
  margin: 0 0 10px;
  font-size: 19px;
}

p {
  margin: 0 0 18px;
}

.course-hero p,
.lesson-hero p,
.course-section > p,
.content-section p,
.content-section li {
  color: var(--muted);
  font-size: 18px;
  font-weight: 400;
}

.course-hero p,
.lesson-hero p,
.course-section > p {
  max-width: 920px;
}

.hero-actions {
  margin-top: 22px;
}

.hero-meta,
.lesson-meta,
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.hero-meta {
  margin-top: 22px;
}

.hero-meta span,
.lesson-meta span,
.card-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 11px;
  border: 1px solid rgba(31, 85, 200, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(31, 85, 200, 0.045);
}

.lesson-meta {
  margin-top: 18px;
}

.hero-visual {
  position: relative;
  z-index: 1;
  min-height: 300px;
  padding: 22px;
  border: 1px solid rgba(31, 85, 200, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(31, 85, 200, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 85, 200, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbff, #ffffff);
  background-size: 30px 30px, 30px 30px, auto;
  box-shadow: 0 20px 42px rgba(31, 85, 200, 0.10);
}

.power-chain {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.power-chain span,
.power-chain strong {
  display: block;
  padding: 12px 14px;
  border-radius: 16px;
  text-align: center;
}

.power-chain span {
  border: 1px solid rgba(31, 85, 200, 0.25);
  color: var(--primary-strong);
  background: rgba(237, 245, 255, 0.92);
}

.power-chain strong {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-strong), #4f8df7);
  box-shadow: 0 12px 26px rgba(31, 85, 200, 0.22);
}

.waveform {
  display: flex;
  align-items: end;
  gap: 9px;
  height: 72px;
  margin-top: 28px;
  padding-top: 10px;
  border-top: 2px solid rgba(220, 110, 60, 0.42);
}

.waveform span {
  width: 100%;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, #f59e63, var(--accent));
  box-shadow: 0 8px 16px rgba(220, 110, 60, 0.18);
}

.waveform span:nth-child(1) { height: 36px; }
.waveform span:nth-child(2) { height: 20px; }
.waveform span:nth-child(3) { height: 56px; }
.waveform span:nth-child(4) { height: 30px; }
.waveform span:nth-child(5) { height: 66px; }

.course-section,
.content-section {
  position: relative;
  margin-top: 38px;
}

.course-section {
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid rgba(31, 85, 200, 0.13);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}

.content-section {
  padding: clamp(28px, 4vw, 48px) clamp(22px, 4vw, 52px);
  border: 1px solid rgba(31, 85, 200, 0.13);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 255, 0.98));
  box-shadow: 0 14px 36px rgba(15, 55, 130, 0.078);
}

.content-section::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 5px;
  border-radius: 24px 0 0 24px;
  background: linear-gradient(180deg, var(--primary-strong), #4f8df7);
}

.content-section h3 {
  position: relative;
  padding-inline-start: 17px;
}

.content-section h3::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 7px;
  width: 6px;
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), #6aa0ff);
}

.content-section ul,
.content-section ol {
  padding-inline-start: 24px;
  margin: 0 0 20px;
}

.content-section li {
  margin-bottom: 8px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 18px;
}

.lesson-card {
  position: relative;
  display: block;
  min-height: 250px;
  padding: 25px;
  overflow: hidden;
  border: 1px solid rgba(31, 85, 200, 0.15);
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(31, 85, 200, 0.07);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.lesson-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-strong), #4f8df7);
}

.lesson-card:hover {
  transform: translateY(-5px);
  border-color: rgba(31, 85, 200, 0.34);
  box-shadow: 0 22px 46px rgba(31, 85, 200, 0.14);
}

.lesson-number {
  display: inline-flex;
  margin-bottom: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(220, 110, 60, 0.11);
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.lesson-card h3 {
  margin-top: 0;
  color: var(--primary-strong);
  font-size: 23px;
}

.lesson-card h3::before {
  display: none;
}

.lesson-card p {
  color: var(--muted);
  font-size: 16.5px;
}

.lesson-nav {
  justify-content: space-between;
  margin: 24px 0 34px;
}

.footer-nav {
  margin-top: 36px;
}

.lesson-toc {
  margin-top: 24px;
  padding: 22px 24px;
  border: 1px solid rgba(31, 85, 200, 0.15);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 255, 0.94));
  box-shadow: 0 12px 28px rgba(31, 85, 200, 0.07);
}

.lesson-toc strong {
  display: block;
  margin-bottom: 12px;
  color: var(--heading);
  font-size: 19px;
}

.lesson-toc ul {
  columns: 2;
  column-gap: 30px;
  padding-inline-start: 20px;
  margin: 0;
}

.lesson-toc li {
  break-inside: avoid;
  margin-bottom: 7px;
}

.lesson-toc a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.lesson-toc a:hover {
  color: var(--primary);
}

.lesson-toc a.is-active {
  color: var(--primary-strong);
  font-weight: 900;
}

.note,
.example-block,
.exercise-block,
.answer-block,
.equation,
.definition,
.intuition,
.design-rule,
.warning,
.mistake-block,
.diagram,
.overview-card,
.formula-card {
  margin: 22px 0;
  padding: 22px 24px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(31, 85, 200, 0.055);
}

.note,
.definition {
  border: 1px solid rgba(31, 85, 200, 0.18);
  border-inline-start: 5px solid var(--primary);
  background: linear-gradient(135deg, #f2f7ff, #ffffff);
}

.intuition {
  border: 1px solid rgba(220, 110, 60, 0.28);
  border-inline-start: 5px solid var(--accent);
  background: linear-gradient(135deg, #fff7ef, #ffffff);
}

.design-rule,
.answer-block {
  border: 1px solid rgba(31, 138, 91, 0.18);
  border-inline-start: 5px solid var(--success);
  background: linear-gradient(135deg, var(--success-soft), #ffffff);
}

.warning,
.mistake-block {
  border: 1px solid rgba(182, 75, 47, 0.20);
  border-inline-start: 5px solid var(--warning);
  background: linear-gradient(135deg, var(--warning-soft), #ffffff);
}

.example-block {
  border: 1px solid rgba(70, 130, 200, 0.22);
  border-inline-start: 5px solid #4682c8;
  background: linear-gradient(135deg, #f4f8ff, #ffffff);
}

.exercise-block {
  border: 1px solid rgba(220, 110, 60, 0.26);
  border-inline-start: 5px solid var(--accent);
  background: linear-gradient(135deg, #fff7ef, #ffffff);
}

.mistake-block strong,
.definition strong,
.intuition strong,
.design-rule strong,
.warning strong,
.note strong,
.answer-block strong {
  color: var(--heading);
}

.equation {
  overflow-x: auto;
  direction: ltr;
  text-align: center;
  font-family: Consolas, Monaco, "Courier New", monospace;
  border: 1px solid rgba(31, 85, 200, 0.18);
  border-inline-start: 5px solid var(--primary);
  background: linear-gradient(135deg, #f3f8ff, #ffffff);
  color: var(--heading);
  line-height: 1.65;
}

.ym-math-inline {
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

.ym-math-block {
  direction: ltr;
  text-align: center;
  margin: 1.4rem 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.ym-math-highlight {
  background: linear-gradient(135deg, #eef6ff, #f8fbff);
  border: 1px solid rgba(59, 130, 246, 0.28);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.ym-math-block mjx-container {
  margin: 0 auto !important;
  overflow-x: auto;
  overflow-y: hidden;
}

.ym-math-inline mjx-container {
  display: inline-block;
  vertical-align: middle;
}

.diagram {
  overflow-x: auto;
  direction: ltr;
  border: 1px solid rgba(31, 85, 200, 0.16);
  background:
    linear-gradient(90deg, rgba(31, 85, 200, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 85, 200, 0.055) 1px, transparent 1px),
    #fbfdff;
  background-size: 24px 24px;
  color: #182842;
  font-family: Consolas, Monaco, "Courier New", monospace;
  line-height: 1.55;
  white-space: pre;
}

.overview-grid,
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.overview-card,
.formula-card {
  border: 1px solid rgba(31, 85, 200, 0.14);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.overview-card h3,
.formula-card h3,
.example-block h3 {
  color: var(--primary-strong);
}

.overview-card h3::before,
.formula-card h3::before,
.example-block h3::before {
  display: none;
}

.waveform-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin: 24px 0;
  padding: 0;
}

.waveform-list li {
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(31, 85, 200, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  list-style: none;
  box-shadow: 0 10px 22px rgba(31, 85, 200, 0.055);
}

.waveform-list strong {
  display: block;
  margin-bottom: 7px;
  color: var(--primary-strong);
}

.example-block ol,
.answer-block ol,
.exercise-block ol {
  margin-bottom: 0;
}

.section-kicker {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(220, 110, 60, 0.11);
  color: var(--accent);
  font-weight: 900;
}

.compact-list li {
  margin-bottom: 6px;
}

.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border: 1px solid rgba(31, 85, 200, 0.14);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(31, 85, 200, 0.055);
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  overflow: hidden;
  background: var(--surface-solid);
}

th,
td {
  padding: 15px 18px;
  border: 1px solid rgba(31, 85, 200, 0.09);
  text-align: right;
  vertical-align: top;
  color: var(--muted);
}

th {
  background: linear-gradient(135deg, #eaf3ff, #f7fbff);
  color: var(--heading);
  font-weight: 900;
}

tr:hover td {
  background: rgba(31, 85, 200, 0.035);
}

@media (max-width: 920px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .course-hero,
  .lesson-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-visual {
    min-height: auto;
  }

  .lesson-toc ul {
    columns: 1;
  }

  .lesson-nav {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .course-page,
  .lesson-page {
    width: min(100% - 22px, 1220px);
    padding-top: 20px;
  }

  .course-hero,
  .lesson-hero,
  .course-section,
  .content-section {
    border-radius: 20px;
    padding: 26px 20px;
  }

  .content-section::before,
  .course-hero::before,
  .lesson-hero::before {
    width: 4px;
  }

  h1 {
    font-size: clamp(36px, 11vw, 52px);
  }

  .top-nav a,
  .nav-button,
  .hero-actions a {
    width: 100%;
  }

  .lesson-card {
    min-height: auto;
  }

  .course-hero p,
  .lesson-hero p,
  .course-section > p,
  .content-section p,
  .content-section li {
    font-size: 17px;
  }

  .note,
  .example-block,
  .exercise-block,
  .answer-block,
  .equation,
  .definition,
  .intuition,
  .design-rule,
  .warning,
  .mistake-block,
  .diagram,
  .overview-card,
  .formula-card {
    padding: 18px;
    border-radius: 16px;
  }
}
