/* Prof. Victor Hugo — portal do Laboratório de Álgebra
   Direção visual: docs/DIRECAO_VISUAL.md (revisão 2) */
:root {
  --hero: #0b2a36; --hero-2: #103745; --on-hero: #eaf4f3; --on-hero-muted: #b0cacb; --hero-line: rgb(255 255 255 / .1);
  --bg: #f3f6f5; --bg-2: #e9f0ef; --panel: #ffffff; --panel-2: #f6f9f8; --line: #d3dfdf; --line-strong: #b9cccc;
  --ink: #12232b; --muted: #4d6169;
  --teal: #086d66; --teal-ink: #ffffff; --teal-soft: #dcefec;
  --amber: #8f5a00; --amber-hi: #f2b84b; --amber-soft: #fbefd2;
  --a-dom: #086d66; --a-pega: #5b46c9; --a-bal: #1d6fb8; --a-robo: #3d7d1d;
  --shadow: 0 1px 2px rgb(18 35 43 / .06), 0 12px 32px -18px rgb(18 35 43 / .28);
  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --head-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-spring: cubic-bezier(.3, 1.4, .5, 1);
  --t-fast: 160ms; --t-panel: 380ms; --t-enter: 620ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hero: #071821; --hero-2: #0c2330; --hero-line: rgb(255 255 255 / .08);
    --bg: #0a1d27; --bg-2: #0d2531; --panel: #11303d; --panel-2: #163a49; --line: #24505f; --line-strong: #2f6273;
    --ink: #e8f1f1; --muted: #a3bcc2;
    --teal: #4fd1c1; --teal-ink: #05211e; --teal-soft: #123f3d;
    --amber: #f2b84b; --amber-soft: #3a2c10;
    --a-dom: #4fd1c1; --a-pega: #b9a7ff; --a-bal: #7cc7ff; --a-robo: #a6e07d;
    --shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 18px 40px -22px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --hero: #071821; --hero-2: #0c2330; --hero-line: rgb(255 255 255 / .08);
  --bg: #0a1d27; --bg-2: #0d2531; --panel: #11303d; --panel-2: #163a49; --line: #24505f; --line-strong: #2f6273;
  --ink: #e8f1f1; --muted: #a3bcc2;
  --teal: #4fd1c1; --teal-ink: #05211e; --teal-soft: #123f3d;
  --amber: #f2b84b; --amber-soft: #3a2c10;
  --a-dom: #4fd1c1; --a-pega: #b9a7ff; --a-bal: #7cc7ff; --a-robo: #a6e07d;
  --shadow: 0 1px 0 rgb(255 255 255 / .04) inset, 0 18px 40px -22px rgb(0 0 0 / .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgb(79 209 193 / .2); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 17px; line-height: 1.6; overflow-wrap: break-word; }
[id] { scroll-margin-top: calc(var(--head-h) + 16px); }
#conteudo { scroll-margin-top: 0; }
#conteudo:focus { outline: none; }
a { color: var(--teal); text-underline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; font-family: var(--f-display); font-weight: 500; font-variation-settings: "opsz" 72; letter-spacing: -.01em; }
p { text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--amber-hi); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; display: block; }
.wrap { max-width: 1160px; margin: 0 auto; padding-inline: max(20px, env(safe-area-inset-left)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--panel); color: var(--ink); padding: 10px 14px; border-radius: 8px; font-weight: 700; transition: top var(--t-fast); }
.skip:focus { top: 12px; }
.note { font-size: 15px; color: var(--muted); margin: 10px 0 0; }
.sub { color: var(--muted); max-width: 38em; margin: 0; font-size: 18px; }

/* botões */
.btn { --bg-b: transparent; --fg: var(--teal); --bd: var(--teal);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; padding: 10px 18px;
  font: 700 16px/1.2 var(--f-body); text-decoration: none; text-align: center; border-radius: 10px; border: 1.5px solid var(--bd);
  background: var(--bg-b); color: var(--fg); cursor: pointer; touch-action: manipulation; position: relative;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast); }
.btn.primary { --bg-b: var(--teal); --fg: var(--teal-ink); }
.btn.ghost { --bd: var(--line-strong); --fg: var(--ink); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--teal) 80%, transparent); }
.btn.ghost:hover { border-color: var(--teal); }
.btn:active { transform: translateY(1px) scale(.97); box-shadow: none; transition-duration: 80ms; }
.btn.small { min-height: 44px; font-size: 15px; padding: 8px 16px; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn .tag { font: 600 12.5px var(--f-body); padding: 3px 8px; border-radius: 6px; background: var(--teal-soft); color: var(--teal); }

/* cabeçalho */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--hero) 92%, transparent); color: var(--on-hero); border-bottom: 1px solid var(--hero-line); backdrop-filter: blur(10px); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--head-h); }
.mark { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 500 19px var(--f-display); }
.mark svg { width: 30px; height: 30px; flex: none; }
.mk-bg { fill: #4fd1c1; }
.mk-eq { stroke: #0b2a36; stroke-width: 3; stroke-linecap: round; }
#nav { display: flex; align-items: center; gap: 4px; }
#nav a { color: var(--on-hero-muted); text-decoration: none; font-size: 15.5px; padding: 10px 12px; border-radius: 8px; position: relative; transition: color var(--t-fast); }
#nav a::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 2px; background: #4fd1c1; transform: scaleX(0); transform-origin: left; transition: transform 260ms var(--ease); }
#nav a:hover, #nav a[aria-current="true"] { color: #fff; }
#nav a[aria-current="true"]::after, #nav a:hover::after { transform: scaleX(1); }
.theme { margin-left: 6px; min-width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1px solid rgb(255 255 255 / .2); background: transparent; color: var(--on-hero); cursor: pointer; transition: border-color var(--t-fast); }
.theme:hover { border-color: #4fd1c1; }
.theme svg { width: 20px; height: 20px; transition: transform 420ms var(--ease); }
:root[data-theme="dark"] .theme svg { transform: rotate(180deg); }
.theme-lbl { display: none; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .js .menu-btn:not([hidden]) { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgb(255 255 255 / .22); background: transparent; color: var(--on-hero); font: 700 15px var(--f-body); cursor: pointer; }
  .bars, .bars::before, .bars::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform 260ms var(--ease), background-color 120ms; }
  .bars { position: relative; }
  .bars::before, .bars::after { content: ""; position: absolute; left: 0; }
  .bars::before { top: -6px; } .bars::after { top: 6px; }
  .menu-btn[aria-expanded="true"] .bars { background: transparent; }
  .menu-btn[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }
  .top-in { flex-wrap: wrap; }
  #nav { width: 100%; flex-wrap: wrap; padding-bottom: 10px; }
  .js #nav { position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 16px 16px; background: var(--hero); border-bottom: 1px solid var(--hero-line); overscroll-behavior: contain;
    opacity: 0; transform: translateY(-8px); visibility: hidden; transition: opacity 280ms var(--ease), transform 280ms var(--ease), visibility 0s linear 280ms; }
  .js #nav.open { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
  .js #nav a { font-size: 18px; padding: 12px; }
  .js #nav a::after { display: none; }
  .js #nav a[aria-current="true"] { background: rgb(255 255 255 / .07); }
  .js .theme { margin: 6px 0 0; display: flex; gap: 10px; justify-content: start; padding: 0 12px; font: 16px var(--f-body); }
  .js .theme-lbl { display: inline; }
}

/* ---------- abertura ---------- */
.hero { position: relative; overflow: hidden; background: var(--hero); color: var(--on-hero);
  background-image: radial-gradient(ellipse 60% 70% at 78% 40%, rgb(79 209 193 / .10), transparent 70%),
    linear-gradient(rgb(255 255 255 / .04) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .04) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px; }
.axes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.axes .ax { fill: none; stroke: rgb(255 255 255 / .16); stroke-width: 1.5; }
.axes .tk { fill: none; stroke: rgb(255 255 255 / .2); stroke-width: 1.5; }
.axes .fn { fill: none; stroke: rgb(79 209 193 / .32); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 0; }
.hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: 64px; align-items: center; padding-block: 80px 88px; }
.hero h1 { font-size: clamp(42px, 5.8vw, 70px); line-height: 1.02; margin: 0; }
.fullname { margin: 12px 0 0; color: var(--on-hero-muted); font-size: 16.5px; }
.lead { margin: 26px 0 0; font-size: clamp(18px, 2vw, 21px); line-height: 1.5; max-width: 30em; }
.roles-line { margin: 14px 0 0; color: var(--on-hero-muted); font-size: 16px; max-width: 32em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero .btn.primary, .contact .btn.primary { --bg-b: #4fd1c1; --fg: #05211e; --bd: #4fd1c1; }
.hero .btn.line { --fg: var(--on-hero); --bd: rgb(255 255 255 / .35); }
.hero .btn.line:hover { --bd: #4fd1c1; }
@media (max-width: 920px) { .hero-in { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-block: 48px 56px; } }

/* quadro da equação */
.board { margin: 0; background: var(--panel); color: var(--ink); border-radius: 20px; padding: 22px 24px 20px; box-shadow: 0 34px 70px -34px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .07); }
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; }
.board-title { font: 500 22px var(--f-display); }
.lvl { font-size: 14px; color: var(--amber); font-weight: 700; }
.progress { display: none; list-style: none; margin: 16px 0 6px; padding: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.js .progress { display: grid; }
.progress li { font-size: 12.5px; color: var(--muted); padding-top: 9px; position: relative; line-height: 1.25; transition: color 200ms; }
.progress li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--line); }
.progress li::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 2px; background: var(--teal); transform: scaleX(0); transform-origin: left; transition: transform 500ms var(--ease) 150ms; }
.progress li.done { color: var(--ink); }
.progress li.done::after { transform: scaleX(1); }
.progress li[aria-current="step"] { color: var(--teal); font-weight: 700; }

.stage { margin: 12px 0 0; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.stage p { margin: 0; }
.eqline, .ops { display: grid; grid-template-columns: minmax(0, 1fr) 2.4ch minmax(0, 1fr); align-items: baseline; column-gap: 10px; position: relative; }
.eqline { font-size: clamp(26px, 3.6vw, 34px); line-height: 1.5; border-radius: 10px; }
.eqline .l { text-align: right; } .eqline .eq { text-align: center; color: var(--muted); }
.eqline .k { position: relative; display: inline-block; }
.eqline .k::after { content: ""; position: absolute; left: -2px; right: -2px; top: 52%; height: 3px; border-radius: 2px; background: var(--amber); transform: scaleX(0); transform-origin: left; }
.eqline.final { color: var(--teal); font-weight: 600; }
.eqline.opline { font-size: clamp(22px, 3vw, 28px); }
.eqline .op { font-weight: 600; color: var(--amber); background: var(--amber-soft); padding: 0 .22em; border-radius: 6px; white-space: nowrap; display: inline-block; }
.ops { font-size: 15px; min-height: 34px; align-items: center; }
.ops .chip:first-child { justify-self: end; }
.ops .chip { font-weight: 600; color: var(--amber); background: var(--amber-soft); padding: 2px 10px; border-radius: 7px; display: inline-block; }
.ops .why { grid-column: 2; grid-row: 1; justify-self: center; white-space: nowrap; font-size: 0; }
.ops .chip:last-child { grid-column: 3; justify-self: start; }
.check { font-size: 14.5px; color: var(--muted); text-align: center; margin-top: 10px !important; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.board-ctrl { display: none; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.js .board-ctrl { display: flex; }

/* estados por passo (só com JS; sem JS, a resolução inteira fica visível) */
.js .stage [data-step] { transition: opacity 300ms var(--ease), transform 300ms var(--ease); }
/* fase 1: operação entra nos dois membros */
.js .ops .chip { transition: opacity 260ms var(--ease), transform 340ms var(--ease-spring); }
.js .ops.ahead .chip { opacity: 0; transform: translateY(-10px) scale(.6); }
/* fase 2: risco no termo afetado */
.js .k::after { transition: transform 280ms var(--ease) 260ms; }
.js .stage.s1 .eqline[data-step="0"] .k::after { transform: scaleX(1); }
.js .stage.s1 .eqline[data-step="0"], .js .stage.s2 .eqline[data-step="1"] { opacity: .62; transition-delay: 300ms; }
/* fase 3: nova linha substitui a lacuna */
.js .eqline[data-ghost]::before { content: attr(data-ghost); position: absolute; inset: 4px 18%; display: grid; place-items: center; font-size: .72em; color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: 10px; transition: opacity 240ms var(--ease) 520ms, transform 240ms var(--ease) 520ms; }
.js .eqline[data-ghost] > span { transition: opacity 340ms var(--ease) 600ms, transform 420ms var(--ease-spring) 600ms; }
.js .eqline.ahead[data-ghost] > span { opacity: 0; transform: translateY(-14px); visibility: hidden; transition: none; }
.js .eqline:not(.ahead)[data-ghost]::before { opacity: 0; transform: scale(.94); pointer-events: none; }
.js .eqline.ahead[data-ghost]::before { transition: none; }
/* passo 2: a divisão aparece escrita nos dois membros e só depois vem o resultado */
.js .eqline.opline::before { transition-delay: 0ms, 0ms; }
.js .eqline.opline > span { transition-delay: 80ms, 80ms; }
.js .eqline.opline .op { transition: transform 360ms var(--ease-spring) 300ms; }
.js .eqline.opline.ahead .op { transform: scale(.4); transition: none; }
.js .eqline.final::before { transition-delay: 760ms, 760ms; }
.js .eqline.final > span { transition-delay: 820ms, 820ms; }
.js .eqline.final:not(.ahead) { animation: result 900ms var(--ease) 1100ms both; }
@keyframes result { 0% { background: transparent; } 35% { background: var(--teal-soft); } 100% { background: var(--teal-soft); } }
.js .check { transition: opacity 360ms var(--ease) 150ms, transform 360ms var(--ease) 150ms; }
.js .check.ahead { opacity: 0; transform: translateY(6px); visibility: hidden; transition: none; }
.js .ops.ahead .chip { visibility: hidden; transition: none; }
.js .ops:not(.ahead) .chip:last-child { transition-delay: 40ms; }
.js .stage.instant *, .js .stage.instant *::before, .js .stage.instant *::after { transition: none !important; animation: none !important; }

/* entrada coordenada da abertura */
.js .hero h1 { animation: rise var(--t-enter) var(--ease) both; }
.js .hero .intro > :not(h1) { animation: rise var(--t-enter) var(--ease) 120ms both; }
.js .hero .cta { animation-delay: 200ms; }
.js .axes .fn { animation: draw 1100ms var(--ease) 250ms both; }
.js .board { animation: board-in 700ms var(--ease) 300ms both; }
.js .board .eqline[data-step="0"] { animation: rise 500ms var(--ease) 700ms both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes board-in { from { opacity: 0; transform: translateY(24px) rotate(1.2deg); } }

/* ---------- sobre ---------- */
.about { background: var(--bg-2); padding-block: 64px; }
.about-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 64px; align-items: start; }
.about h2 { grid-column: 1; font-size: clamp(30px, 3.4vw, 40px); margin: 0; line-height: 1.1; }
.about-text { grid-column: 1; }
.about-text p { margin: 0 0 12px; max-width: 34em; }
.roles { grid-column: 2; grid-row: 1 / span 2; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.roles > div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; border-top: 3px solid var(--teal); }
.roles dt { font: 500 19px/1.25 var(--f-display); }
.roles dd { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
@media (max-width: 900px) { .about-in { grid-template-columns: minmax(0, 1fr); } .roles { grid-column: 1; grid-row: auto; margin-top: 8px; } }
@media (max-width: 560px) { .about { padding-block: 48px; } .roles { grid-template-columns: minmax(0, 1fr); gap: 10px; } .roles > div { padding: 14px 16px; } }

/* ---------- laboratório ---------- */
.lab { padding-block: 72px 80px; }
.lab-head { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px 56px; align-items: end; margin-bottom: 36px; }
.lab h2 { font-size: clamp(32px, 4vw, 46px); line-height: 1.08; margin: 0 0 14px; }
.levels { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--panel); }
.levels li { padding: 14px; border-right: 1px solid var(--line); }
.levels li:last-child { border-right: 0; }
.levels b { display: block; font-size: 15px; }
.levels span { font-size: 14px; color: var(--muted); }
.levels i { display: block; height: 6px; margin-top: 10px; border-radius: 3px; width: calc(var(--n) * 33.33%); background: var(--amber); }
@media (max-width: 860px) { .lab-head { grid-template-columns: minmax(0, 1fr); } }
/* telas estreitas: um nível por linha (nome, passos e barra), sem quebrar "Intermediário" */
@media (max-width: 480px) {
  .levels { grid-template-columns: minmax(0, 1fr); }
  .levels li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; align-items: baseline; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .levels li:last-child { border-bottom: 0; }
  .levels i { grid-column: 1 / -1; margin-top: 8px; }
}

.projects { display: grid; gap: 28px; }
.proj { --acc: var(--a-dom); background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--acc); border-radius: 20px; padding: clamp(20px, 3vw, 36px); box-shadow: var(--shadow); }
#pega-pega { --acc: var(--a-pega); } #balanca { --acc: var(--a-bal); } #robo { --acc: var(--a-robo); }
.proj-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 44px; align-items: center; }
.proj-top.flip .demo { order: -1; }
.proj h3 { font-size: clamp(26px, 2.8vw, 32px); line-height: 1.12; margin: 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.proj-text > p { margin: 14px 0 0; max-width: 36em; }
.status { font: 700 13px var(--f-body); border-radius: 99px; padding: 4px 11px; white-space: nowrap; }
.status.ready { background: var(--teal-soft); color: var(--teal); }
.status.dev { background: var(--amber-soft); color: var(--amber); }
.facts { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.facts dt { font-size: 13.5px; color: var(--muted); }
.facts dd { margin: 0; font: 500 19px var(--f-display); }
.sample { font: 14.5px var(--f-mono); background: var(--panel-2); border-left: 3px solid var(--amber); border-radius: 0 8px 8px 0; padding: 10px 14px; margin: 16px 0 0; overflow-x: auto; }
@media (max-width: 860px) { .proj-top { grid-template-columns: minmax(0, 1fr); } .proj-top.flip .demo { order: 0; } }

/* ilustrações */
.demo { margin: 0; }
.art { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; aspect-ratio: 360 / 210; padding: 6px; position: relative; overflow: hidden;
  background-image: linear-gradient(color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px); background-size: 24px 24px; }
.art svg { width: 100%; height: 100%; display: block; overflow: visible; }
.art text { font: 600 15px var(--f-mono); text-anchor: middle; fill: var(--ink); }
.art g, .art rect, .art path { transform-box: fill-box; transform-origin: center; }
.demo-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; font-size: 15px; color: var(--muted); }
.demo-btn { display: none; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--acc); background: transparent; color: var(--ink); font: 700 15px var(--f-body); cursor: pointer; touch-action: manipulation;
  transition: transform var(--t-fast) var(--ease), background-color var(--t-fast); }
.js .demo-btn { display: inline-flex; }
.demo-btn::before { content: ""; width: 0; height: 0; border-left: 9px solid var(--acc); border-block: 6px solid transparent; transition: transform 200ms var(--ease); }
.demo-btn[aria-pressed="true"]::before { transform: rotate(180deg); }
.demo-btn:hover { background: color-mix(in srgb, var(--acc) 14%, transparent); }
.demo-btn:active { transform: scale(.96); }

/* dominó */
.tile .face { fill: var(--panel); stroke: var(--ink); stroke-width: 2; }
.tile .side { fill: color-mix(in srgb, var(--ink) 70%, var(--panel)); }
.tile .div { stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
.tile .num { fill: var(--a-dom); font-size: 26px; }
.match rect { fill: none; stroke: var(--amber); stroke-width: 2.5; stroke-dasharray: 6 6; }
.match text { fill: var(--amber); font-size: 14px; }
.tb { transition: transform 620ms var(--ease-spring); }
.match { transition: opacity 300ms var(--ease) 500ms; }
.js .demo[data-state="before"] .tb { transform: translate(-4px, -36px) rotate(8deg); }
.js .demo[data-state="before"] .match { opacity: 0; transition-delay: 0s; }
.demo[data-state="after"] .ta .num, .demo[data-state="after"] .tb .num { animation: snap 500ms var(--ease) 560ms; }
@keyframes snap { 50% { transform: scale(1.3); } }

/* pega-pega */
.chip circle { fill: var(--panel); stroke: var(--line-strong); stroke-width: 2; }
.chip text { font-size: 17px; }
.c7 { transform: rotate(-8deg); } .c2 { transform: rotate(10deg); }
.chip.hit { transition: transform 500ms var(--ease-spring) 520ms; }
.chip.hit circle { transition: fill 300ms 520ms, stroke 300ms 520ms; }
.demo[data-state="after"] .chip.hit { transform: translateY(-10px) scale(1.18); }
.demo[data-state="after"] .chip.hit circle { fill: var(--teal-soft); stroke: var(--a-pega); stroke-width: 3; }
.card rect { fill: var(--panel); stroke: var(--ink); stroke-width: 2; }
.card.back rect { fill: var(--a-pega); stroke: none; }
.card.back .pat { stroke: rgb(255 255 255 / .35); stroke-width: 2; fill: none; }
.card.front text { font-size: 19px; }
.card { transition: transform 240ms ease-in; }
.card.front { transition: transform 260ms ease-out 240ms; }
.card.back { transform: scaleX(0); }
.js .demo[data-state="before"] .card.back { transform: none; transition: transform 260ms ease-out 240ms; }
.js .demo[data-state="before"] .card.front { transform: scaleX(0); transition: transform 240ms ease-in; }

/* balança */
.stand, .bar { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; fill: none; }
.str { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.pan { fill: color-mix(in srgb, var(--a-bal) 30%, var(--panel)); stroke: var(--a-bal); stroke-width: 2; }
.pivot { fill: var(--amber); }
.xs rect { fill: var(--a-bal); } .xs text { fill: var(--panel); font-size: 15px; }
.u rect { fill: var(--panel); stroke: var(--ink); stroke-width: 1.6; }
.u.rm rect { stroke: var(--amber); fill: var(--amber-soft); }
.lbl text { font-size: 17px; }
.beam { transform-box: view-box; transform-origin: 180px 58px; }
.u.rm { transition: transform 520ms var(--ease) 80ms, opacity 420ms var(--ease) 200ms; }
.lbl { transition: opacity 300ms var(--ease) 420ms; }
.demo[data-state="after"] .u.rm { transform: translateY(-46px); opacity: 0; }
.lbl.after { opacity: 0; }
.lbl.before { opacity: 1; }
.demo[data-state="after"] .lbl.before { opacity: 0; }
.demo[data-state="after"] .lbl.after { opacity: 1; }
.demo.wobble .beam { animation: wobble 900ms var(--ease); }
@keyframes wobble { 25% { transform: rotate(-3deg); } 55% { transform: rotate(2deg); } 80% { transform: rotate(-.8deg); } }

/* robô */
.cells { stroke: var(--line-strong); stroke-width: 1.2; fill: none; opacity: .7; }
.route { fill: none; stroke: var(--a-robo); stroke-width: 4; stroke-dasharray: 8 8; stroke-linecap: round; }
.st circle { fill: var(--amber-soft); stroke: var(--amber); stroke-width: 2; transition: transform 300ms var(--ease-spring), fill 200ms; }
.st text { font-size: 13px; fill: var(--amber); }
.st.hit circle { transform: scale(1.18); fill: var(--amber); }
.st.hit text { fill: var(--panel); }
.bulb circle { fill: var(--amber-hi); stroke: var(--ink); stroke-width: 2; }
.bulb path { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.bulb .glow { fill: var(--amber-hi); stroke: none; opacity: .3; transition: opacity 400ms, transform 500ms var(--ease-spring); }
.js .demo[data-state="before"] .bulb circle:not(.glow) { fill: var(--panel); }
.js .demo[data-state="before"] .bulb .glow { opacity: 0; transform: scale(.4); }
.bot { transform-box: view-box; transform-origin: 0 0; transform: translate(262px, 40px); }
.bot rect { fill: var(--ink); } .bot circle { fill: var(--a-robo); } .bot path { stroke: var(--a-robo); stroke-width: 2; stroke-linecap: round; }
.js .demo[data-state="before"] .bot { transform: translate(70px, 160px); }
.robo-eq { font: 600 16px var(--f-mono); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; transition: background-color 300ms; }
.robo-eq.flash { background: var(--amber-soft); }

/* materiais */
.files { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 4px; }
.files summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 52px; cursor: pointer; font-weight: 700; font-size: 17px; color: var(--ink); border-radius: 8px; }
.files summary::-webkit-details-marker { display: none; }
.files summary::after { content: ""; width: 10px; height: 10px; border-right: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(45deg); transition: transform 300ms var(--ease); margin-left: auto; margin-right: 6px; flex: none; }
.files[open] summary::after { transform: rotate(-135deg); }
.files .count { font-size: 14.5px; font-weight: 400; color: var(--muted); }
.file-grid { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
/* entrada só na abertura feita pelo visitante; fill-mode backwards: ao terminar ou ser interrompida,
   a animação nunca deixa um cartão transparente */
.js .files.opening .file-grid li { animation: item-in 380ms var(--ease) backwards; }
.js .files.opening .file-grid li:nth-child(2) { animation-delay: 40ms; } .js .files.opening .file-grid li:nth-child(3) { animation-delay: 80ms; }
.js .files.opening .file-grid li:nth-child(4) { animation-delay: 120ms; } .js .files.opening .file-grid li:nth-child(5) { animation-delay: 160ms; }
.js .files.opening .file-grid li:nth-child(6) { animation-delay: 200ms; }
@keyframes item-in { from { opacity: 0; transform: translateY(-8px); } }
.file { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; height: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); text-decoration: none; color: var(--ink);
  transition: border-color var(--t-fast), transform var(--t-fast) var(--ease), background-color var(--t-fast); }
.file:hover { border-color: var(--acc); transform: translateY(-2px); }
.file:active { transform: scale(.98); }
.file .badge { grid-row: 1 / span 2; font: 700 11.5px var(--f-body); letter-spacing: .04em; color: var(--acc); border: 1.5px solid var(--acc); border-radius: 6px; padding: 10px 6px; }
.file .ft { font-weight: 700; color: var(--teal); }
.file small { grid-column: 2; font-size: 14px; color: var(--muted); }
.file .sz { grid-column: 3; grid-row: 1 / span 2; font-size: 13.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.files-note { font-size: 15px; color: var(--muted); margin: 14px 0 0; }

/* uso dos apps */
.use { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 44px; align-items: center; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.use-actions { display: flex; flex-wrap: wrap; gap: 12px; align-content: start; }
.use-actions .note { flex-basis: 100%; margin-top: 4px; }
.shot { margin: 0; }
.shot img { border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.shot figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
@media (max-width: 860px) { .use { grid-template-columns: minmax(0, 1fr); } }

/* ---------- contato ---------- */
.contact { background: var(--hero); color: var(--on-hero); padding-block: 64px; position: relative; overflow: hidden; }
.contact::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, transparent 55%, rgb(79 209 193 / .08) 55.2%, transparent 75%); pointer-events: none; }
.contact-in { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px 56px; align-items: center; }
.contact h2 { font-size: clamp(30px, 3.4vw, 40px); margin: 0 0 10px; }
.contact .sub { color: var(--on-hero-muted); }
.mailbox { background: var(--hero-2); border: 1px solid var(--hero-line); border-radius: 18px; padding: 26px; }
.addr { font: 600 clamp(15px, 2.1vw, 21px) var(--f-mono); margin: 0 0 18px; overflow-wrap: anywhere; user-select: all; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.mailbox .btn.line { --fg: var(--on-hero); --bd: rgb(255 255 255 / .35); }
.mailbox .btn.ok { --bd: #4fd1c1; --fg: #4fd1c1; animation: ok-pop 360ms var(--ease-spring); }
@keyframes ok-pop { 40% { transform: scale(1.06); } }
.copy-status { min-height: 1.5em; margin: 12px 0 0; font-size: 15px; color: var(--on-hero-muted); }
@media (max-width: 820px) { .contact-in { grid-template-columns: minmax(0, 1fr); } .contact { padding-block: 48px; } }

.foot { background: var(--hero); color: var(--on-hero-muted); font-size: 14.5px; padding-block: 22px calc(30px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hero-line); }
.foot-in { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }

/* 404 */
.nf { min-height: 70vh; display: grid; place-items: center; text-align: center; padding-block: 64px; }
.nf h1 { font-size: clamp(34px, 5.4vw, 52px); margin: 0 0 12px; }
.nf .eqn { font: 600 clamp(22px, 4vw, 32px) var(--f-mono); color: var(--amber); margin: 0 0 16px; }
.nf .cta { justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; transition-delay: 0s !important; }
  .js .eqline.final:not(.ahead) { background: var(--teal-soft); }
}

/* toque sem atraso de duplo toque nos controles restantes */
.files summary, .file, #nav a, .menu-btn, .theme, .mark { touch-action: manipulation; }
