:root {
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-dark: #1b4332;
  --accent: #b7e4c7;
  --warm: #f4e8d1;
  --text: #1a1a2e;
  --text-light: #4a4a5a;
  --bg: #fafcfb;
  --card-bg: #ffffff;
  --border: #d8e2dc;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --max-w: 1100px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}

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

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

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

/* Header */
header {
  background: var(--primary-dark);
  color: #fff;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo:hover { text-decoration: none; color: var(--accent); }

nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
nav a { color: rgba(255,255,255,0.9); font-size: 0.95rem; font-weight: 500; }
nav a:hover { color: #fff; text-decoration: none; }

.locale-badge {
  background: var(--accent);
  color: var(--primary-dark);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: #fff;
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero p {
  font-size: 1.15rem;
  max-width: 650px;
  margin: 0 auto;
  opacity: 0.92;
  line-height: 1.6;
}

/* Content sections */
main { padding: 3rem 0; }

.content-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.content-section h2 {
  color: var(--primary-dark);
  font-size: 1.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

.content-section h3 {
  color: var(--primary);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
}

.content-section p { margin-bottom: 1rem; color: var(--text-light); }
.content-section ul, .content-section ol { margin: 1rem 0 1rem 1.5rem; color: var(--text-light); }
.content-section li { margin-bottom: 0.5rem; }

/* Cards grid */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; margin: 2rem 0; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.card h3 { color: var(--primary-dark); margin-bottom: 0.5rem; font-size: 1.1rem; }
.card p { color: var(--text-light); font-size: 0.95rem; }

/* Breadcrumb */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.breadcrumb a { color: var(--primary); }
.breadcrumb span { margin: 0 0.4rem; opacity: 0.5; }

/* Footer */
footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.8);
  padding: 2.5rem 0;
  margin-top: 3rem;
}

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

footer h4 { color: #fff; margin-bottom: 0.75rem; font-size: 1rem; }
footer a { color: rgba(255,255,255,0.75); font-size: 0.9rem; }
footer a:hover { color: #fff; }
footer ul { list-style: none; }
footer li { margin-bottom: 0.4rem; }
footer .copyright { grid-column: 1 / -1; text-align: center; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.15); font-size: 0.85rem; opacity: 0.7; }

/* Resource badge */
.resource-badge {
  display: inline-block;
  background: var(--warm);
  color: var(--primary-dark);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* CTA */
.cta-block {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 2rem;
  border-radius: var(--radius);
  text-align: center;
  margin: 2rem 0;
}

.cta-block h3 { color: #fff; margin-bottom: 0.5rem; }
.cta-block p { opacity: 0.9; margin-bottom: 1rem; }
.cta-btn {
  display: inline-block;
  background: #fff;
  color: var(--primary-dark);
  padding: 0.7rem 1.8rem;
  border-radius: var(--radius);
  font-weight: 600;
  transition: transform 0.2s;
}

.cta-btn:hover { transform: scale(1.03); text-decoration: none; }

@media (max-width: 768px) {
  .hero { padding: 2.5rem 0; }
  .content-section { padding: 1.5rem; }
  header .container { justify-content: center; text-align: center; }
  nav { justify-content: center; }
}

/* Accessibility: skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-dark);
  color: #fff;
  padding: 0.6rem 1.2rem;
  z-index: 200;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; color: #fff; text-decoration: none; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 2px solid rgba(255,255,255,0.6);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  header nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    padding-top: 0.5rem;
  }
  header nav.open { display: flex; }
  header nav a {
    padding: 0.7rem 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 1rem;
  }
}

/* Tables */
.content-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
  color: var(--text-light);
}
.content-section caption {
  text-align: left;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}
.content-section th, .content-section td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
.content-section thead th {
  background: var(--primary-dark);
  color: #fff;
  border-color: var(--primary-dark);
}
.content-section tbody tr:nth-child(even) { background: #f2f7f4; }

/* FAQ (details/summary) */
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  margin-bottom: 0.75rem;
  background: #fff;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-dark);
  list-style: none;
  position: relative;
  padding-right: 1.8rem;
}
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.2rem;
  top: 0;
  font-size: 1.3rem;
  color: var(--primary);
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary::-webkit-details-marker { display: none; }
.faq details p { margin: 0.75rem 0 0; }

/* Last-updated stamp */
.last-updated {
  font-size: 0.85rem;
  color: var(--text-light);
  opacity: 0.85;
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat {
  background: linear-gradient(135deg, #f2f7f4 0%, #e8f3ec 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  text-align: center;
}
.stat .stat-num {
  display: block;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.2;
}
.stat .stat-label { font-size: 0.88rem; color: var(--text-light); }

/* Checklist */
.checklist { list-style: none; margin-left: 0 !important; }
.checklist li {
  padding-left: 1.9rem;
  position: relative;
}
.checklist li::before {
  content: "\2713";
  position: absolute;
  left: 0.3rem;
  color: var(--primary-light);
  font-weight: 700;
}

/* Callout box */
.callout {
  background: var(--warm);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  color: var(--text);
}
.callout p:last-child { margin-bottom: 0; }

/* Card icons */
.card .icon { width: 34px; height: 34px; margin-bottom: 0.6rem; }
.card .icon svg { width: 100%; height: 100%; fill: var(--primary); }

/* Forum topic view */
.topic-badge {
  display: inline-block;
  background: var(--primary-dark);
  color: #fff;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.topic-blurb { font-size: 1.1rem; font-weight: 500; color: var(--text) !important; }
#forum-index.topic-view h2::after { content: ""; }

/* Author byline */
.byline {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
}
.byline strong { color: var(--primary-dark); }

/* Print styles */
@media print {
  header, footer, .cta-block, .nav-toggle, .skip-link, .breadcrumb { display: none; }
  body { background: #fff; font-size: 12pt; }
  main { padding: 0; }
  .content-section {
    box-shadow: none;
    border: none;
    padding: 0;
    margin-bottom: 1.5rem;
  }
  a { color: #000; text-decoration: underline; }
  a[href^="/"]::after { content: " (https://e-commons.org" attr(href) ")"; font-size: 0.85em; }
  .faq details { border: none; padding: 0.3rem 0; }
  .faq summary { pointer-events: none; }
  .faq summary::after { content: ""; }
}
