/* ============================================================
   Il Bellini — design system "Carta & inchiostro"
   Fondo carta, inchiostro nero, un solo accento rosso,
   tipografia da manifesto (Bodoni) + testo leggibile (Inter).
   ============================================================ */

/* ---------- Font (self-hosted, OFL — vedi /vendor/fonts/LICENSE-*) ---------- */
@font-face {
  font-family: 'Bodoni Moda'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('/vendor/fonts/bodoni-moda-latin-standard-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bodoni Moda'; font-style: normal; font-weight: 400 900; font-display: swap;
  src: url('/vendor/fonts/bodoni-moda-latin-ext-standard-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bodoni Moda'; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url('/vendor/fonts/bodoni-moda-latin-standard-italic.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Bodoni Moda'; font-style: italic; font-weight: 400 900; font-display: swap;
  src: url('/vendor/fonts/bodoni-moda-latin-ext-standard-italic.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/vendor/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/vendor/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Token ---------- */
:root {
  --paper: #efe7d8;
  --paper-2: #e6dccb;
  --paper-3: #dcd0bb;
  --ink: #141210;
  --ink-soft: #4a443d;
  --ink-mute: #7a7166;
  --red: #b3261e;
  --red-ink: #8e1d17;
  --line: rgba(20, 18, 16, .18);
  --line-strong: rgba(20, 18, 16, .55);

  --serif: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  /* grana carta (rumore SVG) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.06 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
/* grana sopra tutto, non interattiva */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background-image: var(--grain); opacity: .22; mix-blend-mode: multiply;
}
body.no-grain::after { display: none; }

::selection { background: var(--red); color: var(--paper); }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

body.page {
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
}

/* ---------- Tipografia ---------- */
.kicker {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft);
}
.display {
  font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; line-height: .95;
  font-variation-settings: 'opsz' 96;
}
.display em, .page-head h1 em { font-style: italic; color: var(--red); }
.lede {
  font-family: var(--serif); font-size: clamp(19px, 2.1vw, 25px); line-height: 1.45;
  font-weight: 400; color: var(--ink); max-width: 46ch; margin: 0;
}
.prose { max-width: 62ch; color: var(--ink-soft); }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.num { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--red); }

/* ---------- Testata pagina ---------- */
.masthead {
  display: flex; align-items: center; gap: 18px;
  padding: 18px var(--gutter) 0;
  font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft);
}
.masthead::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); }
.masthead .mh-right { order: 3; }
/* con il link "indietro" fisso in alto a sinistra la testata parte dopo */
.topbar ~ .masthead { padding-left: max(var(--gutter), 190px); padding-top: 24px; }

.page-head {
  width: 100%; max-width: var(--max); margin: 0 auto;
  padding: clamp(64px, 10vw, 120px) var(--gutter) clamp(28px, 4vw, 48px);
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px 56px; align-items: end;
}
.page-head h1 {
  grid-column: 1 / -1;
  margin: 10px 0 0; font-family: var(--serif); font-weight: 500;
  font-size: clamp(54px, 10vw, 148px); line-height: .9; letter-spacing: -.02em;
  font-variation-settings: 'opsz' 96;
}
.page-head .rule { grid-column: 1 / -1; }
.page-head .lede { grid-column: 1; }
.page-head .head-aside { grid-column: 2; align-self: end; }

.rule { height: 1px; background: var(--ink); transform-origin: left; }
.rule.thin { background: var(--line-strong); }

.section {
  width: 100%; max-width: var(--max); margin: 0 auto; padding: clamp(28px, 5vw, 64px) var(--gutter);
}
.section-head {
  display: flex; align-items: baseline; gap: 16px; margin-bottom: 26px;
  border-top: 1px solid var(--ink); padding-top: 14px;
}
.section-head h2 {
  margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(28px, 3.4vw, 44px); line-height: 1;
}
.section-head .num { font-size: 18px; }
.section-head .kicker { margin-left: auto; }

/* ---------- Topbar (link indietro) ---------- */
.topbar {
  position: fixed; top: 14px; left: 14px; z-index: 40;
  pointer-events: none;
}
.topbar .pill, .pill {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 999px;
  padding: 8px 16px 8px 13px;
  font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  text-decoration: none;
  transition: background .25s var(--ease), color .25s var(--ease);
}
.pill .arr { display: inline-block; transition: transform .3s var(--ease); }
.topbar .pill:hover, .pill:hover { background: var(--ink); color: var(--paper); }
.pill:hover .arr { transform: translateX(-4px); }

/* ---------- Pulsante e pannello info ---------- */
.info-btn {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink);
  font-family: var(--serif); font-style: italic; font-weight: 600; font-size: 22px; line-height: 1;
  cursor: pointer; padding: 0 0 2px;
  box-shadow: 0 6px 18px rgba(20, 18, 16, .12);
  transition: background .25s var(--ease), color .25s var(--ease), transform .3s var(--ease), border-color .25s;
}
.info-btn:hover { background: var(--ink); color: var(--paper); transform: rotate(-8deg) scale(1.05); }
.info-btn[aria-expanded="true"] { background: var(--red); border-color: var(--red); color: var(--paper); }

.info-scrim {
  position: fixed; inset: 0; z-index: 80; background: rgba(20, 18, 16, .28);
  opacity: 0; pointer-events: none; transition: opacity .35s var(--ease);
}
.info-scrim.on { opacity: 1; pointer-events: auto; }
.info-panel {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: 81;
  width: min(440px, 92vw); overflow-y: auto;
  background: var(--paper); color: var(--ink);
  border-left: 1px solid var(--ink);
  box-shadow: -24px 0 60px rgba(20, 18, 16, .18);
  padding: 72px 36px 40px;
  transform: translateX(104%); transition: transform .5s var(--ease);
  visibility: hidden;
}
.info-panel.left { right: auto; left: 0; border-left: none; border-right: 1px solid var(--ink); transform: translateX(-104%); box-shadow: 24px 0 60px rgba(20, 18, 16, .18); }
.info-panel.on { transform: none; visibility: visible; }
.info-panel::before { content: ''; position: absolute; inset: 0; background-image: var(--grain); opacity: .18; mix-blend-mode: multiply; pointer-events: none; }
.info-panel .ip-close {
  position: absolute; top: 18px; right: 18px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer;
  font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s, transform .3s var(--ease);
}
.info-panel.left .ip-close { right: 18px; }
.info-panel .ip-close:hover { background: var(--ink); color: var(--paper); transform: rotate(90deg); }
.info-panel .kicker { display: block; margin-bottom: 14px; }
.info-panel h2 {
  margin: 0 0 18px; font-family: var(--serif); font-weight: 500;
  font-size: clamp(30px, 4vw, 42px); line-height: 1.02; letter-spacing: -.01em;
}
.info-panel .rule { margin-bottom: 22px; }
.info-panel .prose { font-size: 15.5px; color: var(--ink-soft); }
.info-panel .ip-actions { margin-top: 28px; }
.info-panel .ip-figure { margin: 26px 0 0; }
.info-panel .ip-img {
  display: block; width: 100%; padding: 8px; cursor: zoom-in;
  background: var(--paper-2); border: 1px solid var(--ink);
}
.info-panel .ip-img img {
  width: 100%; max-height: 320px; object-fit: contain; display: block;
  transition: transform .8s var(--ease);
}
.info-panel .ip-img:hover img { transform: scale(1.03); }
.info-panel .ip-figure + .ip-actions { margin-top: 18px; }
.info-panel.on .ip-anim { animation: ipIn .6s var(--ease) both; }
.info-panel.on .ip-anim:nth-child(2) { animation-delay: .06s; }
.info-panel.on .ip-anim:nth-child(3) { animation-delay: .12s; }
.info-panel.on .ip-anim:nth-child(4) { animation-delay: .18s; }
.info-panel.on .ip-anim:nth-child(5) { animation-delay: .24s; }
@keyframes ipIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.btn-ink {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  padding: 13px 20px; border-radius: 999px; cursor: pointer;
  font: 600 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  transition: background .25s var(--ease), border-color .25s;
}
.btn-ink .arr { transition: transform .3s var(--ease); }
.btn-ink:hover { background: var(--red); border-color: var(--red); }
.btn-ink:hover .arr { transform: translateX(4px); }

/* Overlay per link interni (es. costume aperto da un tour) */
.link-overlay {
  position: fixed; inset: 0; z-index: 85; background: rgba(20, 18, 16, .55);
  display: flex; align-items: center; justify-content: center; padding: 3vh 3vw;
  opacity: 0; transition: opacity .35s var(--ease);
}
.link-overlay.on { opacity: 1; }
.link-overlay .lo-frame {
  position: relative; width: 100%; height: 100%; max-width: 1400px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 6px; overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .4);
  transform: translateY(14px) scale(.985); transition: transform .45s var(--ease);
}
.link-overlay.on .lo-frame { transform: none; }
.link-overlay iframe { width: 100%; height: 100%; border: 0; display: block; }
.link-overlay .lo-image { display: flex; align-items: center; justify-content: center; padding: 18px; }
.link-overlay .lo-image img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.link-overlay .lo-close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--ink);
  background: var(--paper); color: var(--ink); font-size: 22px; cursor: pointer;
}
.link-overlay .lo-close:hover { background: var(--ink); color: var(--paper); }

/* ---------- Card "manifesto" (tour, costumi) ---------- */
.poster-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: clamp(20px, 3vw, 40px);
}
.poster-card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  text-decoration: none; color: var(--ink);
}
.poster-card .pc-frame {
  position: relative; aspect-ratio: 3 / 4; overflow: hidden;
  background: var(--paper-2); border: 1px solid var(--ink); padding: 8px;
}
.poster-card .pc-img {
  position: absolute; inset: 8px; background: var(--paper-3) center / cover no-repeat;
  filter: grayscale(.35) contrast(1.02) sepia(.12);
  transition: transform 1.1s var(--ease), filter .6s var(--ease);
}
.poster-card .pc-num {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  background: var(--paper); border: 1px solid var(--ink); padding: 4px 9px;
  font-family: var(--serif); font-style: italic; font-size: 14px;
}
.poster-card .pc-meta { display: flex; align-items: baseline; gap: 12px; border-top: 1px solid var(--ink); padding-top: 12px; }
.poster-card h3 {
  margin: 0; font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 2.4vw, 30px); line-height: 1.05; flex: 1;
}
.poster-card .pc-arr { font-size: 20px; transition: transform .35s var(--ease), color .2s; }
.poster-card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.poster-card:hover .pc-img { transform: scale(1.045); filter: none; }
.poster-card:hover .pc-arr { transform: translateX(6px); color: var(--red); }
.poster-card:hover h3 { color: var(--red); }

/* ---------- Footer brand ---------- */
.brand-footer {
  position: fixed; bottom: 14px; right: 14px; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line-strong);
  padding: 6px 14px; border-radius: 999px;
  pointer-events: none;
}
.brand-footer a { pointer-events: auto; display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand-footer img { height: 20px; width: auto; display: block; }
.brand-footer .pw { color: var(--ink-soft); font-size: 11px; letter-spacing: .08em; white-space: nowrap; }
.brand-footer.static { position: static; margin: 0 auto 28px; width: max-content; }

/* ---------- Stato vuoto / caricamento ---------- */
.empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); padding: 60px 24px; font-family: var(--serif); font-style: italic; font-size: 20px;
}
.ink-loader {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--paper); transition: opacity .5s var(--ease);
}
.ink-loader.hide { opacity: 0; pointer-events: none; }
.ink-loader .il-title { font-family: var(--serif); font-style: italic; font-size: 26px; }
.ink-loader .il-bar { width: 180px; height: 1px; background: var(--line-strong); position: relative; overflow: hidden; }
.ink-loader .il-bar > i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ink); transition: width .2s ease; }
.ink-loader .il-bar.indeterminate > i { width: 40%; animation: ilSlide 1.3s var(--ease-io) infinite; }
.ink-loader p { margin: 0; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); }
@keyframes ilSlide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- Entrate ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.draw { transform: scaleX(0); transition: transform 1.2s var(--ease-io); }
.draw.is-in { transform: scaleX(1); }

/* pagina incorporata in un overlay */
html.embedded .topbar, html.embedded .brand-footer { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .page-head { grid-template-columns: 1fr; padding-top: 76px; }
  .page-head .lede, .page-head .head-aside { grid-column: 1; }
  .brand-footer { left: 50%; right: auto; transform: translateX(-50%); padding: 4px 10px; }
  .brand-footer img { height: 15px; }
  .brand-footer .pw { font-size: 10px; }
  .brand-footer.static { transform: none; }
  .info-panel { padding: 70px 24px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .draw { transform: none; }
}

/* ---------- Viewer 3D (architettura, costumi) ---------- */
body.viewer3d { height: 100vh; height: 100svh; overflow: hidden; }
body.viewer3d #stage {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 55%),
    var(--paper);
}
body.viewer3d #stage::after { /* filetto a cornice */
  content: ''; position: absolute; inset: 12px; border: 1px solid var(--line-strong); pointer-events: none;
}
body.viewer3d model-viewer { width: 100%; height: 100%; --poster-color: transparent; background: transparent; }
.v3-caption {
  position: fixed; left: 34px; bottom: 34px; z-index: 20; max-width: min(520px, 70vw);
  opacity: 0; transform: translateY(10px); transition: opacity .9s var(--ease) .2s, transform .9s var(--ease) .2s;
}
body.ready .v3-caption { opacity: 1; transform: none; }
.v3-caption h1 { margin: 6px 0 4px; font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 4.6vw, 64px); line-height: .95; }
.v3-caption p { margin: 0; color: var(--ink-soft); font-size: 13.5px; }
.v3-hint { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 20; color: var(--ink-soft); }
.info-dock {
  position: fixed; top: 50%; z-index: 30; transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.info-dock.left { left: 30px; }
.info-dock.right { right: 30px; }
.info-dock .dock-label {
  writing-mode: vertical-rl; font-size: 10px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-soft);
}
.info-dock.left .dock-label { transform: rotate(180deg); }
.info-dock .info-btn { width: 54px; height: 54px; font-size: 26px; }
@media (max-width: 760px) {
  .v3-caption { left: 22px; bottom: 64px; }
  .info-dock { top: auto; bottom: 64px; transform: none; }
  .info-dock.left { left: auto; right: 20px; }
  .info-dock.right { right: 20px; }
  .info-dock .dock-label { display: none; }
  .v3-hint { display: none; }
}
