/* ==========================================================================
   AQS — aqsolutions.it/pulse
   Documento di progetto, sullo stesso impianto di ../styles.css: stessi font,
   token, header e footer del sito. Qui cambiano l'accento (viola, al posto
   del teal) e c'e' l'impaginazione lunga del documento, sul modello delle
   pagine-documento di Dossiero: indice in §, sezioni numerate, tabelle.
   ========================================================================== */

/* ---------- Accento viola ---------- */
:root {
  --accent: #6b3fd4;
  --accent-strong: #5228b0;
  --accent-soft: rgba(107, 63, 212, 0.08);
  --accent-line: rgba(107, 63, 212, 0.35);
  --doc-spine: 7rem;
  --doc-measure: 42rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #a88bfa;
    --accent-strong: #c9b8ff;
    --accent-soft: rgba(168, 139, 250, 0.1);
    --accent-line: rgba(168, 139, 250, 0.4);
  }
}

/* ---------- Intro ---------- */
.doc-intro {
  position: relative;
  padding: calc(var(--header-h) + 72px) 0 56px;
  overflow: hidden;
}
.doc-intro h1 {
  margin-top: 24px;
  max-width: 20ch;
  font-size: clamp(2.3rem, 4.6vw, 3.6rem);
  letter-spacing: -0.032em;
  line-height: 1.05;
  text-wrap: balance;
}
.doc-standfirst {
  margin-top: 22px;
  max-width: 46rem;
  font-size: 18px;
  color: var(--ink-2);
  text-wrap: pretty;
}
.doc-meta {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.doc-meta > div { padding: 14px 18px; background: var(--surface); }
.doc-meta dt { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.doc-meta dd { margin-top: 4px; font-size: 15px; font-weight: 500; }

/* ---------- Foglio ---------- */
.doc-sheet {
  margin-bottom: 96px;
  padding: 48px 56px 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  line-height: 1.7;
}
.doc-sheet p { color: var(--ink-2); text-wrap: pretty; }
.doc-sheet p + p { margin-top: 1em; }
.doc-sheet strong { color: var(--ink); font-weight: 600; }
.doc-sheet h3 { margin: 32px 0 10px; font-size: 18px; letter-spacing: -0.015em; }
.doc-lede { max-width: var(--doc-measure); font-size: 17px; }

/* Indice */
.doc-index { margin: 36px 0 8px; border-top: 1px solid var(--line); }
.doc-index li { border-bottom: 1px solid var(--line); }
.doc-index a {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.doc-index a:hover { background: var(--surface-2); }
.doc-index .n { min-width: 2.6rem; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); }
.doc-index .t { font-weight: 500; font-size: 15px; }
.doc-index .d {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

/* Sezioni: numero nella colonna a sinistra, testo a misura di lettura */
.doc-section { margin-top: 64px; }
.doc-section-head {
  display: grid;
  grid-template-columns: var(--doc-spine) minmax(0, 1fr);
  gap: 24px;
  align-items: baseline;
  padding-top: 16px;
  margin-bottom: 24px;
  border-top: 2px solid var(--ink);
}
.doc-section-head .num { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.doc-section-head h2 { font-size: clamp(1.4rem, 2.4vw, 1.75rem); letter-spacing: -0.025em; text-wrap: balance; }

.doc-body,
.doc-steps,
.doc-feats,
.doc-table-wrap,
.doc-split,
.doc-stack { margin-left: calc(var(--doc-spine) + 24px); }
.doc-body + *,
* + .doc-body { margin-top: 24px; }
.doc-section-head + * { margin-top: 0; }
.doc-col { max-width: var(--doc-measure); }
.doc-col > h3:first-child { margin-top: 0; }

.doc-rule {
  margin-bottom: 22px;
  padding: 20px 24px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
}
.doc-rule p { color: var(--ink); font-size: 17px; font-weight: 600; line-height: 1.5; }

.doc-list { padding-left: 1.2rem; list-style: disc; color: var(--ink-2); }
.doc-list li { margin-top: 10px; }
.doc-list li::marker { color: var(--accent); }

.doc-questions { margin-bottom: 22px; border-top: 1px solid var(--line); }
.doc-questions li {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.doc-questions span { padding-top: 3px; font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--accent); }

/* Il giro della giornata */
.doc-steps { border-top: 1px solid var(--line); }
.doc-step {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 20px;
  max-width: calc(var(--doc-measure) + 8rem);
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.doc-step-code { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--accent) !important; line-height: 1.1; }
.doc-step-code span {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.doc-brief {
  margin: 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.doc-brief figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.doc-brief figcaption span { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.doc-brief-note { margin-top: 14px !important; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted) !important; }

/* Funzioni */
.doc-feats { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; border-top: 1px solid var(--line); }
.doc-feats > div { padding: 18px 0; border-bottom: 1px solid var(--line); }
.doc-feats dt { font-weight: 600; letter-spacing: -0.01em; }
.doc-feats dd { margin-top: 6px; font-size: 15px; color: var(--ink-2); line-height: 1.6; }

/* Tabelle */
.doc-table-wrap { overflow-x: auto; }
.doc-table-wrap + .doc-body { margin-top: 28px; }
.doc-table { width: 100%; max-width: calc(var(--doc-measure) + 8rem); border-collapse: collapse; font-size: 15px; }
.doc-table th {
  padding: 10px 16px 10px 0;
  border-bottom: 2px solid var(--line-strong);
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.doc-table td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.doc-table td:first-child { width: 38%; color: var(--ink); font-weight: 500; }
.doc-table td:last-child { padding-right: 0; }
.tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.tag-now { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.tag-no { border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger); }
/* Nella tabella di §10 la prima colonna e' la descrizione: prende piu' spazio */
#s10 .doc-table td:first-child { width: auto; }
#s10 .doc-table td:last-child { width: 9rem; }

/* Cosa fa / cosa non fa */
.doc-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: calc(var(--doc-measure) + 8rem); }
.doc-yes,
.doc-no { padding: 22px 24px 24px; border: 1px solid var(--line); border-radius: 12px; }
.doc-yes { border-top: 3px solid var(--accent); }
.doc-no { border-top: 3px solid var(--danger); }
.doc-split h3 { margin: 0 0 4px; font-size: 16px; }
.doc-no .doc-list li::marker { color: var(--danger); }
.doc-split .doc-list { font-size: 15px; }

.doc-pipeline { padding-left: 1.4rem; list-style: decimal; color: var(--ink-2); margin: 12px 0 16px; }
.doc-pipeline li { margin-top: 4px; }
.doc-pipeline li::marker { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }

.doc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.doc-tags li {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

.doc-stack {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: calc(var(--doc-measure) + 8rem);
  border-top: 1px solid var(--line);
}
.doc-stack > div { padding: 14px 16px 14px 0; }
.doc-stack > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.doc-stack dt { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.doc-stack dd { margin-top: 4px; font-size: 14.5px; }

.doc-end { margin-top: 64px; padding-top: 20px; border-top: 1px solid var(--line); }
.doc-end a { color: var(--accent); border-bottom: 1px solid var(--accent-line); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .doc-sheet { padding: 40px 36px 48px; }
}

@media (max-width: 860px) {
  :root { --doc-spine: 0px; }
  .doc-section-head { grid-template-columns: 1fr; gap: 6px; }
  .doc-body,
  .doc-steps,
  .doc-feats,
  .doc-table-wrap,
  .doc-split,
  .doc-stack { margin-left: 0; }
  .doc-meta { grid-template-columns: 1fr 1fr; }
  .doc-feats,
  .doc-split { grid-template-columns: 1fr; }
  .doc-stack { grid-template-columns: 1fr 1fr; }
  .doc-stack > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .doc-stack > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .doc-index .d { display: none; }
}

@media (max-width: 600px) {
  .doc-intro { padding: calc(var(--header-h) + 40px) 0 40px; }
  .doc-standfirst { font-size: 16.5px; }
  .doc-sheet { margin: 0 -16px 64px; padding: 28px 16px 40px; border-radius: 0; border-left: 0; border-right: 0; }
  .doc-section { margin-top: 52px; }
  .doc-step { grid-template-columns: 1fr; gap: 6px; }
  .doc-step-code { display: flex; align-items: baseline; gap: 10px; }
  .doc-step-code span { margin-top: 0; }
  .doc-questions li { font-size: 16.5px; }
  .doc-table { font-size: 14px; }
  .doc-table td:first-child { width: 45%; }
  #s10 .doc-table td:last-child { width: auto; }
  .header-inner > .button { display: none; }
}
