/* Max Brasil — forest-sage independent-blog */

:root {
  --primary: #184E3A;
  --accent: #74C69D;
  --bg: #F1FBF5;
  --text: #10261D;
  --muted: #6A8F7A;
  --white: #ffffff;
  --border: rgba(24, 78, 58, 0.14);
  --shadow: 0 4px 20px rgba(16, 38, 29, 0.07);

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;

  --radius-sm: 12px;
  --radius-md: 14px;
  --radius-lg: 16px;

  --container: 960px;
  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --line-body: 1.65;
  --transition: 180ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: var(--line-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

a:hover, a:focus-visible { color: var(--accent); }

h1, h2, h3, h4, p, ul, ol { margin: 0 0 var(--space-sm); }

h1 { font-size: clamp(1.75rem, 4vw, 2.35rem); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); line-height: 1.25; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.35; }

ul, ol { padding-left: 1.25rem; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-sm);
  background: var(--primary);
  color: var(--white);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  z-index: 200;
}

.skip-link:focus { left: var(--space-sm); }

.container {
  width: min(100% - var(--space-md), var(--container));
  margin-inline: auto;
}

/* Header — double-row-nav */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0 var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.site-logo:hover { color: var(--primary); }

.header-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.header-meta a {
  color: var(--muted);
  text-decoration: none;
}

.header-meta a:hover { color: var(--primary); }

.header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) 0 var(--space-sm);
  gap: var(--space-sm);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.menu-toggle:hover, .menu-toggle:focus-visible {
  background: var(--primary);
  color: var(--white);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.site-nav a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--primary);
  background: rgba(116, 198, 157, 0.18);
}

.site-nav a[aria-current="page"] {
  background: var(--primary);
  color: var(--white);
}

/* Buttons — outlined */
.btn {
  display: inline-block;
  padding: 0.55rem 1.15rem;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
}

.btn:hover, .btn:focus-visible {
  background: var(--primary);
  color: var(--white);
}

.btn-accent {
  border-color: var(--accent);
  color: var(--primary);
}

.btn-accent:hover, .btn-accent:focus-visible {
  background: var(--accent);
  color: var(--text);
}

/* Tags — uppercase-small */
.tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  text-decoration: none;
}

.tag:hover { color: var(--accent); }

/* Hero — split-image-text */
.hero-split {
  padding: var(--space-lg) 0;
}

.hero-grid {
  display: grid;
  gap: var(--space-lg);
  align-items: center;
}

.hero-visual {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow);
}

.hero-visual img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.hero-kicker {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

.hero-title {
  margin-bottom: var(--space-sm);
}

.hero-lead {
  font-size: 1.0625rem;
  color: var(--muted);
  max-width: 38ch;
  margin-bottom: var(--space-md);
}

/* Section headings */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--accent);
}

.section-head h2 { margin: 0; }

.section-head a {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

/* Lead story */
.lead-story {
  margin-bottom: var(--space-xl);
}

.lead-card {
  display: grid;
  gap: var(--space-md);
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.lead-card-image {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.lead-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lead-card-body {
  padding: 0 var(--space-md) var(--space-md);
}

.lead-card-body h2 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  margin-top: var(--space-xs);
}

.lead-card-body h2 a {
  color: inherit;
  text-decoration: none;
}

.lead-card-body h2 a:hover { color: var(--primary); }

.section-padded { padding-bottom: var(--space-xl); }

.lead-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

/* Article list — horizontal-rows, stacked-text-below */
.article-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.article-row {
  display: grid;
  gap: var(--space-sm);
  align-items: start;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.article-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.article-row-thumb {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
}

.article-row-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.article-row-body h3 {
  margin: var(--space-xs) 0;
}

.article-row-body h3 a {
  color: var(--text);
  text-decoration: none;
}

.article-row-body h3 a:hover { color: var(--primary); }

.article-row-excerpt {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

.article-row-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Cards grid for articles page */
.card-grid {
  display: grid;
  gap: var(--space-lg);
}

.card-grid-spaced { margin-top: var(--space-lg); }

.card-stack {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-stack:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(16, 38, 29, 0.1);
}

.card-stack-image img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.card-stack-body {
  padding: var(--space-md);
}

.card-stack-body h2 {
  font-size: 1.2rem;
  margin: var(--space-xs) 0;
}

.card-stack-body h2 a {
  color: var(--text);
  text-decoration: none;
}

.card-stack-body h2 a:hover { color: var(--primary); }

/* Article page — split-content-rail */
.article-layout {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-lg) 0 var(--space-xl);
}

.article-rail {
  order: 2;
}

.article-main {
  order: 1;
  min-width: 0;
}

.author-bio-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.author-bio-box img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: var(--space-sm);
  border: 2px solid var(--accent);
}

.author-bio-box h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.author-role {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.author-bio-box p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

.rail-block {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  border: 1px solid var(--border);
}

.rail-block h3 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.rail-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rail-links li {
  margin-bottom: var(--space-xs);
  font-size: 0.9375rem;
}

.rail-links a {
  text-decoration: none;
  color: var(--text);
}

.rail-links a:hover { color: var(--primary); }

.article-header {
  margin-bottom: var(--space-md);
}

.article-header h1 {
  margin: var(--space-xs) 0 var(--space-sm);
}

.article-byline {
  font-size: 0.875rem;
  color: var(--muted);
}

.article-featured-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow);
}

.article-featured-img img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.article-body p {
  margin-bottom: var(--space-sm);
}

.article-body h2 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.article-body blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  border-left: 4px solid var(--accent);
  background: rgba(116, 198, 157, 0.12);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--muted);
}

.article-updated {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}

/* Page content */
.page-content {
  padding: var(--space-lg) 0 var(--space-xl);
}

.page-content h1 {
  margin-bottom: var(--space-md);
}

.page-content p {
  max-width: 65ch;
}

.prose-narrow {
  max-width: 65ch;
}

.prose-narrow code {
  font-size: 0.875em;
  background: rgba(24, 78, 58, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* Contact form */
.contact-form {
  max-width: 32rem;
  margin-top: var(--space-md);
}

.form-group {
  margin-bottom: var(--space-sm);
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  background: var(--white);
  color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

/* Footer — three-column */
.site-footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.85);
  padding: var(--space-xl) 0 var(--space-lg);
  margin-top: var(--space-xl);
}

.footer-grid {
  display: grid;
  gap: var(--space-lg);
}

.footer-col h3 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.footer-col p,
.footer-col li {
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li { margin-bottom: 0.4rem; }

.footer-col a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

/* Cookie — bottom-bar */
.cookie-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: var(--space-sm) var(--space-md);
  box-shadow: 0 -4px 24px rgba(16, 38, 29, 0.08);
  z-index: 150;
  transform: translateY(100%);
  transition: transform 280ms ease;
}

.cookie-bar.is-visible {
  transform: translateY(0);
}

.cookie-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  max-width: var(--container);
  margin-inline: auto;
}

.cookie-inner p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  flex: 1;
  min-width: 200px;
}

.cookie-inner a { color: var(--primary); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 8-col-asymmetric grid helpers */
.grid-8 {
  display: grid;
  gap: var(--space-md);
}

/* Responsive */
@media (min-width: 480px) {
  .article-row {
    grid-template-columns: 140px 1fr;
  }
}

@media (min-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
  }

  .lead-card {
    grid-template-columns: 1.1fr 1fr;
  }

  .lead-card-image {
    min-height: 100%;
  }

  .lead-card-image img {
    height: 100%;
    aspect-ratio: auto;
  }

  .lead-card-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .article-row {
    grid-template-columns: 200px 1fr;
    gap: var(--space-md);
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .article-layout {
    grid-template-columns: 240px 1fr;
    gap: var(--space-xl);
  }

  .article-rail { order: 1; }
  .article-main { order: 2; }

  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .article-layout {
    grid-template-columns: 260px 1fr;
  }
}

@media (max-width: 767px) {
  .menu-toggle { display: block; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: var(--space-sm) var(--space-md);
    box-shadow: var(--shadow);
  }

  .site-nav.is-open { display: block; }

  .site-nav ul {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .header-bottom {
    position: relative;
  }

  .header-meta { display: none; }
}
