/**
 * Learning Section Styles
 * Cert-Ready - Learn pages (adapted from AWSReady)
 *
 * Design language: CertReady brand (dark indigo #1e1b4b + indigo #6366f1),
 * modern cards with subtle shadows, generous spacing, Inter typography.
 * Tokens come from style.css (CSS custom properties).
 */

/* ========================================
   CertReady-specific overrides: navbar on learn pages
   The learn renderer uses logo-cert/logo-ready and mobile-menu-btn
   which differ from the main site's logo/mobile-menu-toggle.
   ======================================== */

.learn-page .navbar {
  background: #1e1b4b;
  border-bottom: 1px solid rgba(99,102,241,0.2);
}

.logo-cert {
  color: #a5b4fc;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-ready {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.learn-page .nav-links a.active {
  color: #a5b4fc;
}

/* Mobile menu button (hamburger) for learn pages */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.mobile-menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.25s ease;
}

.mobile-menu-btn.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.mobile-menu-btn.active span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }

  .learn-page .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1b4b;
    flex-direction: column;
    padding: 1rem;
    border-bottom: 1px solid rgba(99,102,241,0.2);
    z-index: 100;
  }

  .learn-page .nav-links.active { display: flex; }

  .learn-page .nav-links a {
    padding: 0.75rem 0;
    margin-left: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
}

/* Override indigo comment in comment block */
/* ========================================
   Page Layout
   ======================================== */

.learn-page {
  min-height: 100vh;
  background: var(--gray-50, #f9fafb);
}

/* ========================================
   Reading Progress Bar (article page)
   ======================================== */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: var(--z-fixed, 30);
  pointer-events: none;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--primary-500, #6366f1) 0%,
    var(--primary-400, #818cf8) 100%
  );
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(99,102,241,0.4);
}

/* ========================================
   Hero Section
   ======================================== */

.learn-hero {
  position: relative;
  background:
    radial-gradient(
      ellipse at top right,
      rgba(99,102,241,0.18) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse at bottom left,
      rgba(37, 99, 235, 0.22) 0%,
      transparent 55%
    ),
    linear-gradient(135deg, #0f0c29 0%, #1e1b4b 55%, #13112e 100%);
  color: #ffffff;
  padding: 4.5rem 0 3.5rem;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.learn-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  pointer-events: none;
}

.learn-hero > .container {
  position: relative;
  z-index: 1;
}

.learn-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: var(--radius-full, 9999px);
  color: var(--primary-300, #a5b4fc);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.learn-hero-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary-500, #6366f1);
  box-shadow: 0 0 10px var(--primary-500, #6366f1);
}

.learn-hero h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  font-weight: 800;
  margin: 0 0 1rem;
  letter-spacing: -0.025em;
  line-height: 1.1;
  background: linear-gradient(180deg, #ffffff 0%, #d1d5db 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.learn-hero p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.78);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ========================================
   Filter Bar (sticky pill style)
   ======================================== */

.learn-filters {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky, 20);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.filter-bar {
  display: flex;
  gap: 10px;
  padding: 14px 0;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 36px 9px 16px;
  border: 1.5px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-full, 9999px);
  background-color: var(--gray-50, #f9fafb);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary, #374151);
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
  font-family: var(--font-family-base);
  min-height: 40px;
}

.filter-bar select:hover {
  border-color: var(--primary-400, #818cf8);
  background-color: #ffffff;
}

.filter-bar select:focus {
  outline: none;
  border-color: var(--primary-500, #6366f1);
  background-color: #ffffff;
  box-shadow: var(--shadow-focus, 0 0 0 4px rgba(99,102,241,0.2));
}

/* ========================================
   Section Common
   ======================================== */

.learn-featured,
.learn-categories,
.learn-articles {
  padding: 3rem 0;
}

.learn-featured {
  padding-top: 3.5rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.learn-featured h2,
.learn-categories h2,
.learn-articles h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--secondary-color, #1e1b4b);
  margin: 0;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: 1rem;
}

.learn-featured h2::before,
.learn-categories h2::before,
.learn-articles h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    var(--primary-500, #6366f1) 0%,
    var(--primary-600, #4f46e5) 100%
  );
}

.section-subtitle {
  color: var(--text-tertiary, #6b7280);
  font-size: 0.9375rem;
  margin: 0.375rem 0 0;
}

/* ========================================
   Category Grid
   ======================================== */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.category-card {
  --accent: var(--primary-500, #6366f1);
  position: relative;
  display: block;
  padding: 1.75rem 1.5rem 1.5rem;
  background: #ffffff;
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.25s var(--ease-smooth),
    box-shadow 0.25s var(--ease-smooth),
    border-color 0.25s var(--ease-smooth);
  border: 1px solid var(--gray-200, #e5e7eb);
  overflow: hidden;
  isolation: isolate;
}

.category-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) 100%
  );
  opacity: 0.9;
}

.category-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  filter: blur(40px);
  transition: opacity 0.3s var(--ease-smooth);
  z-index: -1;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.15));
  border-color: transparent;
  text-decoration: none;
}

.category-card:hover::after {
  opacity: 0.08;
}

.category-card:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--accent),
    var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md, 12px);
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

/* Fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red, blue)) {
  .category-icon {
    background: rgba(99,102,241,0.12);
  }
}

.category-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.category-card p {
  color: var(--text-tertiary, #6b7280);
  font-size: 0.875rem;
  margin: 0 0 1rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.875rem;
  border-top: 1px dashed var(--gray-200, #e5e7eb);
}

.article-count {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6b7280);
  font-weight: 600;
}

.category-card-arrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.125rem;
  transition: transform 0.25s var(--ease-smooth);
}

.category-card:hover .category-card-arrow {
  transform: translateX(4px);
}

/* ========================================
   Article Card (grid)
   ======================================== */

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--radius-lg, 16px);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.25s var(--ease-smooth),
    box-shadow 0.25s var(--ease-smooth);
  border: 1px solid var(--gray-200, #e5e7eb);
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.15));
  text-decoration: none;
}

.article-card:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--primary-500, #6366f1),
    var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.article-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #1e1b4b 50%, #2563eb 100%);
}

.article-cover-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 55%,
    rgba(0, 0, 0, 0.45) 100%
  );
  pointer-events: none;
}

.article-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease-smooth);
}

.article-card:hover .article-cover {
  transform: scale(1.04);
}

.article-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background-image:
    radial-gradient(
      circle at 25% 25%,
      rgba(99,102,241,0.35) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 75% 75%,
      rgba(37, 99, 235, 0.35) 0%,
      transparent 50%
    );
}

.article-cover-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
}

.article-card-body {
  padding: 1.25rem 1.25rem 1.375rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.article-card-body h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin: 0 0 0.5rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card:hover .article-card-body h3 {
  color: var(--primary-600, #4f46e5);
}

.article-card-body p {
  font-size: 0.875rem;
  color: var(--text-tertiary, #6b7280);
  line-height: 1.55;
  margin: 0 0 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  margin-top: auto;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ========================================
   Featured Grid (larger, prominent)
   ======================================== */

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.75rem;
}

.featured-article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--radius-xl, 24px);
  overflow: hidden;
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.3s var(--ease-smooth),
    box-shadow 0.3s var(--ease-smooth);
  border: 1px solid var(--gray-200, #e5e7eb);
}

.featured-article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl, 0 20px 60px rgba(0, 0, 0, 0.2));
  text-decoration: none;
}

.featured-article-card:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--primary-500, #6366f1),
    var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.15));
}

.featured-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #1e1b4b 50%, #2563eb 100%);
}

.featured-cover-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 50%,
    rgba(0, 0, 0, 0.55) 100%
  );
  pointer-events: none;
}

.featured-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease-smooth);
}

.featured-article-card:hover .featured-cover {
  transform: scale(1.05);
}

.featured-ribbon {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: linear-gradient(
    135deg,
    var(--primary-500, #6366f1) 0%,
    var(--primary-600, #4f46e5) 100%
  );
  color: #ffffff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-full, 9999px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.featured-card-body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.featured-card-body h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary, #111827);
  margin: 0 0 0.625rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-article-card:hover .featured-card-body h3 {
  color: var(--primary-600, #4f46e5);
}

.featured-card-body p {
  font-size: 0.9375rem;
  color: var(--text-tertiary, #6b7280);
  line-height: 1.6;
  margin: 0 0 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========================================
   Badges
   ======================================== */

.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
  border: 1px solid transparent;
}

.difficulty-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

/* Specific semantic colors (fallbacks inline from JS remain) */
.difficulty-badge.basic {
  background: #d1fae5;
  color: #065f46;
  border-color: rgba(6, 95, 70, 0.12);
}

.difficulty-badge.intermediate {
  background: #dbeafe;
  color: #1e40af;
  border-color: rgba(30, 64, 175, 0.12);
}

.difficulty-badge.advanced {
  background: #e0e7ff;
  color: #312e81;
  border-color: rgba(154, 52, 18, 0.12);
}

.exam-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #ffffff;
  border: 1.5px solid #111827;
  border-radius: var(--radius-xs, 4px);
  font-size: 0.6875rem;
  color: #111827;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-family: "SF Mono", Monaco, Consolas, "Courier New", monospace;
}

.category-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(99,102,241,0.1);
  color: var(--primary-700, #3730a3);
  border: 1px solid rgba(99,102,241,0.25);
}

.read-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6b7280);
  font-weight: 500;
}

.read-time::before {
  content: "⏱";
  font-size: 0.875rem;
  opacity: 0.7;
}

/* ========================================
   Loading & Empty States
   ======================================== */

.loading-state,
.article-loading {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-tertiary, #6b7280);
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--gray-200, #e5e7eb);
  border-top-color: var(--primary-500, #6366f1);
  border-radius: 50%;
  animation: learn-spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes learn-spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-tertiary, #6b7280);
  background: #ffffff;
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  border: 1px dashed var(--gray-300, #d1d5db);
  margin: 2rem 0;
}

.empty-state::before {
  content: "📚";
  display: block;
  font-size: 3rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.empty-state p {
  font-size: 1rem;
  margin: 0;
  font-weight: 500;
}

/* ========================================
   Load More Button
   ======================================== */

.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2.25rem;
  background: #ffffff;
  border: 2px solid var(--gray-300, #d1d5db);
  border-radius: var(--radius-full, 9999px);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-secondary, #374151);
  cursor: pointer;
  transition: all var(--transition-base, 0.3s ease);
  font-family: var(--font-family-base);
  min-height: var(--touch-target-comfortable, 48px);
}

.btn-load-more:hover {
  border-color: var(--primary-500, #6366f1);
  color: var(--primary-600, #4f46e5);
  background: var(--primary-50, #eef2ff);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.btn-load-more:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus, 0 0 0 4px rgba(99,102,241,0.2));
}

/* ========================================
   Article Detail - Breadcrumb
   ======================================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6b7280);
  padding: 1.25rem 0 0.25rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--primary-600, #4f46e5);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition-fast, 0.15s ease);
}

.breadcrumb a:hover {
  color: var(--primary-700, #3730a3);
  text-decoration: underline;
}

.breadcrumb .breadcrumb-sep {
  color: var(--gray-300, #d1d5db);
  font-size: 0.75rem;
}

/* ========================================
   Article Detail - Container & Header
   ======================================== */

.learn-article-container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* When .learn-article-container is also .article-reader-layout,
   the layout-specific styles take precedence via specificity */
.article-reader-layout.learn-article-container {
  max-width: 1200px;
  padding: 0 1.5rem 4rem;
}

.article-detail-header {
  padding: 1.75rem 0 1.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

.article-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.25rem;
  align-items: center;
}

.article-detail-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 800;
  color: #1a1a2e;
  margin: 0 0 0.875rem;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.article-detail-dates {
  font-size: 0.8125rem;
  color: #9ca3af;
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  align-items: center;
  letter-spacing: 0.01em;
}

.article-detail-dates span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.article-detail-dates .dot-sep {
  color: var(--gray-300, #d1d5db);
}

/* ========================================
   Article Detail - Cover Image
   ======================================== */

.article-hero-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 2.5rem;
  border-radius: var(--radius-xl, 24px);
  overflow: hidden;
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.15));
  background: linear-gradient(135deg, #1e1b4b 0%, #1e1b4b 50%, #2563eb 100%);
}

.article-hero-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 60%,
    rgba(0, 0, 0, 0.35) 100%
  );
  pointer-events: none;
}

.article-hero-img {
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  display: block;
}

/* ========================================
   Article Detail - Body (reading-optimized)
   ======================================== */

.article-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary, #374151);
  font-family: var(--font-family-base);

  /* Content protection - MUST remain */
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

/* ─── Watermark overlay ──────────────────────────────────────────
 * Client-side friction only — NOT security. Any determined user
 * can bypass this. The low-opacity awsready.net tile is the only
 * defense that survives screenshots.
 *
 * Contract (keep in sync with):
 *   - frontend/js/learn-article.js :: installArticleProtection.injectWatermark
 *   - backend/lambda/learning_seo_renderer.py :: _build_watermark_html
 * Shared invariants: class name ".article-watermark", 18 span children,
 * each text "awsready.net", prepended as first child of .article-body.
 *
 * Accessibility note: the paired keyboard blocks in the JS/Python
 * helpers reduce usability for users who rely on print-to-braille,
 * translation extensions, and offline reading. The article footer
 * exposes a "Request accessible copy" link as the alternative path.
 * Do not expand the blocklist without providing a matching alternative.
 * ─────────────────────────────────────────────────────────────── */
.article-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  display: flex;
  flex-wrap: wrap;
  align-content: space-around;
  justify-content: space-around;
  overflow: hidden;
  z-index: 1;
}
.article-watermark > span {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  color: rgba(35, 47, 62, 0.16);
  transform: rotate(-30deg);
  white-space: nowrap;
  letter-spacing: 0.1em;
  pointer-events: none;
}
.article-body > *:not(.article-watermark) {
  position: relative;
  z-index: 2;
}

/* Hide watermark in Windows High Contrast Mode / Forced Colors — rgba()
   transparency is not honored and the watermark can appear fully opaque. */
@media (forced-colors: active) {
  .article-watermark {
    display: none !important;
  }
}

/* Accessibility affordance — visible "Request accessible copy" note
   shown below the article body on both SPA and SEO pages. */
.article-accessibility-note {
  margin: 2rem 0 1rem;
  padding: 0.875rem 1rem;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-tertiary, #6b7280);
}
.article-accessibility-note p {
  margin: 0;
}
.article-accessibility-note a {
  color: var(--text-secondary, #374151);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article-accessibility-note a:hover {
  color: #6366f1;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body h2 {
  font-size: 1.625rem;
  font-weight: 800;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--secondary-color, #1a1a2e);
  letter-spacing: -0.025em;
  line-height: 1.25;
  position: relative;
  padding-left: 1rem;
  border-left: 4px solid #6366f1;
}

.article-body h2::after {
  display: none;
}

.article-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.625rem;
  color: #1a1a2e;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.article-body h4 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary, #374151);
}

.article-body p {
  margin: 0 0 1.25rem;
}

.article-body strong {
  color: var(--secondary-color, #1e1b4b);
  font-weight: 700;
}

.article-body em {
  color: var(--text-secondary, #374151);
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.5rem;
  padding-left: 1.75rem;
}

.article-body li {
  margin-bottom: 0.625rem;
  line-height: 1.75;
}

.article-body li::marker {
  color: var(--primary-500, #6366f1);
  font-weight: 700;
}

.article-body a {
  color: var(--primary-600, #4f46e5);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast, 0.15s ease);
  font-weight: 500;
}

.article-body a:hover {
  color: var(--primary-700, #3730a3);
  text-decoration-thickness: 2.5px;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 1.5rem auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--gray-200, #e5e7eb);
}

.article-body hr {
  border: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gray-300, #d1d5db),
    transparent
  );
  margin: 2.5rem 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  border-radius: var(--radius-sm, 8px);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  border: 1px solid var(--gray-200, #e5e7eb);
}

.article-body th,
.article-body td {
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  padding: 0.75rem 1rem;
  text-align: left;
}

.article-body th {
  background: var(--gray-50, #f9fafb);
  font-weight: 700;
  color: var(--text-secondary, #374151);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.article-body tr:last-child td {
  border-bottom: none;
}

.article-body tr:hover td {
  background: var(--gray-50, #f9fafb);
}

/* Code styles (syntax-highlighting friendly) */
.article-body code {
  background: var(--gray-100, #f3f4f6);
  color: #be185d;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs, 4px);
  font-family: "SF Mono", Monaco, "Inconsolata", "Courier New", monospace;
  font-size: 0.875em;
  border: 1px solid var(--gray-200, #e5e7eb);
  font-weight: 500;
}

.article-body pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.375rem 1.5rem;
  border-radius: var(--radius-md, 12px);
  overflow-x: auto;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
  line-height: 1.7;
  position: relative;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Quill outputs one <pre> per line — merge consecutive into one visual block */
.article-body pre + pre {
  margin-top: -1.5rem;
  border-top: none;
  border-radius: 0;
  padding-top: 0;
  box-shadow: none;
}

.article-body pre + pre::before {
  display: none;
}

.article-body pre:has(+ pre) {
  border-radius: var(--radius-md, 12px) var(--radius-md, 12px) 0 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* Last pre in a consecutive group */
.article-body pre:not(:has(+ pre)):where(pre + pre) {
  border-radius: 0 0 var(--radius-md, 12px) var(--radius-md, 12px);
  padding-bottom: 1.375rem;
}

.article-body pre::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-500, #6366f1),
    #2563eb,
    #10b981
  );
  border-radius: var(--radius-md, 12px) var(--radius-md, 12px) 0 0;
  opacity: 0.8;
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  font-size: 0.9rem;
  font-weight: 400;
}

/* Blockquote */
.article-body blockquote {
  border-left: 4px solid var(--primary-500, #6366f1);
  padding: 1rem 1.5rem;
  margin: 1.75rem 0;
  color: var(--text-secondary, #374151);
  background: linear-gradient(
    90deg,
    rgba(255, 153, 0, 0.06) 0%,
    transparent 100%
  );
  border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
  font-style: italic;
  font-size: 1.0625rem;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

/* ----------------------------------------
   Callout Boxes (blockquote variants)
   Usage: <blockquote class="callout-info"> etc.
   Types: info (blue), tip (orange), warning (red), note (gray)
   ---------------------------------------- */

/* Shared callout base */
.article-body blockquote.callout-info,
.article-body blockquote.callout-tip,
.article-body blockquote.callout-warning,
.article-body blockquote.callout-note {
  font-style: normal;
  padding: 1.125rem 1.375rem;
  margin: 1.75rem 0;
  border-radius: var(--radius-sm, 8px);
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-primary, #1f2937);
}

/* Callout title (first <strong> child or first line bold) */
.article-body blockquote.callout-info > p:first-child strong:first-child,
.article-body blockquote.callout-tip > p:first-child strong:first-child,
.article-body blockquote.callout-warning > p:first-child strong:first-child,
.article-body blockquote.callout-note > p:first-child strong:first-child {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

/* Callout title as direct <strong> child (Quill 2 emits bare <strong> without <p>) */
.article-body blockquote.callout-info > strong:first-child:last-child,
.article-body blockquote.callout-tip > strong:first-child:last-child,
.article-body blockquote.callout-warning > strong:first-child:last-child,
.article-body blockquote.callout-note > strong:first-child:last-child {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}
.article-body blockquote.callout-info > strong:first-child:last-child { color: #1e40af; }
.article-body blockquote.callout-tip > strong:first-child:last-child { color: #4338ca; }
.article-body blockquote.callout-warning > strong:first-child:last-child { color: #dc2626; }
.article-body blockquote.callout-note > strong:first-child:last-child { color: #4b5563; }

/* Title-only box in a consecutive group: kill the trailing margin so it
   doesn't create a visible gap before the next stitched box. */
.article-body blockquote[class*="callout-"]:has(+ blockquote[class*="callout-"]) > strong:first-child:last-child {
  margin-bottom: 0;
}

/* --- Info / Key Concept (blue) --- */
.article-body blockquote.callout-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
}

.article-body blockquote.callout-info > p:first-child strong:first-child {
  color: #1e40af;
}

/* --- Exam Tip (orange/amber) --- */
.article-body blockquote.callout-tip {
  background: #fff8ee;
  border: 1px solid #fde68a;
  border-left: 4px solid #6366f1;
}

.article-body blockquote.callout-tip > p:first-child strong:first-child {
  color: #4338ca;
}

/* --- Warning (red) --- */
.article-body blockquote.callout-warning {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
}

.article-body blockquote.callout-warning > p:first-child strong:first-child {
  color: #dc2626;
}

/* --- Note (gray) --- */
.article-body blockquote.callout-note {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-left: 4px solid #6b7280;
}

.article-body blockquote.callout-note > p:first-child strong:first-child {
  color: #4b5563;
}

/* Merge consecutive callout blockquotes of the same type into one visual box.
   Quill 2 emits one <blockquote> per paragraph, so this CSS stitches them.
   margin-top: 0 (not -1.75rem) because the preceding box already has
   margin-bottom: 0, so the total gap is already 0 — a negative margin would
   cause each box to slide UP over the previous one, hiding all but the last. */
.article-body blockquote.callout-info + blockquote.callout-info,
.article-body blockquote.callout-tip  + blockquote.callout-tip,
.article-body blockquote.callout-warning + blockquote.callout-warning,
.article-body blockquote.callout-note + blockquote.callout-note {
  margin-top: 0;
  border-top: none;
  border-radius: 0 0 var(--radius-sm, 8px) var(--radius-sm, 8px);
  padding-top: 0;
}

/* First in a consecutive group: square off bottom corners */
.article-body blockquote.callout-info:has(+ blockquote.callout-info),
.article-body blockquote.callout-tip:has(+ blockquote.callout-tip),
.article-body blockquote.callout-warning:has(+ blockquote.callout-warning),
.article-body blockquote.callout-note:has(+ blockquote.callout-note) {
  border-radius: var(--radius-sm, 8px) var(--radius-sm, 8px) 0 0;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Middle items in a group of 3+ */
.article-body blockquote.callout-info + blockquote.callout-info:has(+ blockquote.callout-info),
.article-body blockquote.callout-tip  + blockquote.callout-tip:has(+ blockquote.callout-tip),
.article-body blockquote.callout-warning + blockquote.callout-warning:has(+ blockquote.callout-warning),
.article-body blockquote.callout-note + blockquote.callout-note:has(+ blockquote.callout-note) {
  border-radius: 0;
}

/* Legacy class-based callouts (backward compat) */
.article-body .note,
.article-body .callout {
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-left: 4px solid #2563eb;
  border-radius: var(--radius-sm, 8px);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary, #374151);
}

.article-body .warning {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
  border-radius: var(--radius-sm, 8px);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary, #374151);
}

.article-body .tip,
.article-body .success {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-left: 4px solid #d97706;
  border-radius: var(--radius-sm, 8px);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary, #374151);
}

/* ========================================
   Article Detail - Related Articles
   ======================================== */

.related-section {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  margin-top: 3rem;
}

.related-section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--secondary-color, #1e1b4b);
  margin: 0 0 1.5rem;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: 1rem;
}

.related-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  bottom: 10%;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(
    180deg,
    var(--primary-500, #6366f1) 0%,
    var(--primary-600, #4f46e5) 100%
  );
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: var(--radius-lg, 16px);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.25s var(--ease-smooth),
    box-shadow 0.25s var(--ease-smooth);
  border: 1px solid var(--gray-200, #e5e7eb);
}

.related-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
  text-decoration: none;
}

.related-card-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #1e1b4b 0%, #2563eb 100%);
}

.related-card-cover-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
}

.related-card-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-card-body {
  padding: 1rem 1.125rem 1.125rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.related-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.related-card-body h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin: 0 0 0.375rem;
  line-height: 1.4;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card:hover .related-card-body h3 {
  color: var(--primary-600, #4f46e5);
}

.related-card-body p {
  font-size: 0.8125rem;
  color: var(--text-tertiary, #6b7280);
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========================================
   Article Detail - Navigation (Prev/Next)
   ======================================== */

.article-nav {
  display: flex;
  justify-content: space-between;
  padding: 1.75rem 0 0;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  margin-top: 2.5rem;
  gap: 1rem;
}

.article-nav-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text-secondary, #374151);
  max-width: 45%;
  padding: 1rem 1.25rem;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-md, 12px);
  background: #ffffff;
  transition: all var(--transition-fast, 0.15s ease);
}

.article-nav-link:hover {
  color: var(--primary-600, #4f46e5);
  border-color: var(--primary-300, #a5b4fc);
  background: var(--primary-50, #eef2ff);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
}

.article-nav-label {
  font-size: 0.6875rem;
  color: var(--text-tertiary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.article-nav-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary, #111827);
}

.article-nav-link.next {
  text-align: right;
  margin-left: auto;
}

/* ========================================
   Article Detail - Error State
   ======================================== */

.article-error {
  text-align: center;
  padding: 5rem 1.5rem;
  color: var(--text-tertiary, #6b7280);
}

.article-error::before {
  content: "🔍";
  display: block;
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.article-error h2 {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--secondary-color, #1e1b4b);
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

.article-error a {
  color: var(--primary-600, #4f46e5);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-error a:hover {
  color: var(--primary-700, #3730a3);
}

/* ========================================
   Visually Hidden (a11y)
   ======================================== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
   Content Protection (MUST remain)
   ======================================== */

@media print {
  body,
  .learn-article-container,
  .article-detail-header,
  .article-hero-wrap,
  .article-body,
  .article-body *,
  .article-watermark {
    display: none !important;
    visibility: hidden !important;
  }
}

/* ========================================
   Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  .article-card,
  .featured-article-card,
  .category-card,
  .related-card,
  .article-cover,
  .featured-cover,
  .btn-load-more,
  .article-nav-link {
    transition: none !important;
  }

  .article-card:hover,
  .featured-article-card:hover,
  .category-card:hover,
  .related-card:hover {
    transform: none !important;
  }

  .spinner {
    animation-duration: 2s;
  }
}

/* ========================================
   Responsive - Tablet
   ======================================== */

@media (max-width: 768px) {
  .learn-hero {
    padding: 3rem 0 2.5rem;
  }

  .learn-hero h1 {
    font-size: 2rem;
  }

  .learn-hero p {
    font-size: 1rem;
  }

  .learn-hero-eyebrow {
    font-size: 0.6875rem;
  }

  .filter-bar {
    gap: 8px;
    padding: 12px 0;
  }

  .filter-bar select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 0.8125rem;
    padding: 9px 32px 9px 14px;
  }

  .learn-featured,
  .learn-categories,
  .learn-articles {
    padding: 2.25rem 0;
  }

  .learn-featured h2,
  .learn-categories h2,
  .learn-articles h2,
  .related-section h2 {
    font-size: 1.375rem;
  }

  .category-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .featured-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .article-detail-header {
    padding: 1rem 0 1.5rem;
  }

  .article-body {
    font-size: 1.0625rem;
    line-height: 1.75;
  }

  .article-body h2 {
    font-size: 1.5rem;
    margin-top: 2.25rem;
  }

  .article-body h3 {
    font-size: 1.2rem;
    margin-top: 1.75rem;
  }

  .article-body pre {
    padding: 1.125rem 1.125rem;
    font-size: 0.8375rem;
    margin: 1.25rem -0.5rem;
    border-radius: var(--radius-sm, 8px);
  }

  .article-hero-wrap {
    margin-bottom: 1.75rem;
    border-radius: var(--radius-md, 12px);
  }

  .article-hero-img {
    max-height: 300px;
  }

  .article-nav {
    flex-direction: column;
  }

  .article-nav-link {
    max-width: 100%;
  }

  .article-nav-link.next {
    text-align: left;
    margin-left: 0;
  }

  .learn-article-container {
    padding: 0 1rem 3rem;
  }
}

/* ========================================
   Responsive - Mobile
   ======================================== */

@media (max-width: 480px) {
  .learn-hero {
    padding: 2.5rem 0 2rem;
  }

  .learn-hero h1 {
    font-size: 1.75rem;
  }

  .learn-hero p {
    font-size: 0.9375rem;
  }

  .filter-bar select {
    flex: 1 1 100%;
  }

  .article-detail-header h1 {
    font-size: 1.625rem;
  }

  .article-body {
    font-size: 1rem;
  }

  .article-body h2 {
    font-size: 1.375rem;
  }

  .article-body h3 {
    font-size: 1.125rem;
  }

  .featured-card-body,
  .article-card-body {
    padding: 1.125rem;
  }

  .featured-card-body h3 {
    font-size: 1.125rem;
  }
}

/* ==========================================
   Premium / private article markers
   ========================================== */

/* Lock badge — overlays the cover image on premium article cards.
   Positioned top-right so it doesn't collide with the difficulty badge
   (which sits top-left via .article-cover-badge). */
.premium-lock-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 9px;
  /* Gradient stops chosen so the darkest stop still passes 4.5:1 contrast
     against the #2a1a04 text. #d97706 fails (4.3:1); #db7b0f passes (≈5.1:1). */
  background: linear-gradient(
    135deg,
    #fbbf24 0%,
    #f59e0b 50%,
    #db7b0f 100%
  );
  color: #2a1a04;
  font-size: 0.6875rem;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 4px 14px rgba(180, 83, 9, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  pointer-events: none;
}

.premium-lock-badge-icon {
  font-size: 0.8125rem;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.4));
}

.premium-lock-badge-text {
  line-height: 1;
}

/* When the featured ribbon is already in the top-right, nudge the lock
   badge down so they stack cleanly rather than overlapping. */
.featured-cover-wrap .premium-lock-badge {
  top: 52px;
}

/* Premium card treatment — a warmer tint and a subtle gold inset ring
   that reads as "special" without shouting. */
.article-card-premium {
  background:
    linear-gradient(180deg, #fffdf7 0%, #ffffff 35%);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.18) inset,
    var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.05));
}

.article-card-premium:hover {
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.28) inset,
    var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.12));
}

.featured-article-card.article-card-premium {
  background:
    linear-gradient(180deg, #fffdf7 0%, #ffffff 40%);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.22) inset,
    var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
}

.featured-article-card.article-card-premium:hover {
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.35) inset,
    var(--shadow-xl, 0 20px 60px rgba(0, 0, 0, 0.2));
}

/* ==========================================
   Paywall view on the article detail SPA
   ========================================== */

.article-paywall {
  max-width: 720px;
  margin: 2.5rem auto;
  background: #ffffff;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-xl, 20px);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.12) inset,
    0 12px 40px rgba(17, 24, 39, 0.08);
  overflow: hidden;
}

/* Branded header strip — sets tone before the title */
.article-paywall .paywall-header-strip {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  /* Darkest gradient stop capped so #2a1a04 text stays ≥4.5:1 everywhere. */
  background: linear-gradient(
    90deg,
    #fbbf24 0%,
    var(--primary-500, #6366f1) 50%,
    #db7b0f 100%
  );
  color: #2a1a04;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(180, 83, 9, 0.25);
}

.article-paywall .paywall-header-strip-icon {
  font-size: 0.9375rem;
  line-height: 1;
}

.article-paywall .login-gate-strip {
  background: linear-gradient(90deg, #60a5fa 0%, #1a73e8 50%, #1557b0 100%);
  border-bottom-color: rgba(21, 87, 176, 0.25);
}

.article-paywall .paywall-body {
  padding: 2rem 2rem 2.25rem;
}

.article-paywall .paywall-cover {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-lg, 12px);
  margin-bottom: 1.5rem;
  display: block;
  border: 1px solid var(--gray-100, #f3f4f6);
}

.article-paywall h1 {
  font-size: 1.875rem;
  font-weight: 800;
  margin: 0 0 0.875rem;
  color: var(--text-primary, #111827);
  line-height: 1.25;
  letter-spacing: -0.02em;
  /* Programmatic focus target (tabindex="-1") for screen-reader
     announcement when the paywall replaces the skeleton. */
  outline: none;
}

.article-paywall h1:focus-visible {
  outline: 2px solid #4338ca;
  outline-offset: 4px;
  border-radius: 2px;
}

/* Exam chips + lock pill — now live under the title */
.article-paywall .paywall-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

/* The lock pill inside paywall-meta is inline, not an overlay. */
.article-paywall .paywall-meta .premium-lock-badge {
  position: static;
  top: auto;
  right: auto;
}

.article-paywall .paywall-excerpt {
  color: var(--text-secondary, #374151);
  line-height: 1.65;
  font-size: 1.0625rem;
  margin: 0 0 1.75rem;
}

/* CTA block — elevated, clearly actionable */
.article-paywall .paywall-cta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem 1.5rem 1.625rem;
  background: linear-gradient(135deg, #eef2ff 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 1px 2px rgba(180, 83, 9, 0.06);
}

.article-paywall .paywall-cta-title {
  font-weight: 800;
  color: #7c2d12;
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0;
}

.article-paywall .paywall-cta-body {
  color: #78350f;
  font-size: 0.9375rem;
  line-height: 1.55;
  margin: 0 0 0.25rem;
}

.article-paywall .paywall-cta-body strong {
  color: #7c2d12;
  font-weight: 700;
}

.article-paywall .paywall-cta-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.875rem;
}

.article-paywall .paywall-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.375rem;
  border-radius: var(--radius-md, 8px);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9375rem;
  line-height: 1.2;
  transition:
    transform 0.15s var(--ease-smooth, ease),
    box-shadow 0.15s var(--ease-smooth, ease),
    background 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.article-paywall .paywall-btn-primary {
  /* Brand orange kept visually, but darker end-stops so white text
     passes WCAG 1.4.3 AA at 15px bold (both stops ≥ 5:1 against #fff). */
  background: linear-gradient(
    135deg,
    #4338ca 0%,
    #7c2d12 100%
  );
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(124, 45, 18, 0.38);
}

.article-paywall .paywall-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(124, 45, 18, 0.45);
  color: #ffffff;
  text-decoration: none;
}

.article-paywall .paywall-btn-primary:focus-visible {
  /* Solid dark ring — opaque, meets 1.4.11 non-text contrast against
     the white page background and the button's own dark gradient. */
  outline: 2px solid #1f0d00;
  outline-offset: 2px;
}

.article-paywall .paywall-btn-secondary {
  background: #ffffff;
  color: #7c2d12;
  border-color: #fcd34d;
}

.article-paywall .paywall-btn-secondary:hover {
  background: #fffbeb;
  transform: translateY(-1px);
  text-decoration: none;
}

.article-paywall .paywall-btn-secondary:focus-visible {
  outline: 2px solid #7c2d12;
  outline-offset: 2px;
}

.article-paywall .paywall-refresh-hint {
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  color: #92400e;
  line-height: 1.5;
}

.article-paywall .paywall-refresh-link {
  color: #7c2d12;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(124, 45, 18, 0.35);
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}

.article-paywall .paywall-refresh-link:hover {
  text-decoration-color: currentColor;
}

/* ========================================
   REDESIGN ADDITIONS — 2026-04
   Scoped to learn pages only (.learn-page,
   .learn-article-container, etc.) so no
   other pages are affected.
   ======================================== */

/* ----------------------------------------
   Hub page: light background — matches article detail aesthetic
   ---------------------------------------- */
body.learn-page {
  background: #fff;
  color: #374151;
}

/* ----------------------------------------
   Hub hero — light gradient
   ---------------------------------------- */
.learn-hero {
  background: linear-gradient(160deg, #fff8ee 0%, #ffffff 60%);
  color: #1a1a2e;
  border-bottom: 1px solid #e5e7eb;
}

.learn-hero h1 {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  -webkit-text-fill-color: unset;
  color: #1a1a2e;
}

.learn-hero p {
  color: #6b7280;
}

.learn-hero-eyebrow {
  color: #6366f1;
  background: rgba(99,102,241,0.08);
  border-color: rgba(99,102,241,0.25);
}

/* Hero stat row */
.learn-hero-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.learn-hero-stat {
  text-align: center;
}

.learn-hero-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: #6366f1;
  letter-spacing: -0.03em;
  line-height: 1;
}

.learn-hero-stat-label {
  display: block;
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
  font-weight: 600;
}

/* ----------------------------------------
   Hub filter bar — light theme
   ---------------------------------------- */
.learn-filters {
  background: #f9fafb;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: none;
}

/* Search input */
.filter-search-wrap {
  position: relative;
  flex: 1 1 280px;
  min-width: 200px;
}

.filter-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
  font-size: 0.9rem;
  line-height: 1;
}

.filter-search-input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  background: #ffffff;
  border: 1.5px solid #d1d5db;
  border-radius: var(--radius-full, 9999px);
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-family-base);
  min-height: 40px;
  transition: all var(--transition-fast, 0.15s ease);
  box-sizing: border-box;
}

.filter-search-input::placeholder {
  color: #9ca3af;
}

.filter-search-input:hover {
  border-color: rgba(255,153,0,0.5);
  background: #ffffff;
}

.filter-search-input:focus {
  outline: none;
  border-color: #6366f1;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

/* Selects — light theme */
.filter-bar select {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  border-color: #d1d5db;
  color: #374151;
}

.filter-bar select:hover {
  border-color: rgba(255,153,0,0.5);
  background-color: #ffffff;
}

.filter-bar select:focus {
  background-color: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}

.filter-bar select option {
  background: #ffffff;
  color: #374151;
}

/* Active filter pill */
.filter-active-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0 12px;
  flex-wrap: wrap;
}

.filter-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-full, 9999px);
  color: #4338ca;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.filter-active-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(99,102,241,0.2);
  border: none;
  cursor: pointer;
  color: #4338ca;
  font-size: 0.7rem;
  padding: 0;
  font-family: inherit;
  line-height: 1;
  transition: background var(--transition-fast, 0.15s ease);
}

.filter-active-pill-remove:hover {
  background: rgba(99,102,241,0.4);
}

/* ----------------------------------------
   Hub sections — dark backgrounds
   ---------------------------------------- */
.learn-page .learn-featured,
.learn-page .learn-categories,
.learn-page .learn-articles {
  background: transparent;
}

.learn-page .learn-featured h2,
.learn-page .learn-categories h2,
.learn-page .learn-articles h2 {
  color: #1a1a2e;
}

.learn-page .section-subtitle {
  color: #6b7280;
}

/* ----------------------------------------
   Category cards — light theme (hub page only)
   ---------------------------------------- */
.learn-page .category-card {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #374151;
}

.learn-page .category-card h3 {
  color: #1a1a2e;
}

.learn-page .category-card p {
  color: #6b7280;
}

.learn-page .category-card:hover {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99,102,241,0.1);
}

.learn-page .category-card-footer {
  border-top-color: #e5e7eb;
}

.learn-page .article-count {
  color: #6b7280;
}

/* ----------------------------------------
   Article cards — light theme (hub page only)
   ---------------------------------------- */
.learn-page .article-card {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #374151;
}

.learn-page .article-card-body h3 {
  color: #1a1a2e;
}

.learn-page .article-card-body p {
  color: #6b7280;
}

.learn-page .article-card:hover {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99,102,241,0.1);
}

.learn-page .article-card:hover .article-card-body h3 {
  color: #6366f1;
}

.learn-page .article-card-footer {
  border-top-color: #e5e7eb;
}

/* Cover placeholder — always dark (the gradient looks good on both) */
.article-cover-placeholder {
  background-image:
    radial-gradient(circle at 25% 25%, rgba(99,102,241,0.3) 0%, transparent 55%),
    radial-gradient(circle at 75% 75%, rgba(37,99,235,0.3) 0%, transparent 55%);
}

/* Premium card — light (hub page only) */
.learn-page .article-card-premium {
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 40%);
  border-color: rgba(245,158,11,0.3);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.1) inset;
}

.learn-page .article-card-premium:hover {
  background: linear-gradient(180deg, #fef3c7 0%, #ffffff 40%);
  border-color: rgba(245,158,11,0.5);
  box-shadow:
    0 0 0 1px rgba(245,158,11,0.2) inset,
    0 4px 20px rgba(99,102,241,0.1);
}

/* ----------------------------------------
   Featured cards — light theme (hub page only)
   ---------------------------------------- */
.learn-page .featured-article-card {
  background: #ffffff;
  border-color: #e5e7eb;
}

.learn-page .featured-card-body h3 {
  color: #1a1a2e;
}

.learn-page .featured-card-body p {
  color: #6b7280;
}

.learn-page .featured-article-card:hover {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99,102,241,0.1);
}

.learn-page .featured-article-card:hover .featured-card-body h3 {
  color: #6366f1;
}

.learn-page .featured-article-card.article-card-premium {
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 40%);
  border-color: rgba(245,158,11,0.3);
}

/* ----------------------------------------
   Empty / loading states — light (hub page only)
   ---------------------------------------- */
.learn-page .empty-state {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}

.learn-page .empty-state p {
  color: #6b7280;
}

.learn-page .loading-state {
  color: #6b7280;
}

.learn-page .spinner {
  border-color: #e5e7eb;
  border-top-color: #6366f1;
}

/* ----------------------------------------
   Load more button — light (hub page only)
   ---------------------------------------- */
.learn-page .btn-load-more {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #374151;
}

.learn-page .btn-load-more:hover {
  border-color: #6366f1;
  color: #6366f1;
  background: rgba(99,102,241,0.08);
}

/* ----------------------------------------
   Hub page footer — proper dark footer
   ---------------------------------------- */
.learn-page-footer {
  background: #0d1117;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 2.5rem 0 2rem;
  margin-top: 3rem;
}

.learn-page-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.learn-page-footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.learn-page-footer-links a {
  color: rgba(201,209,217,0.6);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition-fast, 0.15s ease);
}

.learn-page-footer-links a:hover {
  color: #6366f1;
}

.learn-page-footer-copy {
  font-size: 0.8125rem;
  color: rgba(201,209,217,0.35);
  margin: 0;
}

/* ----------------------------------------
   Static hub page: .learn-article-card
   (used in the pre-rendered HTML fallback
   in learn/index.html before JS loads)
   ---------------------------------------- */
.learn-article-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg, 16px);
  overflow: hidden;
  padding: 1.25rem;
  text-decoration: none;
  color: #374151;
  transition:
    transform 0.25s var(--ease-smooth, ease),
    box-shadow 0.25s var(--ease-smooth, ease),
    border-color 0.25s var(--ease-smooth, ease);
  gap: 0.75rem;
}

.learn-article-card:hover {
  transform: translateY(-3px);
  border-color: #6366f1;
  box-shadow: 0 4px 20px rgba(99,102,241,0.1);
  text-decoration: none;
  color: #374151;
}

.learn-article-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.4);
}

.learn-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.learn-article-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
  line-height: 1.4;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast, 0.15s ease);
}

.learn-article-card:hover h3 {
  color: #6366f1;
}

.learn-article-card p {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* ----------------------------------------
   Static article-page badges
   (badge-* classes used by the SEO renderer
   and the static learn/index.html)
   ---------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
}

.badge-category {
  background: rgba(99,102,241,0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99,102,241,0.25);
}

.badge-difficulty {
  border: 1px solid transparent;
}

.badge-basic {
  background: rgba(16,185,129,0.15);
  color: #6ee7b7;
  border-color: rgba(16,185,129,0.2);
}

.badge-intermediate {
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border-color: rgba(59,130,246,0.2);
}

.badge-advanced {
  background: rgba(245,158,11,0.15);
  color: #fcd34d;
  border-color: rgba(245,158,11,0.2);
}

.badge-exam {
  background: rgba(201,209,217,0.08);
  color: rgba(201,209,217,0.65);
  border: 1px solid rgba(201,209,217,0.12);
  font-family: "SF Mono", Monaco, Consolas, "Courier New", monospace;
  border-radius: var(--radius-xs, 4px);
  font-size: 0.6875rem;
  padding: 2px 8px;
}

.badge-read {
  background: rgba(201,209,217,0.07);
  color: rgba(201,209,217,0.55);
  border: 1px solid transparent;
}

/* ----------------------------------------
   Hub page (light bg) badge colour overrides
   Base badge-* rules use dark-mode colours;
   scoped overrides restore WCAG contrast on white.
   ---------------------------------------- */
.learn-page .badge-category {
  background: rgba(99,102,241,0.1);
  color: #4338ca;
  border-color: rgba(99,102,241,0.25);
}

.learn-page .badge-basic {
  background: #d1fae5;
  color: #065f46;
  border-color: rgba(6,95,70,0.2);
}

.learn-page .badge-intermediate {
  background: #dbeafe;
  color: #1e40af;
  border-color: rgba(30,64,175,0.2);
}

.learn-page .badge-advanced {
  background: #e0e7ff;
  color: #312e81;
  border-color: rgba(154,52,18,0.2);
}

.learn-page .badge-exam {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.learn-page .badge-read {
  background: rgba(99,115,129,0.08);
  color: #6b7280;
  border-color: rgba(99,115,129,0.15);
}

/* On light-background pages (article reader), keep badge-basic green readable */
.learn-article-container .difficulty-badge.basic {
  background: #d1fae5;
  color: #065f46;
  border-color: rgba(6, 95, 70, 0.12);
}

.learn-article-container .difficulty-badge.intermediate {
  background: #dbeafe;
  color: #1e40af;
  border-color: rgba(30, 64, 175, 0.12);
}

.learn-article-container .difficulty-badge.advanced {
  background: #e0e7ff;
  color: #312e81;
  border-color: rgba(154, 52, 18, 0.12);
}

/* Article detail page badges — light background overrides.
   The base badge-* rules use dark-mode colours; article pages are light. */
.article-detail-badges .badge-basic {
  background: #d1fae5;
  color: #065f46;
  border-color: rgba(6, 95, 70, 0.2);
}

.article-detail-badges .badge-intermediate {
  background: #dbeafe;
  color: #1e40af;
  border-color: rgba(30, 64, 175, 0.2);
}

.article-detail-badges .badge-advanced {
  background: #e0e7ff;
  color: #312e81;
  border-color: rgba(154, 52, 18, 0.2);
}

.article-detail-badges .badge-exam {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-full, 9999px);
  font-family: "SF Mono", Monaco, Consolas, "Courier New", monospace;
  font-size: 0.6875rem;
}

.article-detail-badges .badge-read {
  background: rgba(99, 115, 129, 0.08);
  color: #6b7280;
  border-color: rgba(99, 115, 129, 0.15);
}

.article-detail-badges .badge-category {
  background: rgba(99,102,241,0.1);
  color: #4338ca;
  border-color: rgba(99,102,241,0.25);
}

/* ----------------------------------------
   Article reader page — layout improvements
   ---------------------------------------- */

/* Wider outer wrapper with sidebar support */
.article-reader-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "article";
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 4rem;
  gap: 2rem;
}

@media (min-width: 1100px) {
  .article-reader-layout {
    grid-template-columns: minmax(0, 760px) 240px;
    grid-template-areas: "article toc";
    align-items: start;
  }
}

.article-reader-main {
  grid-area: article;
  min-width: 0;
}

/* Table of Contents sidebar */
.article-toc {
  grid-area: toc;
  display: none;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 1.25rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg, 16px);
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.article-toc::-webkit-scrollbar {
  width: 4px;
}

.article-toc::-webkit-scrollbar-track {
  background: transparent;
}

.article-toc::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 2px;
}

@media (min-width: 1100px) {
  .article-toc {
    display: block;
  }
}

.article-toc-title {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  margin: 0 0 0.875rem;
}

.article-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.article-toc-item {
  margin: 0;
}

.article-toc-link {
  display: block;
  padding: 5px 8px;
  font-size: 0.8125rem;
  color: #6b7280;
  text-decoration: none;
  border-radius: var(--radius-xs, 4px);
  line-height: 1.45;
  transition: all var(--transition-fast, 0.15s ease);
  border-left: 2px solid transparent;
}

.article-toc-link:hover {
  color: #6366f1;
  background: rgba(255,153,0,0.06);
  border-left-color: rgba(99,102,241,0.4);
}

.article-toc-link.is-active {
  color: #4f46e5;
  font-weight: 600;
  background: rgba(99,102,241,0.08);
  border-left-color: #6366f1;
}

.article-toc-item--h3 .article-toc-link {
  padding-left: 20px;
  font-size: 0.75rem;
}

/* Progress bar — more visible */
.reading-progress {
  height: 3px;
  z-index: 1000;
}

.reading-progress-bar {
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  box-shadow: 0 0 10px rgba(255,153,0,0.5);
}

/* Article header improvements */
.article-detail-header {
  padding: 1.75rem 0 1.25rem;
}

.article-detail-header h1 {
  font-size: clamp(1.875rem, 3.5vw, 2.75rem);
  color: #111827;
  margin-bottom: 1.25rem;
}

.article-detail-dates {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md, 12px);
  padding: 0.625rem 1rem;
  display: inline-flex;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.8125rem;
  color: #6b7280;
  flex-wrap: wrap;
}

/* Back to Learn link on article page */
.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  transition: color var(--transition-fast, 0.15s ease);
}

.article-back-link::before {
  content: "←";
  font-size: 0.875rem;
}

.article-back-link:hover {
  color: #6366f1;
  text-decoration: none;
}

/* Breadcrumb improvements */
.breadcrumb {
  padding: 1rem 0 0.5rem;
  gap: 0.375rem;
}

.breadcrumb a {
  color: #6b7280;
  font-weight: 500;
}

.breadcrumb a:hover {
  color: #6366f1;
}

.breadcrumb-category {
  color: #6366f1;
  font-weight: 600;
}

/* Article body — cleaner reading */
.article-body {
  font-size: 1.0625rem;
  line-height: 1.82;
  color: #1f2937;
}

.article-body h2 {
  font-size: 1.625rem;
  margin-top: 2.75rem;
}

.article-body h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
}

/* Inline exam-tip key-fact styling for article body */
.article-body .key-fact {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #22c55e;
  border-radius: 0 var(--radius-sm, 8px) var(--radius-sm, 8px) 0;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
  color: #14532d;
}

/* Related articles section dark override */
.related-section {
  border-top-color: rgba(201,209,217,0.12);
}

.related-section h2 {
  color: #111827;
}

.related-card {
  background: #ffffff;
  border-color: #e5e7eb;
}

.related-card:hover {
  background: #f9fafb;
  border-color: rgba(99,102,241,0.25);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.related-card-body h3 {
  color: #111827;
}

.related-card-body p {
  color: #6b7280;
}

/* Article nav improvements */
.article-nav-link {
  background: #f9fafb;
  border-color: #e5e7eb;
}

.article-nav-link:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #4f46e5;
}

.article-nav-title {
  color: #111827;
}

/* Article accessibility note */
.article-accessibility-note {
  background: rgba(255,153,0,0.05);
  border-left-color: rgba(255,153,0,0.5);
  color: #6b7280;
}

.article-accessibility-note a {
  color: #4f46e5;
}

/* ----------------------------------------
   Exam badges in difficulty-badge style
   used on the article detail page header
   ---------------------------------------- */
.exam-badge {
  background: rgba(201,209,217,0.12);
  border-color: rgba(201,209,217,0.18);
  color: #6b7280;
}

/* ----------------------------------------
   Responsive: filter search on mobile
   ---------------------------------------- */
@media (max-width: 768px) {
  .filter-search-wrap {
    flex: 1 1 100%;
    order: -1;
  }

  .learn-hero-stats {
    gap: 1.25rem;
  }

  .learn-hero-stat-value {
    font-size: 1.375rem;
  }

  .article-reader-layout {
    padding: 0 1rem 3rem;
  }

  .article-toc {
    display: none !important;
  }

  .article-detail-dates {
    font-size: 0.75rem;
    padding: 0.5rem 0.875rem;
    gap: 0.5rem;
  }

  .article-detail-header h1 {
    font-size: 1.5rem;
  }

  .article-body {
    font-size: 1rem;
  }

  .article-body h2 {
    font-size: 1.375rem;
    padding-left: 0.75rem;
  }

  .article-body h3 {
    font-size: 1.0625rem;
  }

  .article-exam-cta {
    padding: 1.5rem 1.25rem;
  }

  .exam-cta-subtitle {
    padding-left: 0;
  }
}

@media (max-width: 480px) {
  .learn-hero-stats {
    gap: 1rem;
  }

  .learn-hero-stat-value {
    font-size: 1.25rem;
  }

  .article-detail-header h1 {
    font-size: 1.375rem;
  }
}

/* ----------------------------------------
   Mobile navigation menu fix for learn page
   ---------------------------------------- */
.learn-page .mobile-menu {
  background: #161b22;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.learn-page .mobile-menu a {
  color: #c9d1d9;
  border-bottom-color: rgba(255,255,255,0.06);
}

.learn-page .mobile-menu a:hover,
.learn-page .mobile-menu a.active {
  color: #6366f1;
  background: rgba(255,153,0,0.06);
}

.article-paywall .paywall-refresh-link:focus-visible {
  outline: 2px solid #7c2d12;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Respect users who prefer reduced motion — disable hover lifts. */
@media (prefers-reduced-motion: reduce) {
  .article-paywall .paywall-btn,
  .article-paywall .paywall-btn-primary:hover,
  .article-paywall .paywall-btn-secondary:hover {
    transition: none !important;
    transform: none !important;
  }
}

/* Mobile — under 720px, reduce padding and stack the CTA buttons */
@media (max-width: 720px) {
  .article-paywall {
    margin: 1.25rem 1rem;
    border-radius: var(--radius-lg, 14px);
  }

  .article-paywall .paywall-header-strip {
    padding: 0.625rem 1.125rem;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
  }

  .article-paywall .paywall-body {
    padding: 1.375rem 1.25rem 1.625rem;
  }

  .article-paywall .paywall-cover {
    max-height: 200px;
    margin-bottom: 1.125rem;
  }

  .article-paywall h1 {
    font-size: 1.4375rem;
  }

  .article-paywall .paywall-excerpt {
    font-size: 0.9875rem;
    margin-bottom: 1.25rem;
  }

  .article-paywall .paywall-cta {
    padding: 1.125rem 1.125rem 1.25rem;
  }

  .article-paywall .paywall-cta-title {
    font-size: 1.0625rem;
  }

  .article-paywall .paywall-cta-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .article-paywall .paywall-btn {
    width: 100%;
    padding: 0.8125rem 1rem;
  }
}

/* ─── Exam CTA section (end of article) ──────────────────────────────────── */

.article-exam-cta {
  background: linear-gradient(135deg, #fff8ee 0%, #fff 60%);
  border-radius: 12px;
  border: 1px solid #e8ecf0;
  border-top: 3px solid #6366f1;
  padding: 2rem;
  margin-top: 2.5rem;
}

.exam-cta-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.exam-cta-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.exam-cta-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.exam-cta-title {
  font-size: 1.125rem;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.015em;
  margin: 0;
}

.exam-cta-subtitle {
  font-size: 0.875rem;
  color: var(--text-tertiary, #6b7280);
  margin: 0;
  padding-left: 2.75rem;
}

.exam-cta-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.exam-cta-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  cursor: pointer;
}

.exam-cta-card:hover {
  border-color: #6366f1;
  background: #fffbf5;
  box-shadow: 0 2px 12px rgba(99,102,241,0.12);
}

.exam-cta-card:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.exam-cta-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.exam-cta-card-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.exam-cta-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a2e;
}

.exam-cta-card-arrow {
  font-size: 1.1rem;
  color: #6366f1;
  font-weight: 700;
  transition: transform 0.15s;
}

.exam-cta-card:hover .exam-cta-card-arrow {
  transform: translateX(3px);
}

/* ─── Sticky exam bar ────────────────────────────────────────────────────── */

.article-sticky-exam-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: #1a1a2e;
  color: #fff;
  padding: 0.875rem 1.5rem;
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
}

.article-sticky-exam-bar.is-visible {
  display: flex;
}

.sticky-exam-bar-text {
  font-size: 0.875rem;
  opacity: 0.9;
}

.sticky-exam-bar-text strong {
  color: #6366f1;
}

.sticky-exam-bar-actions {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  align-items: center;
}

.sticky-exam-bar-btn {
  padding: 0.5rem 1.25rem;
  background: #6366f1;
  color: #1a1a2e;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.sticky-exam-bar-btn:hover {
  opacity: 0.9;
}

.sticky-exam-bar-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sticky-exam-bar-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.sticky-exam-bar-dismiss:hover {
  color: #fff;
}

.sticky-exam-bar-dismiss:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .sticky-exam-bar-text {
    display: none;
  }

  .sticky-exam-bar-actions {
    width: 100%;
  }

  .sticky-exam-bar-btn {
    flex: 1;
    text-align: center;
  }
}

@media print {
  .article-exam-cta,
  .article-sticky-exam-bar {
    display: none !important;
  }
}
