/* eCircuitCalc — E-Series page (reuses base.css tokens) */

/* Reading progress */
.rprog{position:fixed;top:0;left:0;right:0;height:3px;z-index:120;pointer-events:none}
.rprog span{display:block;height:100%;width:0;background:var(--grad);transition:width .1s linear}

/* Article shell */
.article{min-height:60vh}
.article{padding-bottom:3rem}
.prose{width:min(1180px,92%);margin:0 auto;display:grid;gap:clamp(2.4rem,5vw,3.6rem);padding:2rem 0}
.prose section{scroll-margin-top:90px}
.prose h2{font-size:clamp(1.4rem,3vw,1.9rem);font-weight:800;letter-spacing:-.02em;margin-bottom:.9rem}
.prose h3{font-size:1.08rem;margin:1.4rem 0 .5rem}
.prose p{color:var(--text2);margin-bottom:.9rem;line-height:1.7}
.prose li{color:var(--text2);margin:.4rem 0 0 1.1rem;list-style:disc}
.prose ol li{list-style:decimal}
.muted{color:var(--text2);font-size:.92rem}

/* TOC */
.toc{padding:1.4rem 0;border-block:1px solid var(--border);background:var(--bg2)}
.toc .container{display:flex;gap:1.5rem;align-items:baseline;flex-wrap:wrap}
.toc strong{font-family:var(--mono);font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;color:var(--accent)}
.toc ol{display:flex;flex-wrap:wrap;gap:.35rem .9rem;list-style:none;margin:0;padding:0;counter-reset:t}
.toc li{counter-increment:t}
.toc a{color:var(--text2);font-size:.86rem}
.toc a::before{content:counter(t) ".";color:var(--accent);margin-right:.3rem;font-family:var(--mono)}
.toc a:hover{color:var(--accent)}

/* Callouts */
.callout{border:1px solid var(--border);border-left:3px solid var(--accent);background:var(--surface);
  border-radius:0 12px 12px 0;padding:1rem 1.2rem;margin:1.2rem 0}
.callout p{margin:0}.callout p:not(:last-child){margin-bottom:.6rem}
.callout ul{margin:0 0 0 1.1rem}
.callout.warn{border-left-color:#fbbf24}

/* Figure + circuit SVG */
.fig{margin:1.6rem 0;padding:1.2rem;border-radius:16px;background:var(--bg2);border:1px solid var(--border)}
.fig-svg{width:100%;height:auto;max-width:420px;margin:0 auto;display:block}
.fig figcaption{margin-top:1rem;font-size:.9rem;color:var(--text2);line-height:1.6}
.fig figcaption code{font-family:var(--mono);background:var(--surface2);border:1px solid var(--border);
  padding:.1em .35em;border-radius:5px;font-size:.85em}
.v-wire{fill:none;stroke:var(--wbase);stroke-width:2.4;stroke-linecap:round}
.v-comp{fill:none;stroke:var(--cw);stroke-width:2.6;stroke-linecap:round}
.v-comp.thick{stroke-width:5}
.v-lbl{fill:var(--text);font-family:var(--mono);font-size:14px;font-weight:600}
.v-lbl.sm{font-size:11px;fill:var(--text2);font-weight:400}
.v-node{fill:var(--cw)}
.v-body{fill:#d9c194;stroke:var(--border2);stroke-width:1.4}
.v-meter{fill:var(--surface);stroke:var(--accent);stroke-width:2}
.v-flow{fill:none;stroke:var(--accent);stroke-width:3;stroke-linecap:round;stroke-dasharray:9 14;
  animation:vesflow 1s linear infinite;filter:drop-shadow(0 0 4px var(--glow))}
@keyframes vesflow{to{stroke-dashoffset:-23}}

/* Tables */
.table-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:14px;background:var(--surface);margin:1.2rem 0}
table{width:100%;border-collapse:collapse}
.cmp-table{min-width:480px}
.cmp-table.small{min-width:320px}
.cmp-table caption,.es-table caption{caption-side:top;text-align:left;padding:.9rem 1.1rem .3rem;
  font-family:var(--mono);font-size:.7rem;letter-spacing:.08em;text-transform:uppercase;color:var(--text2)}
.cmp-table th,.cmp-table td,.es-table th,.es-table td{padding:.7rem 1rem;text-align:left;border-bottom:1px solid var(--border);font-size:.92rem}
.cmp-table th,.es-table th{font-family:var(--mono);font-size:.7rem;letter-spacing:.08em;text-transform:uppercase;color:var(--text2);background:var(--surface2)}
.cmp-table tbody tr:last-child td,.es-table tbody tr:last-child td{border-bottom:0}
.cmp-table .num,.es-table td{text-align:center}
.cmp-table th.num{text-align:center}

/* E-series value tables */
.es-table{min-width:440px}
.es-table td{font-family:var(--mono);text-align:center;font-size:.92rem}
.es-table thead th{text-align:center}
.es-table td.hl-e6{background:rgba(34,211,238,.14)}
.es-table td.hl-e12{background:rgba(59,130,246,.12)}
.es-table .ev{display:block}
.es-table .ec{display:block;font-size:.65rem;color:var(--text2);margin-top:2px}
.hl-key{display:inline-block;width:11px;height:11px;border-radius:3px;vertical-align:-1px;margin-right:.15rem}
.hl-key.hl-e6{background:rgba(34,211,238,.5)}
.hl-key.hl-e12{background:rgba(59,130,246,.45)}

/* Formula */
.formula{margin:1.2rem 0;padding:1rem 1.2rem;border-radius:12px;background:var(--bg2);border:1px solid var(--border);
  overflow-x:auto;font-family:var(--mono);font-size:1rem;color:var(--text)}
.formula.big{font-size:clamp(1.2rem,4vw,1.7rem);text-align:center;font-weight:600}

/* Comparison visual */
.viz{margin:1.4rem 0;padding:1.2rem;border-radius:16px;background:var(--bg2);border:1px solid var(--border)}
.viz-svg{width:100%;height:auto;max-width:680px;margin:0 auto;display:block}
.viz-legend{display:flex;gap:1.3rem;flex-wrap:wrap;justify-content:center;margin-top:1rem;list-style:none;padding:0;margin-top:1.1rem}
.viz-legend li{display:flex;align-items:center;gap:.45rem;font-size:.85rem;color:var(--text2)}
.viz-legend .dot{width:12px;height:12px;border-radius:50%;flex:none}
.dot.e6{background:var(--accent)}.dot.e12{background:var(--accent2)}
.dot.e24{background:var(--accent3)}.dot.e96{background:var(--text2)}
.cmp-baseline{stroke:var(--border2);stroke-width:2}
.cmp-axis{fill:var(--text2);font-family:var(--mono);font-size:12px}
.cmp.e6{fill:var(--accent)}.cmp.e12{fill:var(--accent2)}.cmp.e24{fill:var(--accent3)}.cmp.e96{fill:var(--text2);opacity:.55}

/* Nearest-value tool */
.est{padding:1.4rem;border-radius:16px}
.est-controls{display:grid;grid-template-columns:1fr auto;gap:1rem;align-items:end}
.est label{display:flex;flex-direction:column;gap:.45rem;font-size:.85rem;font-weight:600}
.inline-units{display:flex;gap:.45rem}
.est input,.est select{padding:.6rem .8rem;border-radius:10px;border:1px solid var(--border2);background:var(--bg);color:var(--text);font:inherit}
.est input:focus,.est select:focus{outline:0;border-color:var(--accent);box-shadow:0 0 0 3px var(--glow)}
.seg{display:inline-flex;background:var(--surface2);border:1px solid var(--border);border-radius:11px;padding:3px;gap:3px}
.seg-btn{padding:.5rem .95rem;border-radius:8px;font-size:.9rem;font-weight:600;color:var(--text2);transition:.2s}
.seg-btn:hover{color:var(--text)}
.seg-btn.active{background:var(--grad);color:#fff}
.est-out{margin-top:1.3rem;display:grid;gap:.8rem}
.est-hero{display:flex;align-items:baseline;gap:.7rem;flex-wrap:wrap}
.est-hero .val{font-size:clamp(1.7rem,6vw,2.6rem);font-weight:800;font-family:var(--mono);
  background:var(--grad);-webkit-background-clip:text;background-clip:text;color:transparent}
.est-hero .sub{color:var(--text2);font-size:.95rem}
.est-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.7rem}
.est-cell{background:var(--bg2);border:1px solid var(--border);border-radius:10px;padding:.7rem .9rem}
.est-cell span{display:block;font-family:var(--mono);font-size:.66rem;letter-spacing:.08em;text-transform:uppercase;color:var(--text2);margin-bottom:.25rem}
.est-cell b{font-family:var(--mono);font-size:1.05rem}
.est-note{font-size:.86rem;color:var(--text2);line-height:1.6}

/* Quick reference cards */
.cheat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem;margin:1.2rem 0}
.cheat-grid .card{padding:1.1rem 1.2rem}
.cheat-grid h3{font-size:1rem;margin-bottom:.35rem}
.cheat-grid p{font-size:.85rem;color:var(--text2);margin:0}

/* FAQ (scoped to this page) */
.faq{display:grid;gap:.7rem;margin:1rem 0}
.faq-item{background:var(--surface);border:1px solid var(--border);border-radius:12px;overflow:hidden;transition:border-color .3s}
.faq-item.open{border-color:var(--accent)}
.faq-q{width:100%;display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:1rem 1.2rem;font-weight:600;font-size:.98rem;text-align:left}
.faq-x{position:relative;width:14px;height:14px;flex:none}
.faq-x::before,.faq-x::after{content:"";position:absolute;background:var(--accent);border-radius:2px;top:50%;left:50%;transition:transform .3s var(--ease)}
.faq-x::before{width:12px;height:2px;transform:translate(-50%,-50%)}
.faq-x::after{width:2px;height:12px;transform:translate(-50%,-50%)}
.faq-item.open .faq-x::after{transform:translate(-50%,-50%) rotate(90deg) scaleY(0)}
.faq-a{display:grid;grid-template-rows:0fr;transition:grid-template-rows .4s var(--ease)}
.faq-item.open .faq-a{grid-template-rows:1fr}
.faq-a>div{overflow:hidden}
.faq-a p{padding:0 1.2rem 1.1rem;color:var(--text2);margin:0}

/* Ad slot (auto-hides when empty) */
.ad-slot{max-width:728px;margin:1rem auto;text-align:center;transition:max-height .5s var(--ease),opacity .4s,margin .5s;max-height:160px;overflow:hidden}
.ad-slot.ad-hidden{max-height:0;opacity:0;margin:0}
.ad-label{display:block;font-family:var(--mono);font-size:.6rem;letter-spacing:.2em;text-transform:uppercase;color:var(--text2);opacity:.6;margin-bottom:.4rem}
.ad-box{min-height:90px;border:1.5px dashed var(--border2);border-radius:12px;display:grid;place-items:center;color:var(--text2);font-size:.85rem;background:var(--surface)}

/* Reduced motion */
@media (prefers-reduced-motion:reduce){
  .rprog,.est-out,.viz{transition:none}
  .v-flow{animation:none;opacity:.5}
  .faq-a{transition:none}
}

/* Responsive */
@media (max-width:640px){
  .est-controls{grid-template-columns:1fr}
  .es-e96 td{font-size:.82rem;padding:.5rem .45rem}
}
