:root {
  --bg-top: #fff8ea;
  --bg-bottom: #e8f0ef;
  --paper: rgba(255, 252, 246, 0.88);
  --paper-strong: rgba(255, 255, 255, 0.96);
  --border: rgba(34, 51, 59, 0.12);
  --ink: #23333b;
  --muted: #5a6e76;
  --shadow: 0 24px 60px rgba(63, 83, 92, 0.14);
  --accent: #c56a3d;
  --accent-soft: #ffe0ce;
  --accent-strong: #a34d24;
  --radius-lg: 28px;
  --radius-md: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Public Sans", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 38%),
    linear-gradient(135deg, var(--bg-top), var(--bg-bottom));
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(35, 51, 59, 0.08) 0.8px, transparent 0.8px);
  background-size: 24px 24px;
  opacity: 0.3;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: auto auto 8% 70%;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  background: rgba(255, 219, 185, 0.5);
  filter: blur(40px);
  pointer-events: none;
}

body.theme-math {
  --accent: #2f6fed;
  --accent-soft: #dbe7ff;
  --accent-strong: #1d52b8;
}

body.theme-reading {
  --accent: #00806b;
  --accent-soft: #d7f2ea;
  --accent-strong: #006a59;
}

body.theme-writing {
  --accent: #bd4d6a;
  --accent-soft: #ffdce6;
  --accent-strong: #963752;
}

body.theme-science {
  --accent: #417f3d;
  --accent-soft: #dfefd7;
  --accent-strong: #32632f;
}

body.theme-socialstudies {
  --accent: #8a5a2b;
  --accent-soft: #f2e2cf;
  --accent-strong: #6f441c;
}

body.theme-grammar {
  --accent: #7850c9;
  --accent-soft: #eadfff;
  --accent-strong: #5f36b0;
}

a {
  color: inherit;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.page-shell {
  padding-top: 1.5rem;
  padding-bottom: 4rem;
  position: relative;
  z-index: 1;
}

.site-header {
  padding-bottom: 1rem;
}

.brand-navbar {
  --bs-navbar-padding-y: 0;
  --bs-navbar-color: var(--muted);
  --bs-navbar-hover-color: var(--ink);
  --bs-navbar-active-color: var(--ink);
  --bs-navbar-brand-margin-end: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 6rem;
  height: 6rem;
  display: block;
  flex-shrink: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(34, 51, 59, 0.16));
}

.brand-text {
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.navbar-toggler {
  border: 1px solid rgba(35, 51, 59, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 24px rgba(63, 83, 92, 0.08);
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.18rem rgba(197, 106, 61, 0.18);
}

.navbar-collapse {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 34px rgba(63, 83, 92, 0.08);
  backdrop-filter: blur(10px);
}

.pill-nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pill-nav .nav-link {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(35, 51, 59, 0.08);
  color: var(--muted);
  font-weight: 500;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.pill-nav .nav-link:hover,
.pill-nav .nav-link:focus-visible,
.pill-nav .nav-link.active,
.pill-nav .nav-link[aria-current="page"] {
  transform: translateY(-2px);
  background: white;
  color: var(--ink);
  box-shadow: 0 12px 24px rgba(63, 83, 92, 0.1);
}

.hero-row {
  margin-top: 0.5rem;
}

.hero-card,
.section-card,
.subject-panel,
.info-panel,
.mini-card,
.not-found-card {
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card,
.section-card,
.subject-panel,
.info-panel,
.mini-card,
.not-found-card {
  padding: clamp(1.35rem, 2vw, 2.15rem);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.hero-copy::after,
.step-card::after {
  content: "";
  position: absolute;
  inset: auto -12% -30% auto;
  width: 13rem;
  height: 13rem;
  border-radius: 999px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

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

.eyebrow,
.note-label,
.breadcrumbs {
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.5rem, 7vw, 5.15rem);
  max-width: 12ch;
  margin-top: 0.55rem;
}

.subject-title {
  max-width: none;
  font-size: clamp(2.3rem, 4vw, 3.75rem);
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  margin-top: 0.25rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0;
  line-height: 1.7;
}

.lead {
  margin-top: 1rem;
  color: var(--muted);
  max-width: 62ch;
  font-size: 1.05rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.5rem;
}

.button {
  min-height: 3rem;
  padding: 0.82rem 1.25rem;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid transparent;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
}

.button-primary {
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 18px 30px rgba(52, 73, 82, 0.14);
}

.button-primary:hover,
.button-primary:focus-visible {
  color: white;
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(35, 51, 59, 0.1);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  color: var(--ink);
}

.note-card {
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 247, 239, 0.86)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 1.75rem,
      rgba(197, 106, 61, 0.08) 1.75rem,
      rgba(197, 106, 61, 0.08) 1.83rem
    );
}

.folder-tree {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(35, 51, 59, 0.92);
  color: #f6f3ef;
  overflow-x: auto;
  line-height: 1.6;
}

.note-copy {
  color: var(--muted);
}

.section-card {
  margin-top: 1.5rem;
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.3rem;
}

.subject-card,
.step-card {
  height: 100%;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--paper-strong);
  padding: 1.2rem;
}

.subject-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  border-top: 6px solid var(--card-accent, var(--accent));
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.subject-card:hover,
.subject-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 18px 32px rgba(63, 83, 92, 0.12);
}

.subject-name {
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
}

.subject-copy {
  color: var(--muted);
  line-height: 1.6;
}

.subject-math {
  --card-accent: #2f6fed;
}

.subject-reading {
  --card-accent: #00806b;
}

.subject-writing {
  --card-accent: #bd4d6a;
}

.subject-science {
  --card-accent: #417f3d;
}

.subject-socialstudies {
  --card-accent: #8a5a2b;
}

.subject-grammar {
  --card-accent: #7850c9;
}

.step-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.step-card::after {
  inset: auto -18% -38% auto;
  width: 10rem;
  height: 10rem;
  opacity: 0.42;
  filter: blur(10px);
}

.step-number {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.subject-panel p + p,
.info-panel p + p {
  margin-top: 0.9rem;
}

.mini-card {
  display: grid;
  gap: 0.8rem;
}

.empty-state {
  margin-top: 1.35rem;
  padding: 1.1rem 1.15rem;
  border: 1px dashed rgba(35, 51, 59, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
}

.empty-state strong {
  display: block;
  margin-bottom: 0.35rem;
}

.action-list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.8;
}

.breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.breadcrumbs a {
  text-decoration: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.tag-list span {
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(35, 51, 59, 0.12);
  color: var(--muted);
}

.site-footer {
  margin-top: 1.3rem;
  color: var(--muted);
  text-align: center;
}

.not-found-wrap {
  min-height: calc(100vh - 10rem);
  display: grid;
  place-items: center;
}

.not-found-card {
  max-width: 42rem;
  text-align: center;
}

.fade-up {
  opacity: 0;
  transform: translateY(18px);
  animation: fade-up 560ms ease forwards;
}

.delay-1 {
  animation-delay: 70ms;
}

.delay-2 {
  animation-delay: 150ms;
}

.delay-3 {
  animation-delay: 230ms;
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 992px) {
  .navbar-collapse {
    margin-top: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .pill-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 767.98px) {
  .page-shell {
    padding-top: 1rem;
    padding-bottom: 2.5rem;
  }

  h1 {
    font-size: clamp(2.3rem, 14vw, 4rem);
  }

  .hero-card,
  .section-card,
  .subject-panel,
  .info-panel,
  .mini-card,
  .not-found-card {
    padding: 1.2rem;
  }

  .brand-text {
    font-size: 1.05rem;
  }

  .brand-mark {
    width: 5rem;
    height: 5rem;
  }

  .folder-tree {
    font-size: 0.9rem;
  }
}

@media (max-width: 575.98px) {
  body::after {
    inset: auto auto 4% 55%;
    width: 12rem;
    height: 12rem;
  }

  .brand {
    max-width: calc(100% - 4.25rem);
  }

  .brand-text {
    line-height: 1.15;
  }

  .cta-row {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fade-up,
  .delay-1,
  .delay-2,
  .delay-3 {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .button,
  .subject-card,
  .pill-nav .nav-link {
    transition: none;
  }
}
