/* ═══════════════════════════════════════════════════
   CTFB · Catálogo Taxonômico da Fauna do Brasil
   Shared Design System — Light Theme
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400;1,700&family=JetBrains+Mono:wght@300;400;500&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

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

:root {
  --bg:       #f8f6f2;        /* warm off-white body */
  --surface:  #ffffff;         /* card bg */
  --raised:   #f0ede6;         /* slightly elevated surfaces */
  --nav-bg:   #1b3d2a;         /* deep forest green nav */
  --nav-hover:#143221;         /* darker nav hover */
  --accent:   #2d7a4f;         /* forest green accent */
  --accent2:  #c96a2e;         /* terracotta/amber for warmth */
  --text:     #1e1e1e;         /* main body text */
  --muted:    #5a6a74;         /* secondary text */
  --light:    #9badb8;         /* very muted / labels */
  --border:   rgba(45,122,79,0.18);
  --ghost:    rgba(45,122,79,0.05);
  --glow:     0 2px 16px rgba(45,122,79,0.12);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(45,122,79,0.3);
}
.nav-inner {
  display: flex; align-items: stretch;
  padding: 0 2.5rem;
  height: 56px;
}
.nav-logo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.22em;
  color: #a8d5b8; text-transform: uppercase;
  text-decoration: none;
  display: flex; align-items: center;
  margin-right: 2.5rem;
  flex-shrink: 0;
}
.nav-logo span { color: rgba(255,255,255,0.5); }

/* Nav groups */
.nav-groups {
  display: flex; align-items: stretch; flex: 1;
  list-style: none; gap: 0;
}
.nav-group {
  position: relative;
  display: flex; align-items: stretch;
}
.nav-group > a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.75); text-decoration: none;
  text-transform: uppercase;
  display: flex; align-items: center;
  padding: 0 1.1rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.nav-group > a:hover,
.nav-group > a.active {
  color: #ffffff;
  border-bottom-color: #a8d5b8;
}
/* Dropdown */
.nav-group:hover .dropdown { display: flex; }
.dropdown {
  display: none;
  flex-direction: column;
  position: absolute; top: 100%; left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 2px solid var(--accent);
  z-index: 300;
  box-shadow: var(--glow);
}
.dropdown a {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem; color: var(--muted);
  text-decoration: none;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(45,122,79,0.06);
  transition: background 0.15s, color 0.15s;
}
.dropdown a:last-child { border-bottom: none; }
.dropdown a:hover { background: var(--ghost); color: var(--accent); }
.dropdown a.active { color: var(--accent); background: var(--ghost); }

.nav-cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: #ffffff;
  background: var(--accent);
  padding: 0 1.2rem;
  text-decoration: none;
  display: flex; align-items: center;
  margin-left: auto;
  transition: background 0.2s;
  flex-shrink: 0;
}
.nav-cta:hover { background: var(--nav-hover); }

/* ── PAGE HERO ── */
.page-hero {
  position: relative;
  background: #eeeae2;
  border-bottom: 1px solid var(--border);
  padding: 4.5rem 3rem 3.5rem;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(45,122,79,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45,122,79,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse 60% 100% at 85% 50%, black, transparent);
}
.page-hero-orb {
  position: absolute;
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(45,122,79,0.06), transparent 70%);
  top: -100px; right: -50px;
  border-radius: 50%;
  pointer-events: none;
}
.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem; letter-spacing: 0.15em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 1.4rem;
  display: flex; align-items: center; gap: 0.5rem;
  position: relative; z-index: 1;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: 0.35; }
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 900; line-height: 1.0;
  position: relative; z-index: 1;
  margin-bottom: 0.8rem;
  color: var(--text);
}
.page-title em { color: var(--accent); font-style: italic; }
.page-subtitle {
  font-family: 'Crimson Pro', serif;
  font-size: 1.1rem; font-weight: 300;
  color: var(--muted); max-width: 580px;
  position: relative; z-index: 1;
  line-height: 1.7;
}

/* ── STATS BAR ── */
.stats-bar {
  background: var(--raised);
  border-bottom: 1px solid var(--border);
  padding: 0;
  display: grid;
}
.stats-bar.cols-4 { grid-template-columns: repeat(4,1fr); }
.stats-bar.cols-3 { grid-template-columns: repeat(3,1fr); }
.stats-bar.cols-2 { grid-template-columns: repeat(2,1fr); }
.stat-item {
  padding: 1.2rem 2rem;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.stat-item:last-child { border-right: none; }
.stat-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem; font-weight: 700;
  color: var(--accent); line-height: 1;
}
.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.15em;
  color: var(--muted); text-transform: uppercase;
  margin-top: 0.35rem;
}

/* ── TWO-COLUMN LAYOUT ── */
.page-body {
  display: grid;
  grid-template-columns: 1fr 300px;
}
.content-col {
  padding: 3.5rem 4rem 4rem 3rem;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.sidebar {
  padding: 3rem 1.8rem 3rem 2rem;
  display: flex; flex-direction: column; gap: 1.8rem;
}

/* ── CONTENT TYPOGRAPHY ── */
.section-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--accent);
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 0.9rem;
}
.section-tag::before {
  content: ''; display: block;
  width: 18px; height: 1px; background: var(--accent);
}
.content-section {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(45,122,79,0.08);
}
.content-section:last-child { border-bottom: none; margin-bottom: 0; }

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem; font-weight: 700;
  line-height: 1.15; margin-bottom: 1.1rem; color: var(--text);
}
h2 em { color: var(--accent); font-style: italic; }
h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 0.6rem; color: var(--text);
}
p {
  color: var(--muted);
  font-size: 1.02rem; font-weight: 300;
  line-height: 1.85; margin-bottom: 1rem;
}
p:last-child { margin-bottom: 0; }
a { color: var(--accent); }

.pull-quote {
  border-left: 3px solid var(--accent);
  background: var(--ghost);
  padding: 1.1rem 1.4rem;
  margin: 1.6rem 0;
}
.pull-quote p {
  font-family: 'Playfair Display', serif;
  font-style: italic; font-size: 1.1rem;
  color: var(--text); margin: 0; line-height: 1.6;
}

/* ── CARDS / GRIDS ── */
.card-grid {
  display: grid; gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin: 1.4rem 0;
}
.card-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.card-grid.cols-3 { grid-template-columns: repeat(3,1fr); }
.card {
  background: var(--surface);
  padding: 1.3rem 1.4rem;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 0.3rem;
  position: relative; overflow: hidden;
  transition: background 0.2s;
}
.card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent);
  transform: scaleY(0); transition: transform 0.22s;
  transform-origin: bottom;
}
.card:hover { background: #eef5f0; }
.card:hover::before { transform: scaleY(1); }
.card-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent);
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem; font-weight: 700; color: var(--text);
}
.card-desc {
  font-family: 'Crimson Pro', serif;
  font-size: 0.88rem; color: var(--muted); font-weight: 300;
}
.card-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.56rem; color: var(--accent);
  margin-top: 0.3rem; word-break: break-all;
}
.card.span2 { grid-column: span 2; }

/* ── CITATION BOX ── */
.citation-box {
  background: var(--raised);
  border: 1px solid var(--border);
  padding: 1.3rem 1.5rem;
  margin: 1.2rem 0;
}
.citation-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 0.7rem;
}
.citation-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; line-height: 1.75;
  color: var(--muted);
}
.citation-text a { color: var(--accent); word-break: break-all; }
.copy-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: 0.3rem 0.7rem;
  cursor: pointer; margin-top: 0.7rem;
  transition: border-color 0.2s, color 0.2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── LICENSE ── */
.license-block {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--ghost);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem; margin: 1.2rem 0;
}
.license-icon {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; color: var(--accent);
  background: rgba(45,122,79,0.1);
  padding: 0.25rem 0.5rem; white-space: nowrap; flex-shrink: 0;
}
.license-text {
  font-family: 'Crimson Pro', serif;
  font-size: 0.88rem; color: var(--muted);
  font-weight: 300; line-height: 1.6;
}

/* ── SIDEBAR WIDGETS ── */
.sb-block { border: 1px solid var(--border); overflow: hidden; }
.sb-header {
  background: var(--nav-bg);
  padding: 0.6rem 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: rgba(255,255,255,0.85);
}
.sb-body { padding: 0.8rem; }
.sb-body.no-pad { padding: 0; }

.sidenav { list-style: none; }
.sidenav li { border-bottom: 1px solid rgba(45,122,79,0.08); }
.sidenav li:last-child { border-bottom: none; }
.sidenav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.48rem 0.8rem;
  font-family: 'Crimson Pro', serif;
  font-size: 0.88rem; color: var(--muted);
  text-decoration: none; transition: color 0.15s, background 0.15s;
}
.sidenav a:hover { color: var(--accent); background: var(--ghost); }
.sidenav a.active { color: var(--accent); font-weight: 600; }
.sidenav .arrow { font-size: 0.6rem; opacity: 0.35; }
.sidenav a.active .arrow { opacity: 1; }
.sidenav .sub-item { padding-left: 1.5rem; font-size: 0.82rem; }

.quick-links { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem; }
.quick-link {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--raised);
  text-decoration: none; transition: background 0.15s;
}
.quick-link:hover { background: #e5e1d8; }
.ql-icon {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.52rem; letter-spacing: 0.08em;
  color: #ffffff; background: var(--accent);
  padding: 0.12rem 0.3rem; text-transform: uppercase; flex-shrink: 0;
}
.ql-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem; color: var(--text);
}

.version-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.38rem 0;
  border-bottom: 1px solid rgba(45,122,79,0.08);
}
.version-row:last-child { border-bottom: none; }
.vk {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.vv {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem; color: var(--accent);
}

.ouvidoria-block {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.1rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.ouvidoria-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.ouvidoria-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem; font-weight: 700; color: var(--text);
}
.ouvidoria-desc {
  font-family: 'Crimson Pro', serif;
  font-size: 0.84rem; color: var(--muted); font-weight: 300; line-height: 1.5;
}
.ouvidoria-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: #ffffff; background: var(--accent);
  padding: 0.35rem 0.7rem; text-decoration: none;
  display: inline-block; transition: background 0.2s; align-self: flex-start;
}
.ouvidoria-link:hover { background: var(--nav-hover); }

/* ── TABLE ── */
table {
  width: 100%; border-collapse: collapse;
  margin: 1.2rem 0;
}
thead tr {
  background: var(--raised);
  border-bottom: 2px solid var(--accent);
}
th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--accent);
  padding: 0.7rem 1rem; text-align: left;
}
td {
  font-family: 'Crimson Pro', serif;
  font-size: 0.9rem; color: var(--muted); font-weight: 300;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(45,122,79,0.07);
}
td a { color: var(--accent); }
tbody tr:hover td { background: var(--ghost); }
tbody tr:last-child td { border-bottom: none; }

/* ── CODE BLOCK ── */
.code-block {
  background: #f4f2ed;
  border: 1px solid var(--border); margin: 1.2rem 0;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(45,122,79,0.04);
}
.code-dots { display: flex; gap: 0.35rem; }
.code-dot { width: 9px; height: 9px; border-radius: 50%; }
.code-dot:nth-child(1) { background: #ff5f57; }
.code-dot:nth-child(2) { background: #ffbd2e; }
.code-dot:nth-child(3) { background: #28ca42; }
.code-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.1em;
  color: var(--muted); text-transform: uppercase;
}
.code-body {
  padding: 1.3rem 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem; line-height: 1.7;
  overflow-x: auto; color: var(--muted);
}
.cc { color: rgba(90,106,116,0.5); }  /* comment */
.ck { color: #7c4daa; }               /* keyword */
.cs { color: var(--accent); }         /* string */
.cf { color: var(--accent2); }        /* function/var */
.cn { color: #c0522a; }               /* number */

/* ── BADGES ── */
.badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.56rem; letter-spacing: 0.1em;
  border: 1px solid var(--border); color: var(--muted);
  padding: 0.18rem 0.45rem; text-transform: uppercase; display: inline-block;
}
.badge.green { border-color: rgba(45,122,79,0.4); color: var(--accent); }
.badge.amber { border-color: rgba(201,106,46,0.4); color: var(--accent2); }

/* ── FOOTER ── */
footer {
  background: var(--nav-bg);
  border-top: 1px solid rgba(45,122,79,0.3);
  padding: 2rem 3rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
}
.footer-copy {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.07em; color: rgba(255,255,255,0.6);
}
.footer-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── REVEAL ── */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .page-body { grid-template-columns: 1fr; }
  .content-col { padding: 2.5rem 1.5rem; border-right: none; }
  .sidebar { padding: 2rem 1.5rem; border-top: 1px solid var(--border); }
  .nav-groups { display: none; }
  .stats-bar.cols-4 { grid-template-columns: 1fr 1fr; }
  .card-grid.cols-3 { grid-template-columns: 1fr; }
  .card-grid.cols-2 { grid-template-columns: 1fr; }
  .card.span2 { grid-column: span 1; }
  .page-hero { padding: 3.5rem 1.5rem 2.5rem; }
}
