/* MCPCA site — single stylesheet, no build step needed for CSS. */

:root {
  --bg: #f7f6f2;
  --bg-alt: #efede7;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --text: #1b1f24;
  --muted: #5b6472;
  --border: #e2dfd8;
  --border-strong: #cfcbc2;
  --accent: #0e7490;
  --accent-ink: #0b5c73;
  --accent-soft: #dff1f5;
  --accent-contrast: #ffffff;
  --chip-bg: #eceef1;
  --chip-text: #4a535f;
  --teacher: #7c3aed;
  --teacher-soft: #efe7fd;
  --student: #9a3412;
  --student-soft: #fdebe1;
  --dark-bg: #131a21;
  --dark-surface: #1a232c;
  --dark-text: #e6e9ee;
  --dark-muted: #9aa6b4;
  --dark-border: #2a3541;
  --shadow: 0 1px 2px rgba(20, 24, 30, .05), 0 12px 32px -16px rgba(20, 24, 30, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --container: 1120px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1318;
    --bg-alt: #131a21;
    --surface: #171e26;
    --surface-2: #1c252f;
    --text: #e6e9ee;
    --muted: #9aa6b4;
    --border: #273240;
    --border-strong: #354352;
    --accent: #2bb6d1;
    --accent-ink: #7fd6e6;
    --accent-soft: #11333d;
    --accent-contrast: #06212a;
    --chip-bg: #232d38;
    --chip-text: #aeb8c5;
    --teacher: #b794f6;
    --teacher-soft: #2a2140;
    --student: #fb923c;
    --student-soft: #3a2415;
    --dark-bg: #0b0f14;
    --dark-surface: #131a21;
    --dark-border: #223040;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .6);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1318; --bg-alt: #131a21; --surface: #171e26; --surface-2: #1c252f;
  --text: #e6e9ee; --muted: #9aa6b4; --border: #273240; --border-strong: #354352;
  --accent: #2bb6d1; --accent-ink: #7fd6e6; --accent-soft: #11333d; --accent-contrast: #06212a;
  --chip-bg: #232d38; --chip-text: #aeb8c5;
  --teacher: #b794f6; --teacher-soft: #2a2140; --student: #fb923c; --student-soft: #3a2415;
  --dark-bg: #0b0f14; --dark-surface: #131a21; --dark-border: #223040;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .6);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 .5em; font-weight: 700; }
/* I titoli grandi in serif, i titoli piccoli e l'interfaccia in Inter: la
   pagina guadagna in carattere senza perdere leggibilità nelle card fitte. */
h1, h2 { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-weight: 600; }
h2 { font-weight: 600; }
body { font-optical-sizing: auto; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.25rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.35rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
code { font-family: var(--mono); font-size: .9em; }
ul, ol { margin: 0; padding: 0; }
img, svg { display: inline-block; vertical-align: middle; }
.icon { width: 1em; height: 1em; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.accent { color: var(--accent); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Il link di salto è per chi naviga da tastiera: deve comparire solo al focus.
   Con un top negativo fisso sbucava di qualche pixel appena il testo cresceva,
   quindi lo si sposta di tutta la propria altezza. */
.skip {
  position: absolute; left: 8px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-contrast);
  padding: 8px 12px; border-radius: 8px;
  transform: translateY(calc(-100% - 16px));
}
.skip:focus { transform: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container-narrow { max-width: 800px; }
.section { padding: 88px 0; }
.section--alt { background: var(--bg-alt); }
.section-head { max-width: 720px; margin-bottom: 44px; }
.section-lead { font-size: 1.15rem; color: var(--muted); }
.kicker, .badge {
  display: inline-flex; align-items: center; gap: .5em;
  font-size: .78rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent-ink); margin: 0 0 14px;
}
.kicker .icon, .badge .icon { width: .5em; height: .5em; color: var(--accent); }
.kicker--muted { color: var(--muted); }
.kicker--muted .icon { color: var(--muted); }
.badge { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); }

/* ---------- grid & cards ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-tight { gap: 14px; }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Se l'ultima riga a tre colonne ha una scheda sola, resterebbe spaiata a
   sinistra: la si centra. */
@media (min-width: 961px) { .grid-orphan-center > :last-child:nth-child(3n + 1) { grid-column: 2; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.card p:last-child { margin-bottom: 0; }
.card h3 { margin-top: 0; }
.card-sm { padding: 20px 22px; }
.card-sm h3 { font-size: 1.05rem; margin-bottom: .35em; }
.card-sm p { color: var(--muted); font-size: .98rem; }
.card-icon p { color: var(--muted); }
.icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 16px;
  background: var(--accent); color: var(--accent-contrast);
}
.icon-badge .icon { width: 22px; height: 22px; }
.icon-badge--soft { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: 12px 20px; border-radius: 10px; font-weight: 600; text-decoration: none;
  border: 1px solid transparent; line-height: 1.2; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s;
}
.btn .icon { width: 1.1em; height: 1.1em; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-ink); color: var(--accent-contrast); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--text); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: .92rem; }
.btn-lg { padding: 16px 26px; font-size: 1.05rem; }
@media (max-width: 480px) { .btn { white-space: normal; text-align: center; justify-content: center; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { display: inline-flex; color: var(--accent); }
.brand-mark .icon { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; letter-spacing: .02em; font-size: 1.05rem; }
.brand-tag { font-size: .72rem; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav ul { display: flex; gap: 18px; list-style: none; }
.site-nav ul a { color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 500; }
.site-nav ul a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 14px; }
.lang-switch { display: inline-flex; align-items: center; gap: .4em; color: var(--muted); text-decoration: none; font-size: .92rem; font-weight: 500; }
.lang-switch:hover { color: var(--text); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border-strong); border-radius: 8px; width: 42px; height: 38px; padding: 8px; flex-direction: column; justify-content: space-between; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
@media (max-width: 960px) {
  .brand-tag { display: none; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 8px;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 12px var(--gutter) 18px;
    box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav ul a { display: block; padding: 10px 4px; font-size: 1rem; }
  .nav-actions { justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
}

.stub-notice { margin-top: 16px; }
.stub-notice p { background: var(--student-soft); color: var(--student); border-radius: 10px; padding: 10px 14px; font-weight: 500; margin: 0; }

/* ---------- hero ---------- */
.hero { padding: 26px 0 48px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 70%; z-index: -1;
  background: radial-gradient(60% 60% at 70% 30%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr); gap: 44px; align-items: start; }
.hero-copy .lead { font-size: 1.2rem; color: var(--text); }
.hero-copy .lead-secondary { color: var(--muted); font-size: 1.08rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-visual { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 960px) {
  .hero { padding: 48px 0 40px; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
}

/* flow diagram */
.flow { display: flex; align-items: stretch; gap: 8px; }
.flow-node {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; text-align: center;
}
.flow-node--accent { border-color: var(--accent); background: var(--accent-soft); }
.flow-label { font-weight: 700; font-size: .95rem; }
.flow-sub { font-size: .78rem; color: var(--muted); line-height: 1.3; }
.flow-arrow { display: flex; align-items: center; color: var(--muted); }
.flow-arrow .icon { width: 18px; height: 18px; }
.flow-caption { display: flex; align-items: center; gap: .5em; margin: -6px 0 0; font-size: .85rem; color: var(--muted); }
.flow-caption .icon { width: 1em; height: 1em; }
@media (max-width: 480px) {
  .flow { flex-direction: column; }
  .flow-arrow { justify-content: center; }
  .flow-arrow .icon { transform: rotate(90deg); }
}

/* ---------- chat mock ---------- */
.chat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.chat-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-dots { display: inline-flex; gap: 6px; }
.chat-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); display: block; }
.chat-title { font-size: .82rem; color: var(--muted); font-weight: 500; }
.chat-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 92%; }
.msg-user { align-self: flex-end; }
.msg-agent { align-self: flex-start; }
.avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-contrast);
}
.avatar .icon { width: 15px; height: 15px; }
.bubble { padding: 10px 14px; border-radius: 14px; font-size: .95rem; line-height: 1.5; }
.bubble p { margin: 0; }
.msg-user .bubble { background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 4px; }
.msg-agent .bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tool { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--chip-bg); color: var(--chip-text); border: 1px solid var(--border); }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 1.2em; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: .6; } }

/* ---------- glossary ---------- */
.glossary { margin-top: 40px; padding: 26px 28px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.glossary-title { font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 18px; }
.glossary dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin: 0; }
.glossary dt { font-weight: 700; margin-bottom: 4px; }
.glossary dd { margin: 0; color: var(--muted); font-size: .96rem; }
@media (max-width: 960px) { .glossary dl { grid-template-columns: 1fr; } }

/* ---------- tabs ---------- */
.tablist { display: flex; gap: 6px; border-bottom: 1px solid var(--border-strong); margin-bottom: 30px; overflow-x: auto; }
.tab {
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px;
  padding: 12px 18px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }
.tabpanel-title { display: none; }
.tabpanel-intro { color: var(--muted); font-size: 1.08rem; margin-bottom: 22px; max-width: 720px; }
.no-js .tabpanel[hidden] { display: block; }
.no-js .tabpanel-title { display: block; margin-top: 32px; }
.no-js .tablist { display: none; }

/* ---------- features ---------- */
.feature h3 { margin-bottom: 12px; }
.checklist { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.checklist li { display: flex; gap: .55em; align-items: flex-start; color: var(--muted); font-size: .97rem; }
.checklist .icon { color: var(--accent); margin-top: .3em; width: .95em; height: .95em; }
.stats {
  margin-top: 40px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
  padding: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.stat { text-align: center; }
.stat-value { display: block; font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--accent-ink); line-height: 1.1; }
.stat-label { font-size: .88rem; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- roadmap ---------- */
.roadmap { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
.roadmap-item { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.roadmap-item h3 { font-size: 1.05rem; margin-bottom: .25em; }
.roadmap-item p { margin: 0; color: var(--muted); font-size: .97rem; }
.roadmap-num { font-family: var(--mono); font-size: .8rem; color: var(--muted); padding-top: .3em; }
@media (max-width: 760px) { .roadmap { grid-template-columns: 1fr; } }

/* ---------- dialogues ---------- */
.dialogue-meta { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 12px; }
.pill { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.pill-teacher { background: var(--teacher-soft); color: var(--teacher); }
.pill-student { background: var(--student-soft); color: var(--student); }
.dialogues .chat-body { gap: 14px; }

/* ---------- steps ---------- */
.step { position: relative; }
.step-num { font-family: var(--mono); font-size: .85rem; color: var(--accent-ink); font-weight: 700; display: block; margin-bottom: 14px; }
.step p { color: var(--muted); font-size: .97rem; }

/* ---------- tech (dark band) ---------- */
.section--dark { background: var(--dark-bg); color: var(--dark-text); }
.section--dark .section-lead, .section--dark .muted { color: var(--dark-muted); }
.section--dark .kicker { color: #7fd6e6; }
.section--dark .kicker .icon { color: #2bb6d1; }
.arch { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 14px; align-items: stretch; margin-bottom: 40px; }
.arch-col { background: var(--dark-surface); border: 1px solid var(--dark-border); border-radius: var(--radius); padding: 22px; }
.arch-col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; color: var(--dark-muted); margin-bottom: 14px; }
.arch-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: .97rem; }
.arch-col--accent { border-color: #2bb6d1; }
.arch-stack li code { display: block; background: #0b0f14; border: 1px solid var(--dark-border); border-radius: 8px; padding: 8px 12px; color: #cfe8ee; font-size: .85rem; }
.arch-arrow { display: flex; align-items: center; color: var(--dark-muted); }
.arch-arrow .icon { width: 22px; height: 22px; }
@media (max-width: 760px) {
  .arch { grid-template-columns: 1fr; }
  .arch-arrow { justify-content: center; }
  .arch-arrow .icon { transform: rotate(90deg); }
}
.specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; margin: 0; }
.spec { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--dark-border); }
.spec dt { font-weight: 700; color: var(--dark-text); }
.spec dd { margin: 0; color: var(--dark-muted); font-size: .95rem; }
@media (max-width: 960px) { .specs { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .spec { grid-template-columns: 1fr; gap: 4px; } }
.tech-note { margin-top: 28px; display: flex; gap: .6em; align-items: flex-start; color: var(--dark-muted); font-size: .95rem; }
.tech-note .icon { margin-top: .3em; color: #2bb6d1; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 20px; }
.faq-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  cursor: pointer; list-style: none; padding: 16px 0; font-weight: 600;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { color: var(--muted); transition: transform .2s; flex: none; }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item p { margin: 0 0 18px; color: var(--muted); }

/* ---------- CTA band ---------- */
.section--cta { padding-top: 0; }
.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  padding: 40px 44px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--border);
}
.cta-band h2 { margin-bottom: .35em; }
.cta-band p { margin: 0; color: var(--muted); max-width: 560px; }
@media (max-width: 640px) { .cta-band { padding: 28px 22px; } }
/* L'indirizzo è scritto per le persone, non per i raccoglitori: nessun mailto
   nel sorgente, lo ricompone main.js al clic sul pulsante. */
.mail-shown { font-family: var(--mono); font-size: .92em; white-space: nowrap; }
.cta-band .contact-mail { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.cta-band .contact-mail .mail-shown { color: var(--text); }
.contact-hint { font-size: .9rem; }
/* Su un telefono l'indirizzo in monospaziato non sta su una riga: va a capo
   agli spazi, e in ultima istanza ovunque, piuttosto che allargare la pagina. */
@media (max-width: 640px) { .mail-shown { white-space: normal; overflow-wrap: anywhere; font-size: .88em; } }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 36px 0 44px; background: var(--bg-alt); }
.footer-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; align-items: start; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 4px; }
.footer-brand .icon { width: 22px; height: 22px; }
.footer-brand .muted { font-weight: 400; }
.site-footer p { margin-bottom: 6px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- small-screen refinements ---------- */
@media (max-width: 640px) {
  .tablist { flex-wrap: wrap; overflow: visible; gap: 0; }
  .tab { padding: 10px 14px; font-size: .95rem; }
  .badge { font-size: .7rem; letter-spacing: .06em; padding: 5px 10px; }
  .section { padding: 60px 0; }
  .hero-copy .lead { font-size: 1.1rem; }
}

/* ---------- rotating word in the hero ---------- */
.rotate { display: inline-block; position: relative; text-align: left; white-space: nowrap; transition: opacity .35s ease, transform .35s ease; }
.rotate.is-out { opacity: 0; transform: translateY(.35em); }
@media (prefers-reduced-motion: reduce) { .rotate { transition: none; } .rotate.is-out { transform: none; } }

/* ---------- Moodlecraft ---------- */
.mc-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.tree-figure { margin: 0; background: var(--dark-bg); color: var(--dark-text); border-radius: var(--radius); border: 1px solid var(--dark-border); overflow: hidden; }
.tree-figure figcaption { font-size: .8rem; color: var(--dark-muted); padding: 10px 16px; border-bottom: 1px solid var(--dark-border); background: var(--dark-surface); }
.tree { margin: 0; padding: 16px 18px; font-family: var(--mono); font-size: .8rem; line-height: 1.55; overflow-x: auto; color: #cfe8ee; }
.mc-note { margin-top: 28px; display: flex; gap: .6em; align-items: flex-start; color: var(--muted); max-width: 900px; }
.mc-note .icon { margin-top: .3em; color: var(--accent); }
@media (max-width: 960px) { .mc-grid { grid-template-columns: 1fr; } }
.site-nav ul { gap: 16px; }
.site-nav ul a { font-size: .92rem; }
.flow-label { font-size: .9rem; line-height: 1.25; }
.site-nav ul a { white-space: nowrap; }
.header-inner { gap: 16px; }
@media (max-width: 1240px) { .brand-tag { display: none; } }
.flow-node:first-child { flex: 1.6 1 0; }
/* Titolo più grande e con più aria sotto: è la prima cosa che si legge. */
h1 { font-size: clamp(2.2rem, 4.15vw, 3.25rem); line-height: 1.08; margin-bottom: .36em; }
.hero-copy .lead { margin-top: 0; }

/* The English tagline is longer than the Italian one: keep it on one line,
   and hide it before it can squeeze the nav. */
.brand-tag { white-space: nowrap; }
@media (max-width: 1320px) { .brand-tag { display: none; } }

/* ===================================================================
   Sectors (home) + case study page
   =================================================================== */

.nav-case { color: var(--accent-ink) !important; font-weight: 600 !important; }
.nav-case[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

.sector h3 { font-size: 1.05rem; }
.sector p { color: var(--muted); font-size: .96rem; }
.sector .icon-badge { width: 38px; height: 38px; margin-bottom: 12px; }
.sector .icon-badge .icon { width: 19px; height: 19px; }
.sectors-note { display: flex; gap: .6em; align-items: flex-start; margin: 28px 0 0; color: var(--muted); }
.sectors-note .icon { margin-top: .32em; color: var(--accent); width: .95em; height: .95em; }

/* ---------- case study band on the home page ---------- */
.case-band {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 36px; align-items: center;
  padding: 40px 44px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.case-band h2 { margin-bottom: .4em; }
.case-band .section-lead { font-size: 1.06rem; }
.case-band-list { margin: 0 0 24px; }
.case-band-facts { display: grid; gap: 0; margin: 0; padding: 22px 24px; border-radius: var(--radius); background: var(--accent-soft); }
.case-band-facts > div { padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.case-band-facts > div:last-child { border-bottom: 0; }
.case-band-facts dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--accent-ink); font-weight: 700; }
.case-band-facts dd { margin: 2px 0 0; font-weight: 600; font-size: .98rem; }
@media (max-width: 860px) { .case-band { grid-template-columns: 1fr; padding: 28px 22px; gap: 26px; } }

/* ---------- case study hero ---------- */
.case-hero { padding: 40px 0 56px; position: relative; overflow: hidden; }
.case-hero::before {
  content: ""; position: absolute; inset: 0 -10% auto -10%; height: 100%; z-index: -1;
  background: radial-gradient(55% 70% at 25% 20%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.back-link { display: inline-flex; align-items: center; gap: .45em; font-size: .92rem; font-weight: 600; text-decoration: none; color: var(--muted); margin-bottom: 26px; }
.back-link:hover { color: var(--accent-ink); }
.case-hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 44px; align-items: start; }
.case-hero h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
.case-hero .lead { font-size: 1.12rem; }
.case-link-note { display: flex; gap: .55em; align-items: flex-start; font-size: .9rem; color: var(--muted); margin-top: 16px; }
.case-link-note .icon { margin-top: .25em; width: .95em; height: .95em; }
.case-facts { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.case-facts-title { font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; margin: 0 0 14px; }
.case-facts dl { margin: 0; }
.case-facts dl > div { padding: 9px 0; border-top: 1px solid var(--border); }
.case-facts dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.case-facts dd { margin: 2px 0 0; font-size: .96rem; font-weight: 600; }
@media (max-width: 860px) { .case-hero-grid { grid-template-columns: 1fr; gap: 30px; } }

.case-para { font-size: 1.08rem; color: var(--muted); }
.case-para:first-of-type { color: var(--text); }
.section--tight { padding: 40px 0; }
.stats--wide { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 960px) { .stats--wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stats--wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.metrics-note { text-align: center; color: var(--muted); font-size: .88rem; margin: 14px 0 0; }

/* ---------- numbered build steps ---------- */
.case-steps { list-style: none; display: grid; gap: 0; counter-reset: step; }
.case-step { display: grid; grid-template-columns: 64px 1fr; gap: 20px; padding: 24px 0; border-top: 1px solid var(--border); }
.case-step:last-child { border-bottom: 1px solid var(--border); }
.case-step-num { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--accent); line-height: 1.2; }
.case-step-body h3 { margin-bottom: .3em; }
.case-step-body p { color: var(--muted); margin-bottom: 12px; max-width: 78ch; }
.case-step-body .tools { margin-bottom: 0; }
@media (max-width: 640px) { .case-step { grid-template-columns: 1fr; gap: 6px; } .case-step-num { font-size: 1.1rem; } }

/* ---------- screenshots ---------- */
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.shot { margin: 0; }
.shot--wide { grid-column: 1 / -1; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.shot figcaption { margin-top: 10px; font-size: .9rem; color: var(--muted); }
@media (max-width: 720px) { .shots { grid-template-columns: 1fr; } }

/* ---------- content excerpt windows ---------- */
.window { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.window-body { padding: 20px 22px; flex: 1; }
.window-body h3 { font-size: 1.05rem; margin-bottom: .4em; }
.window-body > p { color: var(--muted); font-size: .96rem; }
.window-caption { margin: 0; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: .87rem; color: var(--muted); }
.excerpts .window { height: 100%; }

.lesson-index { list-style: none; counter-reset: li; display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.lesson-index li { counter-increment: li; display: flex; gap: .7em; font-size: .94rem; align-items: baseline; }
.lesson-index li::before { content: counter(li) "."; font-family: var(--mono); font-size: .8rem; color: var(--muted); flex: none; }

.video-placeholder { display: flex; align-items: center; justify-content: center; height: 92px; margin-bottom: 14px; border-radius: var(--radius-sm); background: var(--dark-bg); color: #7fd6e6; }
.video-placeholder .icon { width: 34px; height: 34px; }
.video-index { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.video-index li { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; font-size: .92rem; padding-bottom: 6px; border-bottom: 1px dashed var(--border); }
.video-index code { color: var(--accent-ink); font-size: .82rem; flex: none; }

.question-text { font-size: .96rem; margin-bottom: 14px; }
.answers { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.answer { display: flex; gap: .6em; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.answer--correct { border-color: var(--accent); background: var(--accent-soft); }
.answer-mark { display: inline-flex; margin-top: .25em; color: var(--muted); }
.answer-mark .icon { width: .9em; height: .9em; }
.answer--correct .answer-mark { color: var(--accent-ink); }
.answer code { font-size: .88rem; display: block; }
.answer-feedback { display: block; font-size: .85rem; color: var(--muted); margin-top: 3px; }

.open-q { padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 12px; }
.open-q-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--accent-ink); }
.open-q .question-text { margin: 6px 0 0; }
.open-note { font-size: .9rem; color: var(--muted); margin: 0; }

.cta-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }


/* ===================================================================
   Evidenziazioni nel testo lungo
   =================================================================== */

/* Tre livelli, in ordine crescente di peso visivo: corsivo per gli incisi,
   grassetto per i termini portanti, sottolineatura piena per la frase che deve
   fermare l'occhio. Nessun colore nuovo: solo quelli del sistema. */
strong { font-weight: 650; color: var(--text); }
em { font-style: italic; }
.hl {
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
  color: inherit; padding: 0 1px; border-radius: 1px;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.section--dark strong, .section--dark .hl { color: var(--dark-text); }
.section--dark .hl { background: linear-gradient(transparent 62%, rgba(43, 182, 209, .22) 62%); }
.lead .hl, .section-lead .hl { background: linear-gradient(transparent 64%, var(--accent-soft) 64%); }

/* ===================================================================
   Markdown dentro le bolle di chat
   =================================================================== */

.bubble > *:last-child { margin-bottom: 0; }
.bubble p + p { margin-top: .6em; }
.bubble ul, .bubble ol { margin: .5em 0 .6em; padding-left: 1.15em; }
.bubble li { margin-bottom: .28em; }
.bubble ul { list-style: disc; }
.bubble ol { list-style: decimal; }
.bubble li::marker { color: var(--muted); }
.msg-user .bubble li::marker { color: color-mix(in srgb, var(--accent-contrast) 70%, transparent); }
.bubble code:not(.tool) {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  padding: .08em .35em; border-radius: 4px; font-size: .86em;
}
.msg-user .bubble code:not(.tool) { background: color-mix(in srgb, var(--accent-contrast) 22%, transparent); }
.bubble-title { font-weight: 650; display: block; margin-bottom: .35em; }
.md-table { width: 100%; border-collapse: collapse; margin: .6em 0; font-size: .87em; }
.md-table th, .md-table td { text-align: left; padding: 5px 9px; border-bottom: 1px solid var(--border); }
.md-table th { font-weight: 650; color: var(--muted); font-size: .92em; text-transform: none; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table td code { font-size: .92em; }
.bubble-note { display: block; margin-top: .5em; font-size: .88em; color: var(--muted); }
.msg-user .bubble-note { color: color-mix(in srgb, var(--accent-contrast) 80%, transparent); }

/* Le bolle con contenuto formattato respirano un po' di più */
.msg-rich { max-width: 96%; }
.msg-rich .bubble { padding: 12px 16px; }


/* ---------- il nome del progetto dentro il testo ---------- */
/* Riprende il wordmark della testata: stesso peso, stessa spaziatura, colore
   d'accento. Non va mai spezzato a fine riga, e non si usa a ogni ricorrenza:
   solo dove il lettore deve capire chi è il protagonista. */
.product {
  font-weight: 750; letter-spacing: .012em;
  color: var(--accent-ink); white-space: nowrap;
}
.section--dark .product { color: #7fd6e6; }

/* Nell'hero: prima una riga di contesto in sordina, poi la promessa, che si
   apre con il nome del progetto ed è il paragrafo che deve pesare. */
.hero-copy .lead-intro { font-size: 1.05rem; color: var(--muted); margin-bottom: .45em; }
.hero-copy .lead-promise { font-size: 1.22rem; color: var(--text); line-height: 1.5; }
.hero-copy .lead-promise .product { font-size: 1.06em; }

/* ---------- hero: il diagramma sta con il testo, non sotto la chat ---------- */
/* Su un portatile da 13 pollici la prima schermata deve contenere titolo,
   promessa, pulsanti e lo schema dei tre blocchi: è quello schema a spiegare
   in un colpo d'occhio dove gira il plugin. */
.hero-copy .flow { margin-top: 18px; }
.hero-copy .flow-caption { margin-top: 8px; margin-bottom: 0; }
.hero-copy .lead { margin-bottom: .7em; }
.hero-copy .cta-row { margin-top: 16px; }
/* Riga di raccordo fra lo schema e i pulsanti: dice chi può fare che cosa,
   completa il "dove gira" della didascalia e tiene separati i due blocchi. */
.hero-note {
  margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--border);
  font-size: .97rem; color: var(--muted);
}
.hero-copy .flow-node { padding: 10px 12px; }
.hero-copy .flow-label { font-size: .88rem; }
.hero-copy .flow-sub { font-size: .74rem; }
.hero-visual { gap: 0; }
@media (max-width: 960px) {
  /* In colonna singola il diagramma è alto: i pulsanti tornano prima, così la
     chiamata all'azione resta raggiungibile senza scorrere tutto. */
  .hero-copy { display: flex; flex-direction: column; }
  .hero-copy .cta-row { order: 1; margin-top: 22px; }
  .hero-copy .flow { order: 2; margin-top: 26px; }
  .hero-copy .flow-caption { order: 3; }
  .hero-copy .hero-note { order: 4; }
}


/* Portatili con schermo basso (13 pollici, 720-780px di altezza utile): l'hero
   si stringe quel tanto che basta a tenere schema, riga di raccordo e pulsanti
   sopra la piega. Sui monitor grandi resta arioso. */
@media (min-width: 961px) and (max-height: 800px) {
  .hero { padding-top: 14px; }
  /* Con il verbo in testa il titolo occupa tre righe: su uno schermo basso
     vale la pena rimpicciolirlo un poco per tenere i pulsanti sopra la piega. */
  .hero h1 { font-size: clamp(2rem, 3.6vw, 2.85rem); margin-bottom: .3em; }
  .hero-copy .lead-intro { font-size: 1rem; margin-bottom: .4em; }
  .hero-copy .lead-promise { font-size: 1.05rem; line-height: 1.4; }
  .hero-copy .flow { margin-top: 8px; }
  .hero-copy .flow-caption { margin-top: 6px; }
  .hero-note { margin-top: 6px; padding-top: 6px; font-size: .94rem; }
  .hero-copy .cta-row { margin-top: 12px; }
}

.hero h1 .t-line { display: block; }
.rotate-verb { text-align: left; }
