/* Virtual Lab: the homepage's colours, header and buttons, with the course books' headings, tables and boxes. */
:root {
  --navy: #12303f; --blue: #2e7a9e; --sky: #c5e4f2; --cream: #f3e2a9;
  --text: #1b2a33; --muted: #5b6b75; --line: #dde5ea; --rule: #1b2a33; --tint: #f7fafc;
  --warn: #8a5a00;
  --ink: #12303f;   /* read by plot.js */
  --font: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15.5px/1.7 var(--font); color: var(--text); background: #fff; word-break: keep-all; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
.pname { font-family: Arial, Helvetica, sans-serif; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- site header (as on the homepage) ---------- */
.site { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.site .wrap { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy); text-decoration: none; }
.brand img { width: 38px; height: 38px; }
.brand strong { display: block; font-size: 16.5px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.brand em { display: block; font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--blue); }
.site .crumb { color: var(--muted); font-size: 14.5px; font-weight: 700; padding-left: 18px; border-left: 1px solid var(--line); }
.site nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.site nav a { color: var(--navy); font-size: 14.5px; font-weight: 600; text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.site nav a:hover { background: #f2f7fa; }
.site nav a.cta { background: var(--navy); color: #fff; border-radius: 999px; padding: 8px 18px; }
.site nav a.cta:hover { background: var(--blue); }
@media (max-width: 760px) { .site .crumb, .site nav a:not(.cta) { display: none; } }

/* ---------- page head (homepage hero--page) ---------- */
.head { padding: 40px 0 34px; background: linear-gradient(150deg, var(--sky) 0%, #eef7fc 55%, #fff 100%); }
.head .wrap { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 22px 40px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; font-weight: 700; letter-spacing: .1em; color: var(--blue); }
.eyebrow b { padding: 2px 10px; border-radius: 999px; background: var(--cream); color: var(--navy); letter-spacing: .02em; font-size: 12.5px; }
.head h1 { margin: 0; color: var(--navy); font-size: clamp(28px, 4.2vw, 40px); line-height: 1.2; }
.head p { max-width: 60ch; margin: 12px 0 0; color: #33505f; font-size: 16.5px; }
.switch { display: flex; flex-direction: column; gap: 6px; }
.switch > span { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.switch div { display: inline-flex; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .75); border: 1px solid rgba(46, 122, 158, .22); }
.switch a { padding: 7px 16px; border-radius: 999px; color: var(--navy); text-decoration: none; font-size: 14px; }
.switch a.on { background: var(--navy); color: #fff; }

/* ---------- sections and headings (course-book h2: navy number, sky rule) ---------- */
.step { padding: 38px 0 6px; }
.step + .step { padding-top: 26px; }
h2 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--sky); color: var(--navy); font-size: 21px; letter-spacing: -.02em; }
h2 .no { color: var(--blue); font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; }
h2 small { margin-left: auto; color: var(--muted); font-size: 13.5px; font-weight: 500; letter-spacing: 0; }
@media (max-width: 640px) { h2 { flex-wrap: wrap; } h2 small { flex-basis: 100%; margin-left: 0; } }
h3 { margin: 0 0 10px; color: var(--navy); font-size: 16px; }
.lead { margin: 0 0 16px; color: #3a505c; max-width: 80ch; }

/* ---------- experiment chooser: the books' contents, one block per chapter ---------- */
.course { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 18px 24px; }
.ch { border-top: 2px solid var(--rule); padding-top: 8px; }
.ch-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; color: var(--navy); }
.ch-h b { font-size: 26px; line-height: 1; font-weight: 800; }
.ch-h b i { font-style: normal; font-size: 13px; margin-left: 2px; }
.ch-h span { font-size: 14.5px; font-weight: 700; }
.ch button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px 7px 12px; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 0; background: none; color: var(--text); font: inherit; font-size: 14.5px; text-align: left; cursor: pointer; }
.ch button::after { content: "→"; color: var(--blue); opacity: 0; transition: opacity .15s; }
.ch button:hover { background: #f2f7fa; }
.ch button:hover::after { opacity: 1; }
.ch button.on { border-left-color: var(--blue); background: #eaf5fb; color: var(--navy); font-weight: 700; }
.ch button.on::after { opacity: 1; }

/* ---------- boxes (course-book callouts) ---------- */
.box { border-left: 3px solid var(--navy); padding: 2px 0 2px 16px; margin: 0 0 18px; }
.box > b { display: block; color: var(--navy); font-size: 14px; margin-bottom: 2px; }
.box p { margin: 0; color: #3a505c; font-size: 14.5px; }
.box.warn { border-color: var(--warn); }
.box.warn > b { color: var(--warn); }
#msg { min-height: 1.7em; }
#msg:empty { display: none; }

/* ---------- buttons (homepage .btn) ---------- */
button, .btn { font: inherit; font-weight: 700; font-size: 14.5px; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--navy); background: var(--navy); color: #fff; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
button:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
button:disabled { opacity: .4; cursor: default; }
button.ghost { background: #fff; color: var(--navy); border-color: rgba(18, 48, 63, .25); }
button.ghost:hover:not(:disabled) { background: #fff; color: var(--blue); border-color: var(--blue); }
button.big { padding: 12px 28px; font-size: 15.5px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.tools .sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.tools .push { margin-left: auto; }

/* ---------- form fields ---------- */
select, input { font: inherit; font-size: 14.5px; padding: 6px 10px; border: 1px solid #c9d5dc; border-radius: 8px; background: #fff; color: var(--text); }
select:focus, input:focus { outline: 2px solid var(--sky); border-color: var(--blue); }
.row { display: flex; gap: 10px 12px; flex-wrap: wrap; align-items: end; margin-top: 12px; }
.row label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.row input { width: 108px; font-variant-numeric: tabular-nums; }
.leads { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; }
.leads label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }

/* ---------- measurement + result ---------- */
.measure { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 34px; align-items: start; }
@media (max-width: 900px) { .measure { grid-template-columns: 1fr; } }
.panel { padding: 18px 20px 20px; background: var(--tint); border: 1px solid var(--line); border-radius: 12px; }
.panel .go { display: flex; gap: 10px; margin-top: 18px; }
figure { margin: 0; }
canvas { width: 100%; height: 430px; display: block; }
figcaption { margin-top: 8px; font-size: 13px; color: #3a505c; }
figcaption b { color: var(--navy); }
.plotbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 8px; }
.plotbar label { display: flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin-right: auto; }
.plotbar input { width: auto; }
#legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 6px 0 0; padding: 0; font-size: 13.5px; }
#legend i { display: inline-block; width: 16px; height: 3px; margin-right: 6px; vertical-align: middle; }

/* connection summary: a booktabs-like list */
.check { margin-top: 22px; }
#summary { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--rule); border-bottom: 1.5px solid var(--rule); font-size: 14px; }
#summary li { padding: 6px 2px; }
#summary li + li { border-top: 1px solid #dfe3e6; }
#summary li.warn { color: var(--warn); }
#summary li.warn::before { content: "! "; font-weight: 800; }
.note { margin: 12px 0 0; padding-top: 8px; border-top: 1px solid #c9ced2; font-size: 12.5px; line-height: 1.65; color: #4a5a63; }

footer { margin-top: 56px; padding: 22px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }
footer a { color: var(--muted); }

/* ---------- breadboard (white board as in the course-book photos) ---------- */
.bbwrap { overflow-x: auto; }
svg.bb { width: 100%; max-width: 960px; min-width: 640px; margin: 0 auto; height: auto; display: block; touch-action: none; user-select: none; }
.bb-pinchip { fill: #333; font-weight: 700; }
.bb-dippin { fill: #c9ccd1; stroke: #8a8f96; stroke-width: .6; }
.bb-board { fill: #fbfbfa; stroke: #d3d8dc; }
.bb-gap { fill: #eceff1; }
.bb-rail { stroke-width: 1.5; } .bb-rail.plus { stroke: #d33a2f; } .bb-rail.minus { stroke: #2f5bd3; }
.bb-hole { fill: #3f4448; } .bb-hole.hot { fill: #f0a500; }
.bb-lab, .bb-num { font: 10px var(--font); fill: #98a1a8; text-anchor: middle; }
.bb-jack { stroke: #fff; stroke-width: 2; } .bb-jlab { font: 12px var(--font); fill: var(--navy); }
.bb-wpath { fill: none; stroke-width: 4; stroke-linecap: round; opacity: .9; }
.bb-wend { stroke: #fff; stroke-width: 1.5; cursor: grab; }
.bb-wire.sel .bb-wpath { stroke-width: 6; }
.bb-part { cursor: grab; } .bb-part.sel { filter: drop-shadow(0 0 3px #f0a500); }
.bb-leg { fill: #9aa0a6; } .bb-wireleg { stroke: #9aa0a6; stroke-width: 2; }
.bb-res { fill: #e9d3a6; stroke: #b49a6a; } .bb-diode { fill: #222; } .bb-band { fill: #ccc; }
.bb-zener { fill: #e8873a; stroke: #b5651d; } .bb-band-z { fill: #222; }
.bb-led { fill: #e23b3b; fill-opacity: .85; stroke: #a11; } .bb-cds { fill: #f2c58a; stroke: #b98a4a; } .bb-cdsline { fill: none; stroke: #8b4513; stroke-width: 1.5; }
.bb-solar { fill: #1f3c7a; stroke: #9ab; } .bb-to92 { fill: #222; } .bb-chip { fill: #1d1d1f; } .bb-notch { fill: #fbfbfa; }
.bb-plab { font: 700 11px var(--font); fill: var(--navy); text-anchor: middle; pointer-events: none; }
.bb-chip ~ .bb-plab, .bb-to92 ~ .bb-plab { fill: #eee; }
.bb-pin { font: 9px var(--font); fill: #555; text-anchor: middle; pointer-events: none; }
