/* web/style.css – Washington Post inspired */
@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@300;400;600;700&family=Playfair+Display:wght@700&display=swap');

body {
  font-family: 'Libre Franklin', system-ui, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  background: #f8f9fa;
  color: #111;
  line-height: 1.65;
}

h1 {
  font-family: 'Playfair Display', serif;
  font-size: 3.2rem;
  color: #0a1d37;
  margin-bottom: 0.5em;
  border-bottom: 3px solid #c8102e;
  padding-bottom: 0.3em;
}

/* header and hero styling inspired by WaPo */
.site-header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* navigation links smaller, uppercase */
.main-nav a {
  margin-left: 1.5rem;
  font-size: 0.85rem;
  color: #0a1d37;
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.main-nav a:hover {
  text-decoration: underline;
}

.logo {
  /* keep a container for the image; text styles not needed when using an img */
}
.logo img {
  max-height: 50px;
  width: auto;
  display: block;
}

.main-nav a {
  margin-left: 1.5rem;
  font-size: 0.95rem;
  color: #0a1d37;
  text-decoration: none;
  font-weight: 500;
}

.main-nav a:hover {
  text-decoration: underline;
}

/* hero removed per request */

/* header responsive stacking */
@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .main-nav {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
  }
  .main-nav a {
    margin: 0.5rem 0;
  }
  .logo img {
    width: 100%;
    max-height: none;
    height: auto;
  }
}

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  color: #0a1d37;
  margin: 2.5em 0 1em;
}

section {
  margin-bottom: 3rem;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  overflow: hidden;
}

.section-header h2 {
  font-family: 'Libre Franklin', system-ui, sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 2px solid #ddd;
  padding-bottom: 0.3rem;
  margin-bottom: 1.2rem;
  color: #0a1d37;
}

.news-section {
  border-left: 5px solid #c8102e;
}

.twitter-section {
  border-left: 5px solid #1da1f2;
  background: #f8f9ff;
}

.substack-section {
  border-left: 5px solid #ff6719;
}

.youtube-section {
  border-left: 5px solid #ff0000;
}

.reddit-section {
  border-left: 5px solid #ff4500;
}

.card-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

.card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #eee;
}

.card-content {
  padding: 1.4rem;
}

.card-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 0.8rem;
  line-height: 1.3;
}

.card-teaser {
  font-size: 1rem;
  color: #444;
  margin: 0 0 1rem;
}

.card-meta {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.8rem;
}

.read-more {
  color: #0a1d37;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid #c8102e;
  transition: all 0.2s;
}

.read-more:hover {
  color: #c8102e;
  border-color: transparent;
}

/* Embedded media */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 1.5rem 0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.embed-fallback {
  font-size: 0.9em;
  color: #666;
  text-align: center;
  margin-top: 0.5rem;
}

.tweets-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.twitter-tweet {
  border: 1px solid #e1e8ed;
  border-radius: 8px;
  padding: 1rem;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* New styles for grids */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

/* enforce two columns on YouTube section, collapse to one on narrow screens */
.youtube-section .items-grid {
  grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 600px) {
  .youtube-section .items-grid {
    grid-template-columns: 1fr;
  }
}

.item-card {
  background: white;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #e1e8ed;
}

.item-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  color: #0a1d37;
}

.item-teaser {
  font-size: 0.9rem;
  color: #444;
  margin: 0 0 1rem;
  line-height: 1.4;
}

.item-links {
  display: flex;
  gap: 0.5rem;
}

.item-link {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-block;
  max-width: calc(50% - 0.75rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* reddit-specific layout overrides */
.reddit-section .items-grid {
  display: block; /* stack each pair vertically */
}

.reddit-pair {
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: white; /* match rest of page */
  border: 1px solid #e1e8ed; /* neutral border like other cards */
  border-radius: 6px;
}

.reddit-pair .item-teaser {
  margin-bottom: 0.5rem;
  display: block;
  font-weight: 600; /* make story headline bold */
}

.reddit-pair .item-link {
  margin-right: 1rem;
  max-width: none;
  white-space: normal; /* allow wrapping on mobile */
  word-break: break-word;
  font-weight: normal; /* links should not be bold */
}

/* News item card */
.news-item {
  /* stack the thumbnail, main title, and paired title vertically */
  display: block;
  padding: 0.85rem;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbfbfd);
  border: 1px solid #eef1f4;
  /* left align for easier reading */
  text-align: left;
}

.news-thumb img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.news-content {
  margin-top: 0.75rem;
}

.news-title,
.news-paired a {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0a1d37;
  text-decoration: none;
}

.news-teaser {
  margin-top: 0.5rem;
  color: #444;
  line-height: 1.4;
}

.news-paired {
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.news-paired a {
  text-decoration: none;
}
.news-paired a:hover {
  text-decoration: underline;
}

.news-sources {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid #e6eef6;
}

.left-link.badge {
  background: #eaf6ff;
  color: #0b66b2;
}

.right-link.badge {
  background: #fff5f5;
  color: #b22f2f;
}

@media (max-width: 768px) {
  .news-item {
    flex-direction: column;
  }
  .news-thumb img {
    width: 100%;
    height: 200px;
  }
}

.left-link {
  background: #e3f2fd;
  color: #1976d2;
}

.left-link:hover {
  background: #1976d2;
  color: white;
}

.right-link {
  background: #ffebee;
  color: #d32f2f;
}

.right-link:hover {
  background: #d32f2f;
  color: white;
}

.tweets-grid {
  display: grid;
  /* limit to three columns on desktop */
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap: 0.6rem;
  margin: 1.2rem auto;
  max-width: calc(3 * 320px + 2 * 0.6rem);
}

/* smaller screens: two columns then single column */
@media (max-width: 992px) {
  .tweets-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}

@media (max-width: 600px) {
  .tweets-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }
}

.tweets-grid .small-tweet {
  background: white;
  border-radius: 5px;
  padding: 0.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  border: 1px solid #e1e8ed;
  font-size: 0.85rem;
}

.small-tweet {
  overflow: hidden;
}

.small-tweet .twitter-tweet {
  margin: 0;
  padding: 0.15rem;
  border: none;
  box-shadow: none;
  font-size: 0.8rem;
  width: 100% !important;
  max-width: 100% !important;
}

.small-tweet .twitter-tweet iframe {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

/* Pair layout: left/right tweet per story */
.tweet-pair {
  /* wrapper used for semantic pairing but removed from layout
     so grid counts its children directly. ensures max 4 tweets/row. */
  display: contents;
}

.tweet-side {
  /* still useful for targeting left/right if needed */
  min-width: 0; /* ensure the tweet can shrink within its grid cell */
}

.tweet-side.empty {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Collapsible extra tweets */
.tweets-grid .tweets-extra {
  display: none;
  grid-column: 1 / -1;
  gap: 1rem;
  margin-top: 0.5rem;
}

.tweets-grid.expanded .tweets-extra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.tweets-toggle-wrap {
  text-align: center;
  margin-top: 0.75rem;
}

.toggle-tweets {
  background: transparent;
  border: 1px solid #1976d2;
  color: #1976d2;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.toggle-tweets[aria-expanded="true"] {
  background: #1976d2;
  color: #fff;
}

/* news collapse rules matching tweets pattern */
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap: 0.6rem;
  margin: 1.2rem auto;
  max-width: calc(3 * 320px + 2 * 0.6rem);
}
@media (max-width: 992px) {
  .news-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}
@media (max-width: 600px) {
  .news-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
.news-grid .news-extra {
  display: none;
  grid-column: 1 / -1;
  gap: 1rem;
  margin-top: 0.5rem;
}
.news-grid.expanded .news-extra {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  max-width: calc(3 * 320px + 2 * 0.6rem);
  margin: 0 auto;
}
@media (max-width: 992px) {
  .news-grid.expanded .news-extra {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}
@media (max-width: 600px) {
  .news-grid.expanded .news-extra {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
.news-toggle-wrap {
  text-align: center;
  margin-top: 0.75rem;
}
.toggle-news {
  background: transparent;
  border: 1px solid #c8102e;
  color: #c8102e;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.toggle-news[aria-expanded="true"] {
  background: #c8102e;
  color: #fff;
}

/* substack collapse rules matching news pattern */
.substack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap: 0.6rem;
  margin: 1.2rem auto;
  max-width: calc(3 * 320px + 2 * 0.6rem);
}
@media (max-width: 992px) {
  .substack-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}
@media (max-width: 600px) {
  .substack-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
.substack-grid .substack-extra {
  display: none;
  grid-column: 1 / -1;
  gap: 1rem;
  margin-top: 0.5rem;
}
.substack-grid.expanded .substack-extra {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  max-width: calc(3 * 320px + 2 * 0.6rem);
  margin: 0 auto;
}
@media (max-width: 992px) {
  .substack-grid.expanded .substack-extra {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}
@media (max-width: 600px) {
  .substack-grid.expanded .substack-extra {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
.substack-toggle-wrap {
  text-align: center;
  margin-top: 0.75rem;
}
.toggle-substack {
  background: transparent;
  border: 1px solid #ff6719;
  color: #ff6719;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.toggle-substack[aria-expanded="true"] {
  background: #ff6719;
  color: #fff;
}

/* youtube collapse rules matching news pattern */
.youtube-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap: 0.6rem;
  margin: 1.2rem auto;
  max-width: calc(3 * 320px + 2 * 0.6rem);
  justify-content: center;
}
@media (max-width: 992px) {
  .youtube-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}
@media (max-width: 600px) {
  .youtube-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
.youtube-grid .youtube-extra {
  display: none;
  grid-column: 1 / -1;
  gap: 1rem;
  margin-top: 0.5rem;
}
.youtube-grid.expanded .youtube-extra {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  max-width: calc(3 * 320px + 2 * 0.6rem);
  margin: 0 auto;
  justify-content: center;
}
@media (max-width: 992px) {
  .youtube-grid.expanded .youtube-extra {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    max-width: none;
  }
}
@media (max-width: 600px) {
  .youtube-grid.expanded .youtube-extra {
    grid-template-columns: 1fr;
    max-width: none;
  }
}
.youtube-toggle-wrap {
  text-align: center;
  margin-top: 0.75rem;
}
.toggle-youtube {
  background: transparent;
  border: 1px solid #ff0000;
  color: #ff0000;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.toggle-youtube[aria-expanded="true"] {
  background: #ff0000;
  color: #fff;
}

/* reddit collapse rules matching news pattern */
.reddit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin: 1.2rem auto;
  max-width: 800px;
}
.reddit-grid .reddit-extra {
  display: none;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.reddit-grid.expanded .reddit-extra {
  display: block;
}
.reddit-toggle-wrap {
  text-align: center;
  margin-top: 0.75rem;
}
.toggle-reddit {
  background: transparent;
  border: 1px solid #ff4500;
  color: #ff4500;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.toggle-reddit[aria-expanded="true"] {
  background: #ff4500;
  color: #fff;
}

.video-pair {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.video-item {
  flex: 1;
}

.video-item a {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #0a1d37;
  text-decoration: none;
}

.video-item a:hover {
  text-decoration: underline;
}

.small-video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.small-video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 20px 10px;
  }
  
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 1.8rem;
  }
  
  section {
    padding: 1rem;
  }
  
  .card-container {
    grid-template-columns: 1fr;
  }
}