/* Mandioca — academic-stone research publication */

:root {
  --stone-50: #f7f6f3;
  --stone-100: #eceae4;
  --stone-200: #d8d4ca;
  --stone-300: #b8b2a4;
  --stone-400: #948c7c;
  --stone-500: #6f6759;
  --stone-600: #524c42;
  --stone-700: #3d3830;
  --stone-800: #2a2620;
  --stone-900: #1a1814;
  --accent: #5c6b4a;
  --accent-light: #7a8a66;
  --ink: var(--stone-800);
  --muted: var(--stone-500);
  --bg: var(--stone-50);
  --surface: #ffffff;
  --border: var(--stone-200);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --container: 960px;
  --reading: 640px;
  --font-serif: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --font-sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --shadow-soft: 0 2px 12px rgba(26, 24, 20, 0.06);
  --transition: 0.25s ease;
}

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-serif);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
}

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

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

a:hover { color: var(--stone-700); }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  color: var(--stone-900);
  margin-top: 0;
}

h1 { font-size: 2.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; margin-bottom: var(--space-sm); }
h3 { font-size: 1.2rem; }

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

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  max-width: var(--container);
  margin: 0 auto;
}

.logo {
  flex: 1;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--stone-900);
  text-decoration: none;
}

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

.nav-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
  cursor: pointer;
  color: var(--ink);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle svg { width: 22px; height: 22px; }

.header-spacer { width: 44px; }

/* Desktop nav */
.nav-desktop {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-desktop a {
  color: var(--muted);
  text-decoration: none;
}

.nav-desktop a:hover,
.nav-desktop a[aria-current="page"] { color: var(--stone-900); }

/* Mobile vertical drawer */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
}

.nav-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.nav-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 24, 20, 0.45);
  opacity: 0;
  transition: opacity var(--transition);
}

.nav-drawer.is-open .nav-drawer-backdrop { opacity: 1; }

.nav-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: min(280px, 85vw);
  height: 100%;
  background: var(--surface);
  padding: var(--space-xl) var(--space-md);
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}

.nav-drawer.is-open .nav-drawer-panel { transform: translateX(0); }

.nav-drawer-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.nav-drawer ul {
  list-style: none;
  margin: var(--space-lg) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.nav-drawer a {
  font-family: var(--font-sans);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stone-700);
  text-decoration: none;
  display: block;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border);
}

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

/* Hero — split image text */
.hero-split {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-xl) 0;
  align-items: center;
}

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

.hero-split-text .eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.hero-split-text .lead {
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1.7;
}

.hero-split-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.hero-split-image img,
.hero-split-image svg {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Section titles */
.section-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-md);
}

/* Numbered feed — single column */
.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: feed;
}

.feed-item {
  counter-increment: feed;
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 600px) {
  .feed-item {
    grid-template-columns: 48px 200px 1fr;
    align-items: start;
    gap: var(--space-md);
  }
}

.feed-number::before {
  content: counter(feed, decimal-leading-zero);
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--stone-300);
  line-height: 1;
}

.feed-thumb {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.feed-thumb img,
.feed-thumb svg {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.feed-body .meta {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

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

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

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

.feed-body .excerpt {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

.feed-teaser .feed-body h2 a {
  color: var(--muted);
  cursor: default;
}

/* Cards — stacked text below */
.card-grid {
  display: grid;
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

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

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.card-image img,
.card-image svg {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

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

.card-body .meta {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  color: var(--muted);
}

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

@media (min-width: 900px) {
  .article-layout {
    grid-template-columns: 200px 1fr;
    align-items: start;
  }
}

.toc-sidebar {
  display: none;
}

@media (min-width: 900px) {
  .toc-sidebar {
    display: block;
    position: sticky;
    top: 80px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
  }

  .toc-sidebar h2 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: var(--space-sm);
  }

  .toc-sidebar ol {
    margin: 0;
    padding-left: var(--space-sm);
    border-left: 2px solid var(--border);
  }

  .toc-sidebar li { margin-bottom: var(--space-xs); }

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

  .toc-sidebar a:hover,
  .toc-sidebar a.is-active { color: var(--accent); }
}

.article-content {
  max-width: var(--reading);
}

.article-header {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.article-header .category {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.article-header .byline {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.article-content h2 {
  margin-top: var(--space-lg);
  scroll-margin-top: 90px;
}

.article-content blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--accent);
  background: var(--stone-100);
  font-style: italic;
  color: var(--stone-600);
}

.article-content .citation {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--muted);
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  background: var(--stone-100);
  border-radius: var(--radius-sm);
}

/* Magazine breakout images */
.figure-breakout {
  margin: var(--space-xl) 0;
}

.figure-breakout img,
.figure-breakout svg {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-md);
}

@media (min-width: 768px) {
  .figure-breakout {
    width: calc(100% + 120px);
    margin-left: -60px;
    margin-right: -60px;
  }
}

.figure-caption {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: var(--space-xs);
  text-align: center;
}

/* Page content — general */
.page-content {
  max-width: var(--reading);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

.page-content.wide { max-width: var(--container); }

/* Contact form */
.contact-form label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  margin-bottom: var(--space-xs);
  color: var(--stone-700);
}

.contact-form input,
.contact-form textarea,
.contact-form select {
  width: 100%;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  margin-bottom: var(--space-sm);
  background: var(--surface);
}

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

.btn {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  background: var(--accent);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--transition);
}

.btn:hover { background: var(--stone-700); color: var(--surface); }

/* Footer — two column */
.site-footer {
  background: var(--stone-800);
  color: var(--stone-200);
  padding: var(--space-xl) 0 var(--space-lg);
  margin-top: var(--space-xl);
}

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

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

.site-footer h3 {
  color: var(--stone-100);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-sans);
}

.site-footer a {
  color: var(--stone-300);
  text-decoration: none;
}

.site-footer a:hover { color: var(--surface); }

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

.site-footer li { margin-bottom: var(--space-xs); }

.footer-bottom {
  border-top: 1px solid var(--stone-600);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--stone-400);
  text-align: center;
}

/* Cookie corner popup */
.cookie-popup {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-soft);
  z-index: 300;
  transform: translateY(120%);
  opacity: 0;
  transition: transform var(--transition), opacity var(--transition);
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.cookie-popup.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.cookie-popup p { margin-bottom: var(--space-sm); color: var(--muted); }

.cookie-popup .btn { margin-right: var(--space-xs); }

.cookie-popup .btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

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

.text-muted { color: var(--muted); }

@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .nav-toggle { display: none; }
  .header-spacer { display: none; }
}
