/* ==========================================================================
   kanagalingam.it — foglio di stile principale
   Un'unica famiglia (Bricolage Grotesque, self-hosted), palette fredda,
   tema chiaro/scuro automatico. Nessuna dipendenza esterna.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2-variations"),
       url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Token ---------- */
:root {
  --paper:   #f8f9fb;
  --raised:  #ffffff;
  --surface: #eef1f6;
  --ink:     #121a2e;
  --muted:   #55607a;
  --line:    #dde2ea;
  --line-strong: #c3cad6;
  --accent:  #2e44d6;
  --accent-ink: #ffffff;
  --accent-soft: #e6e9fb;
  --signal:  #1e8c5a;
  --signal-text: #146c45;
  --danger:  #b42318;

  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* scala tipografica (rapporto ~1.25, base 17px) */
  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.3125rem;
  --fs-lg: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  --fs-xl: clamp(2rem, 1.4rem + 2.2vw, 2.875rem);
  --fs-hero: clamp(2.6rem, 0.9rem + 4.6vw, 5rem);

  --gutter: clamp(1rem, 0.4rem + 2.6vw, 3rem);
  --max: 1200px;
  --radius-s: 6px;
  --radius-m: 12px;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #0e1424;
    --raised:  #141c30;
    --surface: #18223a;
    --ink:     #e9edf5;
    --muted:   #9aa5bd;
    --line:    #26314b;
    --line-strong: #3a4664;
    --accent:  #93a2ff;
    --accent-ink: #0e1424;
    --accent-soft: #1f2a52;
    --signal:  #4cc38a;
    --signal-text: #4cc38a;
    --danger:  #ff8a7a;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
h1, h2, h3 { line-height: 1.1; font-weight: 650; letter-spacing: -0.02em; text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 200;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; border-radius: var(--radius-s); text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Bottoni e link ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.7rem 1.35rem;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 560; font-size: 1rem; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .7; cursor: progress; }

.text-link {
  color: var(--accent); font-weight: 560; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 4px;
}
.text-link:hover { text-decoration-thickness: 2px; }
.ext::after { content: "\2197"; display: inline-block; margin-left: .2em; font-weight: 400; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: var(--header-h); }

.brand { display: inline-flex; align-items: baseline; gap: .55rem; text-decoration: none; margin-right: auto; }
.brand-mark { font-weight: 780; font-size: 1.3rem; letter-spacing: -0.03em; }
.brand-mark span { color: var(--accent); }
.brand-name { font-size: var(--fs-sm); color: var(--muted); }

.main-nav ul { display: flex; gap: 1.75rem; list-style: none; padding: 0; }
.main-nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; padding: .4rem 0; }
.main-nav a:hover, .main-nav a[aria-current="true"] { color: var(--ink); }

.lang { display: flex; gap: .25rem; font-size: var(--fs-sm); }
.lang a {
  text-decoration: none; color: var(--muted); padding: .3rem .55rem; border-radius: var(--radius-s);
  min-width: 36px; text-align: center;
}
.lang a:hover { color: var(--ink); background: var(--surface); }
.lang a[aria-current="page"] { color: var(--ink); font-weight: 650; background: var(--surface); }

.header-cta { min-height: 40px; padding: .5rem 1.05rem; font-size: .95rem; }

.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--line-strong); background: transparent;
  border-radius: 999px; cursor: pointer;
}
.menu-toggle svg { width: 20px; height: 20px; }
.menu-toggle .i-close { display: none; }
.menu-toggle[aria-expanded="true"] .i-open { display: none; }
.menu-toggle[aria-expanded="true"] .i-close { display: block; }

@media (max-width: 880px) {
  .brand-name { display: none; }
  .menu-toggle { display: inline-flex; }
  .header-cta { display: none; }
  .main-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: .5rem var(--gutter) 1.5rem;
    display: none;
  }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav li + li { border-top: 1px solid var(--line); }
  .main-nav a { display: block; padding: 1rem 0; font-size: 1.15rem; color: var(--ink); }
  .main-nav .nav-mobile-cta { display: flex; margin-top: 1.25rem; width: 100%; color: var(--accent-ink); padding: .7rem 1.35rem; font-size: 1rem; }
}
@media (min-width: 881px) { .nav-mobile-cta { display: none !important; } }

/* ---------- Sezioni ---------- */
.section { padding-block: clamp(4rem, 3rem + 4vw, 7rem); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 46rem; margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem); }
.section-head h2 { font-size: var(--fs-xl); }
.section-head p { margin-top: 1rem; color: var(--muted); font-size: var(--fs-md); line-height: 1.5; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(2.5rem, 1.5rem + 5vw, 6rem) clamp(3rem, 2rem + 4vw, 5.5rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(2rem, 1rem + 4vw, 5rem); align-items: center; }
.hero-intro { color: var(--muted); font-size: var(--fs-md); margin-bottom: 1.25rem; }
.hero h1 { font-size: var(--fs-hero); font-weight: 720; line-height: .94; letter-spacing: -0.045em; }
.hero h1 .line { display: block; }
.hero-lead { margin-top: 1.75rem; font-size: var(--fs-md); line-height: 1.5; max-width: 34rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(2.5rem, 2rem + 3vw, 4.5rem);
  border-top: 1px solid var(--line);
}
.facts > div { padding: 1.25rem 1.25rem 0 0; }
.facts > div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.facts dt { order: 2; color: var(--muted); font-size: var(--fs-sm); }
.facts dd { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-bottom: .4rem; font-variant-numeric: tabular-nums; }
.facts > div { display: flex; flex-direction: column; }

/* Diagramma di flusso */
.flow { position: relative; }
.flow-card {
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: clamp(.75rem, .5rem + 1vw, 1.25rem);
}
.flow svg { width: 100%; height: auto; overflow: visible; }
.flow .wire { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.flow .pulse { fill: var(--accent); }
.flow .pulse.ok { fill: var(--signal); }
.flow .node rect { fill: var(--paper); stroke: var(--line-strong); stroke-width: 1; }
.flow .node.core rect { fill: var(--accent); stroke: var(--accent); }
.flow .node text { font-family: var(--font); font-size: 13px; fill: var(--ink); font-weight: 560; }
.flow .node .sub { font-size: 11px; fill: var(--muted); font-weight: 400; }
.flow .node.core text { fill: var(--accent-ink); }
.flow .node.core .sub { fill: var(--accent-ink); opacity: .8; }

.flow-log { list-style: none; padding: 0; margin-top: .75rem; border-top: 1px solid var(--line); font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.flow-log li { display: flex; gap: .6rem; align-items: center; padding: .45rem .25rem; border-bottom: 1px dashed var(--line); }
.flow-log li:last-child { border-bottom: 0; }
.flow-log .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); flex: none; }
.flow-log li.is-active { color: var(--ink); }
.flow figcaption { margin-top: .6rem; font-size: .8rem; color: var(--muted); }

/* ---------- Servizi ---------- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); }
.service { padding: 1.75rem 1.75rem 0 0; }
.service + .service { padding-left: 1.75rem; border-left: 1px solid var(--line); }
.service h3 { font-size: var(--fs-lg); margin-bottom: .75rem; }
.service > p { color: var(--muted); }
.service ul { margin-top: 1.25rem; padding: 0; list-style: none; }
.service li { padding: .65rem 0; border-top: 1px solid var(--line); font-weight: 500; display: flex; gap: .6rem; }
.service li::before { content: ""; flex: none; width: 6px; height: 6px; margin-top: .62em; border-radius: 1px; background: var(--accent); }

/* ---------- Prodotto: BulkSync ---------- */
.product { background: var(--surface); }
.section.product + .section, .section + .section.product { border-top: 0; }
.product-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 1rem + 4vw, 5rem); align-items: start; }
.product-kicker { display: inline-flex; gap: .5rem; align-items: center; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 1rem; }
.product-kicker .badge { background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: .15rem .55rem; border-radius: 999px; }
.product h2 { font-size: var(--fs-xl); }
.product-lead { margin-top: 1rem; font-size: var(--fs-md); line-height: 1.5; }
.feature-list { margin-top: 1.75rem; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: .2rem 1.5rem; }
.feature-list li { padding: .7rem 0; border-top: 1px solid var(--line-strong); }
.feature-list strong { display: block; font-weight: 620; }
.feature-list span { color: var(--muted); font-size: .95rem; }
.product-actions { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; margin-top: 2rem; }
.product-note { margin-top: 1rem; font-size: var(--fs-sm); color: var(--muted); }

.mapping {
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1.25rem; font-size: .92rem;
}
.mapping-head { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.mapping-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.mapping-row:last-of-type { border-bottom: 0; }
.mapping-row code { font-family: var(--mono); font-size: .82rem; background: var(--surface); padding: .2rem .45rem; border-radius: 4px; justify-self: start; }
.mapping-row .to { justify-self: end; background: var(--accent-soft); color: var(--ink); }
.mapping-row svg { width: 18px; height: 18px; color: var(--muted); }
.mapping-foot { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 1rem; font-size: .82rem; color: var(--muted); }
.mapping-foot b { color: var(--signal-text); font-weight: 600; }

/* ---------- Progetti ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.filter {
  min-height: 40px; padding: .45rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: transparent; font-size: .95rem;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.filter:hover { border-color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filter .count { color: inherit; opacity: .6; margin-left: .3rem; font-variant-numeric: tabular-nums; }

.featured { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.featured-item {
  display: flex; flex-direction: column; gap: .6rem;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1.5rem;
}
.featured-item:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem 3rem; border-color: var(--ink); }
.featured-item:first-child .fi-main { display: flex; flex-direction: column; gap: .6rem; }
.featured-item h3 { font-size: var(--fs-lg); }
.featured-item:first-child h3 { font-size: var(--fs-xl); }
.fi-meta { font-size: var(--fs-sm); color: var(--muted); }
.featured-item p { color: var(--muted); }
.featured-item:first-child p { font-size: var(--fs-md); line-height: 1.5; color: var(--ink); }
.featured-item .text-link { margin-top: auto; padding-top: .5rem; align-self: flex-start; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; list-style: none; }
.tags li { font-size: .8rem; padding: .15rem .6rem; border-radius: 999px; background: var(--surface); color: var(--muted); }

.project-list { list-style: none; padding: 0; border-top: 2px solid var(--ink); }
.project-row {
  display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) minmax(0, 15rem);
  gap: .5rem 2rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); align-items: start;
}
.project-row h3 { font-size: 1.15rem; font-weight: 620; letter-spacing: -0.01em; line-height: 1.3; }
.project-row .fi-meta { margin-top: .2rem; }
.project-row p { color: var(--muted); }
.project-row .tags { justify-content: flex-end; }
[hidden] { display: none !important; }
.empty-note { padding: 1.5rem 0; color: var(--muted); }

/* ---------- Esperienza + stack ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 1rem + 4vw, 5rem); }
.about-grid h2 { font-size: var(--fs-xl); margin-bottom: 2rem; }
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: .5rem; bottom: .5rem; width: 1px; background: var(--line-strong); }
.timeline li { position: relative; padding-left: 2rem; padding-bottom: 2rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 0; top: .45rem; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.timeline li.current::before { background: var(--accent); }
.timeline time { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: var(--fs-lg); margin: .2rem 0 .5rem; }
.timeline p { color: var(--muted); }

.stack { display: grid; gap: 0; }
.stack > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.stack > div:last-child { border-bottom: 1px solid var(--line); }
.stack dt { font-weight: 620; }
.stack dd { color: var(--muted); }

/* ---------- Contatti ---------- */
.contact {
  /* la sezione contatti resta scura in entrambi i temi: token fissi */
  --paper: #f8f9fb; --ink: #121a2e;
  background: var(--ink); color: var(--paper);
}
.contact .section-head p { color: color-mix(in srgb, var(--paper) 72%, var(--ink)); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(2rem, 1rem + 4vw, 5rem); align-items: start; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 560; font-size: .95rem; }
.field .hint { font-size: .82rem; color: color-mix(in srgb, var(--paper) 65%, var(--ink)); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: .7rem .9rem;
  background: color-mix(in srgb, var(--paper) 7%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--paper) 22%, var(--ink));
  border-radius: var(--radius-s); color: var(--paper);
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 15px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2.5rem; }
.field select option { color: #121a2e; background: #fff; }
.field textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--paper) 45%, var(--ink)); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent-on-dark, #93a2ff); outline-offset: 1px; border-color: transparent; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: #ff8a7a; }
.field .error { color: #ff8a7a; font-size: .85rem; min-height: 0; }
.field .error:empty { display: none; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.consent { grid-column: 1 / -1; display: flex; gap: .7rem; align-items: flex-start; font-size: .92rem; }
.consent input { width: 20px; height: 20px; margin-top: .15rem; accent-color: #93a2ff; flex: none; }
.privacy { grid-column: 1 / -1; font-size: .85rem; color: color-mix(in srgb, var(--paper) 70%, var(--ink)); }
.privacy summary { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; width: fit-content; }
.privacy p { margin-top: .5rem; max-width: 60ch; }

.form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.contact .btn-primary { background: #93a2ff; color: #0e1424; }
.contact .btn-primary:hover { background: #b3bdff; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: none; }
.btn[aria-busy="true"] .spinner { display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-status { grid-column: 1 / -1; padding: .9rem 1rem; border-radius: var(--radius-s); font-size: .95rem; }
.form-status:empty { display: none; }
.form-status.is-success { background: color-mix(in srgb, #4cc38a 18%, var(--ink)); border: 1px solid #4cc38a; }
.form-status.is-error { background: color-mix(in srgb, #ff8a7a 14%, var(--ink)); border: 1px solid #ff8a7a; }
.form-status a { color: inherit; font-weight: 600; }

.direct { border-top: 1px solid color-mix(in srgb, var(--paper) 22%, var(--ink)); }
.direct h3 { font-size: var(--fs-md); margin: 1.5rem 0 1rem; }
.direct ul { list-style: none; padding: 0; }
.direct li { border-bottom: 1px solid color-mix(in srgb, var(--paper) 16%, var(--ink)); }
.direct a, .direct .copy-row { display: flex; flex-direction: column; padding: 1rem 0; text-decoration: none; }
.direct .k { font-size: .82rem; color: color-mix(in srgb, var(--paper) 65%, var(--ink)); }
.direct .v { font-size: 1.05rem; font-weight: 560; overflow-wrap: anywhere; }
.direct a:hover .v { text-decoration: underline; text-underline-offset: 4px; }
.copy-btn {
  margin-top: .4rem; align-self: flex-start; background: transparent; border: 1px solid color-mix(in srgb, var(--paper) 30%, var(--ink));
  color: inherit; font-size: .82rem; padding: .3rem .7rem; border-radius: 999px; cursor: pointer; min-height: 32px;
}
.copy-btn:hover { border-color: var(--paper); }

@media (prefers-color-scheme: dark) {
  .contact { background: #070b16; }
  .contact .btn-primary { background: var(--accent); color: var(--accent-ink); }
}

/* ---------- Footer ---------- */
.site-footer { padding-block: 3.5rem 2rem; border-top: 1px solid var(--line); font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer-brand p { color: var(--muted); margin-top: .75rem; max-width: 30ch; }
.site-footer h2 { font-size: .95rem; font-weight: 650; letter-spacing: 0; margin-bottom: .75rem; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { padding: .25rem 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Comparsa del diagramma (unica animazione d'ingresso) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .flow .node { opacity: 0; transition: opacity .5s ease; }
  .js .flow.is-in .node { opacity: 1; }
  .js .flow.is-in .node:nth-of-type(2) { transition-delay: .08s; }
  .js .flow.is-in .node:nth-of-type(3) { transition-delay: .16s; }
  .js .flow.is-in .node:nth-of-type(4) { transition-delay: .24s; }
  .js .flow.is-in .node:nth-of-type(5) { transition-delay: .32s; }
  .js .flow.is-in .node:nth-of-type(6) { transition-delay: .40s; }
  .js .flow .wire { stroke-dasharray: 400; stroke-dashoffset: 400; transition: stroke-dashoffset 1s ease .2s; }
  .js .flow.is-in .wire { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .flow .pulse { display: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .project-row { grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); }
  .project-row .tags { grid-column: 2; justify-content: flex-start; }
}

@media (max-width: 880px) {
  .hero-grid, .product-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .services { grid-template-columns: 1fr; border-top: 0; }
  .service, .service + .service { padding: 1.75rem 0 0; border-left: 0; border-top: 2px solid var(--ink); }
  .service + .service { margin-top: 2rem; }
  .featured { grid-template-columns: 1fr; }
  .featured-item:first-child { grid-column: auto; grid-template-columns: 1fr; }
  .featured-item:first-child p { font-size: var(--fs-base); color: var(--muted); }
  .featured-item:first-child h3 { font-size: var(--fs-lg); }
  .about-grid > div + div { margin-top: 1rem; }
}

@media (max-width: 600px) {
  :root { --header-h: 60px; }
  .facts { grid-template-columns: 1fr 1fr 1fr; }
  .facts > div { padding: 1rem .5rem 0 0; }
  .facts > div + div { padding-left: .75rem; }
  .facts dd { font-size: 1.85rem; }
  .facts dt { font-size: .8rem; line-height: 1.35; }
  .hero-actions .btn { flex: 1 1 100%; }
  .feature-list { grid-template-columns: 1fr; }
  .project-row { grid-template-columns: 1fr; gap: .4rem; }
  .project-row .tags { grid-column: auto; margin-top: .3rem; }
  .form { grid-template-columns: 1fr; }
  .form-actions .btn { width: 100%; }
  .stack > div { grid-template-columns: 1fr; gap: .2rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .flow-log { font-size: .72rem; }
  .mapping-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .4rem; }
  .mapping-row code { font-size: .75rem; overflow-wrap: anywhere; }
}

@media print {
  .site-header, .flow, .filters, .form, .skip-link { display: none !important; }
  .contact { background: none; color: #000; }
  body { background: #fff; color: #000; }
}
.direct .copy-row > a { padding: 0; }
