/* Sebastiano Spinali — the name as a monument, set in Spectral, on the black of an event display */
:root {
  --bg: #0c0e0c;
  --surface: #161916;
  --surface-2: #23271f;
  --ink: #ebebe8;
  --muted: #b3b6ac;
  --accent: #f3c431;          /* the yellow of a highlighted track */
  --accent-ink: #0c0e0c;
  --field: #ebebe8;           /* bone field for the contact chapter */
  --field-ink: #0c0e0c;
  --field-muted: #43473f;

  --m: clamp(16px, 2vw, 28px);  /* the page's one pair of margins */
  --gap: clamp(112px, 13vw, 200px);

  /* seven sizes, no more */
  --s-small: 15px;
  --s-body: clamp(18px, 1rem + 0.25vw, 19px);
  --s-lead: clamp(22px, 1.1rem + 0.6vw, 24px);
  --s-sub: clamp(26px, 1.2rem + 1.2vw, 34px);
  --s-head: clamp(40px, 4.8vw, 72px);
  --s-big: clamp(56px, 8.6vw, 160px);
  --s-name: clamp(56px, 13.6vw, 280px);

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --face: "Spectral", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--face); font-weight: 300; font-size: var(--s-body); line-height: 1.55; letter-spacing: 0;
  font-kerning: normal; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: .06em; text-underline-offset: .18em; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* language */
html[lang="it"] .en, html[lang="en"] .it { display: none !important; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--m); top: -60px; z-index: 20; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; }
.skip:focus { top: 12px; }
.wrap { padding-inline: var(--m); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 22px; background: var(--accent); color: var(--accent-ink);
  font-size: var(--s-body); font-weight: 400; text-decoration: none; border-radius: 0; white-space: nowrap;
  transition: transform .18s var(--ease-out), background-color .18s;
}
.btn:hover { background: #ffd54d; }
.btn:active { transform: scale(.97); }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: flex; flex-direction: column; }
.hero-media { position: relative; height: 58svh; min-height: 340px; overflow: hidden; background: #000; touch-action: manipulation; cursor: crosshair; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
  filter: brightness(.42) saturate(.55) contrast(1.05);
  animation: drift 26s ease-in-out infinite alternate;
  transform-origin: 47% 52%;
}
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.09); } }
#collision { position: absolute; inset: 0; width: 100%; height: 100%; }
.hits li {
  position: absolute; left: 0; top: 0; font-size: var(--s-small); line-height: 1.2;
  color: var(--ink); white-space: nowrap; pointer-events: none; padding: 3px 6px; background: rgba(12,14,12,.55);
  opacity: 0; transition: opacity .5s var(--ease-out), translate .5s var(--ease-out); translate: 0 6px;
}
.hits li.on { opacity: 1; translate: 0 0; }
.hits li b { color: var(--accent); font-weight: 500; }
.fire {
  position: absolute; left: var(--m); bottom: 18px; display: inline-flex; gap: 12px; align-items: baseline;
  font-size: var(--s-small); padding: 10px 14px; background: rgba(12,14,12,.72); color: var(--ink);
  transition: background-color .2s, color .2s, transform .15s var(--ease-out);
}
.fire:hover { background: var(--accent); color: var(--accent-ink); }
.fire:active { transform: scale(.96); }
.fire-count { font-variant-numeric: tabular-nums; opacity: .85; }

.nav { position: absolute; top: 20px; right: var(--m); z-index: 5; }
.nav ul { display: flex; gap: 26px; align-items: center; background: rgba(12,14,12,.6); padding: 8px 14px; }
.nav a, .nav .lang { font-size: var(--s-small); text-decoration: none; color: var(--ink); padding: 4px 0; transition: color .2s; }
.nav a:hover, .nav .lang:hover { color: var(--accent); }
.nav .lang { font-style: italic; }
.nav-toggle { display: none; }

.hero-band { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 24px var(--m) 0; overflow: hidden; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.hero-line { max-width: 36ch; font-size: var(--s-body); line-height: 1.45; }
.name {
  font-weight: 200; white-space: nowrap; letter-spacing: -0.035em; line-height: .84;
  font-size: var(--s-name); margin: 0 0 0 -0.04em; padding-bottom: .12em;
  transform-origin: 0 100%; will-change: transform;
}

/* ---------- intro ---------- */
.intro { padding-top: var(--gap); }
.intro-top { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: end; }
.intro-h { grid-column: 1 / 8; font-weight: 200; font-size: var(--s-head); letter-spacing: -0.03em; line-height: .95; }
.intro-note { grid-column: 9 / 13; }
.facts { display: flex; justify-content: space-between; gap: 24px; margin-top: 120px; }
.fact { max-width: 22ch; }
.fact dt { font-weight: 200; font-size: var(--s-head); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: lining-nums; }
.fact dd { margin-top: 12px; font-size: var(--s-small); color: var(--muted); }
.intro-fig { margin-top: 96px; display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.intro-fig img { grid-column: 4 / 13; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 30%; }
.intro-fig figcaption { grid-column: 1 / 4; grid-row: 1; align-self: end; font-size: var(--s-small); color: var(--muted); max-width: 26ch; font-style: italic; }

/* ---------- ideas ---------- */
.ideas { padding-top: var(--gap); }
.ideas-p { font-size: var(--s-sub); line-height: 1.3; letter-spacing: -0.01em; }
.ideas-p strong { font-weight: 500; color: var(--ink); }
.ideas-p a { color: var(--muted); text-decoration: none; transition: color .2s; }
.ideas-p a:hover, .ideas-p a:focus-visible { color: var(--accent); }
.ideas-p a:hover .frame { transform: scale(1.6); }
.frame { display: inline-block; width: 1.25em; height: .82em; margin-left: .22em; vertical-align: -0.04em; overflow: hidden; transform-origin: 0 70%; transition: transform .35s var(--ease-out); }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.ideas-count { margin-top: 32px; font-size: var(--s-small); color: var(--muted); }
.chamber { margin-top: 96px; display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: end; }
.chamber video { grid-column: 1 / 10; width: 100%; aspect-ratio: 21 / 9; object-fit: cover; background: #0b1016; }
.chamber figcaption { grid-column: 10 / 13; font-size: var(--s-small); color: var(--muted); font-style: italic; max-width: 30ch; }

/* ---------- physics ---------- */
.physics { margin-top: var(--gap); display: grid; grid-template-columns: 1fr 1fr; min-height: 88svh; background: var(--surface); }
.plate { position: relative; padding: 40px; display: flex; align-items: center; }
.plate img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: opacity .3s; }
.plate img.swap { opacity: 0; }
.ring { position: absolute; left: 50%; top: 50%; width: 46%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; border: 6px solid var(--accent); pointer-events: none; animation: breathe 6s ease-in-out infinite; }
.ring::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; translate: -50% -50%; border-radius: 50%; background: var(--accent); }
@keyframes breathe { 50% { scale: 1.06; } }
.physics-text { padding: 56px var(--m) 40px 40px; display: flex; flex-direction: column; gap: 40px; }
.sec-h { font-weight: 200; font-size: var(--s-head); letter-spacing: -0.03em; line-height: .95; }
.tabs { display: flex; gap: 28px; flex-wrap: wrap; }
.tabs button { font-size: var(--s-body); color: var(--muted); padding: 8px 0; transition: color .2s; }
.tabs button[aria-selected="true"] { color: var(--accent); }
.tabs button:hover { color: var(--ink); }
.panels { flex: 1; display: flex; }
.panel { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.panel[hidden] { display: none; }
.panel h3 { font-weight: 500; font-size: var(--s-sub); letter-spacing: -0.02em; line-height: 1.05; }
.panel .when { font-size: var(--s-small); color: var(--muted); font-style: italic; }
.panel p:not(.when) { max-width: 42ch; }
.cells { margin-top: auto; padding-top: 32px; display: grid; grid-template-columns: 1fr 1fr; }
.cell { display: flex; align-items: center; padding: 0 20px; min-height: 72px; text-decoration: none; background: var(--surface-2); color: var(--ink); transition: background-color .2s, color .2s; }
.cell-ink { background: var(--ink); color: var(--bg); }
.cell:hover { background: var(--accent); color: var(--accent-ink); }
.cell:active { transform: scale(.98); }
.panel.enter > * { animation: up .5s var(--ease-out) both; }
.panel.enter > *:nth-child(2) { animation-delay: .06s; }
.panel.enter > *:nth-child(3) { animation-delay: .12s; }
.panel.enter > *:nth-child(4) { animation-delay: .18s; }
@keyframes up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- data ---------- */
.data { padding-top: var(--gap); }
.big-h { font-weight: 200; font-size: var(--s-head); letter-spacing: -0.03em; line-height: .98; max-width: 14em; }
.data .big-h { text-indent: 3vw; }
.data-grid { margin-top: 96px; display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: end; }
.data-left { grid-column: 1 / 6; display: flex; flex-direction: column; gap: 48px; }
.data-note { max-width: 40ch; }
.data-fig img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.data-fig figcaption { margin-top: 12px; font-size: var(--s-small); color: var(--muted); font-style: italic; }
.table-wrap { grid-column: 7 / 13; align-self: start; }
.table-name { font-weight: 400; font-style: italic; font-size: var(--s-small); color: var(--muted); margin-bottom: 18px; }
.results { width: 100%; border-collapse: collapse; font-size: var(--s-small); }
.results th, .results td { text-align: left; vertical-align: baseline; padding: 13px 0; }
.results th { font-weight: 400; color: var(--muted); width: 24%; padding-right: 16px; white-space: nowrap; }
.results td { padding-right: 16px; }
.results .v { text-align: right; padding-right: 0; white-space: nowrap; color: var(--accent); font-variant-numeric: tabular-nums; }
.results tr.grp th, .results tr.grp td { padding-top: 44px; }

/* ---------- giving back ---------- */
.give { margin-top: var(--gap); padding-inline: var(--m); display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.give-pin { grid-column: 1 / 6; position: sticky; top: 0; align-self: start; height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: 32px; }
.give-h { font-weight: 200; font-size: var(--s-big); letter-spacing: -0.035em; line-height: .86; font-style: italic; }
.give-lead { font-size: var(--s-lead); line-height: 1.35; max-width: 24ch; }
.give-list { grid-column: 6 / 13; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; row-gap: 80px; padding: 14svh 0 12svh; }
.person:nth-child(even) { margin-top: 30svh; }
.person img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.person h3 { margin-top: 20px; font-weight: 500; font-size: var(--s-sub); letter-spacing: -0.02em; line-height: 1.1; }
.person .role { margin-top: 6px; font-size: var(--s-small); color: var(--muted); font-style: italic; }
.person p:not(.role) { margin-top: 12px; max-width: 38ch; }

/* ---------- outside the lab ---------- */
.life { margin-top: var(--gap); padding-inline: var(--m); display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; align-items: end; }
.life-fig { grid-column: 1 / 8; }
.life-fig img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 40%; }
.life-text { grid-column: 9 / 13; display: flex; flex-direction: column; gap: 28px; padding-bottom: 8px; }
.life-lead { font-size: var(--s-lead); line-height: 1.4; }
.life-note { max-width: 36ch; }
.life-cap { font-size: var(--s-small); color: var(--muted); font-style: italic; }

/* ---------- CV ---------- */
.cv { padding: var(--gap) 0; background: var(--surface); }
.cv-head { display: flex; justify-content: space-between; align-items: end; gap: 32px; flex-wrap: wrap; }
.cv-actions { display: flex; gap: 28px; align-items: center; }
.text-link { transition: color .2s; }
.text-link:hover { color: var(--accent); }
.cv-profile { margin-top: 56px; max-width: 62ch; font-size: var(--s-lead); line-height: 1.4; }
.cv-cols { margin-top: 112px; display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(40px, 6vw, 120px); row-gap: 96px; }
.cv-block h3 { font-weight: 500; font-size: var(--s-sub); letter-spacing: -0.02em; margin: 0 0 32px 156px; }
.lines > div { display: grid; grid-template-columns: 132px 1fr; column-gap: 24px; align-items: baseline; }
.lines > div + div { margin-top: 28px; }
.lines dt { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; color: var(--accent); }
.lines dd { max-width: 48ch; color: var(--muted); }
.lines dd strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.skills dd { color: var(--ink); }

/* ---------- contact ---------- */
.contact { min-height: 92svh; background: var(--field); color: var(--field-ink); padding: 56px var(--m) 32px; display: flex; flex-direction: column; }
.contact-top { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.contact-top .contact-h { grid-column: 1 / 6; }
.contact-list { grid-column: 7 / 13; font-size: var(--s-sub); line-height: 1.2; letter-spacing: -0.01em; display: flex; flex-direction: column; gap: 14px; }
.contact-h { font-weight: 400; font-size: var(--s-lead); line-height: 1.3; max-width: 24ch; }
.mail { font-weight: 200; margin-top: auto; margin-bottom: 10vh; display: flex; flex-wrap: wrap; text-decoration: none; font-size: clamp(40px, 7.6vw, 150px); letter-spacing: -0.035em; line-height: 1; transition: color .25s; }
.mail:hover { color: #6b5510; }
.contact-foot { display: flex; justify-content: space-between; gap: 24px; font-size: var(--s-small); color: var(--field-muted); }
.contact-foot a { transition: color .2s; }
.contact-foot a:hover { color: var(--field-ink); }

/* ---------- footer ---------- */
.footer { padding: 72px var(--m) 32px; overflow: hidden; }
.foot-name { font-weight: 200; font-size: var(--s-name); letter-spacing: -0.035em; line-height: .84; white-space: nowrap; margin-left: -0.04em; padding-bottom: .12em; }
.foot-row { margin-top: 72px; display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
.places { grid-column: 1 / 6; display: flex; flex-direction: column; gap: 6px; }
.places a { font-size: var(--s-sub); color: var(--accent); text-decoration: none; letter-spacing: -0.01em; }
.places a:hover { text-decoration: underline; }
.foot-links { grid-column: 7 / 13; columns: 2; column-gap: 24px; font-size: var(--s-small); }
.foot-links li { margin-bottom: 8px; }
.foot-links a { text-decoration: none; transition: color .2s; }
.foot-links a:hover { color: var(--accent); }
.credits { margin-top: 96px; max-width: 110ch; font-size: var(--s-small); line-height: 1.6; color: var(--muted); }
.credits a { color: var(--ink); }
.legal { margin-top: 40px; display: flex; justify-content: space-between; font-size: var(--s-small); color: var(--muted); }
.legal a { color: var(--ink); }

/* ---------- reveal ---------- */
.js .rv { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: var(--d, 0s); }
.js .rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .rv, .rv { opacity: 1; transform: none; transition: none; animation: none; }
  .hero-media img, .ring { animation: none; }
  .panel.enter > * { animation: none; }
  .name { transform: none !important; }
}

/* ---------- tablet ---------- */
@media (max-width: 1000px) {
  .intro-h { grid-column: 1 / 13; }
  .intro-note { grid-column: 1 / 13; margin-top: 28px; max-width: 46ch; }
  .facts { display: grid; grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .chamber video { grid-column: 1 / 13; }
  .chamber figcaption { grid-column: 1 / 13; margin-top: 12px; }
  .physics { grid-template-columns: 1fr; }
  .plate { padding: var(--m) var(--m) 0; }
  .physics-text { padding: 40px var(--m) 56px; }
  .data-left { grid-column: 1 / 13; flex-direction: row; align-items: flex-end; gap: 24px; }
  .data-left > * { flex: 1; }
  .table-wrap { grid-column: 1 / 13; grid-row: 1; margin-bottom: 64px; }
  .data-grid { margin-top: 56px; }
  .cv-cols { grid-template-columns: 1fr; }
  .life-fig { grid-column: 1 / 13; }
  .life-text { grid-column: 1 / 13; margin-top: 40px; }
  .give-pin { grid-column: 1 / 13; position: relative; height: auto; padding: 0 0 56px; flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .give-list { grid-column: 1 / 13; padding: 0; row-gap: 56px; }
  .person:nth-child(even) { margin-top: 120px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .hero-media { height: 50svh; }
  .nav { top: 14px; }
  .nav-toggle { display: block; background: rgba(12,14,12,.72); padding: 10px 14px; font-size: var(--s-body); }
  .nav ul { display: none; position: absolute; right: 0; top: 52px; flex-direction: column; align-items: flex-end; gap: 4px; background: var(--bg); padding: 12px 16px; }
  .nav.open ul { display: flex; }
  .nav a, .nav .lang { font-size: var(--s-body); padding: 8px 0; }
  .hero-band { padding-top: 20px; }
  .hero-row { flex-direction: column; gap: 16px; }
  .name { white-space: normal; font-size: 19vw; line-height: .86; }
  .name-a, .name-b { display: block; }
  .fire { bottom: 12px; }
  .facts { margin-top: 72px; column-gap: 20px; row-gap: 32px; }
  .intro-fig, .chamber { display: block; margin-top: 64px; }
  .intro-fig figcaption { margin-top: 12px; }
  .chamber video { aspect-ratio: 4 / 3; }
  .ideas-p { line-height: 1.36; }
  .ideas-p a { color: var(--ink); padding-block: 3px; }
  .ideas-p a:nth-of-type(n+4) .frame { display: none; }
  .tabs { gap: 22px; }
  .cells { grid-template-columns: 1fr; }
  .cell { min-height: 60px; }
  .data .big-h { text-indent: 0; }
  .data-left { flex-direction: column; align-items: stretch; }
  .data-fig { width: 60%; margin-left: auto; }
  .results, .results tbody, .results tr, .results th, .results td { display: block; }
  .results tr { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; padding: 12px 0; }
  .results th { width: auto; padding: 0; }
  .results td { padding: 4px 0 0; grid-column: 1 / 3; }
  .results td.v { grid-column: 2; grid-row: 1; padding: 0; }
  .results tr.grp { padding-top: 36px; }
  .results tr.grp th, .results tr.grp td { padding-top: 0; }
  .results tr.grp td:not(.v) { padding-top: 4px; }
  .give-pin { flex-direction: column; align-items: flex-start; gap: 24px; }
  .give-h { font-size: 17vw; }
  .give-list { grid-template-columns: 1fr; row-gap: 64px; }
  .person { width: 82%; }
  .person:nth-child(even) { margin: 0 0 0 auto; }
  .cv-actions { flex-wrap: wrap; gap: 20px; }
  .cv-block h3 { margin-left: 0; }
  .lines > div { grid-template-columns: 92px 1fr; column-gap: 16px; }
  .mail { font-size: 10.2vw; margin-bottom: 18vh; }
  .contact-foot { flex-direction: column; gap: 12px; }
  .contact-top { display: block; }
  .contact-list { margin-top: 32px; font-size: var(--s-lead); }
  .foot-name { white-space: normal; font-size: 19vw; }
  .foot-row { display: block; }
  .foot-links { margin-top: 40px; }
}

@media print {
  .hero-media, .fire, .nav, .footer, .contact { display: none; }
}
