/* ======================================================================
   SUBJECT LEVEL STYLES (EXTENDS main-page.css)
   Optimized for Articles, SEO & Readability
   ====================================================================== */


/* ==================================================
   PAGE HEADING (Hub Pages)
   ================================================== */

.page-heading {
  padding: 4.5rem 1rem 3rem;
  text-align: center;
}

.page-heading h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-heading .subtitle {
  margin-top: 0.75rem;
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin-inline: auto;
}


/* ==================================================
   GRID & CARDS (Hub Page)
   ================================================== */

.learning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
}

.learning-grid:empty::before {
  content: "Engineering articles coming soon…";
  grid-column: 1 / -1;
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 4rem 1rem;
  border: 1px dashed var(--border-soft);
  border-radius: 12px;
}

.os-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-blue);
  background: rgba(0, 122, 255, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  width: fit-content;
}

.os-article-card{
  display:block;
  border-radius:18px;
  overflow:hidden;
  background:linear-gradient(180deg,#0a1020,#060b18);
  border:1px solid rgba(255,255,255,0.08);
  text-decoration:none;
  color:inherit;
  padding:0;
  cursor:pointer;
  transition:all .25s ease;
}


.os-article-card:hover {
  border-color: #4aa3ff;
  box-shadow:0 10px 30px rgba(0,0,0,0.45);
  transform:translateY(-4px);
}
.os-article-card:hover .card-title{
  color:#4aa3ff;
}

.card-title{
  margin:0 0 10px;
  font-size:1.15rem;
  font-weight:700;
  line-height:1.5;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.card-image{
  width:100%;
  height:190px;
  object-fit:cover;
  object-position: top; /* shows top part of image */
  display:block;
  border-radius:18px 18px 0 0;
}
.card-desc{
  margin:0 0 10px;
  font-size:0.95rem;
  color:var(--text-secondary);
  line-height:1.5;
}


.card-content{
  padding:18px 18px 20px;
}


.read-more {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-blue);
}




/* ==================================================
   HEADER / BREADCRUMB
   ================================================== */

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
}

.breadcrumb-link {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff !important;
  text-decoration: none;
}


/* ==================================================
   ARTICLE READING LAYOUT (Wiley-like)
   ================================================== */

.article-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.article-title h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-bottom: 0.5rem;
}

.article-meta {
  color: #6b7280;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}


/* ==================================================
   TYPOGRAPHY RHYTHM
   ================================================== */

.article-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #1a1a1a;
}
body.article-dark-mode .article-text {
  color: #e5e7eb;
}
.article-text > p:first-of-type {
  font-size: 1.08rem;
}

/* =========================
   ARTICLE IMAGES
   ========================= */

.article-image {
  width: 100%;
  max-width: 820px;
  display: block;
  margin: 2rem auto;
  border-radius: 10px;
}

/* Dark mode image comfort */
body.article-dark-mode .article-image {
  background: #020617;
  padding: 0.5rem;
}
figure {
  margin: 2.5rem 0;
}

figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
  margin-top: 0.6rem;
}

body.article-dark-mode figcaption {
  color: #9ca3af;
}
.image-note {
  font-size: 0.9rem;
  color: #6b7280;
  text-align: center;
  margin-top: -0.5rem;
}

body.article-dark-mode .image-note {
  color: #9ca3af;
}
figcaption,
.image-note {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}


.article-text ul,
.article-text ol {
  margin: 0.6rem 0 1.2rem 1.4rem;
}

.article-text li {
  margin: 0.3rem 0;
}


/* ==================================================
   HEADINGS (Academic, Clean)
   ================================================== */

.article-text h2 {
  font-size: 1.6rem;
  margin: 3rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #e5e7eb;
}

.article-text h3 {
  font-size: 1.25rem;
  margin: 2.2rem 0 0.8rem;
}

.article-text h4 {
  font-size: 1.1rem;
  margin: 1.6rem 0 0.6rem;
}
/* Strong text inside headings */
.article-text h3 strong,
.article-text h2 strong {
  font-weight: 700;
}

/* Tighten spacing between headings and content */
.article-text h2 + p,
.article-text h2 + ul,
.article-text h2 + ol {
  margin-top: 0.6rem;
}

.article-text h3 + p,
.article-text h3 + ul,
.article-text h3 + ol {
  margin-top: 0.5rem;
}

/* Offset anchor scroll for fixed header */
.article-text h2,
.article-text h3 {
  scroll-margin-top: 90px;
}


/* ==================================================
   PARAGRAPH SPACING (Reading Rhythm)
   ================================================== */

.article-text p {
  margin: 0.8rem 0;
}
/* ==================================================
   LINKS (Readable, SEO Safe)
   ================================================== */

.article-text a {
  color: #1a73e8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-text a:hover {
  color: #174ea6;
}


/* ==================================================
   TABLE OF CONTENTS
   ================================================== */

.article-text h2 + ol {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

.article-text h2 + ol li {
  margin: 0.4rem 0;
}

.article-text h2 + ol a {
  text-decoration: none;
  font-weight: 500;
  color: #1a73e8;
}

.article-text h2 + ol a:hover {
  text-decoration: underline;
}
/* Dark mode – Table of Contents */
body.article-dark-mode .article-text h2 + ol {
  background: #020617;
  border-color: #1f2937;
}

body.article-dark-mode .article-text h2 + ol a {
  color: #8ab4f8;
}


/* ==================================================
   TABLES (Clean Academic Look)
   ================================================== */

.article-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.article-text th {
  background: #f3f4f6;
  font-weight: 600;
}

.article-text th,
.article-text td {
  padding: 0.6rem 0.75rem;
  border: 1px solid #e5e7eb;
}

/* --- FIXED DARK MODE TABLE STYLES --- */

/* 1. Ensure the base table rows and cells have a dark background */
body.article-dark-mode .article-text table td {
    background-color: #0f172a; /* Dark navy */
    color: #e5e7eb;            /* Light grey text */
    border: 1px solid #334155;
}

/* 2. Fix the "Feature" (First) Column specifically */
body.article-dark-mode .article-text table td:first-child,
body.article-dark-mode .article-text table th:first-child {
    background-color: #1e293b !important; /* Slightly lighter navy to stand out */
    color: #ffffff !important;            /* Pure white text */
    font-weight: 700 !important;
    border-right: 2px solid #3b82f6;      /* Optional: adds a blue line to separate it */
}

/* 3. Fix the Top Header Row */
body.article-dark-mode .article-text th {
    background-color: #1e293b;
    color: #8ab4f8; /* Light blue for headers */
    font-weight: 700;
}

/* ==================================================
   THEME SUPPORT
   ================================================== */

body.article-light-mode {
  background-color: #ffffff;
  color: #000;
}

body.article-dark-mode {
  background-color: #0e1629;
  color: #ffffff;
}

.article-dark-mode .article-text {
  color: #e5e7eb;
}

.article-dark-mode .article-text a {
  color: #8ab4f8;
}


/* ==================================================
   FOOTER
   ================================================== */

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 5%;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-links a {
  margin-left: 15px;
  text-decoration: none;
  font-size: 0.9rem;
}


/* ==================================================
   MOBILE OPTIMIZATION
   ================================================== */

@media (max-width: 768px) {

  .article-container {
    padding: 0 1rem 3rem;
  }

  .article-text {
    font-size: 1rem;
    line-height: 1.75;
  }

  .article-text h2 {
    font-size: 1.4rem;
  }

  .article-text h3 {
    font-size: 1.15rem;
  }

  .breadcrumb-link {
    font-size: 1.1rem;
  }
  .article-text p {
    margin: 0.7rem 0;
  }

  .article-text ul,
  .article-text ol {
    margin-left: 1.2rem;
  }
}
@media (max-width: 640px) {

  .os-article-card {
    display: block;
    padding: 0;
  }

  .card-image {
    width: 100%;
    object-fit: cover;
    border-radius: 18px 18px 0 0;
    margin-bottom: 0;
  }

  .card-content{
    padding:16px 18px 20px;
  }

}