/*
Theme Name: GiovLab
Description: Tema predefinito di GiovLab CMS: chiaro, blu, grigio e bianco, con home per progetti e articoli.
Version: 1.1.0
Author: GiovLab
*/
@font-face { font-family: "Inter"; font-weight: 400; font-style: normal; font-display: swap; src: url("assets/fonts/Inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-style: normal; font-display: swap; src: url("assets/fonts/Inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-style: normal; font-display: swap; src: url("assets/fonts/Inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 700; font-style: normal; font-display: swap; src: url("assets/fonts/InterDisplay-Bold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 800; font-style: normal; font-display: swap; src: url("assets/fonts/InterDisplay-ExtraBold.woff") format("woff"); }

:root {
    --bg: #f4f7fb;
    --bg-2: #eaf0f7;
    --surface: #ffffff;
    --ink: #0a1222;
    --text: #1f2a3d;
    --muted: #5d6b82;
    --muted-2: #8a97ab;
    --line: #e2e8f0;
    --line-2: #cfd8e4;

    --blue: #1f6bf2;
    --blue-hover: #1658d4;
    --blue-50: #edf3fe;
    --blue-100: #dbe7fd;
    --blue-200: #b9d0fb;

    --navy: #0b1324;
    --navy-2: #121d33;

    --danger: #c0262d;
    --danger-soft: #fdf1f1;
    --ok: #0f7a4d;
    --ok-soft: #eaf7f0;

    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;

    --shadow-sm: 0 1px 2px rgb(10 18 34 / .05);
    --shadow: 0 1px 2px rgb(10 18 34 / .04), 0 8px 24px -10px rgb(10 18 34 / .12);
    --shadow-lg: 0 2px 4px rgb(10 18 34 / .03), 0 24px 48px -20px rgb(10 18 34 / .18);

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Inter Display", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --header-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-hover); }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue-200); outline-offset: 2px; border-radius: 6px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.inline { display: inline; margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--navy); color: #fff; border-radius: var(--radius-xs); }
.skip:focus { top: 12px; color: #fff; }
.icon { flex: none; display: block; }
.empty { color: var(--muted); padding: 24px 0; }

.eyebrow {
    margin: 0 0 14px; font-size: .75rem; font-weight: 600; letter-spacing: .2em;
    text-transform: uppercase; color: var(--muted);
}
.eyebrow a { color: inherit; }
.eyebrow a:hover { color: var(--blue); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 640px; }

/* ---------- Pulsanti ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border: 1px solid var(--blue); border-radius: var(--radius-sm);
    background: var(--blue); color: #fff;
    font: inherit; font-size: .95rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
    cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
    box-shadow: 0 6px 16px -8px rgb(31 107 242 / .55);
}
.btn:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn .icon { transition: transform .2s; }
.btn:hover .icon { transform: translateX(2px); }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 12px; }
.btn-sm { padding: 8px 14px; font-size: .88rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
.btn-outline, .btn-ghost {
    background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm);
}
.btn-outline:hover, .btn-ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-dark { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 6px 16px -10px rgb(10 18 34 / .7); }
.btn-dark:hover { background: #000; border-color: #000; }

.icon-btn {
    display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: rgb(10 18 34 / .06); color: var(--ink); }

.link-danger, .link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--danger); }
.link-btn { color: var(--blue); }
.link-danger:hover, .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Avvisi ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 0 0 20px; border: 1px solid; font-size: .95rem; }
.alert-success { background: var(--ok-soft); border-color: #bfe5d2; color: var(--ok); }
.alert-error   { background: var(--danger-soft); border-color: #f4c7c9; color: var(--danger); }
.alert-warning { background: var(--bg-2); border-color: var(--line-2); color: var(--muted); }
.flash-wrap { position: relative; z-index: 5; padding-top: 16px; }
.flash-wrap .alert { margin: 0; }
.is-home .flash-wrap { padding-top: calc(var(--header-h) + 12px); margin-bottom: calc(-1 * var(--header-h) - 12px); }

/* ---------- Form ---------- */
label { display: block; margin-bottom: 16px; font-weight: 600; font-size: .93rem; color: var(--ink); }
label small { font-weight: 400; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=url], select, textarea {
    display: block; width: 100%; margin-top: 6px; padding: 11px 13px;
    font: inherit; font-size: .95rem; font-weight: 400; color: var(--ink);
    background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-100); }
input[type=file] {
    display: block; width: 100%; margin: 8px 0 6px; padding: 12px;
    font: inherit; font-size: .9rem; font-weight: 400; color: var(--muted);
    background: var(--bg); border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
}
input[type=file]::file-selector-button {
    margin-right: 12px; padding: 7px 12px; font: inherit; font-weight: 600; font-size: .85rem;
    color: var(--blue); background: var(--blue-50); border: 0; border-radius: var(--radius-xs); cursor: pointer;
}
textarea { line-height: 1.55; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
    position: sticky; top: 0; z-index: 40;
    background: rgb(244 247 251 / .8); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent; transition: background .2s, border-color .2s;
}
.site-header.is-scrolled { background: rgb(255 255 255 / .9); border-bottom-color: var(--line); }
.is-home .site-header:not(.is-scrolled) { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.header-inner { display: flex; align-items: center; gap: 32px; height: var(--header-h); }

.logo { display: inline-flex; align-items: center; color: var(--ink); flex: none; }
.logo:hover { color: var(--ink); }
.logo-text { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; letter-spacing: .12em; text-transform: uppercase; color: var(--navy); }
.logo-img { display: block; height: 32px; width: auto; }

.main-nav { display: flex; align-items: center; gap: 6px; margin: 0 auto; }
.main-nav > a { position: relative; padding: 8px 14px; border-radius: var(--radius-xs); color: var(--ink); font-size: .93rem; font-weight: 500; }
.main-nav > a:hover, .main-nav > a[aria-current="page"] { color: var(--blue); }
.nav-group { position: relative; display: flex; align-items: center; }
.nav-group > a { padding: 8px 4px 8px 14px; border-radius: var(--radius-xs); color: var(--ink); font-size: .93rem; font-weight: 500; }
.nav-group > a:hover, .nav-group.is-current > a { color: var(--blue); }
.nav-sub-toggle { display: grid; place-items: center; width: 26px; height: 30px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.nav-sub { position: absolute; top: 100%; left: 4px; z-index: 50; min-width: 210px; padding: 8px; display: none; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.nav-group:hover .nav-sub, .nav-group:focus-within .nav-sub, .nav-group.is-open .nav-sub { display: flex; }
.nav-sub a { padding: 9px 12px; border-radius: var(--radius-xs); color: var(--ink); font-size: .92rem; font-weight: 500; }
.nav-sub a:hover, .nav-sub a[aria-current="page"] { background: var(--blue-50); color: var(--blue); }
@media (max-width: 900px) {
    .nav-group { flex-wrap: wrap; }
    .nav-group > a { flex: 1; padding: 14px 4px; font-size: 1.1rem; border-bottom: 1px solid var(--line); border-radius: 0; }
    .nav-sub-toggle { height: 50px; width: 44px; border-bottom: 1px solid var(--line); }
    .nav-sub { position: static; width: 100%; box-shadow: none; border: 0; padding: 0 0 0 14px; background: transparent; }
    .nav-group:hover .nav-sub, .nav-group:focus-within .nav-sub { display: none; }
    .nav-group.is-open .nav-sub { display: flex; }
}
.nav-mobile-user { display: none; }

.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; color: var(--ink); font-size: .88rem; font-weight: 600; }
.user-chip:hover { background: rgb(10 18 34 / .06); color: var(--ink); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--blue-50); color: var(--blue); font-size: .8rem; font-weight: 700; }
.nav-toggle { display: none; }

.header-search { position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.header-search-inner { display: flex; align-items: center; gap: 12px; padding-top: 12px; padding-bottom: 12px; color: var(--muted); }
.header-search input { margin: 0; border: 0; box-shadow: none !important; font-size: 1.05rem; padding: 10px 4px; background: transparent; }

/* ==========================================================================
   Home · hero
   ========================================================================== */
.is-home .site-main { margin-top: calc(-1 * var(--header-h)); }
.hero { position: relative; padding-top: calc(var(--header-h) + 56px); padding-bottom: 128px; overflow: hidden; }
.hero-inner { position: relative; z-index: 2; }
.hero-copy { max-width: 560px; }
.hero h1 {
    font-family: var(--font-display); font-weight: 800;
    font-size: clamp(2.6rem, 5.4vw, 4.4rem); line-height: 1.03; letter-spacing: -.035em;
    margin: 0 0 24px; color: var(--ink);
}
.hero .hl { color: var(--blue); }
.hero-text { font-size: 1.08rem; line-height: 1.6; color: var(--text); max-width: 440px; margin-bottom: 32px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 44px; }
.hero .btn-outline { background: rgb(255 255 255 / .7); }

.stats { display: flex; flex-wrap: wrap; gap: 20px 48px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dd { margin: 0; font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; color: var(--ink); line-height: 1.2; letter-spacing: -.01em; }
.stats dt { font-size: .82rem; color: var(--muted); }

/* immagine a destra con dissolvenza verso sinistra e verso il basso */
.hero-visual {
    position: absolute; z-index: 1; top: 0; right: 0; bottom: 40px; width: min(58vw, 820px);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 34%), linear-gradient(to bottom, #000 62%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0%, #000 34%), linear-gradient(to bottom, #000 62%, transparent 100%);
    mask-composite: intersect;
}
.hero-visual img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }

/* illustrazione astratta usata quando non è stata caricata un'immagine */
.hero-visual.is-art {
    background:
        radial-gradient(60% 55% at 70% 30%, #ffffff 0%, rgb(255 255 255 / 0) 70%),
        radial-gradient(70% 60% at 85% 85%, #a9c3e9 0%, rgb(169 195 233 / 0) 70%),
        linear-gradient(160deg, #dfe8f4 0%, #c9d8ec 45%, #9fb6d6 100%);
}
.hero-art { position: absolute; inset: 0; perspective: 1400px; }
.hero-screen {
    position: absolute; right: 9%; top: 19%; width: 58%; aspect-ratio: 16 / 10.5;
    border: 12px solid #0d1526; border-radius: 22px; background: #0d1526;
    transform: rotateY(-22deg) rotateX(8deg) rotateZ(2deg); transform-origin: right center;
    box-shadow: -30px 50px 80px -30px rgb(10 18 34 / .55);
    overflow: hidden;
}
.hero-screen-bar { display: flex; gap: 6px; padding: 10px 12px; background: #f6f9fd; }
.hero-screen-bar span { width: 8px; height: 8px; border-radius: 50%; background: #cfd8e4; }
.hero-screen-body {
    position: relative; height: 100%; padding: 12% 10%;
    background:
        radial-gradient(90% 70% at 100% 100%, #1f6bf2 0%, rgb(31 107 242 / 0) 60%),
        linear-gradient(135deg, #f6f9fd 0%, #e3ecf8 55%, #9bb9e8 100%);
}
.hero-screen-body::after {
    content: ""; position: absolute; right: -18%; bottom: -55%; width: 95%; aspect-ratio: 1;
    border-radius: 50%; border: 2px solid rgb(255 255 255 / .7);
    box-shadow: inset 0 0 60px rgb(255 255 255 / .35);
}
.hero-screen .line { display: block; height: 14px; border-radius: 6px; background: #0d1526; margin-bottom: 12px; opacity: .88; }
.hero-screen .w60 { width: 60%; }
.hero-screen .w40 { width: 42%; }
.hero-screen .w75 { width: 70%; height: 10px; opacity: .25; margin-top: 18px; }
.hero-screen .chip-fake { display: block; width: 72px; height: 22px; border-radius: 999px; background: #fff; margin-top: 18px; box-shadow: var(--shadow); }
.hero-orb {
    position: absolute; right: -6%; bottom: 6%; width: 46%; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffffff 0%, #c5d6ef 35%, #7f9dcc 100%);
    opacity: .55;
}

/* ---------- Box in evidenza ---------- */
.features-wrap { position: relative; z-index: 3; margin-top: -84px; }
.features {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    padding: 14px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.feature { display: flex; align-items: flex-start; gap: 16px; padding: 18px; border-radius: var(--radius); color: inherit; }
a.feature:hover { background: var(--bg); color: inherit; }
.feature-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 12px; background: var(--blue-50); color: var(--blue); }
.feature-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feature-copy strong { font-size: .95rem; font-weight: 600; color: var(--ink); }
.feature-copy span { font-size: .85rem; line-height: 1.5; color: var(--muted); }

/* ==========================================================================
   Sezioni
   ========================================================================== */
.section { padding-top: 80px; }
.section-tight { padding-top: 32px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.section-title { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.75rem, 3vw, 2.3rem); letter-spacing: -.025em; margin: 0 0 8px; }
.section-text { color: var(--muted); font-size: 1.02rem; margin: 0; }
.section-head .btn { flex: none; }

/* ---------- Card articoli ---------- */
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 24px; }
.post-card { position: relative; display: flex; flex-direction: column; }
.post-card-media { display: block; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.post-card .media { aspect-ratio: 2.15 / 1; }
.media { position: relative; overflow: hidden; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.post-card:hover .media img, .project-card:hover .media img { transform: scale(1.04); }
.pill {
    display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px;
    background: rgb(255 255 255 / .94); color: var(--blue);
    font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; line-height: 1.2;
    box-shadow: 0 2px 8px rgb(10 18 34 / .12);
}
.post-card > .pill { position: absolute; top: 14px; left: 14px; z-index: 2; }
.pill:hover { color: var(--blue-hover); background: #fff; }
.pill-static { background: var(--blue-50); box-shadow: none; }
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 18px 12px 0; }
.date { display: block; margin-bottom: 6px; font-size: .78rem; color: var(--muted); }
.post-card h3 { font-size: 1.16rem; line-height: 1.3; margin: 0 0 10px; letter-spacing: -.012em; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--blue); }
.post-card p { margin: 0 0 16px; font-size: .9rem; line-height: 1.55; color: var(--muted); }
.arrow-link { margin-top: auto; display: inline-flex; width: 36px; height: 36px; margin-left: -8px; align-items: center; justify-content: center; border-radius: 50%; color: var(--ink); transition: color .15s, transform .2s; }
.arrow-link:hover, .post-card:hover .arrow-link { color: var(--blue); transform: translateX(3px); }

/* ---------- Progetti ---------- */
.projects-panel { padding: 36px 26px 30px; background: var(--bg-2); border-radius: var(--radius-xl); }
.projects-panel .section-head { padding: 0 6px; }
.project-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.project-grid-lg { grid-template-columns: repeat(3, 1fr); gap: 28px 24px; }
.project-card a { display: block; color: inherit; }
.project-card .media { aspect-ratio: 1.8 / 1; border-radius: 12px; background: var(--navy); }
.project-grid-lg .project-card .media { aspect-ratio: 16 / 10; }
.project-card-body { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 6px 0; }
.project-card h3 { font-size: 1rem; margin: 0 0 2px; letter-spacing: -.005em; }
.project-card p { margin: 0; font-size: .84rem; color: var(--muted); }
.project-icon { color: var(--ink); margin-top: 2px; transition: color .15s, transform .2s; }
.project-card a:hover h3, .project-card a:hover .project-icon { color: var(--blue); }
.project-card a:hover .project-icon { transform: translate(2px, -2px); }

/* segnaposto astratti per contenuti senza foto */
.ph { background: var(--navy); }
.ph::before, .ph::after { content: ""; position: absolute; }
.ph-0 { background: linear-gradient(140deg, #0b1324 0%, #13254a 55%, #1f6bf2 140%); }
.ph-0::before { right: -20%; top: -60%; width: 80%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 30% 70%, #3f86ff 0%, #1f6bf2 30%, rgb(31 107 242 / 0) 70%); }
.ph-0::after { left: 8%; bottom: 18%; width: 38%; height: 8%; border-radius: 6px; background: rgb(255 255 255 / .14); box-shadow: 0 -18px 0 -2px rgb(255 255 255 / .08); }
.ph-1 { background: linear-gradient(160deg, #e9eff8 0%, #cbd9ee 100%); }
.ph-1::before { right: 12%; top: 14%; width: 30%; height: 80%; border-radius: 14px; background: #0d1526; transform: rotate(-14deg); box-shadow: 18px 24px 40px -12px rgb(10 18 34 / .5); }
.ph-1::after { right: 22%; top: 44%; width: 9%; aspect-ratio: 1; border-radius: 50%; background: var(--blue); transform: rotate(-14deg); }
.ph-2 { background: radial-gradient(120% 90% at 0% 100%, #2b6df0 0%, rgb(43 109 240 / 0) 55%), linear-gradient(135deg, #07101f 0%, #0d1f45 100%); }
.ph-2::before { left: 30%; top: -40%; width: 110%; aspect-ratio: 1; border-radius: 50%; border: 1px solid rgb(255 255 255 / .35); }
.ph-2::after { left: 45%; top: -20%; width: 90%; aspect-ratio: 1; border-radius: 50%; border: 1px solid rgb(255 255 255 / .18); }
.ph-3 { background: linear-gradient(135deg, #10203f 0%, #1d4fc4 60%, #8fb3f5 100%); }
.ph-3::before { left: -10%; bottom: -70%; width: 120%; aspect-ratio: 1; border-radius: 45%; background: linear-gradient(180deg, rgb(255 255 255 / .22), rgb(255 255 255 / 0)); transform: rotate(-18deg); }
.ph-3::after { right: 12%; top: 18%; width: 18%; height: 10%; border-radius: 999px; background: rgb(255 255 255 / .85); }

/* ---------- Newsletter ---------- */
.newsletter {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 32px;
    padding: 40px 36px; border-radius: var(--radius-xl); color: #c8d3e4;
    background:
        radial-gradient(60% 140% at 72% 120%, rgb(31 107 242 / .55) 0%, rgb(31 107 242 / 0) 60%),
        radial-gradient(40% 90% at 60% -20%, rgb(120 160 230 / .25) 0%, rgb(120 160 230 / 0) 70%),
        linear-gradient(120deg, #0b1324 0%, #13213d 55%, #0f1c35 100%);
}
.newsletter::before {
    content: ""; position: absolute; left: 38%; top: -120%; width: 70%; aspect-ratio: 1; border-radius: 50%;
    border: 1px solid rgb(255 255 255 / .1); box-shadow: 0 0 0 60px rgb(255 255 255 / .015);
    pointer-events: none;
}
.newsletter > * { position: relative; }
.newsletter .eyebrow { color: #8fa0bb; margin-bottom: 10px; }
.newsletter h2 { color: #fff; font-weight: 800; font-size: clamp(1.6rem, 2.6vw, 2.05rem); letter-spacing: -.025em; margin: 0 0 8px; }
.newsletter p { margin: 0; }
.newsletter-row { display: flex; gap: 10px; }
.newsletter-row input {
    flex: 1; margin: 0; padding: 14px 16px; color: #fff;
    background: rgb(255 255 255 / .05); border: 1px solid rgb(255 255 255 / .16); border-radius: 12px;
}
.newsletter-row input::placeholder { color: #8fa0bb; }
.newsletter-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgb(31 107 242 / .3); }
.newsletter-row .btn { padding: 14px 22px; border-radius: 12px; }
.newsletter-note { margin-top: 10px !important; font-size: .8rem; color: #8090ab; }
.newsletter-note a { color: #c8d3e4; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 48px; padding: 28px 0 32px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-inner .logo-text { font-size: 1.25rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 28px; }
.footer-nav a { color: var(--ink); font-size: .9rem; font-weight: 500; }
.footer-nav a:hover { color: var(--blue); }
.social { display: flex; flex-wrap: wrap; gap: 8px; }
.social a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink); font-size: .82rem; font-weight: 600; background: var(--surface); }
.social a:hover { border-color: var(--ink); color: var(--ink); }
.footer-bottom { display: flex; gap: 20px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted-2); }
.footer-bottom a { color: var(--muted); }

/* ==========================================================================
   Pagine interne
   ========================================================================== */
.page-hero { padding: 56px 0 8px; }
.page-hero h1 { font-weight: 800; font-size: clamp(2rem, 4.4vw, 3.1rem); letter-spacing: -.03em; line-height: 1.08; margin: 0 0 12px; }
.page-hero .lead { margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: .88rem; font-weight: 500; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }

.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 44px; }
.pagination a { min-width: 42px; padding: 9px 12px; text-align: center; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 500; }
.pagination a:hover { border-color: var(--ink); }
.pagination a.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Articolo / pagina / progetto ---------- */
.single { padding-top: 48px; }
.single-head, .single-body { max-width: 800px; }
.single-head .alert { margin-bottom: 24px; }
.single-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--muted); font-size: .88rem; }
.single-head h1 { font-weight: 800; font-size: clamp(2rem, 4.6vw, 3.2rem); line-height: 1.08; letter-spacing: -.032em; margin-bottom: 16px; }
.single-head .lead { font-size: 1.18rem; margin-bottom: 24px; }
.cover { max-width: 1132px; margin: 32px auto 44px; }
.cover img { display: block; width: 100%; max-height: 560px; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.single-head + .single-body { margin-top: 28px; }

.content { font-size: 1.08rem; line-height: 1.8; color: var(--text); }
.content > :first-child { margin-top: 0; }
.content h2 { font-size: 1.6rem; margin-top: 1.8em; }
.content h3 { font-size: 1.25rem; margin-top: 1.6em; }
.content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--blue-200); }
.content a:hover { text-decoration-color: currentColor; }
.content img { border-radius: var(--radius); margin: 8px 0; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin-bottom: .35em; }
.content blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--blue); color: var(--ink); font-size: 1.15rem; font-family: var(--font-display); font-weight: 500; }

/* Campi personalizzati sotto il contenuto */
.content-fields { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 24px; margin: 36px 0 8px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.content-fields dt { font-weight: 600; color: var(--muted); font-size: .92rem; }
.content-fields dd { margin: 0; color: var(--ink); }
.content-fields img { max-width: 320px; border-radius: var(--radius-sm); }
@media (max-width: 560px) { .content-fields { grid-template-columns: 1fr; gap: 2px; } .content-fields dd { margin-bottom: 10px; } }
.content pre, .content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.content code { background: var(--bg-2); padding: 2px 6px; border-radius: 6px; }
.content pre { background: var(--navy); color: #e2e8f0; padding: 18px 22px; border-radius: var(--radius); overflow-x: auto; }
.content pre code { background: none; padding: 0; }
.back { margin-top: 48px; font-weight: 600; }

.gallery { margin-top: 48px; padding-top: 36px; border-top: 1px solid var(--line); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.gallery-grid a { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: var(--bg-2); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s; }
.gallery-grid a:hover img { transform: scale(1.05); }
dialog#lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; overflow: visible; }
dialog#lightbox::backdrop { background: rgb(10 18 34 / .85); backdrop-filter: blur(4px); }
dialog#lightbox img { display: block; max-width: 94vw; max-height: 90vh; border-radius: 14px; cursor: zoom-out; }

/* ---------- Commenti ---------- */
.comments { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--line); }
.comment { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.comment-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); font-weight: 700; }
.comment-main { min-width: 0; flex: 1; }
.comment-meta { margin: 0 0 4px; font-size: .92rem; color: var(--ink); }
.comment-meta .muted { margin-left: 6px; font-size: .84rem; }
.comment-text { margin: 0; overflow-wrap: anywhere; }
.comment-form { margin-top: 28px; }
.comment-form h3 { margin-bottom: 14px; }
.comment-login { margin-top: 24px; padding: 18px 22px; background: var(--bg-2); border-radius: var(--radius); }

/* ---------- Ricerca ---------- */
.search-big { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; margin-bottom: 32px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--muted); box-shadow: var(--shadow-sm); }
.search-big:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-100); }
.search-big input { margin: 0; border: 0; padding: 10px 0; font-size: 1.05rem; box-shadow: none !important; background: transparent; }
.result-list { display: grid; gap: 12px; }
.result { display: flex; align-items: center; gap: 18px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; transition: border-color .15s, box-shadow .15s; }
.result:hover { border-color: var(--blue-200); box-shadow: var(--shadow); color: inherit; }
.result-media { flex: none; width: 132px; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; }
.result-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.result-meta { font-size: .8rem; color: var(--muted); }
.result strong { color: var(--ink); font-family: var(--font-display); font-size: 1.08rem; }
.result-text { font-size: .9rem; color: var(--muted); }

/* ---------- Download ---------- */
.file-list { display: grid; gap: 12px; }
.file-row { display: flex; align-items: center; gap: 18px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color .15s, box-shadow .15s; }
.file-row:hover { border-color: var(--blue-200); box-shadow: var(--shadow); }
.file-icon { flex: none; width: 52px; height: 52px; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); border-radius: 12px; font-size: .72rem; font-weight: 800; letter-spacing: .04em; }
.file-info { flex: 1; min-width: 0; }
.file-info h3 { margin: 0 0 2px; font-size: 1.05rem; }
.file-info .excerpt { margin: 0 0 4px; color: var(--muted); font-size: .92rem; }
.file-info .meta { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; font-size: .82rem; color: var(--muted); }
.file-action { flex: none; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--blue-50); color: var(--blue); font-family: var(--font); font-size: .74rem; font-weight: 600; letter-spacing: 0; }
.tag-lock { background: var(--bg-2); color: var(--muted); margin-left: 8px; vertical-align: middle; }

/* ---------- Pannelli generici, account, disiscrizione ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.panel-title { font-size: 1.1rem; margin-bottom: 16px; }
.account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; align-items: start; }
.narrow { max-width: 560px; margin: 0 auto; padding: 64px 24px 0; }
.center-panel h1 { font-size: 1.8rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1080px) {
    .features { grid-template-columns: repeat(2, 1fr); }
    .project-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-visual { width: 62vw; }
}

@media (max-width: 900px) {
    :root { --header-h: 64px; }
    .header-inner { gap: 12px; }
    .nav-toggle { display: inline-grid; }
    .main-nav {
        position: fixed; left: 0; right: 0; top: var(--header-h); bottom: 0; z-index: 39;
        display: none; flex-direction: column; align-items: stretch; gap: 0; margin: 0;
        padding: 12px 24px 32px; background: var(--surface); overflow-y: auto;
    }
    .nav-open { overflow: hidden; }
    .nav-open .main-nav { display: flex; }
    .nav-open .site-header, .is-home.nav-open .site-header:not(.is-scrolled) { background: var(--surface); }
    .main-nav > a, .nav-mobile-user a { padding: 14px 4px; font-size: 1.1rem; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); }
    .nav-mobile-user { display: flex; flex-direction: column; margin-top: 12px; }
    .nav-mobile-user a { font-size: .98rem; color: var(--muted); }
    .header-actions { margin-left: auto; }
    .user-name, .hide-sm { display: none; }

    .hero { display: flex; flex-direction: column; padding-top: var(--header-h); padding-bottom: 76px; }
    .hero-visual {
        position: relative; inset: auto; width: auto; height: 280px; margin: 0 0 4px;
        -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%); mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
    }
    .hero-screen { right: 14%; top: 12%; width: 68%; }
    .features-wrap { margin-top: -44px; }
    .post-grid, .project-grid-lg { grid-template-columns: repeat(2, 1fr); }
    .newsletter { grid-template-columns: 1fr; padding: 32px 24px; }
    .section { padding-top: 64px; }
}

@media (max-width: 640px) {
    .container { padding-left: 16px; padding-right: 16px; }
    .hero h1 { font-size: 2.55rem; }
    .stats { gap: 16px 28px; }
    .features { grid-template-columns: 1fr; padding: 8px; }
    .feature { padding: 14px; }
    .post-grid, .project-grid, .project-grid-lg { grid-template-columns: 1fr; }
    .section-head { flex-direction: column; align-items: flex-start; }
    .projects-panel { padding: 26px 14px 20px; border-radius: var(--radius-lg); }
    .newsletter-row { flex-direction: column; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .row, .row-2, .account-grid { grid-template-columns: 1fr; }
    .file-row { flex-wrap: wrap; }
    .file-action, .file-action .btn { width: 100%; }
    .result-media { width: 96px; }
    .admin-bar-inner { gap: 10px 16px; padding-top: 10px; padding-bottom: 10px; }
    .admin .nav { order: 3; flex-basis: 100%; }
    .nav-user { margin-left: auto; }
    .wys-bar { top: 0; }
    .comment-date { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
.footer-bottom .powered { margin-left: auto; }

/* ==========================================================================
   Stili per i plugin (il tema dichiara add_theme_support('plugin-styles', …))
   ========================================================================== */

/* Modulo contatti */
.contact-form { max-width: 780px; }
.contact-subjects { border: 0; padding: 0; margin: 0 0 18px; }
.contact-subjects legend { padding: 0; margin-bottom: 10px; font-weight: 600; font-size: .93rem; color: var(--ink); }
.contact-chip { display: inline-flex !important; margin: 0 8px 8px 0 !important; cursor: pointer; }
.contact-chip input { position: absolute; opacity: 0; pointer-events: none; }
.contact-chip span { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: .9rem; font-weight: 500; transition: all .15s; }
.contact-chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.contact-chip input:focus-visible + span { outline: 3px solid var(--blue-200); outline-offset: 2px; }
.contact-form .consent { align-items: flex-start; font-weight: 400; font-size: .9rem; color: var(--muted); }
.contact-form .consent input { margin-top: 2px; }
.contact-form .alert div + div { margin-top: 4px; }

/* Scheda progetto */
.project-details { margin-top: 44px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.project-facts { display: flex; flex-wrap: wrap; gap: 18px 44px; }
.fact { display: flex; flex-direction: column; gap: 6px; }
.fact-label { font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.fact strong { font-family: var(--font-display); font-size: 1.15rem; color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--bg-2); color: var(--ink); font-size: .85rem; font-weight: 600; width: fit-content; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.status-pubblicato::before { background: #18a058; }
.status-sviluppo::before, .status-beta::before { background: var(--blue); }
.status-idea::before { background: #e0a106; }
.tech-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-list a { padding: 4px 12px; border-radius: 999px; background: var(--blue-50); color: var(--blue); font-size: .85rem; font-weight: 600; }
.tech-list a:hover { background: var(--blue-100); }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.changelog { margin-top: 26px; }
.changelog h2 { font-size: 1.2rem; margin-bottom: 8px; }
.changelog ol { list-style: none; margin: 0; padding: 0; }
.changelog li { position: relative; padding: 12px 0 12px 22px; border-left: 2px solid var(--line); margin-left: 5px; }
.changelog li::before { content: ""; position: absolute; left: -7px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--blue); }
.changelog li:first-child::before { background: var(--blue); }
.cl-version { font-family: var(--font-display); font-weight: 700; color: var(--ink); margin-right: 10px; }
.cl-date { font-size: .82rem; color: var(--muted); }
.changelog p { margin: 4px 0 0; color: var(--text); font-size: .95rem; }
.tech-mini { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tech-mini span { padding: 2px 8px; border-radius: 999px; background: rgb(10 18 34 / .06); color: var(--muted); font-size: .7rem; font-weight: 600; }
.chip-count { margin-left: 4px; font-size: .75rem; opacity: .6; }
