/* Studies Suggest — Main Stylesheet */
/* Nature-themed, credibility-first design */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #faf8f4;
  --bg-alt: #f0ece4;
  --bg-card: #ffffff;
  --text: #2c2c2c;
  --text-muted: #6b6560;
  --accent: #3a7d44;
  --accent-hover: #2d6235;
  --accent-light: rgba(58, 125, 68, 0.08);
  --accent-warm: #8b6914;
  --border: #ddd5c8;
  --border-light: #e8e2d8;
  --card-shadow: 0 1px 4px rgba(44, 44, 44, 0.06);
  --card-hover-shadow: 0 6px 20px rgba(44, 44, 44, 0.1);
  --header-bg: rgba(250, 248, 244, 0.96);
  --tag-bg: rgba(58, 125, 68, 0.08);
  --serif: 'Lora', 'Georgia', 'Times New Roman', serif;
  --sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --leaf: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' opacity='0.03'%3E%3Cpath d='M30 5 C15 5 5 20 5 35 C5 50 15 55 30 55 C30 40 20 30 30 5Z' fill='%233a7d44'/%3E%3C/svg%3E");
}

html.dark {
  --bg: #1a1e1a;
  --bg-alt: #242824;
  --bg-card: #2a2e2a;
  --text: #e4e0d8;
  --text-muted: #9a9488;
  --accent: #6db87a;
  --accent-hover: #8ad097;
  --accent-light: rgba(109, 184, 122, 0.12);
  --accent-warm: #c4a04c;
  --border: #3a3e3a;
  --border-light: #333733;
  --card-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  --card-hover-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  --header-bg: rgba(26, 30, 26, 0.96);
  --tag-bg: rgba(109, 184, 122, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* Text selection */
::selection {
  background: rgba(58, 125, 68, 0.2);
  color: var(--text);
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.3s;
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.site-logo {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  text-decoration: none;
  display: flex; align-items: center; gap: 10px;
}
.site-logo .logo-icon {
  font-size: 1.6rem;
}
.site-logo .logo-highlight {
  color: var(--accent);
}

/* Nav */
.main-nav { display: flex; gap: 4px; align-items: center; }
.main-nav a {
  padding: 6px 14px; border-radius: 20px;
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-muted); transition: all 0.2s;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--accent-light); color: var(--accent);
}
.theme-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; padding: 6px; border-radius: 50%;
  color: var(--text-muted); transition: color 0.2s;
}
.theme-toggle:hover { color: var(--accent); }

/* Hamburger */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: 0.3s; border-radius: 2px; }
.mobile-drawer { display: none; }
.mobile-drawer.open { display: block; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 16px 24px; }
.mobile-drawer a { display: block; padding: 10px 0; color: var(--text); font-size: 1rem; }
.drawer-theme-toggle {
  margin-top: 8px;
  padding-top: 12px !important;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted) !important;
  font-size: 0.9rem !important;
}

/* Hero section */
.site-hero {
  text-align: center;
  padding: 56px 24px 40px;
  max-width: 700px;
  margin: 0 auto;
  position: relative;
}
.site-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.site-hero h1 {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text);
  letter-spacing: -0.5px;
}
.site-hero .tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Featured article */
.featured-section {
  max-width: 1100px; margin: 0 auto 40px;
  padding: 0 24px;
}
.featured-card {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s, transform 0.2s;
  text-decoration: none; color: inherit;
}
.featured-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-2px);
}
.featured-img {
  width: 100%; height: 100%; min-height: 280px;
  object-fit: cover;
}
.featured-body {
  padding: 32px 32px 32px 0;
  display: flex; flex-direction: column; justify-content: center;
}
.featured-body .kicker {
  display: inline-block; padding: 3px 12px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--tag-bg); color: var(--accent);
  margin-bottom: 10px; width: fit-content;
}
.featured-body h2 {
  font-family: var(--serif);
  font-size: 1.5rem; font-weight: 700; line-height: 1.3;
  margin-bottom: 10px;
}
.featured-body .deck {
  font-size: 0.95rem; color: var(--text-muted);
  line-height: 1.5; margin-bottom: 12px;
}
.featured-body .byline {
  font-size: 0.8rem; color: var(--text-muted);
}

/* Section headers */
.section-header {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 16px;
  display: flex; align-items: center; gap: 12px;
}
.section-header h2 {
  font-family: var(--serif);
  font-size: 1.3rem; font-weight: 600;
  color: var(--text);
}
.section-header .line {
  flex: 1; height: 1px; background: var(--border);
}

/* Article grid */
.article-grid {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.article-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-shadow: var(--card-shadow);
  transition: all 0.25s ease;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.article-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-3px);
}
.card-img {
  width: 100%; height: 180px; object-fit: cover;
}
.card-body {
  padding: 18px 20px 20px;
  flex: 1; display: flex; flex-direction: column;
}
.card-body .kicker {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--tag-bg); color: var(--accent);
  margin-bottom: 8px; width: fit-content;
}
.card-body h3 {
  font-family: var(--serif);
  font-size: 1.05rem; font-weight: 600; line-height: 1.35;
  margin-bottom: 8px;
}
.card-body .deck {
  font-size: 0.85rem; color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  font-size: 0.75rem; color: var(--text-muted);
  gap: 8px;
}
.card-meta .score {
  font-weight: 600; color: var(--accent-warm);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 1100px;
  margin: 0 auto;
}
.site-footer a { color: var(--accent); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; }
.footer-about {
  max-width: 480px;
  margin: 0 auto 16px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
}
.footer-sep {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 16px auto;
}

/* Accessibility: focus styles */
a:focus-visible,
button:focus-visible,
.article-card:focus-visible,
.featured-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}
.skip-link:focus { top: 8px; }

/* Reading time badge on cards */
.reading-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Botanical divider */
.botanical-divider {
  text-align: center;
  padding: 8px 0;
  font-size: 1.2rem;
  opacity: 0.35;
  letter-spacing: 12px;
  user-select: none;
}

/* Print styles */
@media print {
  .site-header, .hamburger, .mobile-drawer, .theme-toggle,
  .footer-links, .botanical-divider { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .site-hero h1 { font-size: 1.6rem; }
  .article-grid { display: block; }
  .article-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: 12px;
  }
  .featured-card {
    display: block;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  a { color: #000; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 0.8em; }
  .site-logo a::after, .main-nav a::after { content: none; }
}

/* Responsive */
@media (max-width: 768px) {
  .site-hero { padding: 36px 20px 28px; }
  .site-hero h1 { font-size: 1.8rem; }
  .featured-card { grid-template-columns: 1fr; }
  .featured-img { min-height: 200px; }
  .featured-body { padding: 20px; }
  .featured-body h2 { font-size: 1.25rem; }
  .article-grid { grid-template-columns: 1fr; gap: 16px; padding: 0 16px 36px; }
  .main-nav { display: none; }
  .hamburger { display: block; }
  .section-header { padding: 0 16px 12px; }
  .featured-section { padding: 0 16px; }
  .header-inner { padding: 12px 16px; }
}

@media (max-width: 480px) {
  .site-hero h1 { font-size: 1.5rem; }
  .site-hero .tagline { font-size: 0.95rem; }
  .card-img { height: 150px; }
}
