/* ============================================================
   DCAG-MD — Unified Stylesheet
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap");

/* --- Tokens ------------------------------------------------ */
:root {
  --green: #0f2f2f;
  --paper: #f4f1ec;
  --text: #123d3b;
  --off-white: #e7f1ec;
  --accent: #49a69a;
  --focus: #ffbf69;
  --muted: #6b8a86;
  --divider: #456;
  --border: #d5cfc9;
  --footer-bg: #0b2424;
  --card-bg: #eef3f0;
  --card-header-bg: #e1ebe5;
  --card-border: #c7d5ce;
  --link: #2e6f67;
  --link-hover: #2a5f58;
  --link-active: #244f49;
  --link-heading: #2a726c;
  --link-heading-hover: #3b8c84;
  --link-underline: rgba(46, 111, 103, 0.35);
  --tag-bg: #ddf0eb;
  --tag-text: #1a5248;
  --tag-active-bg: #49a69a;
  --tag-active-text: #fff;
  --callout-bg: #e8f5f0;
  --callout-border: #49a69a;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
}

body[data-theme="dark"],
:root[data-theme="dark"] {
  --green: #0c1a1a;
  --paper: #102524;
  --text: #e7f1ec;
  --off-white: #f1f7f5;
  --accent: #49b7a8;
  --muted: #9ab5b0;
  --divider: #2f4a4a;
  --border: #2f3a39;
  --footer-bg: #091818;
  --card-bg: #162f2c;
  --card-header-bg: #1c3835;
  --card-border: #2f4f4b;
  --link: #8fd2c6;
  --link-hover: #b1e6dd;
  --link-active: #74bdb1;
  --link-heading: #9fe0d6;
  --link-heading-hover: #c5f1ea;
  --link-underline: rgba(159, 224, 214, 0.45);
  --tag-bg: #1c3835;
  --tag-text: #9fe0d6;
  --tag-active-bg: #49b7a8;
  --tag-active-text: #0c1a1a;
  --callout-bg: #1a3530;
  --callout-border: #49b7a8;
}

/* --- Reset / Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--paper);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
a:active { color: var(--link-active); }
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 { color: var(--text); margin-top: 0; line-height: 1.3; }

/* --- Skip Link --------------------------------------------- */
.skip-link {
  position: absolute;
  left: -999px; top: -999px;
  background: var(--focus); color: #000;
  padding: 10px 14px; border-radius: 6px;
  font-weight: 700; z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; outline: 3px solid #000; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--green);
  color: var(--off-white);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--divider);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--off-white);
  flex-shrink: 0;
}
.brand svg { width: 56px; height: 42px; fill: currentColor; }
.brand:hover { color: var(--accent); text-decoration: none; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  color: var(--off-white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}
.nav-link.active {
  color: var(--accent);
  background: rgba(73, 166, 154, 0.12);
}
.nav-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Theme Toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  background: transparent;
  color: var(--off-white);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Show/hide sun vs moon */
.theme-icon-light { display: none; }
.theme-icon-dark { display: block; }
[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* Hamburger */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.hamburger-bar {
  display: block;
  width: 24px; height: 2px;
  background: var(--off-white);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 800px) {
  .mobile-menu-toggle { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--green);
    flex-direction: column;
    padding: 16px 24px;
    gap: 4px;
    border-bottom: 1px solid var(--divider);
  }
  .main-nav.is-open { display: flex; }
  .nav-link { padding: 12px 16px; font-size: 1rem; width: 100%; }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 32px;
  font-weight: 400;
}

/* ============================================================
   HERO (Homepage)
   ============================================================ */
.hero {
  position: relative;
  width: 100%;
  max-height: 480px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin-bottom: 48px;
}
.hero img {
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12,26,26,0.85) 0%, rgba(12,26,26,0.3) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
}
.hero-title {
  color: #fff;
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
  letter-spacing: 0.5px;
}
.hero-tagline {
  color: rgba(255,255,255,0.88);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 8px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

@media (max-width: 640px) {
  .hero { border-radius: 0; margin-left: -24px; margin-right: -24px; width: calc(100% + 48px); }
  .hero-overlay { padding: 24px; }
  .hero-title { font-size: 1.5rem; }
}

/* ============================================================
   SECTION HELPERS
   ============================================================ */
.section { margin-bottom: 48px; }
.section-title { font-size: 1.5rem; margin-bottom: 20px; }

/* ============================================================
   MISSION BLOCK (Homepage)
   ============================================================ */
.mission-block {
  max-width: 780px;
  margin: 0 auto 48px;
}
.mission-block p {
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 16px;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
  padding: 10px 0;
}
.cta-link:hover { color: var(--link-heading-hover); text-decoration: none; }
.cta-link::after { content: " →"; }

/* ============================================================
   CARDS — Reports
   ============================================================ */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.report-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.report-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.report-card h3 {
  margin: 0;
  font-size: 1.1rem;
  text-align: left;
}
.report-card h3 a {
  color: var(--link-heading);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--link-underline);
}
.report-card h3 a:hover {
  color: var(--link-heading-hover);
  text-decoration-color: var(--link-heading-hover);
}

.report-card .report-summary {
  font-size: 0.93rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.report-card .report-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--accent);
}
.report-card .report-pdf-link:hover { text-decoration: none; }

/* Tags */
.tag-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
  align-items: flex-start;
}
.tag-bar-label {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 2px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}
.tag-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

.tag-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  flex: 1;
}
.tag-group-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}
.tag-pill:hover {
  background: var(--tag-active-bg);
  color: var(--tag-active-text);
}
.tag-pill.active {
  background: var(--tag-active-bg);
  color: var(--tag-active-text);
}
.tag-pill-sm {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 14px;
  cursor: default;
}
.tag-pill-sm:hover { background: var(--tag-bg); color: var(--tag-text); }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-hidden { display: none !important; }

/* ============================================================
   PRESS SECTION
   ============================================================ */
.press-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

audio { width: 100%; border-radius: 8px; }
.audio-caption { margin-top: 8px; font-size: 0.9rem; color: var(--muted); }

/* ============================================================
   CARDS — Field Notes / Blog
   ============================================================ */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.blog-card:hover { box-shadow: var(--shadow-md); }

.blog-card h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  text-align: left;
}
.blog-card h3 a {
  color: var(--link-heading);
  text-decoration: none;
}
.blog-card h3 a:hover { color: var(--link-heading-hover); text-decoration: underline; }

.blog-date {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}

.blog-card p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 14px;
}

.read-more {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}
.read-more:hover { text-decoration: none; }
.read-more::after { content: " →"; }

/* ============================================================
   CONTACT PAGE
   ============================================================ */
.media-callout {
  background: var(--callout-bg);
  border: 2px solid var(--callout-border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  margin-bottom: 48px;
}
.media-callout h2 {
  text-align: left;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 1.4rem;
}
.media-callout p { margin: 0 0 10px; font-size: 1rem; }
.media-callout .media-contact-name {
  font-weight: 700;
  font-size: 1.05rem;
}
.media-callout a { font-weight: 700; }

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.contact-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}
.contact-card .contact-label { font-weight: 700; font-size: 0.88rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.contact-card .contact-name { font-weight: 700; font-size: 1rem; }
.contact-card .contact-link a { font-weight: 600; }

/* ============================================================
   FAQ
   ============================================================ */
.faq-search {
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-search label { font-weight: 600; }
.faq-search input {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
.faq-search input:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--accent);
}

.faq-list { display: flex; flex-direction: column; gap: 12px; }

.faq-item {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 700;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-header-bg);
  transition: background 0.15s ease;
}
.faq-item summary:hover { background: var(--card-border); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.faq-item summary::after {
  content: "▸";
  color: var(--accent);
  font-size: 1.1rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.faq-item[open] summary::after { transform: rotate(90deg); }
.faq-item .faq-body { padding: 16px 20px; }
.faq-item .faq-body p { margin: 0 0 10px; }
.faq-item .faq-body p:last-child { margin-bottom: 0; }

.is-hidden { display: none !important; }

/* ============================================================
   EDITORIAL BOARD
   ============================================================ */
.board-member {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-bottom: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}
.board-member:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.board-member .profile-img {
  width: 180px;
  height: 180px;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.board-member-info { flex: 1; }
.board-member-info h3 { text-align: left; margin-bottom: 12px; font-size: 1.15rem; }
.board-member-info p { margin: 0 0 12px; font-size: 0.95rem; }
.board-member-info p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .board-member { flex-direction: column; align-items: center; text-align: center; }
  .board-member .profile-img { width: 140px; height: 140px; }
  .board-member-info h3 { text-align: center; }
}

/* ============================================================
   AFFILIATES
   ============================================================ */
.affiliates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  justify-items: center;
}
/* When last row has fewer items, center them */
.affiliates-grid > :last-child:nth-child(3n+1) {
  grid-column: 2;
}
@media (max-width: 900px) {
  .affiliates-grid { grid-template-columns: repeat(2, 1fr); }
  .affiliates-grid > :last-child:nth-child(3n+1) { grid-column: auto; }
}
@media (max-width: 540px) {
  .affiliates-grid { grid-template-columns: 1fr; }
}

.affiliate-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s ease;
}
.affiliate-card:hover { box-shadow: var(--shadow-md); }

.affiliate-card-link {
  text-decoration: none;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.affiliate-card-link:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.affiliate-card h3 { margin: 0; font-size: 1rem; text-align: center; color: var(--link-heading); }
.affiliate-card-link:hover h3 { color: var(--link-heading-hover); }
.affiliate-card p { margin: 0; font-size: 0.93rem; color: var(--muted); text-align: center; }

.affiliate-name-link {
  color: var(--link-heading);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  text-decoration-color: var(--link-underline);
}
.affiliate-name-link:hover { color: var(--link-heading-hover); text-decoration-color: var(--link-heading-hover); }

.affiliate-logo {
  width: 100%;
  max-width: 130px;
  max-height: 100px;
  object-fit: contain;
  margin: 0 auto;
  padding: 4px;
}
.affiliate-logo-on-dark {
  background: var(--green);
  border-radius: 6px;
  padding: 8px;
}

.toggle-desc {
  margin-top: 6px;
  background: var(--accent);
  color: var(--green);
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
}
.toggle-desc:hover { opacity: 0.9; }
.toggle-desc:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ============================================================
   FEATURED REPORTS (Homepage)
   ============================================================ */
.featured-reports {
  margin-bottom: 48px;
}
.featured-reports .section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}
.featured-reports .section-header h2 { margin: 0; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--footer-bg);
  color: var(--off-white);
  margin-top: auto;
  border-top: 1px solid var(--divider);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px 36px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}

.footer-col h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 16px;
  text-align: left;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--off-white);
}
.footer-tagline {
  font-size: 0.95rem;
  color: var(--accent);
  margin: 6px 0 0;
  font-weight: 600;
}
.footer-org {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-links a {
  color: var(--off-white);
  font-size: 0.9rem;
  font-weight: 500;
}
.footer-links a:hover { color: var(--accent); text-decoration: none; }

.footer-contact-info p {
  margin: 0 0 10px;
  font-size: 0.9rem;
}
.footer-contact-info a {
  color: var(--off-white);
  font-weight: 600;
}
.footer-contact-info a:hover { color: var(--accent); text-decoration: none; }
.footer-volunteer {
  margin-top: 16px !important;
  font-size: 0.88rem !important;
  color: var(--muted);
}
.footer-volunteer a { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--divider);
  padding: 18px 40px;
  text-align: center;
}
.footer-bottom p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 800px) {
  .footer-inner { grid-template-columns: 1fr; gap: 28px; padding: 32px 24px; text-align: center; }
  .footer-col h3 { text-align: center; }
  .footer-links ul { align-items: center; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .page-content { padding: 32px 20px; }
  .page-title { font-size: 1.6rem; }
  .report-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .media-callout { padding: 24px 20px; }
}
