:root {
  color-scheme: dark;
  --bg: #070a12;
  --bg-soft: #0d1324;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --muted: #aeb8ca;
  --faint: rgba(245, 247, 251, 0.14);
  --line: rgba(255, 255, 255, 0.16);
  --accent: #7dd3fc;
  --accent-strong: #c084fc;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 999px;
  --font-main: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8ff;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --text: #111827;
  --muted: #546179;
  --faint: rgba(17, 24, 39, 0.11);
  --line: rgba(17, 24, 39, 0.14);
  --accent: #2563eb;
  --accent-strong: #7c3aed;
  --shadow: 0 24px 80px rgba(31, 41, 55, 0.15);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-main);
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, rgba(125, 211, 252, 0.22), transparent 32rem),
    radial-gradient(circle at 82% 12%, rgba(192, 132, 252, 0.18), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(var(--faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--faint) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 82%);
}

.page-glow {
  position: fixed;
  inset: auto 10% -12rem auto;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.26), transparent 68%);
  filter: blur(8px);
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 220px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.16), rgba(192, 132, 252, 0.14));
  font-size: 1.75rem;
  font-weight: 800;
}

.brand-text {
  display: grid;
  gap: 2px;
}

.brand-eyebrow {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}

.app-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.app-author {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.app-author a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.app-author a:hover {
  color: var(--accent);
  border-color: currentColor;
}

.app-preferences {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.pref-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip-group {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
}

.chip {
  display: inline-grid;
  min-width: 34px;
  min-height: 30px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  transition: transform 180ms ease, color 180ms ease, background 180ms ease;
}

.chip:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.chip.is-active {
  color: #06111f;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.hero {
  max-width: 860px;
  padding: 92px 0 52px;
}

.hero-kicker,
.section-kicker {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
}

.hero-lead {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  line-height: 1.75;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading h2 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

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

.module-card {
  position: relative;
  display: grid;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent),
    var(--panel);
  box-shadow: var(--shadow);
  text-decoration: none;
  isolation: isolate;
  backdrop-filter: blur(20px);
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.module-card::after {
  position: absolute;
  inset: auto -10% -32% 25%;
  z-index: -1;
  height: 64%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(125, 211, 252, 0.18), transparent 68%);
  content: "";
  transition: opacity 220ms ease, transform 220ms ease;
}

.module-card:nth-child(2)::after {
  background: radial-gradient(circle, rgba(192, 132, 252, 0.2), transparent 68%);
}

.module-card:hover,
.module-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
  outline: none;
  transform: translateY(-6px);
}

.module-card:hover::after,
.module-card:focus-visible::after {
  opacity: 0.9;
  transform: scale(1.08);
}

.module-visual {
  display: grid;
  min-height: 250px;
  place-items: center;
  padding: 30px 28px 10px;
  color: var(--accent);
}

.module-card:nth-child(2) .module-visual {
  color: var(--accent-strong);
}

.math-svg {
  width: min(100%, 420px);
  height: auto;
  overflow: visible;
}

.svg-grid path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.14;
}

.svg-axis path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 3;
  opacity: 0.55;
}

.svg-vectors path,
.svg-curve,
.svg-tangent {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svg-vectors path:first-child {
  stroke-width: 8;
}

.svg-vectors path:nth-child(2),
.svg-vectors path:nth-child(3) {
  stroke-width: 4;
  opacity: 0.62;
}

.svg-matrix rect {
  fill: rgba(255, 255, 255, 0.08);
  stroke: currentColor;
  stroke-width: 2;
  opacity: 0.72;
}

.svg-matrix path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 3;
  opacity: 0.72;
}

.svg-area {
  fill: url(#areaGradient);
}

.svg-curve {
  stroke-width: 7;
}

.svg-tangent {
  stroke-width: 4;
  stroke-dasharray: 12 10;
  opacity: 0.62;
}

.svg-point {
  fill: currentColor;
  filter: drop-shadow(0 0 18px currentColor);
}

.svg-bars rect {
  fill: currentColor;
  opacity: 0.18;
}

.module-content {
  display: grid;
  align-content: end;
  gap: 14px;
  padding: 0 30px 32px;
}

.module-number {
  width: max-content;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.module-title {
  display: block;
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-weight: 800;
  line-height: 1;
}

.module-copy {
  display: block;
  max-width: 50ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.module-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.94rem;
  font-weight: 900;
}

.module-card:nth-child(2) .module-link {
  color: var(--accent-strong);
}

.app-footer {
  padding: 34px 0 0;
  color: var(--muted);
  text-align: center;
}

.app-footer p {
  margin-bottom: 0;
  font-size: 0.94rem;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 28px, 1160px);
    padding-top: 14px;
  }

  .app-header {
    flex-direction: column;
  }

  .app-header-right {
    align-items: flex-start;
    width: 100%;
  }

  .app-preferences {
    justify-content: flex-start;
  }

  .hero {
    padding-top: 64px;
  }

  .section-heading {
    display: block;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-card {
    min-height: 470px;
  }
}

@media (max-width: 520px) {
  .app-header {
    border-radius: 22px;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .app-preferences {
    gap: 7px;
  }

  .pref-label {
    width: 100%;
  }

  .module-visual {
    min-height: 210px;
    padding-inline: 18px;
  }

  .module-content {
    padding-inline: 22px;
  }
}
