/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #0a0d12;
  --bg-elev: #12171f;
  --bg-elev-2: #191f2a;
  --text: #edf1f7;
  --text-dim: #99a4b7;
  --text-faint: #67718a;
  --accent: #2dd4bf;
  --accent-ink: #04211d;
  --accent-2: #8b7bff;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --card-bg: rgba(255, 255, 255, 0.035);
  --danger: #f2545b;
  --ok: #34d399;
  --resistor-body: #e7d4a6;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg); color: var(--text); font-family: var(--sans);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility; overflow-x: clip; overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.08; letter-spacing: -0.02em; font-weight: 800; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 980px; margin-inline: auto; padding-inline: 1.25rem; }
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--accent); color: var(--accent-ink);
  z-index: 9999; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 1rem; }
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1.25rem; }
h3 { font-size: 1.1rem; margin-bottom: .4rem; }
.hero-sub { color: var(--text-dim); font-size: clamp(1rem, 2vw, 1.2rem); max-width: 52ch; }

/* =============================================================
   5. Components
   ============================================================= */

/* Header */
.site-header { padding-block: 1.1rem; }
.header-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; }
.brand-mark { color: var(--accent); display: inline-flex; }
.header-nav { display: flex; align-items: center; gap: 1.25rem; }
.header-nav a { color: var(--text-dim); font-weight: 600; font-size: .9rem; transition: color .2s var(--ease-out); }
.header-nav a:hover { color: var(--accent); }

/* Tier badges */
.tier-badge { display: inline-flex; align-items: center; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: .25rem .55rem; border-radius: 999px; }
.tier-badge--free { background: rgba(45, 212, 191, 0.14); color: var(--accent); }
.tier-badge--pro { background: rgba(139, 123, 255, 0.14); color: var(--accent-2); }

/* Tool card (shared shell) */
.tool-section { padding-block: .5rem 3rem; }
.tool-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.1rem, 3vw, 2rem); position: relative; }
@supports (backdrop-filter: blur(20px)) { .tool-card { backdrop-filter: blur(20px); } }
.noscript-note { background: rgba(242, 84, 91, 0.12); border: 1px solid rgba(242, 84, 91, 0.35); color: #ffb3b6; padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }

.tool-controls { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; margin-bottom: 1.5rem; }

.mode-switch { position: relative; display: inline-flex; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.mode-btn { position: relative; z-index: 1; padding: .55rem 1.1rem; font-weight: 700; font-size: .88rem; color: var(--text-dim); border-radius: 999px; transition: color .3s var(--ease-out); white-space: nowrap; }
.mode-btn.is-active { color: var(--accent-ink); }
.mode-thumb { position: absolute; top: 4px; left: 4px; bottom: 4px; width: calc(50% - 4px); background: var(--accent); border-radius: 999px; transition: transform .38s var(--ease-bounce); }
.mode-thumb.is-right { transform: translateX(100%); }

/* Page-level tool switch (distinct from .mode-switch used INSIDE a tool, to avoid selector collisions when both appear on one page) */
.tool-switch { position: relative; display: inline-flex; width: 100%; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin-bottom: 1.5rem; }
.tool-switch-btn { position: relative; z-index: 1; flex: 1 1 0; padding: .65rem 1rem; font-weight: 700; font-size: .92rem; color: var(--text-dim); border-radius: 999px; text-align: center; transition: color .3s var(--ease-out); }
.tool-switch-btn.is-active { color: var(--accent-ink); }
.tool-switch-thumb { position: absolute; top: 4px; left: 4px; bottom: 4px; width: calc(50% - 4px); background: var(--accent); border-radius: 999px; transition: transform .38s var(--ease-bounce); }
.tool-switch-thumb.is-right { transform: translateX(100%); }

.bands-switch { display: inline-flex; gap: .4rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.bands-btn { padding: .55rem 1rem; font-weight: 700; font-size: .85rem; color: var(--text-dim); border-radius: 999px; transition: background .25s var(--ease-out), color .25s var(--ease-out); }
.bands-btn.is-active { background: var(--bg-elev-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.bands-btn:hover:not(.is-active) { color: var(--text); }

/* Resistor SVG (shared with resistencias tool) */
.resistor-stage { padding-block: clamp(1.25rem, 4vw, 2.25rem); display: flex; justify-content: center; }
.resistor-svg { width: 100%; max-width: 460px; height: auto; overflow: visible; }
.resistor-svg .lead { stroke: #8f8f96; stroke-width: 5; stroke-linecap: round; }
.resistor-svg .body { fill: var(--resistor-body); filter: drop-shadow(0 10px 24px rgba(0,0,0,.35)); }
.resistor-svg .band { transition: fill .32s var(--ease-out), opacity .32s var(--ease-out); stroke: rgba(0,0,0,.18); stroke-width: 1; }
.resistor-svg .band--empty { fill: rgba(255,255,255,.06) !important; stroke-dasharray: 2 3; stroke: rgba(255,255,255,.3); }

/* Result panel */
.result-panel { text-align: center; min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; margin-bottom: 1.75rem; }
.result-value { font-family: var(--mono); font-size: clamp(1.7rem, 5.5vw, 2.5rem); font-weight: 700; color: var(--accent); letter-spacing: -0.01em; position: relative; padding: .1rem .5rem; border-radius: var(--radius-sm); transition: transform .18s var(--ease-out), background .18s var(--ease-out); }
button.result-value:hover { background: rgba(45, 212, 191, 0.1); transform: scale(1.02); }
button.result-value:active { transform: scale(0.98); }
.result-value.is-copied::after {
  content: "✓ Copiado"; position: absolute; top: -1.9rem; left: 50%; transform: translateX(-50%);
  font-family: var(--sans); font-size: .8rem; font-weight: 700; background: var(--accent); color: var(--accent-ink);
  padding: .2rem .6rem; border-radius: 999px; animation: copyPop .25s var(--ease-bounce);
}
@keyframes copyPop { from { opacity: 0; transform: translateX(-50%) translateY(4px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.result-value--empty { font-family: var(--sans); font-size: 1.05rem; color: var(--text-faint); font-weight: 600; }
.result-meta { color: var(--text-dim); font-size: .85rem; max-width: 52ch; }
.result-meta--ok { color: var(--ok); font-weight: 700; }
.result-value-row { display: flex; gap: 1.75rem; flex-wrap: wrap; justify-content: center; }
.result-value-caption { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; margin-bottom: .2rem; text-align: center; }
.result-meta--bad { color: var(--danger); font-weight: 700; }

/* Band pickers (resistencias tool) */
.mode-panel { display: flex; flex-direction: column; gap: 1.1rem; }
.band-picker { display: flex; flex-direction: column; gap: .55rem; }
.band-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.swatch { --swatch-color: #888; width: 34px; height: 34px; border-radius: 10px; background: var(--swatch-color); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); transition: transform .18s var(--ease-bounce), box-shadow .18s var(--ease-out); }
.swatch:hover { transform: translateY(-3px) scale(1.06); }
.swatch.is-active { box-shadow: 0 0 0 2px var(--bg-elev), 0 0 0 4px var(--accent); transform: translateY(-2px); }
[data-color="ninguno"] { background: repeating-linear-gradient(45deg, var(--bg-elev-2) 0 4px, var(--bg) 4px 8px); }

/* Generic field controls */
.inverse-inputs { display: flex; gap: .75rem; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: .4rem; flex: 1 1 200px; min-width: 0; }
.field-unit { flex: 0 1 120px; }
.field-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.field input, .field select { background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: .75rem .9rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 1rem; transition: border-color .2s var(--ease-out); }
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-row { display: grid; gap: .75rem; grid-template-columns: 1fr; }
.field-inline { display: flex; gap: .5rem; }
.field-inline input { flex: 1 1 auto; min-width: 0; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text); padding: .7rem .85rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 1rem; transition: border-color .2s var(--ease-out); }
.field-inline input:focus { border-color: var(--accent); }
.field-inline select { flex: 0 0 auto; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim); padding: .7rem .6rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: .9rem; }

.privacy-badge { margin-top: 1.5rem; text-align: center; font-size: .82rem; color: var(--text-faint); }

/* Ad slots */
.ad-slot { min-height: 90px; margin-block: 2rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.ad-slot-label { color: var(--text-faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }

/* How it works */
.how-it-works { padding-block: 2rem; }
.steps { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.step { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.25rem; }
.step-icon { width: 28px; height: 28px; color: var(--accent); margin-bottom: .6rem; }
.step p { color: var(--text-dim); font-size: .92rem; }

/* SEO text */
.seo-text { padding-block: 1.5rem; color: var(--text-dim); }
.seo-text h2 { color: var(--text); }
.seo-text p { margin-bottom: 1rem; max-width: 72ch; }
.seo-text strong { color: var(--text); }

/* FAQ */
.faq { padding-block: 1.5rem; }
.faq details { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: .95rem 1.1rem; margin-bottom: .65rem; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; font-weight: 400; transition: transform .25s var(--ease-out); flex-shrink: 0; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { color: var(--text-dim); margin-top: .7rem; font-size: .93rem; }
.faq code { font-family: var(--mono); background: var(--bg-elev); padding: .1rem .35rem; border-radius: 5px; }

/* More tools / hub grid */
.more-tools { padding-block: 1.5rem 3rem; }
.more-tools-grid, .hub-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
.tool-teaser { display: block; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.1rem; opacity: .75; }
.tool-teaser--link { opacity: 1; transition: border-color .25s var(--ease-out), transform .25s var(--ease-out); }
.tool-teaser--link:hover { border-color: var(--accent); transform: translateY(-3px); }
.tool-teaser--link h3 { color: var(--accent-2); }
.tool-teaser-badge { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); margin-bottom: .5rem; }
.tool-teaser p { color: var(--text-dim); font-size: .88rem; }

.hub-card {
  display: flex; flex-direction: column; gap: .6rem; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.35rem; transition: border-color .25s var(--ease-out), transform .25s var(--ease-out), background .25s var(--ease-out);
}
.hub-card:hover { border-color: var(--accent); transform: translateY(-3px); background: rgba(45, 212, 191, 0.04); }
.hub-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.hub-card-icon { width: 30px; height: 30px; color: var(--accent); flex-shrink: 0; }
.hub-card h3 { font-size: 1.05rem; }
.hub-card p { color: var(--text-dim); font-size: .88rem; }

/* Dynamic element lists (Kirchhoff loop builder, resistor lists) */
.elem-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.elem-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .8rem; }
.elem-row-index { font-family: var(--mono); font-weight: 700; color: var(--text-faint); font-size: .85rem; width: 1.4rem; flex-shrink: 0; }
.elem-row select.elem-type { flex: 0 0 auto; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text); padding: .5rem .6rem; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; }
.elem-row .elem-value-wrap { display: flex; gap: .4rem; flex: 1 1 140px; min-width: 0; }
.elem-row input.elem-value { flex: 1 1 auto; min-width: 0; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text); padding: .5rem .6rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: .95rem; }
.elem-row select.elem-unit { flex: 0 0 auto; background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text-dim); padding: .5rem .5rem; border-radius: var(--radius-sm); font-size: .82rem; }
.elem-row .btn-remove { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; color: var(--text-faint); font-size: 1.1rem; line-height: 1; transition: color .2s var(--ease-out), background .2s var(--ease-out); }
.elem-row .btn-remove:hover { color: var(--danger); background: rgba(242, 84, 91, 0.1); }
.polarity-toggle { display: inline-flex; gap: 2px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px; flex: 0 0 auto; }
.polarity-toggle button { padding: .35rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; color: var(--text-faint); }
.polarity-toggle button.is-active { background: var(--accent); color: var(--accent-ink); }
.btn-add { display: inline-flex; align-items: center; gap: .4rem; align-self: flex-start; padding: .55rem 1rem; border-radius: 999px; border: 1px dashed var(--border-strong); color: var(--text-dim); font-weight: 700; font-size: .85rem; transition: color .2s var(--ease-out), border-color .2s var(--ease-out); }
.btn-add:hover { color: var(--accent); border-color: var(--accent); border-style: solid; }
.elem-limit-note { font-size: .78rem; color: var(--text-faint); margin-top: -.3rem; margin-bottom: .5rem; }

/* Verify panel (Kirchhoff) */
.verify-panel { border-top: 1px dashed var(--border); padding-top: 1.25rem; margin-top: .5rem; }
.verify-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.verify-feedback { margin-top: .85rem; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; display: none; }
.verify-feedback.is-shown { display: block; }
.verify-feedback.is-ok { background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.3); color: var(--ok); }
.verify-feedback.is-bad { background: rgba(242, 84, 91, 0.1); border: 1px solid rgba(242, 84, 91, 0.3); color: #ff9599; }

/* Pill radio (shared) */
.pill-radio-group { display: inline-flex; gap: .4rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 999px; padding: 4px; align-self: flex-start; }
.pill-radio { position: relative; cursor: pointer; }
.pill-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill-radio span { display: inline-block; padding: .5rem 1rem; border-radius: 999px; font-size: .84rem; font-weight: 700; color: var(--text-dim); transition: background .25s var(--ease-out), color .25s var(--ease-out); }
.pill-radio input:checked + span { background: var(--accent); color: var(--accent-ink); }
.pill-radio input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Voltage divider */
.divider-layout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: start; }
.divider-stage { display: flex; justify-content: center; }
.divider-svg { width: 100%; max-width: 220px; height: auto; }
.divider-svg .wire { stroke: var(--text-faint); stroke-width: 3; stroke-linecap: round; fill: none; }
.divider-svg .wire--current { stroke: var(--text-faint); stroke-dasharray: 4 5; }
.divider-svg.is-live .wire--current { stroke: var(--accent-2); animation: currentFlow 1.1s linear infinite; }
@keyframes currentFlow { to { stroke-dashoffset: -18; } }
.divider-svg .resistor-symbol { fill: var(--resistor-body); stroke: rgba(0, 0, 0, 0.25); stroke-width: 1; }
.divider-svg .node-dot { fill: var(--text-faint); }
.divider-svg .node-dot--accent { fill: var(--accent); }
.divider-svg .circuit-label { font-family: var(--mono); font-size: 13px; fill: var(--text-dim); }
.divider-svg .circuit-label--accent { fill: var(--accent); font-weight: 700; }
.divider-controls { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.known-picker { display: flex; flex-direction: column; gap: .6rem; }
.divider-note { font-size: .82rem; color: var(--text-faint); text-align: center; margin-top: 1.25rem; max-width: 56ch; margin-inline: auto; }

/* Ley de Ohm calculator */
.tool-panel { display: block; }
.ohm-triangle { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.ohm-triangle svg { width: 140px; height: auto; }
.ohm-grid { display: grid; gap: .85rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
.ohm-field {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: .85rem 1rem; transition: border-color .25s var(--ease-out), background .25s var(--ease-out);
}
.ohm-field.is-known { border-color: var(--accent); background: rgba(45, 212, 191, 0.06); }
.ohm-field-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .55rem; }
.ohm-name { font-size: .84rem; color: var(--text-dim); font-weight: 700; }
.ohm-tag { margin-left: auto; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 700; }
.ohm-field-controls { display: flex; gap: .5rem; }
.ohm-field-controls input {
  flex: 1 1 auto; min-width: 0; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
  padding: .7rem .85rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: 1.05rem;
  transition: border-color .2s var(--ease-out);
}
.ohm-field-controls input:focus { border-color: var(--accent); }
.ohm-field-controls select {
  flex: 0 0 auto; background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim);
  padding: .7rem .6rem; border-radius: var(--radius-sm); font-family: var(--mono); font-size: .92rem;
}
.ohm-formula { text-align: center; color: var(--text-dim); font-size: .88rem; font-family: var(--mono); min-height: 1.4em; margin-bottom: .5rem; }
.ohm-error { text-align: center; color: var(--danger); font-size: .85rem; margin-bottom: .5rem; }
.tool-actions { display: flex; justify-content: center; margin-bottom: .5rem; }

/* Two-column equivalence layout (Thevenin/Norton, op-amp) */
.equiv-layout { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.equiv-col { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.1rem; }
.equiv-col-title { font-family: var(--mono); font-weight: 700; color: var(--accent-2); font-size: .9rem; margin-bottom: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.equiv-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.equiv-arrow svg { width: 26px; height: 26px; }

/* Op-amp schematic card (fixed light "blueprint" look, matches textbook diagrams) */
.opamp-card {
  background: #eef4fa; border: 1px solid #c9dced; border-radius: var(--radius-md);
  padding: 1rem 1rem .75rem; margin-bottom: 1.25rem;
}
.opamp-card-title { text-align: center; font-weight: 800; font-size: .95rem; color: #17324a; margin-bottom: .5rem; }
.opamp-schem { width: 100%; max-width: 420px; height: auto; display: block; margin-inline: auto; }
.opamp-schem .wire, .opamp-schem .zigzag { fill: none; stroke: #1c3a52; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.opamp-schem .triangle { fill: #ffffff; stroke: #1c3a52; stroke-width: 1.8; stroke-linejoin: round; }
.opamp-schem .term-dot { fill: #eef4fa; stroke: #1c3a52; stroke-width: 1.6; }
.opamp-schem .node-dot { fill: #1c3a52; }
.opamp-schem .io-label { font-family: var(--mono); font-size: 13px; fill: #1c3a52; }
.opamp-schem .io-label--accent { font-weight: 700; fill: #b3541e; }
.opamp-schem .pol-sign { font-family: var(--mono); font-size: 15px; font-weight: 700; fill: #1c3a52; }
.opamp-schem .r-label { font-family: var(--mono); font-size: 12px; fill: #1c3a52; }

/* Circuit diagram stages (Kirchhoff loop, op-amp) */
.diagram-stage { display: flex; justify-content: center; padding-block: 1rem 1.5rem; }
.diagram-svg { width: 100%; max-width: 320px; height: auto; }
.diagram-svg .wire { stroke: var(--text-faint); stroke-width: 3; stroke-linecap: round; fill: none; }
.diagram-svg .resistor-symbol { fill: var(--resistor-body); stroke: rgba(0,0,0,.3); stroke-width: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.diagram-svg .opamp-body { fill: var(--bg-elev-2); stroke: var(--border-strong); stroke-width: 1.5; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.diagram-svg .circuit-label { font-family: var(--mono); font-size: 13px; fill: var(--text-dim); }
.diagram-svg .circuit-label--accent { fill: var(--accent); font-weight: 700; }
.diagram-svg .circuit-label--polarity { font-family: var(--mono); font-size: 17px; font-weight: 700; fill: var(--accent-2); }
.diagram-svg .current-arrow { fill: none; stroke: var(--accent); stroke-width: 2; }
.diagram-svg .source-symbol { fill: var(--resistor-body); stroke: rgba(0,0,0,.3); stroke-width: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.diagram-svg .source-sign { font-family: var(--mono); font-size: 15px; font-weight: 700; fill: var(--accent-2); text-anchor: middle; }
.diagram-svg .node-dot { fill: var(--text-faint); }

/* Kirchhoff mesh sections */
.mesh-section { margin-bottom: 1.25rem; }
.mesh-section-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.mesh-section-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); }
.mesh-divider { display: flex; align-items: center; gap: .8rem; margin-block: 1.4rem; color: var(--text-faint); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.mesh-divider::before, .mesh-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.shared-r-field { max-width: 260px; margin-bottom: 1rem; }
.btn-remove-mesh { color: var(--text-faint); font-size: .8rem; font-weight: 700; transition: color .2s var(--ease-out); }
.btn-remove-mesh:hover { color: var(--danger); }

.btn-ghost {
  border: 1px solid var(--border-strong); color: var(--text-dim);
  padding: .55rem 1.1rem; border-radius: 999px; font-size: .85rem; font-weight: 700;
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-solid {
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1.4rem; border-radius: 999px; font-size: .85rem; font-weight: 700;
  transition: transform .18s var(--ease-out), filter .18s var(--ease-out);
}
.btn-solid:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-solid:active { transform: translateY(0); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 1.5rem; margin-top: 2rem; }
.footer-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; color: var(--text-faint); font-size: .85rem; }
.footer-nav { display: flex; gap: 1.25rem; }
.footer-nav a { color: var(--text-dim); transition: color .2s var(--ease-out); }
.footer-nav a:hover { color: var(--accent); }

/* =============================================================
   6. Sections — hero
   ============================================================= */
.hero { position: relative; padding-block: clamp(2.5rem, 7vw, 5rem) 1.5rem; overflow: clip; }
.hero-inner { position: relative; z-index: 1; }
.hero-bg {
  position: absolute; inset: -20% -10% -40% -10%;
  background:
    radial-gradient(38% 45% at 22% 30%, rgba(45, 212, 191, 0.16), transparent 70%),
    radial-gradient(32% 40% at 78% 20%, rgba(139, 123, 255, 0.16), transparent 70%),
    radial-gradient(30% 35% at 55% 75%, rgba(45, 212, 191, 0.08), transparent 70%);
  filter: blur(60px);
  animation: heroDrift 22s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes heroDrift {
  from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(-2%, 2%, 0) scale(1.06); }
}

/* =============================================================
   7. Effects
   ============================================================= */
/* (micro-interactions defined inline with components above) */

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .more-tools-grid { grid-template-columns: repeat(3, 1fr); }
  .hub-grid { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: repeat(3, 1fr); }
  .equiv-layout { grid-template-columns: 1fr auto 1fr; align-items: center; }
}
@media (min-width: 720px) {
  .container { padding-inline: 2rem; }
}
@media (min-width: 780px) {
  .hub-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .tool-card { padding: 2.5rem; }
  .divider-layout { grid-template-columns: 220px 1fr; }
}

/* =============================================================
   9. Reduced-motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  /* hero-bg is a slow (22s) mesh-gradient drift — functional/micro, not gated */
}
