/* MainframeGo - single stylesheet, no external resources */

:root {
  color-scheme: light;
  --paper: #F7F9F6;
  --surface: #FFFFFF;
  --band: #E4EFE7;
  --ink: #132238;
  --muted: #566578;
  --rule: #C7D3CB;
  --blue: #1D4ED8;
  --amber: #96480A;
  --teal: #0C6B63;
  --off: #AEBBB2;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, ui-serif, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh: 1.35rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0F1A2B;
    --surface: #132036;
    --band: #1A2B45;
    --ink: #E6ECF5;
    --muted: #9FADC0;
    --rule: #2C3E5B;
    --blue: #93B7FF;
    --amber: #F2B755;
    --teal: #5DD3C4;
    --off: #46587A;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0F1A2B;
  --surface: #132036;
  --band: #1A2B45;
  --ink: #E6ECF5;
  --muted: #9FADC0;
  --rule: #2C3E5B;
  --blue: #93B7FF;
  --amber: #F2B755;
  --teal: #5DD3C4;
  --off: #46587A;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}

a { color: var(--blue); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 1.25rem; }

.pular {
  position: absolute; left: -999rem; top: 0;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem;
}
.pular:focus { left: 0; z-index: 10; }

/* Header */

.topo { border-bottom: 2px solid var(--ink); }
.topo .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.4rem 1.4rem; padding-top: 1rem; padding-bottom: 0.9rem;
}
.marca {
  font: 700 1.5rem/1 var(--serif); letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; margin-right: auto;
}
.menu { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; margin: 0; padding: 0; list-style: none; }
.menu a { color: var(--ink); font-size: 0.95rem; text-decoration: none; padding: 0.35rem 0; display: inline-block; }
.menu a:hover { text-decoration: underline; }

.tema {
  font: 600 0.875rem/1 var(--sans);
  color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: 999px;
  padding: 0.5rem 0.9rem; cursor: pointer;
}
.tema:hover { background: var(--ink); color: var(--paper); }
.tema[hidden] { display: none; }

/* Intro */

.abertura { padding: 3.2rem 0 0; }
.abertura h1 {
  font: 700 clamp(2.1rem, 7.2vw, 3.5rem)/1.08 var(--serif);
  letter-spacing: -0.02em; margin: 0 0 1.2rem; max-width: 16em;
}
.abertura p { margin: 0 0 2rem; max-width: 34em; font-size: 1.125rem; color: var(--muted); }

.indice { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.indice li { border-bottom: 1px solid var(--rule); }
.indice a {
  display: grid; grid-template-columns: 7rem 1fr; gap: 0.2rem 1rem; align-items: baseline;
  padding: 0.85rem 0; color: var(--ink); text-decoration: none;
}
.indice a:hover .ling { text-decoration: underline; }
.indice .ling { font: 700 1.25rem/1.2 var(--serif); }
.indice .desc { color: var(--muted); font-size: 0.975rem; }

.regua-faixa {
  margin-top: 2.8rem; overflow: hidden; white-space: nowrap;
  font: 0.8125rem/1 var(--mono); color: var(--muted);
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0; user-select: none; -webkit-user-select: none;
}

/* Language sections */

.linguagem { padding: 3.2rem 0 0.5rem; }
.linguagem h2 {
  font: 700 clamp(1.9rem, 6vw, 2.6rem)/1.1 var(--serif);
  letter-spacing: -0.015em; margin: 0 0 0.7rem;
}
.linguagem > .wrap > p { margin: 0 0 1.5rem; max-width: 36em; }

/* Column map */

.colunas { margin: 0 0 2.6rem; }
.colunas figcaption { font-weight: 600; margin-bottom: 0.6rem; }
.mapa { display: flex; height: 2.4rem; border: 1.5px solid var(--ink); background: var(--surface); }
.mapa span {
  flex-basis: 0; flex-shrink: 1; min-width: 5px; overflow: hidden;
  font: 600 0.75rem/2.3rem var(--mono); text-align: center; white-space: nowrap;
  color: var(--paper);
}
.mapa span + span { border-left: 1.5px solid var(--surface); }
.n1 { flex-grow: 1; }
.n4 { flex-grow: 4; }
.n5 { flex-grow: 5; }
.n6 { flex-grow: 6; }
.n8 { flex-grow: 8; }
.n56 { flex-grow: 56; }
.n61 { flex-grow: 61; }
.n80 { flex-grow: 80; }
.c-a { background: var(--blue); }
.c-b { background: var(--amber); }
.c-c { background: var(--teal); }
.c-d { background: var(--ink); }
.c-off { background: var(--off); }
.c-vazio { background: transparent; }

.legenda { margin: 0.9rem 0 0; padding: 0; list-style: none; font-size: 0.95rem; }
.legenda li { display: grid; grid-template-columns: 0.9rem 3.6rem 1fr; gap: 0 0.6rem; align-items: baseline; padding: 0.25rem 0; }
.legenda .cor { width: 0.9rem; height: 0.9rem; align-self: start; margin-top: 0.38rem; border: 1px solid var(--ink); }
.legenda .col { font: 600 0.875rem/1.4 var(--mono); }

/* Examples */

.exemplo { margin: 0 0 3rem; }
.exemplo h3 { font: 700 1.35rem/1.25 var(--serif); margin: 0 0 0.5rem; }
.exemplo > p { margin: 0 0 1rem; max-width: 36em; }

.rolagem {
  overflow-x: auto; border: 1px solid var(--rule); border-left: 4px solid var(--ink);
  background: var(--surface);
}
.listagem {
  margin: 0; padding: var(--lh) 1rem;
  width: max-content; min-width: 100%;
  font: 0.8125rem/var(--lh) var(--mono); white-space: pre; tab-size: 8;
  color: var(--ink);
  background-image: linear-gradient(var(--band) 50%, transparent 50%);
  background-size: 100% calc(var(--lh) * 6);
  background-origin: content-box;
}
.listagem code { font: inherit; }
.listagem .regua { color: var(--muted); user-select: none; -webkit-user-select: none; }
.listagem .com { color: var(--muted); font-style: italic; }
.listagem .pal { color: var(--blue); font-weight: 600; }
.listagem .txt { color: var(--amber); }
.listagem .rot { color: var(--teal); font-weight: 600; }

.notas { margin: 1rem 0 0; padding-left: 1.2rem; max-width: 36em; font-size: 0.975rem; }
.notas li { margin-bottom: 0.4rem; }
.notas code, p code {
  font: 0.9em var(--mono); background: var(--band); padding: 0.08em 0.3em; border-radius: 2px; white-space: pre-wrap;
}

.mais { margin: 1rem 0 0; font-weight: 600; max-width: 36em; }

/* Numbered listing: the number comes from CSS and is not part of the copied text */

.numerada { counter-reset: linha; }
.numerada .ln { scroll-margin-top: 4rem; }
.numerada .ln::before {
  counter-increment: linha; content: counter(linha);
  display: inline-block; width: 5ch; margin-right: 3ch; text-align: right;
  color: var(--muted); font-style: normal; font-weight: 400;
  user-select: none; -webkit-user-select: none;
}
.numerada .ln:target::before { background: var(--amber); color: var(--paper); font-weight: 700; }
.numerada .regua { padding-left: 8ch; }

/* Simulated 3270 screen (always dark, like the emulator) */

.tela-3270 { margin: 0 0 1.4rem; }
.tela-3270 figcaption { font-size: 0.925rem; color: var(--muted); margin-top: 0.5rem; max-width: 40em; }
.rolagem-tela { border: 1px solid var(--rule); border-left: 4px solid var(--ink); background: #0A0E14; }
.tela {
  margin: 0; padding: 0.9rem 1rem; width: max-content; min-width: 100%;
  font: 0.75rem/1.3 var(--mono); white-space: pre;
  background: #0A0E14; color: #7AA7FF;
}
.tela code { font: inherit; }
.t-azu { color: #7AA7FF; }
.t-bra { color: #F2F4F7; font-weight: 600; }
.t-ver { color: #FF6B6B; font-weight: 600; }
.t-vde { color: #5FE07A; }
.t-ama { color: #FFE066; font-weight: 600; }
.t-tur { color: #4FE3E3; }
.t-ros { color: #FF8AD8; }

/* Complete programs, on the home page itself */

.programa { scroll-margin-top: 1rem; padding-top: 1.4rem; border-top: 2px solid var(--ink); margin-top: 2.6rem; }
.programa h3 { font-size: clamp(1.45rem, 4.5vw, 1.8rem); margin-bottom: 0.8rem; }
.programa h4 { font: 700 1.15rem/1.3 var(--serif); margin: 2.2rem 0 0.8rem; scroll-margin-top: 1rem; }
.programa h4 .qtd { font: 400 0.9rem var(--sans); color: var(--muted); margin-left: 0.4rem; }
.programa .notas { margin-bottom: 1rem; }
.pular-fonte { margin: 0 0 0.6rem; font-size: 0.925rem; }

.ficha {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.4rem;
  margin: 0 0 1.2rem; padding: 1rem 0; font-size: 0.975rem;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.ficha dt { font-weight: 700; }
.ficha dd { margin: 0; }
.ficha code, .cfg code, .rotinas code {
  font: 0.9em var(--mono); background: var(--band); padding: 0.08em 0.3em; border-radius: 2px;
}

.tabela-rolagem { border-left-width: 1px; }
.cfg { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.cfg th, .cfg td { text-align: left; vertical-align: top; padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--rule); }
.cfg thead th { border-bottom: 2px solid var(--ink); font-weight: 700; }
.cfg tbody th { font-weight: 400; white-space: nowrap; }
.cfg td:nth-child(2) { white-space: nowrap; }
.cfg tbody tr:last-child > * { border-bottom: 0; }

.rotinas {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.4rem 2rem; margin: 0 0 1rem;
}
.rotinas h5 { font: 700 1.1rem/1.3 var(--serif); margin: 0 0 0.5rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--ink); }
.rotinas h5 a { color: var(--ink); text-decoration: none; }
.rotinas h5 a:hover { text-decoration: underline; }
.rotinas ul { margin: 0; padding: 0; list-style: none; font-size: 0.925rem; }
.rotinas li { padding: 0.2rem 0; }
.rotinas li a { font: 600 0.875rem var(--mono); margin-right: 0.3rem; }
.rotinas li span { color: var(--muted); }

@media (max-width: 30rem) {
  .ficha { grid-template-columns: 1fr; gap: 0.1rem; }
  .ficha dd { margin-bottom: 0.6rem; }
}

/* About and footer */

.sobre { padding: 2.6rem 0 3rem; border-top: 2px solid var(--ink); margin-top: 1rem; }
.sobre h2 { font: 700 1.9rem/1.15 var(--serif); margin: 0 0 0.9rem; }
.sobre p { margin: 0 0 1rem; max-width: 36em; }

.rodape { border-top: 1px solid var(--rule); padding: 1.4rem 0 2.4rem; font-size: 0.925rem; color: var(--muted); }
.rodape .wrap { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; justify-content: space-between; }
.rodape p { margin: 0; }

/* Error page */

.erro { padding: 4rem 0 5rem; }
.erro h1 { font: 700 clamp(2rem, 7vw, 3rem)/1.1 var(--serif); margin: 0 0 1rem; }
.erro p { max-width: 32em; margin: 0 0 1rem; }

@media (min-width: 48rem) {
  .listagem { font-size: 0.875rem; }
  .tela { font-size: 0.8125rem; }
  .abertura { padding-top: 4.5rem; }
}
