/* =========================================================================
   AI in azienda — sistema di stile del sito del corso
   Estetica: "manuale editoriale" — carta avorio, inchiostro, accento vermiglio.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..700&family=Spectral:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --paper:      #F4EFE4;
  --paper-2:    #ECE4D3;
  --paper-3:    #E3D9C3;
  --ink:        #1C1A15;
  --ink-soft:   #514C40;
  --line:       #C9BCA1;
  --accent:     #B23A2E;
  --accent-deep:#8C2A21;
  --gold:       #9A7B2E;

  --serif-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --serif-body:    'Spectral', Georgia, serif;
  --mono:          'IBM Plex Mono', ui-monospace, monospace;

  --maxw: 1140px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 1.075rem;
  line-height: 1.65;
  font-feature-settings: "liga" 1, "onum" 1;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}
/* grana di carta sottile */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- layout ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
section { position: relative; z-index: 2; }

/* ---------- tipografia ---------- */
h1, h2, h3 { font-family: var(--serif-display); font-weight: 600; line-height: 1.04; letter-spacing: -0.01em; }
.display {
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.025em;
}
.display em { font-style: italic; color: var(--accent); font-weight: 500; }
h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
h3 { font-size: 1.35rem; }
.lead { font-size: clamp(1.15rem, 2vw, 1.4rem); color: var(--ink-soft); line-height: 1.5; }
p + p { margin-top: 1rem; }

.label {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.label--muted { color: var(--ink-soft); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.wordmark { font-family: var(--serif-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: .5rem; }
.wordmark .dot { color: var(--accent); }
.nav { display: flex; gap: 1.6rem; align-items: center; }
.nav a { font-family: var(--mono); font-size: .8rem; letter-spacing: .04em; color: var(--ink-soft); padding: .25rem 0; border-bottom: 1.5px solid transparent; transition: color .2s, border-color .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }
.nav .nav-cta { color: var(--accent-deep); }
.menu-toggle { display: none; }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--mono); font-size: .82rem; letter-spacing: .04em;
  padding: .85rem 1.4rem; border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink); cursor: pointer;
  transition: transform .15s ease, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--accent { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn--accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn .arr { transition: transform .2s; }
.btn:hover .arr { transform: translateX(4px); }

/* ---------- hero ---------- */
.hero { padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 6vw, 5rem); border-bottom: 1px solid var(--line); }
.hero .label { margin-bottom: 1.5rem; }
.hero .display { max-width: 16ch; }
.hero .lead { margin-top: 1.6rem; max-width: 48ch; }
.hero-actions { margin-top: 2.4rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-meta { margin-top: 3rem; display: flex; gap: 2.5rem; flex-wrap: wrap; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.hero-meta div { max-width: 22ch; }
.hero-meta .num { font-family: var(--serif-display); font-size: 2rem; color: var(--accent); display: block; line-height: 1; }
.hero-meta small { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; color: var(--ink-soft); text-transform: uppercase; }

/* ---------- sezioni numerate ---------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; border-bottom: 1px solid var(--line); }
.section-head { display: flex; gap: 1.5rem; align-items: flex-start; margin-bottom: 2.5rem; }
.section-num { font-family: var(--mono); font-size: .8rem; color: var(--accent-deep); padding-top: .6rem; letter-spacing: .1em; }
.section-head h2 { max-width: 20ch; }
.section-head .lead { margin-top: .8rem; max-width: 56ch; }

/* ---------- griglie / card ---------- */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 1.8rem; position: relative; transition: transform .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card .label { margin-bottom: .9rem; display: block; }
.card h3 { margin-bottom: .6rem; }
.card p { color: var(--ink-soft); font-size: .98rem; }

/* ---------- callout (il caso) ---------- */
.callout {
  background: var(--ink); color: var(--paper);
  padding: clamp(2rem, 5vw, 3.5rem); border-left: 6px solid var(--accent);
}
.callout .label { color: #E9A99F; }
.callout h2 { color: var(--paper); margin: 1rem 0; }
.callout p { color: #D8D2C4; max-width: 60ch; }
.callout .src { font-family: var(--mono); font-size: .72rem; color: #9b948a; margin-top: 1.2rem; letter-spacing: .04em; }

/* ---------- banda CTA ---------- */
.cta-band { background: var(--accent); color: var(--paper); text-align: center; padding: clamp(3rem, 7vw, 5.5rem) 0; }
.cta-band h2 { color: var(--paper); max-width: 22ch; margin-inline: auto; }
.cta-band .lead { color: #F3D9D4; margin: 1.2rem auto 2rem; max-width: 50ch; }
.cta-band .btn { border-color: var(--paper); color: var(--paper); }
.cta-band .btn:hover { background: var(--paper); color: var(--accent-deep); }

/* ---------- liste ---------- */
.feature-list { list-style: none; padding: 0; }
.feature-list li { padding: 1.1rem 0; border-top: 1px solid var(--line); display: flex; gap: 1rem; }
.feature-list li::before { content: "→"; color: var(--accent); font-family: var(--mono); }
.feature-list li:last-child { border-bottom: 1px solid var(--line); }

/* ---------- moduli ---------- */
.module { border-top: 1px solid var(--line); padding: 1.6rem 0; display: grid; grid-template-columns: auto 1fr auto; gap: 1.5rem; align-items: baseline; }
.module:last-child { border-bottom: 1px solid var(--line); }
.module .m-num { font-family: var(--mono); color: var(--accent-deep); font-size: .85rem; }
.module h3 { font-size: 1.2rem; }
.module p { color: var(--ink-soft); font-size: .95rem; margin-top: .3rem; }
.module .tag { font-family: var(--mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); border: 1px solid var(--line); padding: .2rem .5rem; white-space: nowrap; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: var(--paper-3); padding: clamp(3rem,6vw,4.5rem) 0 2rem; position: relative; z-index: 2; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 2.5rem; justify-content: space-between; }
.site-footer h4 { font-family: var(--mono); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #9b948a; margin-bottom: 1rem; }
.site-footer a { color: var(--paper-3); display: block; padding: .25rem 0; font-size: .95rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer .brand { font-family: var(--serif-display); font-size: 1.6rem; max-width: 16ch; }
.site-footer .fine { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid #3a362e; font-family: var(--mono); font-size: .72rem; color: #847d72; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.placeholder { color: var(--accent); font-family: var(--mono); font-size: .85em; }
.site-footer .soon { color: var(--paper-3); display: block; padding: .25rem 0; font-size: .95rem; opacity: .55; }
.site-footer .fine a { display: inline; color: var(--paper-3); text-decoration: underline; }
.site-footer .fine a:hover { color: var(--accent); }

/* ---------- prose (pagine di testo) ---------- */
.prose { max-width: 64ch; }
.prose p { margin-top: 1.1rem; color: var(--ink); }
.prose h2 { margin-top: 2.5rem; }
.prose h3 { margin-top: 1.8rem; }
.prose ul { margin-top: 1rem; padding-left: 1.2rem; }
.prose li { margin-top: .5rem; }

/* ---------- motion ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .8s cubic-bezier(.2,.7,.2,1) both; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .15s; } .d3 { animation-delay: .25s; } .d4 { animation-delay: .35s; } .d5 { animation-delay: .45s; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 64px 0 auto 0; background: var(--paper); flex-direction: column; gap: 0; padding: 1rem var(--gutter); border-bottom: 1px solid var(--line); transform: translateY(-120%); transition: transform .3s ease; }
  .nav.open { transform: none; }
  .nav a { padding: .9rem 0; border-bottom: 1px solid var(--line); width: 100%; }
  .menu-toggle { display: inline-flex; font-family: var(--mono); font-size: .8rem; background: none; border: 1px solid var(--ink); padding: .4rem .7rem; cursor: pointer; }
  .module { grid-template-columns: auto 1fr; }
  .module .tag { grid-column: 2; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================================
   WOW LAYER — interattività e movimento
   ========================================================================= */

/* barra di avanzamento scroll */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100;
  pointer-events: none;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
}

/* ---- hero a due colonne con schema interattivo ---- */
.hero-grid {
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}
.hero-grid .display { font-size: clamp(2.3rem, 4.4vw, 4.2rem); }
.hero-grid .hero-meta { margin-top: 2.4rem; }

/* pannello "blueprint" */
.arch {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--paper-2) 75%, transparent),
    color-mix(in srgb, var(--paper-3) 55%, transparent));
  overflow: hidden;
}
.arch::before { /* griglia tecnica sottile dietro lo schema */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(circle at 58% 46%, #000 52%, transparent 100%);
          mask-image: radial-gradient(circle at 58% 46%, #000 52%, transparent 100%);
}
.arch canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.arch .arch-tag {
  position: absolute; left: 12px; bottom: 11px; z-index: 2;
  font-family: var(--mono); font-size: .62rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ink-soft);
  display: flex; align-items: center; gap: .5rem;
}
.arch .arch-tag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.arch .arch-corner { position: absolute; width: 13px; height: 13px; border: 1.5px solid var(--accent); z-index: 2; }
.arch .tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.arch .tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.arch .bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.arch .br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .arch { aspect-ratio: 16 / 10; }
}
@media (max-width: 560px) {
  .arch { display: none; } /* mobile leggero */
}

/* ---- contatori ---- */
.hero-meta .num { font-variant-numeric: tabular-nums; }

/* ---- reveal allo scroll (a blocco, niente conflitti con gli hover) ----
   Dietro html.js: senza JavaScript i contenuti restano visibili. */
html.js [data-reveal] {
  opacity: 0; transform: translateY(24px);
  transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1);
}
html.js [data-reveal].in { opacity: 1; transform: none; }

/* ---- card: filo d'accento che si estende all'hover ---- */
.card { overflow: hidden; }
.card::after {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0;
  background: var(--accent);
  transition: width .35s cubic-bezier(.2,.7,.2,1);
}
.card:hover::after { width: 100%; }

/* magnetic: il translate lo applica app.js */
.btn--accent { will-change: transform; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .arch .arch-tag::before { animation: none; }
  .scroll-progress { display: none; }
}
