/* ==========================================================================
   Diego Mazzei — Portfolio
   base.css — font, token di design, reset, tipografia, componenti di base
   ========================================================================== */

/* ---------- Font (self-hosted, nessuna richiesta esterna) ---------- */
@font-face {
  font-family: 'Bricolage';
  src: url('../fonts/bricolage-grotesque-var.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InterTight';
  src: url('../fonts/inter-tight-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'InstrumentSerif';
  src: url('../fonts/instrument-serif-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- Token ---------- */
:root {
  /* Colore — direzione "Notte editoriale" */
  --ink:        #0B0B0C;
  --ink-1:      #111113;
  --ink-2:      #17171A;
  --ink-3:      #202024;
  --cream:      #F4F1EA;
  --cream-dim:  #CFCBC2;
  --muted:      #A5A29B;   /* 7.3:1 su --ink */
  --lime:       #C6F24E;
  --lime-soft:  #DCF98C;
  --line:       rgba(244, 241, 234, 0.14);
  --line-soft:  rgba(244, 241, 234, 0.07);

  /* Tipografia */
  --font-display: 'Bricolage', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'InterTight', 'Helvetica Neue', Arial, sans-serif;
  --font-accent:  'InstrumentSerif', Georgia, 'Times New Roman', serif;

  /* Scala fluida */
  --step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1rem, 0.96rem + 0.22vw, 1.13rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.32rem + 0.9vw, 2.1rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.4rem);
  --step-4:  clamp(2.4rem, 1.7rem + 3.5vw, 4.9rem);
  --step-5:  clamp(2.9rem, 1.5rem + 6.1vw, 7.4rem);

  /* Spazio */
  --gap:      clamp(1rem, 0.8rem + 1vw, 1.6rem);
  --section:  clamp(5rem, 3.5rem + 7vw, 11rem);
  --pad-x:    clamp(1.15rem, 0.6rem + 3vw, 4rem);
  --max:      1280px;

  /* Movimento */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);

  --radius: 18px;
  --radius-lg: 28px;

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.006em;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

em { font-family: var(--font-accent); font-style: italic; letter-spacing: -0.01em; }

::selection { background: var(--lime); color: var(--ink); }

/* ---------- Focus visibile e accessibilità ---------- */
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 999;
  padding: 0.7rem 1.1rem;
  background: var(--lime);
  color: var(--ink);
  border-radius: 999px;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.25s var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.section { padding-block: var(--section); position: relative; }

.section__head { max-width: 62ch; margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 5rem); }

.section__label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.6rem;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lime);
}

.section__title {
  font-size: var(--step-3);
  max-width: 18ch;
}

.section__intro {
  margin-top: 1.5rem;
  max-width: 54ch;
  color: var(--muted);
  font-size: var(--step-1);
  line-height: 1.55;
}

/* ---------- Grana e alone che segue il mouse ---------- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  top: 0; left: 0;
  z-index: 0;
  width: 34rem;
  height: 34rem;
  margin: -17rem 0 0 -17rem;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, rgba(198, 242, 78, 0.10), rgba(198, 242, 78, 0) 62%);
  transition: opacity 0.6s var(--ease);
  will-change: transform;
}

/* ---------- Bottoni ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--cream);
  --btn-bd: var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid var(--btn-bd);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-0);
  letter-spacing: -0.015em;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.35s var(--ease), color 0.35s var(--ease), background-color 0.35s var(--ease);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--lime);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease);
}

.btn__arrow {
  display: inline-block;
  transition: transform 0.4s var(--ease);
}

.btn--lg { padding: 1.1rem 2rem; font-size: var(--step-1); }
.btn--sm { padding: 0.62rem 1.15rem; font-size: var(--step--1); }
.btn--block { width: 100%; }

.btn--accent {
  --btn-bg: var(--lime);
  --btn-fg: var(--ink);
  --btn-bd: var(--lime);
}
.btn--accent::before { background: var(--cream); }

.btn--ghost { --btn-bd: var(--line); }

@media (hover: hover) {
  .btn:hover { color: var(--ink); border-color: var(--lime); }
  .btn:hover::before { transform: translateY(0); }
  .btn--accent:hover { border-color: var(--cream); }
  .btn:hover .btn__arrow { transform: translate(0.22rem, 0); }
  .btn--ghost:hover .btn__arrow,
  .btn--accent:hover .btn__arrow { transform: translate(0.22rem, -0.05rem); }
}

.btn:active { transform: scale(0.985); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  padding-block: 0.9rem;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), padding 0.4s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.is-stuck {
  background: rgba(11, 11, 12, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line-soft);
}

.site-header.is-hidden { transform: translateY(-105%); }
.site-header { transition-property: background-color, border-color, transform, padding; }

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--gap);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: var(--step-0);
}
.brand__mark { color: var(--lime); display: block; width: 26px; }
.brand__mark svg { width: 26px; height: 26px; }
.brand__text { white-space: nowrap; }

.nav__list { display: flex; gap: clamp(1rem, 2vw, 2rem); }

.nav__list a {
  position: relative;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--cream-dim);
  padding-block: 0.4rem;
  transition: color 0.3s var(--ease);
}
.nav__list a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}
@media (hover: hover) {
  .nav__list a:hover { color: var(--cream); }
  .nav__list a:hover::after { transform: scaleX(1); transform-origin: left; }
}
.nav__list a.is-active { color: var(--lime); }

.burger {
  display: none;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.burger span {
  position: absolute;
  left: 50%;
  width: 17px; height: 1.6px;
  background: var(--cream);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: transform 0.4s var(--ease), opacity 0.25s linear;
}
.burger span:nth-child(1) { top: 18px; }
.burger span:nth-child(2) { top: 24px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateX(-50%) translateY(3px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { transform: translateX(-50%) translateY(-3px) rotate(-45deg); }

/* ---------- Menu mobile ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: var(--ink-1);
  display: grid;
  place-items: center;
  opacity: 0;
}
.mobile-menu[hidden] { display: none; }

.mobile-menu__inner {
  width: min(100%, 520px);
  padding: 6rem var(--pad-x) 2.5rem;
}
.mobile-menu li + li { margin-top: 0.4rem; }
.mobile-menu a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 9vw, 3rem);
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.mobile-menu a span {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--lime);
}
.mobile-menu__foot {
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 2;
  padding-block: clamp(3.5rem, 2rem + 5vw, 7rem) 2.5rem;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-1) 100%);
}

.site-footer__big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-4);
  line-height: 0.98;
  letter-spacing: -0.04em;
  max-width: 14ch;
  margin-bottom: clamp(2.5rem, 1.5rem + 3vw, 4.5rem);
}

.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 2rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.8rem;
  border-top: 1px solid var(--line-soft);
  font-size: var(--step--1);
  color: var(--muted);
}
.site-footer__sign { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.site-footer__dot { opacity: 0.5; }
.site-footer__links { display: flex; gap: 1.4rem; }
.site-footer__links a { position: relative; transition: color 0.3s var(--ease); }
@media (hover: hover) { .site-footer__links a:hover { color: var(--lime); } }

/* ---------- WhatsApp flottante ---------- */
.wa-float {
  position: fixed;
  right: clamp(0.9rem, 2vw, 1.6rem);
  bottom: clamp(0.9rem, 2vw, 1.6rem);
  z-index: 80;
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 999px;
  background: var(--lime);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.4s var(--ease), background-color 0.3s var(--ease);
}
@media (hover: hover) {
  .wa-float:hover { transform: scale(1.08) rotate(-6deg); background: var(--lime-soft); }
}

/* ---------- Responsive header ---------- */
@media (max-width: 860px) {
  .nav, .site-header__cta { display: none; }
  .burger { display: block; }
  html { scroll-padding-top: 76px; }
}
