/* ================================================================
   hiendpoint.html — "la costellazione dei dispositivi". Riusa
   .reveal/.reveal.visible, .badge, .section* dal design system
   condiviso (css/style.css, non toccato). Tutto lo stile qui sotto
   è specifico di questa pagina.
   ================================================================ */

/* ---------- Layout a due colonne: illustrazione sticky + testo (stessa
   griglia/offset sticky del pattern condiviso .scrolly__grid/.scrolly__media-sticky
   in css/style.css: colonne quasi paritarie, top sticky = altezza header + respiro) ---------- */
.ep-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 64px;
}
.ep-art-col { position: relative; }
.ep-art-sticky { position: sticky; top: calc(72px + 48px); }
.ep-art-caption { margin-top: 20px; font-size: .85rem; color: var(--text-muted); text-align: center; }

@media (max-width: 900px) {
  .ep-layout { grid-template-columns: 1fr; gap: 40px; }
  .ep-art-sticky { position: static; }
}

/* ---------- Testo HiEndpoint / HiMobile ---------- */
.ep-subsection + .ep-subsection { border-top: 1px solid var(--border); margin-top: 48px; padding-top: 40px; }
.ep-subsection > p { font-size: .98rem; color: var(--navy-mid); line-height: 1.75; margin-top: 14px; }
.ep-feature-title { margin-top: 22px; font-weight: 700; color: var(--navy-dark); font-size: .92rem; }
.ep-feature-list { list-style: none; margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.ep-feature-list li { position: relative; padding-left: 26px; font-size: .95rem; color: var(--text-muted); line-height: 1.6; }
.ep-feature-list li::before { content: ""; position: absolute; left: 0; top: .55em; width: 12px; height: 2px; background: var(--orange); border-radius: 1px; }

/* ---------- Costellazione: elemento visivo principale della sezione, non
   un'icona piccola — a viewBox quadrato, la larghezza definisce anche
   l'altezza (~500px desktop, ben oltre la soglia minima richiesta) ---------- */
.ep-constellation { position: relative; width: 100%; max-width: 500px; margin: 0 auto; }
.ep-constellation__svg { width: 100%; height: auto; display: block; overflow: visible; }

@media (max-width: 640px) {
  .ep-constellation { max-width: 340px; }
}

/* ---------- "Perché scegliere": 3 card, non 4 come il default condiviso.
   Stessi breakpoint di .advantages-grid in style.css, solo il conteggio
   colonne desktop cambia (override scoped, niente inline style). ---------- */
.ep-advantages-grid { grid-template-columns: repeat(3, 1fr); max-width: 900px; margin-left: auto; margin-right: auto; }
@media (max-width: 860px) { .ep-advantages-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ep-advantages-grid { grid-template-columns: 1fr; } }

/* ---------- Link nodo-nodo / nodo-core (stroke-draw pathLength, riuso della
   tecnica condivisa: main.js aggiunge .is-drawn direttamente su [pathLength]
   quando la sezione .reveal entra in vista) ---------- */
.ep-link {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: .5;
  transition: stroke-dashoffset .9s ease, stroke .4s ease, opacity .4s ease;
}
.ep-link.is-drawn { stroke-dashoffset: 0; }

.ep-link--core.ep-link--laptop,
.ep-link--core.ep-link--server {
  stroke: var(--orange);
  opacity: .75;
}
.ep-constellation.is-in-view .ep-link--core.ep-link--laptop.is-drawn,
.ep-constellation.is-in-view .ep-link--core.ep-link--server.is-drawn {
  animation: ep-link-pulse 2.6s ease-in-out infinite;
}

/* Link verso i nodi mobile e mesh di copertura estesa: spenti finché la
   lettura non arriva a HiMobile (stesso concetto di data-stage="mobile"
   del disegno originale, ora sull'attributo reale data-ep-state) */
.ep-link--core.ep-link--phone,
.ep-link--core.ep-link--tablet,
.ep-link--mesh {
  stroke: var(--border);
  opacity: .3;
}
.ep-constellation[data-ep-state="mobile"] .ep-link--core.ep-link--phone,
.ep-constellation[data-ep-state="mobile"] .ep-link--core.ep-link--tablet,
.ep-constellation[data-ep-state="mobile"] .ep-link--mesh {
  stroke: var(--orange);
  opacity: .75;
}
.ep-constellation.is-in-view[data-ep-state="mobile"] .ep-link--core.ep-link--phone.is-drawn,
.ep-constellation.is-in-view[data-ep-state="mobile"] .ep-link--core.ep-link--tablet.is-drawn,
.ep-constellation.is-in-view[data-ep-state="mobile"] .ep-link--mesh.is-drawn {
  animation: ep-link-pulse 2.6s ease-in-out infinite;
}

@keyframes ep-link-pulse {
  0%, 100% { stroke-opacity: .5; }
  50% { stroke-opacity: 1; }
}

/* ---------- Nodo AI centrale: anello che si disegna e poi respira ---------- */
.ep-core__ring {
  fill: none;
  stroke: var(--orange);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1s ease;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ep-core__ring.is-drawn { stroke-dashoffset: 0; }
.ep-constellation.is-in-view .ep-core__ring.is-drawn { animation: ep-core-breathe 3.2s ease-in-out infinite; }
@keyframes ep-core-breathe {
  0%, 100% { stroke-opacity: .55; transform: scale(1); }
  50% { stroke-opacity: 1; transform: scale(1.04); }
}

.ep-core__neural line { stroke: rgba(255, 130, 0, .55); stroke-width: 1.4; }
.ep-core__dot { fill: var(--orange); }
.ep-core__center {
  fill: var(--orange);
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ep-constellation.is-in-view .ep-core__center { animation: ep-core-center-pulse 3.2s ease-in-out infinite; }
@keyframes ep-core-center-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ---------- Nodi dispositivo ---------- */
.ep-node { cursor: pointer; }
.ep-node__bg { fill: var(--navy-dark); }

.ep-node__ring {
  fill: none;
  stroke: var(--border);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .9s ease, stroke .3s ease, transform .3s ease;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ep-node__ring.is-drawn { stroke-dashoffset: 0; }
.ep-node--laptop .ep-node__ring, .ep-node--server .ep-node__ring { stroke: var(--orange); }

.ep-node__icon { color: var(--orange); }
.ep-node__icon rect[pathLength], .ep-node__icon path[pathLength] {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset .8s ease;
}
.ep-node__icon rect[pathLength].is-drawn, .ep-node__icon path[pathLength].is-drawn { stroke-dashoffset: 0; }
.ep-node__icon circle:not([pathLength]) { fill: currentColor; }

/* Nodi mobile (phone/tablet): attenuati finché la lettura non arriva a HiMobile */
.ep-node--phone, .ep-node--tablet {
  opacity: .35;
  transform: scale(.88);
  transition: opacity .5s ease, transform .5s ease;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ep-constellation[data-ep-state="mobile"] .ep-node--phone,
.ep-constellation[data-ep-state="mobile"] .ep-node--tablet {
  opacity: 1;
  transform: scale(1);
}
.ep-constellation[data-ep-state="mobile"] .ep-node--phone .ep-node__ring,
.ep-constellation[data-ep-state="mobile"] .ep-node--tablet .ep-node__ring { stroke: var(--orange); }
.ep-constellation[data-ep-state="mobile"] .ep-node--phone .ep-node__icon,
.ep-constellation[data-ep-state="mobile"] .ep-node--tablet .ep-node__icon { color: var(--orange); }

/* Sonar: presente solo su laptop e server, attivo mentre la costellazione è in vista */
.ep-node__sonar {
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.6;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
.ep-constellation.is-in-view .ep-node__sonar { animation: ep-sonar-ping 2.6s ease-out infinite; }
.ep-constellation.is-in-view .ep-node__sonar--2 { animation-delay: 1.3s; }
@keyframes ep-sonar-ping {
  0% { opacity: .55; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.7); }
}

/* Nodo attivo in hover/focus/tap: evidenzia, attenua gli altri (equivalente
   touch reale via .is-focused aggiunta da hiendpoint.js, non solo :hover) */
.ep-constellation.has-focus .ep-node:not(.is-focused) { opacity: .3; transition: opacity .25s ease; }
.ep-constellation.has-focus .ep-node.is-focused { opacity: 1; }
.ep-constellation.has-focus .ep-node.is-focused .ep-node__ring { stroke: var(--orange); transform: scale(1.08); }

/* ---------- Tooltip dedicato per nodo, posizionato in percentuale sul
   viewBox quadrato (100% affidabile a qualunque larghezza responsive) ---------- */
.ep-constellation__tooltips { position: absolute; inset: 0; pointer-events: none; }
.ep-tooltip {
  position: absolute;
  z-index: 5;
  max-width: 190px;
  background: var(--navy-dark);
  color: var(--white);
  font-size: .8rem;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition: opacity .2s ease, transform .2s ease;
}
.ep-tooltip strong { display: block; margin-bottom: 3px; }
.ep-tooltip p { margin: 0; color: rgba(255, 255, 255, .75); }
.ep-tooltip.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

.ep-tooltip[data-tooltip="laptop"] { left: 21.82%; top: 35.45%; }
.ep-tooltip[data-tooltip="server"] { left: 78.18%; top: 35.45%; }
.ep-tooltip[data-tooltip="phone"] { left: 21.82%; bottom: 35.45%; }
.ep-tooltip[data-tooltip="tablet"] { left: 78.18%; bottom: 35.45%; }

@media (prefers-reduced-motion: reduce) {
  .ep-link, .ep-core__ring, .ep-node__ring,
  .ep-node__icon rect[pathLength], .ep-node__icon path[pathLength] {
    transition: none;
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }
  .ep-node--phone, .ep-node--tablet { transition: none; }
  .ep-node__sonar { animation: none !important; opacity: 0; }
  .ep-core__ring, .ep-core__center { animation: none !important; transform: none; }
  .ep-tooltip { transition: none; }
}

/* Blocchi testuali HiEndpoint / HiMobile */
.device-block { max-width: 760px; margin: 56px auto 0; }
.device-block__body { font-size: 0.98rem; color: var(--navy-mid); line-height: 1.75; margin-top: 14px; }
.device-block__list { list-style: none; margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
.device-block__list li {
  position: relative;
  padding-left: 26px;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.device-block__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 12px;
  height: 2px;
  background: var(--orange);
  border-radius: 1px;
}
.device-block + .device-block { border-top: 1px solid var(--border); padding-top: 40px; }
