/* eCircuitCalc — Schematic Symbols library (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{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:.94rem}
ul.tick li{list-style:none;position:relative;padding-left:1.5rem}
ul.tick li::before{content:"✓";position:absolute;left:0;color:var(--accent);font-weight:700}

/* 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 ul{margin:0 0 0 1.1rem}

/* Figure + animated circuit */
.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:540px;margin:0 auto;display:block}
.fig figcaption{margin-top:1rem;font-size:.9rem;color:var(--text2);line-height:1.6}
.sc-wire{fill:none;stroke:var(--wbase);stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.sc-comp{fill:none;stroke:var(--cw);stroke-width:2.4;stroke-linecap:round}
.sc-lbl{fill:var(--text);font-family:var(--mono);font-size:14px;font-weight:600}
.sc-lbl.sm{font-size:11px;fill:var(--text2);font-weight:400}
.sc-node{fill:var(--cw)}
.sc-body{fill:#d9c194;stroke:var(--border2);stroke-width:1.4}
.sc-diode{fill:currentColor;stroke:var(--cw);stroke-width:1.6}
.sc-wave{fill:none;stroke:var(--accent2);stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:160;stroke-dashoffset:160;animation:scwave 3s linear infinite}
@keyframes scwave{0%{stroke-dashoffset:160}55%{stroke-dashoffset:0}100%{stroke-dashoffset:-160}}
.sc-flow{fill:none;stroke:var(--accent);stroke-width:2.6;stroke-linecap:round;stroke-dasharray:6 10;
  animation:scflow .9s linear infinite;filter:drop-shadow(0 0 4px var(--glow))}
@keyframes scflow{to{stroke-dashoffset:-16}}
.sc-contact{stroke:var(--cw);stroke-width:3;stroke-linecap:round;transform-origin:400px 120px;
  animation:sccontact 2.4s steps(1) infinite}
@keyframes sccontact{0%,55%{transform:rotate(-38deg)}56%,100%{transform:rotate(0deg)}}
.sc-lamp{fill:var(--surface);stroke:var(--cw);stroke-width:2;animation:sclamp 2.4s steps(1) infinite}
@keyframes sclamp{0%,55%{fill:var(--surface)}56%,100%{fill:rgba(251,191,36,.35);stroke:#fbbf24}}

/* 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:460px}
.cmp-table.small{min-width:320px}
.cmp-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{padding:.7rem 1rem;text-align:left;border-bottom:1px solid var(--border);font-size:.92rem}
.cmp-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{border-bottom:0}
.symc{width:120px}
.symc .sym{width:100%;height:auto}

/* Symbol SVG base (all symbol renders) */
.sym{display:block;width:100%;height:auto;fill:none;stroke:var(--text);stroke-width:2.2;
  stroke-linecap:round;stroke-linejoin:round}
.sym text{fill:var(--text);stroke:none;font-family:var(--mono);font-weight:600}
.sym .f{fill:currentColor;stroke:none}
.sym .ff{fill:currentColor;stroke:currentColor}

/* Reference table */
.symref{min-width:560px}
.symref 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)}
.symref th,.symref td{padding:.6rem .8rem;text-align:left;border-bottom:1px solid var(--border);font-size:.9rem;vertical-align:middle}
.symref th{font-family:var(--mono);font-size:.68rem;letter-spacing:.08em;text-transform:uppercase;color:var(--text2);background:var(--surface2);position:sticky;top:0}
.symref tbody tr:last-child td{border-bottom:0}
.symref td.s{width:110px}
.symref .sym{width:100%;height:auto}
.symref .same{color:var(--text2);font-size:.72rem;font-family:var(--mono)}

/* Library controls */
.lib-head{max-width:720px;margin-bottom:1.4rem}
.lib-head h2{font-size:clamp(1.4rem,3vw,2rem);font-weight:800;letter-spacing:-.02em;margin-bottom:.5rem}
.lib-controls{display:flex;flex-wrap:wrap;gap:.8rem;align-items:end;margin-bottom:.8rem}
.searchbox{flex:1 1 260px;display:flex;align-items:center;gap:.6rem;padding:.7rem .9rem;border-radius:12px;
  border:1px solid var(--border2);background:var(--surface)}
.searchbox svg{color:var(--text2);flex:none}
.searchbox input{flex:1;border:0;background:none;outline:0;color:var(--text);font:inherit}
.catbox{display:flex;flex-direction:column;gap:.35rem;font-size:.78rem;font-weight:600;color:var(--text2)}
.catbox select{padding:.65rem .8rem;border-radius:10px;border:1px solid var(--border2);background:var(--bg);color:var(--text);font:inherit}
.catbox select:focus,.searchbox:focus-within{outline:0;border-color:var(--accent);box-shadow:0 0 0 3px var(--glow)}
.catbox select:focus{outline:0}
.seg{display:inline-flex;background:var(--surface2);border:1px solid var(--border);border-radius:11px;padding:3px;gap:3px}
.seg-btn{padding:.55rem .95rem;border-radius:8px;font-size:.88rem;font-weight:600;color:var(--text2);transition:.2s}
.seg-btn:hover{color:var(--text)}
.seg-btn.active{background:var(--grad);color:#fff}
.lib-count{font-family:var(--mono);font-size:.8rem;color:var(--text2);margin:.4rem 0 1rem}
.empty{color:var(--text2);padding:2rem;text-align:center}

/* Symbol grid */
.sym-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:1rem}
.sym-card{display:flex;flex-direction:column;gap:.55rem;text-align:left;padding:.9rem;border-radius:14px;
  background:var(--surface);border:1px solid var(--border);transition:transform .25s var(--ease),border-color .25s,box-shadow .25s}
.sym-card:hover{transform:translateY(-4px);border-color:var(--accent);box-shadow:var(--shadow)}
.sym-card.hide{display:none}
.sym-thumb{background:var(--bg2);border:1px solid var(--border);border-radius:10px;padding:.7rem .8rem;height:64px;
  display:grid;place-items:center}
.sym-thumb .sym{width:100%;max-width:150px;height:auto}
.sym-thumb.dual{gap:.4rem;display:flex}
.sym-thumb.dual .sym{width:48%}
.sym-name{font-size:.95rem;font-weight:600;line-height:1.3}
.sym-meta{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.sym-des{font-family:var(--mono);font-size:.72rem;background:var(--surface2);border:1px solid var(--border);
  border-radius:6px;padding:.12rem .45rem;color:var(--accent)}
.sym-cat{font-family:var(--mono);font-size:.66rem;color:var(--text2);text-transform:uppercase;letter-spacing:.06em}
.sym-diff{font-family:var(--mono);font-size:.62rem;color:#fbbf24}

/* Modal */
.modal{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;padding:5%;
  background:rgba(4,8,16,.62);backdrop-filter:blur(8px);opacity:0;pointer-events:none;transition:opacity .28s}
.modal.open{opacity:1;pointer-events:auto}
.modal-panel{position:relative;width:min(680px,100%);max-height:88vh;overflow:auto;background:var(--bg);
  border:1px solid var(--border2);border-radius:18px;box-shadow:var(--shadow);transform:translateY(12px) scale(.98);transition:transform .28s var(--ease)}
.modal.open .modal-panel{transform:none}
.modal-close{position:absolute;top:.7rem;right:.7rem;width:36px;height:36px;border-radius:10px;font-size:1.6rem;
  line-height:1;color:var(--text2);background:var(--surface2);border:1px solid var(--border);z-index:2}
.modal-close:hover{color:var(--text);border-color:var(--accent)}
.modal-body{padding:1.6rem}
.mb-head{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;padding-right:2rem}
.mb-head h3{font-size:1.3rem;margin-bottom:.35rem}
.mb-syms{display:flex;gap:1rem;flex-wrap:wrap;margin:1.1rem 0}
.mb-sym{flex:1 1 200px;background:var(--bg2);border:1px solid var(--border);border-radius:12px;padding:1rem}
.mb-sym .cap{font-family:var(--mono);font-size:.68rem;letter-spacing:.1em;text-transform:uppercase;color:var(--text2);margin-bottom:.6rem}
.mb-sym .sym{width:100%;max-width:200px;height:auto}
.mb-info{display:grid;gap:.9rem}
.mb-row h4{font-size:.72rem;font-family:var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--accent);margin-bottom:.25rem}
.mb-row p{margin:0;color:var(--text2);line-height:1.6;font-size:.95rem}
.mb-actions{display:flex;gap:.6rem;flex-wrap:wrap;margin-top:1.2rem}
.mb-actions .btn{padding:.6rem 1rem;font-size:.85rem}

/* Ad slot (auto-hides when empty) */
.ad-slot{max-width:728px;margin:1.5rem 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{transition:none}
  .sc-wave,.sc-flow,.sc-contact,.sc-lamp{animation:none}
  .sc-wave{stroke-dasharray:none;stroke-dashoffset:0}
  .sc-contact{transform:none}
  .modal,.modal-panel,.sym-card{transition:none}
}

/* Responsive */
@media (max-width:640px){
  .sym-grid{grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
  .sym-thumb{height:56px}
  .lib-controls{gap:.6rem}
  .catbox{flex:1 1 45%}
}
