/* ===================================================================
   Daniele Castaldo — Personal Site
   =================================================================== */

/* === Variables ===================================================== */
:root {
  --dark:        #0b1629;
  --dark-2:      #0f1e38;
  --dark-3:      #162040;
  --accent:      #2563eb;
  --accent-h:    #1d4ed8;
  --light:       #f3f5f8;
  --white:       #ffffff;
  --text:        #1a202c;
  --text-m:      #64748b;
  --text-on:     #e8edf5;
  --text-on-m:   #94a3b8;
  --border:      #e2e8f0;

  --nav-h:       68px;
  --r:           10px;
  --r-lg:        16px;
  --sp:          clamp(5rem, 8vw, 8rem);
  --cont:        1140px;
  --pad:         clamp(1.25rem, 4vw, 3rem);

  --ease:        0.25s ease;
  --ease-slow:   0.55s cubic-bezier(0.16, 1, 0.3, 1);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  font-size: 16px;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img     { display: block; max-width: 100%; height: auto; }
a       { color: inherit; text-decoration: none; }
ul      { list-style: none; }
button  { cursor: pointer; border: none; background: none; font-family: inherit; }
strong  { font-weight: 600; }

/* === Typography ==================================================== */
h1, h2, h3 {
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
}
h1 { font-size: clamp(3rem, 8vw, 5.75rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }

p { max-width: 64ch; }

.overline {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.875rem;
}
.overline-light { color: rgba(120, 175, 255, 0.85); }

/* === Layout helpers ================================================ */
.container {
  width: 100%;
  max-width: var(--cont);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.section { padding: var(--sp) 0; }

.section-light { background: var(--light); }

.section-dark {
  background: var(--dark-2);
  color: var(--text-on);
}
.section-dark h2 { color: var(--white); }
.section-dark h3 { color: var(--white); }
.section-dark p  { color: var(--text-on-m); }

.section-contact {
  background: var(--dark);
  color: var(--text-on);
  padding: clamp(5rem, 8vw, 8rem) 0;
}
.section-contact h2 { color: var(--white); }

.section-header        { margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-header.centered {
  text-align: center;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.section-header h2 { margin-bottom: 1rem; }

.section-sub {
  font-size: 1.05rem;
  color: var(--text-m);
  margin-top: 0.5rem;
  max-width: 52ch;
}
.section-dark .section-sub,
.section-contact .section-sub { color: var(--text-on-m); }
.section-header.centered .section-sub { margin-left: auto; margin-right: auto; }

/* === Buttons ======================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  transition: all var(--ease);
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.btn-primary:hover {
  background: var(--accent-h);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(37,99,235,0.4);
}
.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.8);
  border: 1.5px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover {
  border-color: rgba(255,255,255,0.5);
  color: var(--white);
  background: rgba(255,255,255,0.05);
}
.btn-lg {
  padding: 0.9rem 2.5rem;
  font-size: 0.95rem;
}

/* === Navigation ==================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  transition: background var(--ease), box-shadow var(--ease);
}
.nav.scrolled {
  background: rgba(10, 20, 40, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.07);
}

.nav-inner {
  height: 100%;
  max-width: var(--cont);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  transition: opacity var(--ease);
}
.nav-brand:hover { opacity: 0.8; }

.nav-logo-wrap {
  width: 38px;
  height: 38px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.nav-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.nav-links a {
  color: rgba(255,255,255,0.65);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  transition: all var(--ease);
}
.nav-links a:hover,
.nav-links a.active-link { color: var(--white); background: rgba(255,255,255,0.07); }

.nav-cta {
  background: var(--accent) !important;
  color: var(--white) !important;
  padding: 0.4rem 1rem !important;
  margin-left: 0.25rem;
}
.nav-cta:hover { background: var(--accent-h) !important; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border-radius: 6px;
  transition: background var(--ease);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all var(--ease);
}
.nav-toggle:hover { background: rgba(255,255,255,0.06); }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === Hero ========================================================== */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-h) + 4rem) 0 6rem;
  background:
    radial-gradient(ellipse at 75% 15%, rgba(37, 99, 235, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse at 15% 85%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
    linear-gradient(160deg, var(--dark) 0%, var(--dark-3) 100%);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  max-width: var(--cont);
  margin: 0 auto;
  padding: 0 var(--pad);
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(120, 175, 255, 0.7);
  margin-bottom: 1.5rem;
  max-width: none;
}

.hero-name {
  color: var(--white);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 1.5rem;
  line-height: 1.05;
}

.hero-desc {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-on-m);
  line-height: 1.7;
  margin-bottom: 2.75rem;
  max-width: 50ch;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}


/* === About ========================================================= */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(3rem, 6vw, 5rem);
  align-items: start;
}

.about-text { max-width: 100%; }
.about-text h2 { margin-bottom: 1.5rem; }
.about-text p  { color: var(--text-m); margin-bottom: 1rem; max-width: 100%; }
.about-text .about-lead {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.7;
}
.about-text strong { color: var(--text); }
.about-text em     { font-style: normal; color: var(--accent); font-weight: 600; }

.about-profile { padding-top: 0.25rem; }

.profile-head {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 1.75rem;
  letter-spacing: -0.02em;
}

.profile-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.profile-items li {
  font-size: 0.875rem;
  color: var(--text-m);
  padding-left: 1.25rem;
  position: relative;
  line-height: 1.5;
}

.profile-items li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.56em;
  width: 8px;
  height: 1.5px;
  background: var(--accent);
}

/* === Collaborazioni ================================================ */
.collab-intro {
  max-width: 560px;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.collab-intro h2 { margin-bottom: 1rem; }
.collab-intro .section-sub { margin-top: 0; }

.collab-list {
  display: flex;
  flex-direction: column;
}

.collab-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem 4rem;
  align-items: center;
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}
.collab-item:last-child { border-bottom: 1px solid var(--border); }

.collab-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.collab-logo-wrap img {
  max-width: 180px;
  max-height: 68px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.collab-text h3 {
  font-size: 1.2rem;
  margin-bottom: 0.65rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.collab-text p {
  color: var(--text-m);
  font-size: 0.95rem;
  line-height: 1.75;
  max-width: 58ch;
}

/* === Expertise ===================================================== */
.expertise-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.exp-card {
  background: rgba(255,255,255,0.025);
  padding: 2.25rem 2rem;
  transition: background var(--ease);
}
.exp-card:hover { background: rgba(255,255,255,0.05); }

.exp-icon {
  color: var(--accent);
  margin-bottom: 1.25rem;
  opacity: 0.9;
}
.exp-card h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.exp-card p  { font-size: 0.875rem; line-height: 1.7; max-width: 100%; }

.expertise-note {
  margin-top: 2.5rem;
  padding: 1.75rem 2rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.expertise-note-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(120, 175, 255, 0.7);
  margin-bottom: 0.5rem;
}
.expertise-note p {
  font-size: 0.875rem;
  color: var(--text-on-m);
  line-height: 1.7;
  max-width: 72ch;
}

/* === Experience / Timeline ========================================= */
.timeline {
  position: relative;
  max-width: 740px;
  padding-left: 1px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: var(--border);
}

.tl-item {
  position: relative;
  padding-left: 2.5rem;
  padding-bottom: 3rem;
}
.tl-item:last-child { padding-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -5px;
  top: 8px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border);
  border: 2.5px solid var(--light);
}
.tl-dot-accent { background: var(--accent); border-color: var(--light); }

.tl-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.tl-period {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-m);
}
.tl-company {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
}

.tl-role {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}

.tl-body p {
  color: var(--text-m);
  font-size: 0.925rem;
  margin-bottom: 0.75rem;
  max-width: 100%;
}
.tl-body p:last-child { margin-bottom: 0; }

.tl-sectors {
  font-size: 0.85rem;
  color: var(--text-m);
  max-width: 100%;
  margin-top: 0;
  font-style: italic;
}

/* === Operations ==================================================== */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.ops-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--r-lg);
  padding: 2.25rem 2rem;
  transition: all var(--ease);
}
.ops-card:hover {
  background: rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

.ops-num {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1.1rem;
  opacity: 0.8;
}
.ops-card h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.ops-card p  { font-size: 0.875rem; line-height: 1.7; max-width: 100%; }

/* === Risultati ===================================================== */
.risultati-list {
  display: flex;
  flex-direction: column;
}

.risultato {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0 3rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  align-items: start;
}
.risultato:last-child { border-bottom: 1px solid var(--border); }

.risultato-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--border);
  letter-spacing: -0.04em;
  line-height: 1;
  padding-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}

.risultato-body h3 {
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}
.risultato-body p {
  color: var(--text-m);
  font-size: 0.95rem;
  line-height: 1.75;
  max-width: 64ch;
}

/* Stagger — risultati */
.risultati-list .risultato:nth-child(2) { transition-delay: 0.1s; }
.risultati-list .risultato:nth-child(3) { transition-delay: 0.2s; }

/* === Contact ======================================================= */
.contact-inner { max-width: 660px; }
.contact-inner h2 { margin-bottom: 1rem; }

.contact-sub {
  font-size: 1.05rem;
  color: var(--text-on-m);
  margin-bottom: 3rem;
  max-width: 52ch;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem 3rem;
  margin-bottom: 3rem;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.contact-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(120, 175, 255, 0.7);
}
.contact-value {
  font-size: 1rem;
  color: var(--white);
  font-weight: 500;
  transition: color var(--ease);
}
a.contact-value:hover { color: rgba(120, 175, 255, 0.9); }

.contact-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* === Footer ======================================================== */
.footer {
  background: var(--dark);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 2rem 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: opacity var(--ease);
}
.footer-brand-link:hover { opacity: 0.65; }

.footer-logo-wrap {
  width: 30px;
  height: 30px;
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.footer-logo-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.footer-brand-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.footer-brand {
  font-weight: 700;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.75);
  line-height: 1;
}

.footer-tagline {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.01em;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  text-align: right;
}

.footer-location {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.22);
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.28);
}


/* === Scroll animations ============================================= */
.animate-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--ease-slow), transform var(--ease-slow);
}
.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger — expertise */
.expertise-grid .exp-card:nth-child(2) { transition-delay: 0.06s; }
.expertise-grid .exp-card:nth-child(3) { transition-delay: 0.12s; }
.expertise-grid .exp-card:nth-child(4) { transition-delay: 0.06s; }
.expertise-grid .exp-card:nth-child(5) { transition-delay: 0.12s; }
.expertise-grid .exp-card:nth-child(6) { transition-delay: 0.18s; }

/* Stagger — ops */
.ops-grid .ops-card:nth-child(2) { transition-delay: 0.06s; }
.ops-grid .ops-card:nth-child(3) { transition-delay: 0.12s; }
.ops-grid .ops-card:nth-child(4) { transition-delay: 0.06s; }
.ops-grid .ops-card:nth-child(5) { transition-delay: 0.12s; }
.ops-grid .ops-card:nth-child(6) { transition-delay: 0.18s; }

/* Stagger — timeline */
.timeline .tl-item:nth-child(2) { transition-delay: 0.1s; }
.timeline .tl-item:nth-child(3) { transition-delay: 0.2s; }
.timeline .tl-item:nth-child(4) { transition-delay: 0.3s; }
.timeline .tl-item:nth-child(5) { transition-delay: 0.35s; }
.timeline .tl-item:nth-child(6) { transition-delay: 0.4s; }

/* Stagger — collab */
.collab-list .collab-item:nth-child(2) { transition-delay: 0.1s; }
.collab-list .collab-item:nth-child(3) { transition-delay: 0.2s; }

/* === Responsive — Tablet (≤1024px) ================================ */
@media (max-width: 1024px) {
  .expertise-grid { grid-template-columns: repeat(2, 1fr); }
  .ops-grid        { grid-template-columns: repeat(2, 1fr); }

  .collab-item {
    grid-template-columns: 180px 1fr;
    gap: 1.5rem 3rem;
  }
}

/* === Responsive — Mobile (≤768px) ================================= */
@media (max-width: 768px) {
  :root { --nav-h: 60px; }

  /* Nav */
  .nav-name   { display: none; }
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(10, 20, 40, 0.97);
    backdrop-filter: blur(14px);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1.25rem;
    gap: 0.1rem;
    transform: translateY(-110%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--ease), opacity var(--ease);
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-links li { width: 100%; }
  .nav-links a  { display: block; padding: 0.75rem 1rem; font-size: 0.9rem; border-radius: 8px; }
  .nav-cta      { margin-left: 0; margin-top: 0.25rem; text-align: center; }

  /* Hero */
  .br-d { display: none; }
  .hero-desc    { max-width: 100%; }
  .hero-actions { flex-direction: column; align-items: flex-start; }

  /* About */
  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }

  /* Collab */
  .collab-item {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2.25rem 0;
  }
  .collab-logo-wrap img {
    max-width: 140px;
    max-height: 52px;
  }

  /* Expertise */
  .expertise-grid { grid-template-columns: 1fr; gap: 0; }

  /* Ops */
  .ops-grid { grid-template-columns: 1fr; }

  /* Contact */
  .contact-grid { grid-template-columns: 1fr; gap: 1.5rem; }

  /* Risultati */
  .risultato {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding: 2rem 0;
  }
  .risultato-num { font-size: 1.1rem; color: var(--accent); opacity: 0.5; }

  /* Footer */
  .footer-inner   { flex-direction: column; align-items: center; gap: 1rem; }
  .footer-meta    { align-items: center; text-align: center; }

  .section-header { max-width: 100%; }
}

/* === Responsive — Small (≤480px) ================================== */
@media (max-width: 480px) {
  h1 { font-size: clamp(2.6rem, 11vw, 3.5rem); }
  .tl-item { padding-left: 2rem; }
}

/* === Reduced motion =============================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .animate-in { opacity: 1; transform: none; }
}
