/* E27 LED-lamppujen sähkönlaatu -artikkeli: kaaviot, tulostaulukot ja kuvaruudukot. */
.site-header h1 { overflow-wrap: anywhere; hyphens: auto; }
.e27-article { max-width: 940px !important; }
.e27-article h2 { scroll-margin-top: 24px; }
.e27-article figure img { display: block; width: 100%; height: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.d-block { display: block; }
.note { color: var(--muted); }
.e27-article .lead-p { font-size: 1.12rem; }

/* Lyhyesti- ja sisällyslaatikot */
.keyfacts { margin: 28px 0; padding: 24px 28px; border: 1px solid var(--line); border-left: 4px solid var(--color-copper); border-radius: var(--radius); background: var(--accent-soft); }
.keyfacts h2 { margin: 0 0 12px !important; font-size: 1.3rem !important; }
.keyfacts ul { margin: 0; padding-left: 20px; }
.keyfacts li { margin: 8px 0; line-height: 1.6; }
.toc { margin: 28px 0; padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.toc-title { margin: 0 0 8px !important; font-weight: 650; }
.toc ol { margin: 0; padding-left: 22px; columns: 2 18rem; column-gap: 32px; }
.toc li { margin: 4px 0; break-inside: avoid; }
.toc a { font-weight: 500 !important; }
.callout { padding: 16px 20px; border-left: 4px solid var(--primary); background: var(--surface-soft); border-radius: var(--radius); }
.chain { padding: 14px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); font-weight: 600; text-align: center; }

/* Tilamerkit (aina kuvake + teksti, ei pelkkä väri) */
.st { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 650; white-space: nowrap; }
.st-ok { color: #18794e; }
.st-bad { color: #b42318; }
.st-na { color: var(--muted); }

/* Taulukot: otsikko vierityskehyksen yläpuolella, solut rivittyvät lukupalstan levyisiksi. */
.table-title { margin: 28px 0 -14px !important; font-size: .95rem !important; font-weight: 650; line-height: 1.45 !important; color: var(--text); }
.e27-article details .table-title { margin: 14px 18px 8px !important; }
.e27-article .table-scroll table { min-width: 0; }
.e27-article td { white-space: nowrap; }
.e27-article thead th { vertical-align: bottom; }
.e27-article tbody th[scope="row"] { white-space: normal; min-width: 10rem; font-weight: 600; background: var(--surface); box-shadow: inset -1px 0 0 var(--line); }
.e27-article tr:last-child th, .e27-article tr:last-child td { border-bottom: 0; }
.e27-article tr.ref th, .e27-article tr.ref td { color: var(--muted); font-style: italic; }
.e27-article tbody.sub th[scope="rowgroup"] { background: var(--surface-soft); font-weight: 600; font-size: .85rem; color: var(--muted); }
.e27-article tbody.sub td, .e27-article tbody.sub th[scope="row"] { color: var(--muted); }
.e27-article table.compliance td { white-space: normal; min-width: 7.5rem; font-size: .84rem; line-height: 1.5; padding: 12px 10px; }
.e27-article table.compliance th[scope="row"] { min-width: 9.5rem; padding: 12px 10px; }
.e27-article table.limits td { white-space: normal; min-width: 0; font-size: .9rem; }
.e27-article table.limits th[scope="row"] { min-width: 0; width: 3rem; text-align: center; }
.c-bad { background: #fdeceb; color: #8f1d17; font-weight: 600; }
.c-bad small, .c-would small { display: block; font-weight: 500; }
.c-would { color: #9a4a43 !important; }
.c-skip { color: #6b7785; font-style: italic; }
.c-ok { color: var(--text); }
.e27-article details { margin: 18px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.e27-article summary { padding: 14px 18px; font-weight: 650; }
.e27-article details[open] summary { border-bottom: 1px solid var(--line); }
.e27-article details .table-scroll { margin: 0; border: 0; border-radius: 0; }
.e27-article details .note { padding: 0 18px 12px; margin: 10px 0 0; }

/* Kaaviot */
.viz { margin: 30px 0; padding: 22px 22px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.viz-title { margin: 0 0 12px !important; color: var(--text) !important; font-size: 1rem !important; font-weight: 650; }
.viz-note { margin: 12px 0 0 !important; color: var(--muted) !important; font-size: .86rem !important; line-height: 1.6 !important; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 0; list-style: none; color: var(--muted); font-size: .82rem; }
.viz-legend li { display: inline-flex; align-items: center; gap: 7px; }
.key { display: inline-block; flex-shrink: 0; width: 14px; height: 10px; border-radius: 2px; }
.key-ok { background: #18794e; } .key-bad { background: #d03b3b; } .key-na { background: #b3bec8; }
.key-ref { width: 2px; height: 14px; border-radius: 0; background: #c77b3f; }
.key-line { width: 18px; height: 2px; background: #0f2a44; } .key-volt { width: 18px; height: 2px; background: #8a96a3; }
.key-dot-ok, .key-dot-bad { width: 10px; height: 10px; border-radius: 50%; } .key-dot-ok { background: #18794e; } .key-dot-bad { background: #d03b3b; }
.key-phase { background: #c77b3f; } .key-neutral { background: #1f5f9e; }
.wave-svg { display: block; width: 100%; height: auto; overflow: visible; }
.wave-svg text { font-family: inherit; }

/* Vaakapalkit (THD) */
.hbar-list, .gbar-list { margin: 0; padding: 0; list-style: none; }
.hbar-row, .hbar-axis { display: grid; grid-template-columns: minmax(9rem, 16rem) minmax(0, 1fr) 6.2rem; align-items: center; gap: 12px; }
.hbar-row { padding: 3px 0; border-radius: 4px; }
.hbar-row:hover, .gbar-row:hover { background: var(--surface-soft); }
.hbar-label { font-size: .84rem; line-height: 1.3; color: var(--text); }
.hbar-track { position: relative; height: 14px; }
.hbar-track::before { content: ""; position: absolute; left: 0; top: -3px; bottom: -3px; width: 1px; background: #c3ccd4; }
.hbar-track::after { content: ""; position: absolute; left: var(--ref); top: -5px; bottom: -5px; width: 2px; background: #c77b3f; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.hbar-ok { background: #18794e; } .hbar-bad { background: #d03b3b; } .hbar-na { background: #b3bec8; }
.hbar-value { font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.hbar-axis { margin-top: 6px; }
.hbar-ticks { position: relative; height: 18px; color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.hbar-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.hbar-ticks span:first-child { transform: none; }

/* Ryhmitellyt palkit (vaihevirta / nollajohdin) */
.gbar-row { display: grid; grid-template-columns: minmax(9rem, 16rem) minmax(0, 1fr); align-items: center; gap: 12px; padding: 6px 0; border-top: 1px solid #eef1f3; }
.gbar-row:first-child { border-top: 0; }
.gbar { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.gbar-fill { display: block; height: 12px; border-radius: 0 4px 4px 0; }
.gbar-phase { background: #c77b3f; } .gbar-neutral { background: #1f5f9e; }
.gbar-val { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }

/* Aaltomuotopaneelit */
.wave-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.wave-panel { margin: 0 !important; padding: 10px 12px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.wave-panel figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; margin: 0 0 6px !important; color: var(--text); font-size: .86rem; line-height: 1.35; }
.wave-panel .st { font-size: .76rem; }
.wave-meta { margin: 4px 0 0 !important; color: var(--muted); font-size: .8rem !important; line-height: 1.45 !important; font-variant-numeric: tabular-nums; }
.wave-meta .m-bad { color: #b42318; font-weight: 650; }

/* Kuvat */
.photo-pair, .shot-grid, .shot-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.photo-pair figure, .shot-grid figure, .shot-pair figure { margin: 0 !important; }
@media (min-width: 761px) { .photo-pair.photo-pair-mixed { grid-template-columns: 16fr 9fr; } }
.shot-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shot figcaption { font-size: .82rem; line-height: 1.5; }

@media (max-width: 760px) {
  .wave-grid, .photo-pair, .shot-grid, .shot-pair, .shot-grid.three { grid-template-columns: minmax(0, 1fr); }
  .viz { padding: 16px 14px 12px; }
  .keyfacts { padding: 18px 18px; }
  .e27-article .table-scroll table { min-width: 620px; }
  .e27-article .table-scroll table.compliance { min-width: 760px; }
  .e27-article .table-scroll table.limits { min-width: 0; }
}
@media (max-width: 640px) {
  .hbar-row, .hbar-axis { grid-template-columns: minmax(0, 1fr) 5.6rem; gap: 2px 10px; }
  .hbar-row .hbar-label { grid-column: 1 / -1; }
  .hbar-axis .hbar-label, .hbar-axis .hbar-value { display: none; }
  .hbar-axis .hbar-ticks { grid-column: 1; }
  .gbar-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .toc ol { columns: 1; }
  .viz-scroll { overflow-x: auto; }
  .viz-scroll > .wave-svg { min-width: 560px; }
}
