/* ==========================================================================
   Marco Paolucci — foglio di stile principale
   Brand: Inchiostro / Carta / Teal · Schibsted Grotesk + JetBrains Mono
   ========================================================================== */

/* ----- 1. Token di design ----- */
:root {
  --ink: #16191F;          /* Inchiostro: testi, fondi scuri */
  --ink-2: #1F232A;        /* Inchiostro chiaro: hover su scuro */
  --paper: #F6F3EC;        /* Carta: fondo principale */
  --white: #FFFFFF;
  --accent: #34B2AB;       /* Teal operativo: CTA, numeri, barra del logo */
  --accent-ink: #2A8F89;   /* Teal scurito: testo su fondo chiaro (contrasto AA) */
  --graphite: #4A4F58;     /* Testo secondario */
  --line: #E3DFD6;         /* Bordi e divisori */
  --line-dark: rgba(246, 243, 236, 0.14);

  --font-sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --container: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --section-y: clamp(64px, 9vw, 120px);
  --header-h: 72px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ----- 2. Reset essenziale ----- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, figure, address { margin: 0; }
ul[role="list"], ol { list-style: none; padding: 0; }
address { font-style: normal; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--accent); color: var(--ink); padding: 12px 16px; font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ----- 3. Layout ----- */
.container { max-width: var(--container); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.section { padding-top: var(--section-y); padding-bottom: var(--section-y); }
.section--bordered { border-bottom: 1px solid var(--line); }
.section--white { background: var(--white); }
.section--dark { background: var(--ink); color: var(--paper); }

.stack { display: flex; flex-direction: column; gap: 24px; }
.stack--sm { gap: 14px; }
.stack--lg { gap: 36px; }
.stack--xl { gap: 48px; }

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 48px 72px;
}
.split--center { align-items: center; }
.split--start  { align-items: start; }
.split--end    { align-items: end; }
.split__media { display: flex; justify-content: center; min-width: 0; }
.split__media img { width: auto; height: auto; max-height: 640px; filter: saturate(.85); }

.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px; }

/* ----- 4. Tipografia ----- */
.display {
  font-size: clamp(48px, 7.2vw, 104px); line-height: .94; font-weight: 800;
  letter-spacing: -0.04em; text-wrap: balance;
}
.display--md { font-size: clamp(48px, 6.4vw, 88px); line-height: .95; }
.h2 { font-size: clamp(36px, 4.4vw, 56px); line-height: 1; font-weight: 800; letter-spacing: -0.035em; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.eyebrow--accent { color: var(--accent); }
.lead { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; max-width: 520px; text-wrap: pretty; }
.lead--on-dark { color: rgba(246, 243, 236, .82); }
.lead--strong { font-size: 19px; line-height: 1.5; font-weight: 500; max-width: none; }
.subhead { margin-top: 6px; font-size: 19px; font-weight: 600; }
.body { font-size: 18px; line-height: 1.6; color: var(--graphite); text-wrap: pretty; }
.body--strong { color: var(--ink); font-weight: 500; }
.body--on-dark { font-size: 16px; color: rgba(246, 243, 236, .75); }
.accent { color: var(--accent); }

/* ----- 5. Bottoni e link ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 22px; font-weight: 700; font-size: 16px; line-height: 1.2;
  text-decoration: none; border: 1px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn--sm { padding: 11px 16px; font-size: 14px; white-space: nowrap; }
.btn--block { width: 100%; margin-top: 20px; }
.btn--primary { background: var(--accent); color: var(--ink); }
.btn--primary:hover { background: var(--paper); color: var(--ink); }
.btn--outline { border-color: var(--ink); color: var(--ink); font-size: 15px; }
.btn--outline:hover { background: var(--ink); color: var(--paper); }
.btn--ghost-light { border-color: rgba(246, 243, 236, .5); color: var(--paper); }
.btn--ghost-light:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.link { font-weight: 700; font-size: 15px; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }

/* ----- 6. Header ----- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink); color: var(--paper);
  border-bottom: 1px solid rgba(246, 243, 236, .12);
}
.site-header__bar { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--paper); }
.brand:hover { color: var(--paper); }
.brand__mark { flex-shrink: 0; }
.brand__divider { width: 1px; height: 28px; background: rgba(246, 243, 236, .2); }
.brand__name { font-weight: 600; letter-spacing: .16em; font-size: 13px; white-space: nowrap; }

.nav { display: flex; align-items: center; gap: 24px; }
.nav__link {
  font-size: 14px; font-weight: 500; color: rgba(246, 243, 236, .7); text-decoration: none; white-space: nowrap;
  padding: 8px 0; border-bottom: 2px solid transparent; transition: color .2s ease, border-color .2s ease;
}
.nav__link:hover { color: var(--paper); border-bottom-color: var(--accent); }

.nav-toggle { display: none; width: 44px; height: 44px; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--paper); transition: transform .25s var(--ease), opacity .2s ease; }
.nav-toggle span:nth-child(2) { background: var(--accent); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.nav-mobile { border-top: 1px solid rgba(246, 243, 236, .12); padding: 8px var(--gutter) 24px; display: flex; flex-direction: column; }
.nav-mobile[hidden] { display: none; }
.nav-mobile__link {
  font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: var(--paper); text-decoration: none;
  padding: 16px 0; border-bottom: 1px solid rgba(246, 243, 236, .12);
}

/* Sotto 1100px le 7 voci non stanno in riga: si passa al menu a tendina */
@media (max-width: 1099px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }
}
@media (min-width: 1100px) {
  .nav-mobile { display: none !important; }
}

/* ----- 7. Hero ----- */
.hero__grid {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: clamp(48px, 7vw, 104px); align-items: end;
  padding-top: clamp(56px, 8vw, 112px); padding-bottom: clamp(56px, 8vw, 112px);
}
@media (min-width: 900px) { .hero__grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); } }
.hero__text { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.hero__media { position: relative; width: 100%; max-width: 440px; justify-self: end; min-width: 0; }
.hero__media img {
  width: 100%; height: auto; aspect-ratio: 4 / 5; max-height: 560px;
  object-fit: cover; object-position: 68% 50%;
  filter: grayscale(1) contrast(1.05);
}
.hero__stats { position: absolute; left: 0; bottom: 0; max-width: 100%; display: flex; gap: 1px; background: var(--line); }
.stat {
  background: var(--paper); color: var(--ink); min-width: 0;
  padding: clamp(14px, 3vw, 20px) clamp(14px, 3.5vw, 24px);
  display: flex; flex-direction: column; gap: 6px;
}
.stat__num { font-size: clamp(34px, 9vw, 52px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.stat__label { font-family: var(--font-mono); font-size: clamp(9px, 2.6vw, 11px); letter-spacing: .06em; text-transform: uppercase; color: var(--graphite); }

/* ----- 8. Griglie ----- */
.logo-grid, .kpi-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.logo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1000px) { .logo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.logo-grid__item { background: var(--white); height: 132px; display: flex; align-items: center; justify-content: center; padding: 20px 28px; }
.logo-grid__item img { max-height: 84px; width: auto; object-fit: contain; filter: grayscale(1); opacity: .85; transition: filter .3s ease, opacity .3s ease; }
.logo-grid__item:hover img { filter: none; opacity: 1; }

.kpi-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px)  { .kpi-grid, .contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpi-grid, .contact-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--paper); padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.kpi__num { font-size: clamp(56px, 6vw, 76px); font-weight: 800; letter-spacing: -0.045em; line-height: .9; }
.kpi__label { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.kpi__text { font-size: 15px; line-height: 1.55; color: var(--graphite); text-wrap: pretty; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 24px; }
.card { border-top: 3px solid var(--ink); padding-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.card__kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--graphite); }
.card__title { font-size: 26px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
.card__text { font-size: 16px; line-height: 1.55; color: var(--graphite); text-wrap: pretty; }

/* ----- 9. Accordion ruoli ----- */
.accordion { border-top: 1px solid var(--ink); }
.accordion__item { border-bottom: 1px solid var(--line); }
.accordion__heading { font-size: inherit; font-weight: inherit; }
.accordion__trigger {
  width: 100%; text-align: left; display: grid; grid-template-columns: 40px 1fr 32px;
  align-items: center; gap: 12px; padding: 22px 0; transition: color .2s ease;
}
.accordion__trigger:hover { color: var(--accent-ink); }
.accordion__num { font-family: var(--font-mono); font-size: 12px; color: var(--accent-ink); }
.accordion__title { font-size: clamp(20px, 2vw, 24px); font-weight: 700; letter-spacing: -0.01em; }
.accordion__icon { justify-self: end; position: relative; width: 14px; height: 14px; }
.accordion__icon::before, .accordion__icon::after {
  content: ""; position: absolute; left: 0; top: 6px; width: 14px; height: 2px; background: currentColor; transition: transform .25s var(--ease);
}
.accordion__icon::after { transform: rotate(90deg); }
.accordion__trigger[aria-expanded="true"] .accordion__icon { color: var(--accent-ink); }
.accordion__trigger[aria-expanded="true"] .accordion__icon::after { transform: rotate(0deg); }
.accordion__panel p { padding: 0 44px 26px 52px; font-size: 17px; line-height: 1.6; color: var(--graphite); text-wrap: pretty; }

/* Testo ruoli più largo, foto più stretta (desktop) */
@media (min-width: 900px) {
  .split--roles { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .split--roles .roles-media { max-width: 440px; justify-self: end; }
}
/* Foto ruoli ad altezza fissa (non segue l'apertura dell'accordion) */
.roles-media { position: relative; height: clamp(420px, 46vw, 600px); min-width: 0; width: 100%; }
.roles-media img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.roles-media__bar {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--paper);
  padding: 24px 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.roles-media__title { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }

/* ----- 10. Carosello ----- */
.carousel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.carousel__viewport {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 4 / 5; max-height: 640px;
  background: var(--line); touch-action: pan-y; cursor: grab;
}
.carousel__track { display: flex; height: 100%; transition: transform .6s var(--ease); }
.carousel__slide { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); user-select: none; pointer-events: none; }
.carousel__arrows { position: absolute; right: 0; bottom: 0; display: flex; }
.carousel__arrow {
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper); font-size: 18px; transition: background-color .2s ease, color .2s ease;
}
.carousel__arrow + .carousel__arrow { border-left: 1px solid var(--line-dark); }
.carousel__arrow:hover { background: var(--accent); color: var(--ink); }
.carousel__footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.carousel__dots { display: flex; gap: 4px; }
.carousel__dot { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.carousel__dot span { display: block; width: 8px; height: 8px; background: #C9C4BA; transition: width .3s ease, background-color .3s ease; }
.carousel__dot[aria-current="true"] span { width: 28px; background: var(--accent); }
.carousel__counter { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; color: var(--graphite); }

/* ----- 11. Curriculum ----- */
.cv-list { border-top: 1px solid var(--ink); }
.cv-list li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); align-items: baseline; font-size: 17px; line-height: 1.45; }
.cv-list__num { font-family: var(--font-mono); font-size: 12px; color: var(--accent-ink); }

/* ----- 12. Contatti ----- */
.contact-grid { display: grid; gap: 1px; background: var(--line-dark); border: 1px solid var(--line-dark); }
.contact { background: var(--ink); color: var(--paper); text-decoration: none; padding: 24px; display: flex; flex-direction: column; gap: 8px; transition: background-color .2s ease; }
.contact:hover { background: var(--ink-2); color: var(--paper); }
.contact__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.contact__value { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }

/* ----- 13. Footer ----- */
.site-footer { background: var(--ink); color: var(--paper); border-top: 1px solid var(--line-dark); }
.site-footer__bar { padding-top: 28px; padding-bottom: 28px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.site-footer__brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.site-footer__top { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: rgba(246, 243, 236, .7); text-decoration: none; }
.site-footer__top:hover { color: var(--accent); }
.site-footer__links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.site-footer__link { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: rgba(246, 243, 236, .7); text-decoration: none; }
.site-footer__link:hover { color: var(--accent); }

/* ----- 13b. Banner cookie ----- */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--ink); color: var(--paper);
  border-top: 1px solid var(--accent);
  box-shadow: 0 -12px 32px rgba(22, 25, 31, .25);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cookie-banner__inner {
  position: relative; padding-top: 22px; padding-bottom: 22px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 40px;
}
.cookie-banner__text { flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-right: 36px; }
.cookie-banner__body { font-size: 15px; line-height: 1.55; color: rgba(246, 243, 236, .82); text-wrap: pretty; }
.cookie-banner__body a { color: var(--paper); font-weight: 600; }
.cookie-banner__body a:hover { color: var(--accent); }
.cookie-banner__actions { display: flex; gap: 12px; flex-shrink: 0; }
.cookie-banner__actions .btn { min-width: 120px; }
.cookie-banner__close {
  position: absolute; top: 10px; right: calc(var(--gutter) - 12px);
  width: 36px; height: 36px; font-size: 24px; line-height: 1; color: rgba(246, 243, 236, .7);
}
.cookie-banner__close:hover { color: var(--accent); }
@media (max-width: 559px) {
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__actions .btn { flex: 1 1 0; }
}

/* ----- 13c. Pagina privacy ----- */
.legal { max-width: 760px; }
.legal h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-top: 56px; scroll-margin-top: calc(var(--header-h) + 24px); }
.legal h3 { font-size: 19px; font-weight: 700; margin-top: 28px; }
.legal p, .legal li { font-size: 17px; line-height: 1.65; color: var(--graphite); text-wrap: pretty; }
.legal p, .legal ul, .legal .table-wrap { margin-top: 14px; }
.legal ul { padding-left: 20px; }
.legal li + li { margin-top: 6px; }
.legal strong { color: var(--ink); }
.legal .table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--white); }
.legal table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.legal th { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--graphite); font-weight: 500; }
.legal tr:last-child td { border-bottom: 0; }
.legal code { font-family: var(--font-mono); font-size: .9em; }

/* ----- 14. Animazioni allo scroll ----- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--reveal-delay, 0ms); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .carousel__track, .accordion__icon::after { transition: none; }
}
