/* =========================================================================
   PrepMaestro Blog — layout + typography for /apps/ielts-maestro/blog/
   Depends on main.css design tokens (--primary, --ink, --paper, etc.)
   ========================================================================= */

/* --- Category accent colors ------------------------------------------- */
:root {
  --cat-ai: #C59500;         /* AI Scoring — mustard */
  --cat-skill: #E31837;      /* Skill Mastery — crimson */
  --cat-strategy: #2563EB;   /* Prep Strategies — cobalt */
  --cat-uni: #7C3AED;        /* University & Immigration — violet */
}

/* --- Shared shell: narrow for listing/post content, wide for 2-col body - */
.blog-shell {
  max-width: 760px;
  margin-inline: auto;
  padding-inline: clamp(1.15rem, 4vw, 2rem);
}
.blog-shell--wide {
  max-width: 1120px;
}

/* ===================================================================
   BLOG INDEX / LISTING PAGE (unchanged for now)
   =================================================================== */
.blog-hero-index {
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2rem, 4vw, 3rem);
  text-align: center;
  background:
    radial-gradient(60% 70% at 50% 0%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 70%),
    linear-gradient(180deg, #FFFBEB 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
}
.blog-hero-index h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1rem;
}
.blog-hero-index p {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: 42rem;
  margin-inline: auto;
}

.blog-filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
  margin-top: 2rem;
}
.blog-filter {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 999px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.blog-filter:hover { border-color: var(--primary); color: var(--primary); }
.blog-filter--active {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.blog-grid-section {
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  text-decoration: none;
  color: inherit;
}
.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(16, 65, 93, .10);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
}
.blog-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 12%, var(--paper)) 0%,
    color-mix(in srgb, var(--primary) 4%, var(--paper)) 100%);
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--primary) 80%, var(--ink));
  overflow: hidden;
}
/* Unified IELTS Maestro red theme for all cards */
.blog-card--ai .blog-card-thumb,
.blog-card--skill .blog-card-thumb,
.blog-card--strategy .blog-card-thumb,
.blog-card--uni .blog-card-thumb {
  background: linear-gradient(135deg, #FDE8EC 0%, #FFF7F9 100%);
  color: #E31837;
}
.blog-card-thumb svg { width: 56px; height: 56px; opacity: .9; }

.blog-card-body {
  padding: 1.3rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  flex: 1;
}
.blog-card-category {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
/* Unified category label color */
.blog-card--ai       .blog-card-category,
.blog-card--skill    .blog-card-category,
.blog-card--strategy .blog-card-category,
.blog-card--uni      .blog-card-category { color: #E31837; }

.blog-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.3;
}
.blog-card p {
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.55;
  flex: 1;
}
.blog-card-meta {
  margin-top: .5rem;
  color: var(--faint);
  font-size: .82rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.blog-card-meta .dot { opacity: .55; }

/* ===================================================================
   BLOG POST PAGE — centered hero + featured image + 2-col body
   =================================================================== */
.blog-article { background: var(--paper); }

/* --- Hero (centered, with featured image below) --------------------- */
.blog-hero {
  padding-block: clamp(2.5rem, 6vw, 4rem) 0;
  background: linear-gradient(180deg, #FFFBEB 0%, var(--paper) 100%);
  text-align: center;
}
.blog-hero .blog-shell { max-width: 1120px; }

/* --- Breadcrumbs (HOME › BLOG › CATEGORY) --------------------------- */
.blog-breadcrumbs {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: .55rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.blog-breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
}
.blog-breadcrumbs a:hover { color: var(--primary); }
.blog-breadcrumbs .sep { color: var(--faint); opacity: .55; }
.blog-breadcrumbs .current { color: var(--ink); }

.blog-category-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .95rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}
.blog-category-pill--ai       { background: #FDE8EC; color: #E31837; }
.blog-category-pill--skill    { background: #FDE8EC; color: #E31837; }
.blog-category-pill--strategy { background: #FDE8EC; color: #E31837; }
.blog-category-pill--uni      { background: #FDE8EC; color: #E31837; }

.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.14;
  margin-bottom: 1.2rem;
  max-width: 20ch;
  margin-inline: auto;
}

.blog-meta {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1.4rem;
  color: var(--faint);
  font-size: .9rem;
  margin-bottom: 2.5rem;
}
.blog-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.blog-meta svg { width: 15px; height: 15px; opacity: .75; }

/* --- Featured hero image / placeholder ------------------------------ */
.blog-hero-image {
  position: relative;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto -4rem;  /* negative pulls body section's bg down over image bottom */
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(16, 65, 93, .25);
}
/* Keep the title + meta narrow and centered inside the wider hero shell */
.blog-hero h1,
.blog-hero .blog-meta,
.blog-category-pill { max-width: 820px; margin-left: auto; margin-right: auto; }
/* Unified IELTS Maestro crimson theme — all categories share the same ground */
.blog-hero-image--ai,
.blog-hero-image--skill,
.blog-hero-image--strategy,
.blog-hero-image--uni {
  background-repeat: no-repeat;
  background-position: center;
  background-color: #FFF7F9;
}
.blog-hero-image--ai       { background-image: url("/apps/ielts-maestro/blog/_art/hero-ai.svg"),       radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); background-size: 70% auto, auto, auto, auto; }
.blog-hero-image--skill    { background-image: url("/apps/ielts-maestro/blog/_art/hero-skill.svg"),    radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); background-size: 72% auto, auto, auto, auto; }
.blog-hero-image--strategy { background-image: url("/apps/ielts-maestro/blog/_art/hero-strategy.svg"), radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); background-size: 66% auto, auto, auto, auto; }
.blog-hero-image--uni      { background-image: url("/apps/ielts-maestro/blog/_art/hero-uni.svg"),      radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); background-size: 72% auto, auto, auto, auto; }

/* ===================================================================
   BLOG POST BODY — 2-column grid (sidebar + content)
   =================================================================== */
.blog-body {
  padding-block: 6rem clamp(3rem, 6vw, 5rem);
}
.blog-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}

/* --- Sidebar --------------------------------------------------------- */
.blog-sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Author compact card (sidebar) */
.blog-sidebar-author {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.blog-sidebar-author-img {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  display: grid; place-items: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
}
.blog-sidebar-author strong {
  display: block;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.blog-sidebar-author span {
  display: block;
  font-size: .8rem;
  color: var(--faint);
  margin-top: 2px;
}

/* TOC in sidebar — soft card, no numbers, no rail */
.blog-sidebar-toc {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.4rem 1.4rem 1.2rem;
  box-shadow: 0 1px 2px rgba(16, 65, 93, .04), 0 8px 24px rgba(16, 65, 93, .04);
}
.blog-sidebar-toc h4 {
  font-family: var(--font-display, var(--font-body));
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--ink);
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
  display: block;
}
.blog-sidebar-share {
  display: flex;
  align-items: center;
  gap: .9rem;
}
.blog-sidebar-share h4 {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 1;
  flex: 0 0 auto;
}
.blog-sidebar-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.blog-sidebar-toc li {
  padding: 0;
  margin: 0;
}
.blog-sidebar-toc li + li {
  margin-top: .9rem;
}
.blog-sidebar-toc a {
  display: block;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .92rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.45;
  transition: color .15s ease;
}
.blog-sidebar-toc a:hover,
.blog-sidebar-toc li.is-active a,
.blog-sidebar-toc a.is-active {
  color: var(--primary);
  font-weight: 600;
}

/* Share row in sidebar */
.blog-share-row {
  display: inline-flex;
  gap: .5rem;
}
.blog-share-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.blog-share-btn:hover { border-color: var(--primary); color: var(--primary); }
.blog-share-btn svg { width: 15px; height: 15px; }

/* --- Content column -------------------------------------------------- */
.blog-content {
  color: var(--ink);
  min-width: 0; /* allow long words / code blocks to shrink */
}
.blog-lead {
  font-size: clamp(1.08rem, 1.6vw, 1.22rem);
  line-height: 1.6;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2rem;
}
.blog-content h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  scroll-margin-top: 100px;
}
.blog-content h2:first-child { margin-top: 0; }
.blog-content h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 1.8rem;
  margin-bottom: .6rem;
}
.blog-content p {
  font-size: 1.03rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 1.1rem;
}
.blog-content ul,
.blog-content ol {
  margin: 0 0 1.3rem 1.25rem;
  padding: 0;
}
.blog-content li {
  margin-bottom: .55rem;
  font-size: 1.03rem;
  line-height: 1.65;
  color: var(--ink);
}
.blog-content li strong { color: var(--ink); font-weight: 700; }
.blog-content a:not(.btn):not(.blog-related-card):not(.blog-share-btn) {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
.blog-content a:not(.btn):not(.blog-related-card):not(.blog-share-btn):hover { color: var(--primary-dark); }
.blog-content strong { color: var(--ink); }

.blog-content .btn { text-decoration: none; }
.blog-content .btn--primary { color: #fff; }
.blog-content .btn--primary:hover { color: #fff; }

/* Mid-article CTA */
.blog-cta-inline {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line));
  border-radius: var(--r-lg);
  padding: 1.6rem 1.6rem 1.75rem;
  margin: 2.5rem 0;
  text-align: center;
}
.blog-cta-inline h4 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 .55rem;
}
.blog-cta-inline p {
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.5;
  margin: 0 0 1.1rem;
}

/* Related posts */
.blog-related {
  margin-top: 3rem;
}
.blog-related h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 1.1rem;
}
.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
@media (max-width: 760px) {
  .blog-related-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .blog-related-grid { grid-template-columns: 1fr; }
}
.blog-related-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border-radius: var(--r);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 65, 93, .04);
  transition: transform .18s ease, box-shadow .18s ease;
}
.blog-related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -16px rgba(16, 65, 93, .22);
}

/* Thumbnail: reuse the per-category hero SVG at a smaller size */
.blog-related-card-thumb {
  aspect-ratio: 16 / 9;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 70% auto, auto, auto, auto;
  background-color: #FFF7F9;
}
.blog-related-card-thumb--ai       { background-image: url("/apps/ielts-maestro/blog/_art/hero-ai.svg"),       radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); }
.blog-related-card-thumb--skill    { background-image: url("/apps/ielts-maestro/blog/_art/hero-skill.svg"),    radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); }
.blog-related-card-thumb--strategy { background-image: url("/apps/ielts-maestro/blog/_art/hero-strategy.svg"), radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); }
.blog-related-card-thumb--uni      { background-image: url("/apps/ielts-maestro/blog/_art/hero-uni.svg"),      radial-gradient(circle at 25% 35%, #FDE8EC 0%, transparent 55%), radial-gradient(circle at 80% 70%, #FBCFD6 0%, transparent 50%), linear-gradient(135deg, #FFF7F9 0%, #FBCFD6 100%); }

/* Card body */
.blog-related-card-body {
  padding: 1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  flex: 1;
}

/* Category pill */
.blog-related-card .cat {
  display: inline-block;
  padding: .25rem .65rem;
  background: #FDE8EC;
  color: #E31837;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  align-self: flex-start;
}

/* Title */
.blog-related-card h4 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.3;
  color: var(--ink);
  margin: 0;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Excerpt */
.blog-related-card .excerpt {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Closing CTA */
.blog-cta-closing {
  margin-top: 3rem;
  padding: 2rem 1.6rem 2.2rem;
  border-radius: var(--r-lg);
  background:
    radial-gradient(60% 90% at 100% 0%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%),
    radial-gradient(80% 100% at 0% 100%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%),
    #10415D;
  color: #fff;
  text-align: center;
}
.blog-cta-closing h3 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  font-weight: 800;
  color: #fff;
  margin: 0 0 .55rem;
}
.blog-cta-closing p {
  color: rgba(255, 255, 255, .78);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 1.4rem;
}

/* ===================================================================
   MOBILE — stack sidebar above content, tighten hero
   =================================================================== */
@media (max-width: 900px) {
  .blog-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .blog-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
  }
  .blog-sidebar-author { flex: 0 0 auto; }
  .blog-sidebar-toc { flex: 1 1 100%; }
  .blog-sidebar-share { flex: 0 0 auto; margin-left: auto; }
  .blog-hero-image { margin-bottom: -3rem; }
  .blog-body { padding-block: 4.5rem clamp(2.5rem, 5vw, 4rem); }
}
@media (max-width: 640px) {
  .blog-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .blog-content h2 { margin-top: 2rem; }
  .blog-cta-inline { padding: 1.25rem 1.1rem 1.4rem; }
  .blog-cta-closing { padding: 1.5rem 1.1rem 1.75rem; }
  .blog-hero { padding-block: 1.5rem 0; }
  .blog-hero h1 { max-width: none; }
  .blog-meta { gap: 1rem; margin-bottom: 1.75rem; }
  .blog-hero-image { border-radius: var(--r); margin-bottom: -2rem; }
  .blog-body { padding-block: 3.5rem 2.5rem; }
  .blog-sidebar { gap: 1.25rem; }
  .blog-sidebar-author strong { font-size: .9rem; }
}
