/*
 * ATTIMI — stile delle pagine web pubbliche.
 * Palette allineata a attimi/constants/theme.ts (fonte di verità dell'app):
 * se cambia il tema dell'app, aggiornare anche qui.
 * Mobile-first, con supporto tema chiaro e scuro.
 */

:root {
  --coral-50:  #FAECE7;
  --coral-100: #F5C4B3;
  --coral-200: #F0997B;
  --coral-400: #D85A30;
  --coral-600: #993C1D;
  --coral-900: #4A1B0C;

  --bg:          #FFF5F0;
  --surface:     #FFFFFF;
  --border:      #E8DAD0;
  --text:        #2C2C2A;
  --text-muted:  #888780;
  --accent:      var(--coral-400);
  --accent-text: #FFFFFF;
  --link:        var(--coral-600);

  --success: #1D9E75;
  --warning: #E8A72C;
  --error:   #E24B4A;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --maxw: 46rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #16100A;
    --surface:    #211913;
    --border:     #3A2E24;
    --text:       #F2EBE5;
    --text-muted: #B4B2A9;
    --accent:     var(--coral-200);
    --accent-text:#16100A;
    --link:       var(--coral-200);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

/* ---- Intestazione ---- */

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

.site-header .wrap {
  padding-top: 1rem;
  padding-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--coral-600);
  text-decoration: none;
  letter-spacing: -0.01em;
}

@media (prefers-color-scheme: dark) {
  .logo { color: var(--coral-200); }
}

.logo .dot { color: var(--coral-200); }

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9375rem;
}

.site-nav a { color: var(--text-muted); text-decoration: none; }
.site-nav a:hover { color: var(--link); text-decoration: underline; }

/* ---- Tipografia ---- */

h1 {
  font-size: 1.875rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.3125rem;
  line-height: 1.3;
  margin: 2.5rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.5rem;
  color: var(--coral-600);
}

@media (prefers-color-scheme: dark) {
  h3 { color: var(--coral-200); }
}

p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.375rem; }
li { margin-bottom: 0.375rem; }

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

strong { font-weight: 650; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--coral-50);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
  code { background: #2E231A; }
}

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

blockquote {
  margin: 1.25rem 0;
  padding: 0.875rem 1.125rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

blockquote p:last-child { margin-bottom: 0; }

.lede {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.updated {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ---- Tabelle (scrollano da sole, la pagina non scrolla mai in orizzontale) ---- */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

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

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

th { font-weight: 650; background: var(--coral-50); white-space: nowrap; }

@media (prefers-color-scheme: dark) {
  th { background: #2E231A; }
}

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

/* ---- Indice della privacy ---- */

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.125rem 1.125rem 1.125rem 2.5rem;
  font-size: 0.9375rem;
}

.toc li { margin-bottom: 0.25rem; }

/* ---- Riquadri ---- */

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

.card h2, .card h3 { margin-top: 0; border-top: 0; padding-top: 0; }

.callout {
  border-left: 3px solid var(--warning);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.875rem 1.125rem;
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
}

.callout.danger { border-left-color: var(--error); }
.callout.ok     { border-left-color: var(--success); }

/* ---- Moduli e pulsanti ---- */

label {
  display: block;
  font-weight: 650;
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
}

input[type="email"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.875rem;
}

input[type="email"]:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.2;
  color: var(--accent-text);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0.8125rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:hover:not(:disabled) { filter: brightness(0.94); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-danger { background: var(--error); color: #fff; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-block { display: block; width: 100%; }

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.btn-row .btn { flex: 1 1 12rem; }

.field { margin-bottom: 1.25rem; }

.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

[hidden] { display: none !important; }

/* ---- Stati del modulo ---- */

.status {
  padding: 1rem 1.125rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.status.ok    { background: rgba(29,158,117,0.12);  border: 1px solid rgba(29,158,117,0.4); }
.status.err   { background: rgba(226,75,74,0.12);   border: 1px solid rgba(226,75,74,0.4); }
.status.info  { background: rgba(55,138,221,0.12);  border: 1px solid rgba(55,138,221,0.4); }

.spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.05em;
  margin-right: 0.4em;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* ---- Landing ---- */

.hero { padding: 2rem 0 1rem; }

.hero h1 { font-size: 2.25rem; }

.hero .payoff {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  color: var(--coral-600);
  font-style: italic;
  margin-bottom: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  .hero .payoff { color: var(--coral-200); }
}

.features {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.875rem;
  grid-template-columns: 1fr;
}

@media (min-width: 34rem) {
  .features { grid-template-columns: 1fr 1fr; }
}

.features li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.125rem;
  margin: 0;
  font-size: 0.9375rem;
}

.features strong { display: block; margin-bottom: 0.25rem; }

/* ---- Piè di pagina ---- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.site-footer .wrap {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: space-between;
}

.site-footer a { color: var(--text-muted); }

.site-footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
