/* =============================================
   SYLVA — progetto.css
   1. Shared utilities
   2. Hero + Arc Gallery
   3. Database
   4. RAG (Come è costruito)
   5. Open / Gratuito
   6. CTA
   7. Responsive
   ============================================= */

/* ── 1. SHARED UTILITIES ─────────────────────── */
.p-eyebrow {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sage-mid);
  margin-bottom: 0.75rem;
}

.p-section-title {
  font-family: var(--font-display);
  font-size: clamp(1.875rem, 3.5vw, 2.875rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--gray-900);
  line-height: 1.08;
  margin-bottom: 0.875rem;
}
.p-section-title em {
  font-style: italic;
  color: var(--sage-mid);
}

/* ── 2. HERO ──────────────────────────────────── */
.p-hero {
  position: relative;
  background: var(--white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── ARC GALLERY ──────────────────────────────── */
.p-arc {
  width: 100%;
  height: 576px; /* radius 480 × 1.2 */
  position: relative;
  flex-shrink: 0;
}

/* Pivot sits at bottom-center — images branch upward */
.p-arc__pivot {
  position: absolute;
  bottom: 0;
  left: 50%;
}

/* Outer wrapper: absolute positioning + centering translate */
.p-arc__pos {
  position: absolute;
  transform: translate(-50%, 50%);
  opacity: 0;
  animation: pArcFadeIn 0.8s ease-out forwards;
}

/* Inner card: holds the tilt rotation, hover scale */
.p-arc__inner {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.10),
    0 1px 4px rgba(0,0,0,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.6);
  transform: rotate(var(--card-rot, 0deg));
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.p-arc__pos:hover .p-arc__inner {
  transform: rotate(var(--card-rot, 0deg)) scale(1.07);
  box-shadow:
    0 12px 36px rgba(0,0,0,0.16),
    0 2px 8px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(255,255,255,0.5);
}

.p-arc__inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Fallback tile for missing images */
.p-arc__fallback {
  width: 100%;
  height: 100%;
  background: var(--sage-ghost);
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-arc__fallback svg {
  width: 22px;
  height: 22px;
  color: var(--sage-light);
}

@keyframes pArcFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Soft bottom vignette — blends arc into content */
.p-arc::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--white));
  pointer-events: none;
  z-index: 5;
}

/* ── HERO TEXT CONTENT ────────────────────────── */
.p-hero__content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 0 1.5rem 2rem;
  margin-top: -19rem; /* overlap with arc bottom */
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.p-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sage-mid);
  margin-bottom: 1.5rem;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.375rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--sage-border);
}
.p-hero__eyebrow::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sage-light);
}

.p-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 7vw, 5.75rem);
  font-weight: 600;
  line-height: 0.97;
  letter-spacing: -0.035em;
  color: var(--gray-900);
  margin-bottom: 1.375rem;
}
.p-hero__title em {
  font-style: italic;
  color: var(--sage-mid);
}

.p-hero__sub {
  font-size: clamp(0.9375rem, 1.8vw, 1.0625rem);
  font-weight: 300;
  color: var(--gray-500);
  line-height: 1.78;
  max-width: 500px;
  margin: 0 auto 1.875rem;
  letter-spacing: 0.01em;
}

/* Stats row */
.p-hero__stats {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--gray-100);
  border-radius: var(--r-xl);
  padding: 0.875rem 0;
  width: fit-content;
  margin: 0 auto 2rem;
  box-shadow: var(--shadow-sm);
}
.p-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.875rem;
}
.p-stat__num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1;
  letter-spacing: -0.03em;
}
.p-stat__label {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.p-stat-div {
  width: 1px;
  height: 36px;
  background: var(--gray-100);
  flex-shrink: 0;
}

/* CTA row */
.p-hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.p-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: white;
  background: var(--sage);
  padding: 0.8125rem 2rem;
  border-radius: 100px;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(47,81,50,0.26);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.p-btn-primary:hover {
  background: #1e3422;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(47,81,50,0.34);
}
.p-btn-primary svg { width: 14px; height: 14px; }

.p-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--gray-500);
  padding: 0.8125rem 1rem;
  text-decoration: none;
  transition: color 0.15s;
}
.p-btn-ghost:hover { color: var(--sage-mid); }
.p-btn-ghost svg { width: 13px; height: 13px; }

/* ── 3. DATABASE ──────────────────────────────── */
.p-db {
  padding: 1rem 0 0;
  background: var(--white);
  overflow: hidden;
}
.p-db__header {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: 1rem;
  position: relative;
  z-index: 1;
}
.p-db__sub {
  font-size: 0.9375rem;
  color: var(--gray-500);
  line-height: 1.75;
  margin-top: 0.75rem;
}

/* Orbital wrapper */
.p-orbital {
  position: relative;
  height: 620px;
  width: 100%;
  cursor: default;
  overflow: hidden;
}
.p-orbital__scene {
  position: absolute;
  top: 50%;
  left: 50%;
}

/* Rings */
.p-orbital__ring {
  position: absolute;
  width: 440px; height: 440px;
  top: -220px; left: -220px;
  border-radius: 50%;
  border: 1px solid rgba(47,81,50,0.12);
  pointer-events: none;
}
.p-orbital__ring-inner {
  position: absolute;
  width: 220px; height: 220px;
  top: -110px; left: -110px;
  border-radius: 50%;
  border: 1px dashed rgba(47,81,50,0.07);
  pointer-events: none;
}

/* Center orb */
.p-orbital__orb {
  position: absolute;
  top: -32px; left: -32px;
  width: 64px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.p-orbital__orb-logo {
  width: 46px; height: 46px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(47,81,50,0.2));
}
.p-orbital__orb-ping {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(47,81,50,0.15);
  animation: pOrbRing 2.5s ease-out infinite;
}
.p-orbital__orb-ping--1 { width: 52px; height: 52px; top: 6px; left: 6px; }
.p-orbital__orb-ping--2 { width: 66px; height: 66px; top: -1px; left: -1px; animation-delay: 0.65s; }
@keyframes pOrbRing {
  0%   { opacity: 0.5; transform: scale(0.9); }
  100% { opacity: 0;   transform: scale(1.5); }
}
.p-orbital__orb-label {
  position: absolute;
  top: 42px; left: 0;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-mid);
  line-height: 1.5;
}

/* Nodes */
.p-orb-node {
  position: absolute;
  top: 0; left: 0;
  cursor: pointer;
  transition: opacity 0.7s var(--ease);
}
.p-orb-node__btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid rgba(47,81,50,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sage-mid);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s var(--ease);
}
.p-orb-node__btn svg { width: 17px; height: 17px; }
.p-orb-node:hover .p-orb-node__btn,
.p-orb-node__btn.is-active {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
  transform: scale(1.3);
  box-shadow: 0 4px 20px rgba(47,81,50,0.32);
}
.p-orb-node__btn.is-pulse {
  border-color: var(--sage-light);
  animation: pNodePulse 1s ease-in-out infinite;
}
@keyframes pNodePulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(47,81,50,0.25); }
  50%       { box-shadow: 0 0 0 8px rgba(47,81,50,0); }
}
.p-orb-node__label {
  position: absolute;
  top: 56px;
  left: 24px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  transition: color 0.3s;
}
.p-orb-node:hover .p-orb-node__label,
.p-orb-node.is-expanded .p-orb-node__label { color: var(--sage-mid); }

/* Card */
.p-orb-node__card {
  position: absolute;
  top: 66px;
  left: 24px;
  transform: translateX(-50%);
  width: 230px;
  background: var(--white);
  border: 1px solid var(--sage-border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.375rem;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(47,81,50,0.05);
  z-index: 300;
  text-align: left;
}
.p-orb-node__card::before {
  content: '';
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 1px; height: 10px;
  background: var(--sage-border);
}
.p-orb-card-label {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-mid);
  margin-bottom: 0.3rem;
}
.p-orb-card-title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.p-orb-card-desc {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.65;
  margin-bottom: 0.875rem;
}
.p-orb-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.p-orb-card-tags span {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gray-400);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
}
.p-orb-card-related {
  border-top: 1px solid var(--gray-100);
  padding-top: 0.625rem;
}
.p-orb-card-related-label {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 0.4rem;
}
.p-orb-card-related-btns { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.p-orb-card-related-btn {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--sage-mid);
  background: var(--sage-ghost);
  border: 1px solid var(--sage-border);
  padding: 0.3rem 0.75rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.p-orb-card-related-btn:hover { background: rgba(47,81,50,0.12); }

/* Hint */
.p-orbital__hint {
  position: absolute;
  bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  font-size: 0.5625rem;
  color: var(--gray-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
/* ── 4. RAG ───────────────────────────────────── */
.p-rag {
  padding: 6.5rem 0 7rem;
  background: var(--white);
}
.p-rag__header {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 4rem;
}
.p-rag__sub {
  font-size: 0.9375rem;
  color: var(--gray-500);
  line-height: 1.75;
  margin-top: 0.75rem;
}

/* 3-step grid */
.p-rag__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  max-width: 960px;
  margin: 0 auto 3rem;
  align-items: start;
}

.p-rag__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 2rem;
  position: relative;
}

/* Illustration */
.p-rag__step-illustration {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 4/3;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-rag__step-illustration img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Dashed curved arrow connector */
.p-rag__step-connector {
  position: absolute;
  top: 60px; /* vertically aligned with illustration center */
  right: -40px;
  width: 80px;
  z-index: 1;
  pointer-events: none;
}
.p-rag__step:last-child .p-rag__step-connector { display: none; }
.p-rag__step-connector svg { width: 100%; height: auto; }

/* Step number */
.p-rag__step-num {
  font-family: var(--font-display);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--sage-light);
  margin-bottom: 0.5rem;
}

.p-rag__step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.p-rag__step-desc {
  font-size: 0.875rem;
  color: var(--gray-500);
  line-height: 1.7;
  max-width: 220px;
}

/* Honest note */
.p-rag__note {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.375rem 1.75rem;
  background: var(--sage-ghost);
  border: 1px solid var(--sage-border);
  border-radius: var(--r-lg);
  border-left: 3px solid var(--sage-light);
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
}
.p-rag__note-icon {
  flex-shrink: 0;
  color: var(--sage-mid);
  margin-top: 2px;
}
.p-rag__note-icon svg { width: 16px; height: 16px; }
.p-rag__note p {
  font-size: 0.875rem;
  color: var(--gray-500);
  line-height: 1.7;
}
.p-rag__note p strong { color: var(--sage-mid); font-weight: 600; }

/* Responsive */
@media (max-width: 767px) {
  .p-rag__steps {
    grid-template-columns: 1fr;
    gap: 3rem;
    max-width: 360px;
  }
  .p-rag__step-connector { display: none; }
}

/* ── 5. OPEN / GRATUITO ───────────────────────── */
.p-open {
  padding: 6rem 0 6.5rem;
  background: var(--sage);
  position: relative;
  overflow: hidden;
}
.p-open::before {
  content: '';
  position: absolute;
  bottom: -120px; right: -120px;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}
.p-open::after {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  pointer-events: none;
}

.p-open__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Left */
.p-open__eyebrow {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 0.875rem;
}
.p-open__title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 3.5vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: white;
  margin-bottom: 1.75rem;
}
.p-open__title em {
  font-style: italic;
  opacity: 0.65;
}
.p-open__body {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.8;
  margin-bottom: 1rem;
}
.p-open__body:last-child { margin-bottom: 0; }
.p-open__body strong { color: rgba(255,255,255,0.8); font-weight: 600; }

/* Right — illustration */
.p-open__right {
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-open__illustration {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;

  /* Cornice polaroid */
  background: white;
  padding: 12px 12px 48px 12px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.25),
    0 4px 16px rgba(0,0,0,0.15);
  border-radius: 4px;

  /* Leggero tilt */
  transform: rotate(-1.5deg);
  transition: transform 0.4s var(--ease);
}

.p-open__illustration:hover {
  transform: rotate(0deg) scale(1.02);
}

/* Responsive */
@media (max-width: 900px) {
  .p-open__grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .p-open__right { order: -1; }
  .p-open__illustration { max-width: 320px; }
}
/* ── 6. CTA FINALE ────────────────────────────── */
.p-cta {
  padding: 7rem 0 6.5rem;
  background: var(--white);
  text-align: center;
}

.p-cta__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sage-mid);
  margin-bottom: 1.25rem;
}
.p-cta__title {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.07;
  color: var(--gray-900);
  margin-bottom: 1rem;
}
.p-cta__title em { font-style: italic; color: var(--sage-mid); }
.p-cta__sub {
  font-size: 1rem;
  color: var(--gray-500);
  line-height: 1.72;
  max-width: 400px;
  margin: 0 auto 2.5rem;
}
.p-cta__note {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--gray-400);
}
.p-cta__note a {
  color: var(--sage-mid);
  text-decoration: underline;
  text-decoration-color: rgba(74,124,84,0.35);
  transition: text-decoration-color 0.15s;
}
.p-cta__note a:hover { text-decoration-color: var(--sage-mid); }

/* ── 7. RESPONSIVE ────────────────────────────── */
@media (max-width: 1023px) {
  .p-arc { height: 432px; }         /* radius 360 × 1.2 */
  .p-db__grid { grid-template-columns: repeat(2, 1fr); }
  .p-rag__flow {
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 460px;
  }
  .p-rag__connector { display: none; }
  .p-open__grid { grid-template-columns: 1fr; gap: 3rem; }
}

@media (max-width: 639px) {
  .p-arc { height: 312px; }         /* radius 260 × 1.2 */
  .p-hero__content { margin-top: -3rem; padding-bottom: 4rem; }
  .p-hero__stats {
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 0.625rem;
  }
  .p-stat-div { width: 60px; height: 1px; }
  .p-db__grid { grid-template-columns: 1fr; }
  .p-hero__actions { flex-direction: column; width: 100%; max-width: 320px; }
  .p-btn-primary, .p-btn-ghost { width: 100%; justify-content: center; }
}