/* ==========================================================
   THE LEFT AND THE CHAOS · the skin (esquerda.css)
   An archive desk at night: official paper, stamp ink, a ruler.
   Two inks that do not say whose side they are on.
   Contrast measured by script (trabalho/direcao_prep.py, trabalho/direcao_mock.py, DIRECAO.md).
   ========================================================== */
:root {
  /* the desk */
  --fundo: #121014;
  --fundo-2: #1b181f;
  --painel: #1b181f;
  --painel-2: #231f28;
  --titulo: #f3eee4;
  --texto: #e9e3d6;
  --suave: #c9c2b4;
  --fraco: #a9a294;
  --acento: #c9a24a;
  --acento-2: #a58bd6;
  --alerta: #c99a62;
  --regua: #3a3540;
  /* the brightest pixel the background wash can reach (fundo-tinta, glow included) */
  --fundo-pico: #2b2229;

  /* the two inks: the dark ones only print (large caps, never body text); the light ones may carry text */
  --tinta-roxa: #7b5ea7;
  --tinta-roxa-clara: #a58bd6;
  --tinta-sepia: #9a6a3c;
  --tinta-sepia-clara: #c99a62;
  --latao: #c9a24a;

  /* paper surfaces (measured apart: dark text on light paper) */
  --papel: #e9e3d6;
  --papel-2: #ddd5c4;
  --papel-tinta: #1b181f;
  --papel-suave: #4e4757;
  --papel-roxa: #5a3f86;
  --papel-sepia: #6f4a24;
  --papel-latao: #6e5414;
  --papel-regua: #b9b0a0;

  /* the pieces */
  --fig-fundo: #16131a;
  --fig-tinta: #e9e3d6;
  --fig-suave: #a9a294;
  --fig-acento: #c9a24a;
  --fig-alerta: #c99a62;

  /* modes: decorative only (glow, rule, canvas) */
  --modo-1a: #7b5ea7; --modo-1b: #9a6a3c;
  --modo-2a: #9a6a3c; --modo-2b: #7b5ea7;
  --modo-3a: #c9a24a; --modo-3b: #7b5ea7;
  --modo-4a: #a9a294; --modo-4b: #9a6a3c;

  --fonte-titulo: 'EB Garamond', 'Iowan Old Style', Georgia, serif;
  --fonte-texto: 'DM Sans', 'DM Sans Fallback', 'Helvetica Neue', Arial, sans-serif;
  --fonte-mono: 'DM Mono', 'DM Mono Fallback', 'Cascadia Mono', Consolas, monospace;
}
/* test only, for her choice in the mock: ?titulo=fraunces | ?titulo=garamond */
:root[data-titulo="fraunces"] { --fonte-titulo: 'Fraunces', 'Iowan Old Style', Georgia, serif; }
:root[data-titulo="garamond"] { --fonte-titulo: 'EB Garamond', 'Iowan Old Style', Georgia, serif; }

body { background: var(--fundo) radial-gradient(90% 60% at 15% 10%, #19151d 0%, transparent 70%) fixed; color: var(--texto); }

/* ---------------------------------------------------------- the reading background: GetLayers "Feather" wash
   (an ink wash drying on paper), retinted to the desk and drawn by esquerda.js at half resolution.
   The template's purple glow is retired here. */
html.esquerda .fundo-camada { display: none; }
.fundo-tinta { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
.fundo-tinta.pronto { opacity: 1; }

/* ---------------------------------------------------------- cursor: an ink drop, only where it does not get in the way */
@media (pointer: fine) {
  html.esquerda, html.esquerda body {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M11 2.5C11 2.5 5 10 5 14a6 6 0 0 0 12 0c0-4-6-11.5-6-11.5z' fill='%23a58bd6' stroke='%23121014' stroke-width='1.6'/%3E%3C/svg%3E") 11 3, default;
  }
  html.esquerda a, html.esquerda button, html.esquerda [role="slider"], html.esquerda summary, html.esquerda label {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M11 2.5C11 2.5 5 10 5 14a6 6 0 0 0 12 0c0-4-6-11.5-6-11.5z' fill='%23c99a62' stroke='%23121014' stroke-width='1.6'/%3E%3Ccircle cx='11' cy='14' r='2' fill='%23121014'/%3E%3C/svg%3E") 11 3, pointer;
  }
  /* reading: the text cursor stays over every line, so selecting is never in question */
  html.esquerda main p, html.esquerda main li, html.esquerda main h2, html.esquerda main h3, html.esquerda main h4,
  html.esquerda main blockquote, html.esquerda main figcaption, html.esquerda main td, html.esquerda main cite { cursor: text; }
  html.esquerda main a { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22'%3E%3Cpath d='M11 2.5C11 2.5 5 10 5 14a6 6 0 0 0 12 0c0-4-6-11.5-6-11.5z' fill='%23c99a62' stroke='%23121014' stroke-width='1.6'/%3E%3Ccircle cx='11' cy='14' r='2' fill='%23121014'/%3E%3C/svg%3E") 11 3, pointer; }
}

/* ---------------------------------------------------------- the bar: a floating capsule of dark glass */
html.esquerda[data-barra="faixa"] .barra {
  position: sticky; top: .6rem; z-index: 60;
  width: min(900px, calc(100% - 1.2rem)); margin: .7rem auto 0; min-height: 3.2rem;
  padding: .35rem .4rem .35rem 1.3rem; gap: .6rem;
  border: 1px solid color-mix(in srgb, var(--texto) 13%, transparent); border-bottom-color: color-mix(in srgb, var(--texto) 13%, transparent);
  border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, #121014 74%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(125%); backdrop-filter: blur(16px) saturate(125%);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .42), inset 0 1px 0 color-mix(in srgb, var(--texto) 8%, transparent);
}
html.esquerda .barra-logo { font-size: .86rem; letter-spacing: .14em; color: var(--suave); }
html.esquerda .barra-meio { gap: .4rem; }
html.esquerda[data-barra="faixa"] .barra-capitulo { border: 0; padding: .15rem .2rem; min-height: 0; color: var(--suave); font-family: var(--fonte-titulo); font-size: .98rem; font-style: italic; }
html.esquerda .barra-pct { font-family: var(--fonte-mono); color: var(--acento); }
html.esquerda .barra-direita { gap: 2px; padding: 2px; border-radius: 999px; background: color-mix(in srgb, var(--texto) 6%, transparent); }
html.esquerda .barra-botao { border: 0; border-radius: 999px; min-height: 36px; padding: .15rem .8rem; color: var(--suave); }
html.esquerda .barra-botao:hover, html.esquerda .barra-botao[aria-pressed="true"], html.esquerda .barra-botao[aria-expanded="true"] { background: color-mix(in srgb, var(--texto) 11%, transparent); color: var(--titulo); }
html.esquerda .barra-botao:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; }
html.esquerda .barra-progresso { left: 1.4rem; right: 1.4rem; bottom: 3px; height: 2px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, var(--texto) 7%, transparent); }
html.esquerda .barra-progresso i { background: linear-gradient(90deg, var(--tinta-roxa-clara), var(--tinta-sepia-clara)); }
@media (max-width: 520px) {
  html.esquerda[data-barra="faixa"] .barra { width: calc(100% - .8rem); padding-left: .8rem; gap: .3rem; }
  html.esquerda .barra-logo { font-size: .72rem; letter-spacing: .08em; }
  html.esquerda[data-barra="faixa"] .barra-capitulo { display: none; }
  html.esquerda .barra-botao { padding: .15rem .55rem; min-width: 36px; }
}

/* ---------------------------------------------------------- hero: the desk, the sheet, the tray */
.hero-mesa {
  position: relative; min-height: calc(100vh - 3.5rem); min-height: calc(100svh - 3.5rem);
  display: grid; grid-template-rows: 1fr auto; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  background: radial-gradient(120% 80% at 30% 20%, color-mix(in srgb, #1e1a22 90%, transparent) 0%, transparent 70%);
}
/* the desk photo melts into the wash below instead of ending on a hard line */
html.esquerda .hero-mesa .hero-arte { -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%); mask-image: linear-gradient(180deg, #000 62%, transparent 100%); }
html.esquerda .hero-mesa .hero-arte::after { background: linear-gradient(180deg, color-mix(in srgb, var(--fundo) 55%, transparent) 0%, color-mix(in srgb, var(--fundo) 20%, transparent) 40%, color-mix(in srgb, var(--fundo) 60%, transparent) 100%); }
html.esquerda .hero-mesa > .mesa, html.esquerda .hero-mesa > .hero-rodape { grid-column: 1 / -1; width: 100%; max-width: none; justify-self: stretch; }
html.esquerda .hero-mesa > .hero-rodape { max-width: 46rem; justify-self: center; }
.hero-mesa .hero-arte { position: absolute; inset: 0; z-index: 0; }
.hero-mesa .hero-arte img { width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.hero-mesa .hero-arte::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--fundo) 55%, transparent) 0%, color-mix(in srgb, var(--fundo) 20%, transparent) 40%, var(--fundo) 100%); }

.mesa {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem;
  padding: 3rem 1rem 2.2rem; text-align: center;
  touch-action: pan-y pinch-zoom; outline: none;
}
.mesa:focus-visible { box-shadow: inset 0 0 0 2px var(--acento); }
.mesa-tinta { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.mesa > :not(.mesa-tinta):not(.mesa-cursor) { position: relative; z-index: 2; }
@media (pointer: fine) { html.esquerda .mesa.tem-cursor, html.esquerda .mesa.tem-cursor .folha p { cursor: none; } html.esquerda .mesa.tem-cursor button { cursor: pointer; } }

html.esquerda .mesa .hero-texto { width: 100%; max-width: 46rem; margin: 0 auto; padding: 0; text-align: center; background: none; display: block; }
.mesa .hero-olho { font-family: var(--fonte-mono); font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; color: var(--fraco); margin: 0; }
.mesa .hero-titulo { font-family: var(--fonte-titulo); font-weight: 500; font-size: clamp(2.5rem, 6.4vw, 4.8rem); line-height: 1.02; color: var(--titulo); margin: .35rem 0 0; text-align: center; }

/* the sheet: official paper laid on the desk, slightly askew; the legend is typed at its foot */
.folha {
  width: min(34rem, 100%); padding: 2rem 2.2rem 1.2rem; background: var(--papel); color: var(--papel-tinta);
  border-radius: 2px; transform: rotate(-.6deg);
  box-shadow: 0 1px 0 #fff6 inset, 0 18px 40px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
  background-image: repeating-linear-gradient(180deg, transparent 0 27px, color-mix(in srgb, var(--papel-regua) 40%, transparent) 27px 28px);
}
.mesa-frase { font-family: var(--fonte-titulo); font-size: clamp(1.45rem, 3.2vw, 2.25rem); line-height: 1.28; color: var(--papel-tinta); margin: 0 0 1.2rem; }
.mesa-legenda { font-family: var(--fonte-mono); font-size: .8rem; letter-spacing: .05em; color: var(--papel-suave); margin: 0; padding-top: .7rem; border-top: 1px solid var(--papel-regua); text-align: right; }

/* the tray: where the stamp rests; controls and hint in one place */
.bandeja {
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
  padding: .7rem .8rem .65rem; border-radius: 18px;
  background: color-mix(in srgb, var(--painel) 82%, transparent); border: 1px solid var(--regua);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
}
.mesa-controles { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.mesa-controles button {
  font: 500 .86rem/1 var(--fonte-texto); color: var(--texto); background: var(--painel-2);
  border: 1px solid var(--regua); border-radius: 999px; padding: .62rem 1rem; min-height: 44px;
}
.mesa-controles button:hover { border-color: var(--fraco); }
.mesa-controles button:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.mesa-controles .mesa-trocar { border-color: color-mix(in srgb, var(--tinta-roxa-clara) 55%, var(--regua)); }
.mesa[data-tinta="1"] .mesa-controles .mesa-trocar { border-color: color-mix(in srgb, var(--tinta-sepia-clara) 55%, var(--regua)); }
.mesa-rotulo { font-family: var(--fonte-mono); letter-spacing: .1em; margin-left: .4rem; color: var(--tinta-roxa-clara); }
.mesa[data-tinta="1"] .mesa-rotulo { color: var(--tinta-sepia-clara); }
.mesa-dica { font-size: .8rem; color: var(--fraco); margin: 0; max-width: 44ch; }
.mesa-cursor { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .2s; will-change: transform; }
.mesa.tem-cursor:hover .mesa-cursor { opacity: 1; }
.mesa-cursor svg { display: block; }

.hero-rodape { position: relative; z-index: 1; padding: 0 1rem 2.4rem; max-width: 46rem; margin: 0 auto; text-align: center; }
.hero-rodape .hero-sub { font-family: var(--fonte-mono); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fraco); }
.hero-rodape .hero-tese { font-family: var(--fonte-titulo); font-size: 1.25rem; line-height: 1.4; color: var(--titulo); }
.hero-rodape .hero-fatos { display: flex; gap: 1.4rem; justify-content: center; list-style: none; padding: 0; font-family: var(--fonte-mono); color: var(--fraco); }
.hero-rodape .hero-fatos b { color: var(--acento); font-weight: 500; }
html.esquerda .hero-rodape .hero-fatos { flex-wrap: wrap; gap: .5rem; }
html.esquerda .hero-rodape .hero-acoes { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
@media (max-width: 520px) {
  html.esquerda .hero-rodape .hero-fatos { flex-wrap: nowrap; gap: .35rem; }
  html.esquerda .hero-rodape .hero-fatos li { font-size: .7rem; padding-inline: .55rem; white-space: nowrap; }
}

/* hero footer on the same center axis as the title, sheet and tray, with even spacing */
html.esquerda .hero-mesa > .hero-rodape {
  grid-column: 1 / -1; justify-self: center; align-self: start;
  width: min(40rem, calc(100% - 2rem)); margin: 3rem auto 0; padding: 0 0 3rem;
  display: flex; flex-direction: column; align-items: center; gap: 1.25rem; text-align: center;
}
html.esquerda .hero-rodape > * { margin: 0; }
html.esquerda .hero-rodape .hero-sub { width: 100%; text-align: center; }
html.esquerda .hero-rodape .hero-tese { width: 100%; padding: 1.1rem 0; text-align: center; text-wrap: balance; }
html.esquerda .hero-rodape .hero-fatos { justify-content: center; margin-top: -.25rem; }
html.esquerda .hero-rodape .hero-acoes { justify-content: center; gap: .75rem; margin-top: .75rem; }

/* ---------------------------------------------------------- the reading */
.esquerda .bloco-titulo, .esquerda .capitulo-titulo { font-family: var(--fonte-titulo); font-weight: 500; }
.esquerda .capitulo-rotulo, .esquerda .bloco-numero { font-family: var(--fonte-mono); letter-spacing: .12em; text-transform: uppercase; }
.tese.oficio { border: 1px solid var(--regua); border-left: 3px solid var(--acento); background: var(--painel); }
.objecao.ficha, .fio.ficha { border: 1px solid var(--regua); background: var(--painel); }
.fio.ficha .fio-rotulo { font-family: var(--fonte-mono); color: var(--acento-2); }
sup { font-family: var(--fonte-mono); font-size: .7em; }
sup a { color: var(--acento); text-decoration: none; }

/* chat-format structure from montar_pagina.py (trabalho/relatorio-builder.md) */
/* the label rides inside the title (the lock wants "Chapter 7 · The ladder" contiguous): small mono caps, inline, so the dot reads as a separator */
.esquerda .capitulo-n, .esquerda .bloco-n { font-family: var(--fonte-mono); font-size: .42em; font-weight: 400; letter-spacing: .14em; text-transform: uppercase; color: var(--fraco); vertical-align: .35em; white-space: nowrap; }
html.esquerda article[data-tipo] .capitulo-numero { display: none; }
html.esquerda .barra-capitulo .capitulo-n { display: none; }
html.esquerda .barra-capitulo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36ch; }
.esquerda .capitulo-sub { font-family: var(--fonte-titulo); font-weight: 500; font-size: 1.45rem; line-height: 1.25; color: var(--titulo); max-width: 40rem; margin: 2.6rem auto 1rem; padding-top: 1rem; border-top: 1px solid var(--regua); }
.esquerda blockquote.citacao { max-width: 38rem; margin: 2rem auto; padding: 1.1rem 1.3rem; background: var(--painel); border: 1px solid var(--regua); border-left: 3px solid var(--acento-2); border-radius: 4px; }
.esquerda blockquote.citacao p { font-family: var(--fonte-titulo); font-size: 1.15rem; line-height: 1.5; color: var(--titulo); margin: 0 0 .5rem; }
.esquerda blockquote.citacao p:last-child { margin-bottom: 0; }
.esquerda sup.nota-ref { line-height: 0; margin-left: .1em; }
.esquerda sup.nota-ref a:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.esquerda ol.notas { font-size: .88rem; line-height: 1.55; color: var(--suave); padding-left: 2.4rem; }
.esquerda ol.notas li { margin-bottom: .55rem; scroll-margin-top: 5rem; }
.esquerda ol.notas li:target { color: var(--texto); background: var(--painel-2); }
.esquerda ol.notas li::marker { font-family: var(--fonte-mono); color: var(--fraco); }
.esquerda ol.notas a { color: var(--acento-2); overflow-wrap: anywhere; }
.esquerda .nota-volta { text-decoration: none; margin-left: .3rem; color: var(--acento); }
body.is-en ol.notas[data-pt], body.is-pt ol.notas[data-en], body.is-en blockquote.citacao > p[data-pt], body.is-pt blockquote.citacao > p[data-en] { display: none; }
.esquerda .bloco-abertura, .esquerda .bloco-fecho { padding-top: 2rem; }
.esquerda .bloco-abertura .capitulo-titulo, .esquerda .bloco-fecho .capitulo-titulo { text-align: center; }
.esquerda article[data-tipo="fecho"] { border-top: 1px solid var(--regua); margin-top: 3rem; }

@media (max-width: 600px) {
  .mesa { padding-top: 2rem; gap: 1.2rem; }
  .folha { padding: 1.4rem 1.3rem 1rem; transform: rotate(-.4deg); }
  .mesa-legenda { text-align: left; }
  .bandeja { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .mesa-cursor, .fundo-tinta { transition: none; }
}

/* ---------------------------------------------------------- print */
@media print {
  .mesa-tinta { display: none; }
  .fundo-tinta, .mesa-cursor, .bandeja, .hero-mesa .hero-arte { display: none; }
  .hero-mesa { min-height: 0; background: none; }
  .mesa { min-height: 0; padding: 1rem 0; }
  .folha { box-shadow: none; transform: none; background: none; }
  body { background: #fff; color: #000; }
}
