/* Base mobile-first (§4.4): reset leggero + componenti condivisi. */

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  /* Gli sfondi decorativi full-bleed (hero) non devono mai creare
     scroll orizzontale: su mobile sfalserebbe gli elementi fixed. */
  overflow-x: clip;
}

@supports not (overflow-x: clip) {
  body {
    overflow-x: hidden;
  }
}

img,
video,
canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Tipografia --- */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.05;
  margin: 0 0 var(--space-4);
}

h1 {
  font-size: clamp(2.2rem, 9vw, 4rem);
}

h2 {
  font-size: clamp(1.6rem, 6vw, 2.6rem);
}

h3 {
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

/* Occhiello di sezione (mock: etichetta piccola, maiuscola, spaziata) */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-2);
}

.eyebrow::before {
  content: "";
  width: 1.6rem;
  height: 2px;
  background: var(--is-gradient);
}

/* Testo con gradiente firma (titoli "neon") */
.grad-text {
  background: var(--is-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

p {
  margin: 0 0 var(--space-4);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Layout --- */
.container {
  width: min(100% - 2rem, 1080px);
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2rem, 560px);
  margin-inline: auto;
}

main {
  padding-block: var(--space-6);
}

/* --- Bottoni pill (§4.3) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  padding: 0.65rem 1.6rem;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--is-gradient);
  color: var(--is-white);
  box-shadow: var(--glow-pink);
}

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

/* CTA scura su pannelli a fondo acceso (sezione finale del mock) */
.btn--ink {
  background: var(--is-ink);
  color: var(--is-paper);
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.5);
}

.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  text-decoration: underline;
}

.btn--danger {
  background: var(--error);
  color: var(--is-white);
}

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

/* --- Card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-5);
}

/* --- Form (§4.3): label grandi, touch target ≥ 48px --- */
.field {
  margin-bottom: var(--space-5);
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%;
  min-height: var(--touch-target);
  padding: 0.7rem 1rem;
  font: inherit;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 80%, var(--bg));
  border: 2px solid color-mix(in srgb, var(--text-muted) 40%, transparent);
  border-radius: 12px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-2);
}

.field .help {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.field .errors {
  list-style: none;
  margin: var(--space-1) 0 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--error);
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea {
  border-color: var(--error);
}

.field--checkbox {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.field--checkbox input {
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.field--checkbox label {
  font-weight: 400;
  margin: 0;
}

.password-wrap {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.password-wrap input {
  flex: 1;
}

/* Honeypot anti-bot: nascosto ai visitatori, presente nel DOM (§6.1) */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- Messaggi / toast --- */
.messages {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
}

.messages li {
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  margin-bottom: var(--space-2);
  background: var(--surface);
  border-left: 4px solid var(--accent-2);
}

.messages li.success {
  border-left-color: var(--success);
}

.messages li.error {
  border-left-color: var(--error);
}

.messages li.warning {
  border-left-color: var(--is-yellow);
}

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface);
  color: var(--text);
}

.badge--pink {
  background: var(--is-pink);
  color: var(--is-white);
}

.badge--cyan {
  background: var(--is-cyan);
  color: var(--is-ink);
}

.badge--yellow {
  background: var(--is-yellow);
  color: var(--is-ink);
}

/* --- Skeleton loader (§4.3) --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    color-mix(in srgb, var(--surface) 60%, var(--text-muted)) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.4s infinite;
  border-radius: 8px;
}

@keyframes skeleton {
  to {
    background-position: -200% 0;
  }
}

/* --- Header/footer pubblici --- */
/* Barra in evidenza: banda piena su superficie rialzata, sticky, con
   filo di gradiente firma sul bordo inferiore. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgb(12 8 21 / 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  min-height: 64px;
}

.site-header .logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-header .logo .logo-stamp {
  height: 80px;
  width: auto;
  display: block;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.site-header__login {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.site-header__login:hover {
  color: var(--text);
}

/* Nell'header il bottone primario resta compatto */
.site-header .btn {
  padding: 0.5rem 1.4rem;
  min-height: 42px;
}

/* Su schermi stretti logo + Accedi + pill devono stare in 390px */
@media (max-width: 479px) {
  .site-header__inner {
    gap: var(--space-3);
  }

  .site-header__nav {
    gap: var(--space-3);
  }

  .site-header .logo .logo-stamp {
    height: 60px;
  }

  .site-header .btn {
    padding: 0.45rem 1rem;
    min-height: 38px;
    font-size: 0.82rem;
  }
}

.site-footer {
  padding: var(--space-8) 0 var(--space-6);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  margin-top: var(--space-8);
}

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

.site-footer ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
}

/* CTA sticky bottom su mobile (§5.1) */
.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 100vw;
  box-sizing: border-box;
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--is-night) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 50;
}

.sticky-cta .btn {
  max-width: 100%;
}

@media (min-width: 768px) {
  .sticky-cta {
    display: none;
  }
}

/* --- Accessibilità: riduzione movimento (§4.3) --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
