:root {
  color-scheme: light;
  --ink: #142c36;
  --soft: #4a626c;
  --navy: #11303a;
  --navy-deep: #0a252d;
  --teal: #056a60;
  --teal-dark: #034e47;
  --mint: #d8f0e8;
  --paper: #f3f6f5;
  --line: #d1e1df;
  --white: #fff;
  --header-height: 65px;
  --fonts: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html {
  scroll-padding-top: calc(var(--header-height) + 23px);
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--fonts);
  font-size: 15px;
  line-height: 1.7;
}
a { color: var(--teal-dark); text-underline-offset: .2em; }
a:hover { color: #058070; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #148b7f; outline-offset: 3px; }
[hidden] { display: none !important; }
.js-only { display: none !important; }
.enhanced .js-only { display: revert !important; }
.skip {
  position: fixed; z-index: 9; top: -120px; left: 16px;
  padding: 6px 12px; background: #fff;
}
.skip:focus { top: 8px; }

.bar {
  position: sticky; top: 0; z-index: 5;
  height: var(--header-height);
  background: var(--navy-deep);
  color: #fff;
  border-bottom: 1px solid #31515a;
}
.bar-inner {
  max-width: 1550px; height: 100%; margin: 0 auto; padding: 0 31px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand, .bar-links { display: flex; align-items: center; gap: 20px; }
.bar a { color: #e8f6f4; text-decoration: none; }
.bar a:hover { color: #92e3cd; }
.brand strong { font-size: 24px; line-height: 1; letter-spacing: -.035em; }
.brand span { font-size: 13px; color: #bfcecf; border-left: 1px solid #4a6970; padding-left: 16px; }
.bar-links a { font-size: 13px; }

.layout {
  max-width: 1550px; margin: 0 auto; padding: 0 31px 45px;
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 27px;
}
.catalog {
  align-self: start; position: sticky; top: calc(var(--header-height) + 27px);
  min-width: 0; max-height: calc(100vh - var(--header-height) - 46px);
  overflow-y: auto; padding: 5px 8px 7px 0;
}
.catalog nav { display: grid; gap: 5px; }
.catalog a {
  display: block; padding: 9px 11px;
  border: 1px solid transparent; border-radius: 7px;
  color: var(--soft); text-decoration: none; font-size: .92rem;
}
.catalog a:hover, .catalog a[aria-current] {
  color: var(--teal-dark); background: #e3f2ed; border-color: #cce4db;
}
.catalog a[aria-current] { font-weight: 700; }

main { min-width: 0; }
.hero {
  min-height: 224px; margin-top: 26px; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 31%);
  align-items: stretch;
  color: white; border: 1px solid #274951; border-radius: 12px;
  background:
    repeating-linear-gradient(0deg, #b5e6da10 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, #b5e6da10 0 1px, transparent 1px 28px),
    linear-gradient(110deg, #102b36 1%, #123a40 99%);
}
.hero-copy {
  position: relative; z-index: 1; display: grid;
  align-content: center; padding: 30px 28px;
}
h1 { margin: 0; color: #fff; font-size: clamp(1.8rem, 3.2vw, 3.3rem); line-height: 1.18; letter-spacing: -.035em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.hero-actions a {
  padding: 7px 12px; border-radius: 6px; text-decoration: none;
  color: white; background: #234c50; border: 1px solid #649186;
  font-size: .86rem; font-weight: 650;
}
.hero-actions a:first-child { color: #0b3833; background: #b9f0e1; border-color: #b9f0e1; }
.hero-actions a:hover { box-shadow: 0 0 0 2px #8be3d0; }
.hero-image {
  display: grid; place-items: center; min-width: 0;
  padding: 10px 18px 10px 0; max-height: 278px;
}
.hero-image img {
  width: 100%; height: 100%; max-height: 250px; object-fit: contain;
  filter: drop-shadow(0 11px 18px #07191f80);
}

.document {
  margin-top: 17px; padding: 4px clamp(17px, 3vw, 37px) 26px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
}
.doc-section { min-width: 0; }
.doc-section + .doc-section { margin-top: 34px; }
.document h2 {
  margin: 24px 0 13px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line); color: #173747;
  font-size: clamp(1.26rem, 2.15vw, 1.7rem); line-height: 1.28;
}
.document h3 { margin: 20px 0 8px; line-height: 1.38; font-size: 1.14rem; }
.document h4 { margin: 15px 0 6px; font-size: 1rem; }
.document p { margin: 8px 0; }
.document ul, .document ol { padding-left: 1.55em; }
.document li + li { margin-top: .24em; }
.document blockquote {
  margin: 13px 0; padding: 7px 15px;
  border-left: 4px solid #399584; background: #edf7f2; color: #224d49;
}
.document blockquote p { margin-block: 4px; }
.document hr { margin-block: 21px; border: 0; border-top: 1px solid var(--line); }
.document code {
  padding: .08em .23em; border-radius: 3px; background: #edf3f2; color: #184950;
  font: .94em "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere;
}
.document pre {
  white-space: pre-wrap; overflow-wrap: anywhere; padding: 13px;
  background: #edf3f2; border-radius: 7px;
}
.document pre code { padding: 0; }

.doc-figure { margin: 13px 0; }
.document img {
  display: block; width: auto; max-width: min(100%, 840px); max-height: 690px;
  height: auto; margin: 10px auto; object-fit: contain;
}
.document a:has(img) { display: block; background: #f2f7f7; border-radius: 8px; }
.document a:has(img):hover { background: #e9f2f1; }
.section-photos .doc-figure { margin: 14px 0; }
.section-photos .doc-figure img { max-height: 510px; }

.table-wrap {
  max-width: 100%; margin: 10px 0 16px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px; scrollbar-color: #79a6a1 transparent;
}
table { width: 100%; border-collapse: collapse; font-size: .91rem; line-height: 1.48; text-align: left; }
th, td { padding: 8px 11px; vertical-align: top; overflow-wrap: anywhere; }
th { color: #143b43; background: #e2efed; font-weight: 700; }
td { border-top: 1px solid #e0ecea; }
tbody tr:nth-child(even) { background: #f5f8f8; }
tbody tr:hover { background: #edf6f2; }
td:first-child { font-weight: 640; }
.section-pinout table { min-width: 540px; }
.section-models > .table-wrap table { min-width: 512px; }

.model-links {
  display: flex !important; flex-wrap: wrap; gap: 7px; padding: 8px;
  margin: 17px 0 3px; border: 1px solid var(--line); border-radius: 9px; background: #f2f7f5;
}
html:not(.enhanced) .model-links { display: none !important; }
.model-links a {
  display: block; text-decoration: none; padding: 6px 10px; border-radius: 6px;
  border: 1px solid transparent; font-weight: 670; font-size: .88rem;
}
.model-links a:hover { border-color: #83c2b4; }
.model-links a[aria-current] { color: #fff; background: var(--teal); }
.model-hidden-note { font-size: .83rem; color: var(--soft); }
.model-panel {
  border: 1px solid var(--line); border-radius: 9px; padding: 14px;
  margin: 11px 0; background: #fbfdfd;
}
.model-panel h3 { margin-top: 0; }
.model-panel img { max-height: 570px; }

.pin-selector {
  align-items: end; flex-wrap: wrap; gap: 9px 15px; margin: 12px 0;
  border: 1px solid var(--line); background: #f2f7f5; border-radius: 9px; padding: 9px 12px;
}
.enhanced .pin-selector { display: flex !important; }
.pin-selector label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--ink); font-size: .92rem; }
.pin-selector input {
  padding: 5px 8px; min-width: 0; max-width: 100%; width: clamp(170px, 24vw, 255px);
  color: var(--ink); border: 1px solid #96b8b4; background: #fff; border-radius: 6px;
}
.pin-selector input::placeholder { color: #5b7278; }
.pin-selector output { color: var(--soft); font-size: .85rem; }
.pin-empty { padding: 5px 9px; background: #f5f8f8; border: 1px solid var(--line); border-radius: 6px; }
.footer { display: flex; flex-wrap: wrap; gap: 19px; padding: 12px 1px; font-size: .87rem; }
.footer a { color: var(--soft); }

.image-dialog {
  width: min(96vw, 1440px); height: min(94dvh, 1050px); max-width: none; max-height: none;
  padding: 0; border: 1px solid #52747b; border-radius: 12px; overflow: hidden;
  color: #fff; background: #203b44;
}
.image-dialog[open] { display: flex; flex-direction: column; }
.image-dialog::backdrop { background: #122e36b5; }
.image-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; padding: 10px 13px; background: #102b36;
}
.image-controls h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: .99rem; }
.image-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.image-buttons a, .image-buttons button {
  display: inline-grid; place-items: center; min-height: 34px; min-width: 33px;
  padding: 3px 7px; border-radius: 5px; border: 1px solid #748f94;
  background: transparent; color: white; text-decoration: none; font-size: .81rem;
}
.image-buttons a:hover, .image-buttons button:hover { background: #275762; }
.image-buttons output { font-size: .83rem; min-width: 4ch; text-align: center; }
.image-viewport {
  display: flex; align-items: safe center; justify-content: safe center;
  flex: 1; min-height: 0; overflow: auto; padding: 13px; overscroll-behavior: contain; touch-action: pan-x pan-y;
  background:
    repeating-conic-gradient(#304950 0% 25%, #39535b 0% 50%) 50% / 28px 28px;
}
.image-viewport img { display: block; flex: none; max-width: none; height: auto; cursor: grab; }
.image-viewport.is-panning img { cursor: grabbing; user-select: none; }

@media (max-width: 1030px) {
  .layout { grid-template-columns: 148px minmax(0,1fr); padding-inline: 21px; gap: 20px; }
  .bar-inner { padding-inline: 21px; }
}
@media (max-width: 745px) {
  :root { --header-height: 53px; }
  html { scroll-padding-top: calc(var(--header-height) + 60px); }
  .bar-inner { padding-inline: 16px; }
  .brand, .bar-links { gap: 11px; }
  .brand strong { font-size: 21px; }
  .brand span { padding-left: 10px; font-size: 11px; }
  .bar-links a { font-size: 12px; }
  .layout { display: block; padding: 0 13px 33px; }
  .catalog {
    top: var(--header-height); z-index: 4; padding: 0 11px;
    margin-inline: -13px; max-height: none; overflow: hidden;
    background: var(--paper); box-shadow: 0 1px #cfdddb;
  }
  .catalog nav { display: flex; gap: 5px; overflow-x: auto; padding: 5px 3px; }
  .catalog a { padding: 4px 7px; white-space: nowrap; font-size: .8rem; }
  .hero { margin-top: 12px; min-height: 163px; grid-template-columns: minmax(0,1fr) 32%; }
  .hero-copy { padding: 14px 9px 14px 12px; }
  h1 { font-size: clamp(1.18rem, 5.1vw, 1.8rem); }
  .hero-actions { margin-top: 10px; gap: 5px; }
  .hero-actions a { padding: 3px 6px; font-size: .74rem; }
  .hero-image { padding: 5px 7px 5px 0; }
  .document { margin-top: 10px; border-radius: 9px; padding-inline: 11px; }
  th, td { padding: 6px 7px; }
  .table-wrap { margin-block: 7px 12px; }
  .model-panel { padding: 10px; }
  .pin-selector { gap: 5px 8px; padding: 8px; }
}
@media (max-width: 355px) {
  .brand span { display: none; }
  .hero-image { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  body { background: white; }
  .bar, .catalog, .hero-actions, .hero-image, .footer, .js-only, .image-dialog { display: none !important; }
  .layout { display: block; padding: 0; }
  .hero { display: block; min-height: 0; color: #111; margin: 0; border: 0; background: none; }
  h1 { color: #111; }
  .hero-copy { padding: 0; }
  .document { border: 0; margin: 0; padding: 0; }
  .table-wrap { overflow: visible; }
  .model-panel[hidden] { display: block !important; }
  .section-pinout tbody tr[hidden] { display: table-row !important; }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.enhanced .model-links { display: flex !important; }
@media (max-width: 745px) {
  h1 { font-size: clamp(1.13rem, 4.72vw, 1.8rem); text-wrap: balance; }
  .enhanced .model-links { display: grid !important; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .model-links a { text-align: center; }
}
