/* =========================================================================
   Memoria Técnica · POO
   Tipografía: IBM Plex Sans (títulos) · Source Serif 4 (cuerpo) · JetBrains Mono (código)
   ========================================================================= */

:root {
  --ink:          #14181f;
  --ink-soft:     #2a2f3a;
  --muted:        #5b6478;
  --muted-2:      #8a93a6;
  --rule:         #e4e6ed;
  --rule-soft:    #eef0f5;
  --paper:        #fbfaf6;
  --card:         #ffffff;
  --accent:       #1c3d8f;      /* deep ink-blue */
  --accent-soft:  #eaf0fb;
  --code-bg:      #f5f6f8;
  --code-border:  #e4e6ed;
  --table-head:   #1a1f2b;
  --table-alt:    #f8f8f4;
  --warn:         #9b3a16;

  --font-body:    "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-sans:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  background: #ecebe5;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "kern", "liga", "calt", "onum";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 880px;
  margin: 40px auto 80px;
  padding: 72px 80px 96px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(20, 24, 31, 0.04),
              0 12px 40px rgba(20, 24, 31, 0.08);
  border-radius: 4px;
}

/* ========== Cover ========== */
.cover {
  margin: -16px 0 56px;
  padding: 36px 0 40px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.cover-eyebrow {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}
.cover-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 14px;
  text-wrap: balance;
  border: none;
  padding: 0;
  background: none;
}
.cover-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 400;
  font-size: 20px;
  color: var(--ink-soft);
  margin-bottom: 28px;
}
.cover-rule {
  width: 64px;
  height: 3px;
  background: var(--accent);
  margin: 4px 0 22px;
  border-radius: 1px;
}
.cover-meta {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.cover-team {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 2px;
}

/* ========== Headings ========== */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 72px 0 36px;
  padding: 0;
  text-transform: none;
  position: relative;
}
h1::before {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: var(--ink);
  margin-bottom: 18px;
}
h1::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background: var(--rule);
  margin-top: 18px;
}
.cover + h1 { margin-top: 8px; }

h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 56px 0 20px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: var(--ink);
}
h2 .num {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 14px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 3px;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  line-height: 1;
  transform: translateY(-2px);
}
h2 .ttl { flex: 1 1 auto; }

h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  margin: 32px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
}

h4 {
  font-size: 14.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--accent);
  margin: 22px 0 6px;
  letter-spacing: 0.005em;
}

/* ========== Body text ========== */
p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  text-wrap: pretty;
  hyphens: auto;
}
p + p { margin-top: 0; }

p strong, li strong {
  color: var(--ink);
  font-weight: 600;
}
p em, li em { color: var(--ink); }

/* ========== Lists ========== */
ul {
  margin: 8px 0 18px;
  padding-left: 20px;
  list-style: none;
}
ul li {
  position: relative;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 8px;
  padding-left: 4px;
  text-wrap: pretty;
}
ul li::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
ul li:last-child { margin-bottom: 0; }

/* ========== Tables ========== */
.table-wrap {
  margin: 16px 0 26px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
}
thead th {
  background: var(--table-head);
  color: #fff;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  padding: 10px 14px;
  border-right: 1px solid rgba(255,255,255,0.08);
  vertical-align: middle;
}
thead th:last-child { border-right: none; }

tbody td {
  padding: 9px 14px;
  border-top: 1px solid var(--rule);
  vertical-align: top;
  color: var(--ink-soft);
}
tbody tr:nth-child(even) td { background: var(--table-alt); }
tbody tr:hover td { background: #f0eee5; }

/* First column gets a slightly different treatment — usually a name/identifier */
tbody td:first-child {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
  letter-spacing: -0.005em;
}

/* If a table has 3 cols and middle col looks like a type (Tipo / Acceso / Retorno),
   monospace the type column too via class — but without parsing it's tricky.
   Apply a subtle ink color uniformly to thead, light bg to first column area. */

/* ========== Code blocks ========== */
pre.code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.4;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  margin: 18px 0 24px;
  border-radius: 3px;
  overflow-x: auto;
  color: var(--ink);
  white-space: pre;
  tab-size: 2;
}

/* Inline code (none in source but defensive) */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
  border: 1px solid var(--code-border);
}

/* ========== First section right after cover ========== */
.cover + h1 { margin-top: 0; }

/* Spacing between successive lists/paragraphs */
ul + p, p + ul { margin-top: 0; }
ul + h3, ul + h4 { margin-top: 28px; }
.table-wrap + p { margin-top: 0; }
pre.code + p { margin-top: 0; }

/* ========== Print ========== */
@page {
  size: A4;
  margin: 18mm 16mm;
}
@media print {
  body { background: #fff; }
  .page {
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    background: #fff;
  }
  h1 { break-before: page; page-break-before: always; }
  .cover + h1 { break-before: auto; page-break-before: auto; }
  h2, h3, h4 { break-after: avoid; page-break-after: avoid; }
  table, pre.code, .table-wrap { break-inside: avoid; page-break-inside: avoid; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  p { orphans: 3; widows: 3; }
}

/* ========== Responsive ========== */
@media (max-width: 720px) {
  .page { margin: 12px; padding: 36px 24px 56px; }
  .cover-title { font-size: 30px; }
  h1 { font-size: 20px; margin: 48px 0 24px; }
  h2 { font-size: 19px; gap: 10px; flex-wrap: wrap; }
  h3 { font-size: 15px; }
  body { font-size: 15px; }
  p, ul li { font-size: 14.5px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 8px 10px; }
}
