/* ElecNora (public site only) — the learn page's left rail and the full-width lesson sheet (elec/learn-rail.js). */
body.has-rail { --er-w: 64px; --er-top: 66px; --er-ease: 0.25s cubic-bezier(0.3, 0.7, 0.4, 1); }
body.has-rail[data-rail="wide"] { --er-w: 256px; }
body.has-rail[data-rail="hidden"] { --er-w: 0px; }

/* the site header spans the screen; ☰ sits before the logo */
body.has-rail #site-header .site-nav { max-width: none; padding-inline: 12px 20px; }
.er-burger { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-right: 6px; border: 0; border-radius: 12px; background: none; color: var(--text); cursor: pointer; }
.er-burger:hover, .er-burger:focus-visible { background: color-mix(in srgb, var(--text) 8%, transparent); }

/* the intro block goes; the lesson fills the room right of the rail */
body.has-rail .page-intro { display: none; }
body.has-rail main.container, body.has-rail .course-circuits { width: auto; max-width: none; margin: 0 20px 0 calc(var(--er-w) + 16px); padding-inline: 0; transition: margin-left var(--er-ease); }
body.has-rail main.container.section { padding-top: 16px; }
body.has-rail #site-footer { margin-left: var(--er-w); transition: margin-left var(--er-ease); }
body.has-rail .elec-learn { display: block; }
/* one large sheet holds the lesson */
body.has-rail .elec-learn > .elec-main { padding: 18px 24px 24px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 10px 30px -22px rgba(0, 0, 0, 0.45); }
body.has-rail .elec-learn > .elec-main .card { box-shadow: none; }
/* long text stays readable on a wide screen */
body.has-rail .elec-main .elec-text, body.has-rail .elec-main .lr-card > p, body.has-rail .elec-main .lr-q { max-width: 900px; }
/* the deck bar («now … · pick a card») is the sheet's slim top row */
body.has-rail .elec-main > #deckBar { position: sticky; top: var(--er-top); z-index: 8; margin: -18px -24px 12px; padding: 8px 24px; border-radius: 18px 18px 0 0; background: var(--surface); }
body.has-rail .elec-main > #deckBar .dk-bar { margin: 0; box-shadow: none; }

/* ---------- the rail ---------- */
.er-rail { position: fixed; z-index: 40; top: var(--er-top); bottom: 0; left: 0; display: flex; flex-direction: column; width: var(--er-w); padding: 10px 8px; overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: thin; transition: width var(--er-ease), transform var(--er-ease), background-color var(--er-ease); }
.er-rail.is-wide { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); border-right: 1px solid var(--border); }
body[data-rail="hidden"] .er-rail { transform: translateX(-100%); }
.er-tools { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 8px; }
.er-rail.is-wide .er-tools { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; }
.er-sep { width: 24px; height: 1px; margin: 4px 0; background: var(--border); }
.er-rail.is-wide .er-sep { width: 1px; height: 24px; margin: 0 4px; }
.er-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--muted); cursor: pointer; }
.er-btn:hover, .er-btn:focus-visible { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.er-btn.is-on { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); }
.er-find { padding: 0 2px 8px; }
.er-find input { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }
.er-list { flex: 1 0 auto; }
.er-foot { padding-top: 8px; }
.er-rail:not(.is-wide) .er-foot, .er-rail:not(.is-wide) .er-find { display: none; }
.er-foot .notice, .er-foot > div > * { margin: 0; font-size: 0.8rem; }

/* the list inside the rail: flat rows, not cards */
.er-rail .elec-lessons { position: static; display: flex; flex-direction: column; gap: 2px; max-height: none; overflow: visible; padding: 0; }
.er-rail .elec-viewtabs { display: none; }
.er-rail .elec-lesson { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; margin: 0; padding: 6px 8px; border: 0; border-radius: 10px; background: none; box-shadow: none; color: var(--text); text-align: left; }
.er-rail .elec-lesson:hover, .er-rail .elec-lesson:focus-visible { background: color-mix(in srgb, var(--text) 7%, transparent); }
.er-rail .elec-lesson.is-active { background: color-mix(in srgb, var(--primary) 16%, transparent); box-shadow: inset 3px 0 0 var(--primary); }
.er-rail .elec-lesson > b { position: relative; display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--text) 8%, transparent); font-size: 0.8rem; }
.er-rail .elec-lesson.is-active > b { background: var(--primary); color: #fff; }
.er-rail .elec-lesson > span { min-width: 0; font-size: 0.88rem; line-height: 1.25; }
.er-rail .elec-level-head { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 0 8px; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.er-rail .elec-level-head > b { display: grid; place-items: center; flex: none; width: 28px; height: 20px; border-radius: 6px; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
/* narrow: numbers only, the name on hover; a small dot marks a finished one */
.er-rail:not(.is-wide) .elec-lesson { justify-content: center; padding: 6px 0; }
.er-rail:not(.is-wide) .elec-lesson > span, .er-rail:not(.is-wide) .elec-level-head > span { display: none; }
.er-rail:not(.is-wide) .elec-level-head { justify-content: center; padding: 0; }
.er-rail:not(.is-wide) .elec-lesson.is-done > b::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border: 2px solid var(--bg); border-radius: 50%; background: #2c9a5c; }

/* «›» brings a hidden rail back */
.er-show { position: fixed; z-index: 41; top: 50%; left: 0; display: none; place-items: center; width: 28px; height: 56px; border: 1px solid var(--border); border-left: 0; border-radius: 0 12px 12px 0; background: var(--surface); color: var(--text); cursor: pointer; }
body[data-rail="hidden"] .er-show { display: grid; }
.er-scrim { display: none; }

/* phones and tablets: the rail is a drawer from the left, opened by ☰ */
@media (max-width: 1024px) {
  body.has-rail { --er-w: 0px; }
  body.has-rail main.container, body.has-rail .course-circuits { margin: 0 12px; }
  body.has-rail .elec-learn > .elec-main { padding: 14px 12px 18px; border-radius: 14px; }
  body.has-rail .elec-main > #deckBar { margin: -14px -12px 10px; padding: 6px 12px; }
  .er-rail { width: min(300px, 86vw); transform: translateX(-100%); box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); }
  body.er-open .er-rail { transform: none; }
  body[data-rail] .er-show { display: none; }
  .er-scrim { position: fixed; z-index: 39; inset: var(--er-top) 0 0; display: block; background: rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; transition: opacity var(--er-ease); }
  body.er-open .er-scrim { opacity: 1; pointer-events: auto; }
  body.has-rail .er-rail .elec-lessons { display: flex; }   /* deck.css hid the old list on phones */
}
@media (prefers-reduced-motion: reduce) { .er-rail, .er-scrim, body.has-rail main.container, body.has-rail #site-footer { transition: none; } }
:root[data-gfx="low"] .er-rail, :root[data-gfx="low"] body.has-rail main.container { transition: none; }
@media (max-width: 640px) { .er-rail { padding-bottom: 84px; } }   /* clear of the phone's bottom bar */
