/* =========================================================
   NCERTNest — clean green study design system
   ========================================================= */

:root {
  --brand-700: #047857;
  --brand-600: #059669;
  --brand-500: #10b981;
  --brand-400: #34d399;
  --brand-100: #d1fae5;
  --brand-50: #ecfdf5;

  --ink-900: #081c15;
  --ink-800: #0f2e24;
  --ink-700: #1f3d33;
  --ink-500: #5b7268;
  --ink-400: #7d938a;

  --line: #e3ede8;
  --line-strong: #cfdfd7;
  --bg: #f7faf8;
  --bg-alt: #f0f7f3;
  --card: #ffffff;

  --amber: #f59e0b;
  --amber-soft: #fff7e6;
  --blue: #0ea5e9;
  --blue-soft: #e8f7ff;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --shadow-xs: 0 1px 2px rgba(8, 28, 21, 0.05);
  --shadow-sm: 0 6px 18px -10px rgba(8, 28, 21, 0.18);
  --shadow: 0 16px 40px -20px rgba(8, 28, 21, 0.28);
  --shadow-lg: 0 36px 70px -30px rgba(8, 28, 21, 0.35);

  --container: 1180px;
  --header-h: 72px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-800);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open,
body.nav-open {
  overflow: hidden;
  touch-action: none;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink-900);
  line-height: 1.18;
  letter-spacing: -0.025em;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.4);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  z-index: 500;
  padding: 10px 16px;
  background: var(--ink-900);
  color: #fff;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: top 0.2s ease;
}

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

/* ========================= Buttons & pills ========================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.82rem 1.4rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(5, 150, 105, 0.8);
}

.btn-primary:hover {
  box-shadow: 0 14px 26px -12px rgba(5, 150, 105, 0.9);
  transform: translateY(-1px);
}

.btn-light {
  background: #fff;
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
}

.btn-light:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-700);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  border-color: var(--brand-500);
  color: var(--brand-700);
  background: var(--brand-50);
}

.btn-sm {
  padding: 0.62rem 1rem;
  font-size: 0.84rem;
  border-radius: 10px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-soft {
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}

.pill-brand {
  background: var(--brand-50);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--brand-600);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ========================= Header ========================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 120;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px -24px rgba(8, 28, 21, 0.5);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  box-shadow: 0 8px 18px -10px rgba(5, 150, 105, 0.9);
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.16rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink-900);
}

.brand-name span {
  color: var(--brand-600);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  color: var(--ink-500);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-link:hover {
  color: var(--brand-700);
  background: var(--brand-50);
}

.nav-link.active {
  color: var(--brand-700);
  background: var(--brand-50);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-500);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.icon-btn:hover {
  color: var(--brand-700);
  border-color: var(--brand-400);
  background: var(--brand-50);
}

.menu-btn {
  display: none;
}

/* ========================= Home hero ========================= */

.hero {
  position: relative;
  overflow: hidden;
  padding: 84px 0 72px;
  border-bottom: 1px solid var(--line);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(55% 60% at 12% 8%, rgba(16, 185, 129, 0.16), transparent 62%),
    radial-gradient(45% 55% at 88% 12%, rgba(245, 158, 11, 0.13), transparent 60%),
    radial-gradient(50% 60% at 70% 95%, rgba(14, 165, 233, 0.08), transparent 60%);
  pointer-events: none;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(8, 28, 21, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 28, 21, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(60% 80% at 50% 30%, #000 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(60% 80% at 50% 30%, #000 20%, transparent 100%);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 56px;
  align-items: center;
}

.hero-copy {
  max-width: 620px;
}

.hero h1 {
  margin: 16px 0 18px;
  font-size: clamp(2.5rem, 4.6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero h1 .accent {
  background: linear-gradient(120deg, var(--brand-500), var(--brand-700) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 52ch;
  color: var(--ink-500);
  font-size: 1.06rem;
  line-height: 1.68;
}

.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  padding: 7px 7px 7px 16px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-search:focus-within {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.hero-search > i {
  color: var(--ink-400);
  font-size: 0.95rem;
}

.hero-search input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-800);
  font-size: 0.95rem;
}

.hero-search input::placeholder {
  color: var(--ink-400);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--ink-400);
}

.quick-chip {
  padding: 0.3rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-500);
  font-size: 0.76rem;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.quick-chip:hover {
  color: var(--brand-700);
  border-color: var(--brand-400);
  background: var(--brand-50);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 34px 0 0;
  padding: 0;
}

.hero-stats > div {
  padding: 0 26px;
  border-left: 1px solid var(--line-strong);
}

.hero-stats > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.hero-stats dt {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink-900);
  line-height: 1.2;
}

.hero-stats dd {
  margin: 2px 0 0;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Hero visual */

.hero-visual {
  position: relative;
  min-height: 430px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visual-glow {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.24), transparent 68%);
  filter: blur(10px);
}

.visual-card {
  position: relative;
  z-index: 2;
  width: min(100%, 400px);
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.visual-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.visual-dots {
  display: flex;
  gap: 5px;
}

.visual-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}

.visual-subject {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-alt);
  border-radius: 14px;
}

.visual-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  color: var(--brand-600);
  font-size: 1.05rem;
  box-shadow: var(--shadow-xs);
}

.visual-subject strong {
  display: block;
  font-size: 0.98rem;
}

.visual-subject small {
  display: block;
  color: var(--ink-400);
  font-size: 0.74rem;
}

.visual-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.visual-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--ink-700);
}

.visual-row span:not(.visual-check) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visual-row em {
  font-style: normal;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.visual-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: 0.6rem;
  flex-shrink: 0;
}

.visual-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-alt);
  overflow: hidden;
}

.visual-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
}

.visual-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 8px;
  color: var(--ink-400);
  font-size: 0.72rem;
}

.visual-foot strong {
  color: var(--brand-700);
  font-size: 0.8rem;
}

.float-card {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: floaty 6s ease-in-out infinite;
}

.float-card strong {
  display: block;
  font-size: 0.86rem;
  color: var(--ink-900);
  line-height: 1.2;
}

.float-card small {
  display: block;
  color: var(--ink-400);
  font-size: 0.68rem;
}

.float-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 0.85rem;
}

.float-a {
  top: 26px;
  left: -18px;
}

.float-b {
  right: -12px;
  bottom: 34px;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  animation-delay: 1.6s;
}

.float-b strong {
  font-size: 1.2rem;
  color: var(--brand-700);
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* ========================= Sections ========================= */

.section {
  padding: 84px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

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

.section-title {
  font-size: clamp(1.7rem, 2.6vw, 2.25rem);
  font-weight: 800;
}

.section-sub {
  max-width: 62ch;
  margin-top: 10px;
  color: var(--ink-500);
  font-size: 0.96rem;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 4px;
  color: var(--brand-700);
  font-size: 0.88rem;
  font-weight: 600;
}

.section-link i {
  transition: transform 0.18s ease;
}

.section-link:hover i {
  transform: translateX(3px);
}

/* ========================= Class cards ========================= */

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 18px;
}

.class-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 218px;
  padding: 22px 22px 18px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.class-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--tone), var(--tone-soft));
}

.class-card:hover {
  transform: translateY(-4px);
  border-color: var(--tone);
  box-shadow: var(--shadow);
}

.class-roman {
  position: absolute;
  top: 8px;
  right: 14px;
  color: var(--tone-soft);
  font-size: 4.4rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.class-card-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1;
}

.class-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 1rem;
}

.class-pill {
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.class-card h3 {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  font-size: 1.3rem;
  font-weight: 800;
}

.class-meta {
  position: relative;
  z-index: 1;
  color: var(--ink-400);
  font-size: 0.82rem;
}

.subject-chips {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 0.26rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdfc;
  color: var(--ink-500);
  font-size: 0.7rem;
  font-weight: 500;
}

.chip-more {
  color: var(--ink-400);
  background: transparent;
  border-style: dashed;
}

.class-card-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--tone);
  font-size: 0.82rem;
  font-weight: 600;
}

.class-card-foot i {
  transition: transform 0.18s ease;
}

.class-card:hover .class-card-foot i {
  transform: translateX(3px);
}

/* Tone palette */

.tone-green { --tone: #059669; --tone-soft: #d1fae5; }
.tone-blue { --tone: #0284c7; --tone-soft: #e0f2fe; }
.tone-amber { --tone: #d97706; --tone-soft: #fef3c7; }
.tone-violet { --tone: #7c3aed; --tone-soft: #ede9fe; }
.tone-teal { --tone: #0d9488; --tone-soft: #ccfbf1; }
.tone-rose { --tone: #e11d48; --tone-soft: #ffe4e6; }
.tone-indigo { --tone: #4f46e5; --tone-soft: #e0e7ff; }
.tone-cyan { --tone: #0891b2; --tone-soft: #cffafe; }
.tone-lime { --tone: #65a30d; --tone-soft: #ecfccb; }

/* ========================= Features ========================= */

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

.feature-card {
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 1.1rem;
}

.feature-card h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  font-weight: 700;
}

.feature-card p {
  color: var(--ink-500);
  font-size: 0.9rem;
  line-height: 1.66;
}

/* ========================= Topic cards ========================= */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.topic-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.topic-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand-400);
  box-shadow: var(--shadow);
}

.topic-tag {
  color: var(--brand-700);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topic-card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.4;
}

.topic-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  color: var(--ink-400);
  font-size: 0.78rem;
  font-weight: 600;
}

.topic-card:hover .topic-link {
  color: var(--brand-700);
}

/* ========================= Steps ========================= */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 26px 24px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.step-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--brand-700);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}

.step h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  font-weight: 700;
}

.step p {
  color: var(--ink-500);
  font-size: 0.88rem;
  line-height: 1.65;
}

/* ========================= CTA ========================= */

.cta-band {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  overflow: hidden;
  padding: 46px 48px;
  border-radius: var(--radius-xl);
  background: linear-gradient(120deg, var(--brand-700), var(--brand-600) 55%, var(--brand-500));
  box-shadow: var(--shadow);
}

.cta-band::before,
.cta-band::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.cta-band::before {
  width: 320px;
  height: 320px;
  right: -80px;
  top: -160px;
}

.cta-band::after {
  width: 200px;
  height: 200px;
  right: 90px;
  bottom: -130px;
}

.cta-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.cta-copy h2 {
  color: #fff;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  font-weight: 800;
}

.cta-copy p {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.94rem;
}

.cta-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.cta-actions .btn-ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.cta-actions .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

/* ========================= Inner page hero ========================= */

.page-hero {
  position: relative;
  padding: 54px 0 46px;
  background:
    radial-gradient(50% 90% at 85% 0%, rgba(16, 185, 129, 0.1), transparent 65%),
    linear-gradient(180deg, #fff, var(--bg));
  border-bottom: 1px solid var(--line);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--ink-400);
  font-size: 0.78rem;
}

.breadcrumbs a {
  color: var(--ink-500);
  font-weight: 500;
}

.breadcrumbs a:hover {
  color: var(--brand-700);
}

.breadcrumbs i {
  font-size: 0.55rem;
  color: var(--line-strong);
}

.page-title {
  margin-top: 6px;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.page-sub {
  max-width: 66ch;
  margin-top: 12px;
  color: var(--ink-500);
  font-size: 0.98rem;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.page-meta .badge {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-500);
}

.page-meta .badge i {
  color: var(--brand-600);
}

/* ========================= Subject cards ========================= */

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.subject-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.subject-card:hover {
  transform: translateY(-3px);
  border-color: var(--tone);
  box-shadow: var(--shadow);
}

.subject-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 1.1rem;
}

.subject-body {
  flex: 1;
  min-width: 0;
}

.subject-body h3 {
  font-size: 1rem;
  font-weight: 700;
}

.subject-body p {
  margin-top: 3px;
  color: var(--ink-400);
  font-size: 0.78rem;
}

.subject-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-400);
  font-size: 0.72rem;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.subject-card:hover .subject-arrow {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
  transform: translateX(2px);
}

/* ========================= Subject page layout ========================= */

.subject-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.subject-layout > * {
  min-width: 0;
}

.chapter-panel,
.chapter-viewer {
  min-width: 0;
}

.filter-wrap {
  min-width: 0;
}

.filter-wrap input {
  min-width: 0;
}

.chapter-panel {
  position: sticky;
  top: calc(var(--header-h) + 22px);
  max-height: calc(100vh - var(--header-h) - 44px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.chapter-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.filter-wrap {
  position: relative;
  flex: 1;
}

.filter-wrap > i {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--ink-400);
  font-size: 0.8rem;
  pointer-events: none;
}

.filter-wrap input {
  width: 100%;
  padding: 0.58rem 0.7rem 0.58rem 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  outline: none;
  font-size: 0.84rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.filter-wrap input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.chapter-count {
  flex-shrink: 0;
  color: var(--ink-400);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.chapter-list {
  overflow-y: auto;
  min-width: 0;
  padding: 8px;
  scrollbar-width: thin;
}

.chapter-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 11px;
  transition: background 0.16s ease;
}

.chapter-row + .chapter-row {
  margin-top: 2px;
}

.chapter-row:hover {
  background: var(--bg-alt);
}

.chapter-row.active {
  background: var(--brand-50);
}

.chapter-num {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--ink-400);
  font-size: 0.68rem;
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease;
}

.chapter-row.active .chapter-num,
.chapter-row:hover .chapter-num {
  background: var(--brand-600);
  color: #fff;
}

.chapter-info {
  min-width: 0;
}

.chapter-title {
  display: block;
  overflow: hidden;
  color: var(--ink-700);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.38;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-row.active .chapter-title {
  color: var(--brand-700);
  font-weight: 600;
}

.chapter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.badge-tiny {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.1rem 0.36rem;
  border-radius: 5px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-note { background: var(--brand-100); color: var(--brand-700); }
.badge-sol { background: #e0f2fe; color: #0369a1; }
.badge-video { background: #fef3c7; color: #b45309; }
.badge-muted { background: #eef2f0; color: var(--ink-400); }

.chapter-open {
  color: var(--line-strong);
  font-size: 0.68rem;
  transition: color 0.16s ease, transform 0.16s ease;
}

.chapter-row:hover .chapter-open {
  color: var(--brand-600);
  transform: translateX(2px);
}

.chapter-empty {
  padding: 34px 22px;
  color: var(--ink-400);
  font-size: 0.84rem;
  text-align: center;
}

/* ========================= Chapter viewer ========================= */

.chapter-viewer {
  min-height: 480px;
  padding: 30px 32px 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}

.viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 30px;
  text-align: center;
}

.viewer-empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 1.35rem;
}

.viewer-empty h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

.viewer-empty p {
  max-width: 38ch;
  margin-top: 8px;
  color: var(--ink-400);
  font-size: 0.9rem;
}

.viewer-head {
  padding-bottom: 20px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.viewer-eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--brand-600);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.viewer-head h2 {
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.3;
}

.viewer-sub {
  margin-top: 7px;
  color: var(--ink-400);
  font-size: 0.82rem;
}

.viewer-tabs {
  display: flex;
  gap: 2px;
  margin: 4px 0 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.viewer-tabs::-webkit-scrollbar {
  display: none;
}

.viewer-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 14px 16px 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-400);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.viewer-tab:hover {
  color: var(--ink-700);
}

.viewer-tab.active {
  color: var(--brand-700);
  border-bottom-color: var(--brand-600);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--ink-400);
  font-size: 0.64rem;
  font-weight: 700;
}

.viewer-tab.active .tab-count {
  background: var(--brand-100);
  color: var(--brand-700);
}

.viewer-panel {
  padding-top: 22px;
}

.notes-text {
  color: var(--ink-700);
  font-size: 0.94rem;
  line-height: 1.78;
}

.key-concepts {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  border-radius: 13px;
}

.key-concepts h4,
.exercise-box h4,
.solution-box h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--ink-900);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.key-concepts h4 i { color: var(--brand-600); }

.key-concepts ul {
  display: grid;
  gap: 6px;
  padding-left: 0;
}

.key-concepts li {
  position: relative;
  padding-left: 17px;
  color: var(--ink-700);
  font-size: 0.88rem;
  line-height: 1.55;
}

.key-concepts li::before {
  content: '';
  position: absolute;
  top: 0.58em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-400);
}

.exercise-box {
  margin-top: 16px;
  padding: 18px 20px;
  background: var(--amber-soft);
  border: 1px solid #fde9bf;
  border-radius: 13px;
}

.exercise-box h4 i { color: var(--amber); }

.exercise-box p {
  color: #7a5a14;
  font-size: 0.88rem;
  line-height: 1.7;
  white-space: pre-line;
}

.solution-box {
  padding: 18px 20px;
  background: var(--blue-soft);
  border: 1px solid #c9ebfb;
  border-radius: 13px;
}

.solution-box h4 i { color: var(--blue); }

.solution-box p {
  color: #14536e;
  font-size: 0.88rem;
  line-height: 1.7;
}

.solution-summary {
  color: var(--ink-700);
  font-size: 0.94rem;
  line-height: 1.78;
}

.solution-summary + .solution-box {
  margin-top: 18px;
}

.sample-problem {
  margin-top: 16px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.video-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.video-thumb {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 118px;
  background: linear-gradient(135deg, #0f3d2e, #0b6b4f);
  color: #fff;
}

.video-thumb i {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
}

.video-thumb span {
  position: absolute;
  right: 9px;
  bottom: 8px;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.62rem;
  font-weight: 600;
}

.video-info {
  padding: 12px 14px 14px;
}

.video-info h4 {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--ink-400);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.video-flag {
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--ink-400);
  font-size: 0.6rem;
  font-weight: 600;
}

.empty-panel {
  padding: 46px 24px;
  text-align: center;
}

.empty-panel i {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--ink-400);
  font-size: 1.1rem;
}

.empty-panel h3 {
  font-size: 1rem;
  font-weight: 700;
}

.empty-panel p {
  max-width: 40ch;
  margin: 6px auto 0;
  color: var(--ink-400);
  font-size: 0.84rem;
}

.viewer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.viewer-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-500);
  font-size: 0.78rem;
  font-weight: 600;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.viewer-nav a:hover {
  color: var(--brand-700);
  border-color: var(--brand-400);
  background: var(--brand-50);
}

.viewer-nav .spacer {
  flex: 1;
}

/* ========================= Footer ========================= */

.site-footer {
  margin-top: 0;
  padding: 64px 0 26px;
  background: var(--ink-900);
  color: #a9c2b7;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}

.brand-light .brand-name {
  color: #fff;
}

.brand-light .brand-name span {
  color: var(--brand-400);
}

.footer-brand p {
  max-width: 34ch;
  margin: 16px 0 18px;
  color: #8faa9e;
  font-size: 0.87rem;
  line-height: 1.7;
}

.footer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.footer-badges .pill {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #b9d0c6;
  font-size: 0.68rem;
}

.footer-col h3 {
  margin-bottom: 15px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-col a {
  display: block;
  margin-bottom: 9px;
  color: #9db6ab;
  font-size: 0.85rem;
  transition: color 0.16s ease;
}

.footer-col a:hover {
  color: var(--brand-400);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.76rem;
  color: #7e9a8e;
}

.footer-note {
  font-size: 0.72rem;
  color: #6a8579;
}

/* ========================= Search modal ========================= */

.search-modal[hidden] {
  display: none;
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 9vh 20px 40px;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 20, 14, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.search-dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: dialog-in 0.18s ease;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.search-dialog-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.search-lead-icon {
  color: var(--ink-400);
  font-size: 0.95rem;
}

.search-modal-input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink-900);
  font-size: 1rem;
}

.search-modal-input::placeholder {
  color: var(--ink-400);
}

.search-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--ink-500);
  cursor: pointer;
}

.search-close:hover {
  background: var(--line);
  color: var(--ink-900);
}

.search-hint {
  padding: 16px 20px;
  color: var(--ink-400);
  font-size: 0.82rem;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}

.search-group-label {
  padding: 12px 12px 6px;
  color: var(--ink-400);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  transition: background 0.14s ease;
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--bg-alt);
}

.search-result-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 0.8rem;
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-body strong {
  display: block;
  overflow: hidden;
  color: var(--ink-800);
  font-size: 0.87rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-body small {
  display: block;
  margin-top: 2px;
  color: var(--ink-400);
  font-size: 0.72rem;
}

.search-result-type {
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  background: var(--bg-alt);
  color: var(--ink-400);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-400);
  font-size: 0.86rem;
}

.search-empty strong {
  color: var(--ink-700);
}

.search-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-400);
  font-size: 0.7rem;
}

kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink-500);
  font-family: inherit;
  font-size: 0.64rem;
  font-weight: 600;
}

/* ========================= Responsive ========================= */

@media (max-width: 1024px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .hero-copy {
    max-width: 680px;
  }

  .hero-visual {
    min-height: 360px;
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }

  .subject-layout {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .footer-col:last-child {
    display: none;
  }
}

@media (max-width: 900px) {
  .main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 16px 18px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 28px 50px -34px rgba(8, 28, 21, 0.7);
  }

  .main-nav.open {
    display: flex;
  }

  .nav-link {
    padding: 0.78rem 0.9rem;
    font-size: 0.94rem;
    border-radius: 10px;
  }

  .menu-btn {
    display: inline-grid;
  }

  .header-cta {
    display: none;
  }

  .subject-layout {
    grid-template-columns: 1fr;
  }

  .chapter-panel {
    position: static;
    max-height: none;
  }

  .chapter-list {
    max-height: 420px;
  }

  .chapter-viewer {
    min-height: 400px;
    padding: 24px 22px;
  }

  .feature-grid,
  .steps {
    grid-template-columns: 1fr;
  }

  .cta-band {
    flex-direction: column;
    align-items: flex-start;
    padding: 34px 30px;
  }
}

@media (max-width: 720px) {
  .section {
    padding: 62px 0;
  }

  .hero {
    padding: 58px 0 54px;
  }

  .hero-stats > div {
    padding: 0 18px;
  }

  .hero-stats dt {
    font-size: 1.3rem;
  }

  .hero-visual {
    max-width: 420px;
  }

  .float-a {
    left: -2px;
    top: 18px;
  }

  .float-b {
    right: -2px;
    bottom: 26px;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .class-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
  }

  .class-card {
    min-height: 200px;
    padding: 18px;
  }

  .class-roman {
    font-size: 3.6rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-col:last-child {
    display: block;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .search-foot span:last-child {
    display: none;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    gap: 12px;
  }

  .brand-name {
    font-size: 1.08rem;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .hero {
    padding: 52px 0 48px;
  }

  .hero h1 {
    font-size: 2.18rem;
    letter-spacing: -0.04em;
  }

  .hero-sub {
    font-size: 0.98rem;
  }

  .hero-search {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .hero-search > i {
    margin-left: 4px;
    align-self: center;
  }

  .hero-search input {
    flex: 1 1 calc(100% - 44px);
    padding: 8px 0;
  }

  .hero-search .btn {
    width: 100%;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 0;
    margin-top: 28px;
  }

  .hero-stats > div {
    padding: 0 14px;
  }

  .hero-stats > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .hero-visual {
    min-height: 320px;
    max-width: 100%;
  }

  .visual-card {
    width: 100%;
    padding: 18px;
    border-radius: var(--radius-lg);
  }

  .float-card {
    display: none;
  }

  .class-grid,
  .subject-grid,
  .topic-grid {
    grid-template-columns: 1fr;
  }

  .btn {
    padding: 0.78rem 1.08rem;
  }

  .cta-actions {
    flex-direction: column;
    width: 100%;
  }

  .cta-actions .btn {
    width: 100%;
  }

  .cta-band {
    padding: 30px 24px;
    border-radius: var(--radius-lg);
  }

  .chapter-panel {
    border-radius: var(--radius);
  }

  .chapter-list {
    max-height: 360px;
  }

  .chapter-tools {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .chapter-count {
    align-self: flex-end;
  }

  .chapter-viewer {
    padding: 18px 16px;
    border-radius: var(--radius);
  }

  .viewer-tabs {
    gap: 0;
  }

  .viewer-tab {
    padding: 11px 10px;
    font-size: 0.79rem;
  }

  .viewer-nav {
    flex-wrap: wrap;
  }

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

  .footer-col:last-child {
    display: block;
  }

  .search-modal {
    padding: 4vh 10px 18px;
  }

  .search-dialog {
    border-radius: 16px;
    max-height: 84vh;
  }
}

@media (max-width: 420px) {
  .brand-name {
    font-size: 1rem;
  }

  .hero h1 {
    font-size: 2.02rem;
  }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero-stats > div {
    padding: 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }

  .hero-stats > div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .visual-row span:not(.visual-check) {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .visual-row {
    align-items: flex-start;
  }

  .visual-check {
    margin-top: 2px;
  }

  .chapter-row {
    grid-template-columns: 34px minmax(0, 1fr) 16px;
    gap: 9px;
    padding: 9px 10px;
  }

  .chapter-num {
    width: 32px;
    height: 32px;
  }

  .chapter-title {
    font-size: 0.83rem;
  }

  .feature-card {
    padding: 22px;
  }

  .step {
    padding: 22px 20px 20px;
  }

  .topic-card {
    padding: 18px;
  }

  .subject-card {
    padding: 16px;
    gap: 12px;
  }

  .subject-icon {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
