/* ════════════════════════════════════════════════
   techalps — stile blog: indice + pagina articolo
   Estende il sistema visivo (variante dark), allineato a landing.css
   ════════════════════════════════════════════════ */

:root {
  --ink: #1A1D1F;
  --graphite: #2E3236;
  --stone: #8A8F94;
  --stone-light: #D9D9D6;
  --paper: #F4F2EE;
  --white: #FFFFFF;

  --glacier: #3B6E8F;
  --fir: #2C4A3E;
  --signal: #C84A2E;

  --bg: var(--ink);
  --fg: var(--paper);
  --fg-soft: #B7BBBE;
  --hairline: rgba(244, 242, 238, 0.12);
  --surface: #202427;
  --surface-2: #262b2e;
  --surface-line: rgba(244, 242, 238, 0.14);
  --accent: var(--glacier);
  --accent-bright: #6FA0BE;

  --tracking-wm: -0.04em;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--fg);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--fg); color: var(--bg); }

.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;
}

/* rete di punti di sfondo */
#net {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.page, .site-footer, .site-header { position: relative; z-index: 1; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 32px; }
@media (min-width: 768px) { .wrap { padding: 0 48px; } }
.wrap--article { max-width: 760px; }

/* ─── EYEBROW ─── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.1em;
  color: var(--stone); text-transform: uppercase; font-weight: 500;
}
.eyebrow::before {
  content: ""; width: 6px; height: 6px; background: var(--accent-bright); flex-shrink: 0;
}

/* ─── HEADER (identico alle landing) ─── */
.site-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 32px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500;
}
@media (min-width: 768px) { .site-header { padding: 28px 48px; } }
.site-header .brand {
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 22px;
  letter-spacing: var(--tracking-wm); text-transform: none;
  display: inline-flex; align-items: baseline;
}
.site-header .brand .dot {
  width: 0.15em; height: 0.15em; background: currentColor;
  display: inline-block; margin-left: 0.08em; align-self: flex-end; margin-bottom: 0.45em;
}
.site-header nav { display: none; gap: 22px; align-items: center; }
.site-header nav a { color: var(--stone); transition: color 0.2s ease; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--fg); }
.lang { display: flex; align-items: center; gap: 6px; padding-left: 18px; border-left: 1px solid var(--surface-line); }
.lang a { color: var(--stone); }
.lang a[aria-current="true"] { color: var(--fg); }
.lang a:hover { color: var(--accent-bright); }
.lang .sep { color: var(--surface-line); }

/* ─── MENU MOBILE (hamburger CSS-only) ─── */
.nav-toggle { position: absolute; opacity: 0; width: 0; height: 0; }
.nav-burger {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; cursor: pointer; color: var(--fg);
  font-size: 26px; line-height: 1; -webkit-tap-highlight-color: transparent;
}
.nav-burger .icon-open::before { content: "\2630"; }
.nav-burger .icon-close { display: none; }
.nav-burger .icon-close::before { content: "\2715"; }
@media (max-width: 767px) {
  .site-header { position: relative; flex-wrap: wrap; }
  .site-header nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-top: 1px solid var(--surface-line);
    border-bottom: 1px solid var(--surface-line);
    padding: 4px 32px 16px; z-index: 30; box-shadow: 0 16px 32px rgba(0,0,0,0.45);
  }
  .site-header nav a { padding: 12px 0; width: 100%; font-size: 14px; }
  .site-header { z-index: 40; }   /* header e menu sopra il contenuto .page */
  .site-header .lang { padding: 12px 0 0; margin-top: 6px; border-left: none; border-top: 1px solid var(--surface-line); width: 100%; }
  .nav-toggle:checked ~ nav { display: flex; }
  .nav-toggle:checked ~ .nav-burger .icon-open { display: none; }
  .nav-toggle:checked ~ .nav-burger .icon-close { display: block; }
}
@media (min-width: 768px) {
  .site-header nav { display: flex; }
  .nav-burger { display: none; }
}

/* ─── BREADCRUMB ─── */
.breadcrumb {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--stone); padding: 8px 0 0;
}
.breadcrumb a:hover { color: var(--accent-bright); }
.breadcrumb .sep { opacity: 0.5; margin: 0 8px; }

/* ════════════ INDICE BLOG ════════════ */
.blog-hero { padding: 56px 0 24px; }
@media (min-width: 768px) { .blog-hero { padding: 72px 0 32px; } }
.blog-hero h1 {
  font-family: 'Inter', sans-serif; font-weight: 600;
  font-size: clamp(34px, 6vw, 56px); letter-spacing: -0.03em; line-height: 1.05;
  margin: 18px 0 0;
}
.blog-hero .sub {
  font-size: clamp(16px, 2.4vw, 19px); color: var(--fg-soft);
  max-width: 56ch; margin: 18px 0 0; font-weight: 400;
}

.posts {
  display: grid; grid-template-columns: 1fr; gap: 1px;
  background: var(--surface-line); border: 1px solid var(--surface-line);
  border-radius: 6px; overflow: hidden;
  margin: 48px 0 96px;
}
@media (min-width: 680px) { .posts { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .posts { grid-template-columns: repeat(3, 1fr); } }

.post-card {
  background: var(--surface); padding: 30px 26px;
  display: flex; flex-direction: column; gap: 12px;
  transition: background 0.25s ease;
}
.post-card:hover { background: var(--surface-2); }
.post-card .meta {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone);
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.post-card .meta .cat { color: var(--accent-bright); }
.post-card h2 {
  font-family: 'Inter', sans-serif; font-size: 20px; font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.25; margin: 0;
}
.post-card:hover h2 { color: var(--accent-bright); }
.post-card p { color: var(--fg-soft); font-size: 14.5px; margin: 0; }
.post-card .more {
  margin-top: auto; padding-top: 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-bright);
}

.blog-empty {
  margin: 48px 0 96px; padding: 48px 26px; text-align: center;
  border: 1px dashed var(--surface-line); border-radius: 6px;
  color: var(--stone);
}

/* ════════════ ARTICOLO ════════════ */
.article-head { padding: 48px 0 8px; }
@media (min-width: 768px) { .article-head { padding: 64px 0 8px; } }
.article-head .meta {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 20px;
}
.article-head .meta .cat { color: var(--accent-bright); }
.article-head h1 {
  font-family: 'Inter', sans-serif; font-weight: 600;
  font-size: clamp(30px, 5.2vw, 50px); letter-spacing: -0.03em; line-height: 1.08;
  margin: 16px 0 0;
}
.article-head .lead {
  font-size: clamp(17px, 2.4vw, 21px); color: var(--fg-soft);
  margin: 22px 0 0; font-weight: 400; line-height: 1.5;
}

/* immagine principale articolo */
.article-cover { margin: 40px 0 0; }
.article-cover figure { margin: 0; }
.article-cover img {
  width: 100%; height: auto; display: block;
  border-radius: 8px; border: 1px solid var(--surface-line);
  aspect-ratio: 16 / 9; object-fit: cover;
}
.article-cover figcaption {
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.04em; color: var(--stone); text-align: right;
}
.article-cover figcaption a { color: var(--stone); text-decoration: underline; text-underline-offset: 2px; }
.article-cover figcaption a:hover { color: var(--accent-bright); }

/* miniatura nella card dell'indice */
.post-card .thumb {
  margin: -30px -26px 4px; /* bleed fino ai bordi della card */
  aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2);
}
.post-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.9; transition: opacity 0.25s ease, transform 0.4s ease; }
.post-card:hover .thumb img { opacity: 1; transform: scale(1.03); }

.article-body {
  padding: 40px 0 8px;
  font-size: 17px; line-height: 1.75; color: var(--fg-soft);
}
.article-body > *:first-child { margin-top: 0; }
.article-body h2 {
  font-family: 'Inter', sans-serif; color: var(--fg); font-weight: 600;
  font-size: clamp(22px, 3.4vw, 30px); letter-spacing: -0.02em; line-height: 1.2;
  margin: 48px 0 16px;
}
.article-body h3 {
  font-family: 'Inter', sans-serif; color: var(--fg); font-weight: 600;
  font-size: 20px; letter-spacing: -0.01em; margin: 32px 0 12px;
}
.article-body p { margin: 0 0 20px; }
.article-body a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { opacity: 0.8; }
.article-body strong { color: var(--fg); font-weight: 600; }
.article-body ul, .article-body ol { margin: 0 0 20px; padding-left: 22px; }
.article-body li { margin: 0 0 10px; }
.article-body blockquote {
  margin: 28px 0; padding: 4px 0 4px 22px;
  border-left: 3px solid var(--accent); color: var(--fg);
  font-size: 19px; font-style: italic;
}
.article-body code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.9em;
  background: var(--surface); padding: 2px 6px; border-radius: 3px; color: var(--fg);
}
.article-body figure { margin: 28px 0; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; display: block; }

/* box fonti */
.sources {
  margin: 48px 0 0; padding: 28px 26px;
  background: var(--surface); border: 1px solid var(--surface-line); border-radius: 6px;
}
.sources h2 {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--stone);
  margin: 0 0 16px;
}
.sources ol { margin: 0; padding-left: 20px; }
.sources li { margin: 0 0 10px; font-size: 14px; }
.sources a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }

/* nota trasparenza AI */
.ai-note {
  margin: 32px 0 0; padding-top: 20px; border-top: 1px solid var(--hairline);
  font-size: 12.5px; color: var(--stone); line-height: 1.6;
}

/* CTA fine articolo */
.article-cta {
  margin: 56px 0 0; padding: 40px 26px; text-align: center;
  background: var(--surface); border: 1px solid var(--surface-line); border-radius: 6px;
}
.article-cta h2 {
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: clamp(22px, 3.5vw, 30px);
  letter-spacing: -0.02em; margin: 0 auto; max-width: 24ch;
}
.article-cta p { color: var(--fg-soft); margin: 14px auto 0; max-width: 48ch; }
.article-cta .btn { margin-top: 24px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 14px 22px; border-radius: 2px; transition: all 0.2s ease;
}
.btn--primary { background: var(--accent); color: var(--paper); border: 1px solid var(--accent); }
.btn--primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn--ghost { color: var(--fg); border: 1px solid var(--surface-line); }
.btn--ghost:hover { border-color: var(--accent-bright); color: var(--accent-bright); }

/* navigazione tra articoli / torna al blog */
.article-foot-nav {
  margin: 56px 0 0; padding-top: 24px; border-top: 1px solid var(--hairline);
  display: flex; justify-content: center;
}

/* spazio prima del footer */
article { padding-bottom: 96px; }
@media (min-width: 768px) { article { padding-bottom: 120px; } }

/* ─── FOOTER (identico alle altre pagine) ─── */
.site-footer { background: var(--bg); border-top: 1px solid var(--hairline); padding: 28px 0;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.site-footer .footer-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--accent-bright); }
.site-footer .legal { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline);
  font-family: 'Inter', sans-serif; font-size: 11px; letter-spacing: 0; text-transform: none; line-height: 1.6; color: var(--stone); text-align: center; }
.site-footer .legal strong { color: var(--fg-soft); font-weight: 600; }
.site-footer .legal-links { margin-top: 12px; text-align: center; font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--stone); }
.site-footer .legal-links a { color: var(--stone); }
.site-footer .legal-links a:hover { color: var(--accent-bright); }

.site-footer .funding { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--hairline); display: flex; justify-content: center; }
.site-footer .funding img { height: 96px; width: auto; max-width: 100%; display: block; }

/* ─── REVEAL ─── */
.fade { opacity: 0; transform: translateY(16px); transition: opacity 0.7s ease, transform 0.7s ease; }
.fade.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade { opacity: 1; transform: none; transition: none; }
}
