/* ==========================================================================
   HOME — mundo isométrico branco
   ========================================================================== */

html, body {
    margin: 0;
    background: var(--papel);
    color: var(--tinta);
    font-family: var(--f-texto);
    -webkit-font-smoothing: antialiased;
}

html { scroll-behavior: smooth; }

/* Jogando, a página não rola */
body.playing { overflow: hidden; }

#hero {
    position: relative;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}

#top { position: absolute; top: 0; }

#world {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: pan-y;
}

body.panning #world { cursor: grabbing; }
body.playing #world { touch-action: none; }

body.playing,
body.playing #world,
body.playing a,
body.playing button {
    cursor: none;
}

body.playing.touch #world { cursor: default; }
body.playing .cursor-ball { opacity: 0; }

a { color: inherit; }

/* --------------------------------------------------------------------------
   Topo
   -------------------------------------------------------------------------- */
.hud-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 36px 44px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s;
}

.hud-top > * { pointer-events: auto; }

.brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
}

.brand-name {
    font-family: var(--f-titulo);
    font-weight: 700;
    font-size: 1.35rem;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    color: var(--azul);
    line-height: 1;
}

.brand-role {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: var(--track-sub);
    color: var(--cinza);
}

.hud-nav {
    display: flex;
    gap: 28px;
    padding-top: 2px;
}

.hud-nav a {
    font-size: 0.82rem;
    text-decoration: none;
    color: var(--tinta);
    position: relative;
    padding-bottom: 3px;
}

.hud-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    right: 100%;
    bottom: 0;
    height: 1px;
    background: var(--azul);
    transition: right 0.25s;
}

.hud-nav a:hover { color: var(--azul); }
.hud-nav a:hover::after { right: 0; }

body.playing .hud-top { opacity: 0.25; }
body.playing .hud-top:hover { opacity: 1; }

/* --------------------------------------------------------------------------
   Chamada inicial
   -------------------------------------------------------------------------- */
.cta {
    position: absolute;
    left: 50%;
    bottom: 56px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    z-index: 10;
    transition: opacity 0.4s, transform 0.4s;
}

/* Véu branco para a chamada ler bem sobre as maquetes */
.cta::before {
    content: '';
    position: absolute;
    inset: -60px -140px -40px;
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0));
    z-index: -1;
    pointer-events: none;
}

.cta-line {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--tinta);
}

.play-btn {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px;
    border: 1px solid var(--azul);
    background: var(--papel);
    color: var(--azul);
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: var(--track-sub);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.play-btn:hover,
.play-btn:focus-visible {
    background: var(--azul);
    color: var(--papel);
    outline: none;
}

.play-btn svg { transition: transform 0.2s; }
.play-btn:hover svg { transform: translateX(4px); }

.cta-alt {
    margin: 0;
    font-size: 0.72rem;
    color: var(--cinza);
}

.cta-alt a { color: var(--cinza); }
.cta-alt a:hover { color: var(--azul); }

body.playing .cta {
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Rótulos dos projetos
   -------------------------------------------------------------------------- */
#labels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.p-label {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    white-space: nowrap;
    pointer-events: auto;
    padding: 6px 8px;
    will-change: transform;
}

body.playing:not(.touch) .p-label { pointer-events: none; }

.p-title {
    font-family: var(--f-titulo);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    color: var(--azul);
}

.p-cat {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--cinza);
    opacity: 0;
    transition: opacity 0.25s;
}

.p-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--azul);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s, transform 0.25s;
}

.p-hint .key { height: 22px; min-width: 22px; font-size: 9px; }

.p-label:hover .p-cat,
.p-label.near .p-cat { opacity: 1; }

.p-label.near .p-hint {
    opacity: 1;
    transform: none;
}

body.touch .p-hint .key { display: none; }

/* --------------------------------------------------------------------------
   Tutorial (meio tom)
   -------------------------------------------------------------------------- */
#tutorial {
    position: absolute;
    left: 50%;
    bottom: 44px;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 36px;
    color: var(--cinza);
    z-index: 10;
    pointer-events: none;
}

#tutorial::before {
    content: '';
    position: absolute;
    inset: -50px -120px -44px;
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.6s;
}

body.playing #tutorial:not(.collapsed)::before { opacity: 1; }

.tut-step {
    display: none;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s, transform 0.6s;
}

.tut-step.shown { display: flex; }
.tut-step.visible { opacity: 0.62; transform: none; }
.tut-step.done { opacity: 0.25; }

.tut-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.tut-label em {
    font-style: normal;
    opacity: 0.7;
    margin-left: 6px;
}

.keys-arrows {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    grid-template-rows: 30px 30px;
    gap: 3px;
}

.keys-arrows .key[data-k="up"] { grid-column: 2; }
.keys-arrows .key[data-k="left"] { grid-column: 1; grid-row: 2; }
.keys-arrows .key[data-k="down"] { grid-column: 2; grid-row: 2; }
.keys-arrows .key[data-k="right"] { grid-column: 3; grid-row: 2; }

.key-space { min-width: 96px; }
.key-shift { min-width: 64px; }

.tut-marker {
    width: 18px;
    height: 18px;
    border: 1px solid currentColor;
    transform: rotate(45deg) scaleY(0.58);
}

.tut-touch { display: none !important; }
body.touch .tut-touch.shown { display: flex !important; }
body.touch .tut-step:not(.tut-touch) { display: none !important; }

#tutorial.collapsed .tut-step { opacity: 0 !important; }

/* Esc */
#esc-hint {
    position: absolute;
    bottom: 44px;
    right: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--cinza);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
    z-index: 11;
}

body.playing:not(.touch) #esc-hint { opacity: 0.62; }

#exit-touch {
    position: fixed;
    top: 28px;
    right: 22px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--linha);
    border-radius: 50%;
    background: var(--papel);
    color: var(--cinza);
    font-size: 22px;
    line-height: 1;
    display: none;
    z-index: 12;
}

body.playing.touch #exit-touch { display: block; }

/* Transição branca ao entrar num projeto */
#fade {
    position: fixed;
    inset: 0;
    background: var(--papel);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.45s ease;
    z-index: 50;
}

#fade.on { opacity: 1; }

.noscript {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--f-titulo);
    color: var(--azul);
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
    .hud-top {
        padding: 24px 22px;
        flex-direction: column;
        gap: 14px;
    }

    .brand-name { font-size: 1.1rem; }
    .hud-nav { gap: 14px; }
    .hud-nav a, .hud-nav .nav-btn { font-size: 0.76rem; white-space: nowrap; }

    body.playing .hud-top { opacity: 0; pointer-events: none; }

    .cta { bottom: 36px; width: calc(100% - 44px); }
    .cta-line { font-size: 0.82rem; }

    #tutorial {
        bottom: 30px;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* --------------------------------------------------------------------------
   Cabeçalho ao rolar para as seções
   -------------------------------------------------------------------------- */
.hud-top { transition: opacity 0.5s, background-color 0.3s, padding 0.3s, border-color 0.3s, transform 0.35s ease; border-bottom: 1px solid transparent; }
body.header-hidden .hud-top { transform: translateY(-100%); }

body.scrolled .hud-top {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding-top: 20px;
    padding-bottom: 18px;
    border-bottom-color: color-mix(in srgb, var(--linha) 40%, transparent);   /* divisória discreta */
}

/* --------------------------------------------------------------------------
   Arrastar e zoom (fora do jogo)
   -------------------------------------------------------------------------- */
#view-tools {
    position: absolute;
    right: 44px;
    bottom: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
    transition: opacity 0.4s;
}

.view-hint {
    margin-right: 10px;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--cinza);
    opacity: 0.7;
}

#view-tools button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--linha);
    background: var(--papel);
    color: var(--tinta);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

#view-tools button:hover { border-color: var(--azul); color: var(--azul); }

body.playing #view-tools { opacity: 0; pointer-events: none; }
body.touch .view-hint { display: none; }

/* --------------------------------------------------------------------------
   Seções
   -------------------------------------------------------------------------- */
/* Mesma margem lateral do cabeçalho */
.sec {
    scroll-margin-top: 40px;
    padding: 120px 44px 40px;
    box-sizing: border-box;
}

/* Títulos fora da tela: seguem só para leitor de tela */
.sec-head {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Sobre */
.about-grid {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: 64px;
    align-items: start;
}

.about-photo { margin: 0; }
/* PNG em tinta azul com fundo transparente, num quadro branco com borda */
.about-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; display: block; box-sizing: border-box; border: 1px solid var(--azul); background: var(--papel); }

.about-text { max-width: 62ch; font-weight: 300; line-height: 1.7; }
.about-text p { margin: 0 0 18px; }
.about-text .lead { font-family: var(--f-titulo); font-weight: 600; font-size: 1.35rem; line-height: 1.35; color: var(--tinta); }

.facts { list-style: none; padding: 0; margin: 28px 0; }
.facts li { padding-bottom: 12px; font-size: 0.88rem; }
.facts small { display: block; font-size: 0.8rem; color: var(--cinza); }

.about-text .play-btn { margin-top: 10px; }

/* Projetos e soluções: todos os cards numa linha, dividindo a largura em partes iguais */
.cards, .solutions {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 56px 36px;
}

.card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--tinta); }

.card-cover {
    display: block;
    aspect-ratio: 4 / 3;
    margin-bottom: 14px;
    background: var(--imagem);
    overflow: hidden;
}

.card-cover > img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s; }
.card:hover .card-cover > img { transform: scale(1.03); }

.card-title { font-family: var(--f-titulo); font-weight: 700; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--azul); }
.card-sub { font-size: 0.8rem; color: var(--cinza); }
.card:hover .card-title { text-decoration: underline; text-underline-offset: 4px; }
.cards-more { margin-top: 56px; }

/* Soluções */
.sol { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 64px 28px 56px; border: 1px solid var(--linha); text-align: center; text-decoration: none; transition: border-color 0.2s; }
.sol:hover { border-color: var(--azul); }
.sol:hover .card-title { text-decoration: underline; text-underline-offset: 4px; }
.sol-icon { width: 88px; height: 88px; margin-bottom: 22px; color: var(--azul); }
.sol-icon text { font-family: var(--f-titulo); font-weight: 600; }

/* Contato */
/* Fundo acima do botão "Ask" (fixo a 44px do pé, 34px de altura) */
.foot { padding-bottom: 112px; position: relative; }
.foot-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 40px; margin-top: 72px; }
.foot-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px 40px; font-size: 1.05rem; }
.foot-links > * { color: var(--tinta); text-decoration: none; }
.foot-links a:hover { color: var(--azul); }
.foot-fig { display: block; height: 90px; flex-shrink: 0; }
.copy { margin: 0; font-size: 0.7rem; color: var(--cinza); }

/* Escala humana no canto, com a base na mesma linha da base do botão "Ask" (44px do pé) */
@media (min-width: 721px) {
    .foot-row { padding-right: 120px; }
    .foot-fig { position: absolute; right: 44px; bottom: 44px; }
}

/* Tablet: 3 projetos lado a lado ficariam estreitos demais */
@media (max-width: 1000px) {
    .cards { grid-auto-flow: row; }
}

@media (max-width: 720px) {
    .sec { padding: 90px 22px 30px; }
    .foot { padding-bottom: 72px; }
    .about-grid { grid-template-columns: 1fr; gap: 32px; }
    .about-photo { max-width: 200px; }
    .solutions { grid-auto-flow: row; }
    #view-tools { right: 22px; bottom: auto; top: 128px; flex-direction: column; }
    body.scrolled .hud-top { padding-top: 14px; padding-bottom: 12px; }
}

/* --------------------------------------------------------------------------
   Intro: cortina azul (como as duplas azuis do caderno)
   -------------------------------------------------------------------------- */
html.intro-on, html.intro-on body { overflow: hidden; }
html.no-intro #intro { display: none; }

#intro {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--azul);
    color: var(--papel);
    cursor: pointer;
    overflow: hidden;
    transition: transform 1.05s cubic-bezier(0.7, 0, 0.2, 1);
}

/* grade de prancha ao fundo */
#intro::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
}

#intro.lift { transform: translateY(-100%); }

.intro-skip {
    background: none;
    border: none;
    padding: 4px 0;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--f-texto);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    cursor: pointer;
}

.intro-skip:hover { color: var(--papel); }

.intro-stage {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 0 28px;
    text-align: center;
    z-index: 1;
}

.intro-stage.on {
    display: flex;
    animation: intro-in 0.9s ease both;
}

@keyframes intro-in {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.intro-name {
    font-family: var(--f-titulo);
    font-weight: 700;
    font-size: clamp(2.2rem, 7vw, 5.6rem);
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
}

.intro-role {
    min-height: 1.4em;
    white-space: nowrap;         /* a largura muda a cada letra digitada e quebrava a última palavra */
    font-size: clamp(0.8rem, 1.6vw, 1.05rem);
    text-transform: uppercase;
    letter-spacing: var(--track-sub);
    color: var(--azul-claro);
}

.intro-enter {
    margin-top: 26px;
    padding: 15px 38px;
    border: 1px solid var(--papel);
    background: transparent;
    color: var(--papel);
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: var(--track-sub);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.intro-enter svg { transition: transform 0.2s; }
.intro-enter:hover svg, .intro-enter:focus-visible svg { transform: translateX(4px); }
.intro-enter:hover, .intro-enter:focus-visible { background: var(--papel); color: var(--azul); outline: none; }

.intro-title {
    font-family: var(--f-titulo);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    color: var(--azul-claro);
}

.intro-bio {
    max-width: 100ch;            /* três linhas no computador */
    margin: 0;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.6vw, 1.45rem);
    line-height: 1.65;
    min-height: 5em;
    text-wrap: balance;
}

.intro-bio .rest,
.intro-phrase .rest { visibility: hidden; }

/* Cursor de texto com largura zero, para não empurrar as letras */
.intro-bio .caret,
.intro-role .caret,
.intro-phrase .caret {
    border-left: 2px solid currentColor;
    margin: 0 -1px;
    animation: caret-blink 1s steps(1) infinite;
}

.intro-bio.typing .caret,
.intro-role.typing .caret,
.intro-phrase.typing .caret { animation: none; }

@keyframes caret-blink { 50% { opacity: 0; } }

.intro-phrase {
    max-width: 24ch;
    margin: 0;
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: clamp(1.4rem, 3.6vw, 2.8rem);
    line-height: 1.25;
}

.intro-hint {
    position: absolute;
    bottom: 48px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(255, 255, 255, 0.6);
}

.intro-stage[data-stage="who"] .intro-skip { position: absolute; bottom: 20px; }

.intro-stage[data-stage="who"] .intro-hint { opacity: 0; transition: opacity 0.6s; }
#intro.hint-on .intro-stage[data-stage="who"] .intro-hint { opacity: 1; }

/* Botão de tema no cabeçalho */
.hud-nav .nav-btn {
    background: none;
    border: none;
    padding: 0 0 3px;
    font-family: var(--f-texto);
    font-size: 0.82rem;
    color: var(--cinza);
    cursor: pointer;
}

.hud-nav .nav-btn:hover { color: var(--azul); }

/* --------------------------------------------------------------------------
   Chat
   -------------------------------------------------------------------------- */
/* Mesma linha e altura do + e − do mapa (#view-tools) */
#ask-btn {
    position: fixed;
    left: 44px;
    bottom: 44px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 14px 0 10px;
    border: 1px solid var(--linha);
    background: var(--papel);
    color: var(--azul);
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    cursor: pointer;
    transition: border-color 0.2s, opacity 0.3s;
}

#ask-btn img { height: 22px; width: auto; }
#ask-btn:hover, #ask-btn[aria-expanded="true"] { border-color: var(--azul); }

body.playing #ask-btn, html.intro-on #ask-btn { opacity: 0; pointer-events: none; }

/* Caixa que abre do botão, logo acima dele (44 do botão + 34 de altura + 12 de folga) */
#chat {
    position: fixed;
    left: 44px;
    bottom: 90px;
    width: min(400px, calc(100vw - 88px));
    max-height: min(560px, calc(100dvh - 210px));   /* cresce com a conversa; 210: não cobre o nome no topo */
    z-index: 40;
    display: flex;
    flex-direction: column;
    background: var(--papel);
    border: 1px solid var(--linha);
    box-shadow: 8px 12px 32px var(--sombra);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98);
    transform-origin: left bottom;
    transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 0, 0.2, 1), visibility 0s 0.25s;
}

body.chat-open #chat {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 0, 0.2, 1);
}

/* A caminhante em pé na borda de cima, como assinatura */
.chat-fig { position: absolute; bottom: 100%; right: 32px; height: 46px; width: auto; pointer-events: none; }

.chat-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 14px 16px 24px;
}

.chat-title {
    display: block;
    font-family: var(--f-titulo);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    color: var(--azul);
}

.chat-sub { display: block; margin-top: 5px; font-size: 0.75rem; color: var(--cinza); }

#chat-close {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    background: none;
    color: var(--cinza);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

#chat-close:hover { border-color: var(--linha); color: var(--azul); }

#chat-log {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 24px 24px;
    counter-reset: pergunta;
}

.msg {
    position: relative;
    padding-left: 34px;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--tinta);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.msg:first-child { padding-left: 0; color: var(--cinza); }   /* saudação */

/* Caderno: cada pergunta abre um bloco numerado; fio de 1 px com o início marcado em azul de 2 px */
.msg.user {
    counter-increment: pergunta;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--linha);
    font-family: var(--f-titulo);
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--azul);
}

.msg.user::before {
    content: counter(pergunta, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 16px;
    font-size: 0.72rem;
    letter-spacing: var(--track-titulo);
    color: var(--cinza);
}

.msg.user::after { content: ''; position: absolute; left: 0; top: -1px; width: 22px; height: 2px; background: var(--azul); }

.msg.user + .msg { margin-top: -6px; }
.msg.pending, .msg.error { color: var(--cinza); }
.msg.error { font-style: italic; }
.msg a { color: var(--azul); text-underline-offset: 3px; word-break: break-all; }

.msg.pending::after {
    content: '...';
    display: inline-block;
    width: 0;
    overflow: hidden;
    white-space: nowrap;      /* com o pre-wrap da mensagem, cada ponto ia para uma linha */
    vertical-align: bottom;
    animation: chat-dots 1.2s steps(4) infinite;
}

@keyframes chat-dots { to { width: 1.3em; } }

@media (prefers-reduced-motion: reduce) {
    .msg.pending::after { width: auto; animation: none; }
}

.chat-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.chat-suggest[hidden] { display: none; }

.chat-suggest button {
    padding: 8px 12px;
    border: 1px solid var(--linha);
    background: none;
    color: var(--azul);
    font-family: var(--f-texto);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s;
}

.chat-suggest button:hover { border-color: var(--azul); }

#chat-form { display: flex; }

#chat-input {
    flex: 1;
    min-width: 0;
    padding: 16px 12px 16px 24px;
    border: none;
    font-family: var(--f-texto);
    font-size: 0.88rem;
    color: var(--tinta);
    outline: none;
}

#chat-input::placeholder { color: var(--cinza); transition: color 0.2s; }
#chat-input:focus::placeholder { color: var(--linha); }   /* sem a linha azul, é o sinal de campo selecionado */

#chat-form button {
    width: 56px;
    border: none;
    background: none;
    color: var(--azul);
    cursor: pointer;
    transition: color 0.2s;
}

#chat-form button svg { display: block; margin: auto; transition: transform 0.2s; }
#chat-form button:hover svg { transform: translateX(3px); }
#chat-input:placeholder-shown + button { color: var(--cinza); }   /* antes do .busy, que vence no empate */
#chat-form.busy button { color: var(--linha); cursor: wait; }

.chat-note { margin: 0; padding: 0 24px 14px; font-size: 0.66rem; color: var(--cinza); }

@media (max-width: 720px) {
    .intro-bio { font-size: 1rem; }
    #ask-btn { left: auto; right: 16px; bottom: 16px; padding: 0 12px 0 10px; }
    #chat { left: 8px; right: 8px; bottom: 58px; width: auto; max-height: min(560px, calc(100dvh - 130px)); transform-origin: right bottom; }
    .chat-fig { right: auto; left: 24px; }   /* à direita, encostava no zoom do mapa */
}

/* --------------------------------------------------------------------------
   Tema blueprint: as cores da identidade invertidas (fundo azul, traço branco)
   -------------------------------------------------------------------------- */
html.blueprint {
    --papel: #1b40a0;
    --tinta: #ffffff;
    --azul: #ffffff;
    --cinza: #c3cff0;
    --linha: rgba(255, 255, 255, 0.28);
    --imagem: rgba(255, 255, 255, 0.07);
}

/* A intro continua azul com letra branca */
html.blueprint #intro { --papel: #ffffff; --azul: #1b40a0; --azul-claro: #c3cff0; }

html.blueprint body.scrolled .hud-top { background: rgba(27, 64, 160, 0.95); }
html.blueprint .cta::before,
html.blueprint #tutorial::before { background: radial-gradient(closest-side, rgba(27, 64, 160, 0.9), rgba(27, 64, 160, 0)); }
html.blueprint img[src*="escalas/"] { filter: brightness(0) invert(1); }
/* A foto continua azul no quadro branco */
html.blueprint .about-photo { --papel: #ffffff; --azul: #1b40a0; }
#chat-input { background: transparent; }

.hud-nav .theme-toggle[aria-pressed="true"] { color: var(--azul); text-decoration: underline; text-underline-offset: 4px; }

/* --------------------------------------------------------------------------
   Passagem do mapa para a página: esmaecimento branco em arco
   -------------------------------------------------------------------------- */
#hero::after {
    content: '';
    position: absolute;
    left: -15%;
    right: -15%;
    bottom: -1px;
    height: 42vh;
    background: radial-gradient(ellipse 46% 100% at 50% 0%, transparent 70%, var(--papel) 90%);
    pointer-events: none;
    z-index: 4;
}

/* Telas largas: o texto do About se divide em duas colunas e usa as laterais */
@media (min-width: 1100px) {
    /* --photo-w vem do script da home: a foto em 4:5 fica da altura do texto */
    .about-grid { grid-template-columns: var(--photo-w, minmax(220px, 300px)) 1fr; gap: 80px; }
    .about-text {
        max-width: none;
        display: grid;
        grid-template-columns: 1.15fr 1fr;
        column-gap: 64px;
        align-content: start;
    }
    .about-text .lead { grid-column: 1 / -1; max-width: 32ch; font-size: 1.6rem; margin-bottom: 28px; }
    .about-text > p:not(.lead) { grid-column: 1; }
    .about-text .facts { grid-column: 2; grid-row: 2 / span 2; margin-top: 0; }
    .about-text .play-btn { grid-column: 1; justify-self: start; }

}

/* --------------------------------------------------------------------------
   Quadra generativa
   -------------------------------------------------------------------------- */
.gen {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 260px;
    gap: 32px;
    align-items: stretch;
}

.gen-controls { display: flex; flex-direction: column; gap: 26px; }
.gen-controls fieldset { margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 14px; }

.gen-controls legend,
.gen-results h3 {
    margin: 0;
    padding: 0 0 10px;
    font-family: var(--f-titulo);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    color: var(--azul);
}

.gen-types { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
.gen-types legend { width: 100%; }
.gen-types label { flex: 1 1 calc(50% - 3px); cursor: pointer; }
.gen-types input { position: absolute; opacity: 0; pointer-events: none; }

.gen-types span {
    display: block;
    padding: 9px 6px;
    border: 1px solid var(--linha);
    font-size: 0.76rem;
    text-align: center;
    color: var(--cinza);
    transition: border-color 0.15s, color 0.15s;
}

.gen-types label:hover span { border-color: var(--azul); color: var(--azul); }
.gen-types input:checked + span { background: var(--azul); border-color: var(--azul); color: var(--papel); }
.gen-types input:focus-visible + span { outline: 2px solid var(--azul); outline-offset: 2px; }

.gen-range {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    font-size: 0.78rem;
    color: var(--tinta);
    cursor: pointer;
}

.gen-range output { font-family: var(--f-titulo); font-weight: 600; font-size: 0.74rem; color: var(--azul); }

.gen-range input {
    grid-column: 1 / -1;
    width: 100%;
    height: 18px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.gen-range input::-webkit-slider-runnable-track { height: 1px; background: var(--linha); }
.gen-range input::-moz-range-track { height: 1px; background: var(--linha); }

.gen-range input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: none;
    border-radius: 50%;
    background: var(--azul);
}

.gen-range input::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: var(--azul); }
.gen-range input:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

.gen-stage {
    position: relative;
    min-height: 620px;
    border: 1px solid var(--linha);
    overflow: hidden;
}

#gen-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#gen-canvas:active { cursor: grabbing; }

.gen-actions {
    position: absolute;
    top: 18px;
    left: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.gen-btn {
    padding: 12px 22px;
    border: 1px solid var(--azul);
    background: var(--azul);
    color: var(--papel);
    font-family: var(--f-titulo);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-sub);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.gen-btn:hover, .gen-btn:focus-visible { background: var(--papel); color: var(--azul); outline: none; }

.gen-view-hint { position: absolute; left: 18px; right: 230px; bottom: 16px; margin: 0; pointer-events: none; }   /* right: não passa por baixo da escala e dos créditos */
.gen-stage.no-3d #gen-canvas { display: none; }
.gen-stage.no-3d .gen-view-hint { top: 50%; bottom: auto; right: 18px; text-align: center; }

.gen-results h3 { border-bottom: 1px solid var(--linha); }

.gen-results dl { margin: 0; }
.gen-results dt { padding-top: 10px; font-size: 0.68rem; color: var(--cinza); }

.gen-results dd {
    margin: 2px 0 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--linha);
    font-family: var(--f-titulo);
    font-size: 1rem;
    font-weight: 600;
    color: var(--azul);
}

.gen-status { margin: 14px 0 0; font-size: 0.76rem; line-height: 1.5; color: var(--cinza); }
.gen-status[data-status="capped"],
.gen-status[data-status="unreachable"],
.gen-status[data-status="empty"] { color: var(--azul); font-weight: 500; }

@media (max-width: 1240px) {
    .gen { grid-template-columns: 1fr 1fr; }
    .gen-stage { grid-column: 1 / -1; grid-row: 1; min-height: 520px; }
}

@media (max-width: 720px) {
    .gen { grid-template-columns: 1fr; }
    .gen-stage { min-height: 400px; }
    .gen-key { display: none; }
    .gen-view-hint { display: none; }
    .gen-stage.no-3d .gen-view-hint { display: block; }
}

/* Caixas laterais da altura do modelo; o que não cabe rola dentro da caixa */
.gen { grid-template-columns: 340px minmax(0, 1fr) 300px; gap: 16px; }
.gen-controls, .gen-results {
    padding: 20px;
    border: 1px solid var(--linha);
    box-sizing: border-box;
    max-height: max(480px, calc(100vh - 108px));
    overflow: hidden auto;
}
.gen-stage { height: max(480px, calc(100vh - 108px)); min-height: 0; background: var(--papel); }

@media (max-width: 1240px) {
    .gen { grid-template-columns: 1fr 1fr; }
    .gen-stage { height: 520px; min-height: 0; }
    .gen-controls, .gen-results { max-height: none; }
}

@media (max-width: 720px) {
    .gen { grid-template-columns: 1fr; }
    .gen-stage { position: sticky; top: 0; height: 42vh; min-height: 280px; z-index: 5; }
    .hud-nav { gap: 12px; flex-wrap: wrap; }
    .hud-nav a, .hud-nav .nav-btn { font-size: 0.72rem; }
}

/* Terreno real: planta 2D, busca, camadas e condicionantes */
.gen [hidden] { display: none !important; }

#gen-plan { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.gen-stage[data-view="2d"] #gen-canvas,
.gen-stage[data-view="3d"] #gen-plan,
.gen-stage[data-view="3d"] .gen-zoom { display: none; }

.gen-views { display: flex; }
.gen-views button,
.gen-zoom button {
    min-width: 40px;
    padding: 11px 10px;
    border: 1px solid var(--azul);
    background: var(--papel);
    color: var(--azul);
    font-family: var(--f-titulo);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.gen-views button + button { border-left: none; }
.gen-views button[aria-pressed="true"] { background: var(--azul); color: var(--papel); }
.gen-views button:focus-visible,
.gen-zoom button:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }
.gen-stage.no-3d .gen-views { display: none; }

.gen-zoom { position: absolute; right: 18px; top: 18px; display: flex; flex-direction: column; }
.gen-zoom button { font-size: 0.9rem; padding: 6px 0; }
.gen-zoom button + button { border-top: none; }

.gen-mini {
    padding: 9px 14px;
    border: 1px solid var(--azul);
    background: var(--papel);
    color: var(--azul);
    font-family: var(--f-titulo);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.gen-mini:hover, .gen-mini:focus-visible { background: var(--azul); color: var(--papel); outline: none; }

.gen-search { display: flex; }
.gen-search input {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--linha);
    border-right: none;
    background: transparent;
    color: var(--tinta);
    font: inherit;
    font-size: 0.8rem;
}
.gen-search input:focus-visible { outline: 2px solid var(--azul); outline-offset: -1px; }

.gen-note { margin: 0; font-size: 0.74rem; line-height: 1.5; color: var(--cinza); }
.gen-note:empty { display: none; }

.gen-layers { flex-direction: row !important; flex-wrap: wrap; gap: 8px 16px !important; }
.gen-layers legend { width: 100%; }
.gen-layers label { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--tinta); cursor: pointer; }
.gen-layers input { accent-color: var(--azul); margin: 0; }

.gen-load { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); }

.gen-credit { position: absolute; right: 18px; bottom: 16px; font-size: 0.66rem; color: var(--cinza); }
.gen-credit a { color: inherit; }

.gen-site-title { margin-top: 26px !important; }
.gen-results #gen-site dd { font-family: var(--f-texto); font-size: 0.8rem; font-weight: 500; line-height: 1.45; }

/* --------------------------------------------------------------------------
   Background: abas de Skills, Timeline e Extras
   -------------------------------------------------------------------------- */
.bg-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 36px; }

.bg-tab {
    padding: 10px 22px;
    border: 1px solid var(--linha);
    background: none;
    color: var(--cinza);
    font-family: var(--f-titulo);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-titulo);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.bg-tab:hover { border-color: var(--azul); color: var(--azul); }
.bg-tab[aria-selected="true"] { background: var(--azul); border-color: var(--azul); color: var(--papel); }
.bg-tab:focus-visible { outline: 2px solid var(--azul); outline-offset: 2px; }

.bg-panel { min-height: 340px; }
.bg-panel[hidden] { display: none; }

.bg-skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 64px; align-content: start; }

.skill { padding: 14px 0; font-size: 0.86rem; }

.bg-timeline { list-style: none; margin: 0; padding: 0; }

.bg-timeline li {
    display: grid;
    grid-template-columns: 200px 1fr;
    column-gap: 40px;
    padding: 20px 0;
}

.bg-timeline time { grid-row: 1 / span 3; padding-top: 3px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--cinza); }
.bg-timeline strong { font-family: var(--f-titulo); font-weight: 600; font-size: 1rem; color: var(--azul); }
.bg-timeline em { margin-top: 2px; font-style: normal; font-size: 0.76rem; color: var(--cinza); }
.bg-timeline p { max-width: 72ch; margin: 8px 0 0; font-weight: 300; font-size: 0.9rem; line-height: 1.6; }

.bg-extras { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; align-content: start; }
.bg-extras > div { padding: 24px; border: 1px solid var(--linha); }
.bg-extras strong { font-family: var(--f-titulo); font-weight: 600; font-size: 0.95rem; color: var(--azul); }
.bg-extras p { margin: 8px 0 0; font-weight: 300; font-size: 0.86rem; line-height: 1.55; }
@media (max-width: 900px) {
    .bg-skills { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .bg-timeline li { grid-template-columns: 1fr; }
    .bg-timeline time { grid-row: auto; margin-bottom: 6px; }
    .bg-panel { min-height: 0; }
}

.hud-nav a, .hud-nav .nav-btn { white-space: nowrap; }

@media (max-width: 1180px) {
    .view-hint { display: none; }
}
