/* ── Guide visuals: .crescita-viz (P1 rewrite, 2026-10-27) ─────────────────────
   Explanatory graphics authored as HTML inside a guide, so the text stays real text:
   readable at 375px, read by screen readers and search engines. Kinds: photo,
   layers, timeline, risk matrix, decision flow; added for the guide sweep (1.107.0):
   check grid, journey, versus, bars. Motion is a reveal driven by
   guide-viz.js (html.viz-js + .is-in); without the script, with reduced motion and
   in print everything is simply shown. The ok / warn / stop colours are status
   colours for charts only, never brand surfaces. Loaded on single guide posts,
   after risorse.css. */

.crescita-guide__content .crescita-viz {
  --viz-ok: #2E7D5B;
  --viz-ok-bg: #E8F3EE;
  --viz-warn: #A86A12;
  --viz-warn-bg: #FBF1DF;
  --viz-stop: #B23B3B;
  --viz-stop-bg: #F8E6E6;
  margin: var(--space-xl) auto;
  text-align: left;
}

@media (min-width: 1100px) {
  .crescita-guide__content > .crescita-viz { max-width: 960px; }
  .crescita-guide__content > .crescita-viz--photo { max-width: 1080px; }
}

.crescita-guide__content .crescita-viz figcaption {
  margin-top: var(--space-sm);
  text-align: center;
  text-wrap: pretty;
}

.crescita-viz__title {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--crescita-midnight);
  text-align: center;
}

/* Photo */
.crescita-guide__content .crescita-viz--photo img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius-card, 16px);
}

/* Layers: three bands, the law on top, each narrower in scope of who it binds. */
.viz-layers { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: layer; }
.viz-layers > li { margin: 0; }
.viz-layer {
  position: relative;
  display: grid;
  gap: 0.3rem 1.5rem;
  padding: 1.15rem 1.25rem 1.2rem 3.6rem;
  border-radius: var(--radius-card, 16px);
  background: var(--crescita-sand);
  border: 1px solid var(--color-border);
  counter-increment: layer;
}
.viz-layer::before {
  content: counter(layer);
  position: absolute;
  left: 1.05rem;
  top: 1.1rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  background: var(--crescita-midnight);
}
.viz-layer:nth-child(2)::before { background: var(--crescita-ocean); }
.viz-layer:nth-child(3)::before { background: var(--crescita-ocean-bright); }
.viz-layer__name { font-family: var(--font-primary); font-weight: 700; font-size: 1.125rem; line-height: 1.35; color: var(--crescita-midnight); }
.viz-layer__row { font-size: 0.975rem; line-height: 1.5; color: var(--crescita-midnight); }
.viz-layer__row b { display: block; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-text-secondary); }

@media (min-width: 768px) {
  .viz-layer { grid-template-columns: 1fr 1fr 1.3fr; align-items: start; }
  .viz-layer:nth-child(2) { margin-inline: 1.25rem; }
  .viz-layer:nth-child(3) { margin-inline: 2.5rem; }
}

/* Timeline: one column on phones, two alternating columns on wide screens. */
.viz-timeline { list-style: none; margin: 0; padding: 0 0 0 1.9rem; position: relative; display: grid; gap: 1.15rem; }
.viz-timeline::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 0.45rem;
  bottom: 0.45rem;
  width: 2px;
  background: var(--color-border);
  transform-origin: top;
}
.viz-tl { position: relative; margin: 0; }
.viz-tl::before {
  content: "";
  position: absolute;
  left: -1.83rem;
  top: 0.3rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--crescita-ocean);
  box-sizing: border-box;
}
.viz-tl--key::before { background: var(--crescita-ocean); }
.viz-tl__date { display: block; font-weight: 700; font-size: 0.875rem; letter-spacing: 0.03em; color: var(--crescita-ocean); }
.viz-tl__what { display: block; font-weight: 600; line-height: 1.4; color: var(--crescita-midnight); }
.viz-tl__why { display: block; margin-top: 0.15rem; font-size: 0.95rem; line-height: 1.5; color: var(--color-text-secondary); }

@media (min-width: 900px) {
  .viz-timeline { padding-left: 0; grid-template-columns: 1fr 1fr; column-gap: 3.5rem; row-gap: 1.4rem; }
  .viz-timeline::before { left: calc(50% - 1px); }
  .viz-tl:nth-child(odd) { grid-column: 1; text-align: right; }
  .viz-tl:nth-child(even) { grid-column: 2; margin-top: 2.6rem; }
  .viz-tl:nth-child(odd)::before { left: auto; right: calc(-1.75rem - 0.475rem); }
  .viz-tl:nth-child(even)::before { left: calc(-1.75rem - 0.475rem); }
}

/* Risk matrix: three columns on wide screens, three stacked groups on phones. */
.viz-risk { display: grid; gap: 1rem; }
@media (min-width: 900px) { .viz-risk { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.viz-risk__col { padding: 1rem 1rem 1.1rem; border-radius: var(--radius-card, 16px); border: 1px solid var(--color-border); }
.viz-risk__col--ok { background: var(--viz-ok-bg); }
.viz-risk__col--warn { background: var(--viz-warn-bg); }
.viz-risk__col--stop { background: var(--viz-stop-bg); }
.viz-risk__head { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.75rem; font-family: var(--font-primary); font-weight: 700; font-size: 1.05rem; color: var(--crescita-midnight); }
.viz-risk__head::before { content: ""; flex: none; width: 0.8rem; height: 0.8rem; border-radius: 50%; }
.viz-risk__col--ok .viz-risk__head::before { background: var(--viz-ok); }
.viz-risk__col--warn .viz-risk__head::before { background: var(--viz-warn); }
.viz-risk__col--stop .viz-risk__head::before { background: var(--viz-stop); }
.viz-risk ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.viz-risk li { margin: 0; padding: 0.65rem 0.8rem; background: #fff; border-radius: 10px; font-size: 0.95rem; line-height: 1.45; color: var(--crescita-midnight); box-shadow: 0 1px 0 var(--color-border); }
.viz-risk__tag { display: block; margin-top: 0.2rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: var(--color-text-secondary); }

/* Decision flow: questions down a spine, each with the exit when the answer is wrong. */
.viz-flow { list-style: none; margin: 0 auto; padding: 0; max-width: 760px; }
.viz-flow__step { position: relative; display: grid; gap: 0.5rem; margin: 0; padding: 0 0 1.5rem 3rem; }
.viz-flow__step::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: var(--crescita-midnight);
}
.viz-flow__step::after {
  content: "";
  position: absolute;
  left: calc(1rem - 1px);
  top: 2rem;
  bottom: 0;
  width: 2px;
  background: var(--crescita-ocean);
  transform-origin: top;
}
.viz-flow__q { padding-top: 0.25rem; font-family: var(--font-primary); font-weight: 600; font-size: 1.05rem; line-height: 1.4; color: var(--crescita-midnight); }
.viz-flow__exit { padding: 0.6rem 0.85rem; border-radius: 10px; background: var(--viz-stop-bg); border: 1px solid color-mix(in srgb, var(--viz-stop) 22%, transparent); font-size: 0.95rem; line-height: 1.45; color: var(--crescita-midnight); }
.viz-flow__exit b { color: var(--viz-stop); }
.viz-flow__end { position: relative; margin: 0 0 0 3rem; padding: 0.9rem 1rem; border-radius: 12px; background: var(--viz-ok-bg); border: 1px solid color-mix(in srgb, var(--viz-ok) 25%, transparent); font-weight: 600; line-height: 1.45; color: var(--crescita-midnight); }
.viz-flow__end::before {
  content: "\2713";
  position: absolute;
  left: -3rem;
  top: 0.7rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--viz-ok);
}

/* Check grid: numbered checks a reader runs on their own practice (sweep, 2026-10-27).
   One column on phones, two at 640px, three at 1000px. Each card: number, name, what to
   open, how long it takes. */
.viz-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; counter-reset: check; }
@media (min-width: 640px) { .viz-checks { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .viz-checks { grid-template-columns: repeat(3, 1fr); } }
.viz-check {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  margin: 0;
  padding: 1.05rem 1.1rem 1.1rem 3.4rem;
  border-radius: var(--radius-card, 16px);
  background: var(--crescita-sand);
  border: 1px solid var(--color-border);
  counter-increment: check;
}
.viz-check::before {
  content: counter(check);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: var(--crescita-midnight);
}
.viz-check__name { font-family: var(--font-primary); font-weight: 700; font-size: 1.05rem; line-height: 1.35; color: var(--crescita-midnight); }
.viz-check__what { font-size: 0.95rem; line-height: 1.5; color: var(--crescita-midnight); }
.viz-check__time { margin-top: 0.15rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.03em; color: var(--crescita-ocean); }

/* Journey: the stages of one path in order. A column with a connecting line on phones;
   a row of equal stages joined by arrows from 900px. Each stage: label, name, one line. */
.viz-journey { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; counter-reset: stage; }
.viz-stage {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.3rem;
  margin: 0;
  padding: 1rem 1.1rem 1.05rem;
  border-radius: var(--radius-card, 16px);
  background: #fff;
  border: 1px solid var(--color-border);
  counter-increment: stage;
}
.viz-stage__label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--crescita-ocean); }
.viz-stage__name { font-family: var(--font-primary); font-weight: 700; font-size: 1.05rem; line-height: 1.35; color: var(--crescita-midnight); }
.viz-stage__what { font-size: 0.95rem; line-height: 1.5; color: var(--color-text-secondary); }
.viz-stage:not(:last-child)::after {
  content: "\2193";
  position: absolute;
  left: 50%;
  bottom: -0.95rem;
  transform: translateX(-50%);
  z-index: 1;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--crescita-midnight);
}
@media (min-width: 900px) {
  .viz-journey { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1.1rem; }
  .viz-stage:not(:last-child)::after { content: "\2192"; left: auto; right: -0.9rem; bottom: auto; top: 50%; transform: translateY(-50%); }
}

/* Versus: what is often said, against what the cited source says. Two cells per row,
   stacked on phones. The source line names where the second cell comes from. */
.viz-versus { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.viz-vs { display: grid; margin: 0; border-radius: var(--radius-card, 16px); border: 1px solid var(--color-border); overflow: hidden; background: #fff; }
@media (min-width: 768px) { .viz-vs { grid-template-columns: 1fr 1.25fr; } }
.viz-vs__claim, .viz-vs__fact { padding: 0.9rem 1.05rem 1rem; font-size: 0.975rem; line-height: 1.5; color: var(--crescita-midnight); }
.viz-vs__claim { background: var(--viz-stop-bg); }
.viz-vs__fact { background: var(--viz-ok-bg); }
.viz-vs__claim b, .viz-vs__fact b { display: block; margin-bottom: 0.2rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.viz-vs__claim b { color: var(--viz-stop); }
.viz-vs__fact b { color: var(--viz-ok); }
.viz-vs__source { display: block; margin-top: 0.35rem; font-size: 0.82rem; color: var(--color-text-secondary); }

/* Bars: real, sourced figures only (never illustrative). Each row sets --v, its share of the
   largest value as a number from 0 to 100, inline: style="--v:62". The value is printed
   as text beside the bar, so the chart reads without colour and in print. */
.viz-bars { list-style: none; margin: 0 auto; padding: 0; max-width: 760px; display: grid; gap: 0.7rem; }
.viz-bar { display: grid; grid-template-columns: minmax(6.5rem, 9rem) 1fr auto; align-items: center; gap: 0.75rem; margin: 0; }
.viz-bar__label { font-size: 0.95rem; line-height: 1.35; color: var(--crescita-midnight); }
.viz-bar__track { height: 0.95rem; border-radius: 999px; background: var(--crescita-sand); overflow: hidden; }
.viz-bar__fill { display: block; height: 100%; width: calc(var(--v, 0) * 1%); border-radius: inherit; background: var(--crescita-ocean); transform-origin: left; }
.viz-bar--key .viz-bar__fill { background: var(--crescita-midnight); }
.viz-bar__value { min-width: 3.5rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--crescita-midnight); }
.viz-bars__source { margin: 0.75rem auto 0; max-width: 760px; font-size: 0.85rem; color: var(--color-text-secondary); text-align: center; }

/* Motion: reveal on scroll, staggered children, lines that draw. */
@media (prefers-reduced-motion: no-preference) {
  html.viz-js .crescita-viz .viz-reveal > * { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
  html.viz-js .crescita-viz.is-in .viz-reveal > * { opacity: 1; transform: none; }
  html.viz-js .crescita-viz.is-in .viz-reveal > :nth-child(2) { transition-delay: 0.12s; }
  html.viz-js .crescita-viz.is-in .viz-reveal > :nth-child(3) { transition-delay: 0.24s; }
  html.viz-js .crescita-viz.is-in .viz-reveal > :nth-child(4) { transition-delay: 0.36s; }
  html.viz-js .crescita-viz.is-in .viz-reveal > :nth-child(5) { transition-delay: 0.48s; }
  html.viz-js .crescita-viz.is-in .viz-reveal > :nth-child(6) { transition-delay: 0.6s; }
  html.viz-js .crescita-viz.is-in .viz-reveal > :nth-child(n+7) { transition-delay: 0.72s; }
  html.viz-js .crescita-viz .viz-timeline::before,
  html.viz-js .crescita-viz .viz-flow__step::after { transform: scaleY(0); transition: transform 1.1s ease 0.2s; }
  html.viz-js .crescita-viz.is-in .viz-timeline::before,
  html.viz-js .crescita-viz.is-in .viz-flow__step::after { transform: scaleY(1); }
  html.viz-js .crescita-viz .viz-bar__fill { transform: scaleX(0); transition: transform 1s ease 0.25s; }
  html.viz-js .crescita-viz.is-in .viz-bar__fill { transform: scaleX(1); }
}

@media print {
  .crescita-viz .viz-reveal > * { opacity: 1 !important; transform: none !important; }
  .crescita-viz .viz-timeline::before,
  .crescita-viz .viz-flow__step::after,
  .crescita-viz .viz-bar__fill { transform: none !important; }
}

/* The guide's own list rules (risorse.css: .crescita-guide__content ul/ol, centred lists with
   inside markers, no padding) outrank the single-class component selectors above, which
   put timeline text on top of its line and hid the dots. Scoped overrides, same container. */
.crescita-guide__content .crescita-viz :where(.viz-layers, .viz-timeline, .viz-flow, .viz-risk ul, .viz-checks, .viz-journey, .viz-versus, .viz-bars) {
  list-style: none;
  margin-inline: 0;
  padding-left: 0;
  text-align: left;
}
.crescita-guide__content .crescita-viz :where(.viz-layers, .viz-timeline, .viz-flow, .viz-risk ul, .viz-checks, .viz-journey, .viz-versus, .viz-bars) > li { margin-block: 0; }
.crescita-guide__content .crescita-viz .viz-timeline { padding-left: 1.9rem; }
@media (min-width: 900px) {
  .crescita-guide__content .crescita-viz .viz-timeline { padding-left: 0; }
  .crescita-guide__content .crescita-viz .viz-tl:nth-child(odd) { text-align: right; }
}
.crescita-guide__content .crescita-viz .viz-flow { margin-inline: auto; }

/* The decision flow's closing box: same column as the steps, body weight. */
.crescita-guide__content > .crescita-viz--flow { max-width: 760px; }
.viz-flow__end { font-weight: 500; font-size: 1rem; }
