123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CQ02WGF470KTCE — Component Characterization</title>
<style>

  @font-face { font-family: 'Familjen Grotesk'; src: url('https://adom.inc/fonts/familjen-grotesk/familjen-grotesk-latin-700-normal.woff2') format('woff2'); font-weight: 700; }
  @font-face { font-family: 'Familjen Grotesk'; src: url('https://adom.inc/fonts/familjen-grotesk/familjen-grotesk-latin-500-normal.woff2') format('woff2'); font-weight: 500; }
  @font-face { font-family: 'Satoshi'; src: url('https://adom.inc/fonts/satoshi/satoshi-400-normal.woff2') format('woff2'); font-weight: 400; }
  @font-face { font-family: 'Satoshi'; src: url('https://adom.inc/fonts/satoshi/satoshi-500-normal.woff2') format('woff2'); font-weight: 500; }
  @font-face { font-family: 'JetBrains Mono'; src: url('https://fonts.gstatic.com/s/jetbrainsmono/v24/tDbv2o-flEEny0FZhsfKu5WU4zr3E_BX0PnT8RD8yKwBNntkaToggR7BYRbKPx3cwhsk.woff2') format('woff2'); font-weight: 400; }

  :root {
    --bg: #0d1117; --surface: #161b22; --elevated: #1c2128; --border: #30363d; --border-muted: #21262d;
    --text: #e6edf3; --text-muted: #8b949e; --text-dim: #484f58;
    --accent: #00b8b0; --accent-bright: #00e6dc; --accent-dim: rgba(0,184,176,0.12); --accent-border: rgba(0,184,176,0.25);
    --green: #3fb950; --orange: #d29922; --red: #f85149; --purple: #8C6BF7; --blue: #58a6ff;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body { font-family: 'Satoshi', sans-serif; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.6; overflow-y: auto; }
  h1,h2,h3 { font-family: 'Familjen Grotesk', sans-serif; font-weight: 700; }
  code { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
  a { color: var(--accent); text-decoration: none; }
  a:hover { color: var(--accent-bright); text-decoration: underline; }

  .header { background: var(--surface); border-bottom: 1px solid var(--border-muted); padding: 20px 24px; }
  .header-top { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
  .header .brand { color: var(--accent); font-family: 'Familjen Grotesk', sans-serif; font-size: 12px; font-weight: 600; }
  .header .vsep { width: 1px; height: 16px; background: var(--border); }
  .header .crumb { color: var(--text-dim); font-size: 12px; }
  .header h1 { font-size: 22px; margin-bottom: 2px; }
  .header h1 .val { color: var(--accent); }
  .header .subtitle { color: var(--text-muted); font-size: 13px; }
  .header .tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
  .tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
  .tag.pkg { background: rgba(0,184,176,0.12); color: var(--accent); }
  .tag.mfr { background: rgba(88,166,255,0.12); color: var(--blue); }
  .tag.series { background: rgba(140,107,247,0.12); color: var(--purple); }
  .tag.rohs { background: rgba(63,185,80,0.12); color: var(--green); }
  .tag.app { background: rgba(210,153,34,0.12); color: var(--orange); }

  .container { max-width: 1100px; margin: 0 auto; padding: 24px; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  @media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

  .section { margin-bottom: 28px; }
  .section-title { font-size: 14px; color: var(--text); margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border-muted); display: flex; align-items: center; gap: 8px; }
  .section-title .icon { color: var(--accent); font-size: 16px; }

  .card { background: var(--surface); border: 1px solid var(--border-muted); border-radius: 8px; padding: 16px; }
  .card:hover { border-color: var(--accent-border); }

  .spec-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  .spec-card { background: var(--surface); border: 1px solid var(--border-muted); border-radius: 8px; padding: 12px 14px; text-align: center; }
  .spec-card .sc-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 4px; }
  .spec-card .sc-value { font-size: 22px; font-weight: 700; font-family: 'Familjen Grotesk', sans-serif; }
  .spec-card .sc-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  .spec-card.highlight { border-color: var(--accent-border); background: linear-gradient(180deg, rgba(0,184,176,0.06), var(--surface)); }
  .spec-card.highlight .sc-value { color: var(--accent); }

  .detail-table { width: 100%; border-collapse: collapse; }
  .detail-table tr { border-bottom: 1px solid var(--border-muted); }
  .detail-table tr:last-child { border-bottom: none; }
  .detail-table td { padding: 8px 0; }
  .detail-table td:first-child { color: var(--text-muted); font-size: 12px; width: 45%; }
  .detail-table td:last-child { font-family: 'JetBrains Mono', monospace; font-size: 13px; text-align: right; }

  .chart-wrap { background: var(--surface); border: 1px solid var(--border-muted); border-radius: 8px; padding: 16px; }
  .chart-wrap h3 { font-size: 13px; color: var(--text); margin-bottom: 12px; }
  .chart-wrap .chart-note { font-size: 11px; color: var(--text-dim); margin-top: 8px; }
  svg text { font-family: 'JetBrains Mono', monospace; }

  .pkg-drawing { display: flex; align-items: center; justify-content: center; padding: 20px; }

  .profile-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
  .profile-table th { background: var(--elevated); padding: 6px 10px; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); text-align: left; border-bottom: 1px solid var(--border); }
  .profile-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-muted); }

  .env-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  @media (max-width: 700px) { .env-grid { grid-template-columns: 1fr; } }
  .env-card { background: var(--surface); border: 1px solid var(--border-muted); border-radius: 8px; padding: 12px 14px; }
  .env-card .env-name { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
  .env-card .env-spec { font-size: 11px; color: var(--text-muted); }
  .env-card .env-detail { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text); margin-top: 4px; }

  .vendor-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  @media (max-width: 700px) { .vendor-cards { grid-template-columns: 1fr; } }
  .vendor-card { background: var(--surface); border: 1px solid var(--border-muted); border-radius: 8px; padding: 14px; }
  .vendor-card .vc-name { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
  .vendor-card .vc-name.mouser { color: var(--blue); }
  .vendor-card .vc-name.digikey { color: var(--red); }
  .vendor-card .vc-name.jlcpcb { color: var(--green); }
  .vendor-card .vc-price { font-size: 20px; font-weight: 700; font-family: 'Familjen Grotesk', sans-serif; }
  .vendor-card .vc-detail { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
  .vendor-card .vc-link { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--accent); }
  .vendor-card.recommended { border-color: var(--accent-border); }
  .vendor-card.recommended::before { content: 'RECOMMENDED'; display: block; font-size: 9px; letter-spacing: 1px; color: var(--accent); margin-bottom: 6px; font-weight: 600; }

  .copy-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 4px; padding: 2px 6px; font-size: 13px; cursor: pointer; font-family: 'JetBrains Mono', monospace; vertical-align: middle; transition: border-color 0.15s, color 0.15s; }
  .copy-btn:hover { border-color: var(--accent); color: var(--accent); }

  .dl-btn { display: inline-block; margin-top: 10px; padding: 6px 14px; background: var(--accent-dim); border: 1px solid var(--accent-border); border-radius: 6px; color: var(--accent); font-size: 11px; font-weight: 500; font-family: 'Satoshi', sans-serif; text-decoration: none; transition: background 0.15s, border-color 0.15s; }
  .dl-btn:hover { background: rgba(0,184,176,0.2); border-color: var(--accent); text-decoration: none; color: var(--accent-bright); }

  .open-full-banner { display: flex; align-items: center; justify-content: center; padding: 12px 24px; background: linear-gradient(90deg, rgba(0,184,176,0.12), rgba(0,184,176,0.06)); border-bottom: 1px solid var(--accent-border); }
  .open-full-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; background: var(--accent); color: var(--bg); font-family: 'Familjen Grotesk', sans-serif; font-size: 13px; font-weight: 600; border-radius: 6px; text-decoration: none; transition: background 0.15s; }
  .open-full-btn:hover { background: var(--accent-bright); text-decoration: none; color: var(--bg); }

  .source { text-align: center; color: var(--text-dim); font-size: 11px; padding: 24px 0 12px; border-top: 1px solid var(--border-muted); margin-top: 20px; }

</style>
</head>
<body>

<div class="open-full-banner" id="fullPageBanner" style="display:none">
  <span style="color:var(--text-muted);font-size:12px;margin-right:8px">Full page:</span>
  <code style="color:var(--accent);font-size:11px;background:var(--elevated);padding:4px 8px;border-radius:4px;user-select:all">https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/CQ02WGF470KTCE.html</code>
  <button class="open-full-btn" id="copyFullUrl" style="margin-left:8px">Copy Link</button>
</div>
<script>
if(window.self!==window.top){document.getElementById('fullPageBanner').style.display='flex'}
document.getElementById('copyFullUrl').addEventListener('click',function(){var t=document.createElement('textarea');t.value='https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/CQ02WGF470KTCE.html';document.body.appendChild(t);t.select();document.execCommand('copy');document.body.removeChild(t);this.textContent='Copied!';var b=this;setTimeout(function(){b.textContent='Copy Link'},1500)});
</script>

<div class="header">
  <div class="header-top">
    <div class="brand">Adom</div>
    <div class="vsep"></div>
    <div class="crumb">Components &rsaquo; Resistors &rsaquo; 0402</div>
  </div>
  <h1>CQ02WGF470KTCE &mdash; <span class="val">4.7&Omega;</span></h1>
  <div class="subtitle">Royalohm &middot; Thick Film Chip Resistor &middot; General Purpose</div>
  <div class="tags">
    <span class="tag pkg">0402</span>
    <span class="tag mfr">Royalohm</span>
    <span class="tag series">CQ02W</span>
    <span class="tag rohs">RoHS</span>
    <span class="tag app">Thick Film</span>
  </div>
</div>

<div class="container">

  <div class="section">
    <div class="spec-cards">
      <div class="spec-card highlight">
        <div class="sc-label">Resistance</div>
        <div class="sc-value">4.7&Omega;</div>
        <div class="sc-detail">&plusmn;1%</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Power Rating</div>
        <div class="sc-value">62.5mW</div>
        <div class="sc-detail">1/16W @ 70&deg;C</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Tolerance</div>
        <div class="sc-value">&plusmn;1%</div>
        <div class="sc-detail">F grade</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">TCR</div>
        <div class="sc-value">&plusmn;200</div>
        <div class="sc-detail">ppm/&deg;C</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Max Voltage</div>
        <div class="sc-value">50V</div>
        <div class="sc-detail">working voltage</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Mouser</div>
        <div class="sc-value">&mdash;</div>
        <div class="sc-detail">search for price</div>
      </div>
    </div>
  </div>

  <div class="grid-2">
    <!-- Left column -->
    <div>
      <div class="section">
        <h2 class="section-title">Electrical Characteristics</h2>
        <div class="card">
          <table class="detail-table">
            <tr><td>Resistance</td><td>4.7&Omega; &plusmn;1%</td></tr>
            <tr><td>Power Rating</td><td>62.5mW (1/16W)</td></tr>
            <tr><td>Derate Above</td><td>70&deg;C &rarr; 0W at 155&deg;C</td></tr>
            <tr><td>Max Working Voltage</td><td>50V</td></tr>
            <tr><td>Max Overload Voltage</td><td>100V</td></tr>
            <tr><td>Rated Current</td><td>1A</td></tr>
            <tr><td>TCR</td><td>&plusmn;200 ppm/&deg;C</td></tr>
            <tr><td>Insulation Resistance</td><td>&ge;1G&Omega; @ 100V</td></tr>
            <tr><td>Dielectric Withstanding</td><td>100V (CR0402)</td></tr>
          </table>
        </div>
      </div>

      <div class="section">
        <h2 class="section-title">Operating Conditions</h2>
        <div class="card">
          <table class="detail-table">
            <tr><td>Operating Temp</td><td>&minus;55&deg;C to +155&deg;C</td></tr>
            <tr><td>Power Derating</td><td>100% to 70&deg;C, 0% at 155&deg;C</td></tr>
            <tr><td>Solder Compatibility</td><td>Sn96.5/Ag3.0/Cu0.5</td></tr>
            <tr><td>Solderability Test</td><td>245&plusmn;3&deg;C, 2&plusmn;0.5s</td></tr>
            <tr><td>Mass</td><td>&sim;0.001g</td></tr>
          </table>
        </div>
      </div>
    </div>

    <!-- Right column -->
    <div>
      <div class="section">
        <h2 class="section-title">Package &amp; Dimensions</h2>
        <div class="card">
          <div class="pkg-drawing">
            <svg width="100%" height="170" viewBox="0 0 480 170">
              <!-- Top view centered at x=110 -->
              <text x="110" y="14" fill="#8b949e" font-size="10" text-anchor="middle">Top View</text>
              <rect x="50" y="22" width="120" height="60" rx="2" fill="#1c2128" stroke="#30363d" stroke-width="1.5"/>
              <rect x="50" y="22" width="24" height="60" rx="1" fill="rgba(0,184,176,0.15)" stroke="#00b8b0" stroke-width="1"/>
              <rect x="146" y="22" width="24" height="60" rx="1" fill="rgba(0,184,176,0.15)" stroke="#00b8b0" stroke-width="1"/>
              <!-- No polarity mark — resistors are non-polarized -->
              <!-- Width dim -->
              <line x1="50" y1="94" x2="170" y2="94" stroke="#484f58" stroke-width="0.5"/>
              <line x1="50" y1="90" x2="50" y2="98" stroke="#484f58" stroke-width="0.5"/>
              <line x1="170" y1="90" x2="170" y2="98" stroke="#484f58" stroke-width="0.5"/>
              <text x="110" y="110" fill="#e6edf3" font-size="10" text-anchor="middle">1.00 &plusmn; 0.10</text>
              <!-- Depth dim -->
              <line x1="180" y1="22" x2="180" y2="82" stroke="#484f58" stroke-width="0.5"/>
              <line x1="176" y1="22" x2="184" y2="22" stroke="#484f58" stroke-width="0.5"/>
              <line x1="176" y1="82" x2="184" y2="82" stroke="#484f58" stroke-width="0.5"/>
              <text x="195" y="56" fill="#e6edf3" font-size="10">0.50 &plusmn; 0.05</text>
              <!-- Terminal width -->
              <line x1="50" y1="122" x2="74" y2="122" stroke="#484f58" stroke-width="0.5" stroke-dasharray="2,2"/>
              <text x="62" y="134" fill="#8b949e" font-size="9" text-anchor="middle">C: 0.20&plusmn;0.10</text>

              <!-- Side view centered at x=370 -->
              <text x="370" y="14" fill="#8b949e" font-size="10" text-anchor="middle">Side View</text>
              <rect x="310" y="46" width="120" height="28" rx="2" fill="#1c2128" stroke="#30363d" stroke-width="1.5"/>
              <rect x="310" y="46" width="20" height="28" rx="1" fill="rgba(0,184,176,0.15)" stroke="#00b8b0" stroke-width="1"/>
              <rect x="410" y="46" width="20" height="28" rx="1" fill="rgba(0,184,176,0.15)" stroke="#00b8b0" stroke-width="1"/>
              <!-- Height dim -->
              <line x1="440" y1="46" x2="440" y2="74" stroke="#484f58" stroke-width="0.5"/>
              <line x1="436" y1="46" x2="444" y2="46" stroke="#484f58" stroke-width="0.5"/>
              <line x1="436" y1="74" x2="444" y2="74" stroke="#484f58" stroke-width="0.5"/>
              <text x="455" y="64" fill="#e6edf3" font-size="10">0.35 &plusmn; 0.05</text>

              <!-- Physical specs -->
              <text x="110" y="155" fill="#8b949e" font-size="10" text-anchor="middle">0402 (1005 metric)</text>
              <text x="370" y="95" fill="#8b949e" font-size="10" text-anchor="middle">Mass: ~0.001g</text>
            </svg>
          </div>
        </div>
      </div>

      <div class="section">
        <h2 class="section-title">Recommended Land Pattern</h2>
        <div class="card">
          <table class="detail-table">
            <tr><td>Pad Width</td><td>0.40mm</td></tr>
            <tr><td>Pad Height</td><td>0.50mm</td></tr>
            <tr><td>Pad-to-Pad (Reflow)</td><td>1.0mm</td></tr>
            <tr><td>Solder Paste Thickness</td><td>100&ndash;130 &micro;m</td></tr>
          </table>
        </div>
      </div>
    </div>
  </div>

  <div class="section">
    <h2 class="section-title">Power Derating</h2>
    <div class="chart-wrap">
      <h3>Power Derating vs. Ambient Temperature (CR0402 — 62.5mW)</h3>
      <svg id="derating-chart" width="100%" height="260" viewBox="0 0 700 260">
        <rect x="60" y="20" width="600" height="200" fill="#0d1117" rx="4"/>
        <line x1="60" y1="220" x2="660" y2="220" stroke="#21262d" stroke-width="1"/>
        <line x1="60" y1="20" x2="60" y2="220" stroke="#21262d" stroke-width="1"/>
        <line x1="60" y1="178" x2="660" y2="178" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="55" y="182" fill="#484f58" font-size="9" text-anchor="end">25%</text>
        <line x1="60" y1="137" x2="660" y2="137" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="55" y="141" fill="#484f58" font-size="9" text-anchor="end">50%</text>
        <line x1="60" y1="95" x2="660" y2="95" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="55" y="99" fill="#484f58" font-size="9" text-anchor="end">75%</text>
        <line x1="60" y1="53" x2="660" y2="53" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="55" y="57" fill="#484f58" font-size="9" text-anchor="end">100%</text>
        <line x1="60" y1="20" x2="60" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="60" y="240" fill="#484f58" font-size="9" text-anchor="middle">-55&deg;C</text>
        <line x1="207" y1="20" x2="207" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="207" y="240" fill="#484f58" font-size="9" text-anchor="middle">0&deg;C</text>
        <line x1="273" y1="20" x2="273" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="273" y="240" fill="#484f58" font-size="9" text-anchor="middle">25&deg;C</text>
        <line x1="393" y1="20" x2="393" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="393" y="240" fill="#484f58" font-size="9" text-anchor="middle">70&deg;C</text>
        <line x1="473" y1="20" x2="473" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="473" y="240" fill="#484f58" font-size="9" text-anchor="middle">100&deg;C</text>
        <line x1="620" y1="20" x2="620" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <text x="620" y="240" fill="#484f58" font-size="9" text-anchor="middle">155&deg;C</text>

        <!-- Derating line: flat at 100% from -55C to 70C, then linear to 0% at 155C -->
        <path d="M60,53 L393,53 L620,220" stroke="#00b8b0" stroke-width="2.5" fill="none"/>
        <!-- Fill under curve -->
        <path d="M60,53 L393,53 L620,220 L620,220 L60,220 Z" fill="rgba(0,184,176,0.08)"/>
        <!-- Key point dots -->
        <circle cx="393" cy="53" r="4" fill="#00b8b0" opacity="0.8"/>
        <circle cx="620" cy="220" r="4" fill="#f85149" opacity="0.8"/>
        <!-- Annotations -->
        <text x="393" y="43" fill="#00b8b0" font-size="10" text-anchor="middle">70&deg;C / 100%</text>
        <text x="620" y="210" fill="#f85149" font-size="10" text-anchor="middle">155&deg;C / 0%</text>
        <!-- Axis labels -->
        <text x="12" y="124" fill="#484f58" font-size="9" text-anchor="middle" transform="rotate(-90,12,124)">Rated Power (%)</text>
        <text x="360" y="255" fill="#484f58" font-size="9" text-anchor="middle">Ambient Temperature</text>
        <!-- 0% label -->
        <text x="55" y="224" fill="#484f58" font-size="9" text-anchor="end">0%</text>
      </svg>
      <div class="chart-note">Full rated power (62.5mW) up to 70&deg;C ambient. Above 70&deg;C, derate linearly to zero at 155&deg;C. Formula: P = 62.5mW &times; (155 &minus; T<sub>amb</sub>) / 85 for T &gt; 70&deg;C.</div>
    </div>
  </div>

  <div class="section">
    <h2 class="section-title">Reflow Soldering Profile</h2>
    <div class="chart-wrap">
      <h3>Lead-Free Reflow Profile (Royalohm CQ Series)</h3>
      <svg id="reflow-chart" width="100%" height="260" viewBox="0 0 700 260">
        <rect x="60" y="10" width="600" height="180" fill="#0d1117" rx="4"/>
        <!-- Grid -->
        <line x1="60" y1="190" x2="660" y2="190" stroke="#21262d" stroke-width="1"/>
        <line x1="60" y1="10" x2="60" y2="190" stroke="#21262d" stroke-width="1"/>
        <line x1="60" y1="145" x2="660" y2="145" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="90" x2="660" y2="90" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="40" x2="660" y2="40" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>

        <!-- Temperature profile (standard) -->
        <!-- Ramp to 150C preheat, hold 60-120s, ramp to 220C zone, 60-90s above 220C, peak 255C -->
        <path d="M80,185 L180,145 L300,145 L370,90 L420,30 L460,30 L500,90 L580,145 L660,185" stroke="#d29922" stroke-width="2.5" fill="none"/>

        <!-- Limit profile (dashed, peak 260C) -->
        <path d="M80,185 L180,145 L300,145 L360,80 L410,18 L470,18 L510,80 L580,145 L660,185" stroke="#f85149" stroke-width="1.5" fill="none" stroke-dasharray="5,4" opacity="0.6"/>

        <!-- Zone annotations -->
        <rect x="210" y="155" width="80" height="16" rx="3" fill="rgba(210,153,34,0.15)"/>
        <text x="250" y="167" fill="#d29922" font-size="9" text-anchor="middle">Pre-heat</text>
        <rect x="310" y="4" width="80" height="16" rx="3" fill="rgba(248,81,73,0.15)"/>
        <text x="350" y="16" fill="#f85149" font-size="9" text-anchor="middle">Peak zone</text>

        <!-- Temperature markers -->
        <text x="55" y="148" fill="#484f58" font-size="9" text-anchor="end">150&deg;C</text>
        <text x="55" y="93" fill="#484f58" font-size="9" text-anchor="end">220&deg;C</text>
        <text x="55" y="33" fill="#484f58" font-size="9" text-anchor="end">255&deg;C</text>

        <!-- 260C limit line -->
        <text x="480" y="15" fill="#f85149" font-size="9">260&deg;C limit</text>
        <line x1="60" y1="18" x2="660" y2="18" stroke="#f85149" stroke-width="0.5" stroke-dasharray="2,3" opacity="0.4"/>

        <!-- Pre-heat duration bracket -->
        <line x1="180" y1="195" x2="300" y2="195" stroke="#484f58" stroke-width="1"/>
        <line x1="180" y1="191" x2="180" y2="199" stroke="#484f58" stroke-width="1"/>
        <line x1="300" y1="191" x2="300" y2="199" stroke="#484f58" stroke-width="1"/>
        <text x="240" y="207" fill="#8b949e" font-size="8" text-anchor="middle">60&ndash;120s preheat</text>

        <!-- Above 220C bracket -->
        <line x1="370" y1="95" x2="500" y2="95" stroke="#484f58" stroke-width="1"/>
        <line x1="370" y1="91" x2="370" y2="99" stroke="#484f58" stroke-width="1"/>
        <line x1="500" y1="91" x2="500" y2="99" stroke="#484f58" stroke-width="1"/>
        <text x="435" y="107" fill="#8b949e" font-size="8" text-anchor="middle">60&ndash;90s &gt;220&deg;C</text>

        <!-- Total time bracket -->
        <line x1="80" y1="220" x2="660" y2="220" stroke="#484f58" stroke-width="0.5"/>
        <line x1="80" y1="216" x2="80" y2="224" stroke="#484f58" stroke-width="0.5"/>
        <line x1="660" y1="216" x2="660" y2="224" stroke="#484f58" stroke-width="0.5"/>

        <!-- X axis time markers -->
        <text x="80" y="234" fill="#484f58" font-size="8" text-anchor="middle">0s</text>
        <text x="180" y="234" fill="#484f58" font-size="8" text-anchor="middle">~50s</text>
        <text x="300" y="234" fill="#484f58" font-size="8" text-anchor="middle">~170s</text>
        <text x="420" y="234" fill="#484f58" font-size="8" text-anchor="middle">~220s</text>
        <text x="500" y="234" fill="#484f58" font-size="8" text-anchor="middle">~260s</text>
        <text x="660" y="234" fill="#484f58" font-size="8" text-anchor="middle">~360s</text>

        <!-- Legend -->
        <line x1="250" y1="248" x2="270" y2="248" stroke="#d29922" stroke-width="2"/>
        <text x="275" y="252" fill="#8b949e" font-size="9">Standard</text>
        <line x1="360" y1="248" x2="380" y2="248" stroke="#f85149" stroke-width="1.5" stroke-dasharray="4,3"/>
        <text x="385" y="252" fill="#8b949e" font-size="9">Limit</text>
      </svg>
      <table class="profile-table">
        <thead><tr><th>Phase</th><th>Standard</th><th>Limit</th></tr></thead>
        <tbody>
          <tr><td>Ramp Up</td><td>3&deg;C/s max</td><td>Same</td></tr>
          <tr><td>Pre-heat</td><td>150&deg;C, 60&ndash;120s</td><td>Same</td></tr>
          <tr><td>Reflow Zone</td><td>190&ndash;220&deg;C</td><td>60&ndash;90s above 220&deg;C</td></tr>
          <tr><td>Peak Temperature</td><td>255&deg;C, &le;20s</td><td>260&deg;C max</td></tr>
          <tr><td>Ramp Down</td><td>6&deg;C/s max</td><td>Same</td></tr>
        </tbody>
      </table>
    </div>
  </div>

  <div class="section">
    <h2 class="section-title">Environmental &amp; Reliability</h2>
    <div class="env-grid">
      <div class="env-card">
        <div class="env-name">Short Time Overload</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.05&Omega;)</div>
        <div class="env-detail">2.5&times; rated voltage, 5s</div>
      </div>
      
      <div class="env-card">
        <div class="env-name">Load Life</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.1&Omega;)</div>
        <div class="env-detail">1000h @ 70&deg;C, 1.5h ON / 0.5h OFF</div>
      </div>
      <div class="env-card">
        <div class="env-name">Load Life (Humidity)</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.05&Omega;)</div>
        <div class="env-detail">1000h @ 85&deg;C, 85% RH</div>
      </div>
      <div class="env-card">
        <div class="env-name">Rapid Temp Change</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.05&Omega;)</div>
        <div class="env-detail">&minus;55&deg;C / +155&deg;C, 100 cycles</div>
      </div>
      <div class="env-card">
        <div class="env-name">Solder Heat</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.05&Omega;)</div>
        <div class="env-detail">260&plusmn;5&deg;C, 10&plusmn;1s</div>
      </div>
      <div class="env-card">
        <div class="env-name">Solderability</div>
        <div class="env-spec">&ge;95% wetting</div>
        <div class="env-detail">245&plusmn;3&deg;C, 2&plusmn;0.5s, Sn96.5/Ag3.0/Cu0.5</div>
      </div>
      <div class="env-card">
        <div class="env-name">Board Flex / Bending</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.05&Omega;)</div>
        <div class="env-detail">3mm deflection</div>
      </div>
      
      <div class="env-card">
        <div class="env-name">Anti-Sulfurized (H&#8322;S)</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1.0% + 0.1&Omega;)</div>
        <div class="env-detail">H&#8322;S 3&ndash;5 ppm, 50 &plusmn; 2&deg;C, 91&ndash;93% RH, 1000h</div>
      </div>
      <div class="env-card">
        <div class="env-name">Anti-Sulfurized (ASTM B-809-95)</div>
        <div class="env-spec">&Delta;R &le; &plusmn;(1% + 0.05&Omega;)</div>
        <div class="env-detail">Sulfur saturated vapor, 50 &plusmn; 2&deg;C, 85&ndash;90% RH, 1000h</div>
      </div>
    </div>
  </div>  <!-- Symbol, Footprint & 3D View -->
  <div class="section">
    <h2 class="section-title">Symbol, Footprint &amp; 3D Model</h2>
    <div class="grid-2" style="margin-bottom:12px">
      <!-- Interactive SymView -->
      <div class="card" style="padding:0;overflow:hidden">
        <div style="font-size:12px;font-weight:500;text-transform:uppercase;letter-spacing:0.5px;color:var(--text-dim);padding:12px 16px 0">Schematic Symbol</div>
        <iframe src="CQ02WGF470KTCE-symview.html" style="width:100%;height:340px;border:none;display:block" allow="fullscreen"></iframe>
      </div>
      <!-- Interactive FpView -->
      <div class="card" style="padding:0;overflow:hidden">
        <div style="font-size:12px;font-weight:500;text-transform:uppercase;letter-spacing:0.5px;color:var(--text-dim);padding:12px 16px 0">Footprint (0402) &mdash; with solder jetting layout</div>
        <iframe src="CQ02WGF470KTCE-fpview.html" style="width:100%;height:340px;border:none;display:block" allow="fullscreen"></iframe>
      </div>
    </div>
    <!-- 3D Model -->
    <div class="card" style="text-align:center;margin-bottom:12px">
      <div style="font-size:12px;font-weight:500;text-transform:uppercase;letter-spacing:0.5px;color:var(--text-dim);margin-bottom:12px">3D Model (interactive)</div>
      <canvas id="viewer3d" width="600" height="300" style="width:100%;height:300px;border-radius:4px;cursor:grab"></canvas>
      <div style="font-size:10px;color:var(--text-dim);margin-top:6px">Click &amp; drag to rotate &middot; Scroll to zoom</div>
    </div>
    <!-- Download / Export Bar -->
    <div class="card" style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
      <span style="font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.5px">Export:</span>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/CQ02WGF470KTCE.kicad_sym" download>KiCad Symbol (.kicad_sym)</a>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/CQ02WGF470KTCE.kicad_mod" download>KiCad Footprint (.kicad_mod)</a>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/CQ02WGF470KTCE.lbr" download>Fusion 360 (.lbr)</a>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/CQ02WGF470KTCE.step" download>3D Model (.step)</a>
    </div>
  </div>

  <div class="section">
    <h2 class="section-title">Pricing &amp; Availability</h2>
    <div class="vendor-cards">
      <div class="vendor-card recommended">
        <div class="vc-name mouser">Mouser Electronics</div>
        <div class="vc-price">&mdash;</div>
        <div class="vc-detail">Search for current pricing</div>
        <div class="vc-detail">PN: CQ02WGF470KTCE</div>
        <a class="vc-link" href="https://www.mouser.com/c/?q=CQ02WGF470KTCE" target="_blank">Search on Mouser &rarr;</a>
      </div>
      <div class="vendor-card">
        <div class="vc-name digikey">DigiKey</div>
        <div class="vc-price">&mdash;</div>
        <div class="vc-detail">Search for current pricing</div>
        <a class="vc-link" href="https://www.digikey.com/en/products/result?keywords=CQ02WGF470KTCE" target="_blank">Search on DigiKey &rarr;</a>
      </div>
      <div class="vendor-card">
        <div class="vc-name jlcpcb">JLCPCB / LCSC</div>
        <div class="vc-price">&mdash;</div>
        <div class="vc-detail">Search for availability</div>
        <a class="vc-link" href="https://www.lcsc.com/search?q=CQ02WGF470KTCE" target="_blank">Search on LCSC &rarr;</a>
      </div>
    </div>
    <div class="chart-note" style="margin-top:8px"><strong>Adom Basic Part</strong> &mdash; Always on hand, no shipping fee.</div>
  </div>

  <div class="section">
    <h2 class="section-title">Documents</h2>
    <div class="card">
      <table class="detail-table">
        <tr><td>Datasheet</td><td><button class="copy-btn" title="Copy link to clipboard" id="ds-copy-btn">&#x2398;</button>
<script>document.getElementById('ds-copy-btn').addEventListener('click',function(){var t=document.createElement('textarea');t.value='https://www.royalohm.com/pdf/product/thick_film_chip_resistors.pdf';document.body.appendChild(t);t.select();document.execCommand('copy');document.body.removeChild(t);this.textContent='Copied!';var b=this;setTimeout(function(){b.innerHTML='&#x2398;'},1500)});</script> <a href="https://www.royalohm.com/pdf/product/thick_film_chip_resistors.pdf" target="_blank">Royalohm Thick Film Chip Resistors (PDF) &rarr;</a></td></tr>
        <tr><td>Series</td><td>CQ02W</td></tr>
        <tr><td>Manufacturer</td><td>Royalohm</td></tr>
        <tr><td>Inventory Source</td><td><a href="https://inventory-2w8z8d9ojzzl.adom.cloud" target="_blank">Adom Parts Inventory &rarr;</a></td></tr>
      </table>
    </div>
  </div>

  <!-- Molecule -->
  <div class="section">
    <h2 class="section-title">Molecule &mdash; Single-Passive Board</h2>
    <div class="card" style="padding:0;overflow:hidden;border-radius:8px">
      <div style="font-size:12px;font-weight:500;text-transform:uppercase;letter-spacing:0.5px;color:var(--text-dim);padding:12px 16px 0">Interactive 3D Board Viewer</div>
      <iframe src="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/cq02wgf470ktce/tsci-viewer/molecule-viewer/index.html"
              style="width:100%;height:500px;border:none;border-radius:0 0 8px 8px;display:block"
              allow="fullscreen"></iframe>
    </div>
    <div style="font-size:11px;color:var(--text-dim);margin-top:8px;text-align:center">
      Orbit: click &amp; drag &middot; Zoom: scroll &middot; Inspect: click a component &middot; X-ray: toggle in toolbar
    </div>
  </div>

  <div class="source">
    CQ02WGF470KTCE characterization &middot; Data from Royalohm datasheet (CQ02W series) + adom-parts-search &middot; 2026-06-03
  </div>

</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/pmrem/PMREMGenerator.js"></script>
<script>
(function() {
  const canvas = document.getElementById('viewer3d');
  if (canvas && window.THREE) {
    const scene = new THREE.Scene();

    const renderer = new THREE.WebGLRenderer({ canvas, antialias: true, alpha: true, logarithmicDepthBuffer: true });
    renderer.setSize(canvas.width, canvas.height);
    renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
    renderer.outputEncoding = THREE.sRGBEncoding;
    renderer.toneMapping = THREE.ACESFilmicToneMapping;
    renderer.toneMappingExposure = 1.2;
    renderer.physicallyCorrectLights = true;

    canvas.style.background = 'linear-gradient(180deg, #5a6b7e 0%, #2a3340 100%)';

    const camera = new THREE.PerspectiveCamera(35, canvas.width / canvas.height, 0.01, 1000);

    const pmremGen = new THREE.PMREMGenerator(renderer);
    pmremGen.compileEquirectangularShader();
    const envScene = new THREE.Scene();
    envScene.background = new THREE.Color(0x3a4550);
    const envLight1 = new THREE.DirectionalLight(0xffffff, 2);
    envLight1.position.set(1, 3, 2);
    envScene.add(envLight1);
    const envLight2 = new THREE.DirectionalLight(0x8899bb, 1);
    envLight2.position.set(-2, 1, -1);
    envScene.add(envLight2);
    const envRT = pmremGen.fromScene(envScene, 0.04);
    scene.environment = envRT.texture;

    const hemi = new THREE.HemisphereLight(0xe6edf3, 0xb3a699, 0.5);
    scene.add(hemi);
    const keyLight = new THREE.DirectionalLight(0xffffff, 1.5);
    keyLight.position.set(2, 5, 3);
    scene.add(keyLight);
    const fillLight = new THREE.DirectionalLight(0x8899aa, 0.5);
    fillLight.position.set(-3, 2, -2);
    scene.add(fillLight);
    const rimLight = new THREE.DirectionalLight(0x00b8b0, 0.3);
    rimLight.position.set(0, -1, 3);
    scene.add(rimLight);

    const S = 2.5; // Scale factor (0402 is tiny, so scale up more)

    const bodyMat = new THREE.MeshStandardMaterial({ color: 0x1a1a2e, metalness: 0.0, roughness: 0.45 });
    const termMat = new THREE.MeshStandardMaterial({ color: 0xc8ccd1, metalness: 1.0, roughness: 0.25,
      polygonOffset: true, polygonOffsetFactor: -1, polygonOffsetUnits: -1 });
    const padMat = new THREE.MeshStandardMaterial({ color: 0xc9a04c, metalness: 1.0, roughness: 0.22 });
    const pcbMat = new THREE.MeshStandardMaterial({ color: 0x0a2a0a, metalness: 0.0, roughness: 0.6 });

    // Body: 1.0 x 0.5 x 0.32 mm
    const bodyW = 1.0, bodyD = 0.5, bodyH = 0.32;
    const termW = 0.20;
    const innerW = bodyW - termW * 2 + 0.02;
    const body = new THREE.Mesh(new THREE.BoxGeometry(innerW*S, bodyH*S, bodyD*S), bodyMat);
    body.position.y = bodyH*S/2;
    scene.add(body);

    // Terminals — no polarity mark
    function makeTerminal(xSign) {
      const group = new THREE.Group();
      const front = new THREE.Mesh(new THREE.BoxGeometry(termW*S, bodyH*S, bodyD*S*0.99), termMat);
      front.position.set(xSign*(bodyW/2 - termW/2)*S, bodyH*S/2, 0);
      group.add(front);
      const bot = new THREE.Mesh(new THREE.BoxGeometry((termW+0.04)*S, 0.04*S, bodyD*S*0.99), termMat);
      bot.position.set(xSign*(bodyW/2 - termW/2)*S, 0.02*S, 0);
      group.add(bot);
      const top = new THREE.Mesh(new THREE.BoxGeometry((termW+0.04)*S, 0.04*S, bodyD*S*0.99), termMat);
      top.position.set(xSign*(bodyW/2 - termW/2)*S, (bodyH-0.02)*S, 0);
      group.add(top);
      return group;
    }
    scene.add(makeTerminal(-1));
    scene.add(makeTerminal(1));

    // PCB
    const pcb = new THREE.Mesh(new THREE.BoxGeometry(12*S, 0.08*S, 10*S), pcbMat);
    pcb.position.y = -0.04*S;
    scene.add(pcb);

    // Gold ENIG pads
    const pad1 = new THREE.Mesh(new THREE.BoxGeometry(0.4*S, 0.025*S, 0.5*S), padMat);
    pad1.position.set(-0.4*S, 0.005*S, 0);
    scene.add(pad1);
    const pad2 = new THREE.Mesh(new THREE.BoxGeometry(0.4*S, 0.025*S, 0.5*S), padMat);
    pad2.position.set(0.4*S, 0.005*S, 0);
    scene.add(pad2);

    // Grid
    const gridMat2 = new THREE.LineBasicMaterial({ color: 0x0d3d0d, transparent: true, opacity: 0.3 });
    for (let i = -10; i <= 10; i++) {
      const pts1 = [new THREE.Vector3(i*0.5*S, 0.045*S, -5*S), new THREE.Vector3(i*0.5*S, 0.045*S, 5*S)];
      scene.add(new THREE.Line(new THREE.BufferGeometry().setFromPoints(pts1), gridMat2));
      const pts2 = [new THREE.Vector3(-5*S, 0.045*S, i*0.5*S), new THREE.Vector3(5*S, 0.045*S, i*0.5*S)];
      scene.add(new THREE.Line(new THREE.BufferGeometry().setFromPoints(pts2), gridMat2));
    }

    // Camera orbit
    let isDragging = false, prevX = 0, prevY = 0;
    let theta = Math.PI/4, phi = Math.PI/5.5, radius = 4.5;
    const target = new THREE.Vector3(0, 0.3, 0);

    function updateCamera() {
      camera.position.x = radius * Math.sin(theta) * Math.cos(phi);
      camera.position.y = radius * Math.sin(phi) + target.y;
      camera.position.z = radius * Math.cos(theta) * Math.cos(phi);
      camera.lookAt(target);
    }
    updateCamera();

    canvas.addEventListener('mousedown', e => { isDragging = true; prevX = e.clientX; prevY = e.clientY; canvas.style.cursor = 'grabbing'; });
    window.addEventListener('mouseup', () => { isDragging = false; canvas.style.cursor = 'grab'; });
    canvas.addEventListener('mousemove', e => {
      if (!isDragging) return;
      theta -= (e.clientX - prevX) * 0.008;
      phi = Math.max(0.05, Math.min(Math.PI/2.2, phi + (e.clientY - prevY) * 0.008));
      prevX = e.clientX; prevY = e.clientY;
      updateCamera();
    });
    canvas.addEventListener('wheel', e => {
      e.preventDefault();
      radius = Math.max(2, Math.min(10, radius + e.deltaY * 0.004));
      updateCamera();
    }, { passive: false });

    function animate() { requestAnimationFrame(animate); renderer.render(scene, camera); }
    animate();
  }


  // Derating chart tooltip
  (function() {
    const svg = document.getElementById('derating-chart');
    if (!svg) return;
    const ns = 'http://www.w3.org/2000/svg';

    // Key points on the derating curve: temp -> power %
    // -55C=100%, 70C=100%, 155C=0%
    function tempToX(t) { return 60 + (t - (-55)) / (170 - (-55)) * 600; }
    function pwrToY(pct) { return 220 - (pct / 120) * 200; }
    function getPower(t) {
      if (t <= 70) return 100;
      if (t >= 155) return 0;
      return 100 * (155 - t) / 85;
    }

    const dot = document.createElementNS(ns, 'circle');
    dot.setAttribute('r', '5');
    dot.setAttribute('fill', '#00b8b0');
    dot.setAttribute('stroke', '#0d1117');
    dot.setAttribute('stroke-width', '2');
    dot.style.display = 'none';
    dot.style.pointerEvents = 'none';
    svg.appendChild(dot);

    const vLine = document.createElementNS(ns, 'line');
    vLine.setAttribute('stroke', '#00b8b0');
    vLine.setAttribute('stroke-width', '0.5');
    vLine.setAttribute('stroke-dasharray', '3,3');
    vLine.setAttribute('opacity', '0.5');
    vLine.style.display = 'none';
    vLine.style.pointerEvents = 'none';
    svg.appendChild(vLine);

    const tipGroup = document.createElementNS(ns, 'g');
    tipGroup.style.display = 'none';
    tipGroup.style.pointerEvents = 'none';
    const tipBg = document.createElementNS(ns, 'rect');
    tipBg.setAttribute('rx', '4');
    tipBg.setAttribute('fill', '#161b22');
    tipBg.setAttribute('stroke', '#30363d');
    tipBg.setAttribute('stroke-width', '1');
    const tipLine1 = document.createElementNS(ns, 'text');
    tipLine1.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine1.setAttribute('font-size', '10');
    tipLine1.setAttribute('fill', '#e6edf3');
    const tipLine2 = document.createElementNS(ns, 'text');
    tipLine2.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine2.setAttribute('font-size', '10');
    tipLine2.setAttribute('fill', '#00b8b0');
    tipGroup.appendChild(tipBg);
    tipGroup.appendChild(tipLine1);
    tipGroup.appendChild(tipLine2);
    svg.appendChild(tipGroup);

    svg.addEventListener('mousemove', function(e) {
      const pt = svg.createSVGPoint();
      pt.x = e.clientX; pt.y = e.clientY;
      const svgPt = pt.matrixTransform(svg.getScreenCTM().inverse());

      const minX = tempToX(-55), maxX = tempToX(155);
      if (svgPt.x < minX - 10 || svgPt.x > maxX + 10) {
        dot.style.display = 'none'; tipGroup.style.display = 'none'; vLine.style.display = 'none';
        return;
      }

      // Convert SVG x back to temperature
      const temp = ((svgPt.x - 60) / 600) * (170 - (-55)) + (-55);
      const clampedTemp = Math.max(-55, Math.min(155, temp));
      const pwr = getPower(clampedTemp);
      const cx = tempToX(clampedTemp);
      const cy = pwrToY(pwr);

      dot.setAttribute('cx', cx);
      dot.setAttribute('cy', cy);
      dot.style.display = '';

      vLine.setAttribute('x1', cx); vLine.setAttribute('y1', cy);
      vLine.setAttribute('x2', cx); vLine.setAttribute('y2', 220);
      vLine.style.display = '';

      const xLabel = clampedTemp.toFixed(0) + String.fromCharCode(176) + 'C';
      const yLabel = 'Power: ' + pwr.toFixed(1) + '% (' + (pwr * 0.625).toFixed(1) + 'mW)';

      tipLine1.textContent = xLabel;
      tipLine2.textContent = yLabel;

      const tipX = cx + 12, tipY = cy - 28;
      const boxW = Math.max(xLabel.length, yLabel.length) * 7 + 16;
      const boxH = 32;
      const adjustedX = tipX + boxW > 660 ? cx - boxW - 12 : tipX;
      const adjustedY = tipY < 10 ? cy + 12 : tipY;

      tipBg.setAttribute('x', adjustedX); tipBg.setAttribute('y', adjustedY);
      tipBg.setAttribute('width', boxW); tipBg.setAttribute('height', boxH);
      tipLine1.setAttribute('x', adjustedX + 8); tipLine1.setAttribute('y', adjustedY + 13);
      tipLine2.setAttribute('x', adjustedX + 8); tipLine2.setAttribute('y', adjustedY + 26);
      tipGroup.style.display = '';
    });

    svg.addEventListener('mouseleave', function() {
      dot.style.display = 'none'; tipGroup.style.display = 'none'; vLine.style.display = 'none';
    });
  })();


  // Reflow chart tooltip
  (function() {
    const svg = document.getElementById('reflow-chart');
    if (!svg) return;
    const ns = 'http://www.w3.org/2000/svg';

    const reflowStd = [
      {sx:80,  sy:185, vx:0,   vy:25},
      {sx:180, sy:145, vx:50,  vy:150},
      {sx:300, sy:145, vx:170, vy:150},
      {sx:370, sy:90,  vx:200, vy:220},
      {sx:420, sy:30,  vx:220, vy:255},
      {sx:460, sy:30,  vx:240, vy:255},
      {sx:500, sy:90,  vx:260, vy:220},
      {sx:580, sy:145, vx:300, vy:150},
      {sx:660, sy:185, vx:360, vy:25},
    ];
    const reflowLim = [
      {sx:80,  sy:185, vx:0,   vy:25},
      {sx:180, sy:145, vx:50,  vy:150},
      {sx:300, sy:145, vx:170, vy:150},
      {sx:360, sy:80,  vx:195, vy:230},
      {sx:410, sy:18,  vx:215, vy:260},
      {sx:470, sy:18,  vx:240, vy:260},
      {sx:510, sy:80,  vx:260, vy:230},
      {sx:580, sy:145, vx:300, vy:150},
      {sx:660, sy:185, vx:360, vy:25},
    ];

    const curves = [
      { data: reflowStd, color: '#d29922', label: 'Standard' },
      { data: reflowLim, color: '#f85149', label: 'Limit' },
    ];
    let activeIdx = 0;

    const dot = document.createElementNS(ns, 'circle');
    dot.setAttribute('r', '5');
    dot.setAttribute('stroke', '#0d1117');
    dot.setAttribute('stroke-width', '2');
    dot.style.display = 'none';
    dot.style.pointerEvents = 'none';
    svg.appendChild(dot);

    const vLine = document.createElementNS(ns, 'line');
    vLine.setAttribute('stroke-width', '0.5');
    vLine.setAttribute('stroke-dasharray', '3,3');
    vLine.setAttribute('opacity', '0.5');
    vLine.style.display = 'none';
    vLine.style.pointerEvents = 'none';
    svg.appendChild(vLine);

    const tipGroup = document.createElementNS(ns, 'g');
    tipGroup.style.display = 'none';
    tipGroup.style.pointerEvents = 'none';
    const tipBg = document.createElementNS(ns, 'rect');
    tipBg.setAttribute('rx', '4');
    tipBg.setAttribute('fill', '#161b22');
    tipBg.setAttribute('stroke', '#30363d');
    tipBg.setAttribute('stroke-width', '1');
    const tipLine1 = document.createElementNS(ns, 'text');
    tipLine1.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine1.setAttribute('font-size', '10');
    tipLine1.setAttribute('fill', '#e6edf3');
    const tipLine2 = document.createElementNS(ns, 'text');
    tipLine2.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine2.setAttribute('font-size', '10');
    const tipLine3 = document.createElementNS(ns, 'text');
    tipLine3.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine3.setAttribute('font-size', '9');
    tipLine3.setAttribute('fill', '#484f58');
    tipGroup.appendChild(tipBg);
    tipGroup.appendChild(tipLine1);
    tipGroup.appendChild(tipLine2);
    tipGroup.appendChild(tipLine3);
    svg.appendChild(tipGroup);

    function setActive(idx) {
      activeIdx = idx;
      const c = curves[idx];
      dot.setAttribute('fill', c.color);
      vLine.setAttribute('stroke', c.color);
      tipLine2.setAttribute('fill', c.color);
    }
    setActive(0);

    function lerp(pts, svgX) {
      if (svgX <= pts[0].sx) return pts[0];
      if (svgX >= pts[pts.length-1].sx) return pts[pts.length-1];
      for (let i = 0; i < pts.length - 1; i++) {
        if (svgX >= pts[i].sx && svgX <= pts[i+1].sx) {
          const t = (svgX - pts[i].sx) / (pts[i+1].sx - pts[i].sx);
          return {
            sx: svgX,
            sy: pts[i].sy + t * (pts[i+1].sy - pts[i].sy),
            vx: pts[i].vx + t * (pts[i+1].vx - pts[i].vx),
            vy: pts[i].vy + t * (pts[i+1].vy - pts[i].vy),
          };
        }
      }
      return pts[0];
    }

    svg.addEventListener('click', function() { setActive((activeIdx + 1) % curves.length); });

    svg.addEventListener('mousemove', function(e) {
      const pt = svg.createSVGPoint();
      pt.x = e.clientX; pt.y = e.clientY;
      const svgPt = pt.matrixTransform(svg.getScreenCTM().inverse());
      const c = curves[activeIdx];
      const minX = c.data[0].sx, maxX = c.data[c.data.length-1].sx;
      if (svgPt.x < minX - 10 || svgPt.x > maxX + 10) {
        dot.style.display = 'none'; tipGroup.style.display = 'none'; vLine.style.display = 'none';
        return;
      }
      const p = lerp(c.data, svgPt.x);
      dot.setAttribute('cx', p.sx); dot.setAttribute('cy', p.sy); dot.style.display = '';
      vLine.setAttribute('x1', p.sx); vLine.setAttribute('y1', p.sy);
      vLine.setAttribute('x2', p.sx); vLine.setAttribute('y2', 195); vLine.style.display = '';

      const xLabel = p.vx.toFixed(0) + 's';
      const yLabel = 'Temp = ' + p.vy.toFixed(0) + String.fromCharCode(176) + 'C';
      const curveLabel = 'Click to switch ' + String.fromCharCode(8226) + ' ' + c.label;
      tipLine1.textContent = xLabel;
      tipLine2.textContent = yLabel;
      tipLine3.textContent = curveLabel;

      const tipX = p.sx + 12, tipY = p.sy - 38;
      const boxW = Math.max(xLabel.length, yLabel.length, curveLabel.length) * 6.5 + 16;
      const boxH = 44;
      const adjustedX = tipX + boxW > 660 ? p.sx - boxW - 12 : tipX;
      const adjustedY = tipY < 10 ? p.sy + 12 : tipY;

      tipBg.setAttribute('x', adjustedX); tipBg.setAttribute('y', adjustedY);
      tipBg.setAttribute('width', boxW); tipBg.setAttribute('height', boxH);
      tipLine1.setAttribute('x', adjustedX + 8); tipLine1.setAttribute('y', adjustedY + 13);
      tipLine2.setAttribute('x', adjustedX + 8); tipLine2.setAttribute('y', adjustedY + 26);
      tipLine3.setAttribute('x', adjustedX + 8); tipLine3.setAttribute('y', adjustedY + 39);
      tipGroup.style.display = '';
    });

    svg.addEventListener('mouseleave', function() {
      dot.style.display = 'none'; tipGroup.style.display = 'none'; vLine.style.display = 'none';
    });

    svg.style.cursor = 'pointer';
  })();

})();
</script>
</div>
</body>
</html>