/* Synapse — tema EngiMedia AI Blog (palette e font EngiMedia) */

@font-face { font-family: "Ubuntu"; font-weight: 500; font-display: swap; src: url("../fonts/ubuntu-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Ubuntu"; font-weight: 700; font-display: swap; src: url("../fonts/ubuntu-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 400; font-display: swap; src: url("../fonts/open-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 400; font-style: italic; font-display: swap; src: url("../fonts/open-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 600; font-display: swap; src: url("../fonts/open-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

:root {
    --bg: #07090f;
    --bg-2: #0d111b;
    --panel: rgba(28, 34, 44, .72);
    --line: rgba(140, 170, 255, .14);
    --text: #e7ecf5;
    --muted: #8d97ab;
    --cyan: #2ea3f2;
    --violet: #326bff;
    --magenta: #e09900;
    --grad: linear-gradient(110deg, var(--cyan), var(--violet) 55%, var(--magenta));
    --radius: 18px;
    --font-head: var(--gh-font-heading, "Ubuntu"), "Ubuntu", system-ui, sans-serif;
    --font-body: var(--gh-font-body, "Open Sans"), "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --ghost-accent-color: var(--violet);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.7 var(--font-body);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
::selection { background: var(--violet); color: #fff; }

/* sfondo: griglia + aloni */
.sy-bg {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(60vw 50vh at 85% -10%, rgba(50, 107, 255, .22), transparent 70%),
        radial-gradient(50vw 40vh at -10% 30%, rgba(46, 163, 242, .13), transparent 70%),
        linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 56px 56px,
        linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 56px 56px,
        var(--bg);
    -webkit-mask-image: linear-gradient(#000 0%, rgba(0,0,0,.55) 60%, rgba(0,0,0,.35));
    mask-image: linear-gradient(#000 0%, rgba(0,0,0,.55) 60%, rgba(0,0,0,.35));
}

.sy-wrap { width: min(1180px, 100% - 48px); margin-inline: auto; }
.sy-wrap--text { width: min(720px, 100% - 48px); }
.sy-mono { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .02em; }
.sy-dim { color: var(--muted); }
.sy-main { flex: 1; }

/* progress */
.sy-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100;
    background: var(--grad); box-shadow: 0 0 12px var(--cyan);
}

/* header */
.sy-header {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    background: rgba(7, 9, 15, .66);
    border-bottom: 1px solid var(--line);
}
.sy-header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.sy-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; font: 700 1.1rem var(--font-head); letter-spacing: -.01em; }
.sy-logo img { max-height: 36px; width: auto; }
.sy-logo-mark { position: relative; width: 26px; height: 26px; }
.sy-logo-mark i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.sy-logo-mark i:nth-child(1) { left: 0; top: 9px; }
.sy-logo-mark i:nth-child(2) { right: 0; top: 0; background: var(--violet); box-shadow: 0 0 10px var(--violet); }
.sy-logo-mark i:nth-child(3) { right: 0; bottom: 0; background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }
.sy-logo-mark::before {
    content: ""; position: absolute; inset: 3px; border: 1px solid rgba(255,255,255,.25);
    clip-path: polygon(0 50%, 100% 0, 100% 100%); border-radius: 2px;
}
.sy-nav { margin-left: auto; }
.sy-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.sy-nav a {
    display: block; padding: 8px 14px; border-radius: 999px; text-decoration: none;
    color: var(--muted); font-weight: 600; font-size: .92rem; transition: color .2s, background .2s;
}
.sy-nav a:hover, .sy-nav .nav-current a { color: var(--text); background: rgba(50, 107, 255, .14); }
.sy-burger { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; }
.sy-burger span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: transform .25s; }

/* hero */
.sy-hero { position: relative; overflow: hidden; padding: 110px 0 90px; border-bottom: 1px solid var(--line); }
.sy-neural { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .85; }
.sy-hero-inner { position: relative; }
.sy-kicker { display: inline-flex; align-items: center; gap: 4px; color: var(--cyan); margin-bottom: 22px; }
.sy-caret { display: inline-block; width: 8px; height: 1em; background: var(--cyan); animation: sy-blink 1.1s steps(1) infinite; }
@keyframes sy-blink { 50% { opacity: 0; } }
.sy-hero-title {
    font: 700 clamp(2.3rem, 5.6vw, 4.6rem)/1.04 var(--font-head);
    letter-spacing: -.035em; margin: 0 0 22px; max-width: 16ch;
    background: linear-gradient(180deg, #fff 30%, #b9c3da);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sy-hero-sub { font-size: 1.18rem; color: var(--muted); max-width: 56ch; margin: 0; }
.sy-hero-stats { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 40px; color: var(--muted); }
.sy-hero-stats b { color: var(--text); font-weight: 500; }

/* sezioni */
.sy-feed { padding: 64px 0 96px; }
.sy-section-head { display: flex; align-items: center; gap: 18px; margin-bottom: 32px; }
.sy-section-head h2 { margin: 0; color: var(--muted); font-weight: 500; white-space: nowrap; }
.sy-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

/* griglia card */
.sy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.sy-grid--3 { grid-template-columns: repeat(3, 1fr); }
.sy-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; isolation: isolate;
    transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .35s, box-shadow .35s;
}
.sy-card::before {
    content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; padding: 1px;
    background: var(--grad); opacity: 0; transition: opacity .35s;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
}
.sy-card:hover { transform: translateY(-4px); box-shadow: 0 24px 60px -24px rgba(50, 107, 255, .55); }
.sy-card:hover::before { opacity: 1; }
.sy-card-link { position: absolute; inset: 0; z-index: 2; }
.sy-card-img { margin: 0; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); }
.sy-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.sy-card:hover .sy-card-img img { transform: scale(1.045); }
.sy-card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }
.sy-card-title { font: 700 1.3rem/1.22 var(--font-head); letter-spacing: -.015em; margin: 10px 0 10px; }
.sy-card-excerpt { color: var(--muted); font-size: .96rem; margin: 0 0 18px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sy-card .sy-meta { margin-top: auto; }

.sy-card--lead { grid-column: 1 / -1; flex-direction: row; }
.sy-card--lead .sy-card-img { flex: 1.35; aspect-ratio: auto; min-height: 380px; }
.sy-card--lead .sy-card-body { flex: 1; padding: 40px; justify-content: center; }
.sy-card--lead .sy-card-title { font-size: clamp(1.7rem, 2.6vw, 2.35rem); }
.sy-card--lead .sy-card-excerpt { -webkit-line-clamp: 4; font-size: 1.04rem; }

.sy-tag {
    display: inline-block; align-self: flex-start; position: relative; z-index: 3;
    color: var(--cyan); text-decoration: none; padding: 3px 10px; border-radius: 999px;
    background: rgba(46, 163, 242, .08); border: 1px solid rgba(46, 163, 242, .22);
}
a.sy-tag:hover { background: rgba(46, 163, 242, .16); }
.sy-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); }
.sy-meta a { text-decoration: none; color: var(--text); }

/* paginazione */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 48px; font-family: var(--font-mono); font-size: .85rem; color: var(--muted); }
.pagination a { color: var(--text); text-decoration: none; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px; }
.pagination a:hover { border-color: var(--violet); }

/* post */
.sy-post-head { padding: 72px 0 36px; }
.sy-post-title { font: 700 clamp(2.1rem, 4.6vw, 3.4rem)/1.08 var(--font-head); letter-spacing: -.03em; margin: 18px 0 18px; }
.sy-post-excerpt { font-size: 1.22rem; color: var(--muted); margin: 0 0 24px; }
.sy-post-img { margin-bottom: 56px; }
.sy-post-img img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: 0 40px 100px -40px rgba(50, 107, 255, .5); }
.sy-post-img figcaption { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 12px; }
.sy-post-tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 32px 0 0; margin-top: 48px; border-top: 1px solid var(--line); }
.sy-related { padding-top: 40px; }

/* contenuto */
.sy-content { font-size: 1.1rem; line-height: 1.8; color: #d6dceb; }
.sy-content > * + * { margin-top: 1.4em; }
.sy-content > :first-child { margin-top: 0; }
.sy-content p { margin-bottom: 0; }
.sy-content h2, .sy-content h3 { font-family: var(--font-head); color: var(--text); letter-spacing: -.02em; line-height: 1.2; }
.sy-content h2 { font-size: 1.75rem; margin-top: 2.2em; }
.sy-content h2::before { content: "## "; font-family: var(--font-mono); font-size: .7em; color: var(--violet); }
.sy-content h3 { font-size: 1.35rem; margin-top: 1.8em; }
.sy-content a { color: var(--cyan); text-decoration-color: rgba(46, 163, 242, .4); text-underline-offset: 3px; }
.sy-content a:hover { text-decoration-color: var(--cyan); }
.sy-content strong { color: var(--text); }
.sy-content ul, .sy-content ol { padding-left: 1.3em; }
.sy-content li + li { margin-top: .5em; }
.sy-content li::marker { color: var(--violet); }
.sy-content blockquote {
    margin-left: 0; padding: 18px 24px; border-left: 3px solid; border-image: var(--grad) 1;
    background: rgba(50, 107, 255, .07); font-size: 1.15rem; color: var(--text); font-style: italic;
}
.sy-content code { font-family: var(--font-mono); font-size: .86em; background: rgba(50, 107, 255, .14); padding: .15em .4em; border-radius: 6px; }
.sy-content pre { background: #0b0f19; border: 1px solid var(--line); border-radius: 12px; padding: 20px; overflow-x: auto; font-size: .9rem; }
.sy-content pre code { background: none; padding: 0; }
.sy-content hr { border: 0; height: 1px; background: var(--grad); opacity: .5; margin: 3em 0; }
.sy-content figure { margin-inline: 0; }
.sy-content figure img { border-radius: 12px; margin-inline: auto; }
.sy-content figcaption { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 10px; }

/* Koenig: larghezze card (richieste da Ghost) */
.kg-width-wide { position: relative; width: min(1040px, 100vw - 48px); left: 50%; transform: translateX(-50%); max-width: none; }
.kg-width-full { position: relative; width: 100vw; left: 50%; transform: translateX(-50%); max-width: none; }
.kg-width-full img { border-radius: 0 !important; }
.kg-image-card img { margin-inline: auto; }

/* archivio / errori / bottoni */
.sy-archive-head { padding: 80px 0 0; }
.sy-error { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.sy-error-code { font: 700 clamp(5rem, 18vw, 11rem)/1 var(--font-head); margin: 0 0 12px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sy-btn { display: inline-block; margin-top: 32px; padding: 12px 22px; border-radius: 999px; text-decoration: none; background: var(--grad); color: #fff; }

/* footer */
.sy-footer { border-top: 1px solid var(--line); padding: 40px 0; color: var(--muted); background: rgba(7, 9, 15, .6); }
.sy-footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.sy-footer p { margin: 8px 0 0; max-width: 46ch; font-size: .92rem; }
.sy-footer-nav { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.sy-footer-nav ul { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; }
.sy-footer-nav a { text-decoration: none; }
.sy-footer-nav a:hover { color: var(--text); }

/* reveal */
.sy-reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.sy-reveal.is-in { opacity: 1; transform: none; }

/* responsive */
@media (max-width: 1000px) {
    .sy-grid, .sy-grid--3 { grid-template-columns: repeat(2, 1fr); }
    .sy-card--lead { flex-direction: column; }
    .sy-card--lead .sy-card-img { min-height: 0; aspect-ratio: 16 / 9; }
    .sy-card--lead .sy-card-body { padding: 26px; }
}
@media (max-width: 720px) {
    body { font-size: 16px; }
    .sy-grid, .sy-grid--3 { grid-template-columns: 1fr; }
    .sy-hero { padding: 72px 0 60px; }
    .sy-burger { display: block; }
    .sy-nav { position: fixed; top: 68px; left: 0; right: 0; background: rgba(7, 9, 15, .96); border-bottom: 1px solid var(--line); padding: 12px 24px 20px; display: none; }
    .sy-nav ul { flex-direction: column; }
    body.sy-menu-open .sy-nav { display: block; }
    body.sy-menu-open .sy-burger span:first-child { transform: translateY(3.5px) rotate(45deg); }
    body.sy-menu-open .sy-burger span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
    .sy-footer-nav { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .sy-reveal { opacity: 1; transform: none; }
}
