12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IN-S42ATUW — 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;
    --led-color: #E8E8E8; --led-color-dim: #E8E8E81e; --led-color-border: #E8E8E859;
  }
  * { 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(--led-color); }
  .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: var(--led-color-dim); color: var(--led-color); }

  .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(--led-color-border); background: linear-gradient(180deg, #E8E8E80f, var(--surface)); }
  .spec-card.highlight .sc-value { color: var(--led-color); }

  .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; }

  .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; cursor: pointer; border: none; }
  .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; }

  .color-swatch { border-radius: 8px; padding: 20px; text-align: center; position: relative; overflow: hidden; }
  .color-swatch .swatch-block { width: 100%; height: 80px; border-radius: 6px; margin-bottom: 12px; position: relative; }
  .color-swatch .swatch-label { font-size: 14px; font-weight: 600; font-family: 'Familjen Grotesk', sans-serif; }
  .color-swatch .swatch-detail { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

  .calc-card { background: var(--surface); border: 1px solid var(--led-color-border); border-radius: 8px; padding: 20px; }
  .calc-card h3 { font-size: 14px; color: var(--led-color); margin-bottom: 16px; font-family: 'Familjen Grotesk', sans-serif; }
  .calc-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
  .calc-field label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
  .calc-field input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 8px 12px; font-family: 'JetBrains Mono', monospace; font-size: 14px; outline: none; transition: border-color 0.15s; }
  .calc-field input:focus { border-color: var(--led-color); }
  .calc-field .unit { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
  .calc-results { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .calc-result { background: var(--bg); border: 1px solid var(--border-muted); border-radius: 6px; padding: 10px 12px; }
  .calc-result .cr-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 2px; }
  .calc-result .cr-value { font-size: 18px; font-weight: 700; font-family: 'Familjen Grotesk', sans-serif; color: var(--led-color); }
  .calc-result .cr-detail { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
  .calc-schematic { margin-top: 16px; text-align: center; }
</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/in-s42atuw/IN-S42ATUW.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/in-s42atuw/IN-S42ATUW.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; LEDs &rsaquo; 0402</div>
  </div>
  <h1>IN-S42ATUW &mdash; <span class="val">White</span></h1>
  <div class="subtitle">Inolux Corporation &middot; Top View SMD LED &middot; 0402 (1.0 &times; 0.5mm) &middot; InGaN</div>
  <div class="tags">
    <span class="tag pkg">0402</span>
    <span class="tag mfr">Inolux</span>
    <span class="tag series">IN-S42AT</span>
    <span class="tag rohs">RoHS</span>
    <span class="tag app">White LED</span>
  </div>
</div>

<div class="container">

  <!-- Key Specs -->
  <div class="section">
    <div class="spec-cards">
      <div class="spec-card highlight">
        <div class="sc-label">Chromaticity</div>
        <div class="sc-value">CIE</div>
        <div class="sc-detail">x=0.295, y=0.3</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Luminous Intensity</div>
        <div class="sc-value">600mcd</div>
        <div class="sc-detail">@ 20mA</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Forward Voltage</div>
        <div class="sc-value">3.1V</div>
        <div class="sc-detail">max 4.0V</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Forward Current</div>
        <div class="sc-value">25mA</div>
        <div class="sc-detail">20mA typical</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Viewing Angle</div>
        <div class="sc-value">130&deg;</div>
        <div class="sc-detail">2&theta;&frac12;</div>
      </div>
      <div class="spec-card">
        <div class="sc-label">Power Dissipation</div>
        <div class="sc-value">100mW</div>
        <div class="sc-detail">max rated</div>
      </div>
    </div>
  </div>

  <div class="grid-2">
    <!-- Left column -->
    <div>
      <!-- Electrical Characteristics -->
      <div class="section">
        <h2 class="section-title">Electrical Characteristics</h2>
        <div class="card">
          <table class="detail-table">
            <tr><td>Forward Voltage (typ)</td><td>3.1V @ 20mA</td></tr>
            <tr><td>Forward Voltage (max)</td><td>4.0V @ 20mA</td></tr>
            <tr><td>Reverse Voltage (max)</td><td>5V</td></tr>
            <tr><td>Forward Current (max)</td><td>25mA</td></tr>
            <tr><td>Peak Forward Current</td><td>100mA (1/10, 0.1ms)</td></tr>
            <tr><td>Power Dissipation</td><td>100mW</td></tr>
            <tr><td>Chromaticity (CIE x)</td><td>0.295</td></tr>
            <tr><td>Chromaticity (CIE y)</td><td>0.3</td></tr>
            <tr><td>Luminous Intensity</td><td>600 mcd @ 20mA</td></tr>
            <tr><td>Viewing Angle (2&theta;&frac12;)</td><td>130&deg;</td></tr>
            <tr><td>Material</td><td>InGaN</td></tr>
            <tr><td>Lens Type</td><td>Clear</td></tr>
          </table>
        </div>
      </div>

      <!-- Operating Conditions -->
      <div class="section">
        <h2 class="section-title">Operating Conditions</h2>
        <div class="card">
          <table class="detail-table">
            <tr><td>Operating Temp</td><td>&minus;30&deg;C to +80&deg;C</td></tr>
            <tr><td>Storage Temp</td><td>&minus;40&deg;C to +85&deg;C</td></tr>
            <tr><td>ESD Sensitivity</td><td>InGaN &mdash; ESD precautions required</td></tr>
            <tr><td>Polarity</td><td>Cathode marked on package</td></tr>
          </table>
          <div style="margin-top:10px;padding:8px 12px;background:rgba(248,81,73,0.08);border:1px solid rgba(248,81,73,0.2);border-radius:6px;font-size:11px;color:var(--red)">
            &#9888; ESD Sensitive Device &mdash; InGaN LEDs require proper ESD precautions during handling and assembly. Use grounded wrist straps and ESD-safe workstations.
          </div>
        </div>
      </div>
    </div>

    <!-- Right column -->
    <div>
      <!-- Package Drawing -->
      <div class="section">
        <h2 class="section-title">Package &amp; Dimensions</h2>
        <div class="card">
          <div class="pkg-drawing">
            <svg width="100%" height="200" viewBox="0 0 500 200">
              <!-- Top view -->
              <text x="120" y="14" fill="#8b949e" font-size="10" text-anchor="middle">Top View</text>
              <rect x="55" y="24" width="130" height="65" rx="2" fill="#1c2128" stroke="#30363d" stroke-width="1.5"/>
              <rect x="55" y="24" width="25" height="65" rx="1" fill="#E8E8E826" stroke="#E8E8E8" stroke-width="1"/>
              <rect x="160" y="24" width="25" height="65" rx="1" fill="#E8E8E826" stroke="#E8E8E8" stroke-width="1"/>
              <line x1="155" y1="28" x2="155" y2="85" stroke="#E8E8E8" stroke-width="1.5" stroke-dasharray="3,2"/>
              <rect x="92" y="38" width="36" height="37" rx="1" fill="#E8E8E840" stroke="#E8E8E880" stroke-width="0.8"/>
              <path d="M110,47 Q125,35 135,47" stroke="#E8E8E899" stroke-width="0.6" fill="none"/>
              <text x="168" y="18" fill="#E8E8E8" font-size="9" text-anchor="middle">K (cathode)</text>
              <text x="68" y="18" fill="#8b949e" font-size="9" text-anchor="middle">A</text>

              <line x1="55" y1="102" x2="185" y2="102" stroke="#484f58" stroke-width="0.5"/>
              <line x1="55" y1="98" x2="55" y2="106" stroke="#484f58" stroke-width="0.5"/>
              <line x1="185" y1="98" x2="185" y2="106" stroke="#484f58" stroke-width="0.5"/>
              <text x="120" y="118" fill="#e6edf3" font-size="10" text-anchor="middle">1.0 &plusmn; 0.1</text>

              <line x1="195" y1="24" x2="195" y2="89" stroke="#484f58" stroke-width="0.5"/>
              <line x1="191" y1="24" x2="199" y2="24" stroke="#484f58" stroke-width="0.5"/>
              <line x1="191" y1="89" x2="199" y2="89" stroke="#484f58" stroke-width="0.5"/>
              <text x="215" y="60" fill="#e6edf3" font-size="10">0.5 &plusmn; 0.1</text>

              <!-- Side view -->
              <text x="380" y="14" fill="#8b949e" font-size="10" text-anchor="middle">Side View</text>
              <rect x="315" y="40" width="130" height="38" rx="2" fill="#1c2128" stroke="#30363d" stroke-width="1.5"/>
              <path d="M320,40 Q380,30 445,40" stroke="#E8E8E880" stroke-width="1.5" fill="#E8E8E814"/>
              <rect x="315" y="40" width="20" height="38" rx="1" fill="#E8E8E826" stroke="#E8E8E8" stroke-width="1"/>
              <rect x="425" y="40" width="20" height="38" rx="1" fill="#E8E8E826" stroke="#E8E8E8" stroke-width="1"/>
              <line x1="455" y1="30" x2="455" y2="78" stroke="#484f58" stroke-width="0.5"/>
              <line x1="451" y1="30" x2="459" y2="30" stroke="#484f58" stroke-width="0.5"/>
              <line x1="451" y1="78" x2="459" y2="78" stroke="#484f58" stroke-width="0.5"/>
              <text x="465" y="58" fill="#e6edf3" font-size="10">0.45 &plusmn; 0.1</text>

              <text x="120" y="145" fill="#8b949e" font-size="10" text-anchor="middle">0402 (1005 metric)</text>
              <text x="380" y="100" fill="#8b949e" font-size="10" text-anchor="middle">Clear lens &middot; InGaN</text>

              <rect x="55" y="158" width="390" height="28" rx="4" fill="#E8E8E80f" stroke="#E8E8E833" stroke-width="0.5"/>
              <text x="250" y="176" fill="#E8E8E8" font-size="10" text-anchor="middle">&#9888; Polarized &mdash; cathode mark on package indicates negative terminal</text>
            </svg>
          </div>
        </div>
      </div>

      <!-- Land Pattern -->
      <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.4 &plusmn; 0.1mm</td></tr>
            <tr><td>Pad Height</td><td>0.6 &plusmn; 0.1mm</td></tr>
            <tr><td>Pad Spacing (center-to-center)</td><td>0.6 &plusmn; 0.1mm</td></tr>
            <tr><td>Polarity</td><td>Cathode marked on PCB</td></tr>
          </table>
        </div>
      </div>
    </div>
  </div>

  <!-- Color Swatch -->
  <div class="section">
    <h2 class="section-title">Emission Color</h2>
    <div class="card color-swatch">
      <div class="swatch-block" style="background: linear-gradient(135deg, #E8E8E8, #FFFAF0); box-shadow: 0 4px 24px rgba(255,255,255,0.3); display:flex; align-items:center; justify-content:center;">
        <span style="font-size:28px;font-weight:700;font-family:'Familjen Grotesk',sans-serif;color:#333;text-shadow:0 2px 8px rgba(0,0,0,0.5)">White</span>
      </div>
      <div class="swatch-label" style="color:#E8E8E8">Cool White &mdash; CIE x=0.295, y=0.3</div>
      <div class="swatch-detail">Blue die + yellow phosphor (InGaN) &middot; Broadband emission &middot; CSS approximation: #F5F5DC</div>
    </div>
  </div>

  <!-- Spectral Distribution -->
  <div class="section">
    <h2 class="section-title">Spectral Distribution</h2>
    <div class="chart-wrap">
      <h3>Emission Spectrum &mdash; Relative Intensity vs. Wavelength</h3>
      <svg id="spectral-chart" width="100%" height="280" viewBox="0 0 700 280">
        <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="170" x2="660" y2="170" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="120" x2="660" y2="120" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="70" x2="660" y2="70" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="20" x2="660" y2="20" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="180" y1="20" x2="180" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="300" y1="20" x2="300" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="420" y1="20" x2="420" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="540" y1="20" x2="540" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>

        <path d="M-90,220 L-90,48 L-87,47 L-84,47 L-81,47 L-78,48 L-75,49 L-72,51 L-69,54 L-66,56 L-63,59 L-60,63 L-57,67 L-54,70 L-51,74 L-48,79 L-45,83 L-42,87 L-39,91 L-36,95 L-33,98 L-30,102 L-27,105 L-24,108 L-21,111 L-18,113 L-15,116 L-12,118 L-9,119 L-6,120 L-3,121 L0,122 L3,123 L6,123 L9,123 L12,122 L15,122 L18,121 L21,120 L24,119 L27,118 L30,117 L33,115 L36,113 L39,112 L42,110 L45,108 L48,106 L51,104 L54,102 L57,100 L60,98 L63,96 L66,94 L69,92 L72,90 L75,88 L78,85 L81,83 L84,81 L87,79 L90,77 L93,75 L96,73 L99,71 L102,69 L105,66 L108,64 L111,62 L114,60 L117,59 L120,57 L123,55 L126,53 L129,51 L132,49 L135,48 L138,46 L141,44 L144,43 L147,41 L150,40 L153,38 L156,37 L159,35 L162,34 L165,33 L168,32 L171,30 L174,29 L177,28 L180,27 L183,26 L186,26 L189,25 L192,24 L195,23 L198,23 L201,22 L204,22 L207,21 L210,21 L213,21 L216,20 L219,20 L222,20 L225,20 L228,20 L231,20 L234,20 L237,21 L240,21 L243,21 L246,22 L249,22 L252,23 L255,23 L258,24 L261,25 L264,26 L267,26 L270,27 L273,28 L276,29 L279,30 L282,32 L285,33 L288,34 L291,35 L294,37 L297,38 L300,40 L303,41 L306,43 L309,44 L312,46 L315,48 L318,49 L321,51 L324,53 L327,55 L330,57 L333,59 L336,61 L339,62 L342,64 L345,66 L348,69 L351,71 L354,73 L357,75 L360,77 L363,79 L366,81 L369,83 L372,86 L375,88 L378,90 L381,92 L384,94 L387,96 L390,99 L393,101 L396,103 L399,105 L402,108 L405,110 L408,112 L411,114 L414,116 L417,118 L420,121 L423,123 L426,125 L429,127 L432,129 L435,131 L438,133 L441,135 L444,137 L447,139 L450,141 L453,143 L456,145 L459,147 L462,149 L465,151 L468,152 L471,154 L474,156 L477,158 L480,159 L483,161 L486,163 L489,164 L492,166 L495,168 L498,169 L501,171 L504,172 L507,174 L510,175 L513,176 L516,178 L519,179 L522,180 L525,182 L528,183 L531,184 L534,185 L537,187 L540,188 L543,189 L546,190 L549,191 L552,192 L555,193 L558,194 L561,195 L564,196 L567,197 L570,198 L573,198 L576,199 L579,200 L582,201 L585,201 L588,202 L591,203 L594,204 L597,204 L600,205 L603,205 L606,206 L609,207 L612,207 L615,208 L618,208 L621,209 L624,209 L627,210 L630,210 L633,211 L636,211 L639,211 L642,212 L645,212 L648,213 L651,213 L654,213 L657,214 L660,214 L660,220 Z" fill="url(#INS42ATUWGrad)" opacity="0.3"/>
        <defs>
          <linearGradient id="INS42ATUWGrad" x1="0" y1="0" x2="0" y2="1">
            <stop offset="0%" stop-color="#E8E8E8" stop-opacity="0.6"/>
            <stop offset="100%" stop-color="#E8E8E8" stop-opacity="0.05"/>
          </linearGradient>
        </defs>
        <path d="M-90,220 L-90,48 L-87,47 L-84,47 L-81,47 L-78,48 L-75,49 L-72,51 L-69,54 L-66,56 L-63,59 L-60,63 L-57,67 L-54,70 L-51,74 L-48,79 L-45,83 L-42,87 L-39,91 L-36,95 L-33,98 L-30,102 L-27,105 L-24,108 L-21,111 L-18,113 L-15,116 L-12,118 L-9,119 L-6,120 L-3,121 L0,122 L3,123 L6,123 L9,123 L12,122 L15,122 L18,121 L21,120 L24,119 L27,118 L30,117 L33,115 L36,113 L39,112 L42,110 L45,108 L48,106 L51,104 L54,102 L57,100 L60,98 L63,96 L66,94 L69,92 L72,90 L75,88 L78,85 L81,83 L84,81 L87,79 L90,77 L93,75 L96,73 L99,71 L102,69 L105,66 L108,64 L111,62 L114,60 L117,59 L120,57 L123,55 L126,53 L129,51 L132,49 L135,48 L138,46 L141,44 L144,43 L147,41 L150,40 L153,38 L156,37 L159,35 L162,34 L165,33 L168,32 L171,30 L174,29 L177,28 L180,27 L183,26 L186,26 L189,25 L192,24 L195,23 L198,23 L201,22 L204,22 L207,21 L210,21 L213,21 L216,20 L219,20 L222,20 L225,20 L228,20 L231,20 L234,20 L237,21 L240,21 L243,21 L246,22 L249,22 L252,23 L255,23 L258,24 L261,25 L264,26 L267,26 L270,27 L273,28 L276,29 L279,30 L282,32 L285,33 L288,34 L291,35 L294,37 L297,38 L300,40 L303,41 L306,43 L309,44 L312,46 L315,48 L318,49 L321,51 L324,53 L327,55 L330,57 L333,59 L336,61 L339,62 L342,64 L345,66 L348,69 L351,71 L354,73 L357,75 L360,77 L363,79 L366,81 L369,83 L372,86 L375,88 L378,90 L381,92 L384,94 L387,96 L390,99 L393,101 L396,103 L399,105 L402,108 L405,110 L408,112 L411,114 L414,116 L417,118 L420,121 L423,123 L426,125 L429,127 L432,129 L435,131 L438,133 L441,135 L444,137 L447,139 L450,141 L453,143 L456,145 L459,147 L462,149 L465,151 L468,152 L471,154 L474,156 L477,158 L480,159 L483,161 L486,163 L489,164 L492,166 L495,168 L498,169 L501,171 L504,172 L507,174 L510,175 L513,176 L516,178 L519,179 L522,180 L525,182 L528,183 L531,184 L534,185 L537,187 L540,188 L543,189 L546,190 L549,191 L552,192 L555,193 L558,194 L561,195 L564,196 L567,197 L570,198 L573,198 L576,199 L579,200 L582,201 L585,201 L588,202 L591,203 L594,204 L597,204 L600,205 L603,205 L606,206 L609,207 L612,207 L615,208 L618,208 L621,209 L624,209 L627,210 L630,210 L633,211 L636,211 L639,211 L642,212 L645,212 L648,213 L651,213 L654,213 L657,214 L660,214 L660,220" stroke="#E8E8E8" stroke-width="2.5" fill="none"/>


        <!-- Blue die peak -->
        <circle cx="-90" cy="80" r="4" fill="#4169E1" opacity="0.9"/>
        <line x1="-90" y1="80" x2="-90" y2="220" stroke="#4169E1" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.4"/>
        <text x="-90" y="238" fill="#4169E1" font-size="10" text-anchor="middle">450nm</text>

        <!-- Phosphor peak -->
        <circle cx="225" cy="20" r="4" fill="#E8E8E8" opacity="0.9"/>
        <line x1="225" y1="20" x2="225" y2="220" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.4"/>
        <text x="225" y="248" fill="#E8E8E8" font-size="10" text-anchor="middle">555nm</text>

        <!-- Broad emission label -->
        <text x="420" y="116" fill="#8b949e" font-size="9">Broad phosphor emission</text>


        <text x="55" y="224" fill="#484f58" font-size="9" text-anchor="end">0%</text>
        <text x="55" y="174" fill="#484f58" font-size="9" text-anchor="end">25%</text>
        <text x="55" y="124" fill="#484f58" font-size="9" text-anchor="end">50%</text>
        <text x="55" y="74" fill="#484f58" font-size="9" text-anchor="end">75%</text>
        <text x="55" y="24" fill="#484f58" font-size="9" text-anchor="end">100%</text>
        <text x="12" y="124" fill="#484f58" font-size="9" text-anchor="middle" transform="rotate(-90,12,124)">Relative Intensity</text>

        <text x="60" y="255" fill="#484f58" font-size="9" text-anchor="middle">500</text>
        <text x="180" y="255" fill="#484f58" font-size="9" text-anchor="middle">540</text>
        <text x="300" y="255" fill="#484f58" font-size="9" text-anchor="middle">580</text>
        <text x="420" y="255" fill="#484f58" font-size="9" text-anchor="middle">620</text>
        <text x="540" y="255" fill="#484f58" font-size="9" text-anchor="middle">660</text>
        <text x="660" y="255" fill="#484f58" font-size="9" text-anchor="middle">700</text>
        <text x="360" y="272" fill="#484f58" font-size="9" text-anchor="middle">Wavelength (nm)</text>
      </svg>
      <div class="chart-note">White LED emission from InGaN blue die (~450nm) combined with yellow phosphor conversion (~555nm peak). The broad spectral output produces cool white light (CIE x=0.295, y=0.30) with high CRI potential.</div>
    </div>
  </div>

  <!-- IV Curve -->
  <div class="section">
    <h2 class="section-title">Forward Current vs. Forward Voltage</h2>
    <div class="chart-wrap">
      <h3>IV Characteristic &mdash; the essential curve for circuit design</h3>
      <svg id="iv-chart" width="100%" height="280" viewBox="0 0 700 280">
        <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="170" x2="660" y2="170" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="120" x2="660" y2="120" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="70" x2="660" y2="70" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="20" x2="660" y2="20" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="180" y1="20" x2="180" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="300" y1="20" x2="300" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="420" y1="20" x2="420" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="540" y1="20" x2="540" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>


        <path d="M60,220 L216,220 L294,220 L341,219 L356,218 L372,216 L387,212 L402,200 L417,180 L432,140 L459,120 L486,100 L513,70 L540,20" stroke="#E8E8E8" stroke-width="2.5" fill="none"/>
        <path d="M60,220 L216,220 L294,220 L341,219 L356,218 L372,216 L387,212 L402,200 L417,180 L432,140 L459,120 L486,100 L513,70 L540,20 L540,220 L60,220 Z" fill="url(#INS42ATUWGrad)" opacity="0.15"/>

        <!-- Operating point -->
        <circle cx="432" cy="140" r="5" fill="#E8E8E8" opacity="0.9"/>
        <line x1="432" y1="140" x2="432" y2="220" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.5"/>
        <line x1="60" y1="140" x2="432" y2="140" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.5"/>
        <rect x="437" y="126" width="108" height="28" rx="4" fill="#E8E8E81e"/>
        <text x="491" y="139" fill="#E8E8E8" font-size="10" text-anchor="middle">Typ: 3.1V, 20mA</text>
        <text x="491" y="149" fill="#8b949e" font-size="8" text-anchor="middle">Operating point</text>

        <!-- Max Vf -->
        <line x1="540" y1="20" x2="540" y2="220" stroke="#f85149" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.5"/>
        <text x="540" y="248" fill="#f85149" font-size="9" text-anchor="middle">4.0V max</text>

        <!-- Max If -->
        <line x1="60" y1="120" x2="660" y2="120" stroke="#f85149" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.3"/>
        <text x="100" y="114" fill="#f85149" font-size="9">25mA max</text>

        <text x="55" y="224" fill="#484f58" font-size="9" text-anchor="end">0</text>
        <text x="55" y="174" fill="#484f58" font-size="9" text-anchor="end">12.5</text>
        <text x="55" y="124" fill="#484f58" font-size="9" text-anchor="end">25</text>
        <text x="55" y="74" fill="#484f58" font-size="9" text-anchor="end">37.5</text>
        <text x="55" y="24" fill="#484f58" font-size="9" text-anchor="end">50</text>
        <text x="12" y="124" fill="#484f58" font-size="9" text-anchor="middle" transform="rotate(-90,12,124)">Forward Current (mA)</text>

        <text x="60" y="255" fill="#484f58" font-size="9" text-anchor="middle">0.0</text>
        <text x="180" y="255" fill="#484f58" font-size="9" text-anchor="middle">1.0</text>
        <text x="300" y="255" fill="#484f58" font-size="9" text-anchor="middle">2.0</text>
        <text x="420" y="255" fill="#484f58" font-size="9" text-anchor="middle">3.0</text>
        <text x="540" y="255" fill="#484f58" font-size="9" text-anchor="middle">4.0</text>
        <text x="660" y="255" fill="#484f58" font-size="9" text-anchor="middle">5.0</text>

        <text x="360" y="272" fill="#484f58" font-size="9" text-anchor="middle">Forward Voltage (V)</text>
      </svg>
      <div class="chart-note">Characteristic exponential IV curve for an InGaN white LED. Near-zero current until threshold (~2.6V), then steep rise. Design point: 3.1V typical at 20mA. Never exceed 4.0V forward or 25mA continuous.</div>
    </div>
  </div>

  <!-- Current Derating -->
  <div class="section">
    <h2 class="section-title">Forward Current Derating</h2>
    <div class="chart-wrap">
      <h3>Maximum Forward Current vs. Ambient Temperature</h3>
      <svg id="derating-chart" width="100%" height="280" viewBox="0 0 700 280">
        <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="170" x2="660" y2="170" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="120" x2="660" y2="120" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="70" x2="660" y2="70" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="180" y1="20" x2="180" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="300" y1="20" x2="300" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="420" y1="20" x2="420" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="540" y1="20" x2="540" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>

        <path d="M60,20 L210,20" stroke="#E8E8E8" stroke-width="2.5" fill="none"/>
        <path d="M210,20 L540,153" stroke="#E8E8E8" stroke-width="2.5" fill="none"/>
        <path d="M540,153 L705,220" stroke="#E8E8E8" stroke-width="2.5" fill="none" stroke-dasharray="4,3"/>
        <path d="M60,20 L210,20 L540,153 L705,220 L60,220 Z" fill="url(#INS42ATUWGrad)" opacity="0.12"/>

        <circle cx="210" cy="20" r="4" fill="#E8E8E8" opacity="0.9"/>
        <text x="210" y="40" fill="#E8E8E8" font-size="10" text-anchor="middle">30mA @ 25&deg;C</text>
        <circle cx="540" cy="153" r="4" fill="#E8E8E8" opacity="0.9"/>
        <text x="540" y="144" fill="#E8E8E8" font-size="10" text-anchor="middle">10mA @ 80&deg;C</text>

        <rect x="200" y="100" width="110" height="20" rx="4" fill="rgba(63,185,80,0.12)"/>
        <text x="255" y="114" fill="#3fb950" font-size="10" text-anchor="middle">Safe operating</text>

        <text x="55" y="224" fill="#484f58" font-size="9" text-anchor="end">0</text>
        <text x="55" y="174" fill="#484f58" font-size="9" text-anchor="end">7.5</text>
        <text x="55" y="124" fill="#484f58" font-size="9" text-anchor="end">15</text>
        <text x="55" y="74" fill="#484f58" font-size="9" text-anchor="end">22.5</text>
        <text x="55" y="24" fill="#484f58" font-size="9" text-anchor="end">30</text>
        <text x="12" y="124" fill="#484f58" font-size="9" text-anchor="middle" transform="rotate(-90,12,124)">Max If (mA)</text>

        <text x="60" y="255" fill="#484f58" font-size="9" text-anchor="middle">0</text>
        <text x="210" y="255" fill="#484f58" font-size="9" text-anchor="middle">25</text>
        <text x="360" y="255" fill="#484f58" font-size="9" text-anchor="middle">50</text>
        <text x="540" y="255" fill="#484f58" font-size="9" text-anchor="middle">80</text>
        <text x="660" y="255" fill="#484f58" font-size="9" text-anchor="middle">100</text>
        <text x="360" y="272" fill="#484f58" font-size="9" text-anchor="middle">Ambient Temperature (&deg;C)</text>
      </svg>
      <div class="chart-note">InGaN LEDs are more thermally stable than AlInGaP types. At 80&deg;C ambient, derate to 10mA. Still requires thermal management in enclosed or high-temperature applications.</div>
    </div>
  </div>

  <!-- Luminous Intensity vs Current -->
  <div class="section">
    <h2 class="section-title">Luminous Intensity vs. Forward Current</h2>
    <div class="chart-wrap">
      <h3>Relative Brightness (normalized at 20mA)</h3>
      <svg id="brightness-current-chart" width="100%" height="280" viewBox="0 0 700 280">
        <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="170" x2="660" y2="170" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="120" x2="660" y2="120" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="70" x2="660" y2="70" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="180" y1="20" x2="180" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="300" y1="20" x2="300" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="420" y1="20" x2="420" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="540" y1="20" x2="540" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>

        <path d="M60,220 Q120,168 180,155 Q240,135 300,120 Q360,106 420,95 Q480,78 540,64 Q600,52 660,40"
              stroke="#E8E8E8" stroke-width="2.5" fill="none"/>

        <path d="M60,220 L660,20" stroke="#484f58" stroke-width="1" stroke-dasharray="5,4" opacity="0.4"/>
        <text x="600" y="50" fill="#484f58" font-size="9">Linear</text>

        <circle cx="300" cy="120" r="5" fill="#E8E8E8" opacity="0.9"/>
        <line x1="60" y1="120" x2="300" y2="120" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.4"/>
        <line x1="300" y1="120" x2="300" y2="220" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.4"/>
        <text x="310" y="114" fill="#E8E8E8" font-size="10">1.0 @ 20mA</text>

        <text x="55" y="224" fill="#484f58" font-size="9" text-anchor="end">0</text>
        <text x="55" y="174" fill="#484f58" font-size="9" text-anchor="end">0.5</text>
        <text x="55" y="124" fill="#484f58" font-size="9" text-anchor="end">1.0</text>
        <text x="55" y="74" fill="#484f58" font-size="9" text-anchor="end">1.5</text>
        <text x="55" y="24" fill="#484f58" font-size="9" text-anchor="end">2.0</text>
        <text x="12" y="124" fill="#484f58" font-size="9" text-anchor="middle" transform="rotate(-90,12,124)">Relative Brightness</text>

        <text x="60" y="255" fill="#484f58" font-size="9" text-anchor="middle">0</text>
        <text x="180" y="255" fill="#484f58" font-size="9" text-anchor="middle">10</text>
        <text x="300" y="255" fill="#484f58" font-size="9" text-anchor="middle">20</text>
        <text x="420" y="255" fill="#484f58" font-size="9" text-anchor="middle">30</text>
        <text x="540" y="255" fill="#484f58" font-size="9" text-anchor="middle">40</text>
        <text x="660" y="255" fill="#484f58" font-size="9" text-anchor="middle">50</text>
        <text x="360" y="272" fill="#484f58" font-size="9" text-anchor="middle">Forward Current (mA)</text>
      </svg>
      <div class="chart-note">Brightness increases sublinearly with current. Doubling the current from 20mA to 40mA yields only ~55% more light, not 100%. This means diminishing returns at higher drive currents &mdash; optimize for efficiency at or below 20mA.</div>
    </div>
  </div>

  <!-- Brightness vs Temperature -->
  <div class="section">
    <h2 class="section-title">Luminous Intensity vs. Temperature</h2>
    <div class="chart-wrap">
      <h3>Relative Brightness vs. Ambient Temperature (normalized at 25&deg;C)</h3>
      <svg id="brightness-temp-chart" width="100%" height="280" viewBox="0 0 700 280">
        <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="170" x2="660" y2="170" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="120" x2="660" y2="120" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="60" y1="70" x2="660" y2="70" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="180" y1="20" x2="180" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="300" y1="20" x2="300" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="420" y1="20" x2="420" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>
        <line x1="540" y1="20" x2="540" y2="220" stroke="#21262d" stroke-width="0.5" stroke-dasharray="4,4"/>

        <path d="M60,95 L120,100 L180,104 L240,109 L300,113 L390,120 L450,123 L510,127 L570,130 L630,133 L660,135" stroke="#E8E8E8" stroke-width="2.5" fill="none"/>

        <circle cx="390" cy="120" r="5" fill="#E8E8E8" opacity="0.9"/>
        <line x1="60" y1="120" x2="390" y2="120" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.4"/>
        <line x1="390" y1="120" x2="390" y2="220" stroke="#E8E8E8" stroke-width="0.5" stroke-dasharray="3,3" opacity="0.4"/>
        <text x="400" y="114" fill="#E8E8E8" font-size="10">1.0 @ 25&deg;C</text>

        <text x="100" y="62" fill="#58a6ff" font-size="9">Brighter when cold</text>
        <text x="570" y="165" fill="#f85149" font-size="9">Dimmer when hot</text>

        <text x="55" y="224" fill="#484f58" font-size="9" text-anchor="end">0</text>
        <text x="55" y="174" fill="#484f58" font-size="9" text-anchor="end">0.5</text>
        <text x="55" y="124" fill="#484f58" font-size="9" text-anchor="end">1.0</text>
        <text x="55" y="74" fill="#484f58" font-size="9" text-anchor="end">1.5</text>
        <text x="55" y="24" fill="#484f58" font-size="9" text-anchor="end">2.0</text>
        <text x="12" y="124" fill="#484f58" font-size="9" text-anchor="middle" transform="rotate(-90,12,124)">Relative Brightness</text>

        <text x="60" y="255" fill="#484f58" font-size="9" text-anchor="middle">-30</text>
        <text x="180" y="255" fill="#484f58" font-size="9" text-anchor="middle">-10</text>
        <text x="300" y="255" fill="#484f58" font-size="9" text-anchor="middle">10</text>
        <text x="390" y="255" fill="#484f58" font-size="9" text-anchor="middle">25</text>
        <text x="540" y="255" fill="#484f58" font-size="9" text-anchor="middle">50</text>
        <text x="660" y="255" fill="#484f58" font-size="9" text-anchor="middle">70</text>
        <text x="360" y="272" fill="#484f58" font-size="9" text-anchor="middle">Ambient Temperature (&deg;C)</text>
      </svg>
      <div class="chart-note">InGaN LEDs are more thermally stable than AlInGaP types. At 70&deg;C, expect only ~15% reduction in luminous intensity, compared to ~30% for AlInGaP (red/amber). Still brighter when cold (125% at -30&deg;C).</div>
    </div>
  </div>

  <!-- Resistor Calculator -->
  <div class="section">
    <h2 class="section-title">LED Resistor Calculator</h2>
    <div class="calc-card">
      <h3>&#9889; Series Resistor Selection</h3>
      <div class="calc-inputs">
        <div class="calc-field">
          <label>Supply Voltage</label>
          <input type="number" id="calc-vsupply" value="3.3" step="0.1" min="0">
          <div class="unit">Volts</div>
        </div>
        <div class="calc-field">
          <label>Desired Current</label>
          <input type="number" id="calc-iled" value="20" step="1" min="0">
          <div class="unit">Milliamps</div>
        </div>
      </div>
      <div class="calc-results">
        <div class="calc-result">
          <div class="cr-label">Calculated Resistor</div>
          <div class="cr-value" id="calc-r-exact">10.00 &Omega;</div>
          <div class="cr-detail" id="calc-r-formula">R = (3.3V - 3.1V) / 20mA</div>
        </div>
        <div class="calc-result">
          <div class="cr-label">Nearest E24 Value</div>
          <div class="cr-value" id="calc-r-e24">9.10 &Omega;</div>
          <div class="cr-detail" id="calc-r-actual">Actual If = 22.0mA</div>
        </div>
        <div class="calc-result">
          <div class="cr-label">Resistor Power</div>
          <div class="cr-value" id="calc-p-resistor">4.4 mW</div>
          <div class="cr-detail" id="calc-p-r-detail">P = (V<sub>supply</sub> - V<sub>f</sub>) &times; I<sub>f</sub></div>
        </div>
        <div class="calc-result">
          <div class="cr-label">LED Power</div>
          <div class="cr-value" id="calc-p-led">68.1 mW</div>
          <div class="cr-detail" id="calc-p-led-detail">P = V<sub>f</sub> &times; I<sub>f</sub> (max 100mW)</div>
        </div>
      </div>
      <div class="calc-schematic">
        <svg width="400" height="80" viewBox="0 0 400 80" style="max-width:100%">
          <text x="20" y="38" fill="#e6edf3" font-size="11" font-family="JetBrains Mono,monospace" id="calc-svg-vsupply">3.3V</text>
          <line x1="50" y1="35" x2="90" y2="35" stroke="#e6edf3" stroke-width="1.5"/>
          <path d="M90,35 L100,25 L110,45 L120,25 L130,45 L140,25 L150,45 L160,35" stroke="#00b8b0" stroke-width="2" fill="none"/>
          <text x="125" y="60" fill="#00b8b0" font-size="10" text-anchor="middle" font-family="JetBrains Mono,monospace" id="calc-svg-r">9.10Ω</text>
          <line x1="160" y1="35" x2="210" y2="35" stroke="#e6edf3" stroke-width="1.5"/>
          <polygon points="210,22 210,48 240,35" fill="none" stroke="#E8E8E8" stroke-width="2"/>
          <line x1="240" y1="22" x2="240" y2="48" stroke="#E8E8E8" stroke-width="2"/>
          <line x1="230" y1="18" x2="238" y2="10" stroke="#E8E8E8" stroke-width="1"/>
          <line x1="235" y1="22" x2="243" y2="14" stroke="#E8E8E8" stroke-width="1"/>
          <polygon points="238,10 234,13 237,14" fill="#E8E8E8"/>
          <polygon points="243,14 239,17 242,18" fill="#E8E8E8"/>
          <text x="225" y="65" fill="#E8E8E8" font-size="10" text-anchor="middle" font-family="JetBrains Mono,monospace">LED</text>
          <line x1="240" y1="35" x2="300" y2="35" stroke="#e6edf3" stroke-width="1.5"/>
          <line x1="300" y1="28" x2="300" y2="42" stroke="#e6edf3" stroke-width="1.5"/>
          <line x1="290" y1="42" x2="310" y2="42" stroke="#e6edf3" stroke-width="1.5"/>
          <line x1="294" y1="47" x2="306" y2="47" stroke="#e6edf3" stroke-width="1.2"/>
          <line x1="297" y1="52" x2="303" y2="52" stroke="#e6edf3" stroke-width="0.8"/>
          <text x="320" y="42" fill="#8b949e" font-size="10" font-family="JetBrains Mono,monospace">GND</text>
          <text x="180" y="26" fill="#8b949e" font-size="9" text-anchor="middle" font-family="JetBrains Mono,monospace" id="calc-svg-if">20mA</text>
          <line x1="168" y1="30" x2="192" y2="30" stroke="#8b949e" stroke-width="0.5"/>
          <polygon points="192,30 187,27 187,33" fill="#8b949e"/>
        </svg>
      </div>
    </div>
  </div>

  <!-- Environmental -->
  <div class="section">
    <h2 class="section-title">Environmental &amp; Handling</h2>
    <div class="env-grid">
      <div class="env-card">
        <div class="env-name">ESD Sensitivity</div>
        <div class="env-spec">InGaN &mdash; ESD precautions required</div>
        <div class="env-detail">Use grounded wrist straps &amp; ESD-safe tools</div>
      </div>
      <div class="env-card">
        <div class="env-name">Operating Temperature</div>
        <div class="env-spec">Continuous operation range</div>
        <div class="env-detail">&minus;30&deg;C to +80&deg;C</div>
      </div>
      <div class="env-card">
        <div class="env-name">Storage Temperature</div>
        <div class="env-spec">Unbiased storage</div>
        <div class="env-detail">&minus;40&deg;C to +85&deg;C</div>
      </div>
      <div class="env-card">
        <div class="env-name">Moisture Sensitivity</div>
        <div class="env-spec">MSL noted in packaging</div>
        <div class="env-detail">Follow J-STD-020 bake requirements</div>
      </div>
    </div>
  </div>

  <!-- Symbol, Footprint & 3D -->  <!-- 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="IN-S42ATUW-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)</div>
        <iframe src="IN-S42ATUW-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/in-s42atuw/IN-S42ATUW.kicad_sym" download>KiCad Symbol (.kicad_sym)</a>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/in-s42atuw/IN-S42ATUW.kicad_mod" download>KiCad Footprint (.kicad_mod)</a>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/in-s42atuw/IN-S42ATUW.lbr" download>Fusion 360 (.lbr)</a>
      <a class="dl-btn" href="https://wiki-ufypy5dpx93o.adom.cloud/static/libraries/in-s42atuw/IN-S42ATUW.step" download>3D Model (.step)</a>
    </div>
  </div>

  <!-- Pricing -->
  <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">Check availability</div>
        <a class="vc-link" href="https://www.mouser.com/Search/Refine?Keyword=IN-S42ATUW" 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">Check availability</div>
        <a class="vc-link" href="https://www.digikey.com/en/products/result?keywords=IN-S42ATUW" 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">Check availability</div>
      </div>
    </div>
  </div>

  <!-- Documents -->
  <div class="section">
    <h2 class="section-title">Documents</h2>
    <div class="card">
      <table class="detail-table">
        <tr><td>Datasheet</td><td><a href="http://www.inolux-corp.com/datasheet/SMDLED/Mono%20Color%20Top%20View/IN-S42AT%20Series_V1.1.pdf" target="_blank">IN-S42AT Series V1.1 (PDF) &rarr;</a></td></tr>
        <tr><td>Series</td><td>IN-S42AT</td></tr>
        <tr><td>Manufacturer</td><td>Inolux Corporation</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/in-s42atuw/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">
    IN-S42ATUW characterization &middot; Data from Inolux IN-S42AT Series V1.1 datasheet + 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() {
  // ==================== 3D Viewer — IN-S42ATUW (0402 LED, white) ====================
  var canvas = document.getElementById('viewer3d');
  if (canvas && window.THREE) {
    var scene = new THREE.Scene();

    var renderer = new THREE.WebGLRenderer({ canvas: 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%)';

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

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

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

    var S = 2.5;

    var bodyMat = new THREE.MeshStandardMaterial({
      color: 0x2a2018, metalness: 0.0, roughness: 0.4
    });
    var lensMat = new THREE.MeshStandardMaterial({
      color: 0xF5F5DC, metalness: 0.0, roughness: 0.15,
      transparent: true, opacity: 0.7,
      emissive: 0xFFFFE0, emissiveIntensity: 0.3
    });
    var termMat = new THREE.MeshStandardMaterial({
      color: 0xc8ccd1, metalness: 1.0, roughness: 0.25,
      polygonOffset: true, polygonOffsetFactor: -1, polygonOffsetUnits: -1
    });
    var padMat = new THREE.MeshStandardMaterial({ color: 0xc9a04c, metalness: 1.0, roughness: 0.22 });
    var pcbMat = new THREE.MeshStandardMaterial({ color: 0x0a2a0a, metalness: 0.0, roughness: 0.6 });
    var cathodeMat = new THREE.MeshStandardMaterial({ color: 0xF5F5DC, emissive: 0xFFFFE0, emissiveIntensity: 0.5, metalness: 0.0, roughness: 0.5 });

    var bodyW = 1.0, bodyD = 0.5, bodyH = 0.30;
    var lensH = 0.15;
    var termW = 0.20;

    var innerW = bodyW - termW * 2 + 0.02;
    var body = new THREE.Mesh(new THREE.BoxGeometry(innerW*S, bodyH*S, bodyD*S), bodyMat);
    body.position.y = bodyH*S/2;
    scene.add(body);

    var lens = new THREE.Mesh(new THREE.BoxGeometry(bodyW*0.85*S, lensH*S, bodyD*0.85*S), lensMat);
    lens.position.y = (bodyH + lensH/2)*S;
    scene.add(lens);

    function makeTerminal(xSign) {
      var group = new THREE.Group();
      var 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);
      var bot = new THREE.Mesh(new THREE.BoxGeometry((termW+0.03)*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);
      return group;
    }
    scene.add(makeTerminal(-1));
    scene.add(makeTerminal(1));

    var cathMark = new THREE.Mesh(new THREE.BoxGeometry(0.02*S, 0.02*S, bodyD*0.7*S), cathodeMat);
    cathMark.position.set(0.25*S, (bodyH + lensH + 0.02)*S, 0);
    scene.add(cathMark);

    var pcb = new THREE.Mesh(new THREE.BoxGeometry(10*S, 0.08*S, 8*S), pcbMat);
    pcb.position.y = -0.04*S;
    scene.add(pcb);

    var pad1 = new THREE.Mesh(new THREE.BoxGeometry(0.4*S, 0.025*S, 0.6*S), padMat);
    pad1.position.set(-0.3*S, 0.005*S, 0);
    scene.add(pad1);
    var pad2 = new THREE.Mesh(new THREE.BoxGeometry(0.4*S, 0.025*S, 0.6*S), padMat);
    pad2.position.set(0.3*S, 0.005*S, 0);
    scene.add(pad2);

    var gridMat2 = new THREE.LineBasicMaterial({ color: 0x0d3d0d, transparent: true, opacity: 0.3 });
    for (var i = -8; i <= 8; i++) {
      var pts1 = [new THREE.Vector3(i*0.4*S, 0.045*S, -4*S), new THREE.Vector3(i*0.4*S, 0.045*S, 4*S)];
      scene.add(new THREE.Line(new THREE.BufferGeometry().setFromPoints(pts1), gridMat2));
      var pts2 = [new THREE.Vector3(-4*S, 0.045*S, i*0.4*S), new THREE.Vector3(4*S, 0.045*S, i*0.4*S)];
      scene.add(new THREE.Line(new THREE.BufferGeometry().setFromPoints(pts2), gridMat2));
    }

    var isDragging = false, prevX = 0, prevY = 0;
    var theta = Math.PI/4, phi = Math.PI/5.5, radius = 5.0;
    var target = new THREE.Vector3(0, 0.4, 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', function(e) { isDragging = true; prevX = e.clientX; prevY = e.clientY; canvas.style.cursor = 'grabbing'; });
    window.addEventListener('mouseup', function() { isDragging = false; canvas.style.cursor = 'grab'; });
    canvas.addEventListener('mousemove', function(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', function(e) {
      e.preventDefault();
      radius = Math.max(2, Math.min(12, radius + e.deltaY * 0.004));
      updateCamera();
    }, { passive: false });

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

  // ==================== Chart Tooltip System ====================
  function setupChartTooltip(svgId, dataPoints, color, formatX, formatY) {
    var svg = document.getElementById(svgId);
    if (!svg) return;

    var ns = 'http://www.w3.org/2000/svg';

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

    var tipGroup = document.createElementNS(ns, 'g');
    tipGroup.style.display = 'none';
    tipGroup.style.pointerEvents = 'none';

    var tipBg = document.createElementNS(ns, 'rect');
    tipBg.setAttribute('rx', '4');
    tipBg.setAttribute('fill', '#161b22');
    tipBg.setAttribute('stroke', '#30363d');
    tipBg.setAttribute('stroke-width', '1');

    var tipLine1 = document.createElementNS(ns, 'text');
    tipLine1.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine1.setAttribute('font-size', '10');
    tipLine1.setAttribute('fill', '#e6edf3');

    var tipLine2 = document.createElementNS(ns, 'text');
    tipLine2.setAttribute('font-family', 'JetBrains Mono, monospace');
    tipLine2.setAttribute('font-size', '10');
    tipLine2.setAttribute('fill', color);

    tipGroup.appendChild(tipBg);
    tipGroup.appendChild(tipLine1);
    tipGroup.appendChild(tipLine2);
    svg.appendChild(tipGroup);

    var vLine = document.createElementNS(ns, 'line');
    vLine.setAttribute('stroke', color);
    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);

    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 (var i = 0; i < pts.length - 1; i++) {
        if (svgX >= pts[i].sx && svgX <= pts[i+1].sx) {
          var 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('mousemove', function(e) {
      var pt = svg.createSVGPoint();
      pt.x = e.clientX;
      pt.y = e.clientY;
      var svgPt = pt.matrixTransform(svg.getScreenCTM().inverse());

      var minX = dataPoints[0].sx;
      var maxX = dataPoints[dataPoints.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;
      }

      var p = lerp(dataPoints, 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', 220);
      vLine.style.display = '';

      var xLabel = formatX(p.vx);
      var yLabel = formatY(p.vy);
      tipLine1.textContent = xLabel;
      tipLine2.textContent = yLabel;

      var tipX = p.sx + 12;
      var tipY = p.sy - 28;
      var boxW = Math.max(xLabel.length, yLabel.length) * 7 + 16;
      var boxH = 32;

      var adjustedX = tipX + boxW > 660 ? p.sx - boxW - 12 : tipX;
      var 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);

      tipGroup.style.display = '';
    });

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

  // ==================== Spectral Chart ====================
  var spectralData = [
    {sx:-90, sy:48, vx:450, vy:86.2},
    {sx:-81, sy:47, vx:453, vy:86.5},
    {sx:-72, sy:51, vx:456, vy:84.4},
    {sx:-63, sy:59, vx:459, vy:80.3},
    {sx:-54, sy:70, vx:462, vy:74.8},
    {sx:-45, sy:83, vx:465, vy:68.7},
    {sx:-36, sy:95, vx:468, vy:62.7},
    {sx:-27, sy:105, vx:471, vy:57.4},
    {sx:-18, sy:113, vx:474, vy:53.3},
    {sx:-9, sy:119, vx:477, vy:50.4},
    {sx:0, sy:122, vx:480, vy:48.9},
    {sx:9, sy:123, vx:483, vy:48.7},
    {sx:18, sy:121, vx:486, vy:49.5},
    {sx:27, sy:118, vx:489, vy:51.1},
    {sx:36, sy:113, vx:492, vy:53.3},
    {sx:45, sy:108, vx:495, vy:55.9},
    {sx:54, sy:102, vx:498, vy:58.9},
    {sx:63, sy:96, vx:501, vy:62.0},
    {sx:72, sy:90, vx:504, vy:65.2},
    {sx:81, sy:83, vx:507, vy:68.4},
    {sx:90, sy:77, vx:510, vy:71.6},
    {sx:99, sy:71, vx:513, vy:74.7},
    {sx:108, sy:64, vx:516, vy:77.8},
    {sx:117, sy:59, vx:519, vy:80.7},
    {sx:126, sy:53, vx:522, vy:83.5},
    {sx:135, sy:48, vx:525, vy:86.2},
    {sx:144, sy:43, vx:528, vy:88.6},
    {sx:153, sy:38, vx:531, vy:90.9},
    {sx:162, sy:34, vx:534, vy:93.0},
    {sx:171, sy:30, vx:537, vy:94.8},
    {sx:180, sy:27, vx:540, vy:96.3},
    {sx:189, sy:25, vx:543, vy:97.6},
    {sx:198, sy:23, vx:546, vy:98.7},
    {sx:207, sy:21, vx:549, vy:99.4},
    {sx:216, sy:20, vx:552, vy:99.9},
    {sx:225, sy:20, vx:555, vy:100.0},
    {sx:234, sy:20, vx:558, vy:99.9},
    {sx:243, sy:21, vx:561, vy:99.4},
    {sx:252, sy:23, vx:564, vy:98.7},
    {sx:261, sy:25, vx:567, vy:97.6},
    {sx:270, sy:27, vx:570, vy:96.3},
    {sx:279, sy:30, vx:573, vy:94.8},
    {sx:288, sy:34, vx:576, vy:93.0},
    {sx:297, sy:38, vx:579, vy:90.9},
    {sx:306, sy:43, vx:582, vy:88.6},
    {sx:315, sy:48, vx:585, vy:86.2},
    {sx:324, sy:53, vx:588, vy:83.5},
    {sx:333, sy:59, vx:591, vy:80.7},
    {sx:342, sy:64, vx:594, vy:77.8},
    {sx:351, sy:71, vx:597, vy:74.7},
    {sx:360, sy:77, vx:600, vy:71.6},
    {sx:369, sy:83, vx:603, vy:68.3},
    {sx:378, sy:90, vx:606, vy:65.1},
    {sx:387, sy:96, vx:609, vy:61.8},
    {sx:396, sy:103, vx:612, vy:58.4},
    {sx:405, sy:110, vx:615, vy:55.2},
    {sx:414, sy:116, vx:618, vy:51.9},
    {sx:423, sy:123, vx:621, vy:48.7},
    {sx:432, sy:129, vx:624, vy:45.5},
    {sx:441, sy:135, vx:627, vy:42.4},
    {sx:450, sy:141, vx:630, vy:39.5},
    {sx:459, sy:147, vx:633, vy:36.6},
    {sx:468, sy:152, vx:636, vy:33.8},
    {sx:477, sy:158, vx:639, vy:31.2},
    {sx:486, sy:163, vx:642, vy:28.6},
    {sx:495, sy:168, vx:645, vy:26.2},
    {sx:504, sy:172, vx:648, vy:23.9},
    {sx:513, sy:176, vx:651, vy:21.8},
    {sx:522, sy:180, vx:654, vy:19.8},
    {sx:531, sy:184, vx:657, vy:17.9},
    {sx:540, sy:188, vx:660, vy:16.2},
    {sx:549, sy:191, vx:663, vy:14.5},
    {sx:558, sy:194, vx:666, vy:13.0},
    {sx:567, sy:197, vx:669, vy:11.7},
    {sx:576, sy:199, vx:672, vy:10.4},
    {sx:585, sy:201, vx:675, vy:9.3},
    {sx:594, sy:204, vx:678, vy:8.2},
    {sx:603, sy:205, vx:681, vy:7.3},
    {sx:612, sy:207, vx:684, vy:6.4},
    {sx:621, sy:209, vx:687, vy:5.6},
    {sx:630, sy:210, vx:690, vy:4.9},
    {sx:639, sy:211, vx:693, vy:4.3},
    {sx:648, sy:213, vx:696, vy:3.7},
    {sx:657, sy:214, vx:699, vy:3.2},
  ];

  setupChartTooltip('spectral-chart', spectralData, '#E8E8E8',
    function(x) { return x.toFixed(0) + ' nm'; },
    function(y) { return 'Intensity: ' + y.toFixed(1) + '%'; }
  );

  // ==================== IV Chart ====================
  var ivData = [
    {sx:60, sy:220, vx:0.00, vy:0.0},
    {sx:216, sy:220, vx:1.30, vy:0.0},
    {sx:294, sy:220, vx:1.95, vy:0.1},
    {sx:341, sy:219, vx:2.34, vy:0.3},
    {sx:356, sy:218, vx:2.47, vy:0.5},
    {sx:372, sy:216, vx:2.60, vy:1.0},
    {sx:387, sy:212, vx:2.73, vy:2.0},
    {sx:402, sy:200, vx:2.85, vy:5.0},
    {sx:417, sy:180, vx:2.98, vy:10.0},
    {sx:432, sy:140, vx:3.10, vy:20.0},
    {sx:459, sy:120, vx:3.33, vy:25.0},
    {sx:486, sy:100, vx:3.55, vy:30.0},
    {sx:513, sy:70, vx:3.77, vy:37.5},
    {sx:540, sy:20, vx:4.00, vy:50.0},
  ];

  setupChartTooltip('iv-chart', ivData, '#E8E8E8',
    function(x) { return 'Vf = ' + x.toFixed(2) + ' V'; },
    function(y) { return 'If = ' + y.toFixed(1) + ' mA'; }
  );

  // ==================== Derating Chart ====================
  var deratingData = [
    {sx:60, sy:20, vx:0, vy:30.0},
    {sx:210, sy:20, vx:25, vy:30.0},
    {sx:240, sy:32, vx:30, vy:28.2},
    {sx:270, sy:44, vx:35, vy:26.4},
    {sx:300, sy:56, vx:40, vy:24.5},
    {sx:330, sy:68, vx:45, vy:22.7},
    {sx:360, sy:81, vx:50, vy:20.9},
    {sx:390, sy:93, vx:55, vy:19.1},
    {sx:420, sy:105, vx:60, vy:17.3},
    {sx:450, sy:117, vx:65, vy:15.5},
    {sx:480, sy:129, vx:70, vy:13.6},
    {sx:510, sy:141, vx:75, vy:11.8},
    {sx:540, sy:153, vx:80, vy:10.0},
    {sx:705, sy:220, vx:108, vy:0.0},
  ];

  setupChartTooltip('derating-chart', deratingData, '#E8E8E8',
    function(x) { return x.toFixed(0) + '\u00b0C'; },
    function(y) { return 'Max If = ' + y.toFixed(1) + ' mA'; }
  );

  // ==================== Brightness vs Current ====================
  var brightCurrentData = [
    {sx:60,  sy:220, vx:0,  vy:0},
    {sx:120, sy:168, vx:5,  vy:0.52},
    {sx:180, sy:148, vx:10, vy:0.72},
    {sx:240, sy:135, vx:15, vy:0.85},
    {sx:300, sy:120, vx:20, vy:1.0},
    {sx:360, sy:108, vx:25, vy:1.12},
    {sx:420, sy:95,  vx:30, vy:1.25},
    {sx:540, sy:69,  vx:40, vy:1.51},
    {sx:660, sy:40,  vx:50, vy:1.80},
  ];

  setupChartTooltip('brightness-current-chart', brightCurrentData, '#E8E8E8',
    function(x) { return 'If = ' + x.toFixed(0) + ' mA'; },
    function(y) { return 'Brightness: ' + y.toFixed(2) + 'x'; }
  );

  // ==================== Brightness vs Temperature ====================
  var brightTempData = [
    {sx:60, sy:95, vx:-30, vy:1.25},
    {sx:120, sy:100, vx:-20, vy:1.20},
    {sx:180, sy:104, vx:-10, vy:1.16},
    {sx:240, sy:109, vx:0, vy:1.11},
    {sx:300, sy:113, vx:10, vy:1.07},
    {sx:390, sy:120, vx:25, vy:1.00},
    {sx:450, sy:123, vx:35, vy:0.97},
    {sx:510, sy:127, vx:45, vy:0.93},
    {sx:570, sy:130, vx:55, vy:0.90},
    {sx:630, sy:133, vx:65, vy:0.87},
    {sx:660, sy:135, vx:70, vy:0.85},
  ];

  setupChartTooltip('brightness-temp-chart', brightTempData, '#E8E8E8',
    function(x) { return x.toFixed(0) + '\u00b0C'; },
    function(y) { return 'Brightness: ' + y.toFixed(2) + 'x'; }
  );

  // ==================== Resistor Calculator ====================
  var VF_TYP = 3.1;

  var E24 = [10,11,12,13,15,16,18,20,22,24,27,30,33,36,39,43,47,51,56,62,68,75,82,91];

  function nearestE24(val) {
    if (val <= 0) return 0;
    var decade = 1;
    while (val >= 100) { val /= 10; decade *= 10; }
    while (val < 10) { val *= 10; decade /= 10; }
    var best = E24[0], bestDist = Math.abs(val - E24[0]);
    for (var i = 1; i < E24.length; i++) {
      var d = Math.abs(val - E24[i]);
      if (d < bestDist) { bestDist = d; best = E24[i]; }
    }
    return best * decade;
  }

  function formatResistance(r) {
    if (r >= 1e6) return (r/1e6).toFixed(1) + ' M\u03a9';
    if (r >= 1e3) return (r/1e3).toFixed(0) + ' k\u03a9';
    if (r >= 100) return r.toFixed(0) + ' \u03a9';
    if (r >= 10) return r.toFixed(1) + ' \u03a9';
    return r.toFixed(2) + ' \u03a9';
  }

  function updateCalculator() {
    var vSupply = parseFloat(document.getElementById('calc-vsupply').value) || 0;
    var iLed = parseFloat(document.getElementById('calc-iled').value) || 0;
    var iLedA = iLed / 1000;

    var vDrop = vSupply - VF_TYP;
    var rExact = vDrop > 0 && iLedA > 0 ? vDrop / iLedA : 0;
    var rE24 = nearestE24(rExact);
    var iActual = rE24 > 0 ? vDrop / rE24 : 0;
    var pResistor = vDrop * iActual;
    var pLed = VF_TYP * iActual;

    document.getElementById('calc-r-exact').innerHTML = rExact > 0 ? formatResistance(rExact) : '&mdash;';
    document.getElementById('calc-r-formula').textContent = 'R = (' + vSupply.toFixed(1) + 'V - ' + VF_TYP + 'V) / ' + iLed.toFixed(0) + 'mA';
    document.getElementById('calc-r-e24').innerHTML = rE24 > 0 ? formatResistance(rE24) : '&mdash;';
    document.getElementById('calc-r-actual').textContent = iActual > 0 ? 'Actual If = ' + (iActual * 1000).toFixed(1) + 'mA' : '';
    document.getElementById('calc-p-resistor').textContent = pResistor > 0 ? (pResistor * 1000).toFixed(1) + ' mW' : '\u2014';
    document.getElementById('calc-p-led').textContent = pLed > 0 ? (pLed * 1000).toFixed(1) + ' mW' : '\u2014';

    var svgVs = document.getElementById('calc-svg-vsupply');
    if (svgVs) svgVs.textContent = vSupply.toFixed(1) + 'V';
    var svgR = document.getElementById('calc-svg-r');
    if (svgR) svgR.textContent = rE24 > 0 ? formatResistance(rE24) : '\u2014';
    var svgIf = document.getElementById('calc-svg-if');
    if (svgIf) svgIf.textContent = iActual > 0 ? (iActual * 1000).toFixed(1) + 'mA' : '';

    var pLedEl = document.getElementById('calc-p-led');
    if (pLed * 1000 > 100) {
      pLedEl.style.color = '#f85149';
    } else {
      pLedEl.style.color = '';
    }

    var rExactEl = document.getElementById('calc-r-exact');
    if (vDrop <= 0) {
      rExactEl.innerHTML = '<span style="color:#f85149">V<sub>supply</sub> too low</span>';
    }
  }

  document.getElementById('calc-vsupply').addEventListener('input', updateCalculator);
  document.getElementById('calc-iled').addEventListener('input', updateCalculator);

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