/* ============================================
   The AI Tribune — Shared Stylesheet
   ============================================ */

:root {
  --cream: #f5f0e8;
  --paper: #faf7f0;
  --ink: #1a1a1a;
  --ink-light: #3d3d3d;
  --ink-faded: #6b6b6b;
  --rule: #2a2a2a;
  --rule-light: #c4bfb3;
  --accent: #8b0000;
  --accent2: #1a3a5c;
  --gold: #b8860b;
  --highlight: #fff8dc;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Lora', 'Georgia', serif;
  background: #e8e3d8;
  color: var(--ink);
  line-height: 1.7;
}

/* ====== TOP NAV ====== */
.top-nav {
  background: #3a3a3a;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 48px;
}
.nav-brand {
  font-family: 'UnifrakturMaguntia', 'Playfair Display', serif;
  font-size: 22px;
  color: var(--paper);
  text-decoration: none;
  direction: ltr;
}
.nav-sponsor {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  direction: ltr;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.nav-sponsor:hover { opacity: 1; }
.nav-sponsor img {
  height: 28px;
  width: auto;
}
.nav-sponsor-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #666;
  white-space: nowrap;
}
.nav-links {
  display: flex;
  gap: 0;
  align-items: center;
}
.nav-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #b8b0a0;
  text-decoration: none;
  padding: 14px 14px;
  transition: color 0.2s, background 0.2s;
  border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--paper); background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--gold); border-bottom-color: var(--gold); }
.nav-auth {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 6px 14px;
  border: 1px solid #555;
  background: transparent;
  color: #b8b0a0;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.nav-btn:hover { border-color: var(--gold); color: var(--paper); }
.nav-btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
  font-weight: 600;
}
.nav-btn.primary:hover { background: #d4a017; }
.nav-user-menu { position: relative; }
.nav-user-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--gold);
  cursor: pointer;
  padding: 6px 12px;
}

/* ====== NEWSPAPER CONTAINER ====== */
.newspaper {
  max-width: 1100px;
  margin: 20px auto;
  background: var(--paper);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
  position: relative;
}
.newspaper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

/* ====== MASTHEAD ====== */
.masthead {
  text-align: center;
  padding: 20px 40px 0;
  border-bottom: 4px double var(--rule);
  position: relative;
}
.masthead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--ink-faded);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-light);
  font-family: 'IBM Plex Mono', monospace;
  direction: ltr;
}
.masthead-title {
  font-family: 'UnifrakturMaguntia', 'Playfair Display', serif;
  font-size: 72px;
  letter-spacing: 2px;
  line-height: 1.1;
  padding: 16px 0 8px;
  color: var(--ink);
  direction: ltr;
  text-align: center;
}
.masthead-subtitle {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--ink-faded);
  padding-bottom: 12px;
  direction: ltr;
}
.masthead-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-faded);
  padding: 8px 0;
  border-top: 1px solid var(--rule-light);
  font-family: 'IBM Plex Mono', monospace;
}

/* ====== SECTION DIVIDERS ====== */
.section-rule { border: none; border-top: 2px solid var(--rule); margin: 0; }
.section-rule.thin { border-top: 1px solid var(--rule-light); }
.section-rule.double { border-top: 4px double var(--rule); }

/* ====== CONTENT ====== */
.content { padding: 0 40px 40px; }

/* ====== LEAD STORY ====== */
.lead-story {
  text-align: center;
  padding: 28px 0 20px;
  border-bottom: 2px solid var(--rule);
}
.lead-headline {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--ink);
}
.lead-headline a { color: inherit; text-decoration: none; }
.lead-headline a:hover { color: var(--accent); }
.lead-subheadline {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 400;
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 14px;
}
.lead-body {
  max-width: 680px;
  margin: 0 auto;
  font-size: 16px;
  text-align: justify;
  color: var(--ink-light);
  column-count: 2;
  column-gap: 30px;
  column-rule: 1px solid var(--rule-light);
}
.lead-body .dropcap {
  float: right;
  font-family: 'Playfair Display', serif;
  font-size: 58px;
  line-height: 0.85;
  padding: 0 0 4px 10px;
  font-weight: 900;
  color: var(--accent);
}

/* ====== SECTION HEADERS ====== */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--rule-light);
  margin-bottom: 16px;
}
.section-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 700;
  white-space: nowrap;
}
.section-header .line { flex: 1; height: 1px; background: var(--rule-light); }
.section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--accent);
  background: var(--paper);
  padding: 2px 8px;
  border: 1px solid var(--accent);
}

/* ====== GRID LAYOUTS ====== */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.cols-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0; }
.cols-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 0; }
.cols-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 0; }
.col {
  padding: 0 16px;
  border-left: 1px solid var(--rule-light);
}
.col:last-child { border-left: none; }
.col:first-child { padding-right: 16px; padding-left: 0; }

/* ====== ARTICLE CARD GRID (index page) ====== */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 20px 0;
}
.article-card {
  background: var(--paper);
  border: 1px solid var(--rule-light);
  padding: 20px;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
}
.article-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}
.article-card .cat-tag {
  position: absolute;
  top: 12px;
  left: 12px;
}
.article-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}
.article-card-title a {
  color: var(--ink);
  text-decoration: none;
}
.article-card-title a:hover { color: var(--accent); }
.article-card-excerpt {
  font-size: 14px;
  color: var(--ink-light);
  line-height: 1.6;
  margin-bottom: 12px;
}
.article-card-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-faded);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ====== ARTICLES (within page) ====== */
.article { margin-bottom: 20px; }
.article-headline {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
}
.article-headline.large { font-size: 24px; }
.article-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--ink-faded);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.article-body {
  font-size: 14px;
  text-align: justify;
  color: var(--ink-light);
  line-height: 1.65;
}
.article-body p { margin-bottom: 8px; }

/* ====== FULL ARTICLE PAGE ====== */
.article-full { padding: 32px 0; }
.article-full .article-headline {
  font-size: 36px;
  text-align: center;
  margin-bottom: 12px;
}
.article-full .article-meta {
  text-align: center;
  margin-bottom: 20px;
  font-size: 12px;
}
.article-full .article-body {
  max-width: 720px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.8;
  column-count: 2;
  column-gap: 30px;
  column-rule: 1px solid var(--rule-light);
}

/* ====== REPO ITEMS ====== */
.repo-item {
  padding: 12px 0;
  border-bottom: 1px dotted var(--rule-light);
}
.repo-item:last-child { border-bottom: none; }
.repo-name-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--accent2);
  text-decoration: none;
  font-weight: 500;
  direction: ltr;
  unicode-bidi: embed;
}
.repo-name-link:hover { text-decoration: underline; }
.repo-desc-text {
  font-size: 13px;
  color: var(--ink-light);
  margin: 4px 0;
  direction: ltr;
  unicode-bidi: embed;
}
.repo-relevance { font-size: 12px; color: var(--ink-faded); font-style: italic; }
.repo-stats {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-faded);
  direction: ltr;
  unicode-bidi: embed;
}
.repo-stars { color: var(--gold); font-weight: 500; }
.stars-badge {
  display: inline-block;
  background: var(--highlight);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  font-family: 'IBM Plex Mono', monospace;
  direction: ltr;
}
.relevance-pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rule-light);
  display: inline-block;
}
.pip.filled { background: var(--accent); }
.company-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1px 5px;
  border: 1px solid var(--rule-light);
  color: var(--ink-faded);
  margin-left: 4px;
}
.cat-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 1px 5px;
  background: var(--ink);
  color: var(--paper);
  margin-left: 4px;
}

/* ====== SIDEBAR ====== */
.sidebar-box {
  background: var(--cream);
  border: 1px solid var(--rule-light);
  padding: 16px;
  margin-bottom: 16px;
}
.sidebar-box h3 {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule-light);
}
.sidebar-box ul { list-style: none; padding: 0; }
.sidebar-box li {
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--rule-light);
  color: var(--ink-light);
}
.sidebar-box li:last-child { border-bottom: none; }

/* ====== STATS ====== */
.stat-highlight {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--ink-faded); }

/* ====== PULL QUOTE ====== */
.pull-quote {
  border-right: 3px solid var(--accent);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 16px 0;
  text-align: center;
}
.pull-quote p {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-style: italic;
  color: var(--ink-light);
  line-height: 1.5;
}
.pull-quote cite {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-faded);
  margin-top: 8px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ====== TABS ====== */
.section-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 16px;
}
.section-tab {
  font-family: 'Playfair Display', serif;
  font-size: 13px;
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--ink-faded);
  transition: all 0.2s;
}
.section-tab:hover { color: var(--ink); }
.section-tab.active {
  background: var(--paper);
  border-color: var(--rule);
  border-bottom: 2px solid var(--paper);
  margin-bottom: -2px;
  color: var(--ink);
  font-weight: 700;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ====== SHARE BUTTONS ====== */
.share-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--rule-light);
  border-bottom: 1px solid var(--rule-light);
  margin: 20px 0;
}
.share-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-faded);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule-light);
  background: transparent;
  color: var(--ink-faded);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  text-decoration: none;
}
.share-btn:hover { border-color: var(--ink); color: var(--ink); background: var(--cream); }
.share-btn.linkedin:hover { color: #0077b5; border-color: #0077b5; }
.share-btn.twitter:hover { color: #1da1f2; border-color: #1da1f2; }
.share-btn.facebook:hover { color: #1877f2; border-color: #1877f2; }
.share-btn.whatsapp:hover { color: #25d366; border-color: #25d366; }
.share-btn.email:hover { color: var(--gold); border-color: var(--gold); }
.share-btn.copy:hover { color: var(--accent); border-color: var(--accent); }

/* ====== SAVE ARTICLE BUTTON ====== */
.save-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 6px 14px;
  border: 1px solid var(--rule-light);
  background: transparent;
  color: var(--ink-faded);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.save-btn:hover { border-color: var(--gold); color: var(--gold); }
.save-btn.saved { background: var(--highlight); border-color: var(--gold); color: var(--gold); }

/* ====== NEWSLETTER SIGNUP ====== */
.newsletter-banner {
  background: var(--ink);
  color: var(--paper);
  padding: 32px 40px;
  text-align: center;
  position: relative;
}
.newsletter-banner h3 {
  font-family: 'UnifrakturMaguntia', 'Playfair Display', serif;
  font-size: 32px;
  margin-bottom: 6px;
  direction: ltr;
}
.newsletter-banner .tagline {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-style: italic;
  color: #b8b0a0;
  margin-bottom: 20px;
}
.newsletter-form-enhanced {
  max-width: 520px;
  margin: 0 auto;
  text-align: right;
}
.newsletter-form-enhanced input[type="email"] {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  padding: 12px 16px;
  border: 2px solid #555;
  background: #2a2a2a;
  color: var(--paper);
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  direction: ltr;
}
.newsletter-form-enhanced input[type="email"]:focus { border-color: var(--gold); }
.newsletter-form-enhanced input[type="email"]::placeholder { color: #777; }
.form-section {
  margin-top: 16px;
  direction: rtl;
}
.form-label {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  color: #b8b0a0;
  margin-bottom: 8px;
}
.radio-group, .checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.radio-option, .checkbox-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #ccc;
}
.radio-option input, .checkbox-option input {
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.newsletter-form-enhanced button {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 32px;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--gold);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s;
  width: 100%;
  margin-top: 20px;
}
.newsletter-form-enhanced button:hover { background: #d4a017; border-color: #d4a017; }
.newsletter-form-enhanced button:disabled { opacity: 0.6; cursor: not-allowed; }
.newsletter-note {
  font-size: 11px;
  color: #777;
  margin-top: 12px;
  font-family: 'IBM Plex Mono', monospace;
}
.newsletter-msg {
  color: var(--gold);
  margin-top: 8px;
  font-size: 13px;
  display: none;
}
.newsletter-error {
  color: #e74c3c;
  margin-top: 8px;
  font-size: 13px;
  display: none;
}

/* ====== FOOTER ====== */
.footer-bar {
  text-align: center;
  padding: 20px 40px;
  border-top: 4px double var(--rule);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--cream);
  background: #3a3a3a;
}

/* ====== AUTH FORMS ====== */
.auth-container {
  max-width: 440px;
  margin: 40px auto;
  padding: 40px;
  background: var(--paper);
  border: 1px solid var(--rule-light);
}
.auth-container h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  text-align: center;
  margin-bottom: 24px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-faded);
  margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--rule-light);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--gold); }
.btn-primary {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 24px;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--gold);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.2s;
  width: 100%;
}
.btn-primary:hover { background: #d4a017; border-color: #d4a017; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-link {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-faded);
}
.auth-link a { color: var(--gold); }
.auth-message {
  padding: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  text-align: center;
  display: none;
}
.auth-message.error { background: #ffeaea; color: #c0392b; border: 1px solid #e74c3c; display: block; }
.auth-message.success { background: var(--highlight); color: var(--gold); border: 1px solid var(--gold); display: block; }

/* ====== PROFILE PAGE ====== */
.profile-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule-light);
}
.profile-section:last-child { border-bottom: none; }
.profile-section h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  margin-bottom: 16px;
}
.saved-article-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dotted var(--rule-light);
}
.saved-article-item:last-child { border-bottom: none; }
.saved-article-title {
  font-size: 14px;
  color: var(--ink);
}
.saved-article-title a { color: var(--ink); text-decoration: none; }
.saved-article-title a:hover { color: var(--accent); }
.saved-article-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-faded);
}
.remove-saved {
  font-size: 11px;
  color: var(--ink-faded);
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'IBM Plex Mono', monospace;
}
.remove-saved:hover { color: var(--accent); }

/* ====== RELATED ARTICLES ====== */
.related-articles {
  padding: 24px 0;
}
.related-articles h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-light);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .newspaper { margin: 0; }
  .content { padding: 0 16px 24px; }
  .masthead { padding: 12px 16px 0; }
  .masthead-title { font-size: 42px; }
  .lead-headline { font-size: 28px; }
  .lead-body { column-count: 1; }
  .cols-2, .cols-3, .cols-2-1, .cols-1-2 { grid-template-columns: 1fr; }
  .col {
    border-left: none;
    padding: 0;
    border-bottom: 1px solid var(--rule-light);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .col:last-child { border-bottom: none; }
  .section-tabs { flex-wrap: wrap; }
  .article-grid { grid-template-columns: 1fr; }
  .article-full .article-body { column-count: 1; }
  .top-nav-inner { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; }
  .nav-links { flex-wrap: wrap; }
  .share-bar { flex-wrap: wrap; }
  .newsletter-banner { padding: 24px 16px; }
}
@media (max-width: 480px) {
  .nav-link { padding: 8px 8px; font-size: 10px; }
  .masthead-title { font-size: 32px; }
}

/* ====== Source Attribution ====== */
.article-source {
  margin-top: 32px;
  padding: 16px 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-faded);
  direction: ltr;
  text-align: left;
}
.article-source .source-label {
  direction: rtl;
  unicode-bidi: isolate;
  font-weight: 600;
  color: var(--ink-light);
  margin-left: 6px;
}
.article-source a {
  color: var(--accent);
  text-decoration: none;
}
.article-source a:hover {
  text-decoration: underline;
}
.article-source .source-site {
  color: var(--ink-faded);
  font-size: 0.8rem;
}

/* ====== GitHub Trending List ====== */
.github-trending-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.trending-repo {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule-light);
}
.trending-repo:last-child {
  border-bottom: none;
}
.trending-repo-rank {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-faded);
  min-width: 28px;
  text-align: center;
  padding-top: 2px;
}
.trending-repo-info {
  flex: 1;
}
.trending-repo-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  direction: ltr;
  unicode-bidi: isolate;
}
.trending-repo-name:hover {
  text-decoration: underline;
}
.trending-repo-desc {
  font-size: 13px;
  color: var(--ink-light);
  margin: 4px 0;
  direction: ltr;
  unicode-bidi: isolate;
}
.trending-repo-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  direction: ltr;
}
.lang-badge {
  font-size: 11px;
  color: var(--ink-faded);
  font-family: 'IBM Plex Mono', monospace;
}

/* ============================================
   ARTICLE VIDEO EMBED (YouTube — social-media sized)
   ============================================ */
.article-video-embed {
  max-width: 480px;
  margin: 0 auto 20px;
  border: 1px solid var(--rule-light);
  background: var(--ink);
}
.video-embed-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
}
.video-embed-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Video share bar */
.video-share-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #2a2a2a;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
}
.video-share-label {
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.video-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.video-share-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.video-share-btn.video-share-yt {
  color: #ff0000;
}
.video-share-btn.video-share-yt:hover {
  background: rgba(255,0,0,0.15);
  color: #ff2020;
}

/* Legacy hero-media-credit (still used by hero images) */
.hero-media-credit {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  z-index: 3;
  direction: ltr;
  text-align: right;
}
.hero-media-credit a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}
.hero-media-credit a:hover { text-decoration: underline; }

/* ============================================
   AI TOOLS DAILY — LIKE + GITHUB
   ============================================ */
.ai-tools-daily h3 {
  margin-bottom: 12px;
}
.ai-tool-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-light);
}
.ai-tool-item:last-of-type {
  border-bottom: none;
}
.ai-tool-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-tool-github {
  color: var(--ink-faded);
  transition: color 0.2s;
  flex-shrink: 0;
}
.ai-tool-github:hover {
  color: var(--ink);
}
.ai-tool-desc {
  font-size: 13px;
  color: var(--ink-light);
  margin: 2px 0 4px;
}
.ai-tool-like {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--rule-light);
  border-radius: 14px;
  padding: 3px 10px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-faded);
  cursor: pointer;
  transition: all 0.2s;
}
.ai-tool-like:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ai-tool-like.liked {
  background: rgba(139,0,0,0.08);
  border-color: var(--accent);
  color: var(--accent);
}
.ai-tool-like.liked svg {
  fill: var(--accent);
}
.like-count {
  font-size: 11px;
}

/* ============================================
   HERO IMAGE
   ============================================ */
.hero-image-container {
  position: relative;
  max-height: 400px;
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--rule-light);
}
.hero-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  max-height: 400px;
  filter: sepia(0.1) contrast(1.02);
  transition: filter 0.4s ease;
}
.hero-image-container:hover .hero-image {
  filter: none;
}
.hero-image-container .hero-media-credit {
  color: rgba(0,0,0,0.5);
  background: rgba(255,255,255,0.7);
  padding: 2px 8px;
  bottom: 0;
  right: 0;
}
.hero-image-container .hero-media-credit a {
  color: rgba(0,0,0,0.7);
}

/* ============================================
   CARD IMAGES
   ============================================ */
.card-image-wrap {
  height: 180px;
  overflow: hidden;
  margin: -20px -20px 12px;
  position: relative;
}
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.1);
  transition: filter 0.3s ease, transform 0.3s ease;
}
.article-card:hover .card-image {
  filter: none;
  transform: scale(1.03);
}
.article-card:has(.card-image-wrap) .cat-tag {
  top: auto;
  bottom: calc(100% - 180px + 8px);
  z-index: 2;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children in article grid */
.article-grid .article-card.fade-in-up:nth-child(2) { transition-delay: 0.1s; }
.article-grid .article-card.fade-in-up:nth-child(3) { transition-delay: 0.2s; }
.article-grid .article-card.fade-in-up:nth-child(4) { transition-delay: 0.3s; }

/* Pull quote hover */
.pull-quote {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.pull-quote:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ============================================
   RESPONSIVE — MEDIA
   ============================================ */
@media (max-width: 768px) {
  .article-video-embed { max-width: 100%; }
  .hero-image-container { max-height: 240px; }
  .hero-image { max-height: 240px; }
  .card-image-wrap { height: 140px; }
  .fade-in-up { transform: translateY(12px); }
}
