/* =============================================================================
   Do Won Park · style.css
   Struttura: 1 token  2 base  3 header  4 layout  5 hero  6 sezioni
              7 articolo  8 footer  9 loader  10 animazioni  11 responsive
   ============================================================================= */

/* 1 · TOKEN ----------------------------------------------------------------- */
:root {
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #ECEBE6;
  --ink: #121211;
  --ink-2: #45443F;
  --muted: #6B6963;
  --line: rgba(18, 18, 17, .10);
  --line-2: rgba(18, 18, 17, .20);
  --accent: #E0531A;
  --accent-ink: #B93A0A;
  --accent-soft: rgba(224, 83, 26, .12);
  --dot: rgba(18, 18, 17, .09);
  --shadow: 0 1px 0 rgba(0, 0, 0, .02), 0 14px 32px -18px rgba(30, 24, 12, .28);
  --on-accent: #FFFFFF;

  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --frame: 1280px;
  --rail: 196px;
  --gut: clamp(16px, 3.4vw, 40px);
  --header-h: 60px;
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --ease: cubic-bezier(.2, .75, .1, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0D0C;
    --surface: #151514;
    --surface-2: #1F1F1D;
    --ink: #EDECE8;
    --ink-2: #BAB8B1;
    --muted: #8C8A83;
    --line: rgba(237, 236, 232, .09);
    --line-2: rgba(237, 236, 232, .20);
    --accent: #FF6A33;
    --accent-ink: #FF8A5C;
    --accent-soft: rgba(255, 106, 51, .14);
    --dot: rgba(237, 236, 232, .07);
    --shadow: 0 14px 34px -16px rgba(0, 0, 0, .7);
    --on-accent: #120A06;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0D0D0C;
  --surface: #151514;
  --surface-2: #1F1F1D;
  --ink: #EDECE8;
  --ink-2: #BAB8B1;
  --muted: #8C8A83;
  --line: rgba(237, 236, 232, .09);
  --line-2: rgba(237, 236, 232, .20);
  --accent: #FF6A33;
  --accent-ink: #FF8A5C;
  --accent-soft: rgba(255, 106, 51, .14);
  --dot: rgba(237, 236, 232, .07);
  --shadow: 0 14px 34px -16px rgba(0, 0, 0, .7);
  --on-accent: #120A06;
  color-scheme: dark;
}

/* 2 · BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .3s, color .3s;
}

img, video, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 10px; text-decoration: none;
  transition: top .2s;
}
.skip:focus { top: 12px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.mono {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 400;
}

.dim { color: var(--muted); }

.ico { width: 18px; height: 18px; flex: none; }
.ico-sm { width: 14px; height: 14px; }

/* Bottoni */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px; font-weight: 500; letter-spacing: -.005em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .25s, border-color .25s, color .25s, transform .25s var(--ease);
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn .ico { transition: transform .3s var(--ease); }
.btn:hover .ico-move { transform: translate(2px, -2px); }
.btn:hover .ico-right { transform: translateX(3px); }
.btn:hover .ico-down { transform: translateY(2px); }

.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.btn-ghost { background: transparent; }

.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; flex: none;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent; cursor: pointer;
  transition: border-color .25s, background-color .25s;
}
.icon-btn:hover { border-color: var(--ink); background: var(--surface); }

.chip {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  padding: 5px 10px 5px 9px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-2);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.is-ongoing .dot { background: var(--accent); animation: ping 2.4s var(--ease) infinite; }
.badge.is-phd .dot { background: var(--ink); }

@keyframes ping {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* 3 · HEADER ---------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header::after {
  content: ''; position: absolute; left: 0; bottom: -1px; height: 1px;
  width: 100%; transform-origin: left; transform: scaleX(var(--p, 0));
  background: var(--accent);
}

.bar {
  max-width: var(--frame); height: 100%; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--gut);
  border-inline: 1px solid var(--line);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 600; letter-spacing: -.02em; font-size: 15.5px;
  margin-right: auto; min-height: 44px;
}
.brand-mark {
  width: 20px; height: 20px; background: var(--ink);
  animation: morph 9s ease-in-out infinite;
  transition: background-color .3s;
}
.brand:hover .brand-mark { background: var(--accent); }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  font-size: 14px; color: var(--ink-2); text-decoration: none;
  padding: 7px 12px; border-radius: 999px;
  transition: color .2s, background-color .2s;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

.bar-right { display: flex; align-items: center; gap: 8px; }
.clock { color: var(--muted); padding-right: 6px; white-space: nowrap; }
.menu-btn { display: none; }

/* Menu mobile */
.menu {
  position: fixed; inset: var(--header-h) 0 0 0; z-index: 55;
  background: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 24px var(--gut) calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .3s var(--ease), transform .4s var(--ease), visibility 0s .4s;
}
html.menu-open .menu { opacity: 1; visibility: visible; transform: none; transition: opacity .3s var(--ease), transform .4s var(--ease); }
html.menu-open { overflow: hidden; }
.menu ol { list-style: none; margin: 0; padding: 0; }
.menu li { border-bottom: 1px solid var(--line); }
.menu ol a {
  display: flex; align-items: baseline; gap: 14px;
  padding: 16px 2px; text-decoration: none;
  font-size: clamp(28px, 8vw, 40px); font-weight: 500; letter-spacing: -.035em; line-height: 1.1;
}
.menu ol a .mono { color: var(--accent-ink); }
.menu-foot { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 28px; }

/* 4 · LAYOUT ---------------------------------------------------------------- */
.frame {
  max-width: var(--frame);
  margin-inline: auto;
  border-inline: 1px solid var(--line);
}

.layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.rail { display: none; }
main { min-width: 0; }

.rail-inner {
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 28px 16px 24px;
}
.rail ol { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.rail a {
  position: relative;
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  font-size: 14px; color: var(--muted); text-decoration: none;
  transition: color .2s, background-color .2s;
}
.rail a .mono { font-size: 10.5px; }
.rail a:hover { color: var(--ink); }
.rail a[aria-current="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.rail a[aria-current="true"] .mono { color: var(--accent-ink); }
.rail-label { color: var(--muted); padding: 0 10px; }
.rail-foot { display: grid; gap: 6px; padding: 0 10px; color: var(--muted); }

/* Sezioni con crocini agli angoli, come un foglio tecnico */
.sec {
  position: relative;
  border-top: 1px solid var(--line);
  padding: clamp(64px, 9vw, 120px) var(--gut);
}
.sec::before, .sec::after {
  content: ''; position: absolute; top: -6px; width: 11px; height: 11px;
  background:
    linear-gradient(var(--ink-2), var(--ink-2)) center / 1px 100% no-repeat,
    linear-gradient(var(--ink-2), var(--ink-2)) center / 100% 1px no-repeat;
  opacity: .45; pointer-events: none;
}
.sec::before { left: -6px; }
.sec::after { right: -6px; }

.sec-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: clamp(24px, 3.4vw, 40px);
  color: var(--muted);
}
.sec-head .num { color: var(--accent-ink); }
.sec-head h2 { margin: 0; font: inherit; color: var(--ink); }
.sec-head .rule { flex: 1; height: 1px; background: var(--line); }

.statement {
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1.02; letter-spacing: -.045em; font-weight: 500;
  margin: 0 0 clamp(32px, 5vw, 64px);
  max-width: 17ch;
}
.statement .dim { color: var(--muted); }

/* 5 · HERO ------------------------------------------------------------------ */
.hero {
  position: relative;
  padding: clamp(20px, 3vw, 32px) var(--gut) clamp(48px, 7vw, 88px);
  isolation: isolate;
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 95%);
}

.hero-top { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); margin-bottom: clamp(28px, 6vw, 72px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}

.status {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 6px 13px 6px 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13.5px; color: var(--ink-2);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ping 2.4s var(--ease) infinite; }

.hero h1 {
  font-size: clamp(60px, 11.2vw, 168px);
  line-height: .86; letter-spacing: -.06em; font-weight: 500;
  margin: clamp(20px, 3vw, 32px) 0 clamp(20px, 3vw, 32px);
  margin-left: -.04em;
}
.hero h1 .line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.hero h1 .line > span { display: inline-block; }

.lead {
  font-size: clamp(18px, 1.75vw, 22px); line-height: 1.42; letter-spacing: -.015em;
  color: var(--ink-2); max-width: 31ch; margin: 0 0 30px;
}

.ctas { display: flex; flex-wrap: wrap; gap: 10px; }

.hero-media { min-width: 0; }

.figure {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.figure > video, .figure > img { width: 100%; height: 100%; object-fit: cover; }
.figure.is-contain > video { object-fit: contain; background: var(--surface); }
.hero-media .figure { aspect-ratio: 4 / 5; }

.figure-ph {
  position: absolute; inset: 0; display: none;
  place-items: center; text-align: center; padding: 20px;
  color: var(--muted);
  background:
    repeating-linear-gradient(45deg, transparent 0 11px, var(--line) 11px 12px),
    var(--surface-2);
}
.figure.is-missing .figure-ph { display: grid; }
.figure.is-missing > video, .figure.is-missing > img { visibility: hidden; }
.figure-ph strong { display: block; font-family: var(--sans); font-size: clamp(40px, 7vw, 72px); font-weight: 500; letter-spacing: -.05em; color: var(--ink-2); text-transform: none; line-height: 1; margin-bottom: 10px; }

.figcap {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 10px; color: var(--muted);
}

.vid-toggle {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 999px; border: 0; cursor: pointer;
  color: #fff; background: rgba(15, 15, 14, .55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background-color .2s, transform .2s var(--ease);
}
.vid-toggle:hover { background: rgba(15, 15, 14, .8); transform: scale(1.05); }
.figure.is-missing .vid-toggle { display: none; }

.spec {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
  margin: clamp(40px, 6vw, 72px) 0 0;
}
.spec > div { background: var(--surface); padding: 14px 16px 16px; }
.spec dt { color: var(--muted); }
.spec dd { margin: 6px 0 0; font-size: 14.5px; line-height: 1.35; letter-spacing: -.01em; }

/* 6 · SEZIONI --------------------------------------------------------------- */

/* Card generiche */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .3s, transform .45s var(--ease), box-shadow .45s var(--ease);
}
.card.is-link:hover, .card.is-hover:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }

/* Ricerca */
.research-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.research-card { padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 16px; min-height: 100%; }
.research-card .top { display: flex; justify-content: space-between; align-items: flex-start; }
.research-card .idx { color: var(--accent-ink); }
.research-card .glyph { width: 56px; height: 56px; color: var(--ink); }
.research-card h3 { margin: 6px 0 0; font-size: 21px; line-height: 1.18; letter-spacing: -.025em; font-weight: 500; }
.research-card p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }

.glyph path, .glyph circle, .glyph line, .glyph rect {
  stroke-dasharray: var(--len, 200); stroke-dashoffset: 0;
}
.research-card.is-hover:hover .glyph .anim { animation: draw 1.2s var(--ease); }
@keyframes draw { from { stroke-dashoffset: var(--len, 200); } to { stroke-dashoffset: 0; } }

/* Progetti */
.bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project { display: flex; flex-direction: column; overflow: hidden; }
.project.is-featured { grid-column: 1 / -1; }
.project-img { aspect-ratio: 16 / 8; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.project-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.project:hover .project-img img { transform: scale(1.03); }
.project-body { padding: clamp(20px, 2.6vw, 30px); display: grid; gap: 18px; flex: 1; }
.project.is-featured .project-body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); column-gap: clamp(24px, 4vw, 56px); }
.project-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; grid-column: 1 / -1; }
.project h3 { margin: 0; font-size: clamp(30px, 3.6vw, 48px); line-height: 1; letter-spacing: -.045em; font-weight: 500; }
.project:not(.is-featured) h3 { font-size: clamp(26px, 2.6vw, 34px); }
.project .full { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.project .summary { margin: 16px 0 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; max-width: 56ch; }
.project dl { margin: 0; display: grid; align-content: start; border-top: 1px solid var(--line); }
.project dl > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.project dt { color: var(--muted); padding-top: 2px; }
.project dd { margin: 0; font-size: 14.5px; line-height: 1.4; }
.project-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 4px; }
.stretch { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 500; }
.stretch::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.stretch .ico { transition: transform .35s var(--ease); }
.card:hover .stretch .ico { transform: translate(2px, -2px); }
.card:hover .stretch { color: var(--accent-ink); }

/* Articoli */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.filter {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em;
  min-height: 34px; padding: 0 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  transition: all .2s;
}
.filter:hover { border-color: var(--ink); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.posts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.post a {
  display: grid; grid-template-columns: 130px minmax(0, 1fr) auto;
  gap: 8px 24px; align-items: baseline;
  padding: 22px 6px; border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background-color .25s, padding .35s var(--ease);
}
.post a:hover { background: var(--surface); padding-inline: 16px; }
.post time { color: var(--muted); }
.post h3 { margin: 0; font-size: clamp(19px, 1.9vw, 23px); line-height: 1.25; letter-spacing: -.025em; font-weight: 500; }
.post p { margin: 6px 0 0; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.post .tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.post .go { color: var(--muted); transition: transform .35s var(--ease), color .2s; align-self: center; }
.post a:hover .go { transform: translateX(4px); color: var(--accent-ink); }
.post .cover { grid-column: 2; margin-top: 14px; border-radius: var(--r-sm); overflow: hidden; aspect-ratio: 16 / 7; background: var(--surface-2); }
.post .cover img { width: 100%; height: 100%; object-fit: cover; }

.more-row { display: flex; justify-content: center; padding-top: 22px; }
.empty { color: var(--muted); padding: 28px 0; border-bottom: 1px solid var(--line); margin: 0; }

/* Aggiornamenti */
.updates { list-style: none; margin: 0; padding: 0; display: grid; }
.update {
  display: grid; grid-template-columns: 130px 18px minmax(0, 1fr);
  gap: 0 14px; align-items: start; padding: 0 0 26px;
}
.update time { color: var(--muted); padding-top: 3px; }
.update .tick { position: relative; height: 100%; }
.update .tick::before { content: ''; position: absolute; left: 50%; top: 8px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; border: 1.5px solid var(--ink); background: var(--bg); z-index: 1; }
.update:first-child .tick::before { background: var(--accent); border-color: var(--accent); }
.update .tick::after { content: ''; position: absolute; left: 50%; top: 12px; bottom: -26px; width: 1px; background: var(--line-2); }
.update:last-child .tick::after { display: none; }
.update p { margin: 0; font-size: 16.5px; line-height: 1.5; letter-spacing: -.01em; max-width: 62ch; }
.update a { text-underline-offset: 3px; }

/* Pubblicazioni */
.pubs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pub { display: grid; grid-template-columns: 80px minmax(0, 1fr) auto; gap: 6px 24px; padding: 20px 4px; border-bottom: 1px solid var(--line); align-items: baseline; }
.pub .year { color: var(--muted); }
.pub h3 { margin: 0; font-size: 17.5px; line-height: 1.35; font-weight: 500; letter-spacing: -.015em; }
.pub .authors { margin: 4px 0 0; color: var(--ink-2); font-size: 14.5px; }
.pub .venue { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; font-style: italic; }
.pub .note { margin-top: 8px; }
.pub a { text-decoration: none; }
.pub a:hover h3 { color: var(--accent-ink); }

/* Chi sono */
.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.portrait .figure { aspect-ratio: 4 / 5; }
.portrait { position: sticky; top: calc(var(--header-h) + 24px); }
.bio p { margin: 0 0 18px; font-size: clamp(16.5px, 1.4vw, 18px); line-height: 1.65; color: var(--ink-2); }
.bio p:first-child { color: var(--ink); font-size: clamp(19px, 1.9vw, 23px); line-height: 1.45; letter-spacing: -.02em; }
.bio a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.bio a:hover { color: var(--accent-ink); }

.sub-head { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 44px 0 6px; }
.sub-head .rule { flex: 1; height: 1px; background: var(--line); }

.timeline { margin: 0; }
.timeline > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline dt { color: var(--muted); padding-top: 3px; }
.timeline dd { margin: 0; }
.timeline .t { font-size: 16px; font-weight: 500; letter-spacing: -.015em; line-height: 1.35; }
.timeline .p { font-size: 14.5px; color: var(--muted); line-height: 1.4; margin-top: 2px; }

.award { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); overflow: hidden; margin-top: 44px; }
.award .figure { border: 0; border-radius: 0; aspect-ratio: auto; min-height: 260px; border-right: 1px solid var(--line); }
.award .figure > img { position: absolute; inset: 0; }
.award-body { padding: clamp(20px, 2.6vw, 28px); display: flex; flex-direction: column; gap: 10px; }
.award-body .badge { align-self: flex-start; }
.award-body h3 { margin: 6px 0 0; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.05; letter-spacing: -.04em; font-weight: 500; }
.award-body .detail { margin: 0; font-size: 15.5px; line-height: 1.4; letter-spacing: -.01em; }
.award-body .event { color: var(--accent-ink); }
.award-body p.text { margin: auto 0 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; padding-top: 8px; }

/* Contatti */
.contact-intro { font-size: clamp(18px, 1.8vw, 22px); line-height: 1.45; letter-spacing: -.015em; color: var(--ink-2); max-width: 44ch; margin: 0 0 32px; }
.email-row { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px; margin-bottom: clamp(36px, 5vw, 56px); }
.email-big {
  font-size: clamp(26px, 5.4vw, 64px); line-height: 1; letter-spacing: -.05em; font-weight: 500;
  text-decoration: none; overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 2px no-repeat;
  transition: background-size .5s var(--ease), color .2s;
  padding-bottom: 6px;
}
.email-big:hover { background-size: 100% 2px; color: var(--accent-ink); }

.link-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.link-card { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 26px; min-height: 132px; text-decoration: none; }
.link-card .row { display: flex; justify-content: space-between; align-items: center; color: var(--muted); }
.link-card .name { font-size: 20px; letter-spacing: -.025em; font-weight: 500; margin-top: auto; }
.link-card .handle { color: var(--muted); font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }
.link-card .ico { transition: transform .35s var(--ease), color .2s; }
.link-card:hover .ico { transform: translate(2px, -2px); color: var(--accent-ink); }

/* 7 · ARTICOLO -------------------------------------------------------------- */
.article-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: clamp(28px, 4vw, 48px) var(--gut) clamp(64px, 8vw, 112px);
  gap: 48px;
}
.article-main { min-width: 0; max-width: 720px; margin: 0 auto; width: 100%; }
.back { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); margin-bottom: clamp(28px, 4vw, 48px); min-height: 40px; }
.back:hover { color: var(--ink); }
.back:hover .ico { transform: translateX(-3px); }
.back .ico { transition: transform .3s var(--ease); }

.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: var(--muted); margin-bottom: 18px; }
.article-title { font-size: clamp(38px, 6vw, 72px); line-height: 1; letter-spacing: -.05em; font-weight: 500; margin: 0 0 20px; }
.article-summary { font-size: clamp(18px, 1.9vw, 22px); line-height: 1.45; letter-spacing: -.015em; color: var(--ink-2); margin: 0 0 36px; }
.article-cover { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); margin: 0 0 40px; background: var(--surface-2); }
.article-cover img { width: 100%; }

.toc { display: none; }
.toc-inner { position: sticky; top: calc(var(--header-h) + 32px); }
.toc ol { list-style: none; margin: 12px 0 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 1px solid transparent; font-size: 13.5px; line-height: 1.35; color: var(--muted); text-decoration: none; transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--ink); border-left-color: var(--accent); }
.toc .lvl-3 a { padding-left: 26px; }

.prose { font-size: 17.5px; line-height: 1.72; color: var(--ink-2); }
.prose > * + * { margin-top: 1.1em; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose figure { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4 { color: var(--ink); font-weight: 500; letter-spacing: -.03em; line-height: 1.2; margin-bottom: 0; scroll-margin-top: calc(var(--header-h) + 24px); }
.prose h2 { font-size: clamp(26px, 2.8vw, 32px); margin-top: 2.2em; }
.prose h3 { font-size: 22px; margin-top: 1.8em; }
.prose h4 { font-size: 18px; margin-top: 1.6em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.prose a:hover { color: var(--accent-ink); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--muted); }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--accent); color: var(--ink); font-size: 1.12em; letter-spacing: -.015em; }
.prose hr { border: 0; height: 1px; background: var(--line-2); margin: 2.4em 0; }
.prose img, .prose video { border-radius: var(--r); border: 1px solid var(--line); width: 100%; height: auto; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 10px; }
.prose code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: .15em .4em; border-radius: 6px; color: var(--ink); }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose .table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.prose th { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 400; background: var(--surface); }
.prose tr:last-child td { border-bottom: 0; }
.prose .math-display { overflow-x: auto; overflow-y: hidden; padding: 6px 0; color: var(--ink); }
.prose .katex { font-size: 1.05em; }

/* Colori del codice (highlight.js) */
.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-name { color: var(--accent-ink); }
.hljs-string, .hljs-attr, .hljs-symbol, .hljs-bullet, .hljs-addition { color: #3B7A57; }
.hljs-number, .hljs-literal, .hljs-type { color: #5B5BD6; }
.hljs-title, .hljs-section, .hljs-function .hljs-title { color: var(--ink); font-weight: 500; }
:root[data-theme="dark"] .hljs-string, :root[data-theme="dark"] .hljs-attr { color: #7CC49B; }
:root[data-theme="dark"] .hljs-number, :root[data-theme="dark"] .hljs-literal { color: #9C9CF5; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hljs-string, :root:not([data-theme="light"]) .hljs-attr { color: #7CC49B; }
  :root:not([data-theme="light"]) .hljs-number, :root:not([data-theme="light"]) .hljs-literal { color: #9C9CF5; }
}

.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.article-nav a { padding: 18px; text-decoration: none; display: grid; gap: 6px; }
.article-nav .next { text-align: right; grid-column: 2; }
.article-nav .t { font-size: 17px; font-weight: 500; letter-spacing: -.02em; line-height: 1.3; }
.article-nav .mono { color: var(--muted); }

.notice { border: 1px dashed var(--line-2); border-radius: var(--r); padding: 22px; color: var(--ink-2); }
.notice code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }

/* 8 · FOOTER ---------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); overflow: hidden; }
.foot { padding: clamp(40px, 6vw, 72px) var(--gut) 0; }
.foot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 24px; }
.foot-col .mono { color: var(--muted); margin: 0 0 14px; }
.foot-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.foot-col a { text-decoration: none; color: var(--ink-2); font-size: 14.5px; display: inline-flex; align-items: center; gap: 6px; min-height: 30px; }
.foot-col a:hover { color: var(--ink); }
.foot-col p { margin: 0 0 8px; color: var(--ink-2); font-size: 14.5px; line-height: 1.55; }
.wordmark {
  margin-top: clamp(40px, 7vw, 96px);
  font-size: clamp(60px, 15.4vw, 214px);
  font-weight: 600; letter-spacing: -.07em; line-height: .76;
  white-space: nowrap; color: var(--ink);
  height: .62em; overflow: hidden;
  margin-left: -.05em;
  user-select: none;
}

/* 9 · LOADER ---------------------------------------------------------------- */
#loader { display: none; }
.js #loader {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: max(var(--gut), env(safe-area-inset-top)) var(--gut) max(var(--gut), env(safe-area-inset-bottom));
  background: var(--bg); color: var(--muted);
  transition: transform 1s var(--ease), visibility 0s 1s;
  animation: loader-failsafe .01s 4.5s forwards;
}
.js.loader-skip #loader { display: none; }
#loader.is-done { transform: translateY(-100%); visibility: hidden; }
.loader-row { display: flex; justify-content: space-between; gap: 12px; }
.loader-count {
  font-size: clamp(88px, 22vw, 300px); line-height: .8; letter-spacing: -.06em; font-weight: 500;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.loader-count small { font-size: .3em; letter-spacing: -.02em; color: var(--muted); }
.loader-bar { height: 1px; background: var(--line-2); margin-top: 18px; }
.loader-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(var(--lp, 0)); }
.loader-blob { width: 34px; height: 34px; background: var(--ink); animation: morph 3.5s ease-in-out infinite; }
@keyframes loader-failsafe { to { visibility: hidden; opacity: 0; } }

/* 10 · ANIMAZIONI ----------------------------------------------------------- */
@keyframes morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50% { border-radius: 50% 30% 60% 40% / 70% 50% 40% 60%; }
  75% { border-radius: 40% 70% 30% 60% / 30% 40% 70% 60%; }
}

/* Comparsa allo scroll. Senza JavaScript tutto resta visibile. */
.js .reveal {
  opacity: 0; transform: translateY(22px); filter: blur(6px);
  transition: opacity .9s var(--ease), transform 1s var(--ease), filter .9s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; filter: none; }

/* Nome nella hero che sale riga per riga */
.js .hero h1 .line > span { transform: translateY(108%); transition: transform 1.15s var(--ease); }
.js .hero h1 .line:nth-child(2) > span { transition-delay: .09s; }
.js.ready .hero h1 .line > span { transform: none; }
.js .hero .intro-fade { opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease) .35s, transform .9s var(--ease) .35s; }
.js.ready .hero .intro-fade { opacity: 1; transform: none; }
.js .hero .intro-fade.d2 { transition-delay: .5s; }
.js .hero .intro-fade.d3 { transition-delay: .65s; }
.js:not(.ready) .hero h1 .line > span, .js:not(.ready) .hero .intro-fade { animation: show-failsafe .01s 5s forwards; }
@keyframes show-failsafe { to { transform: none; opacity: 1; } }

/* Transizione tra pagine (Chrome, Edge, Safari recenti) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; filter: none; }
}

/* 11 · RESPONSIVE ----------------------------------------------------------- */

/* Desktop largo: indice laterale fisso a sinistra */
@media (min-width: 1180px) {
  .layout { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .rail { display: block; border-right: 1px solid var(--line); }
  [data-page="home"] .nav { display: none; }
  .article-wrap { grid-template-columns: minmax(0, 1fr) 220px; }
  .article-wrap.no-toc { grid-template-columns: minmax(0, 1fr); }
  .toc { display: block; }
  .article-wrap.no-toc .toc { display: none; }
}

@media (max-width: 1100px) {
  .clock { display: none; }
}

/* Il riquadro tocca i bordi dello schermo: i crocini uscirebbero dalla pagina */
@media (max-width: 1310px) {
  .sec::before, .sec::after { display: none; }
}

/* Tablet */
@media (max-width: 980px) {
  .research-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .research-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .project.is-featured .project-body { grid-template-columns: minmax(0, 1fr); }
  .link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero-media .figure { aspect-ratio: 16 / 11; }
  .hero h1 { font-size: clamp(64px, 22vw, 150px); }
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { position: static; max-width: 440px; }
  .bento { grid-template-columns: minmax(0, 1fr); }
  .award { grid-template-columns: minmax(0, 1fr); }
  .award .figure { border-right: 0; border-bottom: 1px solid var(--line); aspect-ratio: 4 / 3; min-height: 0; }
}

/* Telefono */
@media (max-width: 640px) {
  :root { --header-h: 56px; }
  .frame, .bar { border-inline: 0; }
  .hero-top .hide-sm { display: none; }
  .cv-btn .lbl-long { display: none; }
  .research-grid { grid-template-columns: minmax(0, 1fr); }
  .research-grid > :last-child:nth-child(odd) { grid-column: auto; }
  .ctas .btn { flex: 1 1 auto; }
  .post a { grid-template-columns: minmax(0, 1fr) auto; padding: 20px 2px; }
  .post a:hover { padding-inline: 2px; background: none; }
  .post time { grid-column: 1 / -1; }
  .post .go { grid-row: 2; grid-column: 2; align-self: start; padding-top: 4px; }
  .post .cover { grid-column: 1 / -1; }
  .update { grid-template-columns: 18px minmax(0, 1fr); }
  .update time { grid-column: 2; grid-row: 1; padding: 0 0 4px; }
  .update .tick { grid-column: 1; grid-row: 1 / span 2; }
  .update p { grid-column: 2; }
  .pub { grid-template-columns: minmax(0, 1fr); }
  .timeline > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .project dl > div { grid-template-columns: 96px minmax(0, 1fr); }
  .link-grid { grid-template-columns: minmax(0, 1fr); }
  .link-card { min-height: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
  .link-card .row { order: 2; }
  .link-card .row .mono { display: none; }
  .link-card .name { margin-top: 0; }
  .article-nav { grid-template-columns: minmax(0, 1fr); }
  .article-nav .next { grid-column: 1; }
  .prose { font-size: 17px; }
}

@media (max-width: 380px) {
  .brand-name { font-size: 14.5px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (hover: none) {
  .card.is-link:hover, .card.is-hover:hover { transform: none; box-shadow: none; }
}
