/* OpenNota — site e portal do desenvolvedor.
   Tema núcleo da WTL (wtl.com.br, public/css/wtl.css): mesmas cores e famílias. */

@font-face { font-family: "Archivo"; font-weight: 700; font-display: swap; src: url("/fonts/archivo-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 800; font-display: swap; src: url("/fonts/archivo-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
    /* tokens da WTL */
    --red: #cc0d1b;
    --red-hover: #a90b16;
    --navy: #061833;
    --blue: #00335e;
    --blue-2: #082a63;
    --blue-3: #005dad;
    --blue-soft: #7fb2e8;
    --paper: #f5f8fc;
    --line: rgba(8, 38, 94, .12);
    --text: #1d2c45;
    --text-strong: #061833;
    --muted: #5f6b85;
    --font-head: "Archivo", "Arial Narrow", sans-serif;
    --font-body: "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --shadow-panel: 0 20px 48px rgba(12, 33, 66, .08);
    /* do OpenNota */
    --shell: 1180px;
    --shell-wide: 1320px;
    --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
    margin: 0;
    background: #fff;
    color: var(--text);
    font: 400 17px/1.6 var(--font-body);
    -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--blue-3); text-underline-offset: 3px; }
a:hover { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue-3); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--font-head); color: var(--text-strong); margin: 0; letter-spacing: -0.015em; }
h1 { font-weight: 800; font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.03; letter-spacing: -0.03em; }
h2 { font-weight: 800; font-size: clamp(1.75rem, 3.2vw, 2.5rem); line-height: 1.1; }
h3 { font-weight: 700; font-size: 1.15rem; line-height: 1.3; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: .88em; }

.pular { position: absolute; left: -9999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 10; }
.pular:focus { left: 8px; }
.moldura { max-width: var(--shell); margin: 0 auto; padding: 0 var(--gutter); }
.moldura-larga { max-width: var(--shell-wide); margin: 0 auto; padding: 0 var(--gutter); }

/* botões: vermelho WTL é a ação principal */
.botao {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 0 22px; border-radius: 6px;
    background: var(--red); color: #fff; border: 2px solid var(--red);
    font: 600 1rem/1 var(--font-body); text-decoration: none; white-space: nowrap;
    transition: background-color .15s, border-color .15s;
}
.botao:hover { background: var(--red-hover); border-color: var(--red-hover); color: #fff; }
.botao-contorno { background: transparent; color: var(--navy); border-color: var(--navy); }
.botao-contorno:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.botao-pequeno { min-height: 40px; padding: 0 16px; font-size: .95rem; }
.acoes { display: flex; flex-wrap: wrap; gap: 12px; }

/* topo */
.topo { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(8px)) { .topo { background: rgba(255, 255, 255, .82); backdrop-filter: blur(8px); } }
.topo-linha { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.marca { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.marca-sufixo { font: 600 .95rem/1 var(--font-body); color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.menu { display: flex; align-items: center; gap: 24px; }
.menu a:not(.botao) { color: var(--text-strong); text-decoration: none; font-weight: 500; }
.menu a:not(.botao):hover { color: var(--blue-3); text-decoration: underline; }

/* abertura: o texto à esquerda e a folha da nota à direita */
.abertura { background: var(--paper); border-bottom: 1px solid var(--line); overflow: hidden; }
.abertura-grade { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(32px, 5vw, 72px); align-items: center; padding-top: clamp(48px, 8vw, 104px); padding-bottom: clamp(56px, 8vw, 112px); }
.abertura-texto { display: grid; gap: 28px; }
.abertura-sub { font-size: 1.2rem; line-height: 1.55; max-width: 34em; color: var(--text); }

/* a via por trás da nota, como no símbolo da marca */
.nota-pilha { position: relative; transform: rotate(-1.2deg); }
.nota-pilha::before {
    content: ""; position: absolute; inset: 0;
    background: var(--blue-soft); border-radius: 4px; transform: translate(14px, -14px) rotate(2deg);
}
.nota {
    margin: 0; position: relative; background: #fff;
    border: 1px solid var(--line); border-top: 6px solid var(--navy);
    border-radius: 4px; padding: 28px 28px 24px; box-shadow: var(--shadow-panel);
}
.nota-cabeca { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px dashed var(--line); }
.nota-tipo { font: 700 1.05rem/1.2 var(--font-head); color: var(--text-strong); }
.nota-numero { color: var(--muted); font-size: .95rem; }
.nota-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin: 18px 0 22px; }
.nota-campos dt { font-size: .8rem; color: var(--muted); }
.nota-campos dd { margin: 0; font-weight: 600; color: var(--text-strong); }
.nota-rotulo { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }

/* a chave de acesso: 11 blocos de 4 dígitos, como no DANFE — o elemento memorável */
.chave {
    display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px 14px;
    font: 500 clamp(1.05rem, 2.1vw, 1.45rem)/1.25 var(--font-mono); color: var(--navy);
    letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.chave span { animation: digito .42s cubic-bezier(.2, .7, .2, 1) both; }
.chave span:nth-child(1) { animation-delay: .10s; } .chave span:nth-child(2) { animation-delay: .16s; }
.chave span:nth-child(3) { animation-delay: .22s; } .chave span:nth-child(4) { animation-delay: .28s; }
.chave span:nth-child(5) { animation-delay: .34s; } .chave span:nth-child(6) { animation-delay: .40s; }
.chave span:nth-child(7) { animation-delay: .46s; } .chave span:nth-child(8) { animation-delay: .52s; }
.chave span:nth-child(9) { animation-delay: .58s; } .chave span:nth-child(10) { animation-delay: .64s; }
.chave span:nth-child(11) { animation-delay: .70s; }
@keyframes digito { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }

.selo { margin-top: 22px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font: 400 .85rem/1.3 var(--font-mono); }
.selo span {
    font: 800 .95rem/1 var(--font-head); color: var(--blue-3); letter-spacing: .02em;
    border: 2px solid var(--blue-3); border-radius: 4px; padding: 7px 12px; transform: rotate(-4deg);
    animation: selo .5s cubic-bezier(.2, 1.4, .4, 1) .95s both;
}
@keyframes selo { from { opacity: 0; transform: rotate(-4deg) scale(1.6); } to { opacity: 1; transform: rotate(-4deg) scale(1); } }

/* seções */
.secao { padding: clamp(64px, 9vw, 112px) 0; }
.secao h2 { max-width: 20em; }
.secao-intro { margin-top: 16px; font-size: 1.1rem; max-width: 40em; color: var(--muted); }
.secao-papel { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.codigo-par { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 20px; margin-top: 40px; }
.codigo-legenda { font-weight: 600; color: var(--text-strong); margin-bottom: 8px; }
.codigo {
    margin: 0; background: var(--navy); color: #dbe7f6; border-radius: 6px; padding: 22px 24px;
    font: 400 .9rem/1.6 var(--font-mono); overflow-x: auto; tab-size: 2;
}

.documentos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 48px 0 0; border-top: 2px solid var(--navy); }
.documentos > div { padding: 22px 24px 0 0; }
.documentos > div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.documentos dt { font: 800 1.35rem/1.2 var(--font-head); color: var(--text-strong); }
.documentos dd { margin: 8px 0 0; color: var(--text); }

.vantagens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 56px; margin-top: 40px; }
.vantagens > div { border-top: 1px solid var(--line); padding-top: 20px; }
.vantagens p { margin-top: 8px; }
.vantagens code { background: #e6edf7; padding: 1px 6px; border-radius: 4px; }

/* segurança: fundo navy, a sequência real de verificações */
.secao-escura { background: var(--navy); color: #c9d6e8; }
.secao-escura h2, .secao-escura h3 { color: #fff; }
.secao-escura .secao-intro { color: #9fb2cc; }
.seguranca-grade { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.seguranca-grade > div:first-child { position: sticky; top: 104px; }
.etapas { list-style: none; margin: 0; padding: 0; counter-reset: etapa; }
.etapas li { counter-increment: etapa; position: relative; padding: 0 0 28px 64px; }
.etapas li + li { padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, .12); }
.etapas li::before {
    content: counter(etapa); position: absolute; left: 0; top: 0;
    width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
    background: var(--red); color: #fff; font: 800 1.05rem/1 var(--font-head);
}
.etapas li + li::before { top: 28px; }
.etapas p { margin-top: 6px; }

.sandbox { display: grid; grid-template-columns: minmax(0, 1.2fr) auto; gap: 32px; align-items: end; border: 2px solid var(--navy); border-radius: 8px; padding: clamp(28px, 4vw, 48px); }
.sandbox p { margin-top: 14px; max-width: 40em; }

/* rodapé */
.rodape { background: var(--navy); color: #9fb2cc; padding: 48px 0 40px; }
.rodape-grade { display: grid; grid-template-columns: 1fr auto; gap: 24px 48px; align-items: start; }
.rodape-texto { margin-top: 12px; }
.rodape-links { display: flex; flex-wrap: wrap; gap: 24px; }
.rodape a { color: #fff; }
.rodape-legal { grid-column: 1 / -1; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .9rem; }

/* portal do desenvolvedor */
.pagina-dev { background: #fff; }
.manual-grade { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); padding-top: 40px; padding-bottom: 96px; }
.sumario { position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; font-size: .95rem; }
.sumario summary { font-weight: 600; color: var(--text-strong); cursor: pointer; margin-bottom: 8px; }
.sumario ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.sumario li a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--text); text-decoration: none; }
.sumario li a:hover { border-left-color: var(--red); color: var(--text-strong); }
.sumario-api { margin-top: 24px; font-size: .85rem; color: var(--muted); }
.sumario-api code { color: var(--text-strong); }

.manual { max-width: 860px; min-width: 0; }
.manual > h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: 16px; }
.manual h2 { font-size: 1.75rem; margin: 56px 0 16px; padding-top: 24px; border-top: 2px solid var(--navy); }
.manual h3 { font-size: 1.2rem; margin: 32px 0 10px; }
.manual p, .manual ul, .manual ol { margin: 0 0 16px; }
.manual li { margin: 4px 0; }
.manual blockquote { margin: 0 0 24px; padding: 14px 18px; background: var(--paper); border-left: 4px solid var(--blue-3); color: var(--text); }
.manual blockquote p:last-child { margin-bottom: 0; }
.manual .ancora { margin-left: 8px; color: var(--blue-soft); text-decoration: none; font-weight: 400; opacity: 0; }
.manual h2:hover .ancora, .manual h3:hover .ancora, .manual .ancora:focus { opacity: 1; }
.manual :not(pre) > code { background: #eef3fa; color: var(--text-strong); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
.manual pre { margin: 0 0 20px; background: var(--navy); color: #dbe7f6; border-radius: 6px; padding: 18px 20px; overflow-x: auto; font-size: .88rem; line-height: 1.6; }
.manual pre code { background: none; padding: 0; color: inherit; }
.tabela { overflow-x: auto; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 6px; }
.manual table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.manual th { text-align: left; background: var(--paper); color: var(--text-strong); font-weight: 600; }
.manual th, .manual td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.manual tr:last-child td { border-bottom: 0; }

/* responsivo */
@media (max-width: 960px) {
    .abertura-grade, .seguranca-grade, .codigo-par, .sandbox { grid-template-columns: minmax(0, 1fr); }
    .seguranca-grade > div:first-child { position: static; }
    .nota-pilha { transform: none; margin-right: 14px; margin-top: 14px; }
    .menu a:not(.botao) { display: none; }
    .documentos { grid-template-columns: minmax(0, 1fr); }
    .documentos > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); margin-top: 22px; }
    .manual-grade { grid-template-columns: minmax(0, 1fr); }
    .sumario { position: static; max-height: none; }
    .sumario details:not([open]) summary { margin-bottom: 0; }
}
@media (max-width: 640px) {
    body { font-size: 16px; }
    .vantagens { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .nota { padding: 22px 18px; }
    .nota-campos { grid-template-columns: minmax(0, 1fr); }
    .chave { grid-template-columns: repeat(3, auto); gap: 4px 10px; }
    .rodape-grade { grid-template-columns: minmax(0, 1fr); }
    .marca-sufixo { display: none; }
    .marca img { width: 136px; }
    .topo-linha { min-height: 64px; }
}
@media (prefers-reduced-motion: reduce) {
    .chave span, .selo span { animation: none; }
    .botao { transition: none; }
}

.manual hr { display: none; }
.em-breve h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.1; color: var(--navy); text-wrap: balance; }
.pagina-acesso main { min-height: 50vh; }
