:root {
  --paper: #f8f7f1;
  --ink: #152d28;
  --muted: #4d625a;
  --line: #d4ddd2;
  --white: #fffefa;
  --mint: #e7efe2;
  --mint-soft: #f1f6ed;
  --green: #1f513f;
  --lime: #b8df43;
  --purple: #6443a6;
  --orange: #ad4325;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 8px 12px;
  border-radius: 9px;
  color: white;
  background: var(--green);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.site-wrap { width: min(1424px, calc(100% - 112px)); margin-inline: auto; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}
.header-inner {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 830;
  letter-spacing: -.035em;
  text-decoration: none;
}
.brand-mark { width: 36px; height: 36px; color: #86bd14; flex: none; }
.header-link {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.header-link:hover { color: var(--green); }

.catalog-hero { padding: clamp(38px, 4vw, 40px) 0 clamp(32px, 4vw, 38px); }
.catalog-hero h1, .subject-hero h1 {
  max-width: 920px;
  font-size: clamp(2.75rem, 6vw, 5rem);
  font-weight: 870;
  line-height: .93;
  letter-spacing: -.075em;
  text-wrap: balance;
}
.catalog-hero p, .subject-hero p {
  max-width: 770px;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.7vw, 1.3rem);
  text-wrap: pretty;
}

.subject-list { display: grid; gap: 24px; padding-bottom: 32px; }
.subject-band {
  padding: clamp(20px, 2vw, 24px);
  border: 1px solid #dce6d8;
  border-radius: var(--radius);
  background: var(--mint);
}
.subject-band h2 {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.055em;
  text-wrap: balance;
}
.subject-band h2::before {
  width: 8px;
  height: 42px;
  border-radius: 4px;
  background: var(--lime);
  content: "";
}
.subject-band h2 a { text-decoration: none; }
.subject-band h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; }
.subject-band:has(.empty-state) h2 { margin-bottom: 8px; }
.empty-state { margin-left: 28px; color: var(--muted); font-size: 1.12rem; }

.lesson-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 330px) auto;
  gap: clamp(18px, 3vw, 40px);
  align-items: center;
  padding: 12px 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 8px 24px rgb(28 64 49 / 4%);
}
.lesson-row + .lesson-row { margin-top: 14px; }
.lesson-copy h3 {
  font-size: clamp(1.35rem, 2.3vw, 1.9rem);
  font-weight: 840;
  line-height: 1.08;
  letter-spacing: -.045em;
  text-wrap: balance;
}
.lesson-copy h3 a { text-decoration: none; }
.lesson-copy h3 a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.lesson-copy p { margin-top: 10px; color: var(--muted); text-wrap: pretty; }
.lesson-copy .lesson-meta { margin-top: 8px; font-size: 1.08rem; }
.preview-frame {
  display: grid;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  border-radius: 16px;
  background: var(--mint-soft);
}
.lesson-preview { display: block; width: min(100%, 280px); }
.lesson-preview text {
  font: 800 18px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  paint-order: stroke;
  stroke: var(--mint-soft);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.lesson-action {
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 24px;
  border-radius: 999px;
  color: white;
  background: var(--green);
  font-size: 1rem;
  font-weight: 780;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms ease, background-color 160ms ease;
}
.lesson-action:hover { background: #173c30; transform: translateY(-2px); }
.lesson-action span { font-size: 1.25em; }

.breadcrumbs {
  display: flex;
  gap: 10px;
  padding-top: 30px;
  color: var(--muted);
  font-size: .92rem;
}
.breadcrumbs a { text-underline-offset: 4px; }
.subject-hero { padding: clamp(42px, 6vw, 78px) 0 clamp(32px, 5vw, 56px); }
.subject-band--page { margin-bottom: 80px; }
.subject-band--page .lesson-row { grid-template-columns: minmax(0, 1fr) minmax(220px, 330px) auto; }
.subject-empty {
  display: grid;
  min-height: 220px;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}
.subject-empty a { color: var(--green); text-underline-offset: 4px; }

.site-footer {
  padding: 22px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .95rem;
}

@media (max-width: 900px) {
  .site-wrap { width: min(100% - 44px, 760px); }
  .lesson-row, .subject-band--page .lesson-row { grid-template-columns: minmax(0, 1fr) minmax(190px, 38%); }
  .lesson-action { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 620px) {
  .site-wrap { width: calc(100% - 30px); }
  .header-inner { min-height: 64px; }
  .brand { gap: 9px; font-size: 1.05rem; }
  .brand-mark { width: 32px; height: 32px; }
  .header-link { font-size: .9rem; }
  .catalog-hero h1, .subject-hero h1 { font-size: clamp(2.65rem, 13vw, 3.55rem); }
  .subject-list { gap: 16px; padding-bottom: 48px; }
  .subject-band { padding: 20px; }
  .subject-band h2 { gap: 12px; margin-bottom: 16px; font-size: 1.65rem; }
  .subject-band h2::before { width: 6px; height: 31px; }
  .empty-state { margin-left: 18px; }
  .lesson-row, .subject-band--page .lesson-row { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .preview-frame { min-height: 150px; }
  .lesson-action { width: 100%; justify-self: stretch; }
  .subject-band--page { margin-bottom: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .lesson-action { transition: none; }
}
