/* The energy guides on the new design (G3 guide template, new shell): glossário, calendário, TAR, fórmulas dos
   indexados, códigos amigo — only what they add to /design/novo.css and /energia/g3.css: the guide header without a
   tool, the TAR validity twins, the glossary (search, filters, letters), the timeline, the equation, the wide tables.
   Rendered by src/energia/guias/g3.ts. Every ep-* rule is scoped under .g3b (one definition per selector). */

/* Validity twins for legal values (vigor.ts): a TAR figure shows only while its year is in force. */
html:not([data-tar="fresco"]) .g3b [data-tar-fresco], html[data-tar="fresco"] .g3b [data-tar-velho],
html:not([data-gas="fresco"]) .g3b [data-gas-fresco], html[data-gas="fresco"] .g3b [data-gas-velho] { display: none !important; }
/* parts that work only with the page script (the glossary search and filters) stay hidden without it */
html:not([data-js]) .g3b [data-so-js] { display: none !important; }

/* ── the guide header (G1): crumbs, the question, the answer, the basis line; one column, ~65ch ── */
.g3b .g1h .wrap { gap: 20px; }
.g3b .g1h .g3r, .g3b .g1h .dek { max-width: 65ch; }
.g3b .g1h .gmeta { align-items: flex-start; max-width: 92ch; line-height: 1.5; } .g3b .g1h .gmeta .dot { margin-top: 3px; }
.g3chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }
.g3chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: var(--r-pill); border: 1.5px solid var(--ink-deep); color: var(--ink-deep); font: 600 15px/1.2 var(--font-ui); text-decoration: none; background: #fff; }
.g3chip:hover { background: var(--ink-deep); color: #fff; }

/* a figure-free line shown instead of a stale table */
.g3b .ep-velho { margin: 0; padding: 16px 18px; border-radius: 16px; background: var(--cream); font-size: 15px; line-height: 1.5; color: var(--ink-60); max-width: 65ch; }
.g3b .b3 .ep-velho { background: #fff; }
/* a sub-heading between two tables of one section */
.g3b .ep-subtit { margin: 8px 0 0; font: 500 12px/1.3 var(--font-doc); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-50); }
.g3stack { display: grid; gap: 20px; min-width: 0; }

/* ── glossário ── */
.g3busca { position: sticky; top: 73px; z-index: 5; display: grid; gap: 12px; padding: 14px 0; background: var(--paper); border-bottom: 1px solid var(--tint-10); }
.g3b .ep-busca { display: flex; align-items: center; gap: 10px; max-width: 520px; min-height: 52px; padding: 0 20px; border-radius: var(--r-pill); background: #fff; border: 1.5px solid var(--tint-20); }
.g3b .ep-busca:focus-within { outline: 2px solid var(--peach-ink); outline-offset: 2px; }
.g3b .ep-busca input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; font: 400 17px/1 var(--font-ui); color: var(--ink); }
.g3b .ep-busca input:focus { outline: none; }
.g3b .ep-busca span[aria-hidden] { color: var(--ink-50); font-size: 18px; }
.g3b .ep-filtros { display: flex; flex-wrap: wrap; gap: 8px; }
.g3b .ep-filtros button { min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1.5px solid var(--tint-20); background: #fff; color: var(--ink-deep); font: 500 14.5px/1 var(--font-ui); cursor: pointer; }
.g3b .ep-filtros button[aria-pressed="true"] { background: var(--ink-deep); border-color: var(--ink-deep); color: #fff; font-weight: 600; }
.g3b .ep-glos { display: grid; gap: 8px; max-width: 820px; }
.g3b .ep-letra { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding-top: 20px; border-top: 1px solid var(--tint-20); }
.g3b .ep-letra[hidden], .g3b .ep-termo[hidden] { display: none; }
.g3b .ep-letra__l { margin: 0; font: 700 40px/1 var(--disp); color: var(--peach-ink); }
.g3b .ep-letra dl { margin: 0; display: grid; gap: 18px; padding-bottom: 12px; }
.g3b .ep-termo { display: grid; gap: 4px; scroll-margin-top: 200px; }
.g3b .ep-termo dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font: 600 18px/1.3 var(--font-ui); color: var(--ink-deep); }
.g3b .ep-termo__c { font: 500 12px/1.3 var(--font-doc); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-50); }
.g3b .ep-termo dd { margin: 0; display: grid; gap: 0; }
.g3b .ep-termo dd p { margin: 0; font-size: 16.5px; line-height: 1.55; color: var(--ink-60); max-width: 65ch; }
.g3b .ep-termo dd a { display: inline-flex; align-items: center; min-height: 44px; justify-self: start; font: 600 15px/1.2 var(--font-ui); color: var(--ink-deep); text-decoration: underline; text-decoration-color: var(--peach); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.g3b .ep-vazio { margin: 0; font-size: 16px; color: var(--ink-60); } .g3b .ep-vazio[hidden] { display: none; }
.g3b .ep-vazio a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); }

/* ── calendário ── */
.g3b .ep-linha { list-style: none; margin: 0; padding: 0; display: grid; max-width: 920px; }
.g3b .ep-ev { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 32px; padding: 24px 0; border-top: 1px solid var(--tint-20); }
.g3b .ep-ev:last-child { border-bottom: 1px solid var(--tint-20); }
.g3b .ep-ev[hidden] { display: none; }
.g3b .ep-ev time { font: 600 15px/1.4 var(--font-doc); color: var(--peach-ink); }
.g3b .ep-ev > div { display: grid; gap: 6px; }
.g3b .ep-ev .cell__label { font: 500 12px/1.3 var(--font-doc); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-50); }
.g3b .ep-ev h3 { margin: 0; font: 700 22px/1.2 var(--disp); color: var(--ink-deep); }
.g3b .ep-ev p { margin: 0; font-size: 16.5px; line-height: 1.55; color: var(--ink-60); max-width: 65ch; }
.g3b .ep-ev small { font: 500 12.5px/1.4 var(--font-doc); color: var(--ink-50); }
.g3exp .tk { color: var(--peach-ink); }

/* ── fórmulas: the equation ── */
.g3b .ep-eq { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.g3b .ep-eq__t { display: grid; gap: 2px; padding: 14px 18px; border-radius: 18px; background: #fff; border: 1px solid var(--tint-20); }
.g3b .ep-eq__t b { font: 700 22px/1.1 var(--disp); color: var(--ink-deep); }
.g3b .ep-eq__t small { font-size: 13.5px; color: var(--ink-60); }
.g3b .ep-eq__t--r { background: var(--ink-deep); border-color: var(--ink-deep); } .g3b .ep-eq__t--r b { color: #fff; } .g3b .ep-eq__t--r small { color: var(--on-dark-75); }
.g3b .ep-eq__op { font: 400 26px/1 var(--font-ui); color: var(--ink-50); }
.g3exp a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-deep); font-weight: 600; text-underline-offset: 3px; }

/* ── the wide tables (fórmulas, códigos amigo): a real table on a desktop; each row a card on a phone ── */
.g3tabx { width: 100%; border-collapse: collapse; font-size: 15px; }
.g3tabx thead th { padding: 0 14px 10px 0; font: 500 12px/1.3 var(--font-doc); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-50); text-align: left; vertical-align: bottom; }
.g3tabx td, .g3tabx tbody th { padding: 16px 14px 16px 0; border-top: 1px solid var(--tint-20); vertical-align: top; text-align: left; line-height: 1.45; }
.g3tabx tbody th { font-weight: 600; color: var(--ink-deep); }
.g3tabx tbody th small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-50); }
.g3tabx .g3tab__n { width: 2.6em; font: 500 13px/1.45 var(--font-doc); color: var(--ink-50); }
.g3tabx .g3tabx__v { text-align: right; white-space: nowrap; font: 600 15px/1.45 var(--font-doc); color: var(--ink-deep); }
.g3tabx thead .g3tabx__v { text-align: right; }
.g3b .ep-conf { display: block; font: 400 12px/1.3 var(--font-doc); color: var(--ink-50); }
.g3tabx--f td:nth-child(3) { display: grid; gap: 12px; }
.g3b .ep-ofertas { color: var(--ink); }
.g3b .ep-f { display: grid; gap: 4px; padding-left: 12px; border-left: 2px solid var(--tint-20); color: var(--ink-60); }
.g3b .ep-f__p { font-weight: 600; color: var(--ink-deep); }
.g3b .ep-f__e { font: 400 13px/1.45 var(--font-doc); color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.g3b .ep-f__c { font-size: 13px; overflow-wrap: anywhere; }
.g3b .ep-ficha { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-deep); font-weight: 600; text-underline-offset: 3px; }

@media (max-width: 760px) {
  .g3b .ep-ev { grid-template-columns: 1fr; padding: 20px 0; }
  .g3b .ep-letra { grid-template-columns: 1fr; gap: 10px; }
  .g3b .ep-letra__l { font-size: 32px; }
  .g3b .ep-filtros { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * clamp(18px, 4vw, 40px)); padding: 0 clamp(18px, 4vw, 40px); }
  .g3b .ep-filtros button { flex: none; }
  .g3tabx thead { display: none; }
  .g3tabx, .g3tabx tbody, .g3tabx tr { display: block; }
  .g3tabx tr { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: 6px 10px; padding: 16px 0; border-top: 1px solid var(--tint-20); }
  .g3tabx td, .g3tabx tbody th { display: block; padding: 0; border: 0; }
  .g3tabx td:not(.g3tab__n) { grid-column: 2; }
  .g3tabx td[data-l]::before { content: attr(data-l); display: block; margin-bottom: 2px; font: 500 11.5px/1.3 var(--font-doc); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-50); }
  .g3tabx .g3tabx__v { text-align: left; white-space: normal; }
  .g3tabx--a tr { grid-template-columns: 2.4em repeat(4, minmax(0, 1fr)); }
  .g3tabx--a tbody th, .g3tabx--a td:nth-of-type(2) { grid-column: 2 / -1; }
  .g3tabx--a td.g3tabx__v { grid-column: auto; }
  .g3tabx--a td.g3tabx__v:nth-of-type(3) { grid-column: 2; }
}
