/* ==========================================================================
   Nexus — guida illustrata
   Un solo foglio per tutte le pagine. Palette e forme dal design system della
   suite (navy + teal), tipografia editoriale: i titoli in serif perche' qui
   si legge, le schermate in evidenza perche' qui si guarda.
   ========================================================================== */

:root {
  --paper:      #F4F7F9;
  --sheet:      #FFFFFF;
  --sunk:       #EBF0F4;
  --ink:        #0F1B27;
  --ink-soft:   #4B5F72;
  --ink-faint:  #7D91A4;
  --line:       rgb(15 27 39 / .12);
  --line-soft:  rgb(15 27 39 / .07);
  --navy:       #0A1526;
  --on-navy:    #E8F0F6;
  --teal:       #0E8F8A;
  --teal-bright:#1CCFC9;
  --teal-wash:  rgb(28 207 201 / .10);
  --amber:      #97600F;
  --amber-wash: rgb(245 158 11 / .12);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "Inter", "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, Consolas, monospace;

  --wrap: 860px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #0A121B;
    --sheet:     #111D28;
    --sunk:      #17242F;
    --ink:       #E6EDF3;
    --ink-soft:  #A2B4C4;
    --ink-faint: #71879A;
    --line:      rgb(230 237 243 / .16);
    --line-soft: rgb(230 237 243 / .08);
    --navy:      #060D16;
    --teal:      #4FE0DA;
    --teal-wash: rgb(28 207 201 / .14);
    --amber:     #E4AB63;
  }
}
:root[data-theme="dark"] {
  --paper:     #0A121B;
  --sheet:     #111D28;
  --sunk:      #17242F;
  --ink:       #E6EDF3;
  --ink-soft:  #A2B4C4;
  --ink-faint: #71879A;
  --line:      rgb(230 237 243 / .16);
  --line-soft: rgb(230 237 243 / .08);
  --navy:      #060D16;
  --teal:      #4FE0DA;
  --teal-wash: rgb(28 207 201 / .14);
  --amber:     #E4AB63;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- barra in alto ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  color: var(--on-navy);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 26px;
  padding: 10px clamp(16px, 4vw, 40px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  flex: none;
}
.brand svg { width: 26px; height: 26px; display: block; }
.brand span { font-weight: 600; letter-spacing: -.01em; font-size: 16px; line-height: 1.1; }
.brand em {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #7E9BB5;
  margin-top: 2px;
}
.nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.nav__link {
  color: #A8BDD0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 7px;
}
.nav__link:hover { background: rgb(255 255 255 / .08); color: #fff; }
.nav__link.is-here { background: var(--teal-bright); color: #062221; }

/* ---------- corpo ---------- */
.page {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(34px, 6vw, 76px) clamp(18px, 5vw, 32px) 80px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 14px;
}
h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(32px, 5.2vw, 50px);
  line-height: 1.08;
  letter-spacing: -.02em;
  margin: 0 0 24px;
  text-wrap: balance;
}
h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.2;
  letter-spacing: -.015em;
  margin: 54px 0 14px;
  text-wrap: balance;
}
h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.005em;
  margin: 32px 0 8px;
}
p { margin: 0 0 18px; }
.page > p:first-of-type { font-size: 19px; line-height: 1.6; color: var(--ink-soft); }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 2px; }
strong { font-weight: 600; }
em { color: var(--ink-soft); }
code {
  font-family: var(--mono);
  font-size: .86em;
  background: var(--sunk);
  padding: 1px 6px;
  border-radius: 4px;
}
ul, ol { margin: 0 0 18px; padding-left: 24px; }
li { margin-bottom: 9px; }
li::marker { color: var(--teal); }
hr { border: none; border-top: 1px solid var(--line); margin: 46px 0; }

/* ---------- figure: sono il motivo per cui questo sito esiste ---------- */
.fig {
  margin: 30px 0 34px;
  padding: 0;
}
.fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--sheet);
  box-shadow: 0 1px 2px rgb(10 21 38 / .07), 0 24px 48px -32px rgb(10 21 38 / .45);
}
.fig figcaption {
  margin-top: 12px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  border-left: 2px solid var(--teal-bright);
  padding-left: 12px;
}
.fig--wide {
  width: min(1180px, 92vw);
  margin-left: calc(50% - min(590px, 46vw));
}
@media (max-width: 900px) {
  .fig--wide { width: 100%; margin-left: 0; }
}

/* ---------- riquadri ---------- */
.box {
  margin: 26px 0;
  padding: 18px 20px;
  background: var(--sheet);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--teal-bright);
  border-radius: 10px;
  font-size: 15.5px;
  line-height: 1.6;
}
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }
.box h3 { margin-top: 0; }
.box--limiti { border-left-color: var(--amber); background: var(--amber-wash); }
.box--limiti h3 { color: var(--amber); }
.box--logica { border-left-color: var(--navy); }
.box--dati { border-left-color: var(--ink-faint); font-size: 14.5px; color: var(--ink-soft); }

/* ---------- tabelle ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 15px;
  background: var(--sheet);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  overflow: hidden;
}
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }

/* ---------- passaggio fra pagine ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 64px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.pager a {
  flex: 1 1 240px;
  text-decoration: none;
  color: inherit;
  background: var(--sheet);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 16px;
}
.pager a:hover { border-color: var(--teal-bright); }
.pager span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}
.pager b { font-weight: 600; font-size: 15.5px; }
.pager__next { text-align: right; }

/* ---------- piede ---------- */
.foot {
  background: var(--navy);
  color: #8AA3B8;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 26px clamp(18px, 5vw, 40px) 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  justify-content: space-between;
}
.foot b { color: #C9DAE8; font-weight: 500; }
.mono { font-family: var(--mono); }

:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
