/* ==========================================================================
   Adripedia — foglio di stile unico
   Per cambiare la grafica basta toccare le variabili in :root.
   Direzione: palette calda e neutra, un solo accento blu, sidebar scura.
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: "Inter", "NotionInter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Liberation Mono", monospace;

  /* Superfici chiare (grigi caldi, non bluastri) */
  --bg: #ffffff;
  --surface: #f7f6f3;
  --surface-strong: #efeeea;
  --text: #37352f;
  --muted: #787774;
  --border: #e9e9e7;

  /* Accento unico */
  --accent: #2383e2;
  --accent-contrast: #ffffff;
  --accent-soft: #eaf3fd;

  /* Menu laterale (scuro, neutro) */
  --sidebar-bg: #191919;
  --sidebar-text: #d3d1cb;
  --sidebar-muted: #8f8d87;
  --sidebar-hover: #252525;
  --sidebar-active-bg: #2d2d2d;

  /* Codice */
  --code-bg: #f1f0ee;
  --code-block-bg: #191919;
  --code-block-text: #e9e7e2;

  /* Stati */
  --warn: #d9730d;
  --warn-bg: #fdf6ec;
  --ok: #0f7b6c;
  --ok-bg: #f0f9f7;

  /* Misure */
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 280px;
  --content-max: 880px;
  --topbar-h: 60px;
  --shadow: 0 12px 32px rgba(15, 15, 15, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: #d7e9fb;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* --------------------------------------------------------------------------
   Layout: sidebar fissa + contenuto
   -------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(0);
  transition: transform 0.22s ease;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.content {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s ease;
}

body.sidebar-collapsed .content {
  margin-left: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.5);
  z-index: 40;
}

.overlay[hidden] {
  display: none;
}

@media (min-width: 901px) {
  .overlay {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Sidebar: brand, navigazione, footer
   -------------------------------------------------------------------------- */

.sidebar-header {
  padding: 1.15rem 1.15rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--sidebar-text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

/* Marchio: globo di meridiani che forma una A */
.brand-mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: #ffffff;
  transition: color 0.18s ease;
}

.brand:hover .brand-mark {
  color: #9cc6f2;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-text span {
  color: var(--sidebar-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.nav {
  flex: 1;
  padding: 1.1rem 0.75rem 1.5rem;
}

.nav-section + .nav-section {
  margin-top: 1.4rem;
}

.nav-label {
  margin: 0 0 0.45rem;
  padding: 0 0.65rem;
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--sidebar-muted);
}

.nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav li + li {
  margin-top: 1px;
}

.nav a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
  text-decoration: none;
}

.nav a.active {
  background: var(--sidebar-active-bg);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent);
}

/* Sottomenu annidati (details/summary), a profondità variabile */

.nav-group > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.nav-group > summary::-webkit-details-marker {
  display: none;
}

.nav-group > summary::marker {
  content: "";
}

.nav-group > summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.15rem;
  border-right: 2px solid var(--sidebar-muted);
  border-bottom: 2px solid var(--sidebar-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
}

.nav-group[open] > summary::after {
  transform: rotate(45deg);
}

.nav-group > summary:hover {
  background: var(--sidebar-hover);
}

.nav-group > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Livello 2: sezioni dentro un'area (es. OpenCode dentro Informatica) */

.nav-group .nav-group > summary {
  padding: 0.4rem 0.55rem;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--sidebar-text);
}

/* Livello 3 e oltre: sottosezioni (es. Installazione) */

.nav-group .nav-group .nav-group > summary {
  padding: 0.35rem 0.55rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--sidebar-muted);
}

.nav-group .nav-group > summary:hover,
.nav-group .nav-group[open] > summary {
  color: #ffffff;
}

.nav-group .nav-group > summary::after {
  width: 0.34rem;
  height: 0.34rem;
}

.nav-group .nav-group .nav-group > summary::after {
  width: 0.3rem;
  height: 0.3rem;
}

.nav-group ul {
  margin: 0.15rem 0 0.4rem 0.6rem;
  padding-left: 0.45rem;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.nav-group .nav-group ul {
  margin-left: 0.45rem;
  padding-left: 0.4rem;
}

.nav-group .nav-group .nav-group ul {
  margin-left: 0.35rem;
  padding-left: 0.35rem;
}

.nav-group ul a {
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  color: var(--sidebar-muted);
}

.nav-group .nav-group ul a {
  font-size: 0.83rem;
}

.nav-group .nav-group .nav-group ul a {
  font-size: 0.82rem;
}

.nav-group ul a:hover {
  color: #ffffff;
}

.nav-group ul a.active {
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Topbar e hamburger
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.hamburger {
  appearance: none;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
}

.hamburger:hover {
  background: var(--surface);
  border-color: var(--border);
}

.hamburger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.topbar-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Contenuto
   -------------------------------------------------------------------------- */

.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  flex: 1;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.page h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.page h2 {
  margin: 2.9rem 0 1rem;
  font-size: 1.45rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.page h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-head {
  margin: 2.9rem 0 1rem;
}

.section-head .eyebrow {
  margin: 0 0 0.2rem;
}

.section-head .eyebrow::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 0.45rem;
  vertical-align: middle;
  background: currentColor;
  opacity: 0.55;
}

.section-head h2 {
  margin: 0;
}

.page p,
.page ul,
.page ol {
  margin: 0 0 1.05rem;
}

.page ul,
.page ol {
  padding-left: 1.35rem;
}

.page li + li {
  margin-top: 0.35rem;
}

.page li > ul,
.page li > ol {
  margin-top: 0.35rem;
}

.lead {
  font-size: 1.16rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 64ch;
}

/* Testata della home ------------------------------------------------------ */

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(230px, 0.75fr);
  gap: 2rem;
  align-items: center;
  overflow: hidden;
  margin: 0 0 2.6rem;
  padding: 3.4rem 3rem 3.1rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 0%, #eaf3fd 0, rgba(234, 243, 253, 0) 42%),
    linear-gradient(145deg, #fbfaf7 0%, var(--surface) 55%, #f2f0ea 100%);
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.02);
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #8bc0f4 45%, transparent 85%);
  opacity: 0.85;
}

.home-hero .ghost-letter {
  position: absolute;
  right: -1.6rem;
  bottom: -8.3rem;
  font-size: 27rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.06em;
  color: #e4e1d9;
  user-select: none;
  pointer-events: none;
}

.home-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 36rem;
}

.hero-pill {
  display: inline-block;
  margin: 0 0 1.1rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid #dce9f7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-hero .home-title {
  margin: 0 0 1.1rem;
  font-size: clamp(2.6rem, 6vw, 4.1rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.home-title .hl {
  background: linear-gradient(transparent 64%, #cfe6fb 64%);
  border-radius: 2px;
}

.home-hero .lead {
  max-width: 32rem;
}

.home-quick {
  position: relative;
  z-index: 2;
  padding: 1.05rem;
  border: 1px solid rgba(222, 220, 214, 0.9);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(15, 15, 15, 0.06);
}

.home-quick-title {
  margin: 0 0 0.55rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-quick-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-quick-list li + li {
  margin-top: 0.15rem;
}

.home-quick-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.52rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  transition: background 0.15s ease, color 0.15s ease;
}

.home-quick-list a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.home-quick-meta {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
}

.home-quick-list a:hover .home-quick-meta {
  color: var(--accent);
}

.home-quick-foot {
  margin: 0.7rem 0 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  font-size: 0.73rem;
  line-height: 1.45;
  color: var(--muted);
}

.home-quick-foot time {
  display: block;
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
    gap: 1.4rem;
    padding: 2.2rem 1.5rem 2rem;
    border-radius: 18px;
  }

  .home-hero .ghost-letter {
    font-size: 19rem;
    bottom: -5.5rem;
  }

  .home-hero-inner {
    max-width: none;
  }

  .home-quick {
    padding: 0.85rem;
  }

  .home-quick-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .home-quick-list li + li {
    margin-top: 0;
  }

  .home-quick-list a {
    display: block;
    padding: 0.5rem 0.55rem;
  }

  .home-quick-meta {
    display: block;
    margin-top: 0.15rem;
  }

  .home-quick-foot time {
    display: inline;
  }
}

@media (max-width: 600px) {
  .home-quick-list {
    grid-template-columns: 1fr;
  }

  .home-hero .ghost-letter {
    font-size: 15rem;
    right: -1rem;
    bottom: -4rem;
  }
}

/* Home — orientamento, percorsi e struttura ------------------------------- */

.page .home-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfaf7, var(--surface));
}

.page .home-stats li + li {
  margin-top: 0;
}

.home-stat {
  padding: 0.85rem 1rem;
  border-left: 1px solid var(--border);
}

.home-stat:first-child {
  border-left: 0;
}

.home-stat b {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--text);
}

.home-stat span {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(150px, 0.7fr);
  gap: 1.2rem;
  align-items: center;
  overflow: hidden;
  margin: 0;
  padding: 1.15rem 1.25rem;
  border: 1px solid #dce9f7;
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0, #eaf3fd 0, rgba(234, 243, 253, 0) 58%),
    linear-gradient(145deg, #fbfaf7, #f2f0ea);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.home-feature::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), #8bc0f4 55%, transparent);
}

.home-feature:hover {
  border-color: #c9dff5;
  box-shadow: 0 10px 26px rgba(15, 15, 15, 0.075);
  transform: translateY(-1px);
  text-decoration: none;
}

.home-feature:hover .home-feature-title {
  color: var(--accent);
}

.home-feature-body {
  display: block;
  min-width: 0;
}

.home-feature-pill {
  display: inline-block;
  padding: 0.16rem 0.5rem;
  border: 1px solid #dce9f7;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-feature-title {
  display: block;
  margin: 0.45rem 0 0.28rem;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  transition: color 0.15s ease;
}

.home-feature-desc {
  display: block;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}

.home-feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.65rem 0 0.7rem;
}

.home-feature-chips > span {
  padding: 0.18rem 0.48rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text);
}

.home-feature-cta {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

.home-feature-art {
  position: relative;
  display: grid;
  align-content: center;
  gap: 0.32rem;
  padding: 0.65rem;
  border: 1px solid rgba(222, 220, 214, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.68);
}

.home-feature-art::before {
  content: "";
  position: absolute;
  left: 1.25rem;
  top: 1.35rem;
  bottom: 1.35rem;
  width: 1px;
  background: #bcd9f5;
}

.home-feature-node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.48rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text);
}

.home-feature-node i {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.home-feature-node.is-dim i {
  background: #cfcdc7;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.65rem;
}

.card-chips > span {
  padding: 0.17rem 0.44rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.card:hover .card-chips > span {
  border-color: #dce9f7;
  background: var(--accent-soft);
  color: var(--accent);
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0 0 1.7rem;
  padding: 0.9rem;
  border: 1px solid #eeede9;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fbfaf7, var(--surface));
}

.persona {
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.persona-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 0.55rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.persona h3 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.persona p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.structure-flow {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
  margin: 0 0 0.7rem;
}

.structure-node {
  flex: 1 1 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.structure-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.structure-name {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.structure-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 1rem;
}

.structure-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.7rem;
}

.structure-tags span {
  padding: 0.2rem 0.5rem;
  border: 1px dashed #ddd9d2;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .page .home-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page .home-stat:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .page .home-stat:nth-child(4) {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  .home-feature {
    grid-template-columns: 1fr;
  }

  .home-feature-art {
    display: none;
  }

  .persona-grid {
    grid-template-columns: 1fr;
  }

  .structure-flow {
    flex-direction: column;
  }

  .structure-arrow {
    padding: 0.1rem 0;
    transform: rotate(90deg);
  }
}

@media (max-width: 600px) {
  .home-stat {
    padding: 0.75rem 0.8rem;
  }

  .home-stat b {
    font-size: 1.4rem;
  }

  .home-stat span {
    font-size: 0.55rem;
  }

  .persona-grid {
    padding: 0.7rem;
  }
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.4rem 0;
}

/* Tabelle ---------------------------------------------------------------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.91rem;
}

th,
td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfaf8;
}

td code,
th code {
  white-space: nowrap;
}

.glossary-table tr[hidden] {
  display: none;
}

/* Codice ----------------------------------------------------------------- */

code {
  padding: 0.14em 0.4em;
  border-radius: 5px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  background: var(--code-block-bg);
  color: var(--code-block-text);
  border-radius: var(--radius);
  font-size: 0.86rem;
  line-height: 1.65;
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
}

.pre-wrap {
  position: relative;
  margin: 0 0 1.5rem;
}

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #d6d3cc;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.pre-wrap:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

@media (hover: none) {
  .copy-btn {
    opacity: 1;
  }
}

kbd {
  display: inline-block;
  padding: 0.08em 0.42em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 15, 15, 0.04);
  font-family: var(--font-mono);
  font-size: 0.82em;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--text);
}

/* Figure ----------------------------------------------------------------- */

.figure {
  margin: 0 0 1.6rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.figure figcaption {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}

.figure-logo {
  padding: 1.7rem 1.5rem;
  background: var(--bg);
  text-align: center;
}

.figure-logo img {
  width: min(100%, 320px);
  margin: 0 auto;
}

/* Indice di sezione ------------------------------------------------------- */

.section-index {
  margin: 0 0 1.6rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.section-index-title {
  margin: 0 0 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-index ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.2rem 1.4rem;
  margin: 0;
  padding-left: 1.25rem;
}

.section-index li {
  margin: 0;
  padding: 0.12rem 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.section-index a {
  font-weight: 500;
}

.section-index-sub {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

.section-index-sub a {
  font-weight: 400;
}

/* Callout ---------------------------------------------------------------- */

.callout {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout.warn {
  border-color: #f1e4d3;
  border-left-color: var(--warn);
  background: var(--warn-bg);
}

.callout.ok {
  border-color: #d9ece8;
  border-left-color: var(--ok);
  background: var(--ok-bg);
}

.callout.feature {
  border-color: #cfe3f8;
  border-left: 4px solid var(--accent);
  background: linear-gradient(180deg, #f5f9ff, var(--surface));
}

.callout.feature h2 {
  margin: 0 0 0.7rem;
}

.callout-tag {
  display: inline-block;
  margin: 0 0 0.5rem;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.callout-links {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
}

/* Tab -------------------------------------------------------------------- */

.tabs {
  margin: 0 0 1.5rem;
}

.tablist {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1.6rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.tab {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover {
  background: var(--surface-strong);
  color: var(--text);
}

.tab[aria-selected="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 15, 15, 0.08);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tabpanel,
h2[id],
h3[id] {
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.tabpanel:focus {
  outline: none;
}

.tabpanel > :first-child {
  margin-top: 0;
}

.tabpanel[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .tablist {
    border-radius: var(--radius-sm);
  }

  .tab {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
  }
}

/* Aggiornamenti paginati -------------------------------------------------- */

.updates {
  margin: 0 0 1.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.025);
}

.updates-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
}

.updates-list::before {
  content: "";
  position: absolute;
  left: 1.5rem;
  top: 1.7rem;
  bottom: 1.7rem;
  width: 1px;
  background: var(--border);
}

.update {
  position: relative;
  display: grid;
  grid-template-columns: 7.4rem minmax(0, 1fr);
  gap: 0 0.9rem;
  padding: 0.95rem 1.2rem 0.95rem 3rem;
}

.update[hidden] {
  display: none;
}

.update::before {
  content: "";
  position: absolute;
  left: 1.06rem;
  top: 1.42rem;
  width: 9px;
  height: 9px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  z-index: 1;
}

.update:first-child::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.update-date {
  grid-column: 1;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.update p {
  grid-column: 2;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.updates-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.updates-controls[hidden] {
  display: none;
}

.updates-pages {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 auto;
}

.updates-status {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.updates-btn,
.updates-page {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.updates-btn {
  flex: 0 0 32px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.updates-btn:hover:not(:disabled),
.updates-page:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.updates-page[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.updates-btn:focus-visible,
.updates-page:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.updates-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 600px) {
  .updates-controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .updates-status {
    order: -1;
    grid-column: 1 / -1;
    text-align: center;
  }

  .updates-pages {
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
  }

  .update {
    grid-template-columns: 1fr;
    padding-left: 2.75rem;
  }

  .update-date {
    grid-column: 1;
    margin-bottom: 0.15rem;
  }

  .update p {
    grid-column: 1;
  }

  .updates-list::before {
    left: 1.28rem;
  }

  .update::before {
    left: 0.84rem;
  }
}

/* Ricerca tra i comandi --------------------------------------------------- */

.cmd-search {
  margin: 0 0 1.6rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.cmd-search-label {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cmd-search-field {
  position: relative;
}

.cmd-search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.cmd-search-input {
  width: 100%;
  padding: 0.62rem 0.8rem 0.62rem 2.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.4;
}

.cmd-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cmd-search-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.cmd-search-results {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0.3rem;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.cmd-search-results[hidden] {
  display: none;
}

.cmd-result {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}

.cmd-result + .cmd-result {
  margin-top: 0.15rem;
}

.cmd-result.is-active,
.cmd-result:hover {
  background: var(--accent-soft);
}

.cmd-result code {
  font-size: 0.85rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cmd-result-desc {
  flex: 1 1 100%;
  font-size: 0.82rem;
  color: var(--muted);
}

.cmd-result-context {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.cmd-line {
  display: inline;
  scroll-margin: 5rem 0;
}

.cmd-line.cmd-hit {
  border-radius: 3px;
  background: rgba(217, 115, 13, 0.22);
  box-shadow: 0 0 0 2px rgba(217, 115, 13, 0.22);
  animation: cmd-hit-pulse 1.2s ease;
}

tr.cmd-hit {
  background: var(--warn-bg);
  box-shadow: inset 3px 0 0 var(--warn);
}

@keyframes cmd-hit-pulse {
  0%, 100% {
    background: rgba(217, 115, 13, 0.22);
  }
  50% {
    background: rgba(217, 115, 13, 0.42);
  }
}

/* Card ------------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 0 0 1.7rem;
}

.card {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.card:hover {
  border-color: #d8d7d3;
  box-shadow: 0 8px 20px rgba(15, 15, 15, 0.075);
  transform: translateY(-2px);
  text-decoration: none;
}

.card:hover::before {
  transform: scaleX(1);
}

.card-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  margin: 0 0 0.8rem;
  padding: 0 0.45rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.card:hover .card-mark {
  background: var(--accent);
  color: var(--accent-contrast);
  transform: translateY(-1px);
}

.card h3 {
  margin: 0 0 0.3rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  transition: color 0.16s ease;
}

.card:hover h3 {
  color: var(--accent);
}

.card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.card-url {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.card[target="_blank"] h3::after {
  content: " \2197";
  font-size: 0.85em;
  color: var(--muted);
}

.card.soon {
  border-style: dashed;
  background: var(--surface);
}

.card.soon::before {
  display: none;
}

.card.soon:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.card.soon .card-mark,
.card.soon:hover .card-mark {
  background: var(--surface-strong);
  color: var(--muted);
  transform: none;
}

.card.soon h3,
.card.soon:hover h3 {
  color: var(--muted);
}

/* Footer ----------------------------------------------------------------- */

.footer {
  padding: 1.5rem 1.5rem 2.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  align-items: center;
  justify-content: space-between;
}

.footer-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

/* Link "Offrimi un caffè": piccolo, sobrio, con l'icona PayPal */
.coffee-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.24rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.coffee-btn:hover {
  border-color: #cfe0f2;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.coffee-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  color: #0070ba;
  transition: color 0.16s ease;
}

.coffee-btn:hover .coffee-icon {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Pulsante "Torna in cima"
   -------------------------------------------------------------------------- */

.to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 35;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: var(--sidebar-bg);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 15, 15, 0.22);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease,
    background 0.18s ease, border-color 0.18s ease;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.to-top svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 900px) {
  .to-top {
    right: 1rem;
    bottom: 1rem;
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .to-top {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .content {
    margin-left: 0;
  }

  body.sidebar-collapsed .content {
    margin-left: 0;
  }

  .sidebar {
    box-shadow: var(--shadow);
  }

  .page {
    padding: 1.75rem 1.15rem 2.75rem;
  }

  .topbar {
    padding: 0 1rem;
  }

  .footer {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .sidebar,
  .content,
  .card,
  .card h3,
  .brand-mark {
    transition: none;
  }
}
