/* Macr Brasil — research-publication design system */
:root {
  --primary: #1F2933;
  --accent: #14B8A6;
  --bg: #F7FAFA;
  --text: #161B22;
  --muted: #718096;
  --white: #FFFFFF;
  --border: #E2E8F0;
  --font-sans: "Georgia", "Times New Roman", serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
  --container: 720px;
  --space-xs: 10px;
  --space-sm: 20px;
  --space-md: 32px;
  --space-lg: 48px;
  --space-xl: 72px;
  --radius: 2px;
  --line-height: 1.75;
  --transition: 0.25s ease;
  --header-height: 64px;
  --header-height-shrink: 48px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

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

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

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

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

ul, ol { list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--primary);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.75rem, 4.5vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); margin-top: var(--space-lg); margin-bottom: var(--space-sm); }
h3 { font-size: 1.125rem; }

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

.lead {
  font-size: 1.1875rem;
  line-height: 1.7;
  color: var(--muted);
}

.label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.text-muted { color: var(--muted); }
.text-small { font-size: 0.875rem; }

/* Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

.section {
  padding: var(--space-lg) 0;
}

.page-header {
  padding: var(--space-lg) 0 var(--space-md);
  margin-bottom: var(--space-md);
}

.page-header h1 { margin-bottom: var(--space-xs); }

/* Minimal header — sticky shrink */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--transition);
}

.site-header.is-scrolled {
  box-shadow: 0 1px 0 var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  transition: height var(--transition);
}

.site-header.is-scrolled .header-inner {
  height: var(--header-height-shrink);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--primary);
  text-decoration: none;
}

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

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  transition: width var(--transition), height var(--transition);
}

.site-header.is-scrolled .logo-icon {
  width: 22px;
  height: 22px;
}

.main-nav {
  display: none;
  gap: var(--space-md);
}

.main-nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--primary);
  transition: transform var(--transition), opacity var(--transition);
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: var(--space-sm);
  border-top: 1px solid var(--border);
  background: var(--white);
}

.mobile-nav.is-open { display: flex; }

.mobile-nav a {
  padding: var(--space-xs) 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a.active { color: var(--accent); }

/* Hero — text-only lead */
.hero {
  padding: var(--space-xl) 0 var(--space-lg);
}

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

.hero h1 {
  margin-bottom: var(--space-md);
  max-width: 18ch;
}

.hero .lead {
  max-width: 42ch;
  margin-bottom: 0;
}

/* Feed — numbered list, flat cards */
.feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.feed-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: var(--space-sm);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.feed-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.feed-number {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  padding-top: 4px;
}

.feed-body h2 {
  font-size: 1.25rem;
  margin: 0 0 var(--space-xs);
}

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

.feed-body h2 a:hover { color: var(--accent); }

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

.feed-meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

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

.feed-meta a:hover { color: var(--accent); }

/* Editorial body on homepage */
.editorial-body {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-lg);
}

.editorial-body h2 {
  margin-top: 0;
  font-size: 1.125rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
}

/* Flat card (minimal) */
.card-flat {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
}

.card-flat:last-child { border-bottom: none; }

.card-flat h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.card-flat h3 a {
  text-decoration: none;
  color: var(--primary);
}

.card-flat h3 a:hover { color: var(--accent); }

/* Article — minimalist reading + sticky TOC */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) 0 var(--space-xl);
}

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

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

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

.article-byline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.article-byline a {
  text-decoration: none;
  color: var(--muted);
}

.article-byline a:hover { color: var(--accent); }

.updated-note {
  font-size: 0.8125rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: var(--space-md);
  padding-left: var(--space-sm);
  border-left: 2px solid var(--accent);
}

.article-content {
  font-size: 1.0625rem;
}

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

.article-content h3 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
}

.article-content ul,
.article-content ol {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
}

.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }

.article-content li { margin-bottom: var(--space-xs); }

.article-content blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

/* Sticky TOC */
.toc-sidebar {
  order: -1;
}

.toc {
  padding: var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
}

.toc h2 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 var(--space-xs);
}

.toc ol {
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  padding: 4px 0;
  font-size: 0.8125rem;
}

.toc li::before {
  content: counter(toc, decimal-leading-zero) ".";
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--accent);
  margin-right: 8px;
}

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

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

.related-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.related-section h2 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0;
  margin-bottom: var(--space-md);
}

/* Content pages */
.content-page h2:first-of-type { margin-top: var(--space-md); }

.content-page ul {
  list-style: disc;
  padding-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

.content-page li { margin-bottom: var(--space-xs); }

/* Contact */
.contact-block {
  margin-bottom: var(--space-lg);
}

.contact-block h2 {
  font-size: 1rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--space-md);
}

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

.form-group label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

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

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

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

.form-submit {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 20px;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

.form-submit:hover { background: var(--accent); }

/* Photo placeholder SVG container */
.photo-placeholder {
  aspect-ratio: 16 / 9;
  max-width: 100%;
  margin: var(--space-md) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}

.photo-placeholder svg {
  width: 100%;
  height: 100%;
}

/* Footer — minimal single */
.site-footer {
  padding: var(--space-lg) 0 var(--space-md);
  border-top: 1px solid var(--border);
  margin-top: var(--space-xl);
}

.footer-inner {
  text-align: center;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.footer-nav a {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}

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

.footer-copy {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Inline cookie note in footer */
.cookie-inline {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.6;
}

.cookie-inline a {
  color: var(--accent);
  text-decoration: underline;
}

.cookie-dismiss {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: underline;
  margin-left: 6px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.cookie-inline.is-hidden { display: none; }

.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;
}

@media (min-width: 768px) {
  .main-nav { display: flex; }
  .menu-toggle { display: none; }
  .mobile-nav,
  .mobile-nav.is-open { display: none; }

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

  .toc-sidebar {
    order: 1;
  }

  .toc {
    position: sticky;
    top: calc(var(--header-height) + 24px);
  }

  .site-header.is-scrolled .toc {
    top: calc(var(--header-height-shrink) + 24px);
  }
}
