/* Psyseal. Una sola hoja de estilos, sin framework.
   Idea: el papel de un electrocardiograma (rejilla rosa sobre blanco) hace de eje de la gráfica;
   la tinta azul marino escribe, el azul de sello marca la acción, rojo y verde solo significan "hoy" y "aislado". */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-wdth.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/assets/fonts/courier-prime-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Courier Prime";
  src: url("/assets/fonts/courier-prime-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --paper: #fff7f5;
  --paper-2: #fdebe7;
  --ink: #14223f;
  --ink-2: #4a5775;
  --rule: rgb(20 34 63 / 0.2);
  --grid-minor: rgb(196 84 76 / 0.15);
  --grid-major: rgb(196 84 76 / 0.38);
  --stamp: #2c3cc8;
  --on-stamp: #fff7f5;
  --alarm: #b32a18;
  --calm: #0b7a63;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 62ch;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --typewriter: "Courier Prime", "Courier New", ui-monospace, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1a33;
    --paper-2: #16244a;
    --ink: #fbefec;
    --ink-2: #b4bdd6;
    --rule: rgb(251 239 236 / 0.22);
    --grid-minor: rgb(255 140 128 / 0.13);
    --grid-major: rgb(255 140 128 / 0.32);
    --stamp: #8fa0ff;
    --on-stamp: #0f1a33;
    --alarm: #ff7b66;
    --calm: #4fd1ae;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 16px;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.58 var(--sans);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Idioma: cada texto lleva data-l="en" o data-l="es". Sin JavaScript se ve en inglés. */
html:not([data-lang="es"]) [data-l="es"],
html[data-lang="es"] [data-l="en"] {
  display: none !important;
}

.wrap {
  width: min(100% - 2 * var(--gutter), 1120px);
  margin-inline: auto;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px;
  top: -64px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--stamp);
  color: var(--on-stamp);
  border-radius: 3px;
  font-weight: 600;
}
.skip:focus {
  top: 8px;
}

code {
  font-family: var(--typewriter);
  font-size: 0.92em;
  line-height: 1;
}

a {
  color: var(--stamp);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 3px solid var(--stamp);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Cabecera ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.01em;
}
.seal {
  width: 30px;
  height: 30px;
  flex: none;
}
.seal-edge {
  fill: var(--stamp);
}
.seal-ring {
  fill: none;
  stroke: var(--on-stamp);
  stroke-width: 1.6;
  opacity: 0.55;
}
.seal-psi {
  fill: none;
  stroke: var(--on-stamp);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.langs {
  display: flex;
  gap: 2px;
}
.lang-btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: 6px 8px;
  border-radius: 3px;
  cursor: pointer;
}
.lang-btn[aria-pressed="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
html:not(.js) .langs {
  display: none;
}

/* ---------- Portada ---------- */
.hero {
  padding-block: clamp(24px, 5vw, 64px) clamp(40px, 7vw, 88px);
}
.hero-title {
  margin: 0;
  max-width: 18ch;
  font-size: clamp(2rem, 0.7rem + 5.2vw, 4.25rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.lede {
  margin: 22px 0 0;
  max-width: 58ch;
  font-size: 1.1875rem;
  line-height: 1.55;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  margin-top: 28px;
}
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.85em 1.3em;
  background: var(--stamp);
  color: var(--on-stamp);
  border-radius: 3px;
  font-weight: 700;
  font-stretch: 108%;
  text-decoration: none;
}
.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline-color: var(--ink);
}

/* ---------- Monitor: la gráfica de latidos ---------- */
.monitor {
  margin: 40px 0 0;
  padding: clamp(12px, 2vw, 20px);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 30px;
  margin-bottom: 12px;
}
html:not(.js) .controls {
  display: none;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.seg-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.seg-opts {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper);
}
.seg-opts input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg-opts label {
  padding: 7px 13px;
  border-left: 1px solid var(--rule);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  cursor: pointer;
}
.seg-opts input:first-child + label {
  border-left: 0;
}
.seg-opts input:checked + label {
  background: var(--ink);
  color: var(--paper);
}
.seg-opts input:focus-visible + label {
  outline: 3px solid var(--stamp);
  outline-offset: -3px;
}

.strip + .strip {
  margin-top: 10px;
}
.strip-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}
.strip-name {
  font-weight: 700;
  font-stretch: 112%;
}
.strip-value {
  font-size: clamp(1.5rem, 1rem + 2.4vw, 2.25rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.is-alarm {
  color: var(--alarm);
}
.is-calm {
  color: var(--calm);
}
.strip-unit {
  color: var(--ink-2);
}
.strip-note {
  margin: 2px 0 6px;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.chart {
  display: block;
  width: 100%;
  height: 148px;
  background: var(--paper);
}
html:not(.js) .chart,
html:not(.js) .axis {
  display: none;
}
.g-minor {
  stroke: var(--grid-minor);
  stroke-width: 1;
}
.g-major {
  stroke: var(--grid-major);
  stroke-width: 1;
}
.base {
  stroke: var(--ink-2);
  stroke-width: 1;
  opacity: 0.4;
}
.ylabel {
  fill: var(--ink-2);
  stroke: var(--paper);
  stroke-width: 3px;
  stroke-linejoin: round;
  paint-order: stroke;
  font: 600 11px var(--sans);
}
.trace {
  fill: none;
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.trace-now {
  stroke: var(--alarm);
}
.trace-iso {
  stroke: var(--calm);
}
.axis {
  position: relative;
  height: 22px;
  margin-top: 4px;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.axis span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}
.axis span:nth-child(1) {
  left: 0;
  transform: none;
}
.axis span:nth-child(2) {
  left: 16.6667%;
}
.axis span:nth-child(3) {
  left: 33.3333%;
}
.axis span:nth-child(4) {
  left: 50%;
}
.axis span:nth-child(5) {
  left: 66.6667%;
}
.axis span:nth-child(6) {
  left: 83.3333%;
}
.axis span:nth-child(7) {
  left: 100%;
  transform: translateX(-100%);
}
.monitor figcaption {
  margin-top: 8px;
  max-width: 76ch;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.how {
  margin-top: 14px;
  max-width: 76ch;
  font-size: 0.9375rem;
}
.how summary {
  cursor: pointer;
  font-weight: 600;
}
.how p {
  margin: 0.7em 0 0;
}
.how code,
.hash {
  font-family: var(--typewriter);
  font-size: 0.9em;
}

/* ---------- Secciones ---------- */
.sec {
  border-top: 1px solid var(--rule);
  padding-block: clamp(44px, 7vw, 88px);
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px 56px;
}
@media (min-width: 900px) {
  .split {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  }
}
.h2 {
  margin: 0;
  font-size: clamp(1.5rem, 1.05rem + 1.7vw, 2.25rem);
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.h3 {
  margin: 40px 0 0;
  font-size: 1.125rem;
  font-weight: 700;
  font-stretch: 108%;
}
.prose p {
  margin: 0 0 1em;
  max-width: var(--measure);
}
.small {
  margin: 0 0 1em;
  max-width: var(--measure);
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.report + .small {
  margin-top: 10px;
}
.sample {
  margin-top: clamp(32px, 5vw, 56px);
}
.sample .h3 {
  margin-top: 0;
}
.sample .small {
  max-width: 80ch;
}

/* Tabla de revisiones */
.checks {
  width: 100%;
  margin-top: 4px;
  border-collapse: collapse;
}
.checks th,
.checks td {
  padding: 14px 18px 14px 0;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.checks thead th {
  padding-top: 0;
  border-top: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}
.checks tbody th {
  width: 22%;
  font-weight: 700;
  font-stretch: 108%;
}
@media (max-width: 719px) {
  .checks thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .checks,
  .checks tbody,
  .checks tr,
  .checks th,
  .checks td {
    display: block;
  }
  .checks tr {
    padding: 14px 0;
    border-top: 1px solid var(--rule);
  }
  .checks th,
  .checks td,
  .checks tbody th {
    width: auto;
    padding: 3px 0;
    border: 0;
  }
  .checks td::before {
    content: attr(data-label-en);
    display: block;
    margin-top: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-2);
  }
  html[data-lang="es"] .checks td::before {
    content: attr(data-label-es);
  }
}

/* Pasos: aquí sí hay una secuencia, así que van numerados */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps > li {
  position: relative;
  margin-bottom: 30px;
  padding-left: 3.4rem;
  counter-increment: step;
  max-width: 70ch;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.08em;
  font-size: 2rem;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1;
  color: var(--stamp);
}
.steps p {
  margin: 0;
}
.steps .btn {
  margin-top: 12px;
}
.verify {
  margin-top: 12px;
  font-size: 0.9375rem;
}
.verify summary {
  cursor: pointer;
  font-weight: 600;
}
.verify p {
  margin: 0.6em 0 0;
}
.hash {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  user-select: all;
}

.cmd {
  display: flex;
  align-items: stretch;
  max-width: 100%;
  margin: 12px 0 0;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.cmd code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font: 400 0.9375rem/1.45 var(--typewriter);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cmd button {
  flex: none;
  padding: 0 14px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--stamp);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--rule);
  cursor: pointer;
}
html:not(.js) .cmd button {
  display: none;
}
.cmd button .t-done,
.cmd button.is-done .t-copy {
  display: none;
}
.cmd button.is-done .t-done {
  display: inline;
}
.also {
  margin: 24px 0 0;
  max-width: 70ch;
}

.report {
  margin: 14px 0 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: var(--paper-2);
  border-left: 4px solid var(--stamp);
  border-radius: 0 4px 4px 0;
  font: 400 0.78125rem/1.6 var(--typewriter);
  white-space: pre;
}
.report b {
  font-weight: 700;
}
.report .hi {
  color: var(--alarm);
}
.report .omit {
  color: var(--ink-2);
}

/* Lo que nunca hace */
.never p {
  margin: 0 0 14px;
  max-width: var(--measure);
}
.never strong {
  font-weight: 700;
  font-stretch: 108%;
}

/* ---------- Pie ---------- */
.foot {
  border-top: 1px solid var(--rule);
  padding-block: 36px 64px;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.foot p {
  margin: 0 0 0.7em;
  max-width: 76ch;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0 0 18px;
  font-size: 0.9375rem;
  font-weight: 600;
}

/* ---------- 404 ---------- */
.lost {
  padding-block: 12vh 20vh;
}
.lost p {
  max-width: 50ch;
}

@media (max-width: 480px) {
  .lede {
    font-size: 1.0625rem;
  }
  .seg-opts label {
    padding: 8px 11px;
  }
}
