/* ==========================================================================
   WRITING TIPS - PINNY TEACHING STYLE BLOG / ARTICLE HUB
   Clean, modern, aesthetic educational article grid matching the user screenshot
   ========================================================================== */

:root {
  --primary-navy: #274760;
  --primary-hover: #1A3347;
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --bg-page: #FFFFFF;
  --bg-card: #FFFFFF;
  --card-border: #E8ECEF;
  --card-shadow: 0 6px 24px rgba(39, 71, 96, 0.07);
  --card-shadow-hover: 0 12px 32px rgba(39, 71, 96, 0.14);
  --tag-bg: #EEF4F8;
  --vermilion: #C83228;
  --radius-card: 20px;
  --radius-img: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-dark);
  background-color: var(--bg-page);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   NAVBAR (PINNY TEACHING STYLE)
   ========================================================================== */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 32px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: #FFF1D6;
  border: 1.5px solid #274760;
}

.brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--primary-navy);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--primary-navy);
}

.nav-links a.active {
  color: var(--primary-navy);
  font-weight: 700;
}

/* ==========================================================================
   PAGE CONTAINER & TITLE
   ========================================================================== */
.main-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 32px 80px;
}

.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2.4rem, 4.5vw, 3.2rem);
  font-weight: 800;
  color: var(--primary-navy);
  margin: 24px 0 36px;
  letter-spacing: -0.5px;
}

/* ==========================================================================
   ARTICLE GRID (3 COLUMNS)
   ========================================================================== */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.article-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--card-shadow-hover);
  border-color: #CBD5E1;
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-img);
  overflow: hidden;
  background: #E2E8F0;
  margin-bottom: 16px;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

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

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-bottom: 8px;
}

.card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-navy);
  background: var(--tag-bg);
  padding: 3px 10px;
  border-radius: 999px;
}

.card-read-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin: 0 4px 10px;
  line-height: 1.38;
}

.card-excerpt {
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.55;
  margin: 0 4px 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-read-more {
  margin-top: auto;
  padding: 0 4px 4px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary-navy);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-read-more span {
  transition: transform 0.2s ease;
}

.article-card:hover .card-read-more span {
  transform: translateX(4px);
}

/* ==========================================================================
   FULL ARTICLE READER VIEW (MODAL / OVERLAY)
   ========================================================================== */
.reader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding: 36px 16px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.reader-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.reader-modal {
  background: #FFF;
  width: min(860px, 100%);
  border-radius: 24px;
  padding: 40px 48px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  margin: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.reader-overlay.open .reader-modal {
  transform: translateY(0);
}

.reader-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #F1F5F9;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary-navy);
  cursor: pointer;
  margin-bottom: 24px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.reader-back-btn:hover {
  background: #E2E8F0;
  transform: translateX(-3px);
}

.reader-hero-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  object-fit: cover;
  margin-bottom: 24px;
}

.reader-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.reader-title {
  font-size: clamp(1.8rem, 3.2vw, 2.3rem);
  font-weight: 800;
  color: var(--primary-navy);
  line-height: 1.25;
  margin: 0 0 20px;
}

.reader-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #334155;
}

.reader-body h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-navy);
  margin: 32px 0 14px;
}

.reader-body p {
  margin: 0 0 18px;
}

/* Callout inside reader */
.reader-callout {
  background: #F8FAFC;
  border-left: 4px solid var(--primary-navy);
  border-radius: 0 12px 12px 0;
  padding: 16px 20px;
  margin: 24px 0;
}

.reader-callout.good {
  background: #F0FDF4;
  border-left-color: #16A34A;
}

.reader-callout.bad {
  background: #FEF2F2;
  border-left-color: #DC2626;
}

.reader-callout strong {
  display: block;
  margin-bottom: 6px;
  color: #0F172A;
}

/* Formula Box inside reader */
.reader-formula {
  background: #FFFBEB;
  border: 1.5px dashed #D97706;
  border-radius: 12px;
  padding: 14px 20px;
  margin: 20px 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #B45309;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Table inside reader */
.reader-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 20px 0;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
}

.reader-table th {
  background: #F8FAFC;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #E2E8F0;
  font-weight: 700;
  color: var(--primary-navy);
}

.reader-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #F1F5F9;
}

/* Copy button in reader */
.reader-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  margin: 2px 4px 2px 0;
  transition: all 0.15s ease;
}

.reader-copy-btn:hover {
  background: #DBEAFE;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }
  .site-nav {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  .nav-links {
    gap: 18px;
    flex-wrap: wrap;
  }
  .reader-modal {
    padding: 24px 20px;
  }
}
