/* ── DESIGN SYSTEM — edstudio.dev ──
   Tipografia precisa, colori sobri,
   nessun effetto, massima leggibilità, estetica ultra-professionale */

:root {
  /* Palette */
  --text-primary:   #111111;
  --text-secondary: #4a4a4a;
  --text-tertiary:  #999999;
  --border:         #e6e6e6;
  --bg:             #ffffff;
  --bg-subtle:      #f8f9fa;
  --accent:         #f26522;

  /* Radii */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-pill: 100px;

  /* Layout */
  --max-width: 960px;

  /* Font mono per tag tecnici */
  --font-mono: ui-monospace, 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ── RESET ── */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Inter: abilita le varianti di carattere più pulite */
  font-feature-settings: 'cv08', 'cv11', 'liga' 1, 'calt' 1;
  text-rendering: optimizeLegibility;
}

/* ── NAVBAR ── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 52px;
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 26px;
  height: 26px;
  background: var(--text-primary);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
}

.nav-links a {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.12s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-cta {
  margin-left: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-cta {
  background: var(--text-primary);
  color: #fff;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s;
}

.btn-cta:hover {
  background: #2a2a2a;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
  line-height: 0;
  align-items: center;
  justify-content: center;
}

.mobile-nav {
  display: none;
  flex-direction: column;
  border-top: 1px solid var(--border);
  padding: 0.5rem 2rem 1rem;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  padding: 0.65rem 0;
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s;
}

.mobile-nav a:last-child {
  border-bottom: none;
}

.mobile-nav a:hover {
  color: var(--text-primary);
}

/* ── HERO ──
   Testo z-index: 2. Esagoni background assoluto (z-index: 0).
   Griglia honeycomb posizionata nella metà inferiore dell'hero. */

.hero {
  position: relative;
  padding: 80px 2rem 0;
  /* Ridotto da 820px: le card servizi si avvicinano agli esagoni */
  min-height: 720px;
  isolation: isolate;
}

.hero-inner {
  position: relative;
  z-index: 6;
  /* will-change: transform → promuove su GPU layer separato,
     garantisce che stia sopra .hero-examples anche se quello ha filter/mask. */
  will-change: transform;
  max-width: var(--max-width);
  margin: 0 auto;
  /* Sfondo bianco → protegge leggibilità testo sui hex che passano dietro il testo.
     Il gradiente svanisce verso destra lasciando emergere il grid esagonale. */
  background: linear-gradient(to right,
    rgba(255,255,255,1)   0%,
    rgba(255,255,255,1)   40%,
    rgba(255,255,255,0.92) 58%,
    rgba(255,255,255,0.5) 76%,
    transparent           100%
  );
  padding-bottom: 3rem;
}

.hero h1 {
  font-size: clamp(48px, 6.5vw, 82px);
  font-weight: 700;
  letter-spacing: -3px;
  line-height: 1.0;
  color: var(--text-primary);
}

.hero h1 em {
  font-style: normal;
  display: inline-block;
  position: relative;
}

.hero h1 em svg {
  color: var(--accent);
  position: absolute;
  z-index: -1;
  top: 0.88em;
  left: 0;
  width: 100%;
  height: auto;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  margin-top: 0.6rem;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.hero-btns {
  margin-top: 1.75rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: filter 0.12s;
  letter-spacing: -0.01em;
}

.btn-accent:hover {
  filter: brightness(0.92);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 400;
  text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
  letter-spacing: -0.01em;
}

.btn-outline:hover {
  border-color: #aaa;
  color: var(--text-primary);
}

/* ── HERO EXAMPLES — griglia 3D ──
   perspective(75em) rotateX(30deg) rotateZ(-7deg) + drop-in animation */

.hero-examples {
  position: absolute;
  /* Esteso 120px sotto l'hero: le punte degli esagoni sconfinano nell'area
     delle card trasparenti. Il mask controlla l'opacità in quella zona. */
  top: 0;
  left: 0;
  right: 0;
  bottom: -120px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  /* Mask calcolata sull'altezza estesa (720+120=840px).
     50% = 420px (sotto testo) → fade-in
     67% = 563px → completamente visibili
     82% = 689px → inizio dissolvenza (dentro hero)
     91% = 764px → nell'area card, opacità ~28%
     100% = 840px → trasparente */
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent        0%,
    transparent        50%,
    rgba(0,0,0,0.45)   59%,
    black              67%,
    black              82%,
    rgba(0,0,0,0.28)   91%,
    transparent        100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent        0%,
    transparent        50%,
    rgba(0,0,0,0.45)   59%,
    black              67%,
    black              82%,
    rgba(0,0,0,0.28)   91%,
    transparent        100%
  );
}

.examples {
  position: absolute;
  /* Anchor sotto il blocco testo (hero-inner bottom ≈ 422px dall'hero top).
     Il grid è centrato orizzontalmente al 50%: si espande da -4 a +4,
     coprendo tutta la larghezza del viewport in modo equilibrato. */
  top: 420px;
  left: 50%;
  --grid-width: 140px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
  transition: transform 0.15s ease-out;
}

@media (min-width: 640px) {
  .examples { --grid-width: 160px; }
}

@media (min-width: 960px) {
  .examples { --grid-width: 200px; }
}

.examples > div {
  position: relative;
  transition: filter 0.25s ease-out;
  animation: fade-in 0.35s cubic-bezier(.215, .61, .355, 1) var(--delay, 0s) backwards;
  pointer-events: auto;
}

.examples > div:hover {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  z-index: 3;
}

.examples a {
  position: absolute;
  --transform: perspective(75em) rotateX(30deg) rotateZ(-7deg)
    translate(calc(var(--x, 0) * 100%), calc(var(--y, 0) * 86.67%))
    scale(1.145);
  transform: var(--transform);
  animation: drop-in 0.35s cubic-bezier(.215, .61, .355, 1) var(--delay, 0s) backwards;
  transition: transform 0.25s ease-out;
  clip-path: polygon(50% 100%, 93.3% 75%, 93.3% 25%, 50% 0%, 6.7% 25%, 6.7% 75%);
  width: var(--grid-width);
  height: var(--grid-width);
  overflow: hidden;
  text-decoration: none;
}

.examples a:hover {
  transform: var(--transform) translateZ(10px) scale(1.1);
}

.examples a img {
  aspect-ratio: 1;
  object-fit: cover;
  width: var(--grid-width);
  display: block;
}

@keyframes fade-in {
  from { filter: blur(20px); opacity: 0; }
  to   { filter: none; opacity: 1; }
}

@keyframes drop-in {
  from { transform: var(--transform) translateY(-100px) translateZ(400px); }
  to   { transform: var(--transform); }
}

.tooltip {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

.examples a:hover .tooltip {
  opacity: 1;
}

/* Fade overlay separati disabilitati: il mask-image su .hero-examples
   gestisce tutta la dissolvenza senza conflitti di compositing layer. */
.fade-top, .fade-top-strip, .fade-left, .fade-right, .fade-bottom { display: none; }

/* ── SEZIONI ── */

.section {
  padding: 5rem 2rem;
  position: relative;
  background: var(--bg);
  z-index: 10;
}

/* Servizi: background trasparente → le punte degli esagoni (overflow
   dall'hero) sono visibili attraverso le card semi-trasparenti */
#servizi {
  background: transparent;
  padding-top: 2rem;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 2.5rem;
}

/* ── SERVIZI ── */

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.service-item {
  padding: 2rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.18s ease, background 0.18s ease;
}

/* Prima riga (esagoni visibili attraverso): quasi completamente trasparente */
.service-item:nth-child(-n+3) {
  background: rgba(255, 255, 255, 0.08);
}

/* Seconda riga: meno trasparente (meno esagoni sotto) */
.service-item:nth-child(n+4) {
  background: rgba(255, 255, 255, 0.55);
}

.service-item:hover {
  box-shadow: 0 0 0 2px var(--accent);
  background: rgba(255, 255, 255, 0.75);
}

.service-item h3 {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.service-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ── STACK — tag tecnici in monospace ── */

.stack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--bg);
  transition: border-color 0.12s, color 0.12s;
}

.pill:hover {
  border-color: #bbb;
  color: var(--text-primary);
}

.pill-primary {
  color: var(--text-primary);
  border-color: #c8c8c8;
  font-weight: 500;
  background: var(--bg-subtle);
}

/* ── INFRASTRUTTURA — statistiche flat, impatto massimo ── */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.metric-card {
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--border);
}

.metric-card:last-child {
  border-right: none;
}

.metric-value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text-primary);
}

.metric-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.4;
}

/* ── PROGETTI — lista essenziale, domain monospace ── */

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.project-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.project-list li:first-child {
  border-top: 1px solid var(--border);
}

.dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.project-list a {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  flex-wrap: wrap;
  transition: color 0.12s;
}

.project-list a:hover {
  color: var(--accent);
}

.project-list a:hover .project-desc {
  color: var(--text-secondary);
}

.project-desc {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0;
}

/* ── FOOTER ── */

footer {
  border-top: 1px solid var(--border);
}

.footer-sat {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.footer-sat-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 2rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.footer-sat-inner a {
  font-size: 11.5px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.12s;
  white-space: nowrap;
}

.footer-sat-inner a:hover {
  color: var(--text-primary);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

.footer-tagline {
  font-size: 12px;
  color: var(--text-tertiary);
}

.footer-cta {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent) !important;
  transition: opacity 0.12s;
}

.footer-cta:hover {
  opacity: 0.8;
}

.footer-links {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.footer-links a {
  font-size: 12px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.12s;
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* ── DIVIDER ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ── RESPONSIVE 768px ── */

@media (max-width: 768px) {

  /* navbar */
  .nav-links {
    display: none;
  }

  .nav-cta {
    margin-left: auto;
  }

  .hamburger {
    display: flex;
  }

  /* hero: su mobile esagoni visibili ma più piccoli */
  .hero {
    padding: 60px 1.5rem 56px;
    min-height: 580px;
  }

  .examples {
    top: 320px;
    --grid-width: 110px;
  }

  .hero h1 {
    font-size: 42px;
    letter-spacing: -1.5px;
    line-height: 1.05;
  }

  .hero p {
    font-size: 16px;
    max-width: 100%;
    margin-top: 0.5rem;
  }

  /* sezioni */
  .section {
    padding: 3.5rem 1.5rem;
  }

  /* servizi */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* infrastruttura */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-card {
    border-bottom: 1px solid var(--border);
  }

  .metric-card:nth-child(even) {
    border-right: none;
  }

  .metric-card:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .metric-value {
    font-size: 32px;
    letter-spacing: -1px;
  }

  /* progetti */
  .project-list a {
    flex-direction: column;
    gap: 3px;
  }

  /* footer */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
}
