/* ── MathCraft Blog — Dark RPG Theme ─────────── */
/* Matches landing page + maths hub aesthetic     */

/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #d0dae6;
  background: #0f1923;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #4facfe; text-decoration: none; }
a:hover { text-decoration: underline; color: #7dc4ff; }
button { cursor: pointer; border: none; font-family: inherit; }

/* ── Starfield Background ────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1.5px 1.5px at 50% 10%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1px 1px at 85% 75%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1.5px 1.5px at 15% 80%, rgba(255,255,255,0.06), transparent),
    radial-gradient(1px 1px at 60% 90%, rgba(255,255,255,0.1), transparent),
    linear-gradient(180deg, #0f1923 0%, #141e2e 40%, #1a1a3e 70%, #0f1923 100%);
  pointer-events: none;
}

/* ── Typography ───────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 800; color: #e8f1f8; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); margin-bottom: 16px; }
h2 { font-size: clamp(1.25rem, 3.5vw, 1.6rem); margin-top: 40px; margin-bottom: 16px; }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.25rem); margin-top: 32px; margin-bottom: 12px; }
p { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 24px; }
li { margin-bottom: 8px; }
strong { color: #e8f1f8; }
blockquote {
  border-left: 4px solid #2ecc71;
  padding: 16px 20px;
  margin: 24px 0;
  background: rgba(46, 204, 113, 0.06);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #8899a8;
}
blockquote p:last-child { margin-bottom: 0; }

/* ── Nav ──────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(12, 18, 32, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.topnav-brand {
  font-weight: 800;
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.topnav-brand:hover { text-decoration: none; color: #fff; }
.topnav-brand img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}
.topnav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.topnav-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.topnav-links a:hover { color: #fff; text-decoration: none; }
.topnav-cta {
  font-size: 0.85rem;
  padding: 8px 18px;
  border-radius: 8px;
  background: #2ecc71;
  color: #fff !important;
  font-weight: 700;
}
.topnav-cta:hover { background: #27ae60; }

/* ── Breadcrumb ───────────────────────────────── */
.breadcrumb {
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 20px;
  font-size: 0.85rem;
  color: #6b7f95;
}
.breadcrumb a { color: #4facfe; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; color: #3a4d62; }

/* ── Article Layout ───────────────────────────── */
.article-header {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 0;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #6b7f95;
}
.article-meta time { font-weight: 600; }
.article-tag {
  display: inline-block;
  background: rgba(79, 172, 254, 0.15);
  color: #4facfe;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-header h1 { margin-top: 8px; }
.article-intro {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  color: #8899a8;
  line-height: 1.7;
  margin-bottom: 0;
}

/* ── Article Body ─────────────────────────────── */
.article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  color: #c0cdd8;
}

/* ── Images & Diagrams ────────────────────────── */
.article-img {
  margin: 32px 0;
  border-radius: 12px;
  overflow: hidden;
  max-width: 100%;
}
.article-img img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}
.article-img figcaption {
  max-width: 100%;
  font-size: 0.78rem;
  color: #6b7f95;
  text-align: center;
  margin-top: 8px;
  padding: 0 4px;
  font-style: italic;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.diagram-box {
  margin: 32px 0;
  background: linear-gradient(180deg, #1a2735 0%, #162232 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 24px;
  overflow-x: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.diagram-box svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.diagram-label {
  text-align: center;
  font-size: 0.82rem;
  color: #6b7f95;
  margin-top: 12px;
  font-weight: 600;
}
/* MTC-style quiz mock */
.mtc-mock {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 32px 0;
}
.mtc-q {
  background: linear-gradient(180deg, #1a2735 0%, #162232 100%);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: #e8f1f8;
}
.mtc-q .mtc-ans {
  display: block;
  margin-top: 8px;
  width: 60px;
  height: 32px;
  border: 2px solid #4facfe;
  border-radius: 6px;
  margin-left: auto;
  margin-right: auto;
  background: rgba(79, 172, 254, 0.08);
}
/* Written method layout */
.written-method {
  font-family: 'Space Mono', monospace;
  font-size: 1.3rem;
  line-height: 2;
  text-align: right;
  max-width: 200px;
  margin: 32px auto;
  background: linear-gradient(180deg, #1a2735 0%, #162232 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 20px 28px;
  color: #e8f1f8;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.written-method .wm-row { display: flex; justify-content: flex-end; }
.written-method .wm-op { margin-right: 8px; color: #6b7f95; }
.written-method .wm-line { border-top: 2px solid #e8f1f8; margin: 4px 0; }
.written-method .wm-carry { font-size: 0.7rem; color: #e74c3c; vertical-align: super; }

/* ── Info Box / Callout ───────────────────────── */
.info-box {
  background: linear-gradient(180deg, #1a2735 0%, #162232 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.info-box h4 { margin-bottom: 8px; font-size: 1rem; color: #e8f1f8; }
.info-box ul { margin-bottom: 0; }
.info-box li:last-child { margin-bottom: 0; }
.info-box.green { border-left: 4px solid #2ecc71; }
.info-box.blue { border-left: 4px solid #4facfe; }
.info-box.amber { border-left: 4px solid #f39c12; }

/* ── Comparison Table ─────────────────────────── */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9rem;
}
.article-body th, .article-body td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #d0dae6;
}
.article-body th {
  background: #1a1a3e;
  font-weight: 700;
  color: #e8f1f8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-body tr:hover { background: rgba(255,255,255,0.03); }

/* ── FAQ Section ──────────────────────────────── */
.faq-section {
  margin-top: 48px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 32px;
}
.faq-section h2 { margin-top: 0; }
.faq-item {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 16px 0;
}
.faq-q {
  font-weight: 700;
  color: #e8f1f8;
  margin-bottom: 8px;
  font-size: 1rem;
}
.faq-a {
  color: #8899a8;
  margin-bottom: 0;
}

/* ── CTA Box ──────────────────────────────────── */
.cta-box {
  background: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 50%, #1a1a3e 100%);
  color: #fff;
  border-radius: 16px;
  padding: 32px;
  margin: 40px 0 0;
  text-align: center;
  border: 1px solid rgba(167, 139, 250, 0.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.cta-box h3 { color: #fff; margin-top: 0; margin-bottom: 8px; }
.cta-box p { color: rgba(255,255,255,0.7); margin-bottom: 16px; }
.cta-box .btn {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 10px;
  background: #2ecc71;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(46, 204, 113, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cta-box .btn:hover {
  background: #27ae60;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(46, 204, 113, 0.45);
  text-decoration: none;
}
.cta-box .btn-note {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
}

/* ── Footer ───────────────────────────────────── */
footer {
  background: #080d18;
  color: rgba(255,255,255,0.4);
  padding: 40px 0;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 48px;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}
.footer-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  display: block;
  margin-bottom: 16px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: rgba(255,255,255,0.5);
  font-weight: 600;
  text-decoration: none;
}
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-persona {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 8px;
}
.footer-persona a {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 0.8rem;
}
.footer-persona a:hover { color: #fff; }

/* ── Author Bio ───────────────────────────────── */
.author-bio {
  margin-top: 40px;
  padding: 24px;
  background: linear-gradient(180deg, #1a2735 0%, #162232 100%);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.author-bio-name {
  font-weight: 800;
  color: #e8f1f8;
  font-size: 1rem;
  margin-bottom: 6px;
}
.author-bio-text {
  color: #8899a8;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ── Responsive ───────────────────────────────── */
@media (min-width: 768px) {
  .article-header { padding: 40px 40px 0; }
  .article-body { padding: 40px; }
  .breadcrumb { padding: 0 40px; }
}
@media (max-width: 480px) {
  .topnav-links a:not(.topnav-cta) { display: none; }
}
