:root {
  --ink: #070707;
  --ink-2: #171923;
  --muted: #5f7185;
  --line: rgba(24, 24, 24, .09);
  --paper: #fffefd;
  --white: #ffffff;
  --lavender: #49a8ff;
  --lavender-soft: #e8f6ff;
  --lilac-line: rgba(110, 190, 255, .2);
  --mint: #e6f8ef;
  --peach: #fff0cf;
  --lemon: #ffe994;
  --blue: #dff2ff;
  --sky: #68bdff;
  --sun: #ffd978;
  --shadow: 0 26px 70px rgba(42, 116, 171, .12);
  --radius-lg: 42px;
  --radius-md: 26px;
  --max: 1280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(92, 174, 239, .055) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(rgba(92, 174, 239, .055) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(circle at 12% 14%, rgba(255, 220, 128, .58), transparent 27%),
    radial-gradient(circle at 78% 10%, rgba(205, 235, 255, .92), transparent 34%),
    radial-gradient(circle at 78% 68%, rgba(224, 246, 255, .78), transparent 32%),
    #fffefd;
}

.paper-bg {
  position: fixed;
  inset: -10vh -8vw;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 16% 58%, transparent 0 23%, var(--lilac-line) 23.6% 25.6%, transparent 26.2%),
    radial-gradient(ellipse at 58% 22%, transparent 0 22%, var(--lilac-line) 22.8% 24.6%, transparent 25.4%),
    radial-gradient(ellipse at 92% 58%, transparent 0 22%, var(--lilac-line) 22.6% 24.6%, transparent 25.2%);
  transform: rotate(-12deg) scale(1.12);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.shell {
  width: min(calc(100% - 44px), var(--max));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 22px;
  z-index: 20;
  min-height: 86px;
  margin-top: 24px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, .22);
  border-radius: 50%;
  background: #fff;
  font: 900 17px/1 "Arial Black", Impact, sans-serif;
  letter-spacing: -.06em;
}

.brand-copy { display: grid; line-height: 1; }
.brand-copy strong { font: 900 24px/1 Georgia, serif; letter-spacing: -.04em; }
.brand-copy small { color: #c68b16; font: 800 11px/1.2 "Trebuchet MS", sans-serif; letter-spacing: .24em; text-transform: uppercase; }

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 36px);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #554b45;
}

.main-nav a {
  padding: 12px 2px;
  transition: color .2s ease, transform .2s ease;
}

.main-nav a:hover,
.main-nav a.active { color: var(--lavender); transform: translateY(-2px); }

.top-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 25px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
}

.btn:hover { transform: translateY(-3px) scale(1.015); }
.btn-primary { color: #fff; background: linear-gradient(135deg, #42a9ff 0%, #7ecbff 100%); box-shadow: 0 18px 34px rgba(59, 158, 238, .28); }
.btn-primary:hover { background: #12324a; box-shadow: 0 18px 34px rgba(18, 50, 74, .16); }
.btn-ghost { color: #161616; background: #fff; border: 1px solid rgba(0, 0, 0, .14); }
.btn-light { color: #111; background: #fff; }
.btn-xl { min-height: 64px; padding-inline: 42px; font-size: 18px; text-transform: uppercase; }

.hero {
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-columns: minmax(380px, .9fr) minmax(360px, 1.1fr);
  align-items: center;
  gap: 40px;
  padding: 58px 0 76px;
}

.kicker {
  margin: 0 0 14px;
  color: #c68b16;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: 13px;
}

.hero h1 {
  margin: 0;
  font: 900 clamp(68px, 9vw, 128px)/.84 "Arial Black", Impact, sans-serif;
  letter-spacing: -.07em;
}

.hero-lead {
  max-width: 560px;
  margin: 22px 0 32px;
  font-size: clamp(22px, 2.2vw, 29px);
  line-height: 1.1;
  letter-spacing: -.03em;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-visual {
  position: relative;
  min-height: 490px;
  display: grid;
  place-items: center;
}

.shape-loop {
  position: absolute;
  border: 26px solid rgba(106, 190, 255, .18);
  border-radius: 48%;
  transform: rotate(-28deg);
}

.shape-loop-a { width: 74%; height: 64%; right: 8%; top: 1%; }
.shape-loop-b { width: 66%; height: 58%; left: 0; bottom: 1%; transform: rotate(-28deg) translateY(20px); }

.photo-orbit {
  position: relative;
  z-index: 1;
  width: min(590px, 88vw);
  aspect-ratio: 1.1 / .84;
  overflow: hidden;
  border-radius: 52% 48% 44% 56% / 57% 43% 57% 43%;
  box-shadow: 0 30px 80px rgba(73, 168, 255, .18);
  transform: rotate(-4deg);
}

.photo-orbit img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: rotate(4deg) scale(1.09);
}

.floating-note {
  position: absolute;
  z-index: 2;
  padding: 16px 22px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .13);
  font-weight: 950;
  transform: rotate(-5deg);
}

.note-a { left: 8%; top: 18%; }
.note-b { right: 8%; bottom: 18%; }

.section { padding: 74px 0; }

.section-title { margin-bottom: 34px; }
.section-title h2,
.learning-copy h2,
.question-band h2,
.courses-hero h1,
.subject-intro h2 {
  margin: 0;
  color: var(--ink-2);
  font: 900 clamp(31px, 3.4vw, 48px)/.98 Georgia, "Times New Roman", serif;
  letter-spacing: -.045em;
}

.section-title.compact { max-width: 820px; }
.row-title { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.text-link { color: var(--lavender); font-weight: 950; }
.text-link::after { content: " ->"; }
.text-link.light { color: #fff; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  align-items: stretch;
}

.feature-card,
.teacher-card,
.benefit-card,
.quote-card,
.course-card {
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 45px rgba(20, 20, 20, .07);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.feature-card:hover,
.teacher-card:hover,
.benefit-card:hover,
.quote-card:hover,
.course-card:hover,
.direction-card:hover {
  transform: translateY(-10px) rotate(-.6deg);
  box-shadow: 0 28px 70px rgba(20, 20, 20, .14);
  border-color: rgba(73, 168, 255, .32);
}

.feature-card {
  min-height: 280px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.feature-card h3,
.direction-content h3,
.teacher-card h3,
.benefit-card h3,
.course-card h3 {
  margin: 0 0 14px;
  font: 900 24px/1.1 Georgia, serif;
  letter-spacing: -.04em;
}

.feature-card p,
.direction-content span,
.teacher-card p,
.benefit-card p,
.course-card p,
.courses-hero p,
.subject-intro p,
.learning-copy p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.card-number {
  align-self: start;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  font-weight: 950;
}

.peach { background: var(--peach); }
.lavender { background: var(--lavender-soft); }
.mint { background: var(--mint); }
.ink { background: #181818; color: #fff; }
.ink p { color: rgba(255, 255, 255, .74); }
.tall { transform: translateY(26px); }
.tall:hover { transform: translateY(8px) rotate(-.6deg); }

.direction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.direction-card {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border-radius: 48px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.direction-image {
  height: 360px;
  overflow: hidden;
  border-radius: 48px 48px 42% 42%;
}

.direction-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.direction-card:hover .direction-image img { transform: scale(1.06); }
.direction-content { padding: 32px; }
.direction-content h3 { font-size: clamp(26px, 2.2vw, 34px); }
.chemistry { background: linear-gradient(180deg, #fff 0%, #fff6dc 100%); }
.math { background: linear-gradient(180deg, #fff 0%, #eaf7ff 100%); }

.learning-card {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  gap: 34px;
  align-items: center;
  padding: 32px;
  border-radius: 54px;
  background: #181818;
  color: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .18);
}

.learning-photo {
  height: 500px;
  overflow: hidden;
  border-radius: 42px 42px 42% 42%;
  background: #eee;
}

.learning-photo img { width: 100%; height: 100%; object-fit: cover; }
.learning-copy { padding: 18px; }
.learning-copy h2 { color: #fff; }
.learning-copy p { color: rgba(255, 255, 255, .74); }

.step-list { display: grid; gap: 14px; margin: 30px 0; }
.step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .08);
}
.step span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #111;
  background: var(--lemon);
  font-weight: 950;
}
.step p { margin: 0; }

.teacher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.teacher-card {
  min-height: 440px;
  padding: 24px;
  background: #fff;
}
.teacher-card.dark { display: flex; flex-direction: column; justify-content: end; color: #fff; background: #181818; }
.teacher-card.dark p { color: rgba(255, 255, 255, .76); }
.teacher-photo {
  height: 220px;
  margin-bottom: 24px;
  border-radius: 34px;
  background-size: cover;
  background-position: center;
}
.chemistry-mini { background-image: url("img/chemistry-direction.png"); }
.math-mini { background-image: url("img/math-direction.png"); }

.review-strip {
  display: grid;
  grid-template-columns: 1.1fr .7fr .7fr;
  gap: 20px;
  align-items: stretch;
}
.review-strip h2 { margin: 0; font: 900 clamp(30px, 3vw, 42px)/1 Georgia, serif; letter-spacing: -.04em; }
.quote-card {
  min-height: 260px;
  padding: 28px;
  display: flex;
  align-items: end;
  color: #171717;
  background: #fff;
  font: 800 22px/1.28 Georgia, serif;
}

.question-band {
  margin-block: 40px 90px;
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 46px;
  background: linear-gradient(135deg, #fff 0%, #e7f6ff 48%, #fff1b8 100%);
  box-shadow: var(--shadow);
}
.question-band h2 { max-width: 780px; font-size: clamp(30px, 3vw, 44px); }

.footer {
  margin-bottom: 32px;
  padding: 34px;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 28px;
  border-radius: 38px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(0, 0, 0, .08);
}
.footer h4 { margin: 0 0 13px; }
.footer a:not(.brand) { display: block; margin: 10px 0; color: var(--muted); }

.courses-hero {
  margin-top: 42px;
  padding: 74px 52px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 30px;
  align-items: end;
  border-radius: 50px;
  background: rgba(255, 255, 255, .74);
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: var(--shadow);
}
.courses-hero p { max-width: 780px; font-size: 20px; }
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 18px;
  border-radius: 32px;
  background: #fff;
  border: 1px solid rgba(73, 168, 255, .18);
}
.mini-stats div {
  min-height: 112px;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 24px;
  background: #f1f9ff;
}
.mini-stats strong { display: block; color: var(--lavender); font: 950 34px/1 Georgia, serif; }
.mini-stats span { color: var(--muted); font-size: 12px; font-weight: 950; letter-spacing: .18em; text-transform: uppercase; }

.subject-section { padding-top: 64px; }
.subject-intro {
  margin-bottom: 26px;
  padding: 24px;
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  gap: 30px;
  align-items: center;
  overflow: hidden;
  border-radius: 46px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: var(--shadow);
}
.subject-intro.reverse { grid-template-columns: 1.05fr .95fr; }
.subject-intro > div { padding: 26px; }
.subject-intro img {
  width: 100%;
  height: 370px;
  object-fit: cover;
  border-radius: 36px 36px 38% 38%;
}
.chemistry-intro { background: linear-gradient(135deg, #fff 0%, #fff5dc 100%); }
.math-intro { background: linear-gradient(135deg, #fff 0%, #e8f6ff 100%); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.course-card {
  min-height: 330px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, .92);
  color: #181818;
}
.course-card.photo-card:nth-child(odd) { background: linear-gradient(180deg, #fff 0%, #fff8e9 100%); }
.course-card.photo-card:nth-child(even) { background: linear-gradient(180deg, #fff 0%, #eaf7ff 100%); }
.course-badge {
  align-self: start;
  padding: 8px 13px;
  border-radius: 999px;
  color: #fff;
  background: #171717;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
}
.course-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.course-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  color: var(--muted);
  font-weight: 850;
}
.course-card strong { color: var(--lavender); font: 950 30px/1 Georgia, serif; }

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.benefit-card {
  min-height: 260px;
  padding: 24px;
  background: #fff;
}

/* Detail pages compatibility */
.course-detail-hero,
.detail-hero,
.course-page-hero {
  margin-top: 42px;
  padding: 58px;
  border-radius: 46px;
  background: rgba(255, 255, 255, .84);
  box-shadow: var(--shadow);
}
.course-detail-hero h1,
.detail-hero h1,
.course-page-hero h1 { margin: 0; font: 900 clamp(42px, 6vw, 86px)/.92 Georgia, serif; letter-spacing: -.055em; }
.program-card,
.tariff-card,
.review-card,
.signup-card,
.teacher-profile,
.lesson-card {
  border-radius: 28px;
  padding: 26px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .08);
  box-shadow: 0 16px 45px rgba(20, 20, 20, .07);
}

@media (max-width: 1080px) {
  .topbar { align-items: stretch; border-radius: 34px; flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .hero,
  .courses-hero,
  .learning-card,
  .subject-intro,
  .subject-intro.reverse { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .feature-grid,
  .course-grid,
  .benefit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .teacher-grid,
  .review-strip { grid-template-columns: 1fr; }
  .direction-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { width: min(calc(100% - 24px), var(--max)); }
  .topbar { top: 10px; margin-top: 10px; padding: 12px; }
  .brand-copy small { letter-spacing: .14em; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; padding-inline: 14px; }
  .main-nav { display: none; }
  .hero { padding-top: 44px; gap: 12px; }
  .hero h1 { font-size: 68px; }
  .hero-lead { font-size: 25px; }
  .btn-xl { width: 100%; min-height: 56px; font-size: 15px; }
  .hero-visual { min-height: 410px; }
  .floating-note { font-size: 12px; padding: 12px 14px; }
  .section { padding: 48px 0; }
  .section-title h2,
  .learning-copy h2,
  .question-band h2,
  .courses-hero h1,
  .subject-intro h2 { font-size: 31px; }
  .row-title { display: block; }
  .feature-grid,
  .course-grid,
  .benefit-grid,
  .mini-stats { grid-template-columns: 1fr; }
  .tall { transform: none; }
  .direction-card { min-height: auto; border-radius: 34px; }
  .direction-image { height: 300px; border-radius: 34px 34px 34% 34%; }
  .learning-card,
  .courses-hero,
  .subject-intro,
  .question-band,
  .footer { padding: 22px; border-radius: 30px; }
  .learning-photo { height: 320px; border-radius: 28px; }
  .subject-intro img { height: 300px; }
  .question-band { display: block; }
  .question-band .btn { margin-top: 20px; }
  .footer { grid-template-columns: 1fr; }
}
