/* ==========================================================================
   MATHSWITHAMAL.COM - ARTICLES & MATHEMATICS NOTES CSS STYLESHEET
   Apple-Inspired AEO & SEO Optimized Editorial & Hub System
   ========================================================================== */

/* --- HUB & ARTICLE PAGE HEADER CLEARANCE --- */
.article-page-header {
  padding-top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 1.5rem);
  padding-bottom: 2rem;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  border-bottom: 1px solid var(--border-glass);
}

/* --- BREADCRUMBS --- */
.article-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.article-breadcrumbs a {
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.article-breadcrumbs a:hover {
  text-decoration: underline;
}

.article-breadcrumbs .separator {
  color: #CBD5E1;
  font-size: 0.75rem;
}

.article-breadcrumbs .current-crumb {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* --- ARTICLE HEADER TYPOGRAPHY --- */
.article-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-blue);
  background: rgba(30, 64, 175, 0.08);
  padding: 0.35rem 0.85rem;
  border-radius: var(--border-radius-full);
  margin-bottom: 1rem;
}

.article-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  padding-bottom: 1rem;
}

.article-author-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

.article-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
}

/* --- AEO DIRECT ANSWER SNIPPET BOX --- */
.aeo-direct-answer-box {
  background: #F0F7FF;
  border-left: 4px solid var(--primary-blue);
  border-radius: 0 16px 16px 0;
  padding: 1.5rem 1.75rem;
  margin: 1.75rem 0 2.25rem 0;
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.05);
}

.aeo-direct-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-blue);
  background: #FFFFFF;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  margin-bottom: 0.65rem;
  border: 1px solid rgba(30, 64, 175, 0.15);
}

.aeo-direct-answer-box p {
  font-size: 1.08rem;
  line-height: 1.68;
  color: var(--text-primary);
  margin: 0;
  font-weight: 500;
}

/* --- ARTICLE TWO-COLUMN LAYOUT --- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }
}

/* --- ARTICLE BODY CONTENT STYLING --- */
.article-body {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.75;
}

.article-body h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 3vw, 1.95rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 2.75rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.article-body h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.75rem 0 0.75rem 0;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

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

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

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body strong {
  color: var(--text-primary);
}

/* --- SUBSECTION DIRECT ANSWER (AEO SNIPPET ANCHOR) --- */
.subheading-direct-answer {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-teal);
  padding: 0.85rem 1.15rem;
  border-radius: 0 10px 10px 0;
  margin-bottom: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.02rem;
  line-height: 1.62;
}

/* --- WORKED EXAMPLE / STEP-BY-STEP BOX --- */
.worked-example-box {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--border-radius-sm);
  padding: 1.5rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow-sm);
}

.worked-example-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary-blue);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #CBD5E1;
}

.math-step {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #F1F5F9;
}

.math-step:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 0.82rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.step-content {
  flex: 1;
}

.math-formula {
  font-family: var(--font-math);
  background: #F8FAFC;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  font-size: 0.95rem;
  display: inline-block;
  margin: 0.2rem 0;
}

.math-formula-block {
  font-family: var(--font-math);
  background: #F8FAFC;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  font-size: 1.05rem;
  text-align: center;
  margin: 1rem 0;
  overflow-x: auto;
}

/* --- COMPARISON TABLE --- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.75rem 0;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
  background: #FFFFFF;
}

.comparison-table th {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 700;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--border-glass);
}

.comparison-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.comparison-table tr:hover {
  background: rgba(248, 250, 252, 0.7);
}

/* --- CALLOUT & TEACHING TIP BOX --- */
.teaching-tip-box {
  background: rgba(13, 148, 136, 0.06);
  border-left: 4px solid var(--accent-teal);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}

.teaching-tip-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--accent-teal);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

/* --- FAQ SECTION ON ARTICLES --- */
.article-faq-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-glass);
}

.article-faq-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.article-faq-item {
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  background: #FFFFFF;
  margin-bottom: 1rem;
  overflow: hidden;
  transition: all var(--transition-fast);
}

.article-faq-item:hover {
  border-color: rgba(30, 64, 175, 0.25);
  box-shadow: var(--shadow-sm);
}

.article-faq-q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.35rem;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  cursor: pointer;
  gap: 1rem;
}

.article-faq-a {
  padding: 0 1.35rem 1.25rem 1.35rem;
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.68;
}

/* --- ARTICLE CONCLUSION & CTA BOX --- */
.article-cta-box {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.05) 0%, rgba(13, 148, 136, 0.05) 100%);
  border: 1px solid rgba(30, 64, 175, 0.15);
  border-radius: var(--border-radius-md);
  padding: 2.25rem 2rem;
  margin: 3rem 0;
  text-align: center;
}

.article-cta-box h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.article-cta-box p {
  color: var(--text-secondary);
  font-size: 1.02rem;
  max-width: 620px;
  margin: 0 auto 1.5rem auto;
  line-height: 1.65;
}

.article-cta-btn-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --- SIDEBAR STYLING --- */
.article-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.sidebar-widget {
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Table of Contents */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.toc-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.toc-link:hover {
  background: var(--bg-surface);
  color: var(--primary-blue);
  padding-left: 0.85rem;
}

/* Author Widget */
.sidebar-author {
  text-align: center;
}

.sidebar-author-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 0.75rem auto;
  border: 3px solid var(--accent-gold);
}

.sidebar-author-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.sidebar-author-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* --- HUB PAGE SPECIFIC STYLES --- */
.hub-hero {
  padding-top: calc(var(--header-height) + 2rem);
  padding-bottom: 3rem;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  text-align: center;
  border-bottom: 1px solid var(--border-glass);
}

.hub-headline {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

.hub-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 2rem auto;
  line-height: 1.6;
}

.hub-filter-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 3rem;
}

.hub-filter-btn {
  padding: 0.55rem 1.15rem;
  border-radius: var(--border-radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.hub-filter-btn:hover,
.hub-filter-btn.active {
  background: var(--primary-blue);
  color: #FFFFFF;
  border-color: var(--primary-blue);
}

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

.article-card {
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.article-card:hover {
  transform: translateY(-6px);
  border-color: rgba(30, 64, 175, 0.3);
  box-shadow: var(--shadow-md);
}

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

.article-card-tag {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-blue);
  margin-bottom: 0.65rem;
}

.article-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.article-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex: 1;
}

.article-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid #F1F5F9;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.article-card-link {
  color: var(--primary-blue);
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: gap var(--transition-fast);
}

.article-card:hover .article-card-link {
  gap: 0.7rem;
}
