/*--------------------------------------------------------------
# Reference pages (ISA references, ABI cheat sheets)
--------------------------------------------------------------*/
.ref {
  --ref-accent: #0563bb;
  --ref-accent-soft: #e8f1fb;
  --ref-line: #e3e7ec;
  --ref-muted: #6c757d;
  --ref-fixed: #f3f4f6;
  --ref-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.ref .section-title p {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.ref code, .ref pre, .ref kbd {
  font-family: var(--ref-mono);
}

.ref code {
  color: #1f2d3d;
  background: var(--ref-fixed);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.86em;
}

.ref-h {
  font-size: 22px;
  font-weight: 700;
  margin: 40px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ref-line);
  color: #173b6c;
}

.ref-h small {
  font-size: 14px;
  font-weight: 400;
  color: var(--ref-muted);
}

.ref h4 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: #173b6c;
}

/* Table of contents */
.ref-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.ref-toc a {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid var(--ref-line);
  border-radius: 20px;
  font-size: 14px;
  background: #fff;
  transition: all 0.2s;
}

.ref-toc a:hover {
  border-color: var(--ref-accent);
  background: var(--ref-accent-soft);
}

/* Generic data tables */
.ref-table-wrap {
  overflow-x: auto;
  margin-bottom: 18px;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ref-table th, .ref-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--ref-line);
  vertical-align: top;
  text-align: left;
}

.ref-table thead th {
  background: #f8f9fa;
  color: #173b6c;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--ref-line);
}

.ref-table tbody tr:hover {
  background: #fafbfc;
}

.ref-table td.mono, .ref-table th.mono {
  font-family: var(--ref-mono);
  font-size: 13px;
  white-space: nowrap;
}

/* Cards (ABI summaries, overview blocks) */
.ref-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.ref-card {
  border: 1px solid var(--ref-line);
  border-radius: 8px;
  padding: 14px 16px;
  background: #fff;
}

.ref-card h5 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ref-accent);
}

.ref-card p, .ref-card ul {
  font-size: 14px;
  margin-bottom: 6px;
}

.ref-card ul {
  padding-left: 18px;
}

.ref-note {
  border-left: 4px solid var(--ref-accent);
  background: var(--ref-accent-soft);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  margin: 12px 0 18px;
}

.ref-note.warn {
  border-left-color: #d9822b;
  background: #fdf3e7;
}

.ref pre.ref-code {
  background: #1f2430;
  color: #e6e6e6;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
}

.ref pre.ref-code .c {
  color: #8a94a6;
}

.ref-footer {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--ref-line);
  font-size: 13px;
  color: var(--ref-muted);
}

/*--------------------------------------------------------------
# Instruction tables
--------------------------------------------------------------*/
.isa-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(4px);
  padding: 10px 0 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--ref-line);
}

.isa-search {
  width: 100%;
  padding: 9px 14px;
  font-size: 15px;
  font-family: var(--ref-mono);
  border: 1px solid #cfd6de;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.isa-search:focus {
  border-color: var(--ref-accent);
  box-shadow: 0 0 0 3px rgba(5, 99, 187, 0.15);
}

.isa-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.isa-chips-l {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ref-muted);
  width: 78px;
}

.isa-chip {
  border: 1px solid var(--ref-line);
  background: #fff;
  border-radius: 14px;
  padding: 2px 10px;
  font-size: 12px;
  color: #3d4852;
  cursor: pointer;
  transition: all 0.15s;
}

.isa-chip:hover {
  border-color: var(--ref-accent);
}

.isa-chip.active {
  background: var(--ref-accent);
  border-color: var(--ref-accent);
  color: #fff;
}

.isa-hint {
  font-size: 12px;
  color: var(--ref-muted);
  margin-top: 6px;
}

.isa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.isa-table thead th {
  text-align: left;
  font-weight: 600;
  color: #173b6c;
  padding: 8px 10px;
  border-bottom: 2px solid var(--ref-line);
}

.isa-cat th {
  background: #f8f9fa;
  color: #173b6c;
  font-family: "Raleway", sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 10px 8px;
  border-bottom: 1px solid var(--ref-line);
}

.isa-row td {
  padding: 6px 10px;
  border-bottom: 1px solid #eef1f4;
  vertical-align: top;
}

.isa-row {
  cursor: pointer;
}

.isa-row:hover {
  background: #f6f9fd;
}

.isa-row.open {
  background: var(--ref-accent-soft);
}

.isa-m {
  font-family: var(--ref-mono);
  font-weight: 700;
  white-space: nowrap;
  width: 1%;
}

.isa-m a {
  color: var(--ref-accent);
}

.isa-syn {
  white-space: nowrap;
  width: 1%;
}

.isa-syn code {
  background: none;
  padding: 0;
  color: #3d4852;
}

.isa-desc {
  color: #272829;
}

.isa-ext {
  width: 1%;
  white-space: nowrap;
}

.isa-tag {
  display: inline-block;
  font-size: 11px;
  font-family: var(--ref-mono);
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--ref-fixed);
  color: #4a5562;
}

.isa-detail {
  display: none;
}

.isa-detail.open {
  display: table-row;
}

.isa-detail > td {
  padding: 12px 10px 16px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--ref-line);
}

.isa-notes {
  font-size: 13px;
  margin: 10px 0 0;
  color: #3d4852;
}

.isa-op {
  font-size: 12.5px;
  background: #fff;
  border: 1px solid var(--ref-line);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 0 0;
  white-space: pre-wrap;
}

.isa-ex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
}

.isa-ex-l {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ref-muted);
}

.isa-hex, .isa-bytes {
  font-family: var(--ref-mono);
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 4px;
}

.isa-hex {
  background: #173b6c;
  color: #fff;
}

.isa-bytes {
  border: 1px dashed #b8c2cc;
  color: #4a5562;
}

.isa-empty {
  display: none;
  text-align: center;
  color: var(--ref-muted);
  padding: 30px;
}

/* Encoding diagram: one grid column per bit */
.enc {
  display: grid;
  border: 1px solid #c9d2dc;
  border-radius: 6px;
  overflow: hidden;
  font-family: var(--ref-mono);
  font-size: 12px;
  max-width: 980px;
}

.enc-32 {
  grid-template-columns: repeat(32, minmax(0, 1fr));
}

.enc-16 {
  grid-template-columns: repeat(16, minmax(0, 1fr));
  max-width: 560px;
}

.enc-f {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-right: 1px solid #c9d2dc;
  padding: 2px 1px 4px;
  min-width: 0;
}

.enc-f:last-child {
  border-right: none;
}

.enc-r {
  font-size: 10px;
  color: var(--ref-muted);
  white-space: nowrap;
}

.enc-v {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: nowrap;
}

.enc-fixed {
  background: var(--ref-fixed);
}

.enc-fixed .enc-v {
  color: #6b7785;
  letter-spacing: 0.1em;
}

.enc-var {
  background: var(--ref-accent-soft);
}

.enc-var .enc-v {
  color: #173b6c;
}

.enc-x {
  font-size: 10px;
  color: var(--ref-accent);
  letter-spacing: 0.05em;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 768px) {
  .isa-syn {
    white-space: normal;
  }
  .isa-chips-l {
    width: 100%;
  }
  .enc {
    font-size: 9px;
  }
  .enc-r {
    font-size: 8px;
  }
}

/* Generated reference pages use an <h1> for the page title (SEO); mirror the h2 look. */
.ref .section-title h1 {
  font-size: 32px;
  font-weight: bold;
  text-transform: uppercase;
  padding-top: 50px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  position: relative;
  color: #45505b;
}
.ref .section-title h1::before {
  content: "";
  position: absolute;
  display: block;
  width: 120px;
  height: 1px;
  background: #ddd;
  bottom: 1px;
  left: calc(50% - 60px);
}
.ref .section-title h1::after {
  content: "";
  position: absolute;
  display: block;
  width: 40px;
  height: 3px;
  background: #0563bb;
  bottom: 0;
  left: calc(50% - 20px);
}

/*--------------------------------------------------------------
# x86doc (reskinned Intel reference pages)
--------------------------------------------------------------*/
.x86ref {
  max-width: 1040px;
  margin: 0 auto;
}

.x86ref .x86-back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--ref-accent);
}

.x86ref h1 {
  font-family: "Raleway", sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: #173b6c;
  padding-top: 10px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ref-line);
}

.x86ref h2 {
  font-size: 20px;
  font-weight: 700;
  color: #173b6c;
  margin: 28px 0 12px;
}

.x86ref h3 {
  font-size: 16px;
  font-weight: 700;
  color: #173b6c;
  margin: 20px 0 10px;
}

.x86ref p {
  margin-bottom: 12px;
}

.x86ref table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13.5px;
  margin: 12px 0 20px;
}

.x86ref th,
.x86ref td {
  border: 1px solid var(--ref-line);
  padding: 6px 10px;
  vertical-align: top;
  text-align: left;
}

.x86ref th {
  background: #f8f9fa;
  color: #173b6c;
  font-weight: 600;
}

.x86ref tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.x86ref .exception-table td:first-child {
  white-space: nowrap;
  font-family: var(--ref-mono);
}

.x86ref pre {
  background: #1f2430;
  color: #e6e6e6;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
}

.x86ref code,
.x86ref em {
  font-family: var(--ref-mono);
}

.x86ref em {
  font-style: normal;
  color: #0b7285;
}

.x86ref strong {
  color: #173b6c;
}

.x86ref a {
  color: var(--ref-accent);
}

.x86ref svg {
  display: block;
  margin: 12px auto;
  max-width: 100%;
}

.x86ref svg + h3 {
  text-align: center;
}

/* Opcode index table on x86doc/index.html */
.x86ref table.opcode-index {
  font-family: var(--ref-mono);
  font-size: 12.5px;
  table-layout: fixed;
}

.x86ref table.opcode-index td {
  overflow-wrap: anywhere;
}

/* The x86 opcode index uses the full page width (container-fluid). */
.x86ref.x86ref-wide {
  max-width: none;
  padding: 0 40px 0 10px;
}

.x86ref.x86ref-wide table.opcode-index {
  width: 100%;
}

/* "CPU Ext." column (3rd) holds tokens up to ~11 chars; widen past the 30px hint. */
.x86ref table.opcode-index th:nth-child(3),
.x86ref table.opcode-index td:nth-child(3) {
  width: 110px;
  white-space: nowrap;
}

/* x86doc index: plain centered title (no decorative underline) + tighter table. */
.x86ref h1.x86-title {
  text-align: center;
  border-bottom: none;
  padding-top: 40px;
  padding-bottom: 10px;
}

.x86ref table.opcode-index {
  font-size: 11.5px;
}

.x86ref table.opcode-index th,
.x86ref table.opcode-index td {
  padding: 3px 8px;
}

/*--------------------------------------------------------------
# Linux system call tables (syscalls/)
--------------------------------------------------------------*/
.ref-toc a.active {
  background: var(--ref-accent);
  border-color: var(--ref-accent);
  color: #fff;
}

.sc-table {
  font-size: 13px;
}

.sc-table thead th {
  font-family: var(--ref-mono);
  white-space: nowrap;
}

.sc-nr {
  font-family: var(--ref-mono);
  text-align: right;
  color: #173b6c;
  font-weight: 600;
  width: 1%;
}

.sc-arg {
  font-family: var(--ref-mono);
  font-size: 12px;
  white-space: nowrap;
}

.sc-t {
  color: var(--ref-muted);
}

.sc-n {
  color: #272829;
  font-weight: 600;
}

.isa-tag.sc-new {
  background: #e6f4ea;
  color: #1e7b34;
}

.sc-card h5 a {
  color: var(--ref-accent);
}

.sc-card h5 {
  font-size: 18px;
}

.sc-go {
  font-weight: 600;
}

.sc-delta {
  font-size: 13px;
  font-weight: 400;
  color: var(--ref-muted);
  margin-left: 6px;
}

.sc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0 0 12px;
  list-style: none;
}

.sc-list code {
  display: inline-block;
  border: 1px solid var(--ref-line);
  background: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  color: #1f2d3d;
  transition: all 0.15s;
}

.sc-list a:hover code {
  border-color: var(--ref-accent);
  background: var(--ref-accent-soft);
}

.sc-removed {
  font-size: 13px;
  color: var(--ref-muted);
}

.sc-none {
  color: #c5ccd4;
}

.sc-grid td, .sc-grid th {
  text-align: center;
}

.sc-grid tbody th {
  text-align: left;
  white-space: nowrap;
}

.sc-grid td a, .sc-compare td.sc-nr a {
  color: var(--ref-accent);
  font-weight: 600;
}

.sc-compare thead th {
  text-align: right;
}

.sc-compare thead th:first-child {
  text-align: left;
}

.sc-compare thead th a {
  color: #173b6c;
}

@media (max-width: 768px) {
  .sc-arg {
    white-space: normal;
  }
}
