/*
 * Apresentação institucional. Mesma linguagem da landing e do login:
 * fundo sólido, uma cor de destaque por perfil e movimento só na entrada de cada slide.
 */
:root {
    --bg: #0b1120;
    --surface: #121b30;
    --border: #2a3650;
    --accent: #60a5fa;
    --accent-2: #bfdbfe;
    --action: #2563eb;
    --on-action: #ffffff;
    --text: #f1f5f9;
    --muted: #a3b1c6;
    --font: 'Inter', 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --ease: cubic-bezier(0.23, 1, 0.32, 1);
    color-scheme: dark;
}

/* Perfil policial: grafite com âmbar */
body.deck-policial {
    --bg: #0a0d12;
    --surface: #141a23;
    --border: #333c4a;
    --accent: #fbbf24;
    --accent-2: #fde68a;
    --action: #f5b30b;
    --on-action: #17120a;
    --muted: #b8c0cc;
}

/* Órgão público: azul-petróleo com dourado */
body.deck-orgao {
    --bg: #06141a;
    --surface: #0d2733;
    --border: #244656;
    --accent: #e0b43a;
    --accent-2: #f0d27a;
    --action: #0e7490;
    --on-action: #ffffff;
    --muted: #b3c4cc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    cursor: pointer;
}

a {
    color: inherit;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: 3px;
}

[hidden] {
    display: none !important;
}

/* Marca */
.deck-brand {
    position: absolute;
    top: 3vh;
    right: 5vw;
    left: 5vw;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deck-brand img {
    display: block;
    width: 124px;
    height: 44px;
    object-fit: contain;
    object-position: left center;
}

.deck-brand > span {
    color: var(--muted);
    font: 500 11px var(--mono);
    letter-spacing: 0.16em;
}

/* Palco */
main {
    display: grid;
    height: 100svh;
    padding: 76px 5vw 92px;
    place-items: center;
}

.slide {
    width: min(100%, 1500px);
    max-height: 100%;
    padding: 1.5vh 0;
    animation: slide-enter 0.35s var(--ease) both;
}

/* Tipografia */
h1,
h2,
h3,
p {
    margin-top: 0;
}

.eyebrow {
    margin: 0 0 2.2vh;
    color: var(--accent);
    font: 500 clamp(10px, 0.95vw, 15px) var(--mono);
    letter-spacing: 0.16em;
}

h2 {
    margin-bottom: 4.5vh;
    font-size: clamp(26px, 3.5vw, 62px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

h3 {
    margin-bottom: 1.2vh;
    font-size: clamp(14px, 1.45vw, 25px);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

p {
    line-height: 1.6;
}

.lead {
    color: var(--muted);
    font-size: clamp(16px, 1.6vw, 27px);
}

.caption {
    margin: 2.5vh 0 0;
    color: var(--muted);
    font-size: clamp(12px, 0.95vw, 16px);
}

.closing-line {
    margin: 3.5vh 0 0;
    color: var(--accent);
    font-size: clamp(16px, 1.6vw, 27px);
    font-weight: 500;
}

article p {
    margin: 0;
    color: var(--muted);
    font-size: clamp(13px, 1.25vw, 21px);
}

article > i {
    margin-bottom: 2.6vh;
    color: var(--accent);
    font-size: clamp(22px, 2.4vw, 40px);
}

/* 01 Capa */
.cover {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 5vw;
    align-items: center;
}

h1 {
    margin-bottom: 3vh;
    color: var(--muted);
    font-size: clamp(15px, 1.4vw, 24px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.24em;
}

h1 span {
    display: block;
    margin-top: 2.4vh;
    color: var(--text);
    font-size: clamp(28px, 3.1vw, 56px);
    line-height: 1.06;
    letter-spacing: -0.035em;
}

.cover-image {
    width: 100%;
    max-height: 68vh;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border);
    border-radius: 16px;
    object-fit: cover;
}

.cover-symbol {
    position: relative;
    display: grid;
    max-height: 55vh;
    aspect-ratio: 1;
    place-content: center;
    gap: 2vh;
    border: 1px solid var(--border);
    border-radius: 50%;
    text-align: center;
}

.cover-symbol::before {
    content: '';
    position: absolute;
    inset: 12%;
    border: 1px solid var(--border);
    border-radius: 50%;
}

.cover-symbol span {
    color: var(--accent);
    font-size: clamp(44px, 6vw, 100px);
    font-weight: 800;
}

.cover-symbol div {
    font: clamp(11px, 1.1vw, 18px) var(--mono);
    letter-spacing: 0.2em;
}

/* 02 Desafio: peças soltas, por isso o tracejado */
.fragment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25vw;
}

.fragment-grid article {
    display: flex;
    align-items: center;
    gap: 1.2vw;
    padding: 2.6vh 1.8vw;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.fragment-grid article i {
    flex: none;
    margin: 0;
    color: var(--muted);
    font-size: clamp(16px, 1.5vw, 24px);
}

.fragment-grid h3 {
    margin: 0;
}

/* Pilares (slides 06 e 10) */
.pillars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5vw;
}

.pillars article {
    padding: 4vh 2.2vw;
    border: 1px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 12px;
    background: var(--surface);
}

/* 03 Conexão */
.network {
    position: relative;
    display: grid;
    height: 34vh;
    min-height: 190px;
    align-content: space-around;
}

.network svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.network path {
    fill: none;
    stroke: var(--accent);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    stroke-width: 2;
}

.network path.revealed {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s var(--ease);
}

.network-core {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: grid;
    width: 9vw;
    min-width: 86px;
    aspect-ratio: 1;
    place-items: center;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--surface);
    font-size: clamp(22px, 2.4vw, 42px);
    letter-spacing: 0.04em;
    transform: translate(-50%, -50%);
}

.network-pair {
    position: relative;
    display: flex;
    justify-content: space-between;
}

.network-pair span {
    min-width: 23%;
    padding: 1.5vh 3vw;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    font-size: clamp(16px, 1.5vw, 26px);
    font-weight: 500;
    text-align: center;
}

/* Etapas reveladas a cada avanço */
[data-step]:not(.revealed) {
    visibility: hidden;
    opacity: 0;
    transform: translateY(12px);
}

[data-step].revealed {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

/* 04 Ciclo */
.cycle {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.2vw;
    margin: 5vh 0 4vh;
    padding: 0;
    list-style: none;
}

.cycle li {
    position: relative;
    padding-top: 3vh;
    border-top: 2px solid var(--border);
}

.step-number {
    display: block;
    margin-bottom: 2vh;
    color: var(--muted);
    font: clamp(22px, 2.4vw, 42px) var(--mono);
}

.cycle h3 {
    font-size: clamp(14px, 1.35vw, 23px);
}

.cycle i {
    position: absolute;
    top: 4vh;
    right: 0;
    color: var(--muted);
}

.cycle li:last-child i {
    display: none;
}

.cycle li.is-current,
.cycle li.is-done {
    border-top-color: var(--accent);
}

.cycle li.is-current .step-number,
.cycle li.is-done .step-number {
    color: var(--accent);
}

.cycle li.is-done .step-number::after {
    content: ' ✓';
    font-size: 0.6em;
}

.information-track {
    position: relative;
    display: flex;
    gap: 15px;
    padding: 2vh 0;
    border-bottom: 2px solid var(--border);
    color: var(--accent-2);
    font-size: clamp(14px, 1.35vw, 23px);
    container-type: inline-size;
}

.information-progress {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(var(--p, 0.1667));
    transform-origin: left;
    transition: transform 0.3s var(--ease);
}

.information-track > .information-doc {
    position: absolute;
    bottom: 4px;
    left: 0;
    font-size: clamp(14px, 1.4vw, 22px);
    transform: translateX(calc(var(--p, 0.1667) * (100cqw - 1.2em)));
    transition: transform 0.3s var(--ease);
}

/* 05 Interface */
.interface-slide {
    display: grid;
    grid-template-columns: 0.8fr 1.4fr;
    gap: 3vw;
    align-items: center;
}

.interface-slide h2 {
    font-size: clamp(24px, 3vw, 50px);
}

.browser-frame {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}

.browser-frame figcaption {
    display: flex;
    gap: 2vw;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font: 12px var(--mono);
}

.browser-frame img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 57vh;
    object-fit: contain;
}

/* 07 Operação */
.operation {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 2vw;
    align-items: center;
}

.operation article {
    padding: 3vh 2vw;
    border-left: 2px solid var(--accent);
}

.operation > span {
    color: var(--muted);
    font-size: clamp(20px, 2vw, 32px);
}

/* 08 Documentos */
.document-flow {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5vw;
    padding-bottom: 4vh;
    border-bottom: 2px solid var(--accent);
}

.document-flow article {
    padding: 2vh 1vw 2vh 0;
}

/* 09 Resultados */
.results {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 5vw;
    align-items: center;
}

.results-target {
    color: var(--accent);
    font-size: clamp(100px, 15vw, 240px);
    text-align: center;
}

.results-list article {
    display: flex;
    gap: 2vw;
    padding: 2.4vh 0;
    border-bottom: 1px solid var(--border);
}

.results-list article > span {
    color: var(--accent);
    font: clamp(16px, 1.5vw, 24px) var(--mono);
}

.results-list h3 {
    margin-bottom: 5px;
}

/* 11 Ecossistema */
.ecosystem {
    display: grid;
    grid-template-columns: 0.6fr 2fr;
    gap: 4vw;
    align-items: center;
}

.ecosystem > strong {
    display: grid;
    aspect-ratio: 1;
    place-items: center;
    border: 2px solid var(--accent);
    border-radius: 50%;
    background: var(--surface);
    font-size: clamp(36px, 4.4vw, 72px);
    letter-spacing: 0.04em;
}

.ecosystem-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3vh 2vw;
}

.ecosystem-groups article {
    padding: 1vh 2vw;
    border-left: 2px solid var(--accent);
}

/* 12 Encerramento */
.closing h2 {
    font-size: clamp(36px, 5.2vw, 90px);
}

.closing-actions {
    display: flex;
    align-items: center;
    gap: 3vw;
    margin-top: 5vh;
    font-size: clamp(14px, 1.3vw, 22px);
}

.closing-actions a:not(.primary-link) {
    color: var(--muted);
    text-underline-offset: 0.3em;
}

.closing-actions a:not(.primary-link):hover {
    color: var(--text);
}

.primary-link {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 16px 26px;
    border-radius: 10px;
    background: var(--action);
    color: var(--on-action);
    font-weight: 600;
    text-decoration: none;
    transition: filter 0.15s var(--ease);
}

.primary-link:hover {
    filter: brightness(1.1);
}

/* Controles */
.controls {
    position: fixed;
    bottom: 24px;
    left: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    transform: translateX(-50%);
    transition: opacity 0.2s var(--ease);
}

.controls button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s var(--ease);
}

.controls button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.controls button:disabled {
    cursor: default;
    opacity: 0.35;
}

.controls.is-idle {
    opacity: 0;
    pointer-events: none;
}

.controls:focus-within {
    opacity: 1;
    pointer-events: auto;
}

#slide-count {
    min-width: 62px;
    color: var(--muted);
    font: 12px var(--mono);
    text-align: center;
    white-space: nowrap;
}

.control-divider {
    width: 1px;
    height: 20px;
    margin: 0 6px;
    background: var(--border);
}

kbd {
    margin-left: 6px;
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    font: 10px var(--mono);
}

#progress {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    border: 0;
    background: var(--surface);
    appearance: none;
}

#progress::-webkit-progress-bar {
    background: var(--surface);
}

#progress::-webkit-progress-value {
    background: var(--accent);
    transition: width 0.3s var(--ease);
}

#progress::-moz-progress-bar {
    background: var(--accent);
}

/* Painéis (resumo e ajuda) */
dialog {
    width: min(650px, 90vw);
    max-height: 80svh;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

dialog p {
    color: var(--muted);
}

.dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.dialog-heading h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.02em;
}

.dialog-heading button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 26px;
    line-height: 1;
}

.dialog-heading button:hover {
    background: rgba(255, 255, 255, 0.08);
}

#slide-menu {
    display: grid;
    gap: 6px;
}

#slide-menu button {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    text-align: left;
    transition: border-color 0.15s var(--ease);
}

#slide-menu button:hover {
    border-color: var(--muted);
}

#slide-menu button[aria-current='step'] {
    border-color: var(--accent);
    color: var(--accent);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.no-script {
    position: fixed;
    bottom: 100px;
    left: 5vw;
    z-index: 8;
    padding: 12px;
    background: var(--surface);
}

/* Movimento: entrada do slide e dos blocos; nada fica em laço */
@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
}

@keyframes snap-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
}

@keyframes snap-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
}

@keyframes slide-enter-forward {
    from {
        opacity: 0;
        transform: translateX(var(--shift, 32px));
    }
}

@keyframes slide-enter-backward {
    from {
        opacity: 0;
        transform: translateX(calc(var(--shift, 32px) * -1));
    }
}

@keyframes slide-enter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
}

#presentation[data-direction='forward'] .slide {
    animation-name: slide-enter-forward;
}

#presentation[data-direction='backward'] .slide {
    animation-name: slide-enter-backward;
}

.network-pair.revealed span:first-child {
    animation: snap-left 0.4s var(--ease) both;
}

.network-pair.revealed span:last-child {
    animation: snap-right 0.4s var(--ease) both;
}

.fragment-grid article,
.pillars article,
.operation article,
.document-flow article,
.results-list article,
.results-target,
.browser-frame,
.cover-image,
.cover-symbol,
.closing > * {
    animation: rise 0.45s var(--ease) both;
}

.cover-image,
.cover-symbol,
.browser-frame,
.fragment-grid article:nth-child(2),
.pillars article:nth-child(2),
.document-flow article:nth-child(2),
.results-list article:nth-child(2),
.closing > :nth-child(2) {
    animation-delay: 0.08s;
}

.fragment-grid article:nth-child(3),
.pillars article:nth-child(3),
.document-flow article:nth-child(3),
.results-list article:nth-child(3),
.operation article:nth-of-type(2),
.closing > :nth-child(3) {
    animation-delay: 0.16s;
}

.fragment-grid article:nth-child(4),
.document-flow article:nth-child(4),
.closing > :nth-child(4) {
    animation-delay: 0.24s;
}

.fragment-grid article:nth-child(5),
.operation article:nth-of-type(3) {
    animation-delay: 0.32s;
}

.fragment-grid article:nth-child(6) {
    animation-delay: 0.4s;
}

/* Celular */
@media (max-width: 760px) {
    .cover-image {
        display: none;
    }
}

@media (max-width: 700px) {
    .slide {
        --shift: 20px;
        padding: 20px 0;
    }

    .deck-brand > span {
        font-size: 8px;
    }

    .deck-brand img {
        width: 84px;
        height: 32px;
    }

    main {
        height: auto;
        min-height: 100svh;
        padding: 70px 5vw 100px;
    }

    .cover,
    .interface-slide {
        grid-template-columns: 1fr;
    }

    .cover-symbol {
        display: none;
    }

    h1 span {
        font-size: 34px;
    }

    h2 {
        margin-bottom: 24px;
        font-size: 30px;
    }

    .fragment-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .fragment-grid article {
        gap: 10px;
        padding: 14px 12px;
    }

    .pillars {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .pillars article {
        display: grid;
        grid-template-columns: 45px 1fr;
        column-gap: 12px;
        padding: 16px;
    }

    .pillars article > i {
        grid-row: span 2;
        margin: 0;
    }

    .pillars h3 {
        margin: 0 0 6px;
    }

    .cycle {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
        margin: 25px 0;
    }

    .cycle li {
        padding-top: 15px;
    }

    .step-number {
        margin-bottom: 10px;
        font-size: 26px;
    }

    .cycle i {
        top: 24px;
    }

    .operation {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .operation article {
        padding: 10px 20px;
    }

    .operation article > i {
        float: left;
        margin: 0 20px 0 0;
    }

    .operation > span {
        display: none;
    }

    .document-flow {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .results {
        grid-template-columns: 1fr;
    }

    .results-target {
        display: none;
    }

    .ecosystem {
        grid-template-columns: 1fr;
    }

    .ecosystem > strong {
        display: none;
    }

    .ecosystem-groups {
        gap: 18px;
    }

    .closing-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 25px;
    }

    .controls {
        width: calc(100% - 16px);
        justify-content: center;
        gap: 0;
        padding: 6px 2px;
    }

    .controls button {
        padding: 8px 7px;
        font-size: 12px;
    }

    #slide-count {
        min-width: 54px;
    }

    .controls kbd,
    .control-divider {
        display: none;
    }

    .browser-frame img {
        max-height: none;
    }

    .network-pair span {
        min-width: 29%;
        padding: 14px;
        font-size: 14px;
    }
}

/* Telas baixas (notebook em tela cheia, projetor 16:9 pequeno) */
@media (max-height: 650px) and (min-width: 701px) {
    main {
        padding-top: 60px;
        padding-bottom: 80px;
    }

    h2 {
        margin-bottom: 20px;
        font-size: clamp(26px, 3.3vw, 46px);
    }

    .eyebrow {
        margin-bottom: 12px;
    }

    .pillars article {
        padding: 20px;
    }

    .cycle {
        margin: 25px 0;
    }

    .closing-line {
        margin-top: 20px;
    }

    article > i {
        margin-bottom: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
