/* Argos QA — lector de especificación · layout del visor.
   La paleta, las fuentes y el logo vienen de flagare-theme.css (tema compartido).
   Aquí solo viven las variables de layout del visor y sus reglas, incluido el
   tema oscuro (esta es la única página con modo oscuro). */

:root {
  --side-w: 19rem;
  --measure: 74ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0d1b2a;
    --surface: #142336;
    --surface-2: #16273d;
    --ink: #e9eef4;
    --ink-2: #bccadb;
    --muted: #8ca0b4;
    --line: #24384f;
    --line-soft: #1b2c3f;
    --accent: #f2854a;
    --accent-ink: #f7a172;
    --accent-soft: #2a1a12;
    --pass: #41f084;
    --fail: #ef6a5f;
    --warn: #f0b429;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .38);
  }
}

:root[data-theme="dark"] {
  --ground: #0d1b2a;
  --surface: #142336;
  --surface-2: #16273d;
  --ink: #e9eef4;
  --ink-2: #bccadb;
  --muted: #8ca0b4;
  --line: #24384f;
  --line-soft: #1b2c3f;
  --accent: #f2854a;
  --accent-ink: #f7a172;
  --accent-soft: #2a1a12;
  --pass: #41f084;
  --fail: #ef6a5f;
  --warn: #f0b429;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15.5px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---------------------------------------------------------------- estructura */

.shell { display: flex; min-height: 100vh; align-items: flex-start; }

.side {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.5rem 0 3rem;
}

.brand { padding: 0 1.35rem; display: flex; flex-direction: column; gap: .2rem; }
.brandlogo { margin: 0 0 .6rem; align-self: flex-start; }
.brandmark {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: -.01em;
  color: var(--ink);
}
.brandsub { margin: 0; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.searchwrap { padding: 0 1.35rem; position: relative; }
#q {
  width: 100%;
  padding: .5rem .7rem;
  font: inherit;
  font-size: .85rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}
#q::placeholder { color: var(--muted); }

.results {
  position: absolute;
  left: 1.35rem; right: 1.35rem; top: calc(100% + 4px);
  z-index: 30;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: .3rem;
}
.rhit {
  display: block;
  padding: .4rem .55rem;
  border-radius: 5px;
  text-decoration: none;
  color: var(--ink);
  font-size: .82rem;
}
.rhit:hover, .rhit.on { background: var(--accent-soft); }
.rhit b { font-family: var(--f-mono); font-size: .78rem; color: var(--accent-ink); margin-right: .45rem; }
.rhit span { color: var(--muted); }
.rempty { padding: .5rem .55rem; font-size: .82rem; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 1.1rem; }
.navgroup { display: flex; flex-direction: column; gap: .12rem; }
.navtitle {
  margin: 0 0 .3rem;
  padding: 0 1.35rem;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
}
.navlink {
  display: block;
  padding: .3rem 1.35rem .3rem 1.2rem;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  font-size: .855rem;
}
.navlink:hover { color: var(--ink); background: var(--surface-2); }
.navlink.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 500; }
.navsub { display: none; flex-direction: column; padding: .15rem 0 .4rem; }
.navdoc.open .navsub { display: flex; }
.navsublink {
  padding: .16rem 1.35rem .16rem 2.1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .78rem;
  border-left: 2px solid transparent;
}
.navsublink:hover { color: var(--accent-ink); }
.navsublink.active { color: var(--accent-ink); border-left-color: var(--line); }

.main { flex: 1 1 auto; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .6rem 2.4rem;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.menubtn {
  display: none;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .2rem .55rem;
  cursor: pointer;
}
.stats { display: flex; flex-wrap: wrap; gap: .4rem; }
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  padding: .15rem .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--f-mono);
  font-size: .7rem;
  letter-spacing: .04em;
  color: var(--muted);
}
.stat b { color: var(--accent-ink); font-size: .78rem; font-variant-numeric: tabular-nums; }

.content { padding: 0 2.4rem 8rem; }

/* ------------------------------------------------------------------ artículo */

.doc { max-width: var(--measure); margin: 0 auto; padding-top: 3.2rem; scroll-margin-top: 3.5rem; }
.doc + .doc { border-top: 1px solid var(--line); margin-top: 4rem; }

.dochead { margin-bottom: 2rem; display: flex; flex-direction: column; gap: .35rem; }
.eyebrow {
  margin: 0;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
}
.doctitle {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  line-height: 1.14;
  letter-spacing: -.018em;
  text-wrap: balance;
}
.docmeta { margin: 0; font-size: .76rem; color: var(--muted); }
.docmeta code { background: none; border: none; padding: 0; color: var(--muted); }

.hd { text-wrap: balance; scroll-margin-top: 4rem; }
h1.hd {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.62rem;
  line-height: 1.2;
  margin: 2.8rem 0 .9rem;
  letter-spacing: -.015em;
}
h2.hd {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.25;
  margin: 2.4rem 0 .8rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--line);
}
h3.hd { font-size: 1.02rem; font-weight: 600; margin: 1.9rem 0 .55rem; }
h4.hd {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.6rem 0 .5rem;
}

p { margin: 0 0 .95rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.35rem; display: flex; flex-direction: column; gap: .22rem; }
li { padding-left: .15rem; }
li > ul, li > ol { margin: .22rem 0 .1rem; }
ul { list-style: none; padding-left: 1.1rem; }
ul > li { position: relative; }
ul > li::before {
  content: "";
  position: absolute;
  left: -.85rem; top: .68em;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .55;
}
ol > li::marker { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9em; }

hr { border: none; border-top: 1px solid var(--line); margin: 2.4rem 0; }

blockquote {
  margin: 1.2rem 0;
  padding: .85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 0 7px 7px 0;
  color: var(--ink-2);
  font-size: .93rem;
}

code {
  font-family: var(--f-mono);
  font-size: .855em;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: .05em .34em;
}
pre.code {
  margin: 0;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: var(--f-mono);
  font-size: .82rem;
  line-height: 1.55;
}
pre.code code { background: none; border: none; padding: 0; font-size: inherit; }

/* párrafo de definición: RF-001, RN-012… */
.def {
  scroll-margin-top: 4.5rem;
  padding: .1rem 0 .1rem .95rem;
  border-left: 2px solid var(--line);
  transition: border-color .25s, background-color .6s;
}
.def:target, tr:target, h2.hd:target, h3.hd:target { animation: flash 1.6s ease-out; }
.def:target { border-left-color: var(--accent); }
@keyframes flash {
  0%, 40% { background: var(--accent-soft); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .def:target, tr:target, h2.hd:target, h3.hd:target { animation: none; background: var(--accent-soft); }
  * { scroll-behavior: auto !important; }
}

.self-id {
  font-family: var(--f-mono);
  font-size: .82em;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: .01em;
}
strong .self-id { font-weight: 600; }

.xref {
  font-family: var(--f-mono);
  font-size: .82em;
  font-weight: 500;
  color: var(--accent-ink);
  text-decoration: none;
  background: var(--accent-soft);
  border-radius: 3px;
  padding: .04em .28em;
  white-space: nowrap;
  transition: background-color .15s;
}
.xref:hover { background: var(--accent); color: var(--surface); }
:root[data-theme="dark"] .xref:hover { color: #06171a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .xref:hover { color: #06171a; }
}

.ilink { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 2px; }
.ext::after { content: "↗"; font-size: .75em; margin-left: .12em; vertical-align: .1em; }

.srcnote {
  margin: 0 0 1.6rem;
  padding: .8rem 1rem;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 7px;
  font-family: var(--f-mono);
  font-size: .74rem;
  line-height: 1.6;
  color: var(--muted);
  white-space: pre-wrap;
}

/* --------------------------------------------------------------------- tablas */

.tw { overflow-x: auto; margin: 1.2rem 0 1.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tw table { border-collapse: collapse; width: 100%; font-size: .875rem; }
.tw th, .tw td { padding: .5rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.tw thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tw tbody tr:last-child td { border-bottom: none; }
.tw tbody tr:hover { background: var(--surface-2); }
.tw td:first-child { white-space: nowrap; }
.tw td:first-child:has(.self-id), .tw td:first-child:has(.xref) { font-variant-numeric: tabular-nums; }

/* tablas crudas heredadas de los snapshots de Notion */
.tw table[header-row="true"] tr:first-child td {
  background: var(--surface-2);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.diagram { padding: 1.4rem 1rem; display: flex; justify-content: center; }
.diagram pre.mermaid { margin: 0; background: none; border: none; }

/* ------------------------------------------------------------------- popover */

.pop {
  position: fixed;
  z-index: 60;
  max-width: 22rem;
  padding: .6rem .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: .82rem;
  line-height: 1.45;
  color: var(--ink-2);
  pointer-events: none;
}
.pop b { display: block; font-family: var(--f-mono); font-size: .74rem; color: var(--accent-ink); margin-bottom: .18rem; letter-spacing: .03em; }
.pop i { display: block; margin-top: .3rem; font-style: normal; font-size: .72rem; color: var(--muted); }

/* -------------------------------------------------------------------- responsive */

@media (max-width: 60rem) {
  .side {
    position: fixed;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: var(--shadow);
  }
  .side.open { transform: none; }
  .menubtn { display: block; }
  .topbar { padding: .6rem 1.1rem; }
  .content { padding: 0 1.1rem 6rem; }
  .stats { overflow-x: auto; }
}

