/* ==========================================================================
   Worky — landing page
   Mobile-first. No frameworks. All colors/typography via custom properties.
   ========================================================================== */

/* ---------- Variables ---------- */

:root {
  --bg:          #FAF7F2;
  --bg-sand:     #F2EBDF;
  --surface:     #FFFFFF;
  --text:        #2B2620;
  --text-muted:  #5C554B;
  --accent:      #2F6D62;
  --accent-dark: #25564D;
  --accent-soft: #E3EDEA;
  --terracotta:  #C2603E; /* solo decorativo, mai per testo */
  --border:      #E4DCCF;
  --footer-bg:   #2B2620;
  --footer-text: #F5F1E8;

  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --fs-h1:    clamp(2rem, 1.2rem + 4vw, 3.25rem);
  --fs-h2:    clamp(1.5rem, 1.1rem + 2vw, 2.25rem);
  --fs-h3:    clamp(1.1rem, 1rem + 0.5vw, 1.25rem);
  --fs-body:  clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  --fs-small: 0.875rem;

  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --section-pad: clamp(3.5rem, 9vw, 6rem);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(43, 38, 32, 0.04);
  --shadow-phone: 0 24px 48px -24px rgba(43, 38, 32, 0.35);
}

/* ---------- Reset / base ---------- */

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

html {
  /* compensa l'header sticky quando si naviga con le ancore */
  scroll-padding-top: 5.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
}

svg {
  display: block;
}

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

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.3; }

.lead {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  color: var(--text-muted);
}

.eyebrow {
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

/* ---------- Layout ---------- */

.container {
  width: min(100% - clamp(2rem, 8vw, 4rem), 1100px);
  margin-inline: auto;
}

.section {
  padding-block: var(--section-pad);
}

.section--sand {
  background: var(--bg-sand);
}

.section-intro {
  max-width: 40rem;
  margin-bottom: var(--space-6);
}

.section-intro p:not(.eyebrow) {
  margin-top: var(--space-4);
  color: var(--text-muted);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.split {
  display: grid;
  gap: var(--space-6);
  align-items: start;
}

.split .section-intro {
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .split {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-7);
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.75em 1.6em;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-sm {
  padding: 0.5em 1.2em;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-ghost {
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.cta-row--center {
  justify-content: center;
}

/* ---------- Skip link / focus ---------- */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  padding: 0.6em 1.2em;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* destinazione del link "salta al contenuto": riceve focus via tabindex="-1" */
main:focus {
  outline: none;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text);
  text-decoration: none;
}

.nav-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.5em 1em;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bars {
  position: relative;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease;
}

.nav-toggle-bars::before { top: -5px; }
.nav-toggle-bars::after  { top: 5px; }

.nav-open .nav-toggle-bars {
  background: transparent;
}

.nav-open .nav-toggle-bars::before {
  transform: translateY(5px) rotate(45deg);
}

.nav-open .nav-toggle-bars::after {
  transform: translateY(-5px) rotate(-45deg);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

.nav-list a:not(.btn) {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.nav-list a:not(.btn):hover {
  color: var(--accent);
}

.nav-list .btn {
  justify-self: start;
}

@media (max-width: 899.98px) {
  /* Senza JS il toggle non funzionerebbe: lista sempre visibile nel flusso,
     header non sticky, pulsante nascosto. */
  html:not(.js) .site-header {
    position: static;
  }

  html:not(.js) {
    /* niente header sticky da compensare */
    scroll-padding-top: 0;
  }

  html:not(.js) .nav-toggle {
    display: none;
  }

  html:not(.js) .nav {
    flex-wrap: wrap;
  }

  html:not(.js) .nav-list {
    flex: 1 1 100%;
    padding-bottom: var(--space-4);
  }

  /* Con JS: pannello a tendina agganciato all'header sticky (containing block
     dei discendenti absolute), così non supera mai la larghezza del viewport. */
  .js .nav-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: var(--space-4) clamp(1rem, 4vw, 2rem) var(--space-5);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - 4.5rem);
    max-height: calc(100dvh - 4.5rem);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  }

  .js .nav-open .nav-list {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }

  /* aree di tocco più comode nel menu */
  .nav-list a:not(.btn) {
    display: block;
    padding-block: 0.5em;
  }
}

@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }

  .nav-list {
    display: flex;
    align-items: center;
    gap: var(--space-6);
  }
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(3rem, 8vw, 5.5rem) var(--section-pad);
}

.hero-grid {
  display: grid;
  gap: var(--space-7);
  align-items: center;
}

.hero-note {
  margin-top: var(--space-6);
  font-size: var(--fs-small);
  color: var(--text-muted);
  max-width: 34rem;
}

.hero-copy .lead {
  margin-top: var(--space-5);
  max-width: 36rem;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

/* ---------- Phone mockup ---------- */

.hero-visual {
  display: grid;
  justify-items: center;
}

.phone {
  width: min(100%, 310px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 36px;
  padding: 10px;
  box-shadow: var(--shadow-phone);
}

.phone-screen {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 18px 16px 16px;
  font-size: 12px;
  line-height: 1.4;
  display: grid;
  gap: 12px;
}

.phone-screen::before {
  /* tacca altoparlante */
  content: "";
  justify-self: center;
  width: 56px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.demo-header {
  display: grid;
  gap: 6px;
}

.demo-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}

.demo-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.demo-tab {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
}

.demo-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.demo-block {
  display: grid;
  gap: 7px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.demo-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.skel {
  display: block;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border);
}

.skel--w30 { width: 30%; }
.skel--w35 { width: 35%; }
.skel--w40 { width: 40%; }
.skel--w55 { width: 55%; }
.skel--w60 { width: 60%; }
.skel--w65 { width: 65%; }
.skel--w70 { width: 70%; }
.skel--price { width: 22px; flex: none; }

.demo-menu-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-menu-row .skel:first-child {
  flex: none;
}

.demo-dots {
  flex: 1;
  border-bottom: 2px dotted var(--border);
  transform: translateY(2px);
}

.demo-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.demo-tile {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
}

.demo-tile--a { background: linear-gradient(135deg, #F2E3D5, #E0BFA6); }
.demo-tile--b { background: linear-gradient(135deg, #DDE9E4, #B9D2C9); }
.demo-tile--c { background: linear-gradient(135deg, #F3EAD3, #E3D3A9); }

.demo-hours-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.demo-contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-contact-row svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex: none;
}

.demo-map {
  position: relative;
  height: 58px;
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(0deg, transparent 0 13px, rgba(43, 38, 32, 0.05) 13px 14px),
    repeating-linear-gradient(90deg, transparent 0 13px, rgba(43, 38, 32, 0.05) 13px 14px),
    linear-gradient(135deg, #E9EFE9, #DCE7E2);
}

.demo-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: var(--terracotta);
  border-radius: 50% 50% 50% 0;
  transform: translate(-50%, -70%) rotate(-45deg);
}

.demo-pin::after {
  content: "";
  position: absolute;
  inset: 5px;
  background: var(--bg);
  border-radius: 50%;
}

.demo-btn {
  display: block;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}

.card h3 {
  margin-top: var(--space-4);
}

.card p {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: 0.975rem;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.card-icon svg {
  width: 1.4rem;
  height: 1.4rem;
}

/* ---------- Metodo / steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
  display: grid;
  gap: var(--space-4);
}

.step {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
}

.step::before {
  content: counter(step);
  /* blocco a sé: il numero sta sopra il testo, con aria attorno */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
}

.method-note {
  margin-top: var(--space-6);
  max-width: 40rem;
  color: var(--text-muted);
}

@media (min-width: 640px) {
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---------- Checklist ---------- */

.checklist {
  list-style: none;
  padding: var(--space-5);
  display: grid;
  gap: var(--space-3);
  background: var(--bg-sand);
  border-radius: var(--radius-lg);
}

.checklist li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 500;
}

.check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.check-icon svg {
  width: 0.85rem;
  height: 0.85rem;
}

@media (min-width: 640px) {
  .checklist {
    grid-template-columns: repeat(2, 1fr);
    padding: var(--space-6);
  }
}

/* ---------- Demo panel ---------- */

.panel {
  max-width: 44rem;
  margin-inline: auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 6vw, 3.5rem);
  box-shadow: var(--shadow-card);
}

.panel p:not(.eyebrow) {
  margin-top: var(--space-4);
  color: var(--text-muted);
}

.panel .btn {
  margin-top: var(--space-6);
}

/* ---------- Contatti ---------- */

.contact {
  max-width: 38rem;
  margin-inline: auto;
  text-align: center;
}

.contact p:not(.eyebrow) {
  margin-top: var(--space-4);
  color: var(--text-muted);
}

.next-steps {
  margin-top: var(--space-6);
  padding: var(--space-5) clamp(1.25rem, 4vw, 2rem);
  background: var(--bg-sand);
  border-radius: var(--radius-lg);
  text-align: left;
}

.next-steps ol {
  list-style: none;
  padding: 0;
  margin-top: var(--space-4);
  display: grid;
  gap: var(--space-3);
  counter-reset: next-step;
}

.next-steps li {
  counter-increment: next-step;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  color: var(--text-muted);
}

.next-steps li::before {
  content: counter(next-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  margin-top: 0.1em;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

.contact-email {
  font-size: 1.1rem;
}

.contact-email a {
  font-weight: 600;
}

.contact-note {
  font-size: var(--fs-small);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: var(--space-2);
  padding: 0.3em 0.9em;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

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

.contact-fallback {
  font-size: var(--fs-small);
}

/* regione aria-live: altezza riservata per i messaggi di una riga
   (il suggerimento lungo può andare a capo e allungare il blocco) */
.contact p.contact-feedback {
  min-height: 1.6em;
  margin-top: var(--space-2);
  font-size: var(--fs-small);
}

.contact .contact-feedback.is-confirm {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding-block: var(--space-7) var(--space-5);
}

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

.site-footer :focus-visible {
  outline-color: var(--footer-text);
}

.footer-grid {
  display: grid;
  gap: var(--space-5);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid rgba(245, 241, 232, 0.18);
}

.footer-brand {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.1rem;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer-links a,
.footer-email a {
  text-decoration: none;
}

.footer-links a:hover,
.footer-email a:hover {
  text-decoration: underline;
}

.footer-bottom {
  padding-top: var(--space-5);
  font-size: var(--fs-small);
  color: rgba(245, 241, 232, 0.7);
}

@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }
}

/* ---------- Reveal on scroll ---------- */
/* Nascosto solo se il JS è attivo (classe .js sull'html), così la pagina
   resta leggibile anche senza JavaScript. */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

.js .grid .reveal:nth-child(2),
.js .steps .reveal:nth-child(2) { transition-delay: 0.08s; }

.js .grid .reveal:nth-child(3),
.js .steps .reveal:nth-child(3) { transition-delay: 0.16s; }

.js .grid .reveal:nth-child(4),
.js .steps .reveal:nth-child(4) { transition-delay: 0.24s; }

.js .grid .reveal:nth-child(5) { transition-delay: 0.32s; }
.js .grid .reveal:nth-child(6) { transition-delay: 0.4s; }

/* ---------- Riduzione del movimento ---------- */

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

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .btn-primary:hover,
  .btn-ghost:hover {
    transform: none;
  }
}
