/* Font self-hosted (SIL OFL 1.1, licenze in fonts/OFL-*.txt; file da @fontsource v5, subset latin).
   Nessuna richiesta a Google Fonts o ad altri server di terzi: coerente con l'informativa §7. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/fraunces-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/fraunces-latin-700-normal.woff2") format("woff2"); }

:root {
  --sage: #8FA58C;
  --cream: #F6F1E7;
  --terracotta: #C9734F;
  --anthracite: #2F3437;
  --sand: #E3D3B6;
  --white: #ffffff;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(47, 52, 55, 0.08);
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--anthracite);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(143, 165, 140, 0.25), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201, 115, 79, 0.12), transparent 55%),
    var(--cream);
  line-height: 1.5;
}

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

.wrap {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--sage), #6f8a6c);
  color: var(--white);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.lang-toggle {
  display: inline-flex;
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.lang-toggle button {
  border: 0;
  background: transparent;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--anthracite);
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--sage);
  color: var(--white);
}

.hero {
  margin-bottom: 1.25rem;
}

.hero h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.2;
}

.hero p {
  margin: 0;
  max-width: 42rem;
  color: #4a5154;
}

.privacy {
  margin: 1rem 0 1.5rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--sand);
  background: rgba(143, 165, 140, 0.15);
  font-size: 0.92rem;
}

.privacy strong {
  color: var(--anthracite);
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
}

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

.card {
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.85rem 0 0.35rem;
}

label:first-of-type {
  margin-top: 0;
}

input,
select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--sand);
  border-radius: 10px;
  font: inherit;
  background: var(--cream);
  color: var(--anthracite);
}

input:focus,
select:focus {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
  background: var(--white);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 520px) {
  .row {
    grid-template-columns: 1fr;
  }
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #667075;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.15rem;
}

button.primary,
button.secondary {
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.primary {
  background: var(--terracotta);
  color: var(--white);
}

button.primary:hover {
  filter: brightness(0.96);
}

button.secondary {
  background: var(--cream);
  color: var(--anthracite);
  border: 1px solid var(--sand);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 320px;
}

#qr-target {
  width: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
  background: var(--cream);
  border-radius: var(--radius);
  border: 1px dashed var(--sand);
  margin-bottom: 1rem;
  padding: 1rem;
}

#qr-target svg {
  width: min(240px, 100%);
  height: auto;
  background: #fff;
  padding: 10px;
  border-radius: 8px;
}

.placeholder {
  color: #778085;
  font-size: 0.95rem;
  padding: 1rem;
}

.meta {
  font-size: 0.85rem;
  color: #556065;
  margin: 0 0 0.75rem;
  word-break: break-word;
}

.footer {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: #6a7276;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.error {
  margin-top: 0.75rem;
  color: #9b3a2a;
  font-size: 0.9rem;
  min-height: 1.2em;
}

/* Avviso: il QR Wi-Fi contiene la password in chiaro (review Vaglio 10/10/2026) */
.warning {
  margin: -0.75rem 0 1.5rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--terracotta);
  background: rgba(201, 115, 79, 0.12);
  font-size: 0.92rem;
}
.warning strong {
  color: var(--anthracite);
}
.warning-inline {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--terracotta);
  font-weight: 600;
}

/* Language switch as links between /tools/<tool>/ (EN) and /tools/<tool>/it/ (IT), same as tools/cin (14/10/2026). */
.lang-toggle a {
  border: 0;
  background: transparent;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--anthracite);
}

.lang-toggle a[aria-current="page"] {
  background: var(--sage);
  color: var(--white);
}

/* Print rules moved here from the inline <style> in index.html (14/10/2026) so the pages work under a CSP with style-src 'self'. */
@media print {
  .topbar,
  .privacy,
  .warning,
  .warning-inline,
  .actions,
  .lang-toggle,
  .footer,
  #error,
  .hero p,
  form .hint {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .grid {
    display: block;
  }
  .card:first-child {
    display: none;
  }
  #qr-target {
    border: none;
    background: #fff;
  }
}
