:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --primary: #1d4ed8;
  --primary-dark: #1e3a8a;
  --teal: #0f766e;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d9e2ef;
  --success-bg: #ecfdf5;
  --success-border: #10b981;
  --info-bg: #eff6ff;
  --info-border: #60a5fa;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Garante que o título não fique colado no topo ao clicar no menu lateral */
  scroll-padding-top: 30px;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* --- HERO SECTION --- */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--teal));
  color: #ffffff;
  padding: 56px 0 42px;
}

.hero-content {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
}

.logo {
  max-width: 180px;
  height: auto;
  margin-bottom: 15px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  font-weight: bold;
  opacity: 0.92;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 2.3rem;
  line-height: 1.15;
}

.hero-text {
  margin: 0;
  max-width: 760px;
  font-size: 1.04rem;
  opacity: 0.96;
}

.hero-badge {
  max-width: 280px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  padding: 16px 18px;
  font-weight: bold;
  font-size: 0.95rem;
  text-align: center;
}

/* --- LAYOUT --- */
.page-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 24px;
  padding: 24px 0 48px;
}

.sidebar {
  position: sticky;
  top: 20px;
  align-self: start;
}

.sidebar-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar-card {
  padding: 20px;
  margin-bottom: 18px;
}

.sidebar-card h2 {
  margin-top: 0;
  color: var(--primary-dark);
  font-size: 1.08rem;
}

.sidebar-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

/* --- NAVEGAÇÃO DE PROBLEMAS (CORREÇÃO DA ATIVAÇÃO) --- */
.problem-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.problem-nav li + li {
  margin-top: 10px;
}

.problem-nav a {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: all 0.2s ease-in-out;
  font-weight: 600;
}

.problem-nav a:hover {
  border-color: var(--primary);
  background: var(--surface-soft);
  color: var(--primary);
  transform: translateX(4px);
}

/* Classe de ativação para uso com JavaScript ou estados fixos */
.problem-nav a.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.2);
}

/* --- CONTEÚDO --- */
.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  padding: 28px;
  scroll-margin-top: 20px;
}

.section-tag {
  display: inline-block;
  background: #eaf2ff;
  color: var(--primary-dark);
  border: 1px solid #c8dbff;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.card h2,
.card h3 {
  color: var(--primary-dark);
  margin-top: 0;
}

.problem-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: start;
}

.figure-box {
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
  border: 1px solid #d4e3ff;
  border-radius: 16px;
  padding: 16px;
  text-align: center;
}

/* --- HIGHLIGHTS --- */
.highlight {
  border-radius: 14px;
  padding: 16px 18px;
  margin: 16px 0;
}

.highlight.success {
  background: var(--success-bg);
  border-left: 5px solid var(--success-border);
}

.highlight.info {
  background: var(--info-bg);
  border-left: 5px solid var(--info-border);
}

/* --- STEPS / ACORDEONS --- */
.steps {
  margin-top: 20px;
}

.steps details {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fcfdff;
  margin-bottom: 14px;
  transition: all 0.3s ease;
}

.steps details[open] {
  border-color: #b8cdfd;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.07);
}

.steps summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 18px;
  font-weight: bold;
  color: var(--primary-dark);
  background: var(--surface-soft);
  border-bottom: 1px solid #e8eef8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.steps summary::after {
  content: "▼";
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.steps details[open] summary::after {
  transform: rotate(180deg);
}

.steps summary::-webkit-details-marker {
  display: none;
}

.step-body {
  padding: 18px;
}

.answer {
  background: #f0fdf4;
  border-left: 5px solid #22c55e;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 12px 0;
}

/* --- FÓRMULAS --- */
.formula-box {
  background: #f8fbff;
  border: 1px solid #d7e5ff;
  border-radius: 14px;
  padding: 14px 16px;
  margin: 14px 0;
}

.formula-line {
  font-family: 'Fira Code', 'Courier New', monospace;
  background: #ffffff;
  border: 1px dashed #bfd1ea;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  overflow-x: auto;
  color: var(--primary-dark);
}

/* --- FOOTER & BOTÃO VOLTAR --- */
.voltar-container {
  text-align: center;
  padding: 40px 0;
}

.btn-voltar {
  display: inline-block;
  padding: 12px 24px;
  background: var(--primary-dark);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: bold;
  transition: opacity 0.2s;
}

.btn-voltar:hover {
  opacity: 0.9;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* --- RESPONSIVIDADE --- */
@media (max-width: 980px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    margin-bottom: 20px;
  }

  .problem-grid {
    grid-template-columns: 1fr;
  }

  .hero-content {
    flex-direction: column;
    align-items: start;
    text-align: left;
  }

  .hero-badge {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .card,
  .sidebar-card {
    padding: 18px;
  }
}