/* Stile B "Scheda PCB". Sorgenti e proposte in grafica/proposte-stile/. Font ospitati in locale (static/fonts). */
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(../fonts/archivo-variable-latin.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/jetbrains-mono-400.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/jetbrains-mono-500.woff2) format("woff2"); }
/* Struttura comune alle tre proposte: cambiano token, font e decorazioni. Mobile first. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-body)/1.6 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; display: block; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.85rem, 6.5vw, 3.1rem); font-weight: var(--fw-h1); letter-spacing: -0.02em; margin: 0.35em 0 0.5em; }
h2 { font-size: clamp(1.35rem, 4vw, 1.75rem); font-weight: var(--fw-h2); letter-spacing: -0.01em; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4rem; }
.wrap { max-width: 70rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px; z-index: 10; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); flex: 1 1 0; min-width: 0; }
.brand-mark { width: 38px; height: 38px; flex: none; color: var(--logo); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; line-height: 1.15; letter-spacing: -0.01em; }
.brand-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.menu { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; font-size: 0.95rem; }
.header-inner nav { order: 3; width: 100%; }
.menu a { color: var(--text); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.menu a:hover, .menu a[aria-current="page"] { border-bottom-color: var(--accent); }
.theme-toggle { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer; display: grid; place-items: center; color: var(--text); }
.theme-toggle span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
@media (min-width: 52rem) { .header-inner nav { order: 0; width: auto; } .header-inner { flex-wrap: nowrap; } }

.hero { padding-top: 48px; padding-bottom: 40px; }
.eyebrow { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.intro { max-width: 40rem; color: var(--muted); font-size: 1.1rem; }
.intro p { margin: 0 0 0.8em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.btn { display: inline-block; background: var(--accent); color: var(--on-accent); padding: 11px 20px; border-radius: var(--radius); text-decoration: none; font-weight: 600; border: 1px solid var(--accent); }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--accent-text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); filter: none; }

.block { padding-top: 28px; padding-bottom: 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent-text); }
.card p { margin: 0; color: var(--muted); font-size: 0.97rem; }
.card .tags { font-family: var(--font-mono); font-size: 0.74rem; margin-top: 12px; color: var(--muted); }
.card-img { aspect-ratio: 16/10; margin-bottom: 14px; border-radius: calc(var(--radius) - 2px); background: var(--bg-alt); border: 1px dashed var(--line-strong); display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.cta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px max(16px, 5vw); margin: 32px auto 48px; max-width: calc(70rem - 32px); }
.cta p { color: var(--muted); }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 48px; font-size: 0.93rem; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 16px; padding-top: 28px; padding-bottom: 12px; }
.social { list-style: none; margin: 0; padding: 0; }
.copy { color: var(--muted); font-size: 0.82rem; padding-bottom: 24px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
.pcb-art, .ref { display: none; }
/* B · Scheda PCB, versione blu: solder mask blu acciaio, oro per piazzole e dettagli, piste e piazzole come decorazione. */
:root {
  --bg: #eef2f8; --bg-alt: #e0e8f3; --surface: #fbfcfe; --text: #101a2c; --muted: #4f5f79;
  --line: #cad5e5; --line-strong: #8aa0c0; --accent: #1f5fc4; --accent-text: #1a4fa6; --on-accent: #ffffff; --copper: #a87a1d;
  --logo: #1f5fc4;
  --font-body: "Archivo", system-ui, sans-serif; --font-head: "Archivo", system-ui, sans-serif; --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --fs-body: 1.0625rem; --fw-h1: 700; --fw-h2: 700; --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0a1220; --bg-alt: #101c31; --surface: #0e182a; --text: #e5ecf7; --muted: #93a4be;
  --line: #1f3252; --line-strong: #36567f; --accent: #5ca3ff; --accent-text: #7db5ff; --on-accent: #06101f; --copper: #e2b655; --logo: #5ca3ff; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0a1220; --bg-alt: #101c31; --surface: #0e182a; --text: #e5ecf7; --muted: #93a4be;
  --line: #1f3252; --line-strong: #36567f; --accent: #5ca3ff; --accent-text: #7db5ff; --on-accent: #06101f; --copper: #e2b655; --logo: #5ca3ff; color-scheme: dark; }
h1, h2 { font-stretch: 112%; }
.brand-name { font-stretch: 108%; }
body { background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.5px); background-size: 20px 20px; }
:root { --grid-dot: rgba(31, 95, 196, 0.15); --trace: rgba(31, 95, 196, 0.4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grid-dot: rgba(92, 163, 255, 0.14); --trace: rgba(92, 163, 255, 0.4); } }
:root[data-theme="dark"] { --grid-dot: rgba(92, 163, 255, 0.14); --trace: rgba(92, 163, 255, 0.4); }

/* Hero: piste a 45 gradi con piazzole, vie e serigrafia */
.hero { position: relative; overflow: hidden; }
@media (min-width: 52rem) { .hero h1 { max-width: 38rem; } }
.pcb-art { display: block; position: absolute; right: 0; top: 0; width: min(100%, 28rem); height: auto; opacity: 0.6; pointer-events: none; z-index: 0; }
.pcb-art .trace { stroke: var(--trace); }
.pcb-art .pad circle { fill: var(--copper); }
.pcb-art .via circle { fill: var(--bg); stroke: var(--copper); stroke-width: 4; }
.pcb-art .silk { fill: var(--muted); font: 500 11px var(--font-mono); letter-spacing: 0.08em; }
.hero > *:not(.pcb-art) { position: relative; z-index: 1; }
@media (max-width: 52rem) { .pcb-art { opacity: 0.3; width: 100%; } }
.eyebrow { color: var(--copper); }
.eyebrow::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--copper); margin-right: 8px; }

/* Card come circuiti integrati: piedini ai lati, tacca di orientamento, designatore serigrafato */
.card { position: relative; border-radius: 6px; border: 1.5px solid var(--line-strong); background: var(--surface); margin-inline: 6px; padding-top: 22px; }
.card::before, .card::after { content: ""; position: absolute; top: 18px; bottom: 18px; width: 6px; background: repeating-linear-gradient(to bottom, var(--copper) 0 7px, transparent 7px 17px); opacity: 0.9; }
.card::before { left: -7px; border-radius: 2px 0 0 2px; }
.card::after { right: -7px; border-radius: 0 2px 2px 0; }
.card .ref { display: block; position: absolute; top: 8px; right: 12px; font: 500 0.7rem var(--font-mono); letter-spacing: 0.1em; color: var(--muted); }
.card:hover { border-color: var(--accent); }
.card h3 { padding-top: 0; }
.card-img { margin-top: 0; }
.grid { gap: 20px 16px; }
.card h3::before { content: ""; position: absolute; top: 8px; left: 12px; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--copper); }

/* Titoli di sezione: piazzola, poi una pista fino al bordo */
h2 { display: flex; align-items: center; gap: 12px; }
h2::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--copper); box-shadow: 0 0 0 4px var(--bg), 0 0 0 5.5px var(--copper); margin-right: 4px; }
h2::after { content: ""; flex: 1; min-width: 16px; height: 4px; border-radius: 2px; background: var(--trace); }
.cta h2::before, .cta h2::after { content: none; }

.btn { border-radius: 4px; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.02em; }
.site-header { border-bottom: 3px solid var(--accent); }
.brand-mark { color: var(--logo); }
.cta { border: 2px dashed var(--accent); border-radius: 6px; position: relative; }
.cta::before { content: "TEST POINT"; position: absolute; top: -0.7em; left: 16px; background: var(--bg); padding: 0 8px; font: 500 0.7rem var(--font-mono); letter-spacing: 0.12em; color: var(--copper); }
.site-footer { border-top: 3px solid var(--accent); background-image: radial-gradient(circle, var(--copper) 0 2.5px, transparent 3px); background-size: 28px 12px; background-repeat: repeat-x; background-position: 8px 0; padding-top: 10px; }

/* Pagine di testo, 404, laboratorio */
.page { padding-top: 40px; padding-bottom: 48px; }
.page > h1 { margin-top: 0; }
.prose h2 { margin-top: 1.8em; font-size: 1.35rem; }
.prose h2::after { content: none; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.meta { color: var(--muted); font-family: var(--font-mono); font-size: 0.85rem; }
.page .tags { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }
aside.cta { max-width: none; margin: 40px 0 0; }
.page .grid { margin-top: 24px; }
.page .btn + .btn { margin-left: 6px; }
.card img { aspect-ratio: 16/10; object-fit: cover; width: 100%; border-radius: 4px; margin-bottom: 14px; }

/* Filtri per tema nella pagina Progetti */
.filtri { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.filtro { font: 500 0.8rem var(--font-mono); padding: 6px 12px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.filtro:hover { border-color: var(--accent); }
.filtro[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.card[hidden] { display: none; }

/* Tutta l'area del riquadro è cliccabile */
.card h3 a::before { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card h3 a:focus-visible { outline: none; }
.card:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.card { cursor: pointer; }

/* Galleria: foto ritagliate in riquadri uniformi, cliccabili per ingrandire */
.galleria { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 10rem; gap: 10px; margin: 1.4rem 0; }
.galleria figure { margin: 0; position: relative; overflow: hidden; border-radius: 6px; border: 1.5px solid var(--line-strong); background: var(--bg-alt); }
.galleria a { display: block; position: absolute; inset: 0; }
.galleria img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.galleria a:hover img { transform: scale(1.04); }
.galleria figcaption { position: absolute; inset: auto 0 0 0; padding: 22px 10px 8px; font-size: 0.82rem; line-height: 1.3; color: #fff; background: linear-gradient(to top, rgba(6,14,30,.82), transparent); pointer-events: none; }
.galleria-alta { grid-auto-rows: 16rem; }
.galleria figure:first-child:nth-last-child(odd) { grid-column: span 2; }
@media (min-width: 40rem) {
  .galleria { grid-auto-rows: 15rem; }
  .galleria-alta { grid-auto-rows: 24rem; }
  .galleria:has(figure:nth-child(3):last-child), .galleria:has(figure:nth-child(5):last-child), .galleria:has(figure:nth-child(6):last-child) { grid-template-columns: repeat(3, 1fr); }
  .galleria figure:first-child:nth-last-child(3) { grid-column: auto; }
  .galleria-alta figure:first-child:nth-last-child(odd) { grid-column: auto; }
}
/* Pagine: testo a larghezza di lettura, gallerie e immagini più larghe */
.prose { max-width: 70rem; }
.prose > p:empty { display: none; }
.prose figure.foto { margin: 1.4rem 0; }
.prose figure.foto img { max-height: 28rem; width: auto; max-width: 100%; border-radius: 6px; border: 1.5px solid var(--line-strong); }
.prose figure.foto figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
/* Ingrandimento */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(6, 12, 24, 0.88); }
.lightbox img { max-width: 96vw; max-height: 92vh; width: auto; height: auto; border-radius: 6px; }
.lightbox button { position: absolute; top: -14px; right: -6px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface); color: var(--text); font-size: 1.4rem; cursor: pointer; }

/* Capacità del laboratorio (pagina Servizi) */
.capacita { margin-top: 48px; scroll-margin-top: 80px; }
.cap-intro { color: var(--muted); max-width: 46rem; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: 20px 16px; margin-top: 20px; }
.cap { position: relative; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); padding: 22px 18px 14px; margin-inline: 6px; }
.cap:hover { border-color: var(--accent); }
.cap .ref { position: absolute; top: 8px; right: 12px; font: 500 0.7rem var(--font-mono); letter-spacing: 0.1em; color: var(--muted); }
.cap h3 { margin: 0 0 8px; }
.cap ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.95rem; }
.cap li { margin: 0 0 6px; }
