/* ==========================================================
   "A porta errada" / "The wrong door": the essay's skin over the base template (ensaio.css).
   Concept (VISUAL.md): a building of doors. Paper is the rule, glass is the medical eye,
   brass and stamp-red are the decision. --lock is only ever prohibition; --brass is only
   ever the right door. Nothing here is driven by scroll.
   build_pagina.py measures every text color below against every reading surface (AA).
   ========================================================== */

:root[data-tema-ativo="claro"] {
  --fundo: #f1f2ef;
  --fundo-2: #e4e8e6;
  --painel: #f7f8f6;
  --painel-2: #e9ecea;
  --titulo: #1b2230;
  --texto: #394355;
  --suave: #566070;
  --fraco: #566070;
  --acento: #4f6676;
  --acento-2: #5e4e91;
  --alerta: #9e3226;
  --sobre-acento: #ffffff;
  --lock: #9e3226;
  --brass: #7d5a1f;
  --corridor: #4f6676;
  --identity: #5e4e91;
  --paper-fecho: #f4eee3;
  --linha: rgba(27, 34, 48, 0.12);
  --linha-2: rgba(27, 34, 48, 0.24);
  --vidro: rgba(255, 255, 255, 0.55);
  --vidro-forte: rgba(247, 248, 246, 0.92);
  --vidro-borda: rgba(27, 34, 48, 0.14);
  --vidro-blur: 14px;
  --fig-fundo: #f7f8f6;
  --fig-tinta: #1b2230;
  --fig-suave: #566070;
  --fig-acento: #9e3226;
  --fig-acento-2: #7d5a1f;
  /* the light of each part (VISUAL.md, section 3): one tone per data-modo, no interpolation by scroll */
  --ceu-1: #f1f2ef; --ceu-2: #f1f2ef; --ceu-3: #e7eded; --ceu-4: #f0eceb;
  --ceu-5: #e6ebee; --ceu-6: #f5f6f3; --ceu-7: #eef0ec; --ceu-8: #f4eee3;
  /* decorative pairs (rules, numerals, marks); text never uses them */
  --modo-1a: #566070; --modo-1b: #9e3226;
  --modo-2a: #4f6676; --modo-2b: #566070;
  --modo-3a: #4f6676; --modo-3b: #5e4e91;
  --modo-4a: #9e3226; --modo-4b: #5e4e91;
  --modo-5a: #4f6676; --modo-5b: #394355;
  --modo-6a: #7d5a1f; --modo-6b: #5e4e91;
  --modo-7a: #7d5a1f; --modo-7b: #4f6676;
  --modo-8a: #7d5a1f; --modo-8b: #5e4e91;
}

:root {
  --fonte-titulo: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --fonte-texto: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --fonte-mono: 'DM Mono', 'Cascadia Mono', Consolas, monospace;
}

/* the four parts the template does not know (it has modes 1 to 4) */
body[data-modo-ativo="5"] { --m1: var(--modo-5a); --m2: var(--modo-5b); }
body[data-modo-ativo="6"] { --m1: var(--modo-6a); --m2: var(--modo-6b); }
body[data-modo-ativo="7"] { --m1: var(--modo-7a); --m2: var(--modo-7b); }
body[data-modo-ativo="8"] { --m1: var(--modo-8a); --m2: var(--modo-8b); }
html[data-fundo="ceu"] body[data-modo-ativo="5"] { --ceu-a: var(--ceu-5); }
html[data-fundo="ceu"] body[data-modo-ativo="6"] { --ceu-a: var(--ceu-6); }
html[data-fundo="ceu"] body[data-modo-ativo="7"] { --ceu-a: var(--ceu-7); }
html[data-fundo="ceu"] body[data-modo-ativo="8"] { --ceu-a: var(--ceu-8); }

/* Cormorant is light: titles a little heavier than the template's Fraunces settings */
.hero-titulo { font-weight: 500; letter-spacing: -0.01em; }
.bloco-titulo, .capitulo-titulo, .interativo-titulo, .bio-nome, .fecho-frase, .serie-titulo { font-weight: 500; }
.capitulo-rotulo, .bloco-rotulo, .hero-olho, .hero-fatos li { font-family: var(--fonte-mono); }

/* ---------- HERO: the corridor of two doors; the words low on the left ---------- */
html[data-hero="pintura-cheia"] .hero-arte img { object-position: 62% 50%; }
/* a step darker than --suave: over the glass on the photo the kicker measured 4.44:1 (review of 19/11/2026) */
.hero-olho, .hero-assinatura { color: color-mix(in srgb, var(--suave) 70%, var(--titulo)); }
/* on a phone the words fill the hero and cross the dark beam of the door frame: the paper veil is
   stronger there (kicker 2.46:1 and title 2.59:1 on the worst pixel; review of 19/11/2026) */
@media (max-width: 860px) {
  html[data-hero="pintura-cheia"] .hero::before { background: linear-gradient(to top, var(--fundo) 0%, color-mix(in srgb, var(--fundo) 86%, transparent) 40%, color-mix(in srgb, var(--fundo) 76%, transparent) 100%); }
}
.hero-titulo em { color: var(--titulo); }
.hero-tese { border-color: color-mix(in srgb, var(--titulo) 22%, transparent); max-width: 52ch; }
.hero-tese .porta-errada { color: var(--lock); font-style: italic; }
/* the hero figure ("Fourteen days") sits on glass at the right, in front of the doors */
.hero .hero-figura { position: absolute; z-index: 2; right: max(var(--margem), 3vw); bottom: 4.5rem; width: min(440px, 36vw); margin: 0; }
@media (max-width: 900px) {
  .hero { flex-direction: column; justify-content: flex-end; gap: 1.6rem; }
  .hero .hero-figura { position: relative; right: auto; bottom: auto; width: 100%; }
}

/* ---------- PARTS: the light changes by part, by attribute (VISUAL.md, section 3) ---------- */
.bloco[data-modo="2"] .capitulo + .capitulo { margin-top: 1rem; }
.bloco[data-modo="4"] .bloco-cabeca { background: linear-gradient(to bottom, color-mix(in srgb, var(--lock) 5%, transparent), transparent 80%); border-radius: var(--raio-grande); }
.bloco[data-modo="5"] :is(.bloco-rotulo, .capitulo-rotulo, .capitulo-nota-num) { color: var(--corridor); }
/* Cormorant's old-style 1 is a small capital I: next to the Roman block numbers, chapter 11 read as "II"
   and 12 as "I 2". Lining figures in the margin note only (19/11/2026) */
.capitulo-nota-num { font-variant-numeric: lining-nums proportional-nums; }
.bloco[data-modo="5"] .capitulo-cabeca { border-bottom: 1px solid color-mix(in srgb, var(--corridor) 30%, transparent); }
.bloco[data-modo="8"], .fecho { background: var(--paper-fecho); }
.bloco-numero:empty { display: none; }
/* no block summary in this essay (only the author writes one): the words sit in the middle of the plate's height */
@media (min-width: 861px) {
  html[data-blocos="prancha-ao-lado"] .bloco-cabeca { grid-template-rows: 1fr auto auto auto auto 1fr; grid-template-areas: "a prancha" "num prancha" "rot prancha" "tit prancha" "lis prancha" "b prancha"; row-gap: 0.6rem; }
  html[data-blocos="prancha-ao-lado"] .bloco.is-par .bloco-cabeca { grid-template-areas: "prancha a" "prancha num" "prancha rot" "prancha tit" "prancha lis" "prancha b"; }
}

/* ---------- the clipping of the rule (chapter 1): typographic, after a gazette, no seal ---------- */
/* 19/11/2026, Julli: the glossary kept misbehaving inside the paper, so what competed with it went out: the
   tilt (a rotated box shifts the term's line and the popover's measure), the ruled lines (they ran under the
   dotted underlines) and the diagnoses' own underline (it sat on the same words as the glossary's). The
   diagnoses are now set in semibold; the custom lens hides over the paper, as it does over the pieces. */
.recorte { position: relative; max-width: var(--medida, 66ch); margin: 2.2rem auto; padding: 1.1rem 1.4rem 1.3rem; background: #fbfaf6; border: 1px solid rgba(27, 34, 48, 0.16); box-shadow: 0 1px 0 rgba(27, 34, 48, 0.05), 0 12px 30px rgba(27, 34, 48, 0.08); }
.recorte-cabeca { margin: 0 0 0.8rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--linha-2); font-family: var(--fonte-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--suave); }
.recorte-texto { margin: 0; font-family: var(--fonte-titulo); font-size: clamp(1.12rem, 1.02rem + 0.35vw, 1.3rem); font-weight: 500; line-height: 1.5; color: var(--titulo); }
.recorte mark { background: none; color: inherit; }
.recorte mark.diag { font-weight: 600; }
/* the underline is a text decoration, not a painted band: the band sat inside the word's box and,
   measured as background, brought "extremamente" down to 2.47:1 (review of 19/11/2026) */
.recorte mark.adv { color: var(--lock); font-style: italic; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--lock) 55%, transparent); text-decoration-thickness: 2px; text-underline-offset: 0.14em; text-decoration-skip-ink: none; }

/* ---------- the glossary of chapter 3 as glass cards ---------- */
.verbetes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 0.9rem; min-width: 0; max-width: 1080px; margin: 1.8rem auto; padding: 0 var(--margem); }
/* inside the chapter, which is a grid, the auto side margins made this grid size itself by its content
   (three 303 px columns, 972 px on a 375 px phone), and the whole page shrank to fit: it stretches
   over the text column instead (19/11/2026) */
.capitulo > .verbetes { margin-inline: 0; padding-inline: 0; }
.verbetes .caixa-termo { background: var(--vidro); border: 1px solid var(--vidro-borda); -webkit-backdrop-filter: blur(var(--vidro-blur)) saturate(1.15); backdrop-filter: blur(var(--vidro-blur)) saturate(1.15); }
.verbetes .caixa-destacado { font-family: var(--fonte-titulo); font-size: var(--t-lg); font-weight: 600; color: var(--titulo); }
.verbetes .caixa-termo p { max-width: none; font-size: var(--t-sm); }
/* with the margin note, the chapter is a grid: the cards take the text column and the right margin,
   like the plates, instead of a fixed 1080 px that ran 49 px past the window at 1440 (19/11/2026) */
@media (min-width: 1100px) {
  html[data-capitulo="nota-margem"] .capitulo > .verbetes { grid-column: 3 / -1; max-width: none; margin: 1.8rem 0; padding: 0 var(--margem) 0 0; }
}

/* ---------- the objection: a corridor rule and a small label; the answer returns to the body ---------- */
.objecao { position: relative; margin: 1.6rem 0; padding: 0.2rem 0 0.2rem 1.15rem; border-left: 2px solid var(--corridor); }
.objecao-rotulo { margin: 0 0 0.3rem; font-family: var(--fonte-mono); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--corridor); }
.objecao p { margin: 0; }
.objecao-trecho { background: color-mix(in srgb, var(--corridor) 9%, transparent); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 0.15em; border-radius: 3px; }

/* ---------- the author's own thread: a quiet mark in the margin, no label, no picture ---------- */
.fio-pessoal { position: relative; }
.fio-pessoal::before { content: ''; position: absolute; left: -1.15rem; top: 0.55em; width: 7px; height: 7px; border-radius: 50%; background: var(--identity); box-shadow: 0 0 0 3px color-mix(in srgb, var(--identity) 18%, transparent); }
.fio-trecho { color: var(--identity); }
@media (max-width: 720px) { .fio-pessoal::before { left: -0.75rem; width: 5px; height: 5px; } }

/* ---------- the four changes of chapter 22: brass-edged cards, numbered by CSS ---------- */
.mudancas { counter-reset: mudanca; display: grid; gap: 0.8rem; margin: 1.4rem 0; }
.mudanca { counter-increment: mudanca; position: relative; margin: 0; padding: 1rem 1.2rem 1rem 3.4rem; border: 1px solid color-mix(in srgb, var(--brass) 55%, transparent); border-radius: var(--raio); background: var(--painel); }
.mudanca::before { content: counter(mudanca, decimal-leading-zero); position: absolute; left: 1.1rem; top: 1.05rem; font-family: var(--fonte-mono); font-size: 0.8rem; color: var(--brass); }

/* ---------- the two static figures (chapters 6 and 12): not interactives, so no glass and no "Fig." ---------- */
.estatica { max-width: 860px; margin: 2.4rem auto; padding: 1.3rem clamp(1rem, 3vw, 1.6rem) 1.5rem; border: 1px solid var(--linha-2); border-radius: var(--raio-grande); background: var(--painel); }
.estatica-titulo { margin: 0 0 1rem; font-family: var(--fonte-mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--suave); }
/* seven factors around the decision against two */
.fatores-par { display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(0.8rem, 3vw, 2rem); }
.fatores-lado { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 1rem; border-radius: var(--raio); text-align: center; }
.fatores-chicago { background: color-mix(in srgb, var(--brass) 7%, var(--painel)); border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent); }
.fatores-norma { background: color-mix(in srgb, var(--lock) 5%, var(--painel)); border: 1px solid color-mix(in srgb, var(--lock) 35%, transparent); }
.fatores-rotulo { margin: 0; font-family: var(--fonte-mono); font-size: 0.7rem; letter-spacing: 0.08em; color: var(--titulo); }
.fatores-centro { order: 2; margin: 0.2rem 0; padding: 0.35rem 1rem; border-radius: var(--pilula); background: var(--titulo); color: var(--fundo); font-family: var(--fonte-titulo); font-size: var(--t-lg); font-weight: 600; }
.fatores-lado ul { order: 3; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; }
.fatores-lado li { padding: 0.3rem 0.7rem; border-radius: var(--pilula); background: var(--fundo); font-size: var(--t-sm); line-height: 1.3; color: var(--titulo); }
.fatores-chicago li { border: 1px solid color-mix(in srgb, var(--brass) 55%, transparent); }
.fatores-norma li { border: 1px solid var(--lock); color: var(--lock); font-weight: 500; }
@media (max-width: 720px) { .fatores-par { grid-template-columns: 1fr; } }
/* the timeline: only dates and facts of chapter 12, no picture, no face */
.linha-tempo ol { list-style: none; margin: 0; padding: 0 0 0 1.2rem; border-left: 2px solid var(--linha-2); display: grid; gap: 0.55rem; }
.linha-tempo li { position: relative; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.8rem; align-items: baseline; }
.linha-tempo li::before { content: ''; position: absolute; left: calc(-1.2rem - 6px); top: 0.45em; width: 10px; height: 10px; border-radius: 50%; background: var(--painel); border: 2px solid var(--corridor); }
.lt-ano { font-family: var(--fonte-mono); font-size: 0.8rem; color: var(--corridor); }
.lt-fato { font-size: var(--t-sm); line-height: 1.45; color: var(--titulo); }
.linha-tempo li.is-trava::before { border-color: var(--lock); background: var(--lock); }
.linha-tempo li.is-trava .lt-ano, .linha-tempo li.is-trava .lt-fato { color: var(--lock); font-weight: 500; }
@media (max-width: 560px) { .linha-tempo li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* ---------- the closing line of a chapter ---------- */
html[data-coda="traco"] .coda { font-family: var(--fonte-titulo); font-weight: 500; }

/* ---------- the series grid and the closing ---------- */
.fecho { max-width: none; padding-bottom: 3.5rem; }
.fecho > * { max-width: 860px; }
.serie-grade a[aria-current] { border-color: var(--brass); background: color-mix(in srgb, var(--brass) 8%, var(--painel)); }
.serie-aqui { color: var(--brass); }

/* ---------- the cursor: the glass lens of Intersexo 2, as a brass magnifier (the examiner's eye, chapter 8).
   Mouse only, like every house cursor; it hides over a figure's stage and grows over links and glossary terms ---------- */
/* clear glass: a magnifier never blurs the word under it */
.cursor-lente { border: 1.5px solid var(--brass); background: color-mix(in srgb, #ffffff 8%, transparent); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), 0 2px 8px rgba(27, 34, 48, 0.2); }
.cursor-lente::after { content: ''; position: absolute; left: 85%; top: 85%; width: 10px; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--brass); transform: rotate(45deg); transform-origin: left center; }

/* ---------- the glossary: the terms read as part of the sentence, with a quiet corridor underline ---------- */
.prosa .gl-term, .coda .gl-term, .caixa-termo .gl-term, .recorte .gl-term, .ch-folha .gl-term, .estatica .gl-term, .hero-tese .gl-term { text-decoration-color: color-mix(in srgb, var(--corridor) 70%, transparent); }
/* the popover is a paper card on the reading: nearly opaque, a light shadow for the light page, and no
   colored hairline on top, which read as a stray red line over the text (19/11/2026) */
.gl-pop { background: color-mix(in srgb, var(--fundo) 97%, transparent); border-color: color-mix(in srgb, var(--titulo) 16%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 14px 34px rgba(27, 34, 48, 0.18), 0 2px 6px rgba(27, 34, 48, 0.08); }
.gl-pop::before { display: none; }
/* when a long definition fits on neither side of the term, ensaio.js caps the card's height and it scrolls
   inside, so it never covers the term's own line (19/11/2026) */
.gl-pop { overflow-y: auto; overscroll-behavior: contain; }
.gl-pop-arrow { display: none; }
/* a definition from an outside source names it, small, under the text (the glossary list links it) */
.gl-pop-fonte { margin: 0.5rem 0 0; font-family: var(--fonte-mono); font-size: 0.68rem; letter-spacing: 0.03em; color: var(--suave); }
.glossario-lista .gl-fonte { display: block; margin-top: 0.25rem; font-family: var(--fonte-mono); font-size: 0.72rem; color: var(--suave); }
.glossario-lista .gl-fonte a { color: inherit; }
.gl-pop[data-side] { transform: none; }

/* ---------- the mock band ---------- */
.mock-faixa { width: min(860px, calc(100% - 2 * var(--margem))); margin: 1.6rem auto 0; padding: 0.6rem 1rem; border: 1px dashed var(--linha-2); border-radius: var(--raio); font-family: var(--fonte-mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--suave); text-align: center; }

/* a figure not made yet: a marked place, never counted */
.interativo-pendente { max-width: var(--medida, 66ch); margin: 2rem auto; padding: 1rem 1.2rem; border: 1px dashed var(--linha-2); border-radius: var(--raio); font-family: var(--fonte-mono); font-size: 0.75rem; color: var(--suave); text-align: center; }

@media print {
  .recorte { transform: none; box-shadow: none; background: #fff; border-color: #999; }
  .recorte mark.adv { color: #000; text-decoration-color: #000; text-decoration-thickness: 1px; }
  .objecao { border-left-color: #000; }
  .objecao-rotulo, .fio-trecho, .mudanca::before { color: #000; }
  .fio-pessoal::before { background: #000; box-shadow: none; }
  .bloco[data-modo="8"], .fecho, .mudanca, .verbetes .caixa-termo { background: #fff; }
  /* the hero piece prints as its static version, like every figure (gate 7; review of 19/11/2026):
     before, the whole hero figure was hidden and the print had no "Fourteen days" at all */
  .interativo-pendente, .mock-faixa { display: none; }
  #fig-h { background: #fff; border-color: #999; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
