/* ==========================================================================
   AP Digital Solution — stylesheet
   Tema chiaro: bianco + legno chiaro, con accenti "da editor di codice"
   (font monospace, finestre stile IDE, syntax-highlight nei toni del legno).
   Scroll-snap a schermo intero invariato.
   ========================================================================== */

:root {
  --white: #ffffff;
  --cream: #faf7f2;
  --paper: #f4ecdf;
  --ink: #2b2216;
  --ink-soft: #55483a;
  --muted: #7a6c5b;
  --muted-light: #c9bda9;
  --line: #e6d9c2;
  --line-soft: #eee3d0;

  --wood-100: #f2e1be;
  --wood-200: #e8d2ae;
  --wood-300: #d9b183;
  --wood-500: #b4864f;
  --wood-600: #8a6339;
  --wood-700: #6b4a2a;
  --wood-800: #3b2a17;
  --amber: #9c6624;
  --status-green: #7cb37a;

  /* Gamma scura per garantire testo bianco leggibile (contrasto AA) sopra i bottoni */
  --grad-wood: linear-gradient(120deg, var(--wood-600) 0%, var(--wood-800) 100%);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; }
::selection { background: var(--wood-200); color: var(--ink); }

/* ---------- Layout / scroll-snap (invariato) ---------- */

.snap-container {
  height: 100vh;
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.snap-container::-webkit-scrollbar { width: 0; height: 0; }

.panel {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 128px 24px 76px;
  overflow: hidden;
  background: var(--cream);
}
.panel.alt { background: var(--paper); }

.panel-inner {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  width: 100%;
  text-align: center;
}

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Wood grain accent strip ---------- */

/* ramo botanico decorativo (hero + contatti) */
.leaf-branch {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  width: 168px;
}
.leaf-branch.hero-pos { top: -12px; right: 30px; }
.leaf-branch.contact-pos { bottom: -12px; left: 30px; transform: scaleX(-1); }

.leaf-sway {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 50% 96%;
  animation: leafSway 9s ease-in-out infinite;
}
@keyframes leafSway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(1.6deg); }
}

@media (max-width: 900px) {
  .leaf-branch { width: 110px; opacity: 0.85; }
}
@media (max-width: 640px) {
  .leaf-branch { width: 84px; }
}

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

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--wood-600);
  margin-bottom: 18px;
}

.grad-text {
  background: linear-gradient(120deg, var(--wood-600), var(--wood-800));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-title {
  font-size: clamp(2.3rem, 5.4vw, 4.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-sub {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 520px;
  margin: 22px 0 32px;
  line-height: 1.65;
}

.section-title {
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--ink);
}

.section-lead {
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 46px;
  line-height: 1.7;
}

/* ---------- Status pill ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px 7px 12px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  box-shadow: 0 6px 16px rgba(139, 105, 60, 0.08);
  margin-bottom: 22px;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--status-green);
  box-shadow: 0 0 0 0 rgba(124, 179, 122, 0.5);
  animation: pulseDot 2.2s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(124, 179, 122, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(124, 179, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 179, 122, 0); }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 30px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15.5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}
.btn-primary {
  background: var(--grad-wood);
  color: #fff;
  box-shadow: 0 10px 26px rgba(138, 99, 57, 0.32);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(138, 99, 57, 0.4); }
.btn-ghost {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--wood-500); transform: translateY(-2px); }
.btn-block { width: 100%; }

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Navbar ---------- */

.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  background: rgba(250, 247, 242, 0.72);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s var(--ease);
}
.navbar.scrolled { background: rgba(250, 247, 242, 0.94); }

.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav-logo-icon { width: 30px; height: 30px; border-radius: 8px; }
.nav-logo-text { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; color: var(--ink); }
.nav-logo-text em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 4px; }

.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-link { font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--ink-soft); text-decoration: none; transition: color 0.2s; }
.nav-link:hover, .nav-link.active { color: var(--wood-700); }
.nav-cta {
  background: var(--grad-wood);
  color: #fff !important;
  padding: 9px 20px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 210;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 0.3s var(--ease), opacity 0.3s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Dot navigation (desktop) ---------- */

.dots-nav {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-light);
  position: relative;
  transition: background 0.3s, transform 0.3s;
}
.dot.active { background: var(--wood-600); transform: scale(1.3); }
.dot::after {
  content: attr(data-label);
  position: absolute;
  right: 20px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.dot:hover::after { opacity: 1; }

/* ---------- Background texture (dot-grid + warm glow) ---------- */

.warm-glow {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  width: 560px; height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--wood-200) 0%, transparent 70%);
  opacity: 0.55;
  filter: blur(10px);
}
.warm-glow.top-right { top: -180px; right: -160px; }
.warm-glow.bottom-left { bottom: -200px; left: -160px; }

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

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  text-align: left;
}

.hero-logo { width: 46px; height: 46px; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 10px 26px rgba(138, 99, 57, 0.25); }

/* finestra "editor" riutilizzata da hero code-card e service card */
.window {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 54px rgba(139, 105, 60, 0.14);
}
.window-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.window-dot { width: 8px; height: 8px; border-radius: 50%; }
.window-dot.red { background: #d9927c; }
.window-dot.amber { background: #e3ba76; }
.window-dot.green { background: #9bb583; }
.window-file { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 6px; }

.code-card { max-width: 460px; width: 100%; }
.code-body { padding: 20px 22px; font-family: var(--mono); font-size: 13.2px; line-height: 1.9; }
.code-line { display: flex; }
.ln { width: 18px; flex-shrink: 0; color: var(--muted-light); user-select: none; text-align: right; margin-right: 16px; }
.indent { width: 16px; flex-shrink: 0; }
.tok-key { color: var(--wood-700); font-weight: 600; }
.tok-prop { color: var(--ink); }
.tok-str { color: var(--amber); }
.tok-bool { color: var(--wood-600); font-weight: 600; }
.tok-punc { color: var(--muted); }

.scroll-hint {
  position: absolute;
  bottom: 34px; left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid var(--line);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
  z-index: 1;
  background: rgba(255,255,255,0.6);
}
.scroll-hint span { width: 4px; height: 8px; background: var(--wood-600); border-radius: 2px; animation: scrollDown 1.8s infinite; }
@keyframes scrollDown {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 0; transform: translateY(14px); }
  100% { opacity: 0; transform: translateY(14px); }
}

/* ---------- Icon badges (sostituiscono le emoji) ---------- */

.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--wood-100);
  color: var(--wood-700);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 16px;
}

/* ---------- About: layout a due colonne con illustrazione ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  text-align: left;
}
.about-text .section-lead { margin: 0 0 32px; max-width: 480px; }

.about-visual svg {
  width: 100%;
  height: auto;
  display: block;
}
.about-visual {
  filter: drop-shadow(0 24px 46px rgba(139, 105, 60, 0.2));
}

.feature-list { display: flex; flex-direction: column; gap: 22px; }
.feature-item { display: flex; gap: 16px; align-items: flex-start; }
.feature-item .icon-badge { margin-bottom: 0; }
.feature-item h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 4px; color: var(--ink); }
.feature-item p { font-size: 14px; color: var(--ink-soft); line-height: 1.6; }

/* ---------- Feature / service cards ---------- */

.feature-grid, .services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 12px;
  text-align: left;
}
.services-grid { grid-template-columns: repeat(4, 1fr); }

.feature-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.feature-card:hover, .service-card:hover {
  transform: translateY(-6px);
  border-color: var(--wood-300);
  box-shadow: 0 18px 40px rgba(139, 105, 60, 0.14);
}

.service-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.service-card .card-body { padding: 22px 22px 26px; }
.service-card .icon-badge { margin-bottom: 14px; }

.feature-card h3, .service-card h3 { font-size: 17.5px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; color: var(--ink); }
.feature-card p, .service-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.6; }

/* ---------- Timeline / process ---------- */

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 16px;
  text-align: left;
}
.step { padding-top: 18px; border-top: 2px solid var(--line); }
.step-icon { width: 54px; height: 70px; margin-bottom: 10px; }
.step-icon svg { display: block; width: 100%; height: 100%; }
.step-num {
  display: block;
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--wood-600);
  margin-bottom: 10px;
}
.step h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.step p { font-size: 14px; color: var(--ink-soft); line-height: 1.6; }

/* ---------- Contact ---------- */

.contact-inner { max-width: 1020px; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  margin-top: 10px;
  text-align: left;
  align-items: start;
}

.contact-info { display: flex; flex-direction: column; gap: 14px; }
.contact-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.contact-item:hover { transform: translateX(4px); border-color: var(--wood-300); }
.contact-item-static:hover { transform: none; border-color: var(--line); }
.contact-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 9px;
  background: var(--wood-100);
  color: var(--wood-700);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.contact-label { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.contact-value { display: block; font-size: 15px; font-weight: 600; word-break: break-word; color: var(--ink); }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}
.form-row label { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.form-row input, .form-row textarea {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s;
}
.form-row input:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--wood-500);
  background: var(--white);
}
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--muted-light); }

.form-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: -2px; }

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

.footer {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  padding: 42px 24px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  background: var(--paper);
}
.footer-logo { width: 34px; height: 34px; border-radius: 9px; opacity: 0.95; }
.footer p { font-family: var(--mono); font-size: 12px; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .nav-links {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: rgba(250, 247, 242, 0.98);
    backdrop-filter: blur(20px);
    padding: 26px 28px;
    gap: 22px;
    border-bottom: 1px solid var(--line);
    transform: translateY(-130%);
    transition: transform 0.35s var(--ease);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-toggle { display: flex; }
  .dots-nav { display: none; }

  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-grid .code-card { margin: 0 auto; }
  .hero-actions { justify-content: center; }

  .about-grid { grid-template-columns: 1fr; text-align: center; }
  .about-text { text-align: center; }
  .about-text .section-lead { margin: 0 auto 32px; }
  .feature-item { text-align: left; }
  .about-visual { order: -1; max-width: 380px; margin: 0 auto 8px; }

  .feature-grid, .services-grid, .timeline { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .panel { padding: 108px 20px 56px; }
  .feature-grid, .services-grid, .timeline { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-actions { flex-direction: column; width: 100%; }
  .btn { width: 100%; }
  .nav-logo-text em { display: none; }
}

@media (max-height: 700px) {
  .panel { padding-top: 96px; padding-bottom: 36px; }
}
