/* ==========================================================
   BEYOND PATTERNS · ESSAY TEMPLATE · ensaio.css
   Every variation is scoped to the attribute ensaio.js writes on
   <html> (data-hero="vidro", data-barra="faixa"...): what is not
   chosen never shows. Change the face of an essay in :root first.
   ========================================================== */

@property --m1 { syntax: '<color>'; inherits: true; initial-value: #b98cff; }
@property --m2 { syntax: '<color>'; inherits: true; initial-value: #ff6fb5; }

:root {
  /* type scale */
  --t-xs: clamp(0.72rem, 0.68rem + 0.2vw, 0.84rem);
  --t-sm: clamp(0.875rem, 0.83rem + 0.25vw, 1rem);
  --t-base: clamp(1.03rem, 0.98rem + 0.3vw, 1.16rem);
  --t-lg: clamp(1.3rem, 1.1rem + 0.9vw, 1.8rem);
  --t-xl: clamp(1.8rem, 1.35rem + 1.8vw, 2.9rem);
  --t-2xl: clamp(2.3rem, 1.5rem + 3.4vw, 4.4rem);
  --t-hero: clamp(3rem, 1rem + 7vw, 8rem);

  /* IT palette: wet asphalt at night, the yellow slicker, the orange of the deadlights, the red
     balloon kept for rare accents. Every text pair passes WCAG AA on --fundo and --painel
     (build_it.py measures them). */
  --fundo: #0b0e12;
  --fundo-2: #10151b;
  --painel: #161c24;
  --painel-2: #1e2630;
  --linha: rgba(226, 232, 240, 0.12);
  --linha-2: rgba(226, 232, 240, 0.22);
  --titulo: #f1f4f7;
  --texto: #dbe1e7;
  --suave: #b6c0ca;
  --fraco: #98a4b1;
  --acento: #f2c230;
  --acento-2: #ff9a52;
  --alerta: #f07070;
  --sobre-acento: #1a1404;

  /* glass */
  --vidro: rgba(22, 28, 36, 0.62);
  --vidro-forte: rgba(16, 21, 27, 0.88);
  --vidro-borda: rgba(255, 255, 255, 0.14);
  --vidro-blur: 16px;

  /* fonts: the house serif for titles, a typewriter for Mike's notebook and the labels */
  --fonte-titulo: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --fonte-texto: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --fonte-mono: 'Courier Prime', 'DM Mono', 'Cascadia Mono', Consolas, monospace;

  /* measures */
  --medida: 66ch;
  --coluna: 760px;
  --margem: clamp(1rem, 0.6rem + 2vw, 2.4rem);
  --barra-altura: 3.25rem;
  --raio: 0.75rem;
  --raio-grande: 1.25rem;
  --pilula: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* reading modes, one per block (decorative colors only; mode 5 is set in it.css):
     1 rain on the town, 2 the summer of 1958, 3 the cold of the grown-ups, 4 the deadlights, 5 the notebook */
  --modo-1a: #8ea2b6; --modo-1b: #4f6d8f;
  --modo-2a: #f2c230; --modo-2b: #e5484d;
  --modo-3a: #7fa7c9; --modo-3b: #b6c0ca;
  --modo-4a: #ff8a3d; --modo-4b: #f2c230;
  --modo-5a: #d8c9a8; --modo-5b: #8ea2b6;

  /* sky (fundo 'ceu'): unused here, kept for the engine */
  --ceu-1: #121a24; --ceu-2: #241d0c; --ceu-3: #101a24; --ceu-4: #26140a;

  /* interactive tokens: the art reads these, the mechanics never do */
  --fig-fundo: #090c10;
  --fig-tinta: #f1f4f7;
  --fig-suave: #98a4b1;
  --fig-acento: #f2c230;
  --fig-acento-2: #ff8a3d;
  --fig-alerta: #f07070;

  color-scheme: dark;
}

/* light face: tema 'claro' or the reader's choice with tema 'alternavel' */
:root[data-tema-ativo="claro"] {
  --fundo: #f4efe6;
  --fundo-2: #ebe4d8;
  --painel: #fbf8f2;
  --painel-2: #efe8dc;
  --linha: rgba(36, 31, 43, 0.14);
  --linha-2: rgba(36, 31, 43, 0.26);
  --titulo: #1d1824;
  --texto: #2b2533;
  --suave: #4c4456;
  --fraco: #625a6d;
  --acento: #74490b;
  --acento-2: #5d34b0;
  --alerta: #a3282f;
  --sobre-acento: #fff8ea;
  --vidro: rgba(251, 248, 242, 0.86);
  --vidro-forte: rgba(251, 248, 242, 0.92);
  --vidro-borda: rgba(36, 31, 43, 0.14);
  --modo-1a: #7b4fd6; --modo-1b: #c43a7e;
  --modo-2a: #a06a12; --modo-2b: #7b4fd6;
  --modo-3a: #1f7f71; --modo-3b: #3561a8;
  --modo-4a: #b2404f; --modo-4b: #a06a12;
  --ceu-1: #ece2f7; --ceu-2: #f5e7cf; --ceu-3: #dcefec; --ceu-4: #f6dde0;
  --fig-fundo: #fbf8f2;
  --fig-tinta: #1d1824;
  --fig-suave: #625a6d;
  --fig-acento: #8a5a10;
  --fig-acento-2: #6a3fc0;
  --fig-alerta: #a3282f;
  color-scheme: light;
}

/* ---------- BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--barra-altura) + 1.5rem); }
body {
  min-height: 100dvh; overflow-x: hidden;
  font-family: var(--fonte-texto); font-size: var(--t-base); line-height: 1.78;
  color: var(--texto); background-color: var(--fundo);
  --m1: var(--modo-1a); --m2: var(--modo-1b);
  transition: --m1 900ms ease, --m2 900ms ease, background-color 400ms ease;
}
body[data-modo-ativo="2"] { --m1: var(--modo-2a); --m2: var(--modo-2b); }
body[data-modo-ativo="3"] { --m1: var(--modo-3a); --m2: var(--modo-3b); }
body[data-modo-ativo="4"] { --m1: var(--modo-4a); --m2: var(--modo-4b); }
html:not([data-modos="true"]) body { --m1: var(--modo-1a); --m2: var(--modo-1b); }
/* mode colors are decorative; text in a mode color is mixed toward the title color so it keeps AA in both themes */
@media screen {
  .capitulo-nota-num, .fontes h3, .hud-leitura span, html:not([data-blocos="laminas"]) .bloco-numero { color: color-mix(in srgb, var(--m1) 62%, var(--titulo)) !important; }
}

/* the two languages: siblings, one visible */
body.is-pt [data-en] { display: none !important; }
body.is-en [data-pt] { display: none !important; }

img, svg, canvas, video { display: block; max-width: 100%; }
h1, h2, h3, h4 { font-weight: 500; line-height: 1.1; text-wrap: balance; color: var(--titulo); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
::selection { background: color-mix(in srgb, var(--acento) 35%, transparent); color: var(--titulo); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pular { position: fixed; left: 1rem; top: 1rem; z-index: 100000; padding: 0.6rem 1rem; border-radius: var(--pilula); background: var(--painel); color: var(--titulo); transform: translateY(-220%); }
.pular:focus { transform: none; }

/* buttons of the house */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px;
  padding: 0.6rem 1.4rem; border-radius: var(--pilula); text-decoration: none;
  font-size: var(--t-sm); letter-spacing: 0.06em; color: var(--sobre-acento); background: var(--acento);
  border: 1px solid transparent; transition: transform 200ms var(--ease), box-shadow 200ms ease;
}
/* on paper the accent button goes a shade deeper, so its words keep AA over a scene (Gnomon, QA 9 Nov 2026) */
:where(:root[data-tema-ativo="claro"]) .botao { background: color-mix(in srgb, var(--acento) 82%, #000); }   /* :where keeps it as weak as .botao: the outline variants still win */
.botao:hover { transform: translateY(-1px); box-shadow: 0 8px 24px color-mix(in srgb, var(--acento) 30%, transparent); }
.botao-sec { color: var(--titulo); background: transparent; border-color: var(--linha-2); }
.botao-sec:hover { border-color: var(--acento); box-shadow: none; }

/* ---------- LAYOUT ---------- */
main { position: relative; z-index: 2; }
.rodape, .barra { position: relative; z-index: 2; }
.bloco, .capitulo, .sussurro, .fontes, .fecho, .bio, .glossario-lista, .constelacao { position: relative; }
.capitulo {
  display: grid; grid-template-columns: minmax(var(--margem), 1fr) minmax(0, var(--coluna)) minmax(var(--margem), 1fr);
  padding: 4.5rem 0 3rem;
}
.capitulo > * { grid-column: 2; }
.capitulo > .larga { grid-column: 1 / -1; }
.prosa p, .cena p, .fio p, .caixa-termo p, .caixa-destaque p { max-width: var(--medida); }
.prosa p + p { margin-top: 1.15em; }
.prosa em { color: var(--titulo); }
.prosa a, .fio a, .leia-tambem a, .fontes a { text-decoration-color: var(--acento); text-underline-offset: 3px; }
.capitulo > * + * { margin-top: 1.6rem; }

/* ---------- BAR (built by ensaio.js) ---------- */
.barra {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 0.6rem; min-height: var(--barra-altura);
  padding: 0.45rem var(--margem);
  background: var(--vidro-forte); border-bottom: 1px solid var(--linha);
  -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur));
}
.barra-logo { font-family: var(--fonte-titulo); font-size: 1.05rem; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--suave); white-space: nowrap; }
.barra-logo:hover { color: var(--titulo); }
.barra-meio { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.6rem; }
.barra-onde { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); letter-spacing: 0.08em; color: var(--suave); }
.barra-capitulo { min-height: 34px; padding: 0.15rem 0.7rem; border-radius: var(--pilula); border: 1px solid var(--linha-2); font-size: var(--t-xs); color: var(--titulo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40ch; }
.barra-pct { font-family: var(--fonte-mono); font-size: var(--t-xs); color: var(--texto); font-variant-numeric: tabular-nums; min-width: 3.4ch; text-align: right; }
.barra-direita { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.barra-botao {
  min-width: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.15rem 0.7rem; border-radius: var(--pilula); border: 1px solid var(--linha-2);
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); background: transparent;
  transition: border-color 160ms ease, color 160ms ease;
}
.barra-botao:hover, .barra-botao[aria-pressed="true"], .barra-botao[aria-expanded="true"] { border-color: var(--m1); color: var(--titulo); }
.barra-progresso { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; pointer-events: none; }
.barra-progresso i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--m1), var(--m2)); }
.barra-secoes, .barra-marcas, .barra-etiqueta, .barra-capitulo, .barra-onde, .barra-pct { display: none; }

/* 'pilulas' (A marca): logo, essay pill, round buttons */
html[data-barra="pilulas"] .barra { background: linear-gradient(to bottom, var(--vidro-forte) 70%, color-mix(in srgb, var(--fundo) 60%, transparent)); }
html[data-barra="pilulas"] .barra-etiqueta { display: inline-block; font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; padding: 0.2rem 0.8rem; border-radius: var(--pilula); border: 1px solid var(--linha-2); color: var(--suave); }

/* 'faixa' (Oráculo, Identidade, 007, Errata, Bússola III, Matrix): current chapter, where, percent */
html[data-barra="faixa"] .barra-capitulo, html[data-barra="faixa"] .barra-pct { display: inline-block; }
html[data-barra="faixa"] .barra { min-height: 2.9rem; }

/* 'capsula' (Quem paga): a floating glass pill */
html[data-barra="capsula"] .barra {
  position: fixed; top: 0.7rem; left: 50%; transform: translateX(-50%); width: min(760px, calc(100% - 1.4rem));
  border: 1px solid var(--vidro-borda); border-radius: var(--pilula); background: var(--vidro); padding-inline: 0.9rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
}
html[data-barra="capsula"] .barra-onde { display: inline-block; }
/* inside the capsule, the progress line sits within the glass: drawn at the bottom edge (-1px) it hung
   one pixel below the floating capsule, over the text scrolling past (QA, 9 Nov 2026) */
html[data-barra="capsula"] .barra-progresso { left: 1.4rem; right: 1.4rem; bottom: 4px; border-radius: 2px; overflow: hidden; }
html[data-barra="capsula"] .hero { padding-top: 5rem; }

/* 'marcas' (Intersexo 1 e 2): one mark per block on the progress track */
html[data-barra="marcas"] .barra-marcas { display: block; position: relative; flex: 1; height: 24px; }
.barra-marcas::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; transform: translateY(-50%); background: var(--linha-2); border-radius: 2px; }
.barra-marcas .trilho-cheio { position: absolute; left: 0; top: 50%; height: 2px; transform: translateY(-50%); width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, var(--m1), var(--m2)); border-radius: 2px; }
.barra-marca { position: absolute; top: 50%; width: 24px; height: 24px; margin-left: -12px; transform: translateY(-50%); border-radius: 50%; display: grid; place-items: center; }
.barra-marca::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--fundo); border: 2px solid var(--fraco); transition: background 200ms ease, border-color 200ms ease; }
.barra-marca.is-lida::before { background: var(--m1); border-color: var(--m1); }
.barra-marca.is-atual::before { border-color: var(--titulo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--m1) 40%, transparent); }
html[data-barra="marcas"] .barra-progresso { display: none; }
html[data-barra="marcas"] .barra-meio { display: none; }
.idioma-polegar { position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--linha-2); border-radius: var(--pilula); padding: 2px; }
.idioma-polegar span { position: relative; z-index: 1; min-width: 2.2rem; text-align: center; font-size: 0.68rem; letter-spacing: 0.12em; line-height: 28px; }
.idioma-polegar::before { content: ''; position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: var(--pilula); background: color-mix(in srgb, var(--m1) 30%, transparent); transition: transform 240ms var(--ease); }
body.is-pt .idioma-polegar::before { transform: translateX(100%); }

/* 'secoes' (Your Idol): anchors to the big sections and a short tag */
html[data-barra="secoes"] .barra-secoes { display: flex; gap: 1.1rem; list-style: none; }
.barra-secoes a { font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; color: var(--suave); }
.barra-secoes a:hover, .barra-secoes a[aria-current="true"] { color: var(--titulo); }
html[data-barra="secoes"] .barra-etiqueta { display: inline-block; font-family: var(--fonte-mono); font-size: 0.7rem; color: var(--acento); }

/* ---------- OPENINGS (abertura) ---------- */
/* 'capa-musica': the house cover in the page flow (assets/music-cover.js) */
.capa {
  position: relative; min-height: 100vh; min-height: 100svh; z-index: 3; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem;
  padding: 2rem; text-align: center; background: #07050b; color: #f6f1fb;
}
.capa-tela { position: absolute; inset: 0; width: 100%; height: 100%; }
.capa > *:not(.capa-tela) { position: relative; z-index: 1; }
.capa-olho { font-size: var(--t-xs); letter-spacing: 0.36em; text-transform: uppercase; color: #c3b9d2; }
.capa-titulo { font-family: var(--fonte-titulo); font-style: italic; font-size: clamp(2.8rem, 1.2rem + 7vw, 7rem); line-height: 0.95; color: #e7b95c; text-shadow: 0 0 40px rgba(231, 185, 92, 0.45); }
.capa-sub { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); color: #c3b9d2; max-width: 30ch; }
.capa-entrar {
  margin-top: 0.8rem; min-height: 48px; padding: 0.9rem 2.4rem; border-radius: var(--pilula);
  border: 1px solid rgba(231, 185, 92, 0.6); color: #f6f1fb; letter-spacing: 0.28em; text-transform: uppercase; font-size: var(--t-sm);
  animation: capa-pulso 2.4s ease-in-out infinite;
}
@keyframes capa-pulso { 0%, 100% { box-shadow: 0 0 0 rgba(231, 185, 92, 0); } 50% { box-shadow: 0 0 34px rgba(231, 185, 92, 0.35); } }
.capa.bp-cover-off, .capa.bp-cover-off * { animation-play-state: paused !important; }

/* 'cortina' (Quem paga, Intersexo): once per session, never locks the scroll */
.cortina {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: var(--fundo); pointer-events: none;
  animation: cortina-emergencia 0.6s ease 4.5s forwards;
}
.cortina-laminas { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.cortina-laminas span { background: var(--fundo-2); border-right: 1px solid var(--linha); transform-origin: top; transition: transform 700ms var(--ease); }
.cortina-laminas span:nth-child(2) { transition-delay: 90ms; }
.cortina-laminas span:nth-child(3) { transition-delay: 180ms; }
.cortina-marca { position: relative; font-family: var(--fonte-titulo); font-size: var(--t-xl); letter-spacing: 0.08em; color: var(--titulo); transition: opacity 400ms ease; }
.cortina.is-abrindo .cortina-laminas span { transform: scaleY(0); }
.cortina.is-abrindo .cortina-marca { opacity: 0; }
.cortina.is-aberta { display: none; }
@keyframes cortina-emergencia { to { opacity: 0; visibility: hidden; } }

/* 'moldura' (Oráculo): a gold line draws the frame around the title */
.moldura {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: var(--fundo); pointer-events: none;
  transition: opacity 600ms ease; animation: cortina-emergencia 0.6s ease 5s forwards;
}
.moldura svg { position: absolute; inset: 8vmin; width: calc(100% - 16vmin); height: calc(100% - 16vmin); overflow: visible; }
.moldura rect { fill: none; stroke: var(--acento); stroke-width: 1.5; stroke-dasharray: 1; stroke-dashoffset: 1; animation: moldura-traco 2s var(--ease) forwards; }
.moldura-titulo { position: relative; font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-2xl); color: var(--titulo); opacity: 0; animation: moldura-titulo 900ms ease 700ms forwards; text-align: center; padding: 0 1rem; }
@keyframes moldura-traco { to { stroke-dashoffset: 0; } }
@keyframes moldura-titulo { to { opacity: 1; } }
.moldura.is-saindo { opacity: 0; }

/* 'terminal' (Matrix): a line typed on a terminal, skippable */
.terminal {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: #050806; color: #9df5c4;
  font-family: var(--fonte-mono); font-size: clamp(1rem, 0.8rem + 1vw, 1.5rem);
  transition: opacity 500ms ease; animation: cortina-emergencia 0.6s ease 8.5s forwards;
}
.terminal-linha { min-height: 1.6em; padding: 0 1.4rem; text-align: left; max-width: 40ch; }
.terminal-linha::after { content: '\2588'; margin-left: 0.15em; animation: terminal-cursor 1s steps(1) infinite; }
@keyframes terminal-cursor { 50% { opacity: 0; } }
.terminal-pular { position: absolute; right: 1.2rem; bottom: 1.2rem; min-height: 44px; padding: 0.5rem 1.1rem; border-radius: var(--pilula); border: 1px solid rgba(157, 245, 196, 0.45); color: #c9fbe0; font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.terminal.is-saindo { opacity: 0; }

/* ---------- HERO ---------- */
.hero {
  position: relative; z-index: 1; overflow: hidden; isolation: isolate;
  min-height: 100vh; min-height: 100svh; display: flex; align-items: center; justify-content: center;
  padding: 6rem var(--margem) 4rem; text-align: center;
}
.hero-arte { position: absolute; inset: 0; z-index: -2; background: radial-gradient(ellipse 70% 60% at 60% 40%, var(--painel-2), var(--fundo) 70%); }
.hero-arte img { width: 100%; height: 100%; object-fit: cover; }
.hero-texto { position: relative; max-width: 980px; display: flex; flex-direction: column; align-items: center; gap: 1.1rem; }
.hero-olho { font-size: var(--t-xs); letter-spacing: 0.34em; text-transform: uppercase; color: var(--acento-2); }
.hero-titulo { font-family: var(--fonte-titulo); font-size: var(--t-hero); line-height: 0.92; letter-spacing: -0.02em; font-weight: 600; }
.hero-titulo em { font-style: italic; font-weight: 400; color: var(--acento); }
.hero-sub { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); line-height: 1.3; color: var(--suave); max-width: 40ch; }
.hero-tese { max-width: 46ch; padding: 0.9rem 1.4rem; color: var(--titulo); border-top: 1px solid color-mix(in srgb, var(--acento) 45%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--acento) 45%, transparent); }
.hero-fatos { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; }
.hero-fatos li { font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; padding: 0.25rem 0.85rem; border-radius: var(--pilula); border: 1px solid var(--linha-2); color: var(--suave); background: color-mix(in srgb, var(--fundo) 55%, transparent); }
.hero-assinatura { font-size: var(--t-sm); color: var(--suave); }
.hero-assinatura strong { color: var(--titulo); font-weight: 500; }
.hero-acoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.hero-aviso-contagem { font-family: var(--fonte-mono); font-size: 0.75rem; color: #fff; background: #a3282f; padding: 0.4rem 0.8rem; border-radius: 6px; }
/* entrance in a stair (Quem paga, Intersexo); with no JS everything is visible */
html.js .hero-texto > * { opacity: 0; transform: translateY(14px); }
html.js .hero.is-pronto .hero-texto > * { opacity: 1; transform: none; transition: opacity 700ms ease, transform 700ms var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
/* if the script never arrives, the hero shows by itself */
html.js .hero:not(.is-pronto) .hero-texto > * { animation: hero-emergencia 0.6s ease 6s forwards; }
@keyframes hero-emergencia { to { opacity: 1; transform: none; } }

/* 'pintura-cheia' (Oráculo, Wolverine, 007, Rocky) */
/* a scene of the library in the hero takes the same arrangement: the words low on the left, over a
   veil, the scene free above and to the right (the vitral of Quem paga, the Refract of A identidade) */
html[data-hero="pintura-cheia"] .hero, html[data-hero="cena"] .hero[data-cena] { align-items: flex-end; text-align: left; padding-bottom: 6rem; }
html[data-hero="pintura-cheia"] .hero-texto, html[data-hero="cena"] .hero[data-cena] .hero-texto { align-items: flex-start; margin-right: auto; max-width: 860px; }
html[data-hero="pintura-cheia"] .hero-fatos, html[data-hero="pintura-cheia"] .hero-acoes,
html[data-hero="cena"] .hero[data-cena] :is(.hero-fatos, .hero-acoes, .hero-fio-cta) { justify-content: flex-start; }
/* over a painting or a drawn scene, the smaller hero lines carry a dark halo so they stay AA
   without dimming the art (A marca, qa/check_hero_contrast.cjs) */
html:is([data-hero="pintura-cheia"], [data-hero="anel-canvas"], [data-hero="cena"]) :is(.hero-olho, .hero-sub, .hero-tese, .hero-assinatura, .hero-fatos li) {
  text-shadow: 0 0 2px var(--fundo), 0 0 6px var(--fundo), 0 0 14px var(--fundo), 0 0 26px color-mix(in srgb, var(--fundo) 85%, transparent);
}
html[data-hero="pintura-cheia"] .hero::before, html[data-hero="cena"] .hero[data-cena]::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, var(--fundo) 0%, color-mix(in srgb, var(--fundo) 82%, transparent) 38%, color-mix(in srgb, var(--fundo) 25%, transparent) 75%, transparent), linear-gradient(90deg, color-mix(in srgb, var(--fundo) 88%, transparent) 0%, color-mix(in srgb, var(--fundo) 72%, transparent) 40%, transparent 70%); }

/* 'vidro' (Identidade, Intersexo 2, Rocky): the painting through glass with a clear window */
html[data-hero="vidro"] .hero-vidro {
  position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--fundo) 45%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.15); backdrop-filter: blur(22px) saturate(1.15);
  -webkit-mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
  /* the clear window: 32% x 60% of the hero, 6% from the right and 16% from the top
     (mask-position % = offset / (100% - size): 62/68 and 16/40) */
  -webkit-mask-size: 100% 100%, 32% 60%; -webkit-mask-position: 0 0, 91.2% 40%; -webkit-mask-repeat: no-repeat;
  -webkit-mask-composite: xor;
  mask-image: linear-gradient(#000, #000), linear-gradient(#000, #000);
  mask-size: 100% 100%, 32% 60%; mask-position: 0 0, 91.2% 40%; mask-repeat: no-repeat; mask-composite: exclude;
}
html[data-hero="vidro"] .hero-janela { position: absolute; z-index: -1; right: 6%; top: 16%; width: 32%; height: 60%; border: 1px solid var(--vidro-borda); border-radius: 4px; pointer-events: none; }
html[data-hero="vidro"] .hero { justify-content: flex-start; text-align: left; }
html[data-hero="vidro"] .hero-texto { align-items: flex-start; max-width: min(640px, 54vw); padding: 2.2rem 2rem; border-radius: var(--raio-grande); background: var(--vidro); border: 1px solid var(--vidro-borda); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 30px 80px rgba(0, 0, 0, 0.35); }
html[data-hero="vidro"] .hero-fatos, html[data-hero="vidro"] .hero-acoes { justify-content: flex-start; }
html[data-hero="vidro"] .hero-titulo { font-size: clamp(2.6rem, 1rem + 5vw, 6rem); }

/* 'anel-canvas' (A marca): plate behind a drawn ring and growing marks */
html[data-hero="anel-canvas"] .hero-arte img { filter: brightness(0.55); }
html[data-hero="anel-canvas"] .hero-tela, html[data-hero="cena"] .hero-tela { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; }
html[data-hero="anel-canvas"] .hero::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 48% 42% at 50% 50%, color-mix(in srgb, var(--fundo) 80%, transparent), transparent 75%); }
html[data-hero="anel-canvas"] .hero-titulo { background: linear-gradient(118deg, var(--titulo) 0%, var(--acento-2) 35%, var(--acento) 75%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
html[data-hero="anel-canvas"] .hero-titulo em { -webkit-text-fill-color: transparent; }

/* 'cena': a canvas that hosts the essay's own scene */
html[data-hero="cena"] .hero-arte img { opacity: 0; transition: opacity 600ms ease; }
html[data-hero="cena"] .hero.sem-cena .hero-arte img { opacity: 1; }
/* a library scene laid over the painting keeps it (Censer on the Oracle's cover, Glister on Rocky's castle) */
html[data-hero="cena"] .hero[data-cena-mistura] .hero-arte img { opacity: 1; }
html[data-hero="cena"] .hero-tela { mix-blend-mode: var(--cena-mistura, normal); opacity: var(--cena-opacidade, 1); }
/* a library scene keeps only the low veil of the arrangement above, not the centred halo */
html[data-hero="cena"] .hero[data-cena]::after { display: none; }
/* the words of the hero sit on a glass panel over a library scene, as the title of A identidade sits
   in its glass and Quem paga sets its words on glass panels: a moving scene, bright or dark, never
   takes them below AA; on a light page the panel is paper */
html[data-hero="cena"] .hero[data-cena] .hero-texto { padding: 1.6rem 1.8rem; border-radius: var(--raio-grande); background: color-mix(in srgb, var(--fundo) 82%, transparent); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28); }
:root[data-tema-ativo="claro"][data-hero="cena"] .hero[data-cena] .hero-texto { background: color-mix(in srgb, var(--fundo) 95%, transparent); }
/* the floating capsule over a bright scene takes the stronger glass */
html[data-hero="cena"][data-barra="capsula"] .barra { background: var(--vidro-forte); }
.hero-passos a { padding: 0.15rem 0.55rem; border-radius: var(--pilula); background: color-mix(in srgb, var(--fundo) 82%, transparent); }
html[data-hero="cena"] .hero::after { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 52% 46% at 50% 50%, color-mix(in srgb, var(--fundo) 72%, transparent), transparent 80%); }

/* 'tipografico' (Bússola II e III): type only, the series steps below */
html[data-hero="tipografico"] .hero-arte { background: var(--fundo); }
html[data-hero="tipografico"] .hero-arte img { display: none; }
html[data-hero="tipografico"] .hero-olho { font-variant: small-caps; text-transform: none; letter-spacing: 0.24em; font-size: var(--t-sm); color: var(--suave); }
html[data-hero="tipografico"] .hero-titulo { font-style: italic; font-weight: 300; }
html[data-hero="tipografico"] .hero-titulo em { font-style: italic; font-weight: 500; }
html[data-hero="tipografico"] .hero-tese { border: 0; padding: 0; }
html[data-hero="tipografico"] .hero-tese::before { content: ''; display: block; width: 4rem; height: 1px; margin: 0 auto 1rem; background: var(--acento); }
.hero-passos { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.2rem; font-size: var(--t-sm); }
.hero-passos a { color: var(--suave); text-decoration: none; }
.hero-passos a:hover { color: var(--titulo); }
.hero-passos [aria-current] { color: var(--acento); }

/* heroMovimento: 'brasas' (Wolverine) and 'deriva' (Rocky castle) */
.hero-brasas { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.hero-brasas span { position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%; background: var(--acento); box-shadow: 0 0 8px var(--acento); opacity: 0; animation: brasa-sobe linear infinite; }
@keyframes brasa-sobe { 0% { transform: translate(0, 0); opacity: 0; } 12% { opacity: 0.9; } 100% { transform: translate(var(--dx, 20px), -105vh); opacity: 0; } }
html[data-hero-movimento="deriva"] .hero-arte img { animation: hero-deriva 38s ease-in-out infinite alternate; transform-origin: 60% 40%; }
@keyframes hero-deriva { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.12) translate(-2%, -1.5%); } }
html.is-pausado .hero-brasas span, html.is-pausado .hero-arte img, html.is-pausado .capa-entrar { animation-play-state: paused !important; }
.hero-continuar { display: none; }
.hero-continuar.is-visivel { display: inline-flex; }

/* ---------- WHISPER ---------- */
.sussurro { text-align: center; padding: 3rem var(--margem); font-family: var(--fonte-titulo); font-style: italic; font-size: clamp(1rem, 0.9rem + 0.6vw, 1.35rem); color: var(--suave); }
.sussurro::before, .sussurro::after { content: ''; display: block; width: 70px; height: 1px; margin: 0 auto; background: linear-gradient(90deg, transparent, var(--m1), transparent); }
.sussurro::before { margin-bottom: 1.4rem; }
.sussurro::after { margin-top: 1.4rem; }

/* ---------- INDEX (indice) ---------- */
/* 'constelacao' (A marca): an SVG map along one thread, a list below */
.constelacao { max-width: 1120px; margin: 0 auto; padding: 3.5rem var(--margem) 2.5rem; }
.constelacao-titulo { font-family: var(--fonte-titulo); font-size: var(--t-xl); margin-bottom: 0.4rem; }
.constelacao-intro { color: var(--suave); max-width: 60ch; margin-bottom: 1.2rem; }
.constelacao svg { width: 100%; height: auto; overflow: visible; margin-bottom: 1rem; }
.constelacao ol { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; border-top: 1px solid var(--linha); }
.constelacao li { border-bottom: 1px solid var(--linha); }
.constelacao a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); align-items: center; gap: 0.6rem; padding: 0.55rem 0.3rem; text-decoration: none; color: var(--suave); }
.constelacao a:hover { color: var(--titulo); background: color-mix(in srgb, var(--m1) 10%, transparent); }
.constelacao-num { font-family: var(--fonte-titulo); color: var(--suave); font-variant-numeric: tabular-nums; }

/* 'gaveta' (Errata, Bússola III, Matrix, Quem paga) and the drawer of 'trilha' under 1100 px */
.gaveta {
  position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 0.8rem; padding: 1.2rem 1.2rem 2rem;
  background: var(--vidro-forte); border-left: 1px solid var(--linha-2);
  -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur));
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(105%); visibility: hidden; transition: transform 320ms var(--ease), visibility 0s linear 320ms;
}
.gaveta.is-aberta { transform: none; visibility: visible; transition: transform 320ms var(--ease); }
.gaveta-topo { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.gaveta-titulo { font-family: var(--fonte-titulo); font-size: var(--t-lg); }
.gaveta-fechar { min-width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid var(--linha-2); font-size: 1.2rem; }
.gaveta-busca { width: 100%; min-height: 44px; padding: 0.5rem 0.9rem; border-radius: var(--raio); border: 1px solid var(--linha-2); background: var(--painel); color: var(--titulo); font: inherit; font-size: var(--t-sm); }
.gaveta details { border-top: 1px solid var(--linha); padding: 0.4rem 0; }
.gaveta summary { cursor: pointer; padding: 0.4rem 0; font-size: var(--t-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--acento); }
.gaveta ol { list-style: none; }
.gaveta a { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.4rem; padding: 0.45rem 0.3rem; text-decoration: none; color: var(--suave); border-radius: 6px; }
.gaveta a:hover, .gaveta a[aria-current="true"] { color: var(--titulo); background: color-mix(in srgb, var(--m1) 12%, transparent); }
.gaveta-vazio { color: var(--fraco); font-size: var(--t-sm); }
.gaveta-fundo { position: fixed; inset: 0; z-index: 79; background: rgba(0, 0, 0, 0.4); opacity: 0; visibility: hidden; transition: opacity 300ms ease, visibility 0s linear 300ms; }
.gaveta.is-aberta + .gaveta-fundo { opacity: 1; visibility: visible; transition: opacity 300ms ease; }

/* 'trilha' (Oráculo, Rocky, Wolverine): a side column from 1100 px, with a reading bar per chapter */
.trilha-barra { display: block; height: 2px; margin-top: 0.25rem; background: var(--linha); border-radius: 2px; overflow: hidden; }
.trilha-barra i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0)); background: var(--m1); }
@media (min-width: 1100px) {
  html[data-indice="trilha"] .gaveta {
    top: calc(var(--barra-altura) + 1rem); left: 0; right: auto; bottom: 1rem; width: 15rem; z-index: 40;
    transform: none; visibility: visible; background: transparent; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0.5rem 1rem;
  }
  html[data-indice="trilha"] .gaveta-topo, html[data-indice="trilha"] .gaveta-busca, html[data-indice="trilha"] .gaveta-fundo { display: none; }
  html[data-indice="trilha"] .gaveta a { grid-template-columns: 1.6rem minmax(0, 1fr); font-size: var(--t-xs); line-height: 1.4; padding: 0.35rem 0.2rem; }
  html[data-indice="trilha"] .gaveta summary { font-size: 0.62rem; }
  html[data-indice="trilha"] main, html[data-indice="trilha"] .rodape { padding-left: 15rem; }
  html[data-indice="trilha"] .barra-indice { display: none; }
}
html:not([data-indice="trilha"]) .trilha-barra { display: none; }

/* trilhoPontos (Bússola): a column of dots with N/total, hidden on small screens */
.trilho-pontos { position: fixed; right: 1.1rem; top: 50%; z-index: 45; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; opacity: 0; transition: opacity 400ms ease; }
.trilho-pontos.is-visivel { opacity: 1; }
.trilho-pontos button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.trilho-pontos button::before { content: ''; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--fraco); transition: all 200ms ease; }
.trilho-pontos button.is-lido::before { background: var(--m1); border-color: var(--m1); }
.trilho-pontos button[aria-current]::before { width: 11px; height: 11px; border-color: var(--titulo); background: var(--titulo); }
.trilho-pontos-conta { font-family: var(--fonte-mono); font-size: 0.7rem; color: var(--suave); }
@media (max-width: 1099px) { .trilho-pontos { display: none; } }
/* ---------- BLOCKS (blocos) ---------- */
.bloco-cabeca { position: relative; max-width: 1180px; margin: 0 auto; padding: 4rem var(--margem) 1rem; }
.bloco-numero { font-family: var(--fonte-titulo); color: var(--m1); }
.bloco-rotulo { font-size: var(--t-xs); letter-spacing: 0.22em; text-transform: uppercase; color: var(--suave); }
.bloco-titulo { font-family: var(--fonte-titulo); font-size: var(--t-2xl); }
.bloco-resumo { color: var(--suave); max-width: 46ch; }
.bloco-prancha { margin: 0; background: linear-gradient(160deg, var(--painel-2), var(--fundo-2)); border-radius: var(--raio-grande); overflow: hidden; }
.bloco-prancha img { width: 100%; height: 100%; object-fit: cover; }
.bloco-lista { list-style: none; display: grid; gap: 0.2rem; font-size: var(--t-sm); }
.bloco-lista a { color: var(--suave); text-decoration: none; }
.bloco-lista a:hover { color: var(--titulo); }

/* false: a slim label keeps the h2 without a block opening */
html[data-blocos="false"] .bloco-cabeca { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 1rem; padding: 3rem var(--margem) 0; max-width: calc(var(--coluna) + 2 * var(--margem)); }
html[data-blocos="false"] .bloco-numero { font-size: var(--t-lg); }
html[data-blocos="false"] .bloco-titulo { font-size: var(--t-lg); font-style: italic; }
html[data-blocos="false"] .bloco-rotulo, html[data-blocos="false"] .bloco-resumo, html[data-blocos="false"] .bloco-prancha, html[data-blocos="false"] .bloco-lista { display: none; }

/* 'prancha-ao-lado' (Bússola III, Identidade, Matrix, Quem paga): the plate beside, alternating */
html[data-blocos="prancha-ao-lado"] .bloco-cabeca { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); grid-template-areas: "num prancha" "rot prancha" "tit prancha" "res prancha" "lis prancha"; align-content: center; column-gap: clamp(1.5rem, 1rem + 3vw, 4rem); row-gap: 0.7rem; padding-top: 6rem; }
html[data-blocos="prancha-ao-lado"] .bloco-numero { grid-area: num; font-size: var(--t-2xl); line-height: 1; }
html[data-blocos="prancha-ao-lado"] .bloco-rotulo { grid-area: rot; }
html[data-blocos="prancha-ao-lado"] .bloco-titulo { grid-area: tit; }
html[data-blocos="prancha-ao-lado"] .bloco-resumo { grid-area: res; }
html[data-blocos="prancha-ao-lado"] .bloco-lista { grid-area: lis; margin-top: 0.4rem; }
html[data-blocos="prancha-ao-lado"] .bloco-prancha { grid-area: prancha; aspect-ratio: 4 / 5; align-self: center; }
html[data-blocos="prancha-ao-lado"] .bloco.is-par .bloco-cabeca { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); grid-template-areas: "prancha num" "prancha rot" "prancha tit" "prancha res" "prancha lis"; }

/* 'laminas' (Intersexo 1 e 2): three sheets, roman numeral behind, glass title in the middle */
html[data-blocos="laminas"] .bloco-cabeca { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: center; min-height: 70vh; padding-top: 6rem; }
html[data-blocos="laminas"] .bloco-numero { grid-column: 1 / 8; grid-row: 1 / 4; font-size: clamp(9rem, 4rem + 20vw, 22rem); line-height: 0.8; color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--m1) 55%, transparent); z-index: 0; }
html[data-blocos="laminas"] .bloco-prancha { grid-column: 6 / 13; grid-row: 1 / 4; aspect-ratio: 4 / 5; opacity: 0.55; z-index: 0; }
html[data-blocos="laminas"] .bloco-rotulo { grid-column: 3 / 10; grid-row: 1; z-index: 1; justify-self: start; padding: 0.2rem 0.7rem; border-radius: var(--pilula); background: var(--fundo); }
html[data-blocos="laminas"] .bloco-titulo { grid-column: 2 / 10; grid-row: 2; z-index: 1; padding: 1.4rem 1.6rem; border-radius: var(--raio-grande); background: var(--vidro); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur)); }
html[data-blocos="laminas"] .bloco-resumo, html[data-blocos="laminas"] .bloco-lista { grid-column: 4 / 12; z-index: 1; padding: 0.9rem 1.2rem; background: var(--painel); border: 1px solid var(--linha); border-radius: var(--raio); }
html[data-blocos="laminas"] .bloco-resumo { grid-row: 3; align-self: start; margin-top: 1rem; }
html[data-blocos="laminas"] .bloco-lista { grid-row: 4; border-top: 0; border-radius: 0 0 var(--raio) var(--raio); margin-top: -0.4rem; }
html[data-blocos="laminas"] .bloco.is-par .bloco-numero { grid-column: 6 / 13; text-align: right; }
html[data-blocos="laminas"] .bloco.is-par .bloco-prancha { grid-column: 1 / 8; }
html[data-blocos="laminas"] .bloco.is-par .bloco-titulo { grid-column: 4 / 12; }
html[data-blocos="laminas"] .bloco.is-par .bloco-resumo, html[data-blocos="laminas"] .bloco.is-par .bloco-lista { grid-column: 2 / 10; }

/* 'limiar' (Wolverine): the plate full width, the numeral in a glass */
html[data-blocos="limiar"] .bloco-cabeca { max-width: none; min-height: 78vh; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 0.6rem; padding: 6rem var(--margem) 3rem; overflow: hidden; isolation: isolate; }
html[data-blocos="limiar"] .bloco-prancha { position: absolute; inset: 0; z-index: -1; border-radius: 0; }
html[data-blocos="limiar"] .bloco-prancha::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--fundo), color-mix(in srgb, var(--fundo) 30%, transparent) 60%, transparent); }
html[data-blocos="limiar"] .bloco-numero { font-size: var(--t-xl); padding: 0.4rem 1.1rem; border-radius: var(--raio); background: var(--vidro); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur)); }
html[data-blocos="limiar"] .bloco-lista { display: none; }

/* ---------- CHAPTER (capitulo) ---------- */
.capitulo-rotulo { font-size: var(--t-xs); letter-spacing: 0.22em; text-transform: uppercase; color: var(--suave); }
.capitulo-titulo { font-family: var(--fonte-titulo); font-size: var(--t-xl); margin-top: 0.3rem; }
.capitulo-titulo:focus { outline: none; }
.capitulo-numeral, .capitulo-numero, .capitulo-nota { display: none; }

/* 'numeral-vazado' (A marca) */
html[data-capitulo="numeral-vazado"] .capitulo-cabeca { position: relative; padding-top: 2rem; }
html[data-capitulo="numeral-vazado"] .capitulo-numeral { display: block; position: absolute; z-index: -1; top: -2rem; left: 50%; transform: translateX(-60%); pointer-events: none; font-family: var(--fonte-titulo); font-weight: 800; font-size: clamp(8rem, 4rem + 16vw, 17rem); line-height: 1; color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--m1) 50%, transparent); opacity: 0.6; }
html[data-capitulo="numeral-vazado"] .capitulo-titulo { font-style: italic; font-size: var(--t-2xl); text-shadow: 0 0 34px color-mix(in srgb, var(--m1) 45%, transparent); }

/* 'nota-margem' (Quem paga, Intersexo 2, Bússola III, Matrix, 007, Errata, Alastor) */
html[data-capitulo="nota-margem"] .capitulo-nota { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1rem; }
.capitulo-nota-num { font-family: var(--fonte-titulo); font-size: var(--t-2xl); line-height: 1; color: var(--m1); font-variant-numeric: tabular-nums; }
.capitulo-nota-fio { width: 2.4rem; height: 1px; background: var(--m1); }
.capitulo-nota-bloco { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--suave); }
@media (min-width: 1100px) {
  html[data-capitulo="nota-margem"] .capitulo { grid-template-columns: minmax(var(--margem), 1fr) 11rem minmax(0, var(--coluna)) minmax(var(--margem), 1fr); }
  html[data-capitulo="nota-margem"] .capitulo > * { grid-column: 3; }
  html[data-capitulo="nota-margem"] .capitulo > .larga { grid-column: 1 / -1; }
  html[data-capitulo="nota-margem"] .capitulo-nota { grid-column: 2; grid-row: 1 / span 40; align-self: start; position: sticky; top: calc(var(--barra-altura) + 2rem); margin: 0; padding-right: 1.5rem; }
  html[data-capitulo="nota-margem"] .capitulo > .capitulo-nota + * { margin-top: 0; }
}

/* 'numero' (Identidade, Prova) */
html[data-capitulo="numero"] .capitulo-numero { display: block; font-family: var(--fonte-titulo); font-size: clamp(3.5rem, 2rem + 5vw, 5.5rem); line-height: 0.9; color: var(--m1); font-variant-numeric: tabular-nums; }
html[data-capitulo="numero"] .capitulo-rotulo { display: none; }

/* 'rotulo' (Rocky) */
html[data-capitulo="rotulo"] .capitulo-rotulo { font-family: var(--fonte-mono); letter-spacing: 0.1em; color: var(--acento); }
html[data-capitulo="rotulo"] .capitulo-titulo { font-family: var(--fonte-texto); font-weight: 500; letter-spacing: -0.01em; }

/* ---------- CHAPTER PLATES (pranchas) ---------- */
.prancha { margin: 0; position: relative; background: linear-gradient(120deg, var(--painel-2), var(--fundo-2)); border-radius: var(--raio-grande); overflow: hidden; }
.prancha img, .prancha video { width: 100%; height: 100%; object-fit: cover; object-position: var(--prancha-pos, 50% 50%); }
.prancha video { position: absolute; inset: 0; opacity: 0; transition: opacity 1200ms ease; }
.prancha video.is-viva { opacity: 1; }
html[data-pranchas="false"] .prancha { display: none; }
/* 'larga' (A marca): 2:1 with soft edges, 4:3 on a phone, accepts a muted video */
html[data-pranchas="larga"] .prancha { grid-column: 1 / -1; aspect-ratio: 2 / 1; max-height: 78vh; border-radius: 0; background: none; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 86%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 86%, transparent); }
/* 'atras-do-titulo' (Oráculo, 007): the painting behind the chapter title */
@media (min-width: 900px) {
  html[data-pranchas="atras-do-titulo"] .capitulo { position: relative; padding-top: 0; }
  html[data-pranchas="atras-do-titulo"] .prancha { grid-column: 1 / -1; grid-row: 1; height: 70vh; border-radius: 0; z-index: 0; -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent); mask-image: linear-gradient(to bottom, #000 40%, transparent); }
  html[data-pranchas="atras-do-titulo"] .capitulo-cabeca { grid-row: 1; align-self: end; z-index: 1; padding-bottom: 3rem; }
  html[data-pranchas="atras-do-titulo"] .prancha img { filter: brightness(0.62); }
  html[data-pranchas="atras-do-titulo"][data-tema-ativo="claro"] .prancha img { filter: brightness(1.08) saturate(0.8); }
  html[data-pranchas="atras-do-titulo"] .capitulo > .prancha + * { margin-top: 0; }
}
html[data-pranchas="atras-do-titulo"] .prancha { aspect-ratio: 16 / 9; }
/* with the margin note, wide pieces start after the note's column so they never cover it */
@media (min-width: 1100px) {
  html[data-capitulo="nota-margem"][data-pranchas] .capitulo > .prancha,
  html[data-capitulo="nota-margem"][data-interativo="arena"] .capitulo > .interativo { grid-column: 3 / -1; }
}
@media (min-width: 900px) { html[data-pranchas="atras-do-titulo"] .prancha { aspect-ratio: auto; } }

/* ---------- TEXT COMPONENTS ---------- */
/* prosa: 'vidro' (A marca), 'papel' (Alastor, Identidade), 'limpa' (Oráculo, Bússola III, Matrix) */
html[data-prosa="vidro"] .prosa { padding: 2rem 2.2rem; border-radius: var(--raio-grande); background: var(--vidro); border: 1px solid var(--linha); -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 50px rgba(0, 0, 0, 0.3); }
html[data-prosa="papel"] .prosa { padding: 2.2rem 2.4rem; border-radius: 4px; background: var(--painel); border: 1px solid var(--linha); box-shadow: 0 1px 0 var(--linha-2), 0 14px 40px rgba(0, 0, 0, 0.18); }
html[data-prosa="papel"] .prosa p { font-family: var(--fonte-titulo); font-size: 1.12em; line-height: 1.7; }

/* cena (A marca): a film frame with black bars, label, timecode and a drop cap */
.cena { position: relative; overflow: hidden; padding: 3rem 2.2rem 2.8rem; border-radius: var(--raio-grande); background: radial-gradient(ellipse 70% 90% at 15% 0%, color-mix(in srgb, var(--acento) 16%, transparent), transparent 60%), radial-gradient(ellipse 60% 80% at 100% 100%, color-mix(in srgb, var(--m1) 18%, transparent), transparent 60%), var(--fundo-2); border: 1px solid color-mix(in srgb, var(--m1) 28%, transparent); }
.cena::before, .cena::after { content: ''; position: absolute; left: 0; right: 0; height: 22px; background: #000; }
.cena::before { top: 0; }
.cena::after { bottom: 0; }
.cena-rotulo { position: absolute; top: 2px; left: 1rem; z-index: 1; font-size: 0.62rem; line-height: 18px; letter-spacing: 0.22em; text-transform: uppercase; color: #e7b95c; }
.cena-tempo { position: absolute; bottom: 2px; right: 1rem; z-index: 1; font-size: 0.62rem; line-height: 18px; letter-spacing: 0.18em; color: #c3b9d2; font-variant-numeric: tabular-nums; }
.cena .soco { margin-top: 1.1rem; }
html[data-cena="false"] .cena { padding: 0; background: none; border: 0; overflow: visible; }
html[data-cena="false"] .cena::before, html[data-cena="false"] .cena::after, html[data-cena="false"] .cena-rotulo, html[data-cena="false"] .cena-tempo { display: none; }

/* capitular (Your Idol, A marca) */
.capitular::first-letter { font-family: var(--fonte-titulo); font-weight: 700; font-size: 4.2em; float: left; line-height: 0.8; margin: 0.06em 0.12em 0 0; color: var(--acento); }

/* soco: 'filete' (A marca), 'martelo' (Prova, Rocky, Intersexo 2), 'mono' (Errata) */
.soco { font-family: var(--fonte-titulo); font-size: var(--t-lg); line-height: 1.32; color: var(--titulo); }
html[data-soco="filete"] .soco { padding-left: 1.1rem; border-left: 3px solid var(--acento); }
html[data-soco="martelo"] .soco { font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem); font-style: italic; line-height: 1.15; margin-block: 1.6rem; }
html[data-soco="martelo"] .soco::after { content: ''; display: block; width: 3rem; height: 1px; margin-top: 1rem; background: var(--acento); }
html[data-soco="mono"] .soco { font-family: var(--fonte-mono); font-size: var(--t-base); letter-spacing: 0.02em; padding: 0.7rem 1rem; border-left: 3px solid var(--alerta); background: color-mix(in srgb, var(--alerta) 8%, transparent); }

/* coda: 'estrela' (A marca), 'traco' (Rocky), 'glifo' (Wolverine, Beast), 'secao' (Your Idol) */
.coda { margin: 2.4rem auto 0; max-width: 30ch; text-align: center; font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); line-height: 1.35; color: var(--titulo); }
html[data-coda="estrela"] .coda::before { content: '\2726'; display: block; margin-bottom: 0.7rem; font-style: normal; font-size: 1rem; color: var(--acento); }
html[data-coda="traco"] .coda { text-align: left; margin-left: 0; max-width: 34ch; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem); }
html[data-coda="traco"] .coda::after { content: ''; display: block; width: 100%; height: 1px; margin-top: 1.6rem; background: linear-gradient(90deg, var(--acento), transparent); }
html[data-coda="glifo"] .coda::before { content: ''; display: block; width: 46px; height: 24px; margin: 0 auto 0.8rem; background: var(--acento); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 24'%3E%3Cpath d='M2 20 L14 4 M17 22 L23 2 M29 22 L32 4 M44 20 L36 6' stroke='black' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 24'%3E%3Cpath d='M2 20 L14 4 M17 22 L23 2 M29 22 L32 4 M44 20 L36 6' stroke='black' stroke-width='3' stroke-linecap='round' fill='none'/%3E%3C/svg%3E") center / contain no-repeat; }
html[data-coda="secao"] .coda { max-width: none; margin: 3rem 0 0; padding: 3rem 2rem; border-radius: var(--raio-grande); background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--m1) 14%, transparent), transparent 70%), var(--fundo-2); border: 1px solid var(--linha); font-size: var(--t-base); line-height: 1.7; }

/* tese: 'degrade' (A marca), 'borda' (Identidade), 'contrato' (Prova) */
.tese { text-align: center; margin-block: 2.8rem; }
.tese-rotulo { font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--suave); margin-bottom: 0.6rem; }
.tese-frase { margin: 0 auto; max-width: 26ch; font-family: var(--fonte-titulo); font-style: italic; font-size: clamp(1.6rem, 1.2rem + 2vw, 2.7rem); line-height: 1.14; color: var(--titulo); }
html[data-tese="degrade"] .tese-frase { background: linear-gradient(110deg, var(--titulo) 0%, var(--acento-2) 40%, var(--acento) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
html[data-tese="borda"] .tese { text-align: left; padding: 0.4rem 0 0.4rem 1.2rem; border-left: 4px solid var(--acento); }
html[data-tese="borda"] .tese-frase { margin: 0; max-width: var(--medida); font-family: var(--fonte-texto); font-style: normal; font-weight: 600; font-size: var(--t-lg); }
html[data-tese="contrato"] .tese { text-align: left; padding: 1.4rem 1.6rem; border: 1px solid var(--linha-2); border-radius: 4px; background: repeating-linear-gradient(0deg, transparent 0 31px, var(--linha) 31px 32px), var(--painel); }
html[data-tese="contrato"] .tese-rotulo { font-family: var(--fonte-mono); letter-spacing: 0.12em; color: var(--acento); }
html[data-tese="contrato"] .tese-rotulo::before { content: '00 / '; }
html[data-tese="contrato"] .tese-frase { margin: 0; max-width: none; font-style: normal; font-size: var(--t-lg); }

/* citacao: 'cartao' (Quem paga, Intersexo 2), 'destaque' (Intersexo 1), 'tela' (Matrix) */
.citacao { margin-block: 2rem; }
.citacao p { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); line-height: 1.4; color: var(--titulo); }
.citacao cite { display: block; margin-top: 0.6rem; font-style: normal; font-size: var(--t-xs); letter-spacing: 0.16em; text-transform: uppercase; color: var(--suave); }
html[data-citacao="cartao"] .citacao { padding: 1.4rem 1.6rem; border-radius: var(--raio); background: var(--painel); border: 1px solid var(--linha); }
html[data-citacao="destaque"] .citacao { text-align: center; padding: 1rem 0; border-top: 1px solid var(--linha-2); border-bottom: 1px solid var(--linha-2); }
html[data-citacao="destaque"] .citacao p { font-size: var(--t-xl); line-height: 1.2; }
html[data-citacao="tela"] .citacao { padding: 1rem 1.2rem; border: 1px solid color-mix(in srgb, var(--m1) 50%, transparent); background: color-mix(in srgb, var(--m1) 6%, transparent); }
html[data-citacao="tela"] .citacao p { font-family: var(--fonte-mono); font-style: normal; font-size: var(--t-base); }

/* fio pessoal (A marca, Intersexo 1) */
.fio { position: relative; padding: 1.8rem 2rem 1.8rem 2.8rem; border-radius: var(--raio-grande); background: radial-gradient(ellipse 60% 80% at 0% 0%, color-mix(in srgb, var(--m2) 14%, transparent), transparent 60%), var(--painel); border: 1px solid color-mix(in srgb, var(--m2) 30%, transparent); }
.fio::before { content: ''; position: absolute; left: 1.15rem; top: 1.4rem; bottom: 1.4rem; width: 2px; border-radius: 2px; background: linear-gradient(to bottom, var(--titulo), var(--m2) 20%, var(--m1) 80%, transparent); }
.fio::after { content: ''; position: absolute; left: calc(1.15rem - 4px); top: 1.2rem; width: 10px; height: 10px; border-radius: 50%; background: var(--titulo); box-shadow: 0 0 0 3px var(--m2); }
.fio-rotulo { font-size: 0.68rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--suave); margin-bottom: 0.7rem; }
.fio p + p { margin-top: 1em; }

/* marked phrases, breath, spoiler, divider */
.marca { color: var(--acento); font-weight: 500; padding: 0 0.15em; border-radius: 3px; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--acento) 22%, transparent) 62%); }
/* in the light face the gold mark keeps its highlight and takes the title ink (AA on the tint) */
:root[data-tema-ativo="claro"] .marca { color: var(--titulo); background: linear-gradient(transparent 58%, color-mix(in srgb, var(--acento) 30%, transparent) 58%); }
.formula { color: var(--titulo); font-style: italic; background: linear-gradient(transparent 60%, color-mix(in srgb, var(--acento-2) 30%, transparent) 60%); }
.respiro { text-align: center; letter-spacing: 0.6em; color: var(--fraco); }
.spoiler { padding: 0.8rem 1.1rem; border-radius: var(--raio); border: 1px dashed var(--linha-2); font-size: var(--t-sm); color: var(--suave); }
.divisor { display: flex; align-items: center; gap: 1rem; font-family: var(--fonte-titulo); font-size: var(--t-xs); letter-spacing: 0.36em; text-transform: uppercase; color: var(--suave); }
.divisor::before, .divisor::after { content: ''; flex: 1; height: 1px; background: linear-gradient(to right, transparent, var(--linha-2), transparent); }

/* tabela (Your Idol): scrolls sideways, takes focus, sticky header, a seal for the extreme case */
.tabela { overflow-x: auto; border-radius: var(--raio); border: 1px solid var(--linha); background: var(--painel); }
.tabela-titulo { padding: 0.9rem 1rem 0.2rem; font-size: var(--t-xs); letter-spacing: 0.18em; text-transform: uppercase; color: var(--suave); }
.tabela table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: var(--t-sm); }
.tabela th { position: sticky; top: 0; text-align: left; padding: 0.7rem 1rem; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--suave); background: var(--painel-2); }
.tabela td { padding: 0.75rem 1rem; border-top: 1px solid var(--linha); vertical-align: top; }
.tabela td:first-child { font-family: var(--fonte-mono); color: var(--titulo); }
.selo { display: inline-block; margin-left: 0.4rem; padding: 0.1rem 0.5rem; border-radius: var(--pilula); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sobre-acento); background: var(--alerta); }

/* caixa-termo and caixa-destaque (Your Idol) */
.caixa-termo, .caixa-destaque { padding: 1.3rem 1.5rem; border-radius: var(--raio); }
.caixa-termo { background: var(--painel); border: 1px solid var(--linha); }
.caixa-destaque { background: color-mix(in srgb, var(--alerta) 9%, var(--painel)); border-left: 3px solid var(--alerta); }
.caixa-rotulo { display: flex; align-items: center; gap: 0.5rem; font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--suave); margin-bottom: 0.6rem; }
.caixa-termo .caixa-rotulo::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--acento); }
.caixa-destacado { font-family: var(--fonte-mono); font-size: var(--t-lg); color: var(--acento); margin-bottom: 0.5rem; }
.caixa-termo p + p, .caixa-destaque p + p { margin-top: 0.6em; }

/* comparacao (Your Idol): two cards side by side, a column on a phone */
.comparacao { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.comparacao-cartao { padding: 1.4rem; border-radius: var(--raio); background: var(--painel); border: 1px solid var(--linha); }
.comparacao-cartao:last-child { border-color: color-mix(in srgb, var(--acento) 45%, transparent); }
.comparacao-rotulo { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--suave); }
.comparacao-pergunta { margin: 0.5rem 0; font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); line-height: 1.25; color: var(--titulo); }
.comparacao-resposta { font-size: var(--t-sm); color: var(--texto); }

/* read also, chapter sources, next chapter */
.leia-tambem { padding: 1.2rem 1.5rem; border-radius: var(--raio); background: linear-gradient(120deg, color-mix(in srgb, var(--m1) 12%, transparent), color-mix(in srgb, var(--m2) 8%, transparent)); border: 1px solid color-mix(in srgb, var(--m1) 30%, transparent); font-size: var(--t-sm); }
.leia-tambem-rotulo, .fontes-capitulo-titulo { font-size: 0.68rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--suave); margin-bottom: 0.4rem; }
.fontes-capitulo { padding: 1.2rem 1.4rem; border-radius: var(--raio); background: var(--fundo-2); border: 1px solid var(--linha); }
.fontes-capitulo ul { list-style: none; display: grid; gap: 0.4rem; font-size: var(--t-sm); color: var(--suave); }
.proximo a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.4rem; border-radius: var(--raio-grande); text-decoration: none; background: linear-gradient(var(--fundo-2), var(--fundo-2)) padding-box, linear-gradient(110deg, var(--m1), var(--m2), var(--acento)) border-box; border: 1px solid transparent; transition: transform 300ms var(--ease); }
.proximo a:hover { transform: translateY(-2px); }
.proximo-rotulo { display: block; font-size: 0.66rem; letter-spacing: 0.26em; text-transform: uppercase; color: var(--suave); }
.proximo-titulo { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); color: var(--titulo); }
.proximo-seta { font-family: var(--fonte-titulo); font-size: 2rem; color: var(--acento); }

/* ---------- INTERACTIVES (interativo) ---------- */
.interativo { margin-block: 3rem; }
.interativo-cabeca { margin-bottom: 1.2rem; }
.interativo-rotulo { font-size: 0.7rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--acento); }
.interativo-titulo { font-family: var(--fonte-titulo); font-size: var(--t-xl); margin: 0.3rem 0; }
.interativo-dica { display: inline-block; font-size: 0.74rem; letter-spacing: 0.08em; color: var(--suave); }
.palco { position: relative; min-height: 360px; border-radius: var(--raio-grande); overflow: hidden; background: var(--fig-fundo); border: 1px solid var(--linha-2); touch-action: pan-y pinch-zoom; }
.palco[data-quebrado="true"]::after { content: attr(data-quebrado-msg); position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; color: var(--suave); background: var(--fig-fundo); }
html.js .interativo.is-montado .interativo-estatico { display: none; }
html:not(.js) .palco { display: none; }
.interativo-estatico { margin-top: 0.8rem; padding: 1rem 1.2rem; border-radius: var(--raio); background: var(--painel); font-size: var(--t-sm); color: var(--suave); }
.interativo-conclusao { margin-top: 1rem; padding: 1rem 1.2rem; border-left: 3px solid var(--acento); font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); color: var(--titulo); }
.interativo-conclusao.is-nova { animation: conclusao-entra 700ms var(--ease); }
@keyframes conclusao-entra { from { opacity: 0; transform: translateY(8px); } }
html[data-conclusao="false"] .interativo-conclusao { display: none !important; }
/* 'arena' (A marca): full-bleed band */
html[data-interativo="arena"] .interativo { grid-column: 1 / -1; padding: 3.5rem var(--margem) 3rem; background: radial-gradient(ellipse 60% 70% at 50% 0%, color-mix(in srgb, var(--m1) 18%, transparent), transparent 60%), var(--fig-fundo); border-top: 1px solid var(--linha); border-bottom: 1px solid var(--linha); }
html[data-interativo="arena"] .interativo-cabeca { text-align: center; max-width: 900px; margin: 0 auto 1.6rem; }
html[data-interativo="arena"] .interativo-titulo { font-size: var(--t-2xl); font-style: italic; }
html[data-interativo="arena"] .interativo-dica { padding: 0.3rem 1rem; border-radius: var(--pilula); border: 1px solid color-mix(in srgb, var(--acento) 45%, transparent); }
html[data-interativo="arena"] .palco, html[data-interativo="arena"] .interativo-estatico, html[data-interativo="arena"] .interativo-conclusao { max-width: 1080px; margin-inline: auto; }
/* 'cantos' (Quem paga, Matrix): four corners and a head */
html[data-interativo="cantos"] .interativo { position: relative; padding: 1.6rem; }
html[data-interativo="cantos"] .interativo-canto { position: absolute; width: 18px; height: 18px; border: 0 solid var(--acento); pointer-events: none; }
html[data-interativo="cantos"] .interativo-canto:nth-of-type(1) { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
html[data-interativo="cantos"] .interativo-canto:nth-of-type(2) { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
html[data-interativo="cantos"] .interativo-canto:nth-of-type(3) { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
html[data-interativo="cantos"] .interativo-canto:nth-of-type(4) { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }
.interativo-canto { display: none; }
html[data-interativo="cantos"] .interativo-canto { display: block; }
/* 'instrumento' (Intersexo 1 e 2): a glass figure "Fig. N" */
html[data-interativo="instrumento"] .interativo { padding: 1.4rem; border-radius: var(--raio-grande); background: var(--vidro); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur)); }
html[data-interativo="instrumento"] .interativo-rotulo { font-family: var(--fonte-titulo); font-style: italic; text-transform: none; letter-spacing: 0.02em; font-size: var(--t-sm); }
/* 'experimento' (Errata, Alastor): a bench with "Experiment NN" */
html[data-interativo="experimento"] .interativo { padding: 1.4rem; border: 1px dashed var(--linha-2); border-radius: 4px; background: repeating-linear-gradient(90deg, transparent 0 39px, var(--linha) 39px 40px), var(--fundo-2); }
html[data-interativo="experimento"] .interativo-rotulo { font-family: var(--fonte-mono); letter-spacing: 0.08em; }
html[data-interativo="experimento"] .palco { border-radius: 4px; }

/* example piece 1, 'medir' */
.medir { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto; }
.medir-pagina { position: relative; margin: 1.4rem auto 0; width: min(92%, 640px); border-radius: 6px; background: color-mix(in srgb, var(--fig-tinta) 6%, transparent); border: 1px solid color-mix(in srgb, var(--fig-tinta) 16%, transparent); overflow: hidden; }
.medir-moldura { position: absolute; inset: 0; pointer-events: none; }
.medir-coluna { position: absolute; top: 12%; bottom: 12%; left: 50%; transform: translateX(-50%); border-radius: 3px; background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--fig-tinta) 55%, transparent) 0 3px, transparent 3px 11px); transition: width 120ms linear; }
.medir-coluna.is-apertada { background: repeating-linear-gradient(to bottom, var(--fig-alerta) 0 3px, transparent 3px 11px); }
.medir-controle { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem 1.2rem; }
.medir-trilho { position: relative; flex: 1; height: 44px; }
.medir-trilho::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: color-mix(in srgb, var(--fig-tinta) 18%, transparent); }
.medir-alca { position: absolute; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: var(--fig-acento); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); touch-action: none; cursor: grab; }
.medir-alca:active { cursor: grabbing; }
.medir-leitura { min-width: 9.5rem; font-family: var(--fonte-mono); font-size: 0.8rem; color: var(--fig-tinta); text-align: right; font-variant-numeric: tabular-nums; }
.palco-resultado { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; text-align: center; background: color-mix(in srgb, var(--fig-fundo) 94%, transparent); }
.palco-resultado-linha { max-width: 26ch; font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-xl); line-height: 1.15; color: var(--fig-tinta); }
.palco-resultado-antes { font-size: var(--t-sm); color: var(--fig-suave); }
.palco-botao { min-height: 44px; padding: 0 1.6rem; border-radius: var(--pilula); background: var(--fig-acento); color: var(--sobre-acento); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* example piece 2, 'bolhas' (Your Idol) */
.bolhas { position: absolute; inset: 0; }
.bolhas-campo { position: absolute; inset: 0 0 3.6rem; }
.bolhas-tela { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.bolha {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem;
  border-radius: 50%; padding: 0.4rem; text-align: center; color: var(--fig-tinta); font-size: 0.72rem; line-height: 1.15;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--fig-tinta) 30%, transparent), color-mix(in srgb, var(--fig-acento-2) 22%, transparent) 55%, color-mix(in srgb, var(--fig-acento) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--fig-tinta) 30%, transparent);
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, 0.25), 0 0 18px color-mix(in srgb, var(--fig-acento-2) 25%, transparent);
  animation: bolha-flutua ease-in-out infinite alternate;
}
.bolha:hover { border-color: var(--fig-acento); }
.bolha.is-estourando { animation: bolha-estoura 360ms ease-out forwards; }
@keyframes bolha-flutua { from { transform: translateY(-6px); } to { transform: translateY(6px); } }
@keyframes bolha-estoura { to { transform: scale(1.5); opacity: 0; } }
.bolhas-rodape { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.8rem 1.2rem; font-family: var(--fonte-mono); font-size: 0.8rem; color: var(--fig-tinta); }
.bolhas-conta.is-pulso { animation: conta-pulso 420ms ease; }
@keyframes conta-pulso { 50% { color: var(--fig-acento); transform: scale(1.08); } }
html.is-pausado .bolha { animation-play-state: paused; }

/* ---------- GLOSSARY ---------- */
.gl-term {
  -webkit-appearance: none; appearance: none; display: inline; margin: 0; padding: 0; border: 0; border-radius: 3px;
  background: none; color: inherit; font: inherit; letter-spacing: inherit; line-height: inherit; text-align: inherit; vertical-align: baseline; white-space: normal;
  cursor: help; text-decoration-line: underline; text-decoration-style: dotted; text-decoration-color: color-mix(in srgb, var(--m1) 85%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 0.22em;
  -webkit-tap-highlight-color: transparent;
}
.gl-term:hover, .gl-term:focus-visible, .gl-term[aria-expanded="true"] { transition: background-color 0.16s ease, text-decoration-color 0.16s ease; }
.gl-term:hover { text-decoration-color: var(--m1); }
.gl-term[aria-expanded="true"] { background-color: color-mix(in srgb, var(--m1) 20%, transparent); text-decoration-color: var(--m1); }
.gl-term:focus { outline: none; }
.gl-term:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.gl-pop {
  position: fixed; top: 0; left: 0; z-index: 70; width: max-content; max-width: min(22rem, calc(100vw - 16px));
  padding: 0.8rem 1rem 0.9rem; border-radius: var(--raio); color: var(--texto); text-align: left;
  background: var(--vidro-forte); border: 1px solid var(--linha-2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 40px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(4px); transition: opacity 0.16s ease, transform 0.16s ease;
}
.gl-pop::before { content: ''; position: absolute; left: 14px; right: 14px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--m1), var(--m2), transparent); }
@media (hover: none), (pointer: coarse) { .gl-pop { pointer-events: none; } }
.gl-pop[data-side="bottom"] { transform: translateY(-4px); }
.gl-pop.is-in { opacity: 1; transform: none; }
.gl-pop-label { font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--suave); margin-bottom: 0.2rem; }
.gl-pop-term { font-family: var(--fonte-titulo); font-size: 1.2rem; line-height: 1.15; color: var(--titulo); margin-bottom: 0.35rem; }
.gl-pop-def { font-size: 0.92rem; line-height: 1.6; }
.gl-pop-arrow { position: absolute; left: 50%; width: 18px; height: 9px; margin-left: -9px; pointer-events: none; background: var(--vidro-forte); }
.gl-pop[data-side="top"] .gl-pop-arrow { top: 100%; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.gl-pop[data-side="bottom"] .gl-pop-arrow { bottom: 100%; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.glossario-lista { max-width: 980px; margin: 0 auto; padding: 4rem var(--margem) 1rem; }
.glossario-lista h2 { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-2xl); margin-bottom: 1.2rem; }
.glossario-lista dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 0.8rem; }
.glossario-lista div { padding: 1rem 1.1rem; border-radius: var(--raio); background: var(--painel); border: 1px solid var(--linha); scroll-margin-top: 5rem; }
.glossario-lista dt { font-family: var(--fonte-titulo); font-size: 1.15rem; color: var(--titulo); margin-bottom: 0.3rem; }
.glossario-lista dd { font-size: var(--t-sm); line-height: 1.65; }

/* ---------- SOURCES (fontes) ---------- */
.fontes { max-width: 860px; margin: 0 auto; padding: 5rem var(--margem) 2rem; }
.fontes h2 { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-2xl); margin-bottom: 1rem; }
.fontes h3 { font-family: var(--fonte-texto); font-size: 0.72rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--m1); margin: 2rem 0 0.7rem; }
.fontes ul, .fontes ol { list-style: none; display: grid; gap: 0.55rem; }
.fontes li { position: relative; padding-left: 1.1rem; font-size: var(--t-sm); line-height: 1.65; color: var(--suave); overflow-wrap: anywhere; }
.fontes li::before { content: '\00B7'; position: absolute; left: 0.2rem; color: var(--acento); font-size: 1.3em; line-height: 1.2; }
/* 'grupos' (Quem paga, Bússola III, Matrix, Intersexo 1): one details per group, opened for print */
html[data-fontes="grupos"] .fontes details { border-top: 1px solid var(--linha); padding: 0.6rem 0; }
html[data-fontes="grupos"] .fontes summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
html[data-fontes="grupos"] .fontes summary::-webkit-details-marker { display: none; }
html[data-fontes="grupos"] .fontes summary h3 { margin: 0; }
html[data-fontes="grupos"] .fontes summary::after { content: '+'; font-size: 1.2rem; color: var(--suave); }
html[data-fontes="grupos"] .fontes details[open] summary::after { content: '\2212'; }
/* 'razao' (Rocky): a numbered ledger */
html[data-fontes="razao"] .fontes { counter-reset: fonte; }
html[data-fontes="razao"] .fontes li { counter-increment: fonte; padding-left: 3rem; border-top: 1px solid var(--linha); padding-top: 0.6rem; }
html[data-fontes="razao"] .fontes li::before { content: counter(fonte, decimal-leading-zero); left: 0; top: 0.6rem; font-family: var(--fonte-mono); font-size: 0.8rem; color: var(--acento); }

/* ---------- CLOSING (fecho) AND SERIES ---------- */
.fecho { max-width: 860px; margin: 0 auto; padding: 4.5rem var(--margem) 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.fecho-chamada { font-size: 0.7rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--suave); }
.fecho-frase { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-xl); line-height: 1.2; color: var(--titulo); max-width: 24ch; }
.serie { width: 100%; margin-top: 1rem; }
.serie-rotulo { font-size: 0.68rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--suave); margin-bottom: 0.8rem; }
.serie-grade { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0.8rem; }
.serie-grade a { display: flex; flex-direction: column; gap: 0.3rem; height: 100%; padding: 1.1rem 1.2rem; border-radius: var(--raio); text-align: left; text-decoration: none; background: var(--painel); border: 1px solid var(--linha); transition: border-color 200ms ease; }
.serie-grade a:hover { border-color: var(--acento); }
.serie-grade a[aria-current] { border-color: var(--acento); background: color-mix(in srgb, var(--acento) 8%, var(--painel)); }
.serie-parte { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--suave); }
.serie-titulo { font-family: var(--fonte-titulo); font-size: var(--t-lg); line-height: 1.2; color: var(--titulo); }
.serie-aqui { font-size: 0.7rem; color: var(--acento); }
/* 'continua' (Intersexo 1, Identidade): one glass card to the next part */
.continua { display: block; width: 100%; max-width: 560px; padding: 1.4rem 1.6rem; border-radius: var(--raio-grande); text-align: left; text-decoration: none; background: var(--vidro); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur)); }
.continua:hover { border-color: var(--acento); }
.virada { position: fixed; inset: 0; z-index: 9500; pointer-events: none; width: 100%; height: 100%; }

/* ---------- BIO ---------- */
.bio { max-width: 780px; margin: 0 auto; padding: 3.5rem var(--margem) 1rem; }
.bio-cartao { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 1.6rem; align-items: center; padding: 2rem; border-radius: var(--raio-grande); }
/* house rule: a rounded square, never a circle */
.bio-foto { width: 140px; height: 140px; object-fit: cover; border-radius: 12px; background: var(--painel-2); }
.bio-rotulo { font-size: 0.7rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--acento); margin-bottom: 0.3rem; }
.bio-nome { font-family: var(--fonte-titulo); font-size: var(--t-xl); margin-bottom: 0.5rem; }
.bio-texto { font-size: var(--t-sm); line-height: 1.85; color: var(--texto); }
.bio-pub { margin-top: 0.7rem; font-size: var(--t-sm); line-height: 1.7; color: var(--suave); }
html[data-bio="cartao"] .bio-cartao { background: linear-gradient(var(--fundo-2), var(--fundo-2)) padding-box, linear-gradient(120deg, var(--m1), var(--m2), var(--acento)) border-box; border: 1px solid transparent; }
html[data-bio="vidro"] .bio-cartao { background: var(--vidro); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(var(--vidro-blur)); backdrop-filter: blur(var(--vidro-blur)); }
html[data-bio="vidro"] .bio-foto { transition: transform 300ms var(--ease); }
html[data-bio="vidro"] .bio-cartao:hover .bio-foto { transform: rotate(-1deg); }

/* ---------- FOOTER ---------- */
.rodape { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; padding: 3rem var(--margem) calc(3rem + env(safe-area-inset-bottom, 0px)); }
.rodape-acoes { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem; }
.rodape-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem 1rem; font-size: 0.85rem; }
.rodape-links a { color: var(--suave); }
.rodape-links a + a::before { content: '\00B7'; display: inline-block; margin-right: 1rem; opacity: 0.6; }
.rodape-credito { max-width: 520px; font-size: 0.78rem; line-height: 1.6; color: var(--suave); }
.rodape-marca { font-family: var(--fonte-titulo); letter-spacing: 0.2em; text-transform: uppercase; color: var(--suave); }
/* ---------- BACKGROUNDS (fundo) ---------- */
.fundo-camada, .fundo-tela, .grao, .fio-vertical, .particulas-tela { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.fundo-tela, .particulas-tela { width: 100%; height: 100%; }
/* 'brilho' (A marca): radial glows in the colors of the section */
html[data-fundo="brilho"] .fundo-camada { inset: -10%; background: radial-gradient(ellipse 55% 45% at 12% 8%, color-mix(in srgb, var(--m1) 22%, transparent), transparent 70%), radial-gradient(ellipse 50% 45% at 92% 88%, color-mix(in srgb, var(--m2) 18%, transparent), transparent 70%); filter: blur(10px); }
/* 'ceu' (Quem paga): the sky changes color by block, like the hour of the day */
@property --ceu-a { syntax: '<color>'; inherits: true; initial-value: #1b1230; }
html[data-fundo="ceu"] body { --ceu-a: var(--ceu-1); transition: --ceu-a 1400ms ease, --m1 900ms ease, --m2 900ms ease; }
html[data-fundo="ceu"] body[data-modo-ativo="2"] { --ceu-a: var(--ceu-2); }
html[data-fundo="ceu"] body[data-modo-ativo="3"] { --ceu-a: var(--ceu-3); }
html[data-fundo="ceu"] body[data-modo-ativo="4"] { --ceu-a: var(--ceu-4); }
html[data-fundo="ceu"] .fundo-camada { background: linear-gradient(to bottom, var(--ceu-a), var(--fundo) 85%); }
/* 'textura' (Errata, 007): an image tile that enters after the opening */
html[data-fundo="textura"] .fundo-camada { opacity: 0; transition: opacity 900ms ease; background-image: var(--textura, none); background-size: 512px auto; background-repeat: repeat; }
html[data-fundo="textura"].is-textura-pronta .fundo-camada { opacity: 0.35; }
/* 'cena': the essay's own scene; a veil under the reading column keeps the text in AA */
html[data-fundo="cena"] .fundo-tela { opacity: 0; transition: opacity 1200ms ease; }
html[data-fundo="cena"] .fundo-tela.is-ligada { opacity: var(--cena-opacidade, 1); }
html[data-fundo="cena"] .fundo-tela { mix-blend-mode: var(--cena-mistura, normal); }
html[data-fundo="cena"] .fundo-camada { z-index: 1; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fundo) 82%, transparent) 12%, color-mix(in srgb, var(--fundo) 82%, transparent) 88%, transparent); }
/* below 860 px the text takes the whole width, and so does the veil (Matrix, Pollen); the side index
   of 'trilha' and the dot rail sit outside the band, so they bring their own */
@media (max-width: 860px) {
  html[data-fundo="cena"] .fundo-camada { background: color-mix(in srgb, var(--fundo) 84%, transparent); }
  /* a light page keeps more paper over the scene: pale text on a pale ground needs it (Gnomon, QA 9 Nov 2026) */
  :root[data-tema-ativo="claro"][data-fundo="cena"] .fundo-camada { background: color-mix(in srgb, var(--fundo) 90%, transparent); }
}
html[data-fundo="cena"][data-indice="trilha"] .gaveta { background: color-mix(in srgb, var(--fundo) 92%, transparent); }
html[data-fundo="cena"] .trilho-pontos-conta { padding: 0.1rem 0.4rem; border-radius: var(--pilula); background: color-mix(in srgb, var(--fundo) 90%, transparent); }
/* grain, particles, vertical thread */
.grao { z-index: 99990; opacity: 0.08; mix-blend-mode: soft-light; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"); background-size: 200px 200px; }
.fio-vertical { left: 5%; right: auto; width: 2px; height: 100vh; border-radius: 2px; opacity: 0.4; background: linear-gradient(to bottom, var(--m1), color-mix(in srgb, var(--m1) 18%, transparent) 55%, transparent); }
@media (max-width: 860px) { .fio-vertical { left: 0.5rem; } }

/* ---------- CURSORS (mouse only) ---------- */
@media (hover: hover) and (pointer: fine) {
  html.tem-cursor, html.tem-cursor a, html.tem-cursor button, html.tem-cursor summary, html.tem-cursor .gl-term { cursor: none; }
  html.tem-cursor input, html.tem-cursor select, html.tem-cursor textarea { cursor: auto; }
}
.cursor-tela { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 99995; pointer-events: none; }
/* 'lente' (Intersexo 2) */
.cursor-lente { position: fixed; left: 0; top: 0; z-index: 99996; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; pointer-events: none; border: 1px solid var(--vidro-borda); background: color-mix(in srgb, var(--titulo) 8%, transparent); -webkit-backdrop-filter: blur(2px) saturate(1.4); backdrop-filter: blur(2px) saturate(1.4); transition: width 200ms var(--ease), height 200ms var(--ease), margin 200ms var(--ease), opacity 200ms ease; }
.cursor-lente.is-alvo { width: 54px; height: 54px; margin: -27px 0 0 -27px; }
.cursor-lente.is-oculta { opacity: 0; }
/* 'pena' (Errata, Alastor): the essay's own image, set in --cursor-imagem */
.cursor-pena { position: fixed; left: 0; top: 0; z-index: 99996; width: 34px; height: 34px; pointer-events: none; background: var(--cursor-imagem, none) center / contain no-repeat; transform-origin: 0 100%; }
.cursor-pena.is-padrao { background: none; }
.cursor-pena.is-padrao::before { content: ''; position: absolute; left: 0; bottom: 0; width: 30px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--acento), var(--titulo)); transform: rotate(-45deg); transform-origin: 0 50%; box-shadow: 0 0 6px var(--acento); }
.cursor-pena.is-baixa { transform: rotate(-8deg) scale(0.92); }
/* 'chama' (Your Idol): a CSS flame that flickers, grows gold on a control and bows on a click */
.cursor-chama { position: fixed; left: 0; top: 0; z-index: 99996; width: 22px; height: 28px; pointer-events: none; transform: translate(-50%, -80%); animation: chama-tremula 1.8s ease-in-out infinite; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--alerta) 70%, transparent)); transition: width 200ms var(--ease), height 200ms var(--ease); }
.cursor-chama::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 80%, var(--acento) 0%, var(--alerta) 40%, color-mix(in srgb, var(--acento-2) 60%, transparent) 75%, transparent 100%); clip-path: polygon(50% 0%, 65% 25%, 80% 15%, 70% 45%, 90% 40%, 75% 65%, 85% 80%, 65% 75%, 50% 100%, 35% 75%, 15% 80%, 25% 65%, 10% 40%, 30% 45%, 20% 15%, 35% 25%); }
.cursor-chama::after { content: ''; position: absolute; bottom: 20%; left: 50%; transform: translateX(-50%); width: 35%; height: 35%; border-radius: 50%; background: rgba(255, 240, 200, 0.85); filter: blur(2px); }
.cursor-chama.is-alvo { width: 30px; height: 38px; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--acento) 80%, transparent)); }
.cursor-chama.is-baixa { width: 16px; height: 12px; animation: none; transform: translate(-50%, -50%) scaleY(0.5); }
@keyframes chama-tremula { 0%, 100% { transform: translate(-50%, -80%) scale(1, 1) rotate(-1deg); } 25% { transform: translate(-50%, -80%) scale(0.92, 1.06) rotate(1.5deg); } 50% { transform: translate(-50%, -80%) scale(1.05, 0.96) rotate(-2deg); } 75% { transform: translate(-50%, -80%) scale(0.95, 1.04) rotate(1deg); } }
.chama-cinza, .chama-faisca, .chama-halo { position: fixed; z-index: 99994; pointer-events: none; border-radius: 50%; transform: translate(-50%, -50%); }
.chama-faisca { animation: faisca-voa 0.55s var(--ease) forwards; }
.chama-halo { width: 22px; height: 22px; border: 1.5px solid var(--alerta); animation: halo-abre 0.45s var(--ease) forwards; }
@keyframes faisca-voa { to { transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0); opacity: 0; } }
@keyframes halo-abre { to { transform: translate(-50%, -50%) scale(3.5); opacity: 0; } }

/* ---------- CONTROLS: edition switch, resume ---------- */
.edicoes { display: inline-flex; border: 1px solid var(--linha-2); border-radius: var(--pilula); padding: 2px; }
.edicoes button { min-height: 30px; padding: 0 0.75rem; border-radius: var(--pilula); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--suave); }
.edicoes button[aria-pressed="true"] { background: color-mix(in srgb, var(--m1) 28%, transparent); color: var(--titulo); }
html[data-edicao="curta"] [data-ed="completa"], html[data-edicao="completa"] [data-ed="curta"], html:not([data-edicoes="true"]) [data-ed="curta"] { display: none !important; }

/* ---------- HUD (A marca): a fixed reader in the corner ---------- */
.hud { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 50; width: 230px; pointer-events: none; display: grid; grid-template-columns: 44px 1fr; gap: 0.15rem 0.7rem; align-items: center; padding: 0.7rem 0.9rem; border-radius: 0.95rem; font-size: 0.68rem; color: var(--texto); background: var(--vidro-forte); border: 1px solid var(--linha-2); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); opacity: 0; transform: translateY(10px); transition: opacity 600ms ease, transform 600ms ease; }
.hud.is-visivel { opacity: 1; transform: none; }
html.is-no-fim .hud { opacity: 0; transform: translateY(10px); }
.hud-emblema { grid-row: 1 / span 2; width: 44px; height: 44px; }
.hud-nome { font-family: var(--fonte-titulo); letter-spacing: 0.16em; text-transform: uppercase; color: var(--titulo); }
.hud-leitura { color: var(--suave); }
.hud-leitura span { color: var(--m1); }

/* ---------- COVER (cobrir, A marca): a second layer of reading ---------- */
html[data-cobrir="true"] body.is-coberto .prosa p { color: var(--fraco); }
html[data-cobrir="true"] body.is-coberto .marca { color: var(--titulo); background: linear-gradient(transparent 52%, color-mix(in srgb, var(--acento) 45%, transparent) 52%); text-shadow: 0 0 16px color-mix(in srgb, var(--acento) 70%, transparent); }
.fio-cobrir { display: none; }
html[data-cobrir="true"] body.is-coberto .fio-cobrir { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 0.8rem; padding: 0.5rem 1.1rem; border-radius: var(--pilula); border: 1px solid color-mix(in srgb, var(--m2) 45%, transparent); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--titulo); }
html[data-cobrir="true"] body.is-coberto .fio:not(.is-aberto) > p:not(.fio-rotulo) { display: none; }
html[data-cobrir="true"] :is(.soco, .coda) { position: relative; }
html[data-cobrir="true"] body.is-coberto :is(.soco, .coda) { cursor: pointer; }
html[data-cobrir="true"] body.is-coberto :is(.soco, .coda)::before { content: ''; position: absolute; inset: -0.2em -0.35em; z-index: 1; border-radius: 6px; pointer-events: none; background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 7px), linear-gradient(90deg, var(--painel-2), var(--painel), var(--painel-2)); box-shadow: inset 0 0 0 1px var(--linha-2); transform-origin: left center; transition: transform 520ms var(--ease), opacity 520ms ease; }
html[data-cobrir="true"] body.is-coberto :is(.soco, .coda):is(:hover, :focus-visible, .is-levantado)::before { transform: scaleX(0); opacity: 0; }

/* ---------- REVEAL (revelar) ---------- */
html.js[data-revelar="true"] .revelar { opacity: 0; filter: blur(6px); transform: translateY(14px); transition: opacity 800ms ease, filter 800ms ease, transform 800ms var(--ease); }
html.js[data-revelar="true"] .revelar.is-visivel { opacity: 1; filter: none; transform: none; }

/* ---------- DEMO SELECTOR (development only, demo: true) ---------- */
.demo { position: fixed; left: 0.8rem; bottom: 0.8rem; z-index: 99999; width: min(340px, calc(100vw - 1.6rem)); max-height: min(78vh, 680px); display: flex; flex-direction: column; border-radius: var(--raio); background: #111018; color: #ece6f4; border: 1px solid #3a3448; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); font-family: var(--fonte-texto); font-size: 0.8rem; }
.demo-topo { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.6rem 0.8rem; border-bottom: 1px solid #3a3448; }
.demo-topo strong { font-weight: 600; letter-spacing: 0.08em; }
.demo-topo button { min-height: 32px; padding: 0 0.7rem; border-radius: 6px; border: 1px solid #4a4358; color: #ece6f4; }
.demo-corpo { overflow-y: auto; padding: 0.6rem 0.8rem 0.9rem; display: grid; gap: 0.45rem; }
.demo.is-fechado .demo-corpo { display: none; }
.demo label { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.demo label span { font-family: var(--fonte-mono); font-size: 0.72rem; color: #c9c0d8; }
.demo select { min-height: 30px; padding: 0 0.4rem; border-radius: 6px; border: 1px solid #4a4358; background: #1b1824; color: #ece6f4; font: inherit; }
.demo-aviso { padding: 0.5rem 0.8rem; color: #ffd2d2; background: #5a1a22; border-top: 1px solid #3a3448; }

/* ---------- PHONES ---------- */
@media (max-width: 860px) {
  .constelacao ol { grid-template-columns: 1fr; }
  html[data-blocos="prancha-ao-lado"] .bloco-cabeca, html[data-blocos="prancha-ao-lado"] .bloco.is-par .bloco-cabeca { grid-template-columns: 1fr; grid-template-areas: "prancha" "num" "rot" "tit" "res" "lis"; padding-top: 4rem; }
  html[data-blocos="prancha-ao-lado"] .bloco-prancha { aspect-ratio: 4 / 3; }
  html[data-blocos="laminas"] .bloco-cabeca { display: flex; flex-direction: column; align-items: stretch; gap: 0.8rem; min-height: 0; }
  html[data-blocos="laminas"] .bloco-numero { font-size: 7rem; }
  html[data-blocos="laminas"] .bloco-prancha { aspect-ratio: 4 / 3; opacity: 0.8; }
  html[data-blocos="laminas"] .bloco-lista { margin-top: 0; border-top: 1px solid var(--linha); border-radius: var(--raio); }
  .comparacao { grid-template-columns: 1fr; }
  html[data-pranchas="larga"] .prancha { aspect-ratio: 4 / 3; }
  .bio-cartao { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .bio-foto { width: 120px; height: 120px; }
}
@media (max-width: 720px) {
  .barra { padding-inline: 0.7rem; gap: 0.4rem; }
  .barra-logo { font-size: 0.82rem; letter-spacing: 0.06em; }
  .barra-botao { padding: 0.1rem 0.5rem; font-size: 0.6rem; letter-spacing: 0.08em; }
  .barra-etiqueta, .barra-secoes, html[data-barra="capsula"] .barra-onde { display: none !important; }
  /* on a phone the edition switch lives in the hero only: the bar keeps contents, language and pause */
  .barra-edicoes { display: none !important; }
  html[data-barra="capsula"] .barra { width: calc(100% - 1rem); top: 0.5rem; padding-inline: 0.7rem; }
  .barra-capitulo { max-width: 16ch; }
  html[data-prosa="vidro"] .prosa, html[data-prosa="papel"] .prosa { padding: 1.4rem 1.2rem; }
  .cena { padding: 2.8rem 1.2rem 2.6rem; }
  .fio { padding: 1.5rem 1.2rem 1.5rem 2.4rem; }
  /* on a phone the window sits on top and the glass text at the bottom (50/56 and 9/78) */
  html[data-hero="vidro"] .hero { align-items: flex-end; padding-top: 5rem; }
  html[data-hero="vidro"] .hero-texto { max-width: none; padding: 1.6rem 1.2rem; margin-top: 33svh; }
  html[data-hero="vidro"] .hero-vidro { -webkit-mask-size: 100% 100%, 44% 22%; mask-size: 100% 100%, 44% 22%; -webkit-mask-position: 0 0, 89.3% 11.5%; mask-position: 0 0, 89.3% 11.5%; }
  html[data-hero="vidro"] .hero-janela { width: 44%; height: 22%; top: 9%; right: 6%; }
  .hud { width: auto; max-width: 64vw; right: 0.5rem; bottom: 0.5rem; grid-template-columns: 28px auto; padding: 0.4rem 0.75rem 0.4rem 0.45rem; border-radius: var(--pilula); }
  .hud-emblema { grid-row: auto; width: 28px; height: 28px; }
  .hud-nome { display: none; }
  .hero-brasas { display: none; }
  /* on a phone the text column covers most of the drawn scene: a deeper veil under it keeps the lines AA */
  html:is([data-hero="anel-canvas"], [data-hero="cena"]) .hero::after { background: radial-gradient(ellipse 95% 62% at 50% 52%, color-mix(in srgb, var(--fundo) 90%, transparent), color-mix(in srgb, var(--fundo) 60%, transparent) 75%, transparent); }
}
@media (max-width: 420px) {
  html .barra-direita { gap: 0.2rem; }
  html .barra-botao { min-width: 30px; padding: 0.1rem 0.4rem; }
}

/* ---------- EFFECTS OF ONE ESSAY, MADE GENERAL ---------- */
/* bandeira (Rocky Horror): the flag slides through the word only while it is on screen */
.palavra-bandeira {
  background-image: var(--bandeira-tinta); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  animation: bandeira-desliza 7s linear infinite; animation-play-state: paused;
}
.palavra-bandeira.is-mexendo { animation-play-state: running; }
.hero-titulo .palavra-bandeira { padding-right: 0.13em; }
/* on paper-light pages the pale flag sits on a dark pill, same layout (Rocky's light reading) */
:root[data-tema-ativo="claro"] .prosa .palavra-bandeira {
  background-image: var(--bandeira-tinta), linear-gradient(#24131d, #24131d); background-size: 200% 100%, 100% 100%;
  -webkit-background-clip: text, padding-box; background-clip: text, padding-box; padding: 0.02em 0.12em; margin: 0 -0.12em; border-radius: 0.15em;
}
@keyframes bandeira-desliza { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }
@media (forced-colors: active) { .palavra-bandeira { background: none !important; color: CanvasText !important; -webkit-text-fill-color: CanvasText !important; animation: none !important; } }

/* decodificar (Matrix): the letters settle in a layer over the heading, with a short RGB split;
   the real text stays in place underneath, transparent, so nothing moves */
.is-decodificando { position: relative; }
.is-decodificando > [data-decodificando] { color: transparent !important; -webkit-text-fill-color: transparent !important; }
.decodificar-capa { position: absolute; inset: 0; pointer-events: none; animation: decodificar-tremor 700ms steps(2) 1; }
@keyframes decodificar-tremor { 0% { text-shadow: 2px 0 var(--acento), -2px 0 var(--m2); } 30% { text-shadow: -3px 0 var(--acento), 3px 0 var(--m1); } 60% { text-shadow: 1px 0 var(--acento); } 100% { text-shadow: none; } }

/* moeda (Bússola III) and the verdict pills */
.moeda { width: min(100%, 420px); aspect-ratio: 1 / 1.05; margin: 2.4rem auto; }
.moeda-tela { display: block; width: 100%; height: 100%; }
html[data-moeda="false"] .moeda { display: none; }
.veredito { display: inline-flex; align-items: center; margin-left: 0.4rem; padding: 0.05rem 0.55rem; border-radius: var(--pilula); font-size: 0.78em; font-weight: 600; vertical-align: 0.12em; border: 1px solid currentColor; white-space: nowrap; }
.v-acertou { color: var(--acento); background: color-mix(in srgb, var(--acento) 14%, transparent); }
.v-parcial { color: color-mix(in srgb, var(--m2) 62%, var(--titulo)); background: color-mix(in srgb, var(--m2) 12%, transparent); }
.v-falhou { color: var(--suave); background: color-mix(in srgb, var(--suave) 8%, transparent); }

/* piscar (Alastor): the layer has the picture's aspect and shares its object-fit, so it stays registered */
.retrato { position: relative; overflow: hidden; margin: 2.4rem auto; max-width: 980px; border-radius: var(--raio); }
.retrato img { display: block; width: 100%; height: 100%; object-fit: cover; }
.retrato-camada { position: absolute; inset: 0; opacity: 0; pointer-events: none; }

/* heroFio (Oráculo): the thread over the painting, under the words; touch keeps scroll and zoom */
.hero-fio { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; touch-action: pan-y pinch-zoom; }
.hero-fio.is-perto, .hero.is-pegando .hero-fio { cursor: grab; }
.hero.is-pegando .hero-fio { cursor: grabbing; }
html[data-hero-fio="true"] .hero-texto { z-index: 1; pointer-events: none; }
html[data-hero-fio="true"] .hero-texto :is(a, button, .hero-acoes, .hero-fio-cta) { pointer-events: auto; }
.hero-fio-cta { display: flex; justify-content: center; }
html[data-hero="pintura-cheia"] .hero-fio-cta, html[data-hero="vidro"] .hero-fio-cta { justify-content: flex-start; }
.hero-fio-botao { font: inherit; font-size: var(--t-sm); color: var(--titulo); background: color-mix(in srgb, var(--fundo) 70%, transparent); border: 1px solid color-mix(in srgb, var(--acento) 60%, transparent); border-radius: var(--pilula); padding: 0.4rem 1rem; cursor: pointer; }

/* regua (Prova): one numbered mark per chapter on the right edge; gone on phones and paper */
.regua { position: fixed; right: 18px; top: calc(var(--barra-altura) + 4.5rem); bottom: 2rem; width: 52px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; padding: 0.6rem 0; border-radius: 14px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fundo) 72%, transparent) 40%); }
.regua-legenda { font: 0.62rem/1 var(--fonte-mono); color: var(--suave); margin: 0 0 0.7rem; letter-spacing: 0.08em; }
.regua-marcas { display: grid; grid-template-rows: repeat(var(--marcas, 10), 1fr); height: 100%; max-height: 520px; width: 52px; }
.regua-marcas a { position: relative; display: flex; justify-content: flex-end; align-items: center; gap: 8px; font: 0.62rem/1 var(--fonte-mono); color: var(--suave); text-decoration: none; }
.regua-marcas a::after { content: ''; display: block; width: 6px; height: 1px; background: var(--linha-2); }
.regua-marcas a::before { content: ''; position: absolute; inset: -4px -10px; }
.regua-marcas a[aria-current="true"] { color: var(--acento); }
.regua-marcas a[aria-current="true"]::after { width: 14px; background: var(--acento); }
@media (max-width: 1100px) { .regua { display: none; } }

/* cursor 'svg' (Wolverine): a themed arrow, mouse only, with a button back to the system cursor */
@media (hover: hover) and (pointer: fine) {
  html[data-cursor="svg"]:not(.cursor-nativo), html[data-cursor="svg"]:not(.cursor-nativo) body { cursor: var(--cursor-normal); }
  html[data-cursor="svg"]:not(.cursor-nativo) :is(a, button, summary, input[type="range"], [role="slider"], .gl-term) { cursor: var(--cursor-ativo); }
  html[data-cursor="svg"]:not(.cursor-nativo) :is(.prosa p, .capitulo-titulo, .bloco-titulo, .fontes li, .bio-texto) { cursor: text; }
}
.cursor-troca { display: block; margin: 1.2rem auto 0; font: inherit; font-size: var(--t-sm); color: var(--suave); background: transparent; border: 1px solid var(--linha-2); border-radius: var(--pilula); padding: 0.45rem 1.1rem; min-height: 44px; cursor: pointer; }
@media (pointer: coarse), (hover: none) { .cursor-troca { display: none; } }

/* vidroLiquido (Intersexo): the rim displacement goes before the blur, with an EMPTY fallback; with
   var(--lg-filter, none) a pane whose lens is not drawn yet resolved to "none blur()" and lost its frost */
html.lg-refract .refract {
  -webkit-backdrop-filter: var(--lg-filter,) blur(var(--vidro-blur)) saturate(1.3) brightness(1.04);
  backdrop-filter: var(--lg-filter,) blur(var(--vidro-blur)) saturate(1.3) brightness(1.04);
}

/* lerOuJogar (TADC): reading is the default; playing keeps only the chapters that hold a piece,
   their headings and the pieces, with a way back always in reach */
.modo-escolha { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.modo-rotulo { font-size: var(--t-xs); letter-spacing: 0.2em; text-transform: uppercase; color: var(--suave); margin-right: 0.3rem; }
.modo-botao { font: inherit; font-size: var(--t-sm); color: var(--titulo); background: transparent; border: 1px solid var(--linha-2); border-radius: var(--pilula); padding: 0.35rem 1rem; cursor: pointer; }
.modo-botao[aria-pressed="true"] { background: var(--acento); border-color: var(--acento); color: var(--fundo); }
.modo-voltar { display: none; }
html.modo-jogar .modo-voltar { display: block; position: fixed; z-index: 55; left: 50%; bottom: 1rem; transform: translateX(-50%); font: inherit; font-size: var(--t-sm); color: var(--titulo); background: var(--vidro-forte); border: 1px solid var(--vidro-borda); border-radius: var(--pilula); padding: 0.55rem 1.2rem; cursor: pointer; }
html.modo-jogar main .capitulo:not(:has(.interativo)), html.modo-jogar main .capitulo > :not(.capitulo-cabeca, .interativo), html.modo-jogar main :is(.pausa-leitura, .bloco-lista, .bloco-prancha) { display: none !important; }
.modo-vazio { max-width: var(--coluna, 680px); margin: 3rem auto; padding: 1.4rem; border: 1px dashed var(--linha-2); border-radius: var(--raio); color: var(--suave); text-align: center; }

/* pausas (Wolverine): a picture and the author's line between chapters; the picture breathes on screen */
html:not([data-pausas="true"]) .pausa-leitura { display: none; }
.pausa-leitura { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; gap: 2rem; max-width: 980px; margin: 4rem auto; padding: 0 var(--margem); }
.pausa-arte { overflow: hidden; border-radius: var(--raio-grande); aspect-ratio: 4 / 3; }
.pausa-arte img { display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 60%; }
.pausa-leitura.is-respirando .pausa-arte img { animation: pausa-respira 9s ease-in-out infinite; }
@keyframes pausa-respira { 0%, 100% { transform: scale(1); filter: brightness(0.92); } 50% { transform: scale(1.045); filter: brightness(1.04); } }
.pausa-rotulo { font-size: var(--t-xs); letter-spacing: 0.24em; text-transform: uppercase; color: var(--acento-2); margin-bottom: 0.6rem; }
.pausa-titulo { font-family: var(--fonte-titulo); font-style: italic; font-size: var(--t-lg); line-height: 1.3; color: var(--titulo); }
@media (max-width: 720px) { .pausa-leitura { grid-template-columns: 1fr; gap: 1.2rem; } }

/* ---------- REDUCED MOTION, REDUCED TRANSPARENCY ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.js .hero-texto > * { opacity: 1 !important; transform: none !important; }
  html.js[data-revelar="true"] .revelar { opacity: 1; filter: none; transform: none; }
  .particulas-tela, .cursor-tela, .cursor-lente, .cursor-pena, .cursor-chama, .hero-brasas, .prancha video, .barra-pausa { display: none !important; }
  .cortina, .moldura, .terminal { display: none !important; }
  .retrato-camada { display: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .barra, .gaveta, .gl-pop, .hud, .continua, html[data-prosa="vidro"] .prosa, html[data-hero="vidro"] .hero-texto, html[data-interativo="instrumento"] .interativo, html[data-bio="vidro"] .bio-cartao, html[data-blocos="laminas"] .bloco-titulo, html.lg-refract .refract { background: var(--painel) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .barra, .gaveta, .gl-pop, .hud, .continua { background: var(--painel); }
}

/* ---------- PRINT: one block, black on white, no screen layers ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .barra, .gaveta, .gaveta-fundo, .trilho-pontos, .hud, .capa, .cortina, .moldura, .terminal, .demo, .pular, canvas, video, iframe, audio,
  .fundo-camada, .fundo-tela, .grao, .fio-vertical, .particulas-tela, .cursor-lente, .cursor-pena, .cursor-chama, .chama-cinza, .chama-faisca, .chama-halo,
  .hero-arte, .hero-brasas, .hero-vidro, .hero-janela, .prancha, .bloco-prancha, .palco, .interativo-dica, .hero-acoes, .rodape-acoes, .gl-pop, .fio-cobrir, .virada, .proximo, .barra-pausa,
  .regua, .moeda, .retrato-camada, .hero-fio-cta, .cursor-troca, .modo-escolha, .modo-voltar, .modo-vazio, .pausa-arte { display: none !important; }  .interativo-estatico { display: block !important; }
  main *, header *, footer * { color: #000 !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; -webkit-text-fill-color: #000 !important; filter: none !important; }
  .hero { min-height: 0; padding: 0 0 2rem; }
  html.js .hero-texto > *, html.js[data-revelar="true"] .revelar { opacity: 1 !important; transform: none !important; filter: none !important; }
  .capitulo, html[data-capitulo="nota-margem"] .capitulo { display: block; padding: 1.5rem 0; }
  .capitulo-nota { position: static !important; }
  .bloco { break-before: page; }
  .bloco:first-of-type { break-before: auto; }
  .soco, .coda, .tese, .fio, .citacao, .comparacao-cartao, .bio-cartao, .fecho { break-inside: avoid; }
  .gl-term { text-decoration: none !important; }
  .fio > p:not(.fio-rotulo) { display: block !important; }
  body.is-en .fio > p[data-pt], body.is-pt .fio > p[data-en] { display: none !important; }
  :is(.soco, .coda)::before { display: none !important; }
  .tabela { overflow: visible; border-color: #000; }
  .tabela table { min-width: 0; }
  .prosa a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 0.8em; overflow-wrap: anywhere; }
  .bio-foto { border: 1px solid #000; }
}
