/* ── MathCraft Blog — Shared Styles ───────────── */
/* Matches landing page aesthetic (public/landing/index.html) */

/* ── 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: #1a1a2e;
  background: #F0F7FF;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #3498db; text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; border: none; font-family: inherit; }

/* ── Typography ───────────────────────────────── */
h1, h2, h3, h4 { line-height: 1.25; font-weight: 800; color: #1a1a2e; }
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: #1a1a2e; }
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: #444;
}
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: #888;
}
.breadcrumb a { color: #3498db; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; color: #ccc; }

/* ── 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: #888;
}
.article-meta time { font-weight: 600; }
.article-tag {
  display: inline-block;
  background: rgba(52, 152, 219, 0.1);
  color: #3498db;
  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: #555;
  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: #333;
}

/* ── 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;
}
.article-img figcaption {
  max-width: 100%;
  font-size: 0.78rem;
  color: #888;
  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: #fff;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  padding: 24px;
  overflow-x: auto;
}
.diagram-box svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }
.diagram-label {
  text-align: center;
  font-size: 0.82rem;
  color: #888;
  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: #fff;
  border: 2px solid #e8eef5;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  font-family: 'Space Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1a1a2e;
}
.mtc-q .mtc-ans {
  display: block;
  margin-top: 8px;
  width: 60px;
  height: 32px;
  border: 2px solid #3498db;
  border-radius: 6px;
  margin-left: auto;
  margin-right: auto;
  background: #f8fafd;
}
/* 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: #fff;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  padding: 20px 28px;
}
.written-method .wm-row { display: flex; justify-content: flex-end; }
.written-method .wm-op { margin-right: 8px; color: #888; }
.written-method .wm-line { border-top: 2px solid #1a1a2e; margin: 4px 0; }
.written-method .wm-carry { font-size: 0.7rem; color: #e74c3c; vertical-align: super; }

/* ── Info Box / Callout ───────────────────────── */
.info-box {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
}
.info-box h4 { margin-bottom: 8px; font-size: 1rem; }
.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 #3498db; }
.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 #e8eef5;
}
.article-body th {
  background: #f8fafd;
  font-weight: 700;
  color: #1a1a2e;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-body tr:hover { background: #f8fafd; }

/* ── FAQ Section ──────────────────────────────── */
.faq-section {
  margin-top: 48px;
  border-top: 1px solid #e8eef5;
  padding-top: 32px;
}
.faq-section h2 { margin-top: 0; }
.faq-item {
  border-bottom: 1px solid #e8eef5;
  padding: 16px 0;
}
.faq-q {
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
  font-size: 1rem;
}
.faq-a {
  color: #555;
  margin-bottom: 0;
}

/* ── CTA Box ──────────────────────────────────── */
.cta-box {
  background: linear-gradient(135deg, #0c1220 0%, #1a1a3e 100%);
  color: #fff;
  border-radius: 16px;
  padding: 32px;
  margin: 40px 0 0;
  text-align: center;
}
.cta-box h3 { color: #fff; margin-top: 0; margin-bottom: 8px; }
.cta-box p { color: rgba(255,255,255,0.8); 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.5);
}

/* ── Footer ───────────────────────────────────── */
footer {
  background: #0c1220;
  color: rgba(255,255,255,0.5);
  padding: 40px 0;
  font-size: 0.85rem;
  text-align: center;
}
.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.6);
  font-weight: 600;
  text-decoration: none;
}
.footer-links a:hover { color: #fff; text-decoration: none; }

/* ── 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; }
}
