/*
  ISIPC - Public Page Style for Listmonk
  Incolla in: Settings > Appearance > Public Page Style
  Compat: Listmonk v4.x (struttura HTML default)

  Register: brand. Color strategy: committed (dark identity + signal orange CTA).
  Scene: IT pro/SMB owner subscribing to security alerts on work laptop during day.
  Theme: light surface, dark hero, warm CTA - evita il riflex "blue-corporate-IT".
*/

@import url('https://fonts.googleapis.com/css2?family=Jost:wght@400;500;600;700&display=swap');

:root {
  /* OKLCH base (browsers moderni). Hex fallback per Outlook web e simili */
  --ink: #15191F;
  --ink-2: #2a3038;
  --paper: #fbfbfc;
  --surface: #f5f6f8;
  --line: #e6e8ec;
  --line-strong: #c9ced6;
  --text: #15191F;
  --text-2: #4a5260;
  --text-3: #7a8290;
  --brand: #3865c9;
  --brand-strong: #1f3a8a;
  --signal: #e89344;
  --signal-strong: #d97a2c;
  --ok: #2a9d6f;
  --err: #c0392b;
  --err-bg: #fef3f2;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(20,25,32,0.05), 0 8px 24px -8px rgba(20,25,32,0.08);
  --ring: 0 0 0 3px rgba(56,101,201,0.22);
  --ease: cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* ---------- Reset minimo che convive col CSS Listmonk ---------- */
html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  font-family: 'Jost', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

a {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
a:hover {
  color: var(--brand-strong);
  border-bottom-color: currentColor;
}
a:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 3px;
}

/* ---------- Layout root ---------- */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Listmonk wrappa tutto in .container.wrap, e poi footer in .container.
   Forziamo full-width per applicare l'hero, ricentriamo il contenuto. */
.container.wrap {
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100%;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ---------- Header: hero scuro full-bleed ---------- */
.header {
  background: var(--ink);
  background-image:
    radial-gradient(80% 120% at 100% 0%, rgba(56,101,201,0.22) 0%, transparent 55%),
    radial-gradient(60% 100% at 0% 100%, rgba(232,147,68,0.10) 0%, transparent 60%),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
  padding: 32px 24px 80px;
  border-bottom: none;
  text-align: center;
  position: relative;
}

.header::after {
  /* Onda sottile in fondo per separare visivamente */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 32px;
  background: var(--surface);
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 60%);
}

.header .logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.header .logo a {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.3px;
}
.header .logo a::after {
  content: "ISIPC";
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.header .logo img {
  width: 36px;
  height: 36px;
  display: block;
  filter: brightness(0) invert(1);
}

/* Sottotitolo dinamico - aggiunto via pseudo */
.header::before {
  content: "Newsletter ISIPC";
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 16px;
}

/* ---------- Content area ---------- */
.container.wrap > section,
.container.wrap > .wrap > section {
  background: var(--paper);
  margin: -56px auto 48px;
  padding: 40px 36px 36px;
  max-width: 520px;
  width: calc(100% - 32px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 2;
}

section h2 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Microcopy sotto il titolo principale */
section > h2:first-child::after {
  content: "Alert di sicurezza, novità tech, casi reali. Niente spam, max 2 email al mese.";
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-3);
  letter-spacing: 0;
}

section p {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.65;
}

/* ---------- Form ---------- */
.form {
  margin-top: 24px;
}

.form > div > p {
  margin: 0 0 18px;
}

.form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.form input[type="email"],
.form input[type="text"] {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), background 160ms var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.form input[type="email"]::placeholder,
.form input[type="text"]::placeholder {
  color: var(--text-3);
}

.form input[type="email"]:hover,
.form input[type="text"]:hover {
  border-color: var(--text-3);
}

.form input[type="email"]:focus,
.form input[type="text"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
  background: #fff;
}

.form input.nonce { display: none; }

/* ---------- Liste / checkboxes ---------- */
.form ul.lists {
  list-style: none;
  padding: 18px;
  margin: 24px 0 24px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.form ul.lists h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-3);
  margin: 0 0 12px;
}

.form ul.lists li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 14.5px;
  line-height: 1.5;
}

.form ul.lists li + li {
  border-top: 1px solid var(--line);
}

.form ul.lists input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color 140ms var(--ease), background 140ms var(--ease);
}

.form ul.lists input[type="checkbox"]:hover {
  border-color: var(--brand);
}

.form ul.lists input[type="checkbox"]:checked {
  background: var(--brand);
  border-color: var(--brand);
}

.form ul.lists input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.form ul.lists input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.form ul.lists label {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  line-height: 1.5;
}

/* ---------- Bottone CTA ---------- */
.form .button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #fff;
  background: var(--signal);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease);
  text-decoration: none;
  position: relative;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 1px 0 rgba(20,25,32,0.05);
}

.form .button::after,
button.button::after {
  content: "→";
  font-size: 18px;
  transition: transform 200ms var(--ease);
}

.form .button:hover,
button.button:hover {
  background: var(--signal-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -4px rgba(232,147,68,0.45);
}
.form .button:hover::after,
button.button:hover::after {
  transform: translateX(3px);
}

.form .button:active,
button.button:active {
  transform: translateY(0);
}

.form .button:focus-visible,
button.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232,147,68,0.35), 0 6px 16px -4px rgba(232,147,68,0.4);
}

/* Sotto-CTA: link archive */
.form p.right {
  text-align: center;
  margin: 18px 0 0;
  font-size: 13.5px;
  color: var(--text-3);
}

.form p.right a {
  font-weight: 500;
  color: var(--text-2);
}

/* ---------- Messaggi (success / error / info) ---------- */
.message-text,
section > p:first-of-type:not(:empty) {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-2);
}

/* Listmonk usa diversi pattern - copertura ampia */
.error, .err, p.err {
  background: var(--err-bg);
  color: var(--err);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(192,57,43,0.2);
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 18px;
}

.ok, .success {
  background: #ecf8f3;
  color: var(--ok);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42,157,111,0.2);
  font-size: 14px;
  font-weight: 500;
}

/* Pagine conferma / unsubscribe / errore: layout identico */
section.confirm,
section.unsub,
section.error {
  text-align: center;
}

section.confirm h2,
section.unsub h2,
section.error h2 {
  margin-bottom: 16px;
}

/* ---------- Footer ---------- */
footer.container {
  background: var(--ink);
  color: var(--text-3);
  max-width: none;
  margin: 0;
  padding: 24px 24px 28px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.05);
}

footer.container::before {
  content: "ISIPC — Sicurezza Informatica & Assistenza IT · Treviso";
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

footer.container a {
  color: var(--text-3);
  border-bottom-color: rgba(255,255,255,0.18);
}

footer.container a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .header {
    padding: 28px 20px 64px;
  }
  .container.wrap > section {
    padding: 32px 22px 28px;
    margin: -44px auto 32px;
    width: calc(100% - 24px);
  }
  section h2 {
    font-size: 22px;
  }
  .form input[type="email"],
  .form input[type="text"] {
    font-size: 16px; /* evita zoom iOS */
  }
}

/* ---------- Riduzione motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
