/* Stile comune delle pagine. Nessun font esterno, nessun tracciamento. */

:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --text: #22272b;
  --muted: #545c63;
  --line: #e0dbd0;
  --accent: #23706a;
  --accent-strong: #185753;
  --accent-soft: #e2f0ee;
  --on-accent: #ffffff;
  --warn-bg: #fff4c2;
  --warn-line: #e0b100;
  --warn-text: #3d3100;
  --code-bg: #24292e;
  --code-text: #f3f3f3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --wrap: 68rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15191c;
    --surface: #1d2226;
    --surface-2: #232a2f;
    --text: #e9ecee;
    --muted: #a9b2b9;
    --line: #313a40;
    --accent: #6cc4ba;
    --accent-strong: #8fd6cd;
    --accent-soft: #1f3533;
    --on-accent: #0d1f1d;
    --warn-bg: #3a3108;
    --warn-line: #d8ab1c;
    --warn-text: #fbefc0;
    --code-bg: #0f1214;
    --code-text: #e9ecee;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15191c;
  --surface: #1d2226;
  --surface-2: #232a2f;
  --text: #e9ecee;
  --muted: #a9b2b9;
  --line: #313a40;
  --accent: #6cc4ba;
  --accent-strong: #8fd6cd;
  --accent-soft: #1f3533;
  --on-accent: #0d1f1d;
  --warn-bg: #3a3108;
  --warn-line: #d8ab1c;
  --warn-text: #fbefc0;
  --code-bg: #0f1214;
  --code-text: #e9ecee;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.125rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-strong); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 1.5rem; } }

/* Intestazione */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); text-decoration: none; }
.brand svg { width: 2rem; height: 2rem; flex: none; }
.nav { display: flex; align-items: center; gap: .4rem 1.1rem; flex-wrap: wrap; justify-content: flex-end; font-size: 1rem; }
.nav a { color: var(--text); text-decoration: none; }
.nav a:hover { color: var(--accent-strong); text-decoration: underline; }
.nav .lang { border: 1px solid var(--line); border-radius: 999px; padding: .15rem .7rem; }
.nav .hide-sm { display: none; }
@media (min-width: 760px) { .nav .hide-sm { display: inline; } }

/* Menu a tendina sullo smartphone (assets/menu.js); da tablet e computer le voci restano in riga */
.menu-btn { display: none; }
@media (max-width: 639px) {
  .site-header { position: relative; z-index: 20; }
  .site-header.has-menu .menu-btn { display: inline-flex; align-items: center; gap: .55rem; min-height: 2.75rem; padding: .4rem .95rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; cursor: pointer; }
  .site-header.has-menu .menu-btn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); }
  .menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 1.1rem; height: 2px; border-radius: 2px; background: currentColor; }
  .menu-icon { position: relative; }
  .menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
  .menu-icon::before { top: -6px; }
  .menu-icon::after { top: 6px; }
  .menu-btn[aria-expanded="true"] .menu-icon { background: transparent; }
  .menu-btn[aria-expanded="true"] .menu-icon::before { top: 0; transform: rotate(45deg); }
  .menu-btn[aria-expanded="true"] .menu-icon::after { top: 0; transform: rotate(-45deg); }
  .site-header.has-menu .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; padding: .25rem 1rem .75rem; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 10px 24px rgba(0, 0, 0, .12); }
  .site-header.has-menu.menu-open .nav { display: flex; }
  .site-header.has-menu .nav a { display: block; padding: .8rem .25rem; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .site-header.has-menu .nav a:last-child { border-bottom: 0; }
  .site-header.has-menu .nav .lang { border-radius: 0; border-width: 0; padding: .8rem .25rem; }
}

/* Sezioni */
section { padding: 3.5rem 0; }
section + section { border-top: 1px solid var(--line); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .8rem; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; max-width: 42rem; }
.lead { font-size: clamp(1.2rem, 2.6vw, 1.4rem); color: var(--muted); max-width: 40rem; }
.eyebrow { font-size: .95rem; font-weight: 600; color: var(--accent-strong); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .6rem; }
.muted { color: var(--muted); }

/* Apertura */
.hero { padding: 4rem 0 3.5rem; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: 999px; font-weight: 600; text-decoration: none;
  border: 2px solid var(--accent); color: var(--accent-strong); background: transparent;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn:hover { text-decoration: none; filter: brightness(1.05); }

/* Riquadri */
.note {
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 1.5rem 0 0;
  background: var(--accent-soft); border-left: 6px solid var(--accent); max-width: 46rem;
}
.note p:last-child { margin-bottom: 0; }

.warn {
  display: flex; gap: .9rem; align-items: flex-start;
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 1.5rem 0 0;
  background: var(--warn-bg); color: var(--warn-text); border: 2px solid var(--warn-line); max-width: 46rem;
}
.warn svg { width: 1.8rem; height: 1.8rem; flex: none; margin-top: .1rem; }
.warn p { margin: 0 0 .5rem; }
.warn p:last-child { margin-bottom: 0; }
.warn a { color: inherit; font-weight: 600; }

/* Griglie */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.5rem; }
@media (min-width: 680px) { .grid.two { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 680px) and (max-width: 959px) { .grid.three { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem 1.3rem 1.1rem; box-shadow: var(--shadow); min-width: 0;
}
.card p { font-size: 1.02rem; }
.card .tag { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: .1rem .65rem; margin-bottom: .6rem; }
.cmds { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 0; padding: 0; list-style: none; }
.cmds li { font-size: .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .1rem .5rem; overflow-wrap: anywhere; }

/* Passi */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; }
@media (min-width: 860px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { counter-increment: step; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }
.steps li::before {
  content: counter(step); display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; margin-bottom: .6rem;
}
.steps p { margin: 0; font-size: 1.02rem; }

/* Elenchi semplici */
.list { padding-left: 1.2rem; margin: 1rem 0 0; max-width: 46rem; }
.list li { margin-bottom: .5rem; }

/* Video */
.video { margin-top: 1.5rem; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; max-width: 56rem; }
.caption { font-size: .98rem; color: var(--muted); margin-top: .7rem; }

/* Codice */
.code { position: relative; margin: .8rem 0 1.2rem; max-width: 46rem; }
.code pre {
  margin: 0; padding: 1rem 1.1rem; padding-right: 5.5rem; border-radius: 10px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text); font: .95rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy {
  position: absolute; top: .55rem; right: .55rem; font: inherit; font-size: .85rem; cursor: pointer;
  border: 1px solid #5b646b; background: #343b41; color: #f3f3f3; border-radius: 8px; padding: .25rem .65rem;
}
.copy:hover { background: #3f474e; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .05rem .35rem; overflow-wrap: anywhere; }

/* Piè di pagina */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0 3rem; font-size: 1rem; color: var(--muted); }
.site-footer p { max-width: 50rem; }
.site-footer a { color: var(--muted); }
.code pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; overflow-wrap: normal; }
/* Il pulsante Copia sta sopra il blocco, così non copre il comando sui telefoni */
.code { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; }
.code pre { align-self: stretch; padding-right: 1.1rem; }
.copy { position: static; background: var(--surface); color: var(--text); border-color: var(--line); }
.copy:hover { background: var(--surface-2); }

/* Briciole di pane */
.crumbs { font-size: .95rem; color: var(--muted); margin: 0 0 1rem; }
.crumbs a { color: var(--muted); }

/* Tabelle dei comandi */
.table-wrap { overflow-x: auto; margin: 1rem 0 0; max-width: 56rem; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th, td { text-align: left; vertical-align: top; padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
th { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
td:first-child { white-space: nowrap; font-weight: 600; }
@media (max-width: 560px) {
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  td { border: 0; padding: .2rem 0; white-space: normal; }
}

/* Demo della chat (simulazione) */
.chat { margin: 1.5rem 0 0; max-width: 46rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.chat-head p { margin: 0; font-size: .92rem; color: var(--muted); }
.chat-play { font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: .25rem .9rem; }
.chat-log { padding: 1rem; display: flex; flex-direction: column; gap: .75rem; min-height: 6rem; }
.msg { max-width: 88%; border-radius: 14px; padding: .65rem .9rem; font-size: 1rem; line-height: 1.55; }
.msg p { margin: 0 0 .5rem; max-width: none; }
.msg p:last-child { margin-bottom: 0; }
.msg ul { margin: .2rem 0 .5rem; padding-left: 1.2rem; }
.msg .who { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .03em; color: var(--muted); margin-bottom: .2rem; }
.msg.user { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.msg.claude { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.file { align-self: flex-start; background: transparent; border: 1px dashed var(--accent); color: var(--accent-strong); font-size: .92rem; padding: .4rem .8rem; }
.msg.event { align-self: center; background: transparent; color: var(--muted); font-size: .88rem; font-style: italic; text-align: center; max-width: 100%; }
.chat-log.playing .msg { display: none; }
.chat-log.playing .msg.shown { display: block; animation: rise .35s ease-out; }
.typing { align-self: flex-start; display: inline-flex; gap: .3rem; padding: .7rem .9rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.typing span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chat-log.playing .msg.shown, .typing span { animation: none; } }

/* Elenco degli altri strumenti */
.tools-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.tools-nav a { border: 1px solid var(--line); border-radius: 999px; padding: .3rem .9rem; text-decoration: none; color: var(--text); background: var(--surface); }
.tools-nav a[aria-current] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.more { display: inline-block; margin-top: .6rem; font-weight: 600; }

/* Passi numerati della configurazione */
.howto { counter-reset: h; list-style: none; padding: 0; margin: 1.2rem 0 0; max-width: 46rem; }
.howto > li { counter-increment: h; position: relative; padding: 0 0 1.2rem 3rem; }
.howto > li::before { content: counter(h); position: absolute; left: 0; top: 0; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.howto > li p { margin-bottom: .4rem; }
.ui { font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 .35rem; white-space: nowrap; }
.filetree { font: .95rem/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; overflow-x: auto; max-width: 46rem; margin: 1rem 0; }
.mt { margin-top: 1rem; }
.filetree { white-space: pre; }
.code pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Demo per comando, in riquadri apribili */
.demos { display: grid; gap: .7rem; margin-top: 1.2rem; max-width: 50rem; }
details.demo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
details.demo > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; padding: .85rem 1.1rem; }
details.demo > summary::-webkit-details-marker { display: none; }
details.demo > summary::before { content: "▸"; color: var(--accent-strong); font-weight: 700; }
details.demo[open] > summary::before { content: "▾"; }
.demo-cmd { font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; }
.demo-desc { color: var(--muted); font-size: 1rem; }
details.demo .chat { margin: 0 1rem 1rem; box-shadow: none; }
.chat-log.no-motion .msg.shown { animation: none; }
.chat-log.no-motion .typing span { animation: none; opacity: .6; }

/* Modulo dei contatti */
.form { display: grid; gap: 1.1rem; max-width: 40rem; margin-top: 1.5rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; }
.field input[type="text"], .field input[type="email"], .field select, .field textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--line);
  border-radius: 10px; padding: .6rem .75rem; width: 100%;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
[aria-invalid="true"] { border-color: #c0392b !important; }
.field .hint { font-size: .95rem; color: var(--muted); margin: 0; }
.field.check { grid-template-columns: auto 1fr; align-items: start; gap: .7rem; }
.field.check input { width: 1.3rem; height: 1.3rem; margin-top: .25rem; accent-color: var(--accent); }
.field.check label { font-weight: 400; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.turnstile { min-height: 65px; }
.form .btn { justify-self: start; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.form .btn:disabled { opacity: .55; cursor: not-allowed; }
.form-status { margin: 0; font-weight: 600; min-height: 1.6em; }
.ok-text { color: var(--accent-strong); }
.error-text { color: #c0392b; }
.warn-text { color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .error-text, :root:not([data-theme="light"]) [aria-invalid="true"] { color: #ff8a80; border-color: #ff8a80 !important; } }
.news h3 { margin: 1.8rem 0 .4rem; }
