@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500;1,600&family=Manrope:wght@400;500;600;700&display=swap');

/* =========================================================
   BASE / TOKENS / RESET
   ========================================================= */

:root {
  --ink: #3d4e49;
  --ink-soft: #667672;
  --ink-strong: #2f413c;
  --clay: #b2886f;
  --sage: #8da184;
  --rose: #c8a2a8;
  --paper: #f7f1ea;
  --paper-soft: #fbf7f3;
  --line: rgba(111, 101, 86, 0.22);
  --card-shadow: 0 22px 54px rgba(69, 57, 44, 0.12);
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  background: radial-gradient(circle at 8% 6%, #f5dccd 0%, transparent 30%),
    radial-gradient(circle at 88% 14%, #d5e2cd 0%, transparent 36%),
    radial-gradient(circle at 55% 80%, #efd8dc 0%, transparent 28%),
    linear-gradient(135deg, #efe4d7 0%, #f8f1ea 48%, #f3e9dd 100%);
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(4px);
  opacity: 0.24;
}

.blob-a {
  width: 34vw;
  height: 34vw;
  min-width: 280px;
  min-height: 280px;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle at 30% 30%, rgba(199, 153, 130, 0.56), rgba(199, 153, 130, 0.08));
}

.blob-b {
  width: 28vw;
  height: 28vw;
  min-width: 240px;
  min-height: 240px;
  top: 16%;
  right: -8%;
  background: radial-gradient(circle at 20% 20%, rgba(142, 173, 131, 0.54), rgba(142, 173, 131, 0.08));
}

.blob-c {
  width: 24vw;
  height: 24vw;
  min-width: 220px;
  min-height: 220px;
  bottom: -8%;
  left: 40%;
  background: radial-gradient(circle at 35% 35%, rgba(189, 139, 155, 0.44), rgba(189, 139, 155, 0.06));
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: radial-gradient(rgba(90, 75, 58, 0.65) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.app {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: var(--space-3) 20px 64px;
}

/* =========================================================
   LAYOUT SHARED / HEADER / NAV
   ========================================================= */

.app-header {
  text-align: center;
  padding: var(--space-1) 0 var(--space-2);
}

.brand-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.brand-logo {
  width: clamp(88px, 11vw, 124px);
  height: auto;
  filter: drop-shadow(0 10px 18px rgba(99, 71, 63, 0.18));
}

.app-header h1 {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2.5rem, 5.7vw, 4.7rem);
  line-height: 0.95;
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #415a4f;
}

.subtitle {
  margin: 12px auto 0;
  max-width: 56ch;
  color: #4c6059;
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  min-height: 44px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid rgba(107, 137, 95, 0.62);
  color: #f8f4ef;
  background: linear-gradient(180deg, #759569 0%, #5f7e54 100%);
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.hero-cta:hover {
  transform: translateY(-1px);
  border-color: rgba(94, 123, 84, 0.76);
  box-shadow: 0 12px 24px rgba(67, 90, 59, 0.3);
}

.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  color: #415a4f;
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px solid rgba(86, 111, 101, 0.45);
  padding-bottom: 2px;
}

.main-nav {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin: 0 0 8px;
  padding: 0 0 6px;
  position: sticky;
  top: 10px;
  z-index: 12;
  --nav-line-left: 0px;
  --nav-line-width: 0px;
}

.main-nav::after {
  content: '';
  position: absolute;
  left: var(--nav-line-left);
  bottom: 0;
  width: var(--nav-line-width);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(72, 95, 87, 0.78), rgba(124, 152, 113, 0.88));
  transition: left 0.28s cubic-bezier(0.2, 0.85, 0.22, 1),
    width 0.28s cubic-bezier(0.2, 0.85, 0.22, 1), opacity 0.2s ease;
  opacity: 0.95;
}

.nav-link {
  --mx: 0px;
  --my: 0px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 4px 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #566a64;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transform: translate(var(--mx), var(--my));
  will-change: transform;
  transition: transform 0.16s ease-out, color 0.2s ease, opacity 0.2s ease;
}

.nav-link:hover {
  color: #3f544d;
  --my: -1px;
}

.nav-link.is-active {
  color: #2f413c;
  font-weight: 700;
  border-bottom: 0;
}

#top,
#contenuto,
#calcolo,
#storia {
  scroll-margin-top: 88px;
}

.experience {
  display: grid;
  gap: var(--space-3);
}

/* =========================================================
   HOME PAGE / CALCOLO MATRICE
   ========================================================= */

.tool-shell {
  display: grid;
  grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 252, 249, 0.84), rgba(245, 236, 227, 0.62));
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.input-panel {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
  border-radius: 20px;
  border: 1px solid rgba(141, 131, 117, 0.16);
  background: linear-gradient(180deg, rgba(255, 252, 249, 0.9), rgba(250, 243, 236, 0.8));
}

.input-panel h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.8rem;
  font-weight: 600;
  font-style: italic;
}

.panel-intro {
  margin: 0 0 2px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field input {
  display: block;
  inline-size: 100%;
  width: 100%;
  min-width: 0;
  max-inline-size: 100%;
  max-width: 100%;
  min-height: 50px;
  border: 1px solid rgba(152, 128, 119, 0.3);
  border-radius: 13px;
  background: rgba(255, 252, 249, 0.95);
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input[type='date'] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding-right: 14px;
}

@supports (-webkit-touch-callout: none) {
  .field input[type='date'] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 50px;
    line-height: normal;
  }

  .field input[type='date']::-webkit-date-and-time-value {
    text-align: left;
  }
}

.field input:focus {
  outline: none;
  border-color: rgba(141, 161, 132, 0.58);
  box-shadow: 0 0 0 4px rgba(141, 161, 132, 0.14);
  transform: translateY(-1px);
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.actions-row button {
  flex: 1;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#btnCalcola {
  color: #f9f6f2;
  background: linear-gradient(180deg, #8ea57f 0%, #768d68 100%);
  box-shadow: 0 10px 20px rgba(85, 108, 75, 0.24);
}

#btnCalcola:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(85, 108, 75, 0.28);
}

.btn-secondary {
  color: #43564f;
  border-color: rgba(177, 144, 129, 0.28);
  background: rgba(255, 251, 246, 0.9);
  box-shadow: 0 8px 16px rgba(101, 76, 62, 0.1);
}

.btn-secondary:hover {
  transform: translateY(-1px);
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.errore {
  margin: 0;
  color: #9d5f66;
  font-size: 0.88rem;
  font-weight: 500;
}

.matrix-panel {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 420px;
  perspective: 900px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.matrix-panel.is-locked {
  opacity: 0.98;
  transform: translateY(0) scale(1);
  pointer-events: none;
}

.matrix-panel.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.matrix-container {
  position: relative;
  width: 100%;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(164, 143, 122, 0.18);
  background: linear-gradient(180deg, rgba(255, 252, 249, 0.86), rgba(250, 243, 236, 0.62));
  box-shadow: 0 16px 36px rgba(98, 80, 61, 0.12);
  transition: transform 0.38s ease, box-shadow 0.38s ease, filter 0.38s ease;
}

.matrix-container::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.matrix-panel.is-locked .matrix-container {
  transform: scale(0.985);
  filter: blur(1px) saturate(0.75);
}

.matrix-panel.is-locked .matrix-container::after {
  content: 'Premi Calcola per rivelare la tua mappa';
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  color: #3f544d;
  letter-spacing: 0.01em;
  font-weight: 600;
  font-size: 0.98rem;
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.82), rgba(245, 237, 229, 0.86));
  border: 1px dashed rgba(118, 137, 107, 0.5);
  opacity: 1;
}

.matrix-panel.is-active .matrix-container::after {
  opacity: 0;
}

.matrix-container.updated {
  transform: scale(1.01);
  box-shadow: 0 20px 40px rgba(98, 80, 61, 0.2);
}

.matrix-container svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 252, 249, 0.95);
}

.matrix-panel.is-active .matrix-container.reveal-play {
  opacity: 1;
  transform: scale(1);
}

.matrix-panel.is-active .matrix-container.reveal-play svg {
  clip-path: inset(0 0 0 0 round 16px);
  filter: blur(0);
}

.note-band {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(149, 136, 112, 0.16);
  background: rgba(255, 252, 249, 0.78);
}

/* =========================================================
   ABOUT PAGE / CONTENT BLOCKS
   ========================================================= */

.note-band h2 {
  margin: 0 0 8px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  font-style: italic;
  line-height: 1;
  color: #3d544b;
}

.note-band p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #4f625c;
}


.about-hero,
.about-story,
.about-cta {
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(149, 136, 112, 0.18);
  background: linear-gradient(150deg, rgba(255, 252, 249, 0.84), rgba(246, 238, 230, 0.66));
  box-shadow: var(--card-shadow);
}

.about-hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 14px;
}

.about-kicker {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #7f8f88;
  font-weight: 700;
}

.about-hero h2,
.about-story h2,
.about-cta h2 {
  margin: 8px 0 10px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1;
  font-style: italic;
  color: #415a4f;
}

.about-hero p,
.about-story p,
.about-cta p {
  margin: 0;
  color: #4f615b;
  line-height: 1.65;
  max-width: 68ch;
}

.about-quote {
  border-radius: 16px;
  border: 1px solid rgba(157, 132, 116, 0.24);
  padding: 16px;
  background: rgba(255, 251, 247, 0.9);
  align-self: center;
}

.about-quote p {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.2;
  color: #4e665d;
  font-style: italic;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.about-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(155, 132, 108, 0.24);
  background: rgba(255, 251, 247, 0.92);
}

.about-card h3 {
  margin: 0 0 8px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.45rem;
  line-height: 1;
  color: #486157;
}

.about-card p {
  margin: 0;
  color: #52635d;
  font-size: 0.92rem;
  line-height: 1.58;
}

.skip-link {
  position: absolute;
  left: 10px;
  top: -40px;
  z-index: 30;
  padding: 8px 12px;
  border-radius: 8px;
  background: #2f413c;
  color: #fff;
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 10px;
}

.back-to-top {
  --scroll-progress: 0%;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 14;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 0;
  background: conic-gradient(
    from -90deg,
    rgba(99, 130, 88, 0.98) var(--scroll-progress),
    rgba(151, 172, 141, 0.28) var(--scroll-progress)
  );
  color: transparent;
  text-decoration: none;
  font-size: 0;
  line-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 10px 20px rgba(59, 80, 53, 0.24);
}

.back-to-top::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: rgba(249, 244, 238, 0.96);
  border: 1px solid rgba(108, 135, 98, 0.28);
}

.back-to-top::after {
  content: '↑';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  font-size: 20px;
  line-height: 1;
  color: #31453f;
  font-weight: 700;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  box-shadow: 0 14px 24px rgba(59, 80, 53, 0.3);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(101, 137, 91, 0.58);
  outline-offset: 2px;
}

/* =========================================================
   FOOTER / SOCIAL / UTILITY
   ========================================================= */

.site-footer {
  margin-top: 20px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(132, 115, 97, 0.2);
  background: linear-gradient(140deg, rgba(64, 79, 61, 0.92), rgba(88, 66, 52, 0.92));
  color: #f4ede3;
  box-shadow: 0 12px 30px rgba(85, 63, 48, 0.18);
}

.footer-wrap {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 18px;
  padding: 22px 22px 16px;
}

.footer-brand,
.footer-contact,
.footer-social {
  display: flex;
  flex-direction: column;
}

.footer-logo {
  width: 58px;
  height: auto;
  margin-bottom: 8px;
}

.footer-title {
  margin: 0 0 6px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.45rem;
  font-style: italic;
}

.footer-copy {
  margin: 0;
  max-width: 32ch;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(244, 237, 227, 0.82);
}

.footer-heading {
  margin: 0 0 8px;
  font-size: 0.73rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(244, 237, 227, 0.62);
}

.site-footer a {
  width: fit-content;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #f7e9d6;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.site-footer a:hover {
  color: #fff7ec;
  border-bottom-color: rgba(255, 247, 236, 0.72);
  transform: translateY(-1px);
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.social-link .social-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.social-link:nth-of-type(2) .social-icon {
  fill: currentColor;
  stroke: none;
}

.footer-city {
  margin: 2px 0 0;
  color: rgba(244, 237, 227, 0.82);
}

.footer-bottom {
  padding: 10px 22px 12px;
  border-top: 1px solid rgba(255, 237, 213, 0.16);
}

.footer-bottom p {
  margin: 0;
  font-size: 0.76rem;
  color: rgba(244, 237, 227, 0.72);
}

.numero-punto {
  font-size: 42px;
  font-weight: 700;
  fill: #42574d;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: 'Cormorant Garamond', Georgia, serif;
}

.numero-prognosi {
  font-size: 13px;
  font-weight: 700;
  fill: #3d4e49;
  paint-order: stroke;
  stroke: rgba(255, 252, 249, 0.96);
  stroke-width: 2.2px;
  stroke-linejoin: round;
}

.guida-marker {
  fill: #b88aa3;
  opacity: 0.95;
  pointer-events: none;
}

.guida-cross {
  stroke: #b88aa3;
  stroke-width: 1.5;
  opacity: 0.8;
  pointer-events: none;
}

.guida-label {
  fill: #4f6753;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  paint-order: stroke;
  stroke: rgba(255, 252, 249, 0.96);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

/* =========================================================
   MATRIX SVG / ANIMATIONS / UTILITIES
   ========================================================= */

.reveal {
  opacity: 1;
  transform: none;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 980px) {
  .tool-shell {
    grid-template-columns: 1fr;
  }

  .about-hero {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app {
    padding: 18px 14px 50px;
  }

  .app-header h1 {
    line-height: 1;
  }

  .main-nav {
    justify-content: center;
    gap: 18px;
    margin-bottom: 12px;
    top: 6px;
  }

  .nav-link {
    width: auto;
  }

  .tool-shell {
    padding: 12px;
    border-radius: 20px;
  }

  .input-panel {
    padding: 14px;
  }

  .actions-row {
    flex-direction: column;
  }

  .matrix-container {
    padding: 10px;
    border-radius: 18px;
  }

  .matrix-panel {
    min-height: 280px;
  }

  .about-hero,
  .about-story,
  .about-cta {
    padding: 14px;
    border-radius: 18px;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .footer-wrap {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 16px 12px;
  }

  .footer-bottom {
    padding: 8px 16px 10px;
  }

  .back-to-top {
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .blob,
  .reveal,
  .reveal.is-visible,
  .matrix-container,
  .matrix-panel,
  .matrix-container svg,
  .back-to-top {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .back-to-top {
    pointer-events: auto;
  }
}
