/* Biblioteca IT: layout essenziale, coerente con il tema del portale. */
:root { color-scheme: light; --paper: #fff; --panel: #fafafa; --ink: #202020; --muted: #6b6b6b; --line: #e5e5e5; --accent: #365c4d; }
:root[data-theme="dark"] { color-scheme: dark; --paper: #1b1d20; --panel: #202225; --ink: #f2f2f2; --muted: #aaaeb4; --line: #36383c; --accent: #a8cfbe; }
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.shell { width: min(1100px, calc(100% - 64px)); margin: auto; }
.topbar { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.logo { display: block; width: 220px; }
:root[data-theme="dark"] .logo { filter: invert(1); }
nav { display: flex; gap: 24px; font-size: 12px; color: var(--muted); }
nav a[aria-current] { color: var(--ink); }
.hero { padding: 48px 0 30px; }
h1 { margin: 0; font-size: 42px; font-weight: 450; letter-spacing: -.045em; line-height: 1.1; }
.intro { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 12px 0 0; }
.catalogue { padding-bottom: 24px; }
.search { display: block; max-width: 380px; }
.search input { width: 100%; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; color: var(--ink); font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 20px 0 12px; }
.filters button { padding: 6px 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; }
.filters button[aria-pressed=true] { border-color: var(--ink); color: var(--ink); }
.filters button:hover { color: var(--ink); }
.result-count { margin: 0 0 30px; color: var(--muted); font-size: 11px; }
.guide-row { margin-bottom: 30px; }
.row-header { margin-bottom: 12px; }
.row-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.rail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.guide-card { min-width: 0; text-align: left; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); transition: background .15s; }
.guide-card:hover { background: var(--panel); }
.card-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--accent); background: var(--panel); }
.card-icon svg { display: block; width: 19px; height: 19px; }
.card-body { display: flex; flex-direction: column; height: 100%; }
.card-title { display: block; font-size: 15px; font-weight: 500; line-height: 1.4; }
.card-summary { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; margin: 10px 0 20px; flex: 1; }
.card-bottom { display: flex; justify-content: space-between; gap: 12px; font-size: 10px; color: var(--muted); }
.card-bottom > :last-child { color: var(--accent); }
.app-card { display: flex; flex-direction: column; }
.app-card .card-title { margin: 0; }
.app-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; }
.app-actions a:first-child { color: var(--accent); }
.app-actions a:last-child { color: var(--muted); }
.app-actions a:hover { text-decoration: underline; }
.empty { text-align: center; padding: 40px 16px; border: 1px solid var(--line); }
.empty h3 { font-weight: 500; }
.empty p { color: var(--muted); font-size: 13px; }
.empty button, .dialog-toolbar button { border: 1px solid var(--line); border-radius: 3px; padding: 8px 12px; background: transparent; color: var(--ink); font-size: 12px; }
.help { padding: 0 0 32px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.help a { color: var(--accent); margin-left: 6px; }
.footer { border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; padding: 22px 0 28px; color: var(--muted); font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; width: min(720px, calc(100% - 32px)); max-height: 90vh; padding: 28px; }
dialog::backdrop { background: #0006; }
.dialog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted); }
#guide-content h2 { font-size: 28px; font-weight: 500; letter-spacing: -.025em; margin: 24px 0 16px; }
#guide-content h3 { font-size: 15px; margin: 25px 0 12px; font-weight: 600; }
#guide-content p, #guide-content li { font-size: 14px; color: var(--muted); line-height: 1.8; }
#guide-content li { padding-left: 5px; margin: 10px 0; }
#guide-content ol, #guide-content ul { padding-left: 24px; }
.guide-note { border-left: 2px solid var(--line); padding: 0 16px; }
.dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding-top: 22px; margin-top: 28px; font-size: 12px; }
.dialog-actions a { color: var(--accent); }
.primary { border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 10px 14px; border-radius: 3px; font-size: 12px; }
body:has(dialog[open]) { overflow: hidden; }
@media (max-width: 800px) { .rail { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) {
  .shell { width: calc(100% - 32px); }
  .topbar { min-height: 76px; gap: 16px; }
  .logo { width: 150px; }
  nav { gap: 12px; font-size: 11px; }
  .hero { padding: 32px 0 24px; }
  h1 { font-size: 34px; }
  .intro { font-size: 13px; }
  .search { max-width: none; }
  .filters { gap: 6px 14px; }
  .rail { grid-template-columns: 1fr; gap: 10px; }
  .guide-card { padding: 18px; }
  .card-summary { margin-bottom: 14px; }
  .footer { font-size: 10px; }
  dialog { padding: 20px; }
  .dialog-actions { align-items: start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  body { background: white; color: black; }
  body > * { display: none !important; }
  body > dialog[open] { display: block !important; position: static; width: 100%; max-height: none; border: 0; margin: 0; padding: 0; overflow: visible; background: white; color: black; }
  dialog::backdrop, .dialog-toolbar, .dialog-actions { display: none !important; }
  #guide-content p, #guide-content li { color: #222; }
  #guide-content h2 { font-size: 26px; }
  .guide-note { border-color: #888; }
  body:has(dialog[open]) { overflow: visible; }
}
