/* NetworkCheck — foglio di stile.
   Font di sistema, nessuna risorsa esterna. Contrasto AA, focus visibile,
   rispetto di prefers-reduced-motion. */

:root {
  --bg: #0b1f33;
  --surface: #122c45;
  --surface-2: #173552;
  --border: #2a4a6b;
  --text: #eaf1f8;
  --muted: #b9c9da;
  --accent: #4cc2ff;
  --accent-strong: #0b3a57;
  --info: #4cc2ff;
  --notice: #f7b955;
  --warning: #ff8a8a;
  --focus: #ffd166;
  --radius: 12px;
  --maxw: 880px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.5rem;
}

h2 {
  font-size: 1.25rem;
}

h3 {
  font-size: 1.05rem;
  margin-top: 1.25rem;
}

p {
  margin: 0 0 0.85rem;
}

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

.note {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Accessibilità: skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #04121f;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
  font-weight: 600;
}

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

/* Focus visibile uniforme */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand__logo {
  display: block;
  border-radius: 8px;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Layout */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.intro .note {
  margin-bottom: 0;
}

/* Comandi */
.cmd-grid {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}

.cmd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.cmd__os {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent);
}

.cmd__code {
  font-family: var(--mono);
  font-size: 0.92rem;
  background: #04121f;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  overflow-x: auto;
  white-space: pre;
  color: #d9ecff;
}

/* Comandi alternativi */
.alt {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  background: var(--surface-2);
}

.alt > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.3rem 0;
}

.alt .cmd {
  margin-top: 0.6rem;
  background: var(--bg);
}

.alt__text {
  margin-top: 0.8rem;
}

/* Tabella porte */
.table-wrap {
  overflow-x: auto;
}

.ports {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 0.5rem;
  font-size: 0.95rem;
}

.ports th,
.ports td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ports thead th {
  color: var(--accent);
  border-bottom: 2px solid var(--border);
}

.ports tbody th {
  font-family: var(--mono);
  font-weight: 700;
  white-space: nowrap;
}

/* Bottoni */
.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  background: var(--surface-2);
  color: var(--text);
}

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

.btn--primary {
  background: var(--accent);
  color: #04121f;
  border-color: var(--accent);
}

.btn--ghost {
  background: transparent;
}

.btn--copy {
  justify-self: start;
  padding: 0.4rem 0.8rem;
  font-size: 0.88rem;
}

.btn.is-flash {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--primary.is-flash {
  color: #04121f;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Generatore di comando */
.builder {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

.builder__row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem;
}

.builder__label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  width: 100%;
}

.builder__input {
  font: inherit;
  font-family: var(--mono);
  flex: 1 1 220px;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #04121f;
  color: var(--text);
}

#builder-result {
  margin-top: 0.9rem;
}

/* Analizzatore */
.analyzer {
  margin-top: 1.25rem;
}

.analyzer__label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.analyzer__input {
  font-family: var(--mono);
  font-size: 0.9rem;
  width: 100%;
  resize: vertical;
  padding: 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #04121f;
  color: var(--text);
}

.analyzer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.7rem 0;
}

/* Risultati */
.results {
  display: grid;
  gap: 0.7rem;
}

.results__title {
  margin: 0.5rem 0 0;
  font-size: 1rem;
}

.results__error {
  color: var(--warning);
  font-weight: 600;
  margin: 0;
}

.finding {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
}

.finding--info {
  border-left-color: var(--info);
}

.finding--notice {
  border-left-color: var(--notice);
}

.finding--warning {
  border-left-color: var(--warning);
}

.finding__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
  background: var(--accent-strong);
  color: var(--text);
}

.finding--notice .finding__badge {
  background: #4a3508;
  color: var(--notice);
}

.finding--warning .finding__badge {
  background: #4a1414;
  color: var(--warning);
}

.finding__title {
  margin: 0 0 0.25rem;
  font-size: 0.98rem;
}

.finding__detail {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 1rem;
}

.site-footer__inner {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.site-footer__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0;
}

.author {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* Modale */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(2, 10, 18, 0.78);
  z-index: 200;
}

.modal[hidden] {
  display: none;
}

.modal__dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal__list {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.modal__list li {
  margin-bottom: 0.6rem;
  color: var(--muted);
}

.modal__check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1rem 0;
  font-weight: 600;
  cursor: pointer;
}

.modal__check input {
  margin-top: 0.25rem;
  width: 1.1rem;
  height: 1.1rem;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
}

/* Responsive */
@media (min-width: 620px) {
  .cmd-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tema chiaro su richiesta del sistema */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f6fa;
    --surface: #ffffff;
    --surface-2: #eef3f9;
    --border: #c5d3e2;
    --text: #10202f;
    --muted: #41576b;
    --accent: #0b6da8;
    --accent-strong: #d6ecfa;
    --info: #0b6da8;
    --notice: #8a5a00;
    --warning: #b32020;
    --focus: #b35b00;
  }

  .cmd__code,
  .analyzer__input,
  .builder__input {
    background: #0d2233;
    color: #e6f1fb;
  }

  .btn--primary {
    color: #ffffff;
  }

  .finding--notice .finding__badge {
    background: #fcefd2;
    color: #6b4400;
  }

  .finding--warning .finding__badge {
    background: #fbdede;
    color: #8f1818;
  }

  .finding__badge {
    color: var(--text);
  }
}

/* Rispetto delle preferenze di movimento ridotto */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
