/* Cores da marca e do tema. --cor-principal é o azul-marinho da marca (fixo); as outras mudam no tema escuro
   (scripts/theme.js), que é o palco da vitrine da VR: fundo azul-noite, textos claros e o azul da marca mais vivo.
   --vidro é a cor dos painéis translúcidos (cada um com a sua transparência, em color-mix), --superficie a dos
   opacos (cartão escolhido, botão apertado) e --botao a dos botões cheios. --ponto-* são o fundo, o título e o texto do
   cartão de um ponto de informação, que fica sobre a caldeira e o céu: no escuro, fundo mais fechado e textos bem claros,
   para lerem tão bem quanto no claro. */
:root {
    --cor-principal: #11387f;
    --branco: #fff;
    --gutter: 32px;
    --theme-time: 1.2s;
    --texto: #11387f;
    --texto-suave: #55627a;
    --cor-secundaria: #007fc8;
    --cinza1: #847770;
    --linha: #c5c9d0;
    --linha-suave: #dde0e5;
    --vidro: #fff;
    --superficie: #fff;
    --cartao: rgba(250, 250, 250, .97);
    --botao: #11387f;
    --botao-hover: #007fc8;
    --fundo-1: #e1e1e1;
    --fundo-2: #e7e7e7;
    --fundo-3: #ededed;
    --fundo-4: #f3f1f1;
    --fundo-brilho: rgba(255, 255, 255, .55);
    --ponto-fundo: rgba(255, 255, 255, .96);
    --ponto-titulo: #11387f;
    --ponto-texto: #55627a;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --texto: #dbe5f3;
    --texto-suave: #93a9cc;
    --cor-secundaria: #3aa9ff;
    --cinza1: #5d6f8e;
    --linha: #2b3e5f;
    --linha-suave: #1d2c48;
    --vidro: #12244a;
    --superficie: #15294f;
    --cartao: rgba(9, 20, 42, .96);
    --botao: #007fc8;
    --botao-hover: #1f93df;
    --fundo-1: #050a17;
    --fundo-2: #07101f;
    --fundo-3: #0a1529;
    --fundo-4: #0f1b36;
    --fundo-brilho: rgba(28, 53, 102, .5);
    --ponto-fundo: rgba(7, 15, 33, .97);
    --ponto-titulo: #f4f7fc;
    --ponto-texto: #cad7ea;
    color-scheme: dark;
}

/* A troca de tema anima as próprias variáveis: registradas como cor, elas passam de um valor ao outro e tudo o que as usa
   acompanha (o cenário 3D muda no mesmo tempo, em scripts/theme.js). */
@property --texto { syntax: '<color>'; inherits: true; initial-value: #11387f; }
@property --texto-suave { syntax: '<color>'; inherits: true; initial-value: #55627a; }
@property --cor-secundaria { syntax: '<color>'; inherits: true; initial-value: #007fc8; }
@property --cinza1 { syntax: '<color>'; inherits: true; initial-value: #847770; }
@property --linha { syntax: '<color>'; inherits: true; initial-value: #c5c9d0; }
@property --linha-suave { syntax: '<color>'; inherits: true; initial-value: #dde0e5; }
@property --vidro { syntax: '<color>'; inherits: true; initial-value: #fff; }
@property --superficie { syntax: '<color>'; inherits: true; initial-value: #fff; }
@property --cartao { syntax: '<color>'; inherits: true; initial-value: rgba(250, 250, 250, .97); }
@property --botao { syntax: '<color>'; inherits: true; initial-value: #11387f; }
@property --botao-hover { syntax: '<color>'; inherits: true; initial-value: #007fc8; }
@property --fundo-1 { syntax: '<color>'; inherits: true; initial-value: #e1e1e1; }
@property --fundo-2 { syntax: '<color>'; inherits: true; initial-value: #e7e7e7; }
@property --fundo-3 { syntax: '<color>'; inherits: true; initial-value: #ededed; }
@property --fundo-4 { syntax: '<color>'; inherits: true; initial-value: #f3f1f1; }
@property --fundo-brilho { syntax: '<color>'; inherits: true; initial-value: rgba(255, 255, 255, .55); }
@property --ponto-fundo { syntax: '<color>'; inherits: true; initial-value: rgba(255, 255, 255, .96); }
@property --ponto-titulo { syntax: '<color>'; inherits: true; initial-value: #11387f; }
@property --ponto-texto { syntax: '<color>'; inherits: true; initial-value: #55627a; }
:root {
    transition-property: --texto, --texto-suave, --cor-secundaria, --cinza1, --linha, --linha-suave, --vidro, --superficie,
        --cartao, --botao, --botao-hover, --fundo-1, --fundo-2, --fundo-3, --fundo-4, --fundo-brilho,
        --ponto-fundo, --ponto-titulo, --ponto-texto;
    transition-duration: var(--theme-time);
    transition-timing-function: ease-in-out;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
    background:
        radial-gradient(ellipse 40% 34% at 50% 40%, var(--fundo-brilho), transparent 100%),
        linear-gradient(180deg, var(--fundo-1) 0%, var(--fundo-2) 22%, var(--fundo-3) 55%, var(--fundo-4) 100%);
    font-family: 'Alfa Laval', 'Helvetica Neue', Arial, sans-serif;
    color: var(--texto);
    -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
i, em { font-style: normal; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--cor-secundaria); outline-offset: 4px; }
::selection { color: var(--branco); background: var(--cor-secundaria); }

svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- palco ---------- */
#app {
    position: relative;
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(320px, 400px) 1fr 300px;
    grid-template-rows: 84px 1fr auto;
    grid-template-areas:
        "top  top    top"
        "hero center boilers"
        "hint center boilers";
    column-gap: 28px;
    padding: 0 var(--gutter) 28px;
}

#app > :not(#viewer) { z-index: 1; }

#viewer { position: absolute; inset: 0; z-index: 0; }
#viewer canvas { display: block; cursor: grab; touch-action: none; outline: none; opacity: 0; transition: opacity .5s ease; }
#viewer canvas:active { cursor: grabbing; }
#app[data-state="ready"] #viewer canvas { opacity: 1; }

/* ---------- pontos de informação no modelo ---------- */
#hotspots { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
#app:not([data-state="ready"]) #hotspots { visibility: hidden; }

.hotspot {
    position: absolute; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px;
    display: grid; place-items: center; border-radius: 50%; pointer-events: auto;
    color: var(--branco); background: var(--cor-secundaria); border: 2px solid var(--branco);
    box-shadow: 0 4px 14px rgba(17, 56, 127, .3);
    transition: opacity .15s linear, background-color .2s ease;
}
.hotspot::before {
    content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 1px solid var(--cor-secundaria);
    animation: hotspot-pulse 2.4s ease-out infinite;
}
.hotspot svg { width: 14px; height: 14px; stroke-width: 2; transition: transform .2s ease; }
.hotspot:hover, .hotspot[aria-expanded="true"] { background: var(--botao); }
.hotspot[aria-expanded="true"]::before { animation: none; border-color: var(--botao); }
.hotspot[aria-expanded="true"] svg { transform: rotate(45deg); }
.hotspot[data-hidden] { pointer-events: none; }

@keyframes hotspot-pulse {
    0% { transform: scale(.75); opacity: 1; }
    100% { transform: scale(1.45); opacity: 0; }
}

.hotspot-card {
    position: absolute; left: 0; top: 0; width: min(270px, calc(100% - 16px)); padding: 18px 20px 20px;
    pointer-events: auto; background: var(--ponto-fundo); backdrop-filter: blur(8px);
    border: 1px solid var(--linha-suave); border-left: 3px solid var(--cor-secundaria);
    box-shadow: 0 14px 36px rgba(17, 56, 127, .14);
}
/* No escuro, uma borda que separa o cartão do céu e uma sombra preta (a azul não aparece no fundo escuro). */
:root[data-theme="dark"] .hotspot-card {
    border-color: var(--linha); border-left-color: var(--cor-secundaria); box-shadow: 0 14px 36px rgba(0, 0, 0, .5);
}
.hotspot-card h3 {
    padding-right: 24px; font-size: 13px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
    color: var(--ponto-titulo);
}
.hotspot-card p { margin-top: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ponto-texto); }
.hotspot-card__close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; display: grid; place-items: center; }
.hotspot-card__close:hover { color: var(--cor-secundaria); }
.hotspot-card__close svg { width: 18px; height: 18px; }

/* ---------- cabeçalho ---------- */
.topbar { grid-area: top; display: flex; align-items: center; gap: 48px; }

.brand { display: flex; align-items: center; gap: 18px; text-decoration: none; color: inherit; }
.brand img { height: 32px; display: block; transition: filter var(--theme-time) ease-in-out; }
:root[data-theme="dark"] .brand img { filter: brightness(0) invert(1); }
.brand__text { display: flex; flex-direction: column; gap: 5px; padding-left: 18px; border-left: 1px solid var(--linha); line-height: 1; }
.brand__text b { font-weight: 700; font-size: 14px; letter-spacing: .38em; }
.brand__text span { font-weight: 400; font-size: 9.5px; letter-spacing: .42em; color: var(--texto-suave); }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 24px; }

/* Seletor de idioma: mostra o código (EN, PT, ES) e abre a lista nativa do <select>, invisível por cima. */
.language {
    position: relative; display: flex; align-items: center; gap: 7px; height: 44px; cursor: pointer;
    font-size: 11.5px; font-weight: 700; letter-spacing: .14em; color: var(--texto);
    transition: color .2s ease;
}
.language:hover { color: var(--cor-secundaria); }
.language:has(select:focus-visible) { outline: 2px solid var(--cor-secundaria); outline-offset: 4px; }
.language svg { width: 18px; height: 18px; }
.language .language__chevron { width: 9px; height: 6px; stroke-width: 1.8; }
.language select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; font: inherit; }

/* Tema claro ou escuro (scripts/theme.js): a lua no claro e o sol no escuro, que giram e trocam de lugar junto com a
   transição das cores. */
.theme-toggle {
    position: relative; width: 44px; height: 44px; display: grid; place-items: center; margin: 0 -10px;
    color: var(--texto); transition: color .2s ease;
}
.theme-toggle:hover { color: var(--cor-secundaria); }
.theme-toggle svg {
    grid-area: 1 / 1; width: 19px; height: 19px;
    transition: transform var(--theme-time) cubic-bezier(.65, 0, .35, 1), opacity calc(var(--theme-time) / 2) ease;
}
.theme-toggle__sun { opacity: 0; transform: rotate(-120deg) scale(.4); }
:root[data-theme="dark"] .theme-toggle__moon { opacity: 0; transform: rotate(120deg) scale(.4); }
:root[data-theme="dark"] .theme-toggle__sun { opacity: 1; transform: none; transition-delay: 0s, calc(var(--theme-time) / 4); }
:root[data-theme="light"] .theme-toggle__moon { transition-delay: 0s, calc(var(--theme-time) / 4); }

.cta {
    height: 44px; padding: 0 22px 0 24px; display: flex; align-items: center; gap: 10px;
    background: var(--botao); color: var(--branco);
    font-size: 11px; font-weight: 700; letter-spacing: .14em; text-decoration: none;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    transition: background-color .2s ease;
}
.cta:hover { background: var(--botao-hover); }
.cta svg { width: 16px; height: 16px; stroke-width: 1.8; }

/* ---------- painel do modelo ---------- */
#hero { grid-area: hero; align-self: start; padding-top: 28px; pointer-events: none; }
#hero :is(a, button) { pointer-events: auto; }

.crumb { font-size: 11px; font-weight: 400; letter-spacing: .2em; color: var(--texto-suave); }
.crumb i { color: var(--cor-secundaria); margin: 0 4px; }
.crumb b { font-weight: 700; color: var(--texto); }

.kicker { margin-top: 34px; font-size: 12px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--cor-secundaria); }

#name {
    display: flex; align-items: flex-end; gap: 16px; margin-top: 10px;
    font-weight: 700; font-size: clamp(56px, 5.4vw, 92px); line-height: .88; letter-spacing: .01em;
    text-transform: uppercase;
}
#name .slash { flex: none; width: 14px; height: .62em; margin-bottom: .1em; background: var(--cor-secundaria); transform: skewX(-22deg); }

.subtitle { min-height: 22px; margin-top: 12px; font-weight: 700; font-size: 18px; letter-spacing: .06em; color: var(--texto-suave); }

.rule { display: block; height: 1px; margin: 26px 0 22px; background: linear-gradient(90deg, var(--linha), transparent); }

.stats { display: flex; gap: 40px; }
.stats dt { font-size: 10.5px; font-weight: 400; letter-spacing: .2em; color: var(--texto-suave); }
.stats dd { margin-top: 4px; font-weight: 700; font-size: 34px; line-height: 1; }
.stats small { margin-left: 5px; font-size: 13px; letter-spacing: .06em; color: var(--texto-suave); }

.description { margin-top: 22px; max-width: 34ch; font-size: 14px; line-height: 1.55; color: var(--texto-suave); }

.actions { display: inline-grid; gap: 10px; margin-top: 28px; }

.link {
    display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 13px 18px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .16em; color: var(--texto); text-decoration: none;
    border: 1px solid var(--linha); background: color-mix(in srgb, var(--vidro) 45%, transparent); backdrop-filter: blur(6px);
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.link:hover { color: var(--cor-secundaria); border-color: var(--cor-secundaria); background: color-mix(in srgb, var(--vidro) 80%, transparent); }
.link svg { width: 14px; height: 10px; }
.link--primary { color: var(--branco); background: var(--botao); border-color: var(--botao); }
.link--primary:hover { color: var(--branco); background: var(--botao-hover); border-color: var(--botao-hover); }
.link--primary svg { width: 16px; height: 16px; }

.hint {
    grid-area: hint; align-self: end; display: flex; align-items: center; gap: 14px; pointer-events: none;
    font-size: 10.5px; font-weight: 400; letter-spacing: .18em; line-height: 1.75; color: var(--texto-suave);
}
.hint span { white-space: pre-line; }
.hint svg { flex: none; width: 24px; height: 24px; color: var(--texto); }

/* ---------- área central (sobre o 3D) ---------- */
#center { grid-area: center; position: relative; display: grid; grid-template-rows: auto 1fr auto; pointer-events: none; }
#center::before {
    content: ''; position: absolute; inset: 8px 0 0; pointer-events: none;
    --c: linear-gradient(var(--linha), var(--linha));
    background:
        var(--c) top left / 18px 1px, var(--c) top left / 1px 18px,
        var(--c) top right / 18px 1px, var(--c) top right / 1px 18px,
        var(--c) bottom left / 18px 1px, var(--c) bottom left / 1px 18px,
        var(--c) bottom right / 18px 1px, var(--c) bottom right / 1px 18px;
    background-repeat: no-repeat;
}

#tools { justify-self: end; display: flex; gap: 6px; margin: 22px 14px 0 0; pointer-events: auto; }
#tools button {
    width: 42px; height: 42px; display: grid; place-items: center;
    background: color-mix(in srgb, var(--vidro) 55%, transparent); border: 1px solid var(--linha); backdrop-filter: blur(6px);
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}
#tools button:hover { color: var(--cor-secundaria); background: var(--superficie); }
#tools button[aria-pressed="true"] { color: var(--cor-secundaria); border-color: var(--cor-secundaria); background: var(--superficie); }
#tools svg { width: 20px; height: 20px; }

#loading {
    grid-row: 2; align-self: center; justify-self: center; display: grid; justify-items: center; gap: 14px;
    font-size: 11.5px; font-weight: 400; letter-spacing: .24em; text-align: center;
}
#app:not([data-state="loading"], [data-state="failed"]) #loading { display: none; }
.loading__mark { width: 22px; height: 22px; border: 2px solid var(--cor-secundaria); animation: spin 1.6s cubic-bezier(.6, 0, .4, 1) infinite; }
.loading__bar { width: 240px; height: 2px; background: var(--linha); overflow: hidden; }
.loading__bar i { display: block; height: 100%; background: var(--cor-secundaria); transform: scaleX(0); transform-origin: left; transition: transform .15s linear; }
#loading-percent { font-weight: 700; font-size: 24px; letter-spacing: .04em; }
#retry {
    display: none; pointer-events: auto; padding: 12px 18px; border: 1px solid var(--texto);
    font-size: 11px; font-weight: 700; letter-spacing: .16em;
}
#retry:hover { color: var(--branco); background: var(--botao); border-color: var(--botao); }
#app[data-state="failed"] #retry { display: block; }
#app[data-state="failed"] :is(.loading__bar, #loading-percent) { display: none; }
#app[data-state="failed"] .loading__mark { animation: none; border-color: var(--cinza1); transform: rotate(45deg); }

@keyframes spin { to { transform: rotate(360deg); } }

.bottom { grid-row: 3; justify-self: center; display: grid; justify-items: center; gap: 16px; padding: 0 24px 6px; }

#model-title { display: flex; align-items: center; gap: 20px; font-size: 13px; font-weight: 700; letter-spacing: .45em; white-space: nowrap; }
#model-title i { width: 52px; height: 1px; background: var(--linha); }
#model-title em { font-weight: 400; letter-spacing: 2px; color: var(--cinza1); margin: 0 12px 0 0; }
#model-title em:last-child { margin: 0 0 0 12px; }
#model-title b { font-weight: 700; }

#variants { list-style: none; display: flex; align-items: center; pointer-events: auto; }
#variants li { display: flex; align-items: center; }
#variants li + li::before { content: ''; width: 28px; height: 1px; background: var(--linha); }
#variants button { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; white-space: nowrap; }
#variants b { font-weight: 700; font-size: 13px; }
#variants span { font-size: 11px; font-weight: 400; letter-spacing: .19em; color: var(--texto-suave); transition: color .2s ease; }
#variants button:hover span { color: var(--cor-secundaria); }
#variants [aria-current="true"] b { font-weight: 400; font-size: 30px; color: var(--cor-secundaria); }
#variants [aria-current="true"] span { font-weight: 700; color: var(--texto); }

/* ---------- seletor de caldeiras ---------- */
#boilers {
    grid-area: boilers; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto;
    padding: 24px 2px 2px; scrollbar-width: thin; scrollbar-color: var(--linha) transparent;
}
#boilers::before { content: attr(data-heading); margin-bottom: 8px; font-size: 10.5px; font-weight: 400; letter-spacing: .22em; color: var(--texto-suave); }

.card {
    flex: none; display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 14px;
    min-height: 84px; padding: 8px 14px 8px 8px; text-align: left;
    background: color-mix(in srgb, var(--vidro) 42%, transparent); border: 1px solid transparent; border-left: 3px solid transparent;
    backdrop-filter: blur(6px);
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover { background: color-mix(in srgb, var(--vidro) 80%, transparent); border-color: var(--linha-suave); }
.card[aria-current="true"] {
    background: var(--superficie); border-color: var(--linha-suave); border-left-color: var(--cor-secundaria);
    box-shadow: 0 10px 28px rgba(17, 56, 127, .08);
}

.card__thumb {
    position: relative; width: 104px; height: 66px; display: grid; place-items: center; overflow: hidden;
    background-image:
        linear-gradient(var(--linha-suave) 1px, transparent 1px),
        linear-gradient(90deg, var(--linha-suave) 1px, transparent 1px);
    background-size: 13px 13px;
}
/* A imagem ocupa a caixa toda e a caldeira é encaixada inteira no centro, com uma folga: vale para a caixa fixa do
   desktop e para a proporcional do celular. As miniaturas têm fundo transparente (tools/thumbnails.mjs). */
.card__thumb img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 4%; object-fit: contain; }
.card__mono {
    font-weight: 700; font-size: 28px; letter-spacing: .04em;
    color: transparent; -webkit-text-stroke: 1px var(--texto); opacity: .6;
}

.card__text { display: grid; gap: 3px; }
.card__text b { font-weight: 700; font-size: 19px; letter-spacing: .06em; line-height: 1.1; }
.card__text small { font-size: 12px; color: var(--texto-suave); }
.card__text em { margin-top: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .2em; color: var(--cor-secundaria); }

/* ---------- popovers e aviso ---------- */
.popover {
    margin: auto; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 34px 30px 30px;
    color: var(--texto); background: var(--cartao);
    border: 1px solid var(--linha); box-shadow: 0 24px 60px rgba(17, 56, 127, .16);
}
.popover::backdrop { background: rgba(17, 56, 127, .14); backdrop-filter: blur(2px); }
.popover h2 { font-size: 14px; font-weight: 700; letter-spacing: .3em; }
.popover .popover__kicker { margin: 0 0 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .24em; text-transform: uppercase; color: var(--cor-secundaria); }
.popover p { margin-top: 16px; font-size: 14px; line-height: 1.55; color: var(--texto-suave); }
/* Números da caldeira (capacidade, pressão, tensão), marcados com **...** no catálogo. */
.popover p b { font-weight: 700; color: var(--texto); white-space: nowrap; }
.popover__close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center; }
.popover__close:hover { color: var(--cor-secundaria); }
.popover__close svg { width: 20px; height: 20px; }

#notice {
    position: fixed; left: 50%; bottom: 32px; z-index: 10; padding: 12px 20px; max-width: calc(100vw - 32px);
    font-size: 11px; font-weight: 700; letter-spacing: .2em; color: var(--branco); background: var(--botao);
    overflow-wrap: anywhere; opacity: 0; pointer-events: none; transform: translate(-50%, 16px);
    transition: opacity .25s ease, transform .25s ease;
}
#notice[data-show] { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tela limpa ---------- */
/* Como na vitrine (showcase.html): só a marca, a caldeira no meio da tela e a legenda embaixo à esquerda. Das
   ferramentas ficam os pontos de informação, a tela cheia e o botão que volta, mais apagados até o mouse passar. */
.caption { display: none; grid-row: 3; justify-self: start; flex-direction: column; gap: 8px; padding-bottom: 6px; pointer-events: none; }
.caption span { font-size: 11px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--cor-secundaria); }
.caption b { font-weight: 700; font-size: clamp(30px, 2.6vw, 46px); line-height: .9; letter-spacing: .02em; text-transform: uppercase; }

#app[data-clean] :is(.topbar__actions, #hero, .hint, #boilers, #bottom) { display: none; }
#app[data-clean] #center { grid-column: 1 / -1; grid-row: 2 / -1; }
#app[data-clean] #center::before { display: none; }
#app[data-clean] .caption { display: flex; animation: caption-in .6s ease .15s both; }
/* #fly: TEMPORÁRIO (scripts/flymode.js) */
#app[data-clean] #tools > :not(#hotspots-toggle, #fullscreen, #clean, #fly) { display: none; }
#app[data-clean] #tools { opacity: .5; transition: opacity .3s ease; }
#app[data-clean] #tools:is(:hover, :focus-within) { opacity: 1; }

@keyframes caption-in {
    from { opacity: 0; transform: translateY(8px); }
}

/* ---------- telas médias ---------- */
@media (max-width: 1280px) {
    #app { grid-template-columns: minmax(280px, 330px) 1fr 260px; column-gap: 20px; }
    .card { grid-template-columns: 84px 1fr; gap: 12px; }
    .card__thumb { width: 84px; height: 56px; }
}

@media (min-width: 900px) and (max-height: 820px) {
    #app { grid-template-rows: 76px 1fr auto; }
    .card { min-height: 70px; padding-block: 6px; }
    .card__thumb { height: 54px; }
    .card__text em { margin-top: 2px; }
    .kicker { margin-top: 24px; }
}

/* ---------- celular / tablet retrato ---------- */
/* Tudo cabe em uma tela: o 3D ocupa a altura que sobra e os seletores ficam numa grade compacta, sem rolagem lateral.
   Em telas muito baixas o 3D para em 300px e a página passa a rolar. */
@media (max-width: 899px) {
    :root { --gutter: 16px; }
    html, body { height: auto; overflow: auto; }

    #app {
        height: auto; min-height: 100vh; min-height: 100svh;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 60px auto minmax(300px, 1fr) auto;
        grid-template-areas: "top" "hero" "viewer" "boilers";
        padding-top: env(safe-area-inset-top);
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    .topbar { gap: 16px; }
    .brand img { height: 26px; }
    .brand__text { padding-left: 14px; }
    .cta { height: 40px; padding: 0 16px 0 18px; }

    #hero { padding-top: 6px; }
    .kicker { margin-top: 12px; }
    #name { margin-top: 6px; font-size: clamp(40px, 12vw, 60px); }
    .subtitle { min-height: 0; margin-top: 6px; font-size: 15px; }
    .rule, .stats, .description { display: none; }
    .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
    .actions .link { gap: 10px; padding: 11px 14px; font-size: 10.5px; letter-spacing: .12em; }
    .hint { display: none; }

    #viewer, #center, #app[data-clean] #center { grid-area: viewer; }
    /* `contain: size` impede que o canvas (com altura fixa em px) empurre a linha da grade ao girar o aparelho. */
    #viewer { position: relative; height: auto; margin: 8px calc(var(--gutter) * -1) 0; contain: size; }
    #center { margin-top: 8px; }
    #center::before { inset: 0; }

    #tools { gap: 4px; margin: 10px 0 0; }
    #tools button { width: 38px; height: 38px; }
    #fullscreen { display: none !important; }

    .bottom { padding: 0 0 8px; gap: 4px; max-width: 100%; }
    #model-title { font-size: 11px; letter-spacing: .26em; gap: 0; }
    #model-title i { display: none; }
    #variants button { min-height: 40px; padding: 0 10px; }
    #variants li + li::before { width: 12px; }
    #variants [aria-current="true"] b { font-size: 24px; }

    #boilers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; padding: 0; overflow: visible; }
    #boilers::before { display: none; }

    .card {
        grid-template-columns: minmax(0, 1fr); gap: 4px; min-height: 0; padding: 4px 4px 6px; text-align: center;
        border: 1px solid transparent; border-bottom: 2px solid transparent;
    }
    .card[aria-current="true"] { border-color: var(--linha-suave); border-bottom-color: var(--cor-secundaria); }
    .card__thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; background-size: 9px 9px; }
    .card__mono { font-size: 21px; }
    .card__text b { font-size: 13px; letter-spacing: .04em; }
    .card__text :is(small, em) { display: none; }
}

/* Celulares: o seletor de idioma fica só com o código e o compartilhar, só com o ícone (o texto continua para leitores
   de tela), para a marca caber na mesma linha. */
@media (max-width: 559px) {
    .topbar__actions { gap: 14px; }
    .language > svg:first-child { display: none; }
    .cta { width: 40px; padding: 0; justify-content: center; }
    .cta span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* Celulares estreitos: cabeçalho mais justo para a marca não quebrar linha. */
@media (max-width: 380px) {
    .topbar { gap: 10px; }
    .brand { gap: 10px; }
    .brand__text { padding-left: 10px; }
    .brand__text b { letter-spacing: .3em; }
    .brand__text span { letter-spacing: .3em; white-space: nowrap; }
    .topbar__actions { gap: 10px; }
}

/* Celulares de 320px: com o botão do tema, a marca e o idioma ficam mais justos para tudo caber numa linha. */
@media (max-width: 340px) {
    .brand img { height: 22px; }
    .brand__text :is(b, span) { letter-spacing: .22em; }
    .topbar__actions { gap: 6px; }
    .language .language__chevron { display: none; }
}

/* Tablets e celulares deitados com o botão AR (um a mais no cabeçalho): os botões do cabeçalho ficam só com o ícone, como
   no celular em pé, até a largura em que os textos cabem (com o COMPARTILHAR, o mais longo). */
@media (max-width: 699px) {
    .topbar:has(#ar-link:not([hidden])) .topbar__actions { gap: 14px; }
    .topbar:has(#ar-link:not([hidden])) .cta { width: 40px; padding: 0; justify-content: center; }
    .topbar:has(#ar-link:not([hidden])) .cta span {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
    }
}

/* Celulares com o botão AR: o cabeçalho fica mais justo aos poucos, para tudo caber numa linha. Até 459 px, o cabeçalho
   justo dos estreitos; abaixo de 410 px, também o logo menor, o idioma sem a setinha e os botões mais juntos; abaixo de
   353 px, só o logo da marca. */
@media (max-width: 459px) {
    .topbar:has(#ar-link:not([hidden])) { gap: 10px; }
    .topbar:has(#ar-link:not([hidden])) :is(.brand, .topbar__actions) { gap: 10px; }
    .topbar:has(#ar-link:not([hidden])) .brand__text { padding-left: 10px; }
    .topbar:has(#ar-link:not([hidden])) .brand__text :is(b, span) { letter-spacing: .3em; white-space: nowrap; }
}
@media (max-width: 409px) {
    .topbar:has(#ar-link:not([hidden])) .brand img { height: 22px; }
    .topbar:has(#ar-link:not([hidden])) .brand__text :is(b, span) { letter-spacing: .22em; }
    .topbar:has(#ar-link:not([hidden])) .topbar__actions { gap: 6px; }
    .topbar:has(#ar-link:not([hidden])) .language__chevron { display: none; }
}
@media (max-width: 352px) {
    .topbar:has(#ar-link:not([hidden])) .brand__text { display: none; }
}

/* Celulares baixos (ex.: iPhone SE): topo mais enxuto para o 3D e os seletores caberem sem rolar. */
@media (max-width: 899px) and (max-height: 760px) {
    #app { grid-template-rows: 56px auto minmax(280px, 1fr) auto; }
    .crumb, .subtitle { display: none; }
    .kicker { margin-top: 8px; }
    #name { font-size: clamp(36px, 11vw, 48px); }
    .actions { margin-top: 12px; }
}

/* Tablet retrato: uma linha só com todas as caldeiras. */
@media (min-width: 560px) and (max-width: 899px) {
    #boilers { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
}

/* ---------- celular deitado ---------- */
/* Vem depois dos blocos acima e vale tanto abaixo quanto acima de 900px de largura: textos e seletores à esquerda,
   o 3D ocupa a tela toda por trás (como no desktop) e a caldeira fica centralizada na coluna da direita. */
@media (orientation: landscape) and (max-height: 520px) {
    :root { --gutter: 16px; }
    html, body { height: 100%; overflow: hidden; }

    #app {
        height: 100dvh; min-height: 0;
        grid-template-columns: minmax(260px, 36%) minmax(0, 1fr);
        grid-template-rows: 48px auto minmax(0, 1fr);
        grid-template-areas: "top top" "hero center" "boilers center";
        column-gap: 16px;
        padding: 0 max(var(--gutter), env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
    }

    .topbar { gap: 16px; }
    .brand img { height: 24px; }
    .brand__text { padding-left: 14px; }
    .cta { height: 36px; padding: 0 14px 0 16px; }

    #hero { padding-top: 0; }
    .crumb, .subtitle, .rule, .stats, .description, .hint { display: none; }
    .kicker { margin-top: 2px; font-size: 11px; }
    #name { margin-top: 4px; font-size: clamp(32px, 9vh, 44px); }
    .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
    .actions .link { gap: 8px; padding: 10px 12px; font-size: 10px; letter-spacing: .1em; }

    #viewer { grid-area: auto; position: absolute; inset: 0; height: auto; margin: 0; contain: none; }
    #center { grid-area: center; margin: 0; }
    #app[data-clean] #center { grid-area: 2 / 1 / -1 / -1; }
    #center::before { inset: 0; }

    #tools { gap: 4px; margin: 8px 8px 0 0; }
    #tools button { width: 36px; height: 36px; }
    #fullscreen { display: none !important; }

    .bottom { padding: 0 0 6px; gap: 2px; max-width: 100%; }
    #model-title { font-size: 11px; letter-spacing: .26em; gap: 0; }
    #model-title i { display: none; }
    #variants button { min-height: 36px; padding: 0 10px; }
    #variants li + li::before { width: 12px; }
    #variants [aria-current="true"] b { font-size: 22px; }

    #boilers {
        display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: row; grid-auto-columns: auto;
        align-content: end; gap: 6px; min-height: 0; margin: 10px 0 0; padding: 0; overflow: hidden auto; scrollbar-width: none;
    }
    #boilers::before { display: none; }

    .card {
        width: auto; grid-template-columns: minmax(0, 1fr); gap: 3px; min-height: 0; padding: 3px 3px 5px; text-align: center;
        border: 1px solid transparent; border-bottom: 2px solid transparent;
    }
    .card[aria-current="true"] { border-color: var(--linha-suave); border-bottom-color: var(--cor-secundaria); }
    .card__thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; background-size: 9px 9px; }
    .card__mono { font-size: 18px; }
    .card__text b { font-size: 12px; letter-spacing: .04em; }
    .card__text :is(small, em) { display: none; }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 760px) {
    .actions .link { justify-content: center; padding: 10px 8px; }
    .actions .link svg { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
