/* =====================================================
   Iskra Delta – Manual CSS  (shared across all manuals)

   Cover colour is controlled by:  --manual-cover
   Set it once per manual in a <style> tag, e.g.:
     :root { --manual-cover: #2e4d72; }   user manuals  (blue)
     :root { --manual-cover: #2a5c3f; }   prog manuals  (green)
     :root { --manual-cover: #7a3a1a; }   service/DIY   (brown)
   ===================================================== */

:root {
  --manual-cover: #2e4d72;
}

/* ─── Reset site.css body defaults for manual pages ──── */

body.cover,
body.content {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.65;
  color: #1a1a1a;
  background: transparent;
}

/* ─── site-stage background per page type ──────────── */

body.cover .site-stage {
  background: var(--manual-cover);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  min-height: 100vh;
  padding: 40px 20px;
}

body.content .site-stage {
  background: #adadad;
  min-height: 100vh;
}

/* =====================================================
   COVER PAGE  (body.cover)
   ===================================================== */

.cover-brand {
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 54px;
}

.cover-brand img {
  width: 320px;
  height: auto;
  filter: brightness(10);
}

.cover-box {
  border: 1px dashed rgba(255, 255, 255, 0.65);
  padding: 38px 68px;
  text-align: center;
  min-width: 320px;
  line-height: 2.5;
}

.cover-box p {
  color: #fff;
  margin: 0;
}

.cover-meta {
  text-align: right;
  min-width: 320px;
  margin-top: 32px;
  line-height: 2.8;
  font-size: 13px;
  opacity: 0.9;
}

.cover-footer {
  margin-top: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.cover-footer img {
  filter: brightness(10);
  width: 95px;
}

/* =====================================================
   CONTENT PAGE  (body.content)
   ===================================================== */

/* The "physical page" box */
.page {
  background: #fff;
  width: 748px;
  min-height: 1058px;
  margin: 28px auto;
  padding: 46px 68px 95px 76px;
  position: relative;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.4);
}

@media (max-width: 860px) {
  .page {
    width: 100%;
    margin: 0;
    padding: 28px 20px 80px;
    box-shadow: none;
    min-height: auto;
  }
}

/* ─── Page header ────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 5px;
  border-bottom: 1px solid #333;
  margin-bottom: 5px;
}

.page-header img {
  width: 33%;
  height: auto;
}

.running {
  text-align: right;
  font-size: 11px;
  color: #333;
  margin-bottom: 36px;
}

/* ─── Chapter title ──────────────────────────────── */

.site-stage h1 {
  font-size: 14px;
  font-weight: normal;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 48px 0 0;
  font-family: 'Courier New', Courier, monospace;
}

.site-stage h1 + .rule {
  text-align: center;
  font-size: 13px;
  color: #1a1a1a;
  letter-spacing: 0;
  margin-bottom: 32px;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

/* ─── Section headings ───────────────────────────── */

.site-stage h2 {
  font-size: 13px;
  font-weight: bold;
  text-transform: uppercase;
  margin: 28px 0 9px;
  font-family: 'Courier New', Courier, monospace;
  color: #1a1a1a;
}

.site-stage h3 {
  font-size: 13px;
  font-weight: bold;
  margin: 18px 0 7px;
  font-family: 'Courier New', Courier, monospace;
  color: #1a1a1a;
}

.site-stage h4 {
  font-size: 13px;
  font-weight: bold;
  font-style: italic;
  margin: 12px 0 5px;
  font-family: 'Courier New', Courier, monospace;
  color: #1a1a1a;
}

/* ─── Body text ──────────────────────────────────── */

.site-stage p {
  margin-bottom: 12px;
  text-align: justify;
  hyphens: auto;
  font-size: 13px;
  line-height: 1.65;
  color: #1a1a1a;
}

/* ─── Code / terminal ────────────────────────────── */

.site-stage pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  line-height: 1.55;
  margin: 10px 0 14px 22px;
  padding: 6px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  background: none;
  border: 1px solid #555;
}

.site-stage code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
}

.cmd-block {
  margin: 14px 0 18px;
}

.cmd-block .label {
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 4px;
}

.cmd-block pre {
  margin-left: 0;
}

hr.sep {
  border: none;
  border-top: 1px solid #aaa;
  margin: 12px 0;
}

/* ─── Lists ──────────────────────────────────────── */

.site-stage ul {
  list-style: none;
  margin: 8px 0 12px 14px;
  padding: 0;
}

.site-stage ul > li {
  margin-bottom: 4px;
  text-align: justify;
}

.site-stage ul > li::before {
  content: "- ";
}

.site-stage ol {
  margin: 8px 0 12px 28px;
  padding: 0;
}

.site-stage ol > li {
  margin-bottom: 5px;
  text-align: justify;
}

/* ─── Tables ─────────────────────────────────────── */

.site-stage table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 12px;
}

.site-stage th {
  text-align: left;
  padding: 3px 10px 3px 0;
  border-bottom: 1px solid #444;
  font-weight: bold;
}

.site-stage td {
  text-align: left;
  padding: 4px 10px 4px 0;
  vertical-align: top;
}

table.keys td:first-child {
  width: 80px;
  font-weight: bold;
  white-space: nowrap;
}

/* ─── Separators ─────────────────────────────────── */

.site-stage hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 16px 0;
}

.dash-sep {
  color: #888;
  font-size: 12px;
  margin: 8px 0;
  overflow: hidden;
  white-space: nowrap;
}

/* ─── Memory map diagram ─────────────────────────── */

.memmap {
  margin: 18px 0 18px 22px;
  width: fit-content;
  min-width: 340px;
  border: 1px solid #555;
  font-family: 'Courier New', Courier, monospace;
}

.memmap-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 28px;
  text-align: center;
  border-bottom: 1px solid #555;
  line-height: 1.5;
}

.memmap-block:last-child { border-bottom: none; }

.memmap-block .memmap-addr {
  font-size: 10px;
  color: #888;
  letter-spacing: 0.5px;
}

.memmap-block .memmap-name {
  font-size: 12px;
  font-weight: bold;
}

.memmap-block .memmap-desc {
  font-size: 10px;
  color: #555;
}

.memmap-block.region-shared  { background: #e2f0e2; }
.memmap-block.region-banked  { background: #dce8f8; }
.memmap-block.region-empty   { background: #f2f2f2; color: #999; }
.memmap-block.region-rom     { background: #fdf0dc; }
.memmap-block.region-tpa     { background: #f8f4ec; }
.memmap-block.region-os      { background: #fce8e0; }
.memmap-block.region-iobuf   { background: #f0f0f0; }

/* ─── Figures ────────────────────────────────────── */

figure {
  text-align: center;
  margin: 18px 0;
}

.caption {
  text-align: center;
  font-size: 12px;
  color: #555;
  margin: 6px 0 18px;
}

/* ─── Address ────────────────────────────────────── */

address {
  font-style: normal;
  margin-left: 55px;
  line-height: 1.9;
}

/* ─── Page footer ────────────────────────────────── */

.page-footer {
  position: absolute;
  bottom: 38px;
  left: 76px;
  right: 68px;
  border-top: 1px solid #444;
  padding-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.page-footer .iskra-logo {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
}

.page-num {
  letter-spacing: 1px;
}

/* ─── Fixed prev/next arrows ─────────────────────── */

.nav-prev,
.nav-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.1);
  color: var(--manual-cover);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
  padding: 18px 12px;
  border-radius: 4px;
  transition: background 0.15s;
  user-select: none;
  z-index: 100;
}

.nav-prev { left: calc(var(--nav-width, 0px) + 12px); }
.nav-next { right: 12px; }

@media (max-width: 980px) {
  .nav-prev { left: 12px; }
}

.nav-prev:hover,
.nav-next:hover {
  background: rgba(0, 0, 0, 0.22);
}

body.cover .nav-prev,
body.cover .nav-next {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

body.cover .nav-prev:hover,
body.cover .nav-next:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* =====================================================
   TABLE OF CONTENTS
   ===================================================== */

.toc-title {
  font-size: 14px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0 0 4px;
}

.toc-title + .rule {
  margin-bottom: 30px;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

.toc-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.toc-row a {
  color: #1a1a1a;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.toc-row a:hover {
  text-decoration: underline;
}

.toc-fill {
  flex: 1;
  border-bottom: 1px dotted #999;
  margin: 0 4px 3px;
  min-width: 16px;
}

.toc-pg {
  flex-shrink: 0;
  font-size: 11.5px;
  width: 44px;
  text-align: right;
}

.toc-l2 { padding-left: 22px; }
.toc-l3 { padding-left: 44px; }

.toc-group {
  margin-bottom: 6px;
}
