/* ─── Design tokens ─── */
:root {
  --bg:           #342764;
  --text:         #ffffff;
  --text-muted:   rgba(255, 255, 255, 0.6);
  --text-faint:   rgba(255, 255, 255, 0.3);
  --surface:      rgba(255, 255, 255, 0.08);
  --divider:      rgba(255, 255, 255, 0.12);
  --nav-bg:       rgba(52, 39, 100, 0.95);

  --font:         'Inter', system-ui, sans-serif;
  --container:    1100px;
  --container-narrow: 720px;

  --radius:       6px;
  --radius-sm:    3px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* ─── Base ─── */
html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ─── Container ─── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 2rem;
}

.container--narrow {
  max-width: var(--container-narrow);
}

/* ─── Typography ─── */
h1 {
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

h2 {
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h3 {
  font-weight: 800;
  line-height: 1.2;
}

.label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.section {
  padding-block: 6rem;
}
.section--flush-bottom { padding-bottom: 1.5rem; }
.section--flush-top { padding-top: 1.5rem; }

.section__header {
  margin-bottom: 3rem;
}

.section__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.section__title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
}

.section__lead {
  margin-top: 1rem;
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 620px;
}

/* ─── Divider ─── */
.divider {
  width: 2.5rem;
  height: 2px;
  background: var(--divider);
  margin-block: 1.5rem;
}

/* ─── Navigation ─── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--divider);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 2rem;
  height: 3.5rem;
}

.nav-logo {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--text);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--divider);
    padding: 1rem 2rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    width: 100%;
    padding-block: 0.75rem;
    border-bottom: 1px solid var(--divider);
  }

  .nav-links li:last-child { border-bottom: none; }
}

/* Offset for fixed nav */
section { scroll-margin-top: 3.5rem; }

/* ─── Hero ─── */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 2rem 4rem;
  max-width: var(--container);
  margin-inline: auto;
  overflow: hidden;
}

/* Decorative circles — positioned off the right edge */
#hero::before,
#hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

#hero::before {
  width: 600px;
  height: 600px;
  top: 50%;
  right: -200px;
  transform: translateY(-50%);
}

#hero::after {
  width: 420px;
  height: 420px;
  top: 50%;
  right: -120px;
  transform: translateY(-50%);
  border-color: rgba(255, 255, 255, 0.04);
}

.hero__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 2rem;
}

.hero__title {
  font-family: 'Barlow', sans-serif;
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
}

.hero__title span {
  display: block;
}

.hero__divider {
  width: 3rem;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  margin-bottom: 1.5rem;
}

.hero__subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.hero__institution {
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.hero__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.hero__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: var(--radius);
  letter-spacing: 0.02em;
  background: rgba(255,255,255,0.15);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.25);
  transition: background 0.15s, border-color 0.15s;
}
.hero__btn:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.45); }

.hero__btn--disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.hero__cta {
  position: absolute;
  bottom: 2.5rem;
  left: 2rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Problem section ─── */
#problem {
  border-top: 1px solid var(--divider);
}

.prose p {
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  max-width: 680px;
}

.prose p:last-child { margin-bottom: 0; }

/* ─── About the Index ─── */
.tier-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.tier-legend__label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  width: 100%;
  margin-bottom: 0.25rem;
}

.tier-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

.tier-pill__swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.tier-pill__swatch--na {
  background: transparent;
  border: 1px dashed var(--divider);
}
.tier-pill__label { color: var(--text-muted); display: flex; align-items: baseline; gap: 0.4rem; }
.tier-pill__range { font-size: 0.6875rem; font-weight: 400; color: var(--text-faint); }

/* ─── Heatmap ─── */
.heatmap-section {
  overflow-x: auto;
}

.heatmap-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.heatmap-filter-tabs {
  display: flex;
  gap: 0.375rem;
}

.heatmap-tab {
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.heatmap-tab:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.heatmap-tab.active {
  background: rgba(255, 255, 255, 0.9);
  color: #342764;
}

.heatmap-sort {
  margin-left: auto;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.heatmap-sort:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.heatmap-sort.active {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.heatmap-table {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 0;
}

.heatmap-table thead th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0.5rem 0.75rem;
  text-align: center;
}

.heatmap-table thead th:first-child {
  text-align: left;
  padding-left: 0;
}

.heatmap-table tbody tr {
  transition: background 0.15s;
}

.heatmap-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.heatmap-table tbody td {
  padding: 0.3rem 0.5rem;
  vertical-align: middle;
}

.heatmap-table tbody td:first-child {
  padding-left: 0;
  white-space: nowrap;
}

.platform-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  min-width: 130px;
}

.vlop-badge {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-faint);
  padding: 1px 5px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tier-cell {
  border-radius: var(--radius-sm);
  height: 2.25rem;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  transition: opacity 0.2s;
}

.tier-cell .tier-label {
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
}

tr:hover .tier-cell .tier-label {
  opacity: 1;
}

.tier-cell.dimmed {
  opacity: 0.2;
}

.tier-cell.not-assessed {
  background: transparent;
  border: 1px dashed var(--divider);
  color: var(--text-faint);
}

/* ─── Key Findings ─── */
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 3rem;
  margin-top: 1rem;
}

.finding {
  max-width: 720px;
  padding-left: 1.5rem;
  border-left: 2px solid var(--divider);
}

.finding__statement {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.finding__body {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Recommendations ─── */
.rec-group {
  margin-bottom: 3rem;
}

.rec-group__heading {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--divider);
}

.rec-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.rec-card__header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
}

.rec-card__header:hover {
  background: rgba(255, 255, 255, 0.04);
}

.rec-badge {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  margin-top: 2px;
}

.rec-card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  flex: 1;
}

.rec-card__toggle {
  font-size: 1rem;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: transform 0.2s;
  margin-top: 2px;
}

.rec-card.open .rec-card__toggle {
  transform: rotate(180deg);
}

.rec-card__summary {
  padding: 0 1.5rem 1.25rem 4rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.rec-card__full {
  display: none;
  padding: 1rem 1.5rem 1.5rem 4rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
  border-top: 1px solid var(--divider);
}

.rec-card.open .rec-card__summary {
  display: none;
}

.rec-card.open .rec-card__full {
  display: block;
}

/* ─── Download & Cite ─── */
#download {
  border-top: 1px solid var(--divider);
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 3rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: rgba(255,255,255,0.15);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 700;
  border-radius: var(--radius);
  letter-spacing: 0.02em;
  border: 1px solid rgba(255,255,255,0.25);
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.45); }
.btn-primary--disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: rgba(255,255,255,0.15);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.25);
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover { background: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.45); }

.citation-block {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 3rem;
}

.citation-block__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

.citation-block__text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.doi-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

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

.logos-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding-top: 2rem;
  border-top: 1px solid var(--divider);
}

.logo-placeholder {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.logo-link { display: inline-flex; align-items: center; opacity: 0.7; transition: opacity 0.15s; }
.logo-link:hover { opacity: 1; }
.logo-img { height: 2rem; width: auto; }
.logo-img[alt="NetLab UFRJ"] { height: 2.75rem; }
.logo-img[alt="UFRJ"] { height: 3.5rem; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .section { padding-block: 4rem; }

  #hero {
    padding: 5rem 1.5rem 3rem;
    min-height: 100svh;
  }

  .hero__cta { left: 1.5rem; }

  .container { padding-inline: 1.5rem; }

  .heatmap-controls { gap: 0.5rem; }

  .heatmap-sort { margin-left: 0; width: 100%; justify-content: center; }

  .download-actions { flex-direction: column; }
  .btn-primary, .btn-secondary { justify-content: center; }

  .logos-row { gap: 1.25rem; }
}

@media (max-width: 480px) {
  .rec-card__summary,
  .rec-card__full {
    padding-left: 1.5rem;
  }

  .rec-card__header { gap: 0.75rem; }
}

/* ─── Load animation ─── */
body { opacity: 0; animation: fadeIn 0.3s ease 0.1s forwards; }

@keyframes fadeIn { to { opacity: 1; } }

/* ─── Accessibility ─── */
:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}
