/* =========================================================
   Cool Stuff: base (token, reset, tipografia, header, footer,
   pulsanti, moduli, pagine semplici). Tema solo scuro: il museo è buio.
   ========================================================= */

@font-face { font-family: "Manrope"; src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
	/* Colore */
	--bg: #0b0a10;
	--bg-raised: #13111b;
	--bg-sunk: #08070c;
	--line: rgb(242 239 247 / .12);
	--line-strong: rgb(242 239 247 / .24);
	--text: #f2eff7;
	--muted: #b3aec0;          /* 8.9:1 su --bg */
	--subtle: #8a8597;         /* 5.3:1 su --bg, solo testo secondario */
	--magenta: #e0107f;
	--violet: #8b6cff;
	--violet-deep: #2e1f7f;
	--accent-grad: linear-gradient(115deg, var(--magenta), var(--violet));
	--focus: #c9b8ff;
	/* Superfici (card): quasi nero neutro, filo chiaro, ombra vera. Il colore sta solo nelle azioni. */
	--surface: #121116;
	--surface-hi: #18171d;
	--hairline: inset 0 0 0 1px rgb(255 255 255 / .09), inset 0 1px 0 rgb(255 255 255 / .05);
	--hairline-hi: inset 0 0 0 1px rgb(255 255 255 / .18), inset 0 1px 0 rgb(255 255 255 / .08);
	--shadow-card: 0 24px 48px -20px rgb(0 0 0 / .85), 0 6px 16px -8px rgb(0 0 0 / .6);
	--magenta-hi: #f0258f;

	/* Tipografia */
	--font: "Manrope", system-ui, sans-serif;
	--fs-xs: .875rem;
	--fs-sm: 1rem;
	--fs-md: clamp(1.0625rem, .98rem + .3vw, 1.25rem);
	--fs-lg: clamp(1.375rem, 1.15rem + .9vw, 1.875rem);
	--fs-xl: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
	--fs-2xl: clamp(2.5rem, 1.6rem + 4vw, 5.5rem);

	/* Spazio e forma */
	--gutter-base: clamp(16px, 4vw, 56px);
	--gutter: max(var(--gutter-base), env(safe-area-inset-left), env(safe-area-inset-right), calc((100vw - 1440px) / 2));
	--section: clamp(88px, 12vw, 176px);
	--radius-card: 16px;
	--radius-field: 12px;
	--radius-pill: 999px;
	--header-h: 72px;

	/* Movimento */
	--ease-out: cubic-bezier(.16, 1, .3, 1);
	--dur: .5s;

	/* Livelli */
	--z-header: 40;
	--z-menu: 45;
	--z-skip: 60;

	color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
	margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
	font: 400 var(--fs-sm)/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: clip;
	caret-color: var(--magenta);
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1px; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
::selection { background: var(--magenta); color: #fff; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
main:focus { outline: none; }
html { scrollbar-color: #3a3546 var(--bg); scrollbar-width: thin; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: var(--z-skip); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--radius-field); font-weight: 700; }
.skip-link:focus { top: 16px; }

/* ---------- Logo e "cool" con gli anelli ---------- */
.logo { font: 800 clamp(22px, 2vw, 28px)/1 var(--font); letter-spacing: -.02em; display: inline-flex; align-items: center; white-space: nowrap; }
.logo__ring, .ring-o {
	display: inline-block; width: .62em; height: .62em; margin: 0 .03em;
	background: url("../img/ring.webp") center / contain no-repeat;
	transform: translateY(.04em);
}
.cool-word { white-space: nowrap; }
.site-header__logo img, .site-footer__logo img { display: block; height: clamp(28px, 3vw, 40px); width: auto; max-width: 48vw; }

/* ---------- Pulsanti ---------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 10px;
	min-height: 52px; padding: 0 28px; border-radius: var(--radius-pill);
	font: 700 var(--fs-sm)/1 var(--font); text-decoration: none; white-space: nowrap;
	border: 1px solid transparent; cursor: pointer;
	transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out), border-color .3s, background-color .3s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn--primary { background: var(--magenta); color: #fff; }
.btn--primary:hover { background: var(--magenta-hi); transform: translateY(-2px); box-shadow: 0 14px 28px -14px rgb(0 0 0 / .9); }
.btn--ghost { border-color: var(--line-strong); color: var(--text); background: rgb(11 10 16 / .55); }
.btn--ghost:hover { border-color: var(--text); }
.btn--sm { min-height: 44px; padding: 0 20px; font-size: var(--fs-xs); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; background: linear-gradient(var(--magenta), var(--magenta)) left bottom / 100% 2px no-repeat; padding-bottom: 4px; }
.link-arrow::after { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("../icons/arrow-right.svg") center / contain no-repeat; mask: url("../icons/arrow-right.svg") center / contain no-repeat; transition: transform .3s var(--ease-out); }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
	position: fixed; inset: 0 0 auto; z-index: var(--z-header);
	height: calc(var(--header-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) var(--gutter) 0;
	display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
	transition: background-color .4s, border-color .4s, transform .5s var(--ease-out);
	border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { background: rgb(11 10 16 / .82); border-bottom-color: var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.site-header.is-hidden { transform: translateY(-100%); }
.site-header__logo { text-decoration: none; justify-self: start; display: inline-flex; }
.site-nav__list { list-style: none; display: flex; gap: clamp(20px, 2.6vw, 40px); }
.site-nav__list a { text-decoration: none; font-weight: 600; font-size: var(--fs-sm); padding: 8px 0; background: linear-gradient(var(--magenta), var(--magenta)) left bottom / 0 2px no-repeat; transition: background-size .35s var(--ease-out); }
.site-nav__list a:hover, .site-nav__list .current-menu-item > a { background-size: 100% 2px; }
.site-header__cta { justify-self: end; }
.menu-toggle { display: none; justify-self: end; width: 48px; height: 48px; border: 0; background: transparent; cursor: pointer; position: relative; }
.menu-toggle__bar { position: absolute; left: 12px; right: 12px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .4s var(--ease-out); }
.menu-toggle__bar:first-of-type { top: 19px; }
.menu-toggle__bar:last-of-type { top: 27px; }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:first-of-type { transform: translateY(4px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle__bar:last-of-type { transform: translateY(-4px) rotate(-45deg); }

.menu-mobile {
	position: fixed; inset: 0; z-index: var(--z-menu); background: var(--bg);
	padding: calc(var(--header-h) + env(safe-area-inset-top) + 24px) var(--gutter) calc(32px + env(safe-area-inset-bottom));
	display: flex; flex-direction: column; justify-content: space-between; gap: 32px; overflow-y: auto;
}
.menu-mobile[hidden] { display: none; }
.menu-mobile__list { list-style: none; display: grid; gap: 4px; }
.menu-mobile__list a { display: block; padding: 10px 0; font-weight: 800; font-size: clamp(2rem, 9vw, 3rem); letter-spacing: -.03em; text-decoration: none; }
.menu-mobile .btn { align-self: stretch; }
body.menu-open { overflow: hidden; }
body.menu-open .site-header { background: var(--bg); }

@media (max-width: 1023px) {
	.site-header { grid-template-columns: 1fr auto; }
	.site-nav, .site-header__cta { display: none; }
	.menu-toggle { display: block; }
}

/* ---------- Footer ---------- */
.site-footer { position: relative; padding: 64px var(--gutter) calc(32px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg-sunk); }
.site-footer__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 32px; padding-bottom: 40px; }
.site-footer__logo { text-decoration: none; display: inline-flex; }
.site-footer__contacts { list-style: none; display: flex; flex-wrap: wrap; gap: 12px 28px; }
.site-footer__contacts a { font-weight: 600; text-decoration: none; }
.site-footer__contacts a:hover { color: var(--magenta-hi); }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--subtle); font-size: var(--fs-xs); }
.site-footer__legal { list-style: none; display: flex; gap: 20px; }

/* ---------- Pagine semplici ---------- */
.page-shell { padding: calc(var(--header-h) + 64px) var(--gutter) var(--section); max-width: calc(760px + 2 * var(--gutter)); margin-inline: auto; }
.page-shell__head { margin-bottom: 48px; }
.page-title { font-size: var(--fs-xl); }
.lead { font-size: var(--fs-md); color: var(--muted); max-width: 56ch; }
.prose { font-size: var(--fs-md); color: var(--muted); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: var(--fs-lg); color: var(--text); margin-top: 2em; }
.prose h3 { font-size: var(--fs-md); color: var(--text); margin-top: 1.6em; }
.prose a { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.2em; }

/* ---------- 404 ---------- */
.not-found { min-height: 100dvh; padding: calc(var(--header-h) + 48px) var(--gutter) 64px; display: grid; align-content: center; justify-items: start; gap: 40px; }
.not-found__text { display: grid; gap: 20px; justify-items: start; }
.not-found { align-content: start; padding-top: calc(var(--header-h) + clamp(48px, 10svh, 120px)); }
.not-found__ring { display: none; } /* l'anello è già nel cielo dello sfondo */
.not-found__code { color: var(--subtle); font-weight: 600; }
.not-found .actions { margin-top: 12px; }

/* ---------- Moduli ---------- */
.form { display: grid; gap: 20px; }
.form__row { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field { display: grid; gap: 8px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 8px; }
.field label, .field legend { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
	width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg-sunk);
	border: 1px solid var(--line-strong); border-radius: var(--radius-field); padding: 14px 16px; transition: border-color .25s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--subtle); }
.field select { appearance: none; padding-right: 44px; background: var(--bg-sunk) url("../icons/caret-down.svg") right 16px center / 16px no-repeat; }
.field textarea { resize: vertical; min-height: 140px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: rgb(255 255 255 / .55); box-shadow: 0 0 0 3px rgb(255 255 255 / .1); }
.field input:user-invalid, .field textarea:user-invalid { border-color: #ff6b9e; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-xs); color: var(--muted); }
.check input { margin-top: 2px; width: 20px; height: 20px; flex: none; accent-color: var(--magenta); }
.check a { color: var(--text); }
.form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { padding: 14px 18px; border-radius: var(--radius-field); font-weight: 600; }
.notice--ok { background: rgb(80 200 140 / .12); color: #8de8b8; }
.notice--err { background: rgb(224 16 127 / .14); color: #ff9ccb; }
.choice-group { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); border: 0; padding: 0; margin: 0; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice span { display: block; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-field); font-weight: 600; transition: border-color .25s, background-color .25s; }
.choice input:checked + span { border-color: var(--magenta); background: rgb(224 16 127 / .1); }
.choice input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Superficie comune (card, riquadri, moduli) ---------- */
.surface { background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--hairline), var(--shadow-card); }

/* ---------- Sfondo delle pagine interne: cielo, anello e specchio (3D, fermo) ---------- */
.ambient { position: fixed; inset: 0; z-index: -2; background: var(--bg); pointer-events: none; }
.ambient canvas { width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease-out); }
.ambient--ready .ambient canvas { opacity: 1; }
.ambient-veil { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--bg); opacity: calc(var(--veil, 0) * .74); }
/* Senza WebGL (o senza JS): anello e orizzonte disegnati in CSS. */
.ambient--static .ambient::before, .no-js .ambient::before {
	content: ""; position: absolute; left: 50%; top: 60%; width: min(56vw, 420px); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
	background: conic-gradient(from 200deg, var(--magenta), var(--violet), var(--magenta));
	-webkit-mask: radial-gradient(closest-side, transparent 49%, #000 51%, #000 98%, transparent 100%);
	mask: radial-gradient(closest-side, transparent 49%, #000 51%, #000 98%, transparent 100%);
	opacity: .85;
}
.ambient--static .ambient::after, .no-js .ambient::after { content: ""; position: absolute; inset: 72% 0 0; background: linear-gradient(rgb(46 31 127 / .35), var(--bg) 60%); }

/* ---------- Animazioni di ingresso (solo con JS e movimento consentito) ---------- */
@media (prefers-reduced-motion: no-preference) {
	.js [data-reveal] { opacity: 0; transform: translateY(24px); }
}

/* ---------- Breadcrumb (sopra le intestazioni di pagina, non spostano l'impaginazione) ---------- */
.breadcrumbs { position: absolute; z-index: 2; top: calc(var(--header-h) + env(safe-area-inset-top) + 18px); left: var(--gutter); right: var(--gutter); font-size: var(--fs-xs); color: var(--subtle); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 0; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { content: ""; width: 14px; height: 14px; margin: 0 6px; background: currentColor; opacity: .6; -webkit-mask: url("../icons/caret-down.svg") center / 12px no-repeat; mask: url("../icons/caret-down.svg") center / 12px no-repeat; transform: rotate(-90deg); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--text); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 48vw; }
