/* Bussola — foglio di stile condiviso */

:root {
  --navy: #16233f;
  --navy-light: #24365c;
  --navy-dark: #0d1628;
  --gold: #c9a24b;
  --gold-light: #e4c778;
  --bg: #f7f5f0;
  --card-bg: #ffffff;
  --text: #1c1f26;
  --text-muted: #5b5f6a;
  --border: #e6e1d3;
  --heading: var(--navy-dark);
  --accent-text: var(--navy-light);
  --badge-live-bg: #e4f2e6;
  --badge-live-text: #276b39;
  --badge-soon-bg: #efe9db;
  --badge-soon-text: #8a6d1f;
  --notice-warning-bg: #fdf3e0;
  --notice-warning-border: #eecf8c;
  --notice-warning-text: #6e5210;
  --notice-info-bg: #eef1f8;
  --notice-info-border: #b9c4dc;
  --notice-info-text: var(--navy);
  --radius: 12px;
  --shadow: 0 2px 12px rgba(22, 35, 63, 0.07);
  --shadow-hover: 0 10px 24px rgba(22, 35, 63, 0.14);
}

html.dark {
  --bg: #10182c;
  --card-bg: #1a2340;
  --text: #e9ebf1;
  --text-muted: #a2a9ba;
  --border: #2c3a5e;
  --heading: #f4f1e8;
  --accent-text: var(--gold-light);
  --badge-live-bg: #163821;
  --badge-live-text: #7fd99a;
  --badge-soon-bg: #3a2f10;
  --badge-soon-text: #e0c169;
  --notice-warning-bg: #3a2f10;
  --notice-warning-border: #6e5210;
  --notice-warning-text: #f0d9a0;
  --notice-info-bg: #1c2846;
  --notice-info-border: #35447a;
  --notice-info-text: #cfd8ef;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 10px 24px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

html.dark {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.15s ease, color 0.15s ease;
}

a {
  color: var(--accent-text);
}

*:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */

header.site-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy) 60%, var(--navy-light));
  color: #fff;
  padding: 1.1rem 1.5rem 0.9rem;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
}

header.site-header .header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

header.site-header .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  color: #fff;
  letter-spacing: 0.01em;
}

header.site-header .brand .needle {
  color: var(--gold-light);
  font-size: 1.2rem;
}

header.site-header .tagline {
  margin: 0.3rem 0 0;
  color: #c7cfe0;
  font-size: 0.82rem;
  max-width: 46ch;
}

header.site-header .status-pill {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-dark);
  background: var(--gold-light);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.theme-toggle-wrap {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.theme-toggle {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.theme-toggle-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c7cfe0;
}

nav.breadcrumb {
  max-width: 960px;
  margin: 1.1rem auto 0;
  padding: 0 1.5rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

nav.breadcrumb a {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 500;
}

nav.breadcrumb a:hover {
  text-decoration: underline;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.92rem;
  margin-bottom: 1rem;
  padding: 0.45rem 1rem;
  border: 1.5px solid var(--accent-text);
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.back-link:hover {
  background: var(--accent-text);
  color: var(--card-bg);
}

/* Variante per il pulsante "torna indietro" quando vive dentro l'header
   (sempre a sfondo blu navy scuro, indipendentemente dal tema chiaro/scuro
   della pagina) — usa i colori oro già usati per gli altri elementi header,
   non var(--accent-text) che cambierebbe con il tema e diventerebbe
   illeggibile su questo sfondo in tema chiaro. */
.back-link.on-header {
  color: var(--gold-light);
  border-color: var(--gold-light);
  margin-bottom: 0;
}

.back-link.on-header:hover {
  background: var(--gold-light);
  color: var(--navy-dark);
}

.header-back-row {
  max-width: 960px;
  margin: 0.7rem auto 0;
  padding: 0 1.5rem;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 4rem;
}

h1 {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
  color: var(--heading);
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-top: 2rem;
}

.section-intro {
  color: var(--text-muted);
  max-width: 640px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

/* ---------- Pagina 404 ---------- */

.error-page {
  text-align: center;
  padding: 3rem 1rem;
  max-width: 480px;
  margin: 0 auto;
}

.error-page .error-code {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--gold);
  margin: 0;
  line-height: 1;
}

.error-page h1 {
  margin-top: 0.5rem;
}

.error-page .section-intro {
  margin: 0 auto 1.75rem;
}

.error-page .btn {
  display: inline-flex;
}

/* ---------- Griglia categorie (homepage) ---------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}

.category-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: block;
}

.category-card .icon {
  font-size: 1.3rem;
  display: block;
  margin-bottom: 0.35rem;
}

.category-card.active:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--gold);
}

.category-card h3 {
  margin: 0 0 0.25rem;
  color: var(--heading);
  font-size: 0.98rem;
  font-weight: 700;
}

.category-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.category-card.disabled {
  opacity: 0.6;
  cursor: default;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.badge.live {
  background: var(--badge-live-bg);
  color: var(--badge-live-text);
}

.badge.soon {
  background: var(--badge-soon-bg);
  color: var(--badge-soon-text);
}

.badge.pro {
  background: var(--gold);
  color: var(--navy-dark);
  margin-bottom: 0;
}

/* ---------- Elenco app in una categoria ---------- */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
}

.app-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.app-card .icon {
  font-size: 1.3rem;
}

.app-card h3 {
  margin: 0;
  color: var(--heading);
  font-size: 0.95rem;
  font-weight: 700;
}

.app-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-grow: 1;
}

.app-card .btn {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* ---------- Pagina dedicata app ---------- */

.app-page-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.app-version {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-tagline {
  color: var(--text-muted);
  font-size: 1.08rem;
  margin-top: 0;
  max-width: 60ch;
}

.feature-list {
  padding-left: 1.2rem;
}

.feature-list li {
  margin-bottom: 0.5rem;
}

.notice {
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1.75rem 0;
  font-size: 0.92rem;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.notice.warning {
  background: var(--notice-warning-bg);
  border: 1px solid var(--notice-warning-border);
  color: var(--notice-warning-text);
}

.notice.info {
  background: var(--notice-info-bg);
  border: 1px solid var(--notice-info-border);
  color: var(--notice-info-text);
}

.notice .notice-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--gold);
  color: var(--navy-dark);
  font-weight: 700;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.1s ease;
  font-size: 0.95rem;
}

.btn:hover {
  background: var(--gold-light);
  transform: translateY(-1px);
}

.btn.disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* ---------- Commenti e richieste ---------- */

.comments-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin-top: 2.5rem;
  box-shadow: var(--shadow);
}

.comments-section h2 {
  margin-top: 0;
}

.comments-section .section-intro {
  margin-bottom: 1rem;
}

.comments-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.comments-form input[type="text"],
.comments-form textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.comments-form textarea {
  min-height: 100px;
}

.comments-form button.btn {
  align-self: flex-start;
  border: none;
  cursor: pointer;
}

.comments-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.75rem 0 0;
}

/* Campo anti-spam: presente nel markup ma invisibile e ignorabile da una
   persona reale, i bot invece lo compilano quasi sempre. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Messaggi pubblici (bacheca generale + widget per pagina) ---------- */

.bacheca-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.bacheca-item .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.bacheca-item .meta .nome {
  font-weight: 700;
  color: var(--heading);
}

.bacheca-pagina-tag {
  font-style: italic;
}

.bacheca-item .messaggio {
  white-space: pre-wrap;
}

.bacheca-item .risposta {
  margin-top: 0.9rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: var(--notice-info-bg);
  border: 1px solid var(--notice-info-border);
  color: var(--notice-info-text);
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.bacheca-item .risposta .risposta-label {
  font-weight: 700;
  display: block;
  margin-bottom: 0.25rem;
  white-space: normal;
}

.bacheca-anteprima {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}

.bacheca-anteprima h2 {
  margin-top: 0;
}

.bacheca-anteprima-lista {
  margin-bottom: 1.2rem;
}

.bacheca-anteprima-lista .bacheca-item {
  margin-bottom: 0.8rem;
}

.bacheca-anteprima-lista .bacheca-item:last-child {
  margin-bottom: 0;
}

.bacheca-loading, .bacheca-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.bacheca-azioni {
  margin-top: 0.7rem;
  display: flex;
  gap: 1rem;
}

.bacheca-azione {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.bacheca-azione:hover {
  color: var(--text);
}

.bacheca-rispondi-box {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bacheca-rispondi-box textarea {
  width: 100%;
  min-height: 70px;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.bacheca-rispondi-box .btn {
  align-self: flex-start;
  border: none;
  cursor: pointer;
}

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

footer.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 2rem 1.5rem;
}
