/* ══════════════════════════════════════════════════════════════════════════
   PIÑA DIGITAL · Guía de alta como Agente Digitalizador

   This page's own styles. Every colour, face, shadow and radius here goes
   through a name defined in `tokens.css`; there are no literals below except
   the ones that carry no design meaning (0, 100%, transparent, currentColor)
   and one documented exception in the print block.

   That rule is what makes dark mode free: `tokens.css` redefines the values
   per theme and nothing in this file needs to know a theme exists.
   ══════════════════════════════════════════════════════════════════════════ */

/* ================= BASE ================= */
* { box-sizing: border-box }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -.012em;
  line-height: 1.2;
}

p, li { text-wrap: pretty }
p { margin: 0 }

a {
  color: var(--accent-ink);
  text-decoration-color: var(--accent-ring);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: currentColor }

button, input, select { font: inherit; color: inherit }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* The 135° diagonal cut of the Piña Digital visual system. Each user sets
   its own --sa / --sb pair. */
.split { background: linear-gradient(135deg, var(--sa) 0 49.5%, var(--sb) 50.5% 100%) }

/* ================= TOP BAR ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  gap: 16px;
}

.mark { display: flex; align-items: center; gap: 9px; min-width: 0 }
.mark img { width: 24px; height: auto; display: block; flex: none }
.mark b {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.015em;
  white-space: nowrap;
}
.mark span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-left: 1px solid var(--line-strong);
  padding-left: 9px;
  white-space: nowrap;
}

.prog { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0 }
.prog-bar {
  width: clamp(90px, 18vw, 200px);
  height: 7px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
  flex: none;
}
.prog-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition: width .3s ease;
}
.prog-num {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.prog-reset {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-3);
  border-radius: 99px;
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.prog-reset:hover { background: var(--surface-2); color: var(--ink) }

@media (max-width: 640px) {
  .mark span,
  .prog-reset { display: none }
}

/* ================= HERO ================= */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.hero-ribbon { height: 8px; --sa: var(--p-navy); --sb: var(--p-purple) }
.hero-in {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 54px) clamp(16px, 3vw, 32px) clamp(24px, 4vw, 42px);
  display: grid;
  gap: clamp(16px, 2.6vw, 40px);
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 980px) {
  .hero-in { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: end }
  .hero-lead-wrap { padding-bottom: 3px }
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  gap: 9px;
}
.eyebrow::before {
  content: "";
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--p-pink) 0 49.5%, var(--p-purple) 50.5% 100%);
}

.hero h1 { font-size: clamp(29px, 4.6vw, 48px); margin: 14px 0 0 }
.hero-lead { max-width: 54ch; font-size: clamp(15.5px, 1.5vw, 17.5px); color: var(--ink-2) }

.hero-meta {
  grid-column: 1 / -1;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px clamp(20px, 3.4vw, 44px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.meta-i { display: flex; flex-direction: column; gap: 1px; min-width: 0 }
.meta-i dt {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.meta-i dd { margin: 0; font-size: 15px; font-weight: 600 }
.meta-lk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent-ring);
}
.meta-lk:hover { border-bottom-color: currentColor }
.meta-lk svg { width: 13px; height: 13px; flex: none; opacity: .75 }

/* ================= SHELL ================= */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 32px) 80px;
  display: grid;
  gap: clamp(24px, 4vw, 52px);
  grid-template-columns: 230px minmax(0, 1fr);
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr) }
}

.toc {
  position: sticky;
  top: 70px;
  align-self: start;
  padding: 26px 0;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
@media (max-width: 900px) {
  .toc { position: static; max-height: none; padding-bottom: 0 }
}
.toc p {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  counter-reset: toc;
}
.toc a {
  display: flex;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
}
.toc a::before {
  counter-increment: toc;
  content: counter(toc, decimal-leading-zero);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-3);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.toc a:hover { background: var(--surface-2); color: var(--ink) }
.toc a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700 }
.toc a.on::before { color: var(--accent-ink) }

.main { padding-top: 26px; display: flex; flex-direction: column; gap: 52px; min-width: 0 }

/* ================= SECTIONS ================= */
.sec { display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 86px }
.sec-head { display: flex; flex-direction: column; gap: 7px }
.sec-head h2 { font-size: clamp(22px, 3vw, 28px) }
.sec-head .sub { color: var(--ink-2); max-width: min(100%, 88ch) }
.src { font-size: 12px; color: var(--ink-3); font-style: italic }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: clamp(16px, 2.4vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card h3 { font-size: 18px }
.card h4 { font-size: 15px; font-family: var(--sans); font-weight: 800; letter-spacing: 0 }
.card p { max-width: min(100%, 86ch) }

.bullets {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 14.5px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* A bullet list introduced by its own subheading needs the gap the flex
   container does not give it. Was a `style="margin-top:8px"` on two <ul>s. */
h4 + .bullets { margin-top: 8px }

.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)) }

/* Secondary prose inside a card. Replaces the inline font-size/colour pairs
   the source document repeated on seven <p> elements. */
.card-note { font-size: 14.5px; color: var(--ink-2) }
.fine      { font-size: 14px;   color: var(--ink-2) }

.note {
  border-radius: var(--r);
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 14.5px;
}
.note b { font-weight: 800 }
.note.warn   { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--ink) }
.note.bad    { background: var(--bad-soft);    border-color: var(--bad-line);    color: var(--ink) }
.note.ok     { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ink) }
.note.accent { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--ink) }
.note-t {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15.5px;
  margin-bottom: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.ok     { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok) }
.chip.warn   { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--warn) }
.chip.bad    { background: var(--bad-soft);    border-color: var(--bad-line);    color: var(--bad) }
.chip.accent { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent-ink) }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none }
.tags li {
  font-size: 12.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-2);
}

/* ================= CHECKLIST ================= */
.ck { display: flex; flex-direction: column; gap: 2px }
.ck label {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s ease;
}
.ck label:hover { background: var(--surface-2) }
.ck input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  margin: 2px 0 0;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s ease, border-color .15s ease;
}
.ck input::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2.4px solid var(--on-accent);
  border-bottom: 2.4px solid var(--on-accent);
  transform: rotate(-45deg) scale(.5);
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  margin-top: -2px;
}
.ck input:checked { background: var(--accent); border-color: var(--accent) }
.ck input:checked::after { opacity: 1; transform: rotate(-45deg) scale(1) }
.ck .txt { font-size: 14.8px; line-height: 1.5; min-width: 0 }
.ck .txt b { font-weight: 700 }
.ck .txt small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; line-height: 1.5 }
.ck input:checked ~ .txt { color: var(--ink-3) }
.ck input:checked ~ .txt b { color: var(--ink-2) }

/* ================= STEPS ================= */
.steps { display: flex; flex-direction: column; gap: 0 }
.step {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 16px;
  padding-bottom: 24px;
  position: relative;
}
.step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 50px;
  bottom: 0;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
}
.step-n {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
  z-index: 1;
  --sa: var(--p-navy);
  --sb: var(--p-purple);
  color: var(--on-accent);
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  box-shadow: var(--shadow-1);
}
.step-b { display: flex; flex-direction: column; gap: 11px; padding-top: 5px; min-width: 0 }
.step-b h3 { font-size: 18.5px }
.step-b p { color: var(--ink-2); max-width: min(100%, 88ch) }
.step-b ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-2);
}

/* ================= REQUIREMENTS TOOL ================= */
.tool {
  background: var(--surface);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
}
.tool-top { --sa: var(--p-purple); --sb: var(--p-cyan); height: 6px }
.tool-in { padding: clamp(16px, 2.4vw, 24px); display: flex; flex-direction: column; gap: 18px }
.tool h3 { font-size: 19px }
.tool-note { color: var(--ink-2); font-size: 14.5px; max-width: min(100%, 86ch) }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0 }
.field > span { font-size: 12.5px; font-weight: 700; color: var(--ink-2) }
.field input {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px 11px;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.segs { display: flex; gap: 6px; flex-wrap: wrap }
.segs button {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  border-radius: 99px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink-2);
}
.segs button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.verdict {
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.verdict.ok  { background: var(--ok-soft);  border-color: var(--ok-line) }
.verdict.bad { background: var(--bad-soft); border-color: var(--bad-line) }
.verdict h4 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
  margin-bottom: 8px;
}
.verdict ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 14px }
/* The two paragraph shapes guide.js renders into the verdict box. They are
   classes rather than inline styles so `style-src` can stay 'self'. */
.verdict-tail { margin-top: 10px; font-size: 13.5px; color: var(--ink-2) }
.verdict-next { font-size: 14px }

/* ================= TABLES ================= */
.tw {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 14px }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top }
thead th {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none }
td b { font-weight: 700 }

/* ================= COMMON MISTAKES ================= */
.errs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)) }
.err {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--bad);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.err b { font-size: 14.5px; font-weight: 800 }
.err span { font-size: 13.5px; color: var(--ink-2); line-height: 1.5 }

/* ================= CONTACTS AND LINKS ================= */
.contact-p    { font-size: 15px }
.contact-when { color: var(--ink-3) }

.links { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)) }
.lk {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.lk:hover { border-color: var(--accent-ring); background: var(--accent-soft) }
.lk b { font-size: 14.5px; font-weight: 700 }
.lk span { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere }

.foot {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding-top: 22px;
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ================= PRINT ================= */
@media print {
  .topbar,
  .toc,
  .prog-reset { display: none }
  .shell { grid-template-columns: 1fr }
  /* Literal white on purpose: paper is white whatever theme the screen is in,
     and var(--surface) would print a dark page for a dark-mode reader. */
  body { font-size: 11pt; background: #fff }
  .card, .tool, .err, .lk { box-shadow: none; break-inside: avoid }
  .sec { break-inside: avoid-page }
}
