/* ================================================================
   blog.css — Universal shared stylesheet for all QuickTypeTest blog posts
   One file to rule them all. No per-article CSS needed.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=Dancing+Script:wght@600;700&family=Cormorant+Garamond:ital,wght@0,600;0,700;1,500&family=Crimson+Pro:ital,wght@0,400;0,500;1,400&family=Libre+Baskerville:ital,wght@0,700;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Theme Variables ───────────────────────────────────────────── */
:root {
  --bg:          #f9f8f5;
  --bg-card:     #ffffff;
  --bg-code:     #f0efe9;
  --bg-subtle:   #f0efe9;
  --text:        #1c1b18;
  --text-muted:  #6b6860;
  --border:      #e4e2db;
  --accent:      #e8501a;
  --accent-soft: #fdeee8;
  --accent-2:    #2563eb;
  --heading:     #111009;
  --nav-bg:      #fffffdee;
  --shadow:      0 2px 20px rgba(0,0,0,0.07);
  --shadow-sm:   0 1px 8px rgba(0,0,0,0.05);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.12);
  --radius:      10px;

  /* Font roles */
  --font-display: 'Playfair Display', 'Times New Roman', serif;
  --font-heading: 'Cormorant Garamond', 'Times New Roman', serif;
  --font-sub:     'Libre Baskerville', 'Times New Roman', serif;
  --font-body:    'Crimson Pro', 'Times New Roman', Georgia, serif;
  --font-cursive: 'Dancing Script', cursive;
  --font-ui:      'DM Sans', sans-serif;
}

[data-theme="dark"] {
  --bg:          #121210;
  --bg-card:     #1c1b18;
  --bg-code:     #252420;
  --bg-subtle:   #252420;
  --text:        #e8e6df;
  --text-muted:  #9e9b91;
  --border:      #2e2d29;
  --accent:      #ff6b35;
  --accent-soft: #2a1a12;
  --accent-2:    #60a5fa;
  --heading:     #f5f3ec;
  --nav-bg:      #121210ee;
  --shadow:      0 2px 20px rgba(0,0,0,0.3);
  --shadow-sm:   0 1px 8px rgba(0,0,0,0.2);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.4);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.18rem;
  line-height: 1.88;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { color: var(--heading); font-weight: 600; }

/* ── Reading Progress Bar ──────────────────────────────────────── */
#readingProgress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: var(--accent);
  z-index: 1000;
  transition: width 0.08s linear;
}

/* ── Navigation ────────────────────────────────────────────────── */
/* nav styles handled by nav.css — blog.css only adds blog-specific nav tweaks if any */

/* ── Post Hero ─────────────────────────────────────────────────── */
.post-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem 2.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-ui);
  flex-wrap: wrap;
}

/* ── Tags ──────────────────────────────────────────────────────── */
.tag {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 11px;
  border-radius: 99px;
}
/* Default (orange/accent) */
.tag         { background: var(--accent-soft); color: var(--accent); }

/* Named variants — add as many as your categories need */
.tag.speed        { background: var(--accent-soft);   color: var(--accent); }
.tag.guide        { background: #dbeafe;               color: #1e40af; }
.tag.science      { background: #e8f4fd;               color: #1a6fa8; }
.tag.keyboards    { background: #edf7ed;               color: #2d7a2d; }
.tag.productivity { background: #f5f0ff;               color: #6b35c8; }
.tag.beginners    { background: #fff8e6;               color: #b07600; }

[data-theme="dark"] .tag.guide        { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .tag.science      { background: #0d2a3e; color: #60b8f0; }
[data-theme="dark"] .tag.keyboards    { background: #0d2a0d; color: #5bbf5b; }
[data-theme="dark"] .tag.productivity { background: #1e1030; color: #a87de8; }
[data-theme="dark"] .tag.beginners    { background: #2a1f00; color: #e8b840; }

.date-read {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Post H1 ───────────────────────────────────────────────────── */
.post-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3.1rem);
  font-weight: 900;
  line-height: 1.12;
  color: var(--heading);
  letter-spacing: -0.02em;
  margin-bottom: 1.1rem;
}
.post-hero h1 em { font-style: italic; color: #22c55e; }

/* ── Post Subtitle ─────────────────────────────────────────────── */
.post-subtitle {
  font-family: var(--font-cursive);
  font-size: 1.42rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ── Author Bar ────────────────────────────────────────────────── */
.author-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  flex-wrap: wrap;
}

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.author-info { flex: 1; }
.author-info strong { display: block; font-size: 0.85rem; color: var(--heading); }
.author-info span   { font-size: 0.75rem; color: var(--text-muted); }

.share-btns { display: flex; gap: 0.5rem; }
.share-btn {
  font-family: var(--font-ui);
  font-size: 0.73rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  text-decoration: none;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── Hero CTA Band (below hero, above body) ────────────────────── */
.hero-cta-band {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}
.hero-cta-band .band-inner {
  background: var(--bg-card);
  border: 1.5px solid var(--accent);
  border-radius: 14px;
  padding: 1.4rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.band-text strong {
  display: block;
  font-family: var(--font-sub);
  font-size: 1rem;
  color: var(--heading);
  margin-bottom: 0.2rem;
}
.band-text span {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.band-links { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.band-btn {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.band-btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }
.band-btn.outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.band-btn.outline:hover { border-color: var(--accent); color: var(--accent); }

/* ── Post Body ─────────────────────────────────────────────────── */
.post-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  font-family: var(--font-body);
  font-size: 1.18rem;
  line-height: 1.88;
}

.post-body p { margin-bottom: 1.6rem; color: var(--text); }

/* Drop cap — first paragraph of the article */
.post-body > p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  float: left;
  line-height: 0.78;
  margin: 0.12em 0.1em 0 0;
  color: var(--accent);
}

/* ── Headings inside body ──────────────────────────────────────── */
.post-body h2 {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--heading);
  margin: 3rem 0 1rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
}

.post-body h3 {
  font-family: var(--font-sub);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--heading);
  margin: 2rem 0 0.65rem;
}

/* ── Section Intro ─────────────────────────────────────────────── */
.section-intro {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 1.4rem;
  line-height: 1.7;
}

/* ── Pull Quote ────────────────────────────────────────────────── */
.pull-quote {
  font-family: var(--font-cursive);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  padding: 1.5rem 2rem;
  margin: 2.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

/* ── Lists ─────────────────────────────────────────────────────── */
.post-body ul, .post-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.6rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
}
.post-body li { margin-bottom: 0.55rem; line-height: 1.7; }

/* ── Divider ───────────────────────────────────────────────────── */
.post-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ── Callouts ──────────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.3rem;
  margin: 2rem 0;
}
.callout.info { border-color: #3b82f6; background: color-mix(in srgb, #3b82f6 8%, var(--bg)); }
.callout.tip  { border-color: #22c55e; background: color-mix(in srgb, #22c55e 8%, var(--bg)); }
.callout.warn { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 8%, var(--bg)); }

.callout-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.callout.info .callout-label { color: #3b82f6; }
.callout.tip  .callout-label { color: #16a34a; }
.callout.warn .callout-label { color: #b45309; }
.callout p { margin: 0; font-family: var(--font-body); font-size: 1.05rem; line-height: 1.65; }

/* ── Stat Grid ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}
.stat-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* ── WPM Bar Chart ─────────────────────────────────────────────── */
.wpm-bar-wrap { margin: 2rem 0; }
.wpm-bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 100px;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}
.wpm-bar-label { color: var(--text-muted); text-align: right; font-size: 0.82rem; }
.wpm-bar-track {
  background: var(--border);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.wpm-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  width: 0;
  transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.wpm-bar-val { font-weight: 600; color: var(--heading); font-size: 0.82rem; }

/* ── Table ─────────────────────────────────────────────────────── */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.post-body th {
  background: var(--bg-subtle);
  color: var(--heading);
  font-weight: 700;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.post-body td {
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
}
.post-body tr:last-child td { border-bottom: none; }
.post-body tr:hover td { background: var(--bg-subtle); }
.post-body tr.highlight td {
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--heading);
}
[data-theme="dark"] .post-body tr.highlight td { background: #2a1a12; }

/* ── Table of Contents ─────────────────────────────────────────── */
.toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin: 1.5rem 0 2.5rem;
  font-family: var(--font-ui);
}
.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.toc ol { padding-left: 1.2rem; margin: 0; }
.toc li { margin-bottom: 0.35rem; }
.toc a { font-size: 0.88rem; color: var(--text-muted); transition: color 0.2s; }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* ── Mid-article CTA ───────────────────────────────────────────── */
.mid-cta {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem 1.8rem;
  margin: 2.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.mid-cta-text strong {
  display: block;
  font-family: var(--font-sub);
  font-size: 1rem;
  color: var(--heading);
  margin-bottom: 0.2rem;
}
.mid-cta-text span {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.mid-cta-links { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.mid-cta-btn {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
}
.mid-cta-btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }
.mid-cta-btn.soft {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.mid-cta-btn.soft:hover { border-color: var(--accent); color: var(--accent); }

/* ── Final CTA Box ─────────────────────────────────────────────── */
.post-cta {
  background: linear-gradient(135deg, var(--accent), #b33a10);
  border-radius: 14px;
  padding: 2.2rem 2rem;
  margin: 3rem 0 1rem;
  text-align: center;
  color: #fff;
}
.post-cta h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
  color: #fff;
}
.post-cta p {
  font-family: var(--font-body);
  font-size: 1.05rem;
  opacity: 0.9;
  margin-bottom: 1.2rem;
  line-height: 1.6;
}
.post-cta-btns { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.post-cta a {
  display: inline-block;
  background: #fff;
  color: var(--accent);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 10px 24px;
  border-radius: 99px;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.post-cta a:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); text-decoration: none; }
.post-cta a.ghost {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.6);
  color: #fff;
}
.post-cta a.ghost:hover { background: rgba(255,255,255,0.12); }

/* ── Related Posts ─────────────────────────────────────────────── */
.related-section {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3.5rem;
  border-top: 1px solid var(--border);
}
.related-section h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 1.2rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  display: block;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.related-card h4 {
  font-family: var(--font-sub);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--heading);
  margin: 0.45rem 0 0.35rem;
  line-height: 1.35;
}
.related-card span { font-family: var(--font-ui); font-size: 0.72rem; color: var(--text-muted); }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .post-hero   { padding: 2rem 1rem 1.5rem; }
  .post-body   { padding: 1.5rem 1rem 3rem; }
  .wpm-bar-row { grid-template-columns: 105px 1fr 70px; font-size: 0.78rem; }
  .stat-grid   { grid-template-columns: 1fr 1fr; }
  .author-bar  { flex-wrap: wrap; }
  .share-btns  { width: 100%; }
  .hero-cta-band .band-inner { flex-direction: column; align-items: flex-start; }
  .mid-cta     { flex-direction: column; align-items: flex-start; }
  .post-cta    { padding: 1.5rem 1.2rem; }
}