@layer base, layout, componentes, paginas;

:root {
  --papel: #FFFFFF;
  --nevoa: #EFF4F3;
  --tinta: #142229;
  --tinta-2: #4C5C63;
  --linha: #D5DFE0;
  --rede: #0E2C33;
  --rede-2: #18434C;
  --rede-texto: #D8E6E6;
  --zap: #0A7A42;
  --zap-forte: #075F33;
  --par-azul: #2F6FE0;
  --par-laranja: #E0742A;
  --par-verde: #2B9A5A;
  --par-marrom: #A2693F;
  --par-ardosia: #7F929B;
  --fonte: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --largura: 1200px;
  --margem: clamp(16px, 4vw, 44px);
  --raio: 10px;
}

@layer base {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5.5rem; }
  body {
    margin: 0;
    background: var(--papel);
    color: var(--tinta);
    font: 400 1.0625rem/1.65 var(--fonte);
    overflow-wrap: break-word;
  }
  :where(*, *::before, *::after) { box-sizing: border-box; }
  img, svg { max-width: 100%; height: auto; }
  h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
  h1 { font-size: clamp(2.3rem, 5.6vw, 4.1rem); font-weight: 850; }
  h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 800; }
  h3 { font-size: 1.2rem; font-weight: 750; line-height: 1.25; letter-spacing: -0.01em; }
  p { margin: 0; }
  a { color: var(--rede-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
  a:hover { text-decoration-thickness: 2px; }
  :focus-visible { outline: 3px solid var(--par-azul); outline-offset: 2px; border-radius: 3px; }
  main:focus { outline: none; }
  table { border-collapse: collapse; width: 100%; }
}

@layer layout {
  .faixa { width: min(100% - 2 * var(--margem), var(--largura)); margin-inline: auto; }
  .bloco { padding-block: clamp(56px, 8vw, 104px); }
  .bloco-nevoa { background: var(--nevoa); }
  .bloco-cabeca { max-width: 46rem; display: grid; gap: 14px; margin-block-end: clamp(28px, 4vw, 48px); }
  .bloco-cabeca p { color: var(--tinta-2); font-size: 1.125rem; }
  .bloco-cabeca-linha { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px 24px; max-width: none; }
}

@layer componentes {
  .pular {
    position: absolute; left: 16px; top: -100px; z-index: 60;
    background: var(--tinta); color: #fff; padding: 10px 16px; border-radius: 6px;
  }
  .pular:focus { top: 12px; }

  /* Topo */
  .topo { position: sticky; top: 0; z-index: 40; background: var(--rede); color: #fff; border-bottom: 1px solid var(--rede-2); }
  .topo-faixa { width: min(100% - 2 * var(--margem), var(--largura)); margin-inline: auto; display: flex; align-items: center; gap: 24px; min-height: 68px; }
  .marca { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; }
  .marca em { font-style: normal; font-weight: 400; color: var(--rede-texto); }
  .marca-sinal { fill: none; stroke-width: 2.6; stroke-linecap: round; flex: none; }
  .m-tronco { stroke: #fff; stroke-width: 4.5; }
  .m-a { stroke: var(--par-azul); }
  .m-b { stroke: var(--par-laranja); }
  .m-c { stroke: var(--par-verde); }
  .menu { margin-inline-start: auto; display: flex; align-items: center; gap: 22px; }
  .menu ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
  .menu ul a { display: block; color: var(--rede-texto); text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: 0.97rem; }
  .menu ul a:hover { color: #fff; background: var(--rede-2); }
  .menu ul a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--par-laranja); border-radius: 0; }
  .menu-botao { display: none; }

  /* Botoes */
  .botao {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 48px; padding: 10px 22px; border-radius: 999px;
    font: 700 1rem/1.2 var(--fonte); text-decoration: none; text-align: center;
    background: var(--rede); color: #fff; border: 2px solid var(--rede);
  }
  .botao:hover { background: var(--rede-2); border-color: var(--rede-2); }
  .botao-zap { background: var(--zap); border-color: var(--zap); color: #fff; }
  .botao-zap:hover { background: var(--zap-forte); border-color: var(--zap-forte); }
  .botao-linha { background: transparent; color: var(--rede); }
  .botao-linha:hover { background: var(--nevoa); color: var(--rede); }
  .icone-zap { fill: currentColor; flex: none; }
  .botao-topo { min-height: 42px; padding: 8px 18px; font-size: 0.95rem; white-space: nowrap; }
  .acoes { display: flex; flex-wrap: wrap; gap: 12px; }

  /* Trilha e topo das paginas */
  .trilha ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 18px; padding: 0; font-size: 0.92rem; color: var(--rede-texto); }
  .trilha li:not(:last-child)::after { content: "/"; margin-inline: 8px; opacity: 0.6; }
  .trilha a { color: #fff; }
  .pagina-topo { background: var(--rede); color: #fff; padding-block: clamp(40px, 6vw, 76px) clamp(36px, 5vw, 60px); position: relative; overflow: hidden; }
  .pagina-topo::after {
    content: ""; position: absolute; inset: auto 0 0 0; height: 6px;
    background: linear-gradient(90deg, var(--par-azul) 0 20%, var(--par-laranja) 20% 40%, var(--par-verde) 40% 60%, var(--par-marrom) 60% 80%, var(--par-ardosia) 80%);
  }
  .pagina-topo h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); max-width: 22ch; }
  .lide { margin-block-start: 18px; font-size: clamp(1.08rem, 1.6vw, 1.25rem); max-width: 44rem; color: var(--rede-texto); }
  .lide strong { color: #fff; }
  .lide a { color: #fff; }
  .data { margin-block-start: 16px; font-size: 0.9rem; color: var(--rede-texto); opacity: 0.85; }

  /* Guia: texto + indice */
  .guia { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: clamp(32px, 5vw, 72px); padding-block: clamp(40px, 6vw, 72px); }
  .guia-lateral { position: relative; }
  .indice { position: sticky; top: 96px; font-size: 0.95rem; border-top: 3px solid var(--rede); padding-top: 14px; }
  .indice p { font-weight: 800; margin-block-end: 8px; }
  .indice ol { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: var(--tinta-2); }
  .indice a { color: var(--tinta); text-decoration: none; }
  .indice a:hover { text-decoration: underline; }
  .texto { max-width: 46rem; min-width: 0; }
  .texto > * + * { margin-block-start: 1.05em; }
  .texto > :first-child { margin-block-start: 0; }
  .texto h2 { margin-block-start: 2.1em; font-size: clamp(1.45rem, 2.4vw, 1.9rem); }
  .texto h3 { margin-block-start: 1.6em; }
  .texto ul, .texto ol { padding-inline-start: 1.3em; }
  .texto li + li { margin-block-start: 0.45em; }
  .texto li::marker { color: var(--rede-2); font-weight: 700; }
  .nota { font-size: 0.95rem; color: var(--tinta-2); }

  /* Passos numerados (sequencia real) */
  .passos { list-style: none; margin: 0; padding: 0; counter-reset: passo; display: grid; gap: 0; }
  .passos > li { counter-increment: passo; position: relative; padding: 0 0 28px 64px; }
  .passos > li::before {
    content: counter(passo); position: absolute; left: 0; top: -2px;
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    background: var(--rede); color: #fff; font-weight: 800;
  }
  .passos > li:not(:last-child)::after { content: ""; position: absolute; left: 20px; top: 44px; bottom: 4px; width: 2px; background: var(--linha); }
  .passos h3 { margin-block-end: 6px; }
  .passos p { color: var(--tinta-2); }

  /* Tabelas */
  .tabela, .rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--linha); border-radius: var(--raio); }
  .tabela table, .rolagem table { min-width: 640px; font-size: 0.95rem; }
  caption { text-align: left; font-weight: 800; padding: 14px 16px; border-bottom: 1px solid var(--linha); }
  th, td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--linha); }
  tbody tr:last-child :is(th, td) { border-bottom: 0; }
  thead th { background: var(--nevoa); font-weight: 800; }
  tbody th { font-weight: 700; }
  .destaque { background: #E6F2EC; }
  thead .destaque { background: var(--zap); color: #fff; }

  /* Perguntas */
  .perguntas { display: grid; border-top: 1px solid var(--linha); }
  .perguntas details { border-bottom: 1px solid var(--linha); }
  .perguntas summary {
    cursor: pointer; list-style: none; padding: 18px 44px 18px 0; position: relative;
    font-weight: 750; font-size: 1.08rem;
  }
  .perguntas summary::-webkit-details-marker { display: none; }
  .perguntas summary::after {
    content: ""; position: absolute; right: 8px; top: 50%; width: 12px; height: 12px;
    border-right: 2.5px solid var(--rede-2); border-bottom: 2.5px solid var(--rede-2);
    translate: 0 -70%; rotate: 45deg; transition: rotate 0.2s ease;
  }
  .perguntas details[open] summary::after { rotate: 225deg; translate: 0 -20%; }
  .resposta { padding: 0 0 20px; color: var(--tinta-2); max-width: 46rem; }
  .resposta > * + * { margin-block-start: 0.8em; }

  /* Lista de posts */
  .lista-posts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 36px 40px; }
  .lista-posts li { display: grid; gap: 8px; align-content: start; padding-top: 16px; border-top: 2px solid var(--tinta); }
  .lista-posts time, .lista-posts .categoria { font-size: 0.88rem; color: var(--tinta-2); }
  .lista-posts h2, .lista-posts h3 { font-size: 1.22rem; }
  .lista-posts h2 a, .lista-posts h3 a { color: var(--tinta); text-decoration: none; }
  .lista-posts h2 a:hover, .lista-posts h3 a:hover { text-decoration: underline; }
  .lista-posts p { color: var(--tinta-2); }

  /* Fecho dos guias */
  .fecho { margin-block-start: 3em; padding: clamp(24px, 4vw, 36px); background: var(--rede); color: #fff; border-radius: var(--raio); }
  .fecho h2 { margin-block-start: 0; color: #fff; }
  .fecho p { color: var(--rede-texto); margin-block: 12px 18px; }
  .fecho a:not(.botao) { color: #fff; }
  .fecho-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 22px; }
  .fecho .botao-linha { color: #fff; border-color: rgb(255 255 255 / 0.5); }
  .fecho .botao-linha:hover { background: var(--rede-2); color: #fff; }

  /* Chamada final */
  .chamada { background: var(--nevoa); padding-block: clamp(48px, 7vw, 88px); border-top: 1px solid var(--linha); }
  .chamada .faixa { display: grid; gap: 20px; justify-items: start; }
  .chamada h2 { max-width: 24ch; }
  .chamada p { color: var(--tinta-2); max-width: 40rem; }

  /* Rodape */
  .rodape { background: var(--rede); color: var(--rede-texto); padding-block: 56px 28px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .rodape a { color: #fff; }
  .rodape-faixa { width: min(100% - 2 * var(--margem), var(--largura)); margin-inline: auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
  .rodape-sobre { display: grid; gap: 14px; justify-items: start; max-width: 28rem; }
  .rodape-marca, .rodape-titulo { color: #fff; font-weight: 800; }
  .rodape-links ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
  .rodape-links a { text-decoration: none; }
  .rodape-links a:hover { text-decoration: underline; }
  .rodape-fim { width: min(100% - 2 * var(--margem), var(--largura)); margin: 40px auto 0; padding-top: 20px; border-top: 1px solid var(--rede-2); font-size: 0.9rem; }

  /* Erro */
  .erro { padding-block: clamp(64px, 10vw, 128px); }
  .erro .faixa { display: grid; gap: 18px; max-width: 44rem; margin-inline: var(--margem) auto; }
  .erro ul { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 6px; }
}

@layer paginas {
  /* Home: abertura com o tronco */
  .abertura { background: var(--rede); color: #fff; overflow: hidden; }
  .abertura .faixa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: center; gap: clamp(28px, 4vw, 56px); padding-block: clamp(48px, 7vw, 96px); }
  .abertura h1 { max-width: 13ch; }
  .abertura-texto { margin-block: 22px 30px; font-size: clamp(1.1rem, 1.7vw, 1.28rem); color: var(--rede-texto); max-width: 34rem; }
  .abertura .botao-linha { color: #fff; border-color: rgb(255 255 255 / 0.5); }
  .abertura .botao-linha:hover { background: var(--rede-2); color: #fff; }

  .tronco { margin: 0; }
  .tronco svg { display: block; width: 100%; overflow: visible; }
  .tronco figcaption { margin-block-start: 10px; font-size: 0.9rem; color: var(--rede-texto); }
  .tronco figcaption a { color: #fff; }
  .t-caixa { fill: var(--rede-2); stroke: #3B6A73; stroke-width: 1.5; }
  .t-cinndi { fill: #fff; }
  .t-rotulo { font: 700 15px var(--fonte); fill: #fff; }
  .t-sub { font: 400 12.5px var(--fonte); fill: var(--rede-texto); }
  .t-cinndi-texto { font: 800 14px var(--fonte); fill: var(--rede); }
  .t-cinndi-sub { font: 500 11.5px var(--fonte); fill: var(--rede-2); }
  .t-feixe { fill: none; stroke-linecap: round; stroke-width: 3.2; }
  .t-capa { fill: none; stroke: #fff; stroke-opacity: 0.18; stroke-width: 26; stroke-linecap: round; }
  .t-fio { fill: none; stroke-width: 3.2; stroke-linecap: round; }
  .t-ponta { stroke: none; }
  .t-uso { font: 700 14.5px var(--fonte); fill: #fff; }
  .c-azul { stroke: var(--par-azul); fill: var(--par-azul); }
  .c-laranja { stroke: var(--par-laranja); fill: var(--par-laranja); }
  .c-verde { stroke: var(--par-verde); fill: var(--par-verde); }
  .c-marrom { stroke: var(--par-marrom); fill: var(--par-marrom); }
  .c-ardosia { stroke: var(--par-ardosia); fill: var(--par-ardosia); }
  .t-fio.c-azul, .t-fio.c-laranja, .t-fio.c-verde, .t-fio.c-marrom, .t-fio.c-ardosia,
  .t-feixe.c-azul, .t-feixe.c-laranja, .t-feixe.c-verde, .t-feixe.c-marrom, .t-feixe.c-ardosia { fill: none; }

  @media (prefers-reduced-motion: no-preference) {
    .js .t-fio { stroke-dasharray: 1; stroke-dashoffset: 1; animation: t-liga 0.9s cubic-bezier(.3,.7,.2,1) forwards; animation-delay: calc(0.35s + var(--i) * 0.12s); }
    .js .t-chega { opacity: 0; animation: t-aparece 0.4s ease forwards; animation-delay: calc(0.9s + var(--i) * 0.12s); }
  }
  @keyframes t-liga { to { stroke-dashoffset: 0; } }
  @keyframes t-aparece { to { opacity: 1; } }

  /* Usos: cada um com a cor do seu par no tronco */
  .usos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 40px; }
  .usos li { display: grid; gap: 10px; align-content: start; padding-top: 18px; border-top: 4px solid var(--cor, var(--tinta)); }
  .usos p { color: var(--tinta-2); }
  .usos a { font-weight: 700; color: var(--tinta); }
  .uso-azul { --cor: var(--par-azul); }
  .uso-laranja { --cor: var(--par-laranja); }
  .uso-verde { --cor: var(--par-verde); }
  .uso-marrom { --cor: var(--par-marrom); }
  .uso-ardosia { --cor: var(--par-ardosia); }
  .uso-rede { --cor: var(--rede-2); }

  /* Integracao: passos + o que conectamos */
  .integra { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
  .conecta h3 { margin-block-end: 14px; }
  .conecta ul { list-style: none; margin: 0 0 26px; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
  .conecta li { padding: 8px 14px; border: 1.5px solid var(--rede); border-radius: 999px; font-weight: 600; font-size: 0.97rem; background: var(--papel); }

  /* Tronco solto x integrado */
  .contraste { background: var(--rede); color: #fff; }
  .contraste .bloco-cabeca p { color: var(--rede-texto); }
  .lados { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 48px); }
  .lado { padding: clamp(22px, 3vw, 32px); border-radius: var(--raio); border: 1px solid var(--rede-2); }
  .lado h3 { margin-block-end: 14px; }
  .lado ul { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 8px; color: var(--rede-texto); }
  .lado-cinndi { background: var(--rede-2); border-color: var(--par-verde); }
  .lado-cinndi ul { color: #fff; }
  .contraste .acoes { margin-block-start: 32px; }
  .contraste .botao-linha { color: #fff; border-color: rgb(255 255 255 / 0.5); }
  .contraste .botao-linha:hover { background: var(--rede-2); color: #fff; }

  .ranking { padding-inline-start: 1.3em; }
  .ranking > li + li { margin-block-start: 1.6em; }
  .ranking h3 { margin-block: 0 8px; }
  .ranking p + p { margin-block-start: 0.8em; }
  .bloco-faq + .bloco-faq { margin-block-start: 48px; }
  .bloco-faq h2 { margin-block-end: 14px; }
}

@media (max-width: 1080px) {
  .menu ul a { padding-inline: 7px; font-size: 0.93rem; }
}

@media (max-width: 980px) {
  .menu-botao {
    display: inline-flex; align-items: center; margin-inline-start: auto;
    min-height: 44px; padding: 8px 16px; border-radius: 999px;
    background: transparent; color: #fff; border: 1.5px solid rgb(255 255 255 / 0.5);
    font: 700 0.95rem var(--fonte); cursor: pointer;
  }
  .menu { display: none; }
  .menu.aberto {
    display: grid; gap: 14px; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--rede); padding: 12px var(--margem) 22px; border-bottom: 1px solid var(--rede-2);
  }
  .menu.aberto ul { flex-direction: column; }
  .menu.aberto ul a { padding: 12px 4px; font-size: 1.05rem; border-bottom: 1px solid var(--rede-2); border-radius: 0; }
  .menu.aberto ul a[aria-current="page"] { box-shadow: none; color: #fff; font-weight: 800; }
  .topo { position: sticky; }
  .topo-faixa { position: static; }
  .abertura .faixa, .integra, .guia { grid-template-columns: 1fr; }
  .guia-lateral:has(#indice-titulo) { order: -1; }
  .indice { position: static; }
  .usos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rodape-faixa { grid-template-columns: 1fr 1fr; }
  .rodape-sobre { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .usos, .lados { grid-template-columns: 1fr; }
  .rodape-faixa { grid-template-columns: 1fr; }
  .acoes .botao { width: 100%; }
  .t-uso { font-size: 20px; }
  .t-detalhe { display: none; }
  .t-rotulo.t-lado { font-size: 17px; }
  .t-sub.t-lado { font-size: 16px; }
  .t-cinndi-texto { font-size: 16px; }
  .t-cinndi-sub { font-size: 14px; }
}

@media (forced-colors: active) {
  .botao { border: 2px solid ButtonText; }
}
