/* ============================================================
   L'Arciere Celeste — tema "notte"
   Le variabili sono raggruppate su [data-theme] così la futura
   variante "giorno" sarà solo un blocco di override.
   ============================================================ */

:root {
  --container: 1200px;
  --radius: 12px;
  --radius-sm: 6px;
  --font-text: 'Source Sans 3', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
}

/* ---------- Palette NOTTE ---------- */
[data-theme="night"] {
  --black:       #000000;
  --deep-space:  #050d1a;
  --navy:        #0d1f3c;
  --blue-dark:   #1a3a6e;
  --blue-mid:    #2a6ab0;
  --blue-bright: #4ab4f5;
  --sky:         #7dd4fc;
  --white:       #f0f8ff;
  --grey-muted:  #8ab4cc;

  --bg:          var(--black);
  --panel:       rgba(5, 13, 26, 0.82);
  --panel-soft:  rgba(26, 58, 110, 0.12);
  --border:      rgba(74, 180, 245, 0.18);
  --border-soft: rgba(74, 180, 245, 0.30);
  --text:        #c9d8e4;
  --text-dim:    var(--grey-muted);
  --heading:     var(--white);
  --link:        var(--blue-bright);
  --link-hover:  var(--sky);
  --accent:      var(--blue-bright);
  --btn-fg:      #021019;
  /* Alone luminoso per il nome del sito: azzurro cielo, intenso sul fondo scuro */
  --name-glow:   rgba(125, 212, 252, 0.80);
  --name-glow-soft: rgba(74, 180, 245, 0.55);
  /* Rilievo 3D: luce in alto, ombra scura in basso -> testo staccato dal fondo scuro */
  --name-3d:
    0 -1px 0 rgba(255, 255, 255, 0.25),
    0 1px 0 rgba(0, 0, 0, 0.45),
    0 2px 2px rgba(0, 0, 0, 0.55);
}

/* ---------- Palette GIORNO ---------- */
[data-theme="day"] {
  --black:       #ffffff;
  --deep-space:  #e8eef4;
  --navy:        #d4e2ee;
  --blue-dark:   #1a3a6e;
  --blue-mid:    #2a6ab0;
  --blue-bright: #1c6fb0;
  --sky:         #14507f;
  --white:       #ffffff;
  --grey-muted:  #5a7184;

  --bg:          #faf9f7; /* bianco caldo: pagine interne */
  --panel:       rgba(255, 255, 255, 0.86);
  --panel-soft:  rgba(28, 111, 176, 0.07);
  --border:      rgba(28, 111, 176, 0.20);
  --border-soft: rgba(28, 111, 176, 0.38);
  --text:        #2b3d4d;
  --text-dim:    #5a7184;
  --heading:     #122c44;
  --link:        #1c6fb0;
  --link-hover:  #14507f;
  --accent:      #1c6fb0;
  --btn-fg:      #ffffff;
  /* Alone luminoso per il nome del sito: blu, leggibile sul chiaro */
  --name-glow:   rgba(28, 111, 176, 0.55);
  --name-glow-soft: rgba(74, 150, 220, 0.55);
  /* Rilievo 3D su fondo chiaro: luce bianca sotto, ombra morbida -> testo in rilievo */
  --name-3d:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 -1px 0 rgba(0, 0, 0, 0.18),
    0 2px 3px rgba(0, 0, 0, 0.22);
}

/* Tema giorno, solo home (con effetto matrix): grigio chiaro neutro
   così la pioggia si stacca meglio. Le altre pagine restano bianco caldo. */
[data-theme="day"] body.is-home { --bg: #f4f5f6; }

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--link); text-decoration: none; transition: color .18s ease; }
a:hover, a:focus { color: var(--link-hover); }

h1, h2, h3, h4 {
  color: var(--heading);
  line-height: 1.25;
  font-weight: 600;
}

img { max-width: 100%; height: auto; }

/* ============================================================
   Selettore tema (alto a sinistra, fisso)
   ============================================================ */
/* Voce del menu che ospita il toggle: nessun padding, allineata a sinistra di "Home" */
.menu-toggle-item { display: flex; align-items: center; padding-right: 14px; }
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, border-color .2s ease, background .2s ease, color .2s ease;
}
.theme-toggle:hover { transform: scale(1.1); border-color: var(--accent); color: var(--link-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle-icon { display: none; }
/* Notte → mostra il sole (clic per passare al giorno); Giorno → mostra la luna */
[data-theme="night"] .theme-icon-day  { display: inline; }
[data-theme="day"]   .theme-icon-night { display: inline; }

/* ============================================================
   Matrix canvas — solo home, sfondo fisso dietro a tutto
   ============================================================ */
#matrix-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}

/* Il contenuto della home sta sopra il canvas */
.is-home #topbanner,
.is-home .page-shell { position: relative; z-index: 1; }

/* ============================================================
   Banda firma (banner storico) — su tutte le pagine
   ============================================================ */
#topbanner {
  width: 100%;
  text-align: center;
}
.topbanner-img {
  width: 100%;
  max-width: 1200px; /* dimensione intrinseca del PNG */
  height: auto;
  margin: 0 auto;
}
/* Mostra la variante giusta in base al tema (default: notte) */
.topbanner-night { display: block; }
.topbanner-day   { display: none; }
[data-theme="day"] .topbanner-night { display: none; }
[data-theme="day"] .topbanner-day   { display: block; }

/* ============================================================
   Header (logo + social)
   ============================================================ */
#header .container {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 16px;
}
#logo h1 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
#logo h1 a {
  color: var(--sky);
  text-shadow:
    var(--name-3d),
    0 0 3px var(--name-glow),
    0 0 9px var(--name-glow-soft);
  transition: text-shadow 0.25s ease;
}
#logo h1 a:hover {
  text-shadow:
    var(--name-3d),
    0 0 4px var(--name-glow),
    0 0 13px var(--name-glow-soft);
}
#logo .subtitle {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
#social {
  display: flex;
  align-items: center;
  gap: 14px;
}
#social a {
  display: inline-flex;
  color: var(--blue-bright);
  line-height: 0;
  transition: color 0.15s, transform 0.15s;
}
#social a:hover { color: var(--sky); transform: translateY(-1px); }
#social .social-svg { width: 22px; height: 22px; }

/* ---- Lista contatti nella pagina Contatti (icona + nome) ---- */
.contact-social {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.contact-social a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--link);
  font-family: var(--font-mono);
  font-size: 15px;
}
.contact-social a:hover { color: var(--sky); }
.contact-social .social-svg { width: 24px; height: 24px; flex: 0 0 24px; }
.contact-social-name { line-height: 1; }

/* ---- Icona via mask (PNG grigio+alpha ricolorato col tema): AstroBin ---- */
.social-mask {
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}
.social-mask--astrobin {
  -webkit-mask-image: url("/images/social/astrobin.png");
          mask-image: url("/images/social/astrobin.png");
}
/* Il logo è più largo che alto (90×62): allarga mantenendo l'altezza pari alle altre icone */
#social .social-mask--astrobin { width: 32px; height: 22px; }
.contact-social .social-mask--astrobin { width: 35px; height: 24px; flex: 0 0 35px; }

/* ============================================================
   Menu principale
   ============================================================ */
#topmenu {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
/* Barra esterna: toggle tema · (burger) · voci · lingua — sempre in riga */
#topmenu > ul.container {
  list-style: none;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
/* Lista delle voci di navigazione (annidata) */
#topmenu .nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.menu-links-item { display: flex; }
#topmenu li a {
  display: block;
  padding: 11px 16px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}
/* Allinea il testo della prima voce ("Home") col logo dell'header */
#topmenu .nav-links li:first-child a { padding-left: 0; }
#topmenu .nav-links li a:hover { color: var(--sky); }
#topmenu .nav-links li.active a { color: var(--white); }

/* ---- Hamburger: nascosto su desktop, mostrato sotto i 700px ---- */
.menu-burger-item { display: none; }
.nav-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  padding: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.nav-burger-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-dim);
  border-radius: 2px;
  transition: transform .25s ease, opacity .25s ease;
}
.nav-burger:hover .nav-burger-bar { background: var(--sky); }
/* Stato aperto: trasforma in "X" */
.nav-burger[aria-expanded="true"] .nav-burger-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-burger[aria-expanded="true"] .nav-burger-bar:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] .nav-burger-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 700px) {
  .menu-burger-item { display: flex; align-items: center; padding-right: 14px; }
  /* Le voci diventano un pannello verticale a comparsa, chiuso di default */
  .menu-links-item { flex-basis: 100%; order: 10; }
  #topmenu .nav-links {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
  }
  #topmenu .nav-links.is-open { max-height: 60vh; }
  #topmenu .nav-links li a { padding: 12px 4px; }
  #topmenu .nav-links li:first-child a { padding-left: 4px; }
  /* Toggle tema · burger a sinistra, selettore lingua spinto a destra */
  .menu-lang-item { margin-left: auto; }
}

/* ============================================================
   Breadcrumb (percorso di navigazione, sotto il menu principale)
   ============================================================ */
#ribbon.breadcrumb {
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
#ribbon.breadcrumb ol {
  list-style: none;
  margin: 0 auto;
  padding: 7px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
}
#ribbon.breadcrumb li {
  display: inline-flex;
  align-items: center;
}
#ribbon.breadcrumb a {
  color: var(--text-dim);
  padding: 2px 4px;
}
#ribbon.breadcrumb a:hover { color: var(--sky); }
.breadcrumb-sep {
  color: var(--text-dim);
  opacity: 0.6;
  margin: 0 4px;
}
.breadcrumb-current {
  color: var(--heading);
  padding: 2px 4px;
}

/* ============================================================
   Layout contenuto
   ============================================================ */
#layout {
  display: block;
  padding-top: 24px;
  padding-bottom: 48px;
}
#content { min-width: 0; }

/* ---------- pannello generico arrotondato ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
}

/* ============================================================
   Intestazione di pagina
   ============================================================ */
.page-header {
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 30px; margin: 0; }
.section-intro { color: var(--text-dim); margin-bottom: 24px; }

/* ============================================================
   Card (liste e home) — riquadri arrotondati
   ============================================================ */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  padding: 22px 24px;
  margin-bottom: 22px;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.card:hover {
  border-color: var(--border-soft);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.card-title { font-size: 21px; margin: 0 0 8px; }
.card-title a { color: var(--sky); }
.card-title a:hover { color: var(--white); }
.card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.card-meta .hits { margin-left: 14px; }
.card-thumb { float: left; margin: 4px 18px 8px 0; }
.card-thumb img { width: 140px; height: auto; border-radius: var(--radius-sm); }
.card-body::after { content: ""; display: block; clear: both; }
.card-body p { margin: 0; }
.readmore { margin: 14px 0 0; }
.readmore a { color: var(--blue-bright); font-size: 14px; font-weight: 600; }
.readmore a:hover { color: var(--sky); }

/* ---------- Galleria: griglia delle categorie ---------- */
.gallery-cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.gallery-cat {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.gallery-cat:hover {
  border-color: var(--border-soft);
  transform: translateY(-3px);
}
.gallery-cat-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.gallery-cat-info {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gallery-cat-title {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--sky);
}
.gallery-cat-count { font-size: 13px; color: var(--text-dim); }

/* ============================================================
   Articolo singolo
   ============================================================ */
.single .article-info {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.single .article-info .hits { margin-left: 14px; }

.article-body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  padding: 28px 32px;
  line-height: 1.75;
  font-size: 17px;
}
.article-body h1, .article-body h2 { font-size: 23px; margin: 32px 0 12px; }
.article-body h3 { font-size: 19px; margin: 26px 0 10px; }
.article-body p { margin: 0 0 16px; }
.article-body a { color: var(--blue-bright); text-decoration: underline; text-underline-offset: 2px; }
.article-body a:hover { color: var(--sky); }
.article-body img { border-radius: var(--radius-sm); }
.article-body table {
  max-width: 100%;
  border-collapse: collapse;
  margin: 0 auto 18px;
}
.article-body table img { max-width: 100%; height: auto; }
.article-body iframe { max-width: 100%; border-radius: var(--radius-sm); }
.article-body blockquote {
  margin: 0 0 18px;
  padding: 12px 18px;
  border-left: 2px solid var(--border-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--panel-soft);
  color: var(--text-dim);
}

/* ============================================================
   Tag / argomenti
   ============================================================ */
.article-tags {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.tags-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 4px;
}
.tag-chip {
  display: inline-block;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--panel-soft);
  color: var(--link);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.tag-chip:hover {
  background: var(--accent);
  color: var(--btn-fg);
  border-color: var(--accent);
  text-decoration: none;
}
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag-cloud .tag-chip { font-size: 15px; padding: 6px 16px; }
.tag-count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.7;
  margin-left: 2px;
}

/* Foto pagina "Chi sono" */
.about-photo {
  float: right;
  width: 240px;
  max-width: 42%;
  margin: 4px 0 18px 24px;
  text-align: center;
}
.about-photo img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
}
.about-photo figcaption {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
@media (max-width: 560px) {
  .about-photo { float: none; width: 100%; max-width: 100%; margin: 0 0 18px; }
}

/* ============================================================
   Footer
   ============================================================ */
#footer {
  border-top: 1px solid var(--border);
  margin-top: 32px;
  padding: 24px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
#footer .cookie-info { margin: 0 0 8px; opacity: 0.8; }
#footer .credit { margin: 0; }
#footer .credit a { color: var(--blue-bright); }
#footer .credit a:hover { color: var(--sky); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 18px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--sky);
  margin: 0 0 10px;
  text-shadow:
    var(--name-3d),
    0 0 5px var(--name-glow),
    0 0 14px var(--name-glow-soft),
    0 0 28px var(--name-glow-soft);
  animation: name-pulse 4s ease-in-out infinite;
}
@keyframes name-pulse {
  0%, 100% {
    text-shadow:
      var(--name-3d),
      0 0 5px var(--name-glow),
      0 0 14px var(--name-glow-soft),
      0 0 28px var(--name-glow-soft);
  }
  50% {
    text-shadow:
      var(--name-3d),
      0 0 7px var(--name-glow),
      0 0 20px var(--name-glow-soft),
      0 0 38px var(--name-glow-soft);
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-title { animation: none; }
}
.hero-tagline {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: var(--heading);
  margin: 0 0 14px;
}
.hero-intro {
  max-width: 640px;
  margin: 0 auto 26px;
  color: var(--text-dim);
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--btn-fg);
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
}
.btn:hover { background: var(--link-hover); border-color: var(--link-hover); color: var(--btn-fg); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-ghost:hover { background: var(--panel-soft); color: var(--link-hover); border-color: var(--link-hover); }

/* ---------- Sezioni home ---------- */
.home-section { margin-bottom: 44px; }
.home-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.home-section-head h2 { margin: 0; font-size: 22px; }
.see-all {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--blue-bright);
  white-space: nowrap;
}
.see-all:hover { color: var(--sky); }

/* ---------- Griglia card con copertina ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.gcard {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.gcard:hover {
  border-color: var(--border-soft);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}
.gcard-link { display: block; color: inherit; }
.gcard-link:hover { color: inherit; }
.gcard-thumb {
  aspect-ratio: 16 / 9;
  background: var(--deep-space);
  overflow: hidden;
}
.gcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcard-thumb-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 2rem; color: var(--blue-dark);
}
.gcard-body { padding: 14px 16px 16px; }
.gcard-title { font-size: 16px; margin: 0 0 6px; color: var(--heading); line-height: 1.35; }
.gcard:hover .gcard-title { color: var(--sky); }
.gcard-summary { margin: 0; font-size: 13.5px; color: var(--text-dim); line-height: 1.55; }

/* ---------- Quicklinks ---------- */
.quicklinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.ql-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.ql-card h3 { margin: 0 0 8px; font-size: 17px; color: var(--sky); }
.ql-card p { margin: 0 0 12px; color: var(--text-dim); font-size: 14px; }
.ql-card a { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; }

/* ---------- Switch lingua (tutorial) ---------- */
/* ---- Selettore lingua: combo box (dropdown <details>) ---- */
.lang-switch {
  position: relative;
  display: inline-block;
}
.lang-switch > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, color 0.15s;
}
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary:hover { border-color: var(--border-soft); color: var(--sky); }
.lang-switch[open] > summary { border-color: var(--accent); }

.lang-flag {
  display: block;
  width: 22px;
  height: 15px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  flex: 0 0 22px;
  box-sizing: border-box;
}
.lang-flag--text { width: auto; height: auto; font-size: 11px; padding: 1px 4px; background: var(--panel-soft); box-shadow: none; }
.lang-name { white-space: nowrap; }
.lang-caret {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.15s;
}
.lang-switch[open] .lang-caret { transform: rotate(180deg); }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 100%;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.lang-menu li {
  display: block;
  width: 100%;
  margin: 0;
  float: none;
}
#topmenu .lang-menu li a.lang-option,
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
}
#topmenu .lang-menu li:first-child a.lang-option { padding-left: 12px; }
.lang-option:hover { background: var(--panel-soft); color: var(--sky); }
.lang-option.is-active { background: var(--panel-soft); color: var(--text); }
.lang-option.is-active .lang-name { font-weight: 600; color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 560px) {
  body { font-size: 15px; }
  #header .container { justify-content: center; text-align: center; }
  #social { margin-top: 8px; }
  #logo h1 { font-size: 24px; }
  .article-body { padding: 20px 18px; }
  .card { padding: 18px; }
  .card-thumb { float: none; margin: 0 0 12px; }
  .card-thumb img { width: 100%; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
}

/* ============================================================
   Hover swap before/after — img.hover-swap (+ JS hover-swap.js)
   ============================================================ */
.article-body img.hover-swap {
  cursor: pointer;
  max-width: 100%;
  height: auto;
  transition: opacity .2s ease;
}
.article-body img.hover-swap:hover { opacity: .96; } /* feedback leggero */
