/* icmadar pinout viewer — preserves original table structure, mobile-friendly */

@font-face {
  font-family: 'IRANYekanRegular';
  src: url('fonts/IRANYekanRegular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'IRANYekanRegular';
  src: url('fonts/IRANYekanRegularMobile(FaNum).ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(78, 145, 230, 0.15);
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

:root {
  --page-background: #ffffff;
  --text-color: #2d3a4a;
  --title-color: #4e91e6;
  --primary-color: #4e91e6;
  --primary-alt-color: #eef4fc;
  --grey-color: #f8f8f8;
  --border-color: #d8dee8;
  --table-border-width: 0.5px;
  --table-radius: 10px;
  --muted-color: #7a8699;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body,
table,
th,
td,
font,
div,
b,
i,
span,
li,
p {
  font-family: 'IRANYekanRegular', Arial, sans-serif;
}

body {
  margin: 0;
  padding: 12px 14px calc(30px + env(safe-area-inset-bottom, 0px));
  background-color: var(--page-background);
  color: var(--text-color);
  font-size: 13px;
  line-height: 1.5;
  direction: ltr;
  text-align: center;
  overflow-x: auto;
}

body > :last-child {
  margin-bottom: 0 !important;
}

img {
  border: 0;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 8px auto 4px;
}

img.rd,
img.rs {
  position: static;
  left: auto;
  right: auto;
}

font.imgdescr,
font[style*="font-size: 80%"] {
  display: block;
  font-size: 12px !important;
  color: var(--muted-color);
  text-align: center;
  line-height: 2.5;
  margin-bottom: 12px;
}

font.axs {
  font-size: xx-small;
}

/* Unified rounded table frame — works in WebView + desktop browser preview */
.pinout-table-wrap,
body > table {
  border-radius: var(--table-radius);
  box-shadow: 0 0 0 var(--table-border-width) var(--border-color);
  background: #fff;
}

.pinout-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 8px 0 16px;
  overflow: hidden;
}

.pinout-table-wrap--scroll {
  overflow: hidden;
}

body > table {
  width: max-content;
  min-width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
}

.pinout-table-wrap .pinout-table-scroll > table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  max-width: none;
  margin: 0;
  table-layout: auto;
}

td table,
.pinout-table-wrap td table {
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  margin: 0;
  width: auto;
  min-width: 0;
}

.pinout-table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  width: 100%;
  max-width: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;
}

.pinout-table-scroll.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.pinout-table-scroll::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

@media (hover: hover) and (pointer: fine) {
  .pinout-table-scroll {
    scrollbar-width: thin;
    scrollbar-color: #b8c9e6 transparent;
  }

  .pinout-table-scroll::-webkit-scrollbar {
    display: block;
    width: 0;
    height: 6px;
  }

  .pinout-table-scroll::-webkit-scrollbar-thumb {
    background: #b8c9e6;
    border-radius: 999px;
  }

  .pinout-table-scroll::-webkit-scrollbar-track {
    background: transparent;
  }
}

.pinout-table-wrap .pinout-table-scroll > table {
  margin-top: 0;
}

table {
  border-collapse: collapse;
  direction: ltr;
  table-layout: auto;
  margin-top: 14px;
}

body > b {
  display: block;
  margin: 16px 0 12px;
  color: var(--title-color);
  font-family: 'IRANYekanRegular', Arial, sans-serif;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}

body > b + table,
body > b + .pinout-table-wrap {
  margin-top: 0;
}

table,
th,
td {
  border: var(--table-border-width) solid var(--border-color);
}

thead th {
  background-color: var(--primary-alt-color);
}

th,
td {
  padding: 6px 10px;
  text-align: center;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}

.pinout-table-scroll th,
.pinout-table-scroll td {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  width: auto;
  min-width: 0;
  max-width: none;
}

table.padleft td {
  padding-right: 10px;
  padding-left: 10px;
  text-align: center;
}

table.padleft th {
  text-align: center;
}

table.padleft td.min {
  width: 1%;
  padding: 0 5px;
  white-space: nowrap;
}

table.nopad td {
  padding: 1px;
}

table.noborder,
table.noborder th,
table.noborder td {
  border: 0;
}

tr.c {
  background-color: var(--grey-color);
}

td.c {
  background-color: var(--primary-alt-color);
}

td.small {
  font-size: 80%;
}

span.mon {
  font-size: large;
  font-family: monospace;
}

div.l {
  text-align: left;
}

div.ls {
  text-align: center;
  font-size: 12px;
  color: var(--muted-color);
  line-height: 2.5;
  margin: 8px 0 14px;
}

div[align=left].pinout-prose,
div.ls.pinout-prose,
div.l.pinout-prose {
  font-size: 12.5px;
  line-height: 2.1;
  color: #384152;
  margin: 14px 0 20px;
  padding: 0 8px;
  text-align: center;
  direction: ltr;
}

div[align=left].pinout-prose p,
div.ls.pinout-prose p,
div.l.pinout-prose p {
  margin: 0 0 14px;
}

div[align=left].pinout-prose p:last-child,
div.ls.pinout-prose p:last-child,
div.l.pinout-prose p:last-child {
  margin-bottom: 0;
}

div[align=left].pinout-prose-fa,
div.ls.pinout-prose-fa,
div.l.pinout-prose-fa {
  direction: rtl;
  text-align: center;
  unicode-bidi: plaintext;
}

div[align=left].pinout-prose b,
div[align=left].pinout-prose-fa b,
div.ls.pinout-prose b,
div.ls.pinout-prose-fa b,
div.l.pinout-prose b,
div.l.pinout-prose-fa b {
  color: var(--text-color);
  font-weight: 600;
}

div[align=left] font {
  display: block;
  font-size: 13px !important;
  text-align: center;
  color: var(--muted-color);
  line-height: 2;
}

ul {
  margin: 0 0 0 20px;
  padding: 0;
}

ul li {
  margin: 0;
  padding: 0;
}

h2,
h3,
h4 {
  color: var(--title-color);
  text-align: center;
  font-family: 'IRANYekanRegular', Arial, sans-serif;
  font-weight: 600;
  margin: 16px 0 14px;
}

h2 {
  font-size: 15px;
  margin: 16px 0 20px;
}

h3 {
  font-size: 14px;
  margin: 10px 0 28px;
}

h4 {
  font-size: 14px;
  margin: 10px 0 28px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 18px 0;
}

.bigfont {
  font-size: 120%;
  font-weight: 600;
  text-align: center;
  color: var(--title-color);
  font-family: 'IRANYekanRegular', 'IRANYekanRegular', Arial, sans-serif;
  margin: 14px 0 10px;
}

a:link,
a:visited {
  text-decoration: none;
  color: var(--title-color);
}

b,
strong {
  font-weight: 600;
}

.pinout-note-fa {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}
