/* ============================================================
   MathCraft — Shared Stylesheet
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --ink:        #1a1625;
  --ink-soft:   #4b4360;
  --ink-faint:  #7c7394;
  --bg:         #faf9fc;
  --surface:    #ffffff;
  --border:     #e8e3f0;

  --purple:     #7c3aed;
  --purple-lt:  #ede9fe;
  --amber:      #d97706;
  --amber-lt:   #fef3c7;

  --radius:     16px;
  --shadow-sm:  0 2px 8px rgba(80,50,140,.08);
  --shadow-md:  0 8px 32px rgba(80,50,140,.13);
  --shadow-lg:  0 20px 60px rgba(80,50,140,.18);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,249,252,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

.logo-symbol {
  font-size: 1.7rem;
  color: var(--purple);
  line-height: 1;
}

nav { display: flex; gap: 1.8rem; }

.nav-link {
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-faint);
  letter-spacing: .02em;
  transition: color .2s;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 7rem 2rem 5rem;
  text-align: center;
}

/* Subtle dot-grid background */
.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #c4b5fd 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: .25;
  pointer-events: none;
}

/* Radial fade over the grid */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, var(--bg) 55%, transparent 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}

.hero-eyebrow {
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 1.1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1.2rem;
}

.hero-title em {
  font-style: italic;
  color: var(--purple);
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto;
}

/* Floating formulae */
.hero-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-formula {
  position: absolute;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--purple);
  opacity: .12;
  user-select: none;
  animation: floatDrift 8s ease-in-out infinite;
}

.f1 { font-size: 1.1rem; top: 18%; left: 5%;  animation-delay: 0s; }
.f2 { font-size: 2.8rem; top: 12%; right: 8%; animation-delay: 1.5s; }
.f3 { font-size: 5rem;   bottom: 15%; left: 10%; animation-delay: 3s; }
.f4 { font-size: 1rem;   bottom: 20%; right: 6%; animation-delay: 2s; }

@keyframes floatDrift {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%       { transform: translateY(-12px) rotate(2deg); }
}

/* ============================================================
   TOPICS SECTION
   ============================================================ */
.topics-section {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem 6rem;
  width: 100%;
}

.topics-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--ink);
  margin-bottom: .5rem;
}

.section-subtitle {
  color: var(--ink-faint);
  font-weight: 300;
}

/* ---------- Topic Cards ---------- */
.topic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform .3s ease, box-shadow .3s ease;
  cursor: pointer;
}

.topic-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

/* Image area */
.card-image {
  position: relative;
  background: linear-gradient(135deg, #f5f0ff 0%, #eef2ff 100%);
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#card-exponential .card-image {
  background: linear-gradient(135deg, #fffbeb 0%, #fff7ed 100%);
}

.topic-svg {
  width: 100%;
  max-width: 320px;
  height: 200px;
  transition: transform .4s ease;
}

.topic-card:hover .topic-svg {
  transform: scale(1.04);
}

.image-placeholder-label {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: .7rem;
  color: var(--ink-faint);
  letter-spacing: .04em;
  opacity: .7;
}

/* Card body */
.card-body {
  padding: 1.6rem 1.8rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  flex: 1;
}

.card-tag {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--purple);
  background: var(--purple-lt);
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 100px;
  width: fit-content;
}

#card-exponential .card-tag {
  color: var(--amber);
  background: var(--amber-lt);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--ink);
  line-height: 1.25;
}

.card-desc {
  font-size: .93rem;
  color: var(--ink-soft);
  line-height: 1.65;
  font-weight: 300;
  flex: 1;
}

.card-cta {
  margin-top: .5rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--purple);
  display: flex;
  align-items: center;
  gap: .3rem;
  transition: gap .2s;
}

#card-exponential .card-cta { color: var(--amber); }

.topic-card:hover .card-cta { gap: .6rem; }

.arrow {
  transition: transform .2s;
}
.topic-card:hover .arrow { transform: translateX(4px); }

/* ============================================================
   DETAIL PAGE STYLES  (quadratic-equations.html, exponential-functions.html)
   ============================================================ */

/* --- Page hero --- */
.detail-hero {
  padding: 5rem 2rem 3.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #c4b5fd 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: .18;
}

.detail-hero.amber-theme::before {
  background-image: radial-gradient(circle, #fcd34d 1px, transparent 1px);
}

.detail-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 65% 55% at 50% 40%, var(--bg) 50%, transparent 100%);
}

.detail-hero > * { position: relative; z-index: 1; }

.breadcrumb {
  font-size: .8rem;
  color: var(--ink-faint);
  margin-bottom: 1.2rem;
}

.breadcrumb a { color: var(--purple); }
.breadcrumb a:hover { text-decoration: underline; }

.detail-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: .9rem;
}

.detail-hero h1 em { color: var(--purple); font-style: italic; }
.amber-theme h1 em { color: var(--amber); }

.detail-hero .lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  font-weight: 300;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Placeholder content block --- */
.detail-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

.coming-soon-block {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 4rem 2rem;
  text-align: center;
}

.coming-soon-block .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.coming-soon-block h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  margin-bottom: .6rem;
}

.coming-soon-block p {
  color: var(--ink-faint);
  font-size: .95rem;
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--purple);
  border: 1.5px solid var(--purple);
  padding: .55rem 1.2rem;
  border-radius: 100px;
  transition: background .2s, color .2s;
}

.back-link:hover {
  background: var(--purple);
  color: #fff;
}

.amber-theme .back-link { color: var(--amber); border-color: var(--amber); }
.amber-theme .back-link:hover { background: var(--amber); color: #fff; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--ink-faint);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .hero { padding: 5rem 1.2rem 3rem; }
  .hero-title { font-size: 2.2rem; }
  .float-formula { display: none; }
  .topics-section { padding: 0 1.2rem 4rem; }
  .topic-cards { grid-template-columns: 1fr; }
  .header-inner { padding: 0 1.2rem; }
}
