:root {
  --mono-space-1: clamp(6px, 0.5vw, 10px);
  --mono-space-2: clamp(12px, 1vw, 18px);
  --mono-space-3: clamp(18px, 1.8vw, 30px);
  --mono-space-4: clamp(28px, 3vw, 52px);
  --mono-space-5: clamp(44px, 5vw, 88px);
  --mono-space-6: clamp(72px, 8vw, 138px);
  --mono-radius-surface: clamp(24px, 2.6vw, 42px);
  --mono-motion-instant: 150ms;
  --mono-motion-fast: 240ms;
  --mono-motion-scene: 720ms;
  --mono-motion-portal: 820ms;
  --mono-type-hero: clamp(58px, 7vw, 112px);
  --mono-type-section: clamp(42px, 5.4vw, 84px);
  --mono-type-card: clamp(25px, 2.2vw, 38px);
  --mono-type-body: clamp(16px, 1.16vw, 19px);
  --mono-oil-origin-x: 50vw;
  --mono-oil-origin-y: 50vh;
}

html[data-mono-quality="balanced"] {
  --mono-motion-scene: 580ms;
  --mono-motion-portal: 660ms;
}

.mono-world main {
  view-transition-name: mono-main;
}

.mono-world .site-header {
  view-transition-name: mono-header;
}

.mono-world .page-hero h1,
.mono-world .cinema-claim {
  font-size: var(--mono-type-hero);
}

.mono-world .page-section h2,
.mono-world .section-heading h2,
.mono-world .definition-section h2 {
  font-size: var(--mono-type-section);
}

.mono-world .page-card h3 {
  font-size: var(--mono-type-card);
}

.mono-world .page-hero p,
.mono-world .page-section > p,
.mono-world .definition-column p {
  font-size: var(--mono-type-body);
}

html[data-mono-time="morning"] .mono-world {
  --mono-daylight: rgba(255, 249, 238, 0.12);
  --page-glow-secondary: rgb(var(--mono-butter-rgb) / 0.26);
}

html[data-mono-time="day"] .mono-world {
  --mono-daylight: rgba(255, 255, 255, 0.045);
}

html[data-mono-time="evening"] .mono-world {
  --mono-daylight: rgb(var(--mono-brick-rgb) / 0.075);
  --page-glow-secondary: rgba(203, 167, 90, 0.18);
}

/* MONO O Portal */
.mono-o-portal {
  align-items: center;
  background:
    radial-gradient(circle at var(--mono-portal-x) var(--mono-portal-y), rgb(var(--mono-cashmere-rgb) / 0.96) 0 8%, rgb(var(--mono-gold-rgb) / 0.92) 28%, rgb(var(--mono-olive-rgb) / 0.94) 54%, var(--mono-anthracite) 100%);
  clip-path: circle(0 at var(--mono-portal-x) var(--mono-portal-y));
  display: grid;
  inset: 0;
  isolation: isolate;
  justify-items: center;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  transition: clip-path var(--mono-motion-portal) cubic-bezier(0.22, 0.88, 0.22, 1), opacity 80ms linear;
  z-index: 1000;
}

.mono-o-portal__ring {
  align-items: center;
  aspect-ratio: 1;
  border: clamp(5px, 0.7vw, 10px) solid rgba(244, 236, 221, 0.92);
  border-radius: 50%;
  color: transparent;
  display: flex;
  justify-content: center;
  left: var(--mono-portal-x);
  position: absolute;
  top: var(--mono-portal-y);
  transform: translate(-50%, -50%) scale(0.2);
  transition: transform var(--mono-motion-portal) cubic-bezier(0.18, 0.88, 0.22, 1);
  width: clamp(86px, 13vw, 180px);
}

.mono-o-portal__oil {
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 249, 238, 0.8), transparent 14%),
    radial-gradient(circle at 62% 68%, rgba(184, 92, 56, 0.68), transparent 50%),
    rgba(110, 106, 60, 0.76);
  border: 1px solid rgba(255, 249, 238, 0.48);
  border-radius: 44% 56% 52% 48% / 58% 42% 58% 42%;
  box-shadow: inset 0 0 22px rgba(255, 249, 238, 0.22), 0 24px 80px rgba(38, 35, 33, 0.28);
  filter: blur(0.2px);
  height: clamp(140px, 22vw, 320px);
  left: var(--mono-portal-x);
  opacity: 0;
  position: absolute;
  top: var(--mono-portal-y);
  transform: translate(-50%, -50%) scale(0.18) rotate(-9deg);
  transition: opacity 240ms ease, transform var(--mono-motion-portal) cubic-bezier(0.16, 0.9, 0.22, 1);
  width: clamp(150px, 24vw, 350px);
}

.is-mono-navigating .mono-o-portal {
  clip-path: circle(160vmax at var(--mono-portal-x) var(--mono-portal-y));
  opacity: 1;
}

.is-mono-navigating .mono-o-portal__ring {
  transform: translate(-50%, -50%) scale(7.8);
}

.is-mono-navigating .mono-o-portal__oil {
  opacity: 0.92;
  transform: translate(-50%, -50%) scale(6.8) rotate(8deg);
}

.is-mono-navigating[data-mono-flow-direction="previous"] .mono-o-portal__oil {
  transform: translate(-50%, -50%) scale(6.8) rotate(-16deg);
}

/* MONO FLOW */
.mono-next-chapter {
  --flow-drag: 0;
  background:
    radial-gradient(circle at 85% 22%, rgba(203, 167, 90, 0.2), transparent 30%),
    linear-gradient(135deg, rgb(var(--mono-cashmere-rgb) / 0.98), rgb(var(--mono-butter-rgb) / 0.84));
  border-block: 1px solid rgba(184, 92, 56, 0.16);
  min-height: min(76svh, 760px);
  overflow: hidden;
  padding: var(--mono-space-6) 0 var(--mono-space-5) clamp(24px, 7vw, 126px);
  position: relative;
  z-index: 2;
}

.mono-next-chapter::before {
  background: linear-gradient(90deg, var(--mono-terracotta), var(--mono-champagne), var(--mono-olive));
  content: "";
  height: 5px;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}

.mono-next-chapter__previous {
  color: var(--mono-ink-soft);
  display: grid;
  gap: 7px;
  left: clamp(24px, 4vw, 70px);
  max-width: 180px;
  position: absolute;
  text-decoration: none;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}

.mono-next-chapter__previous span,
.mono-next-chapter__index,
.mono-next-chapter__eyebrow,
.mono-next-chapter__gesture {
  font-family: "Sora", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mono-next-chapter__previous strong {
  color: var(--mono-anthracite);
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 20px;
}

.mono-next-chapter__stage {
  background:
    radial-gradient(circle at 88% 14%, rgba(255, 249, 238, 0.3), transparent 24%),
    radial-gradient(circle at 16% 80%, rgba(110, 106, 60, 0.18), transparent 32%),
    linear-gradient(145deg, var(--mono-terracotta-dark), var(--mono-terracotta) 58%, var(--mono-copper));
  border: 1px solid rgba(255, 249, 238, 0.24);
  border-radius: var(--mono-radius-surface) 0 0 var(--mono-radius-surface);
  box-shadow: 0 40px 100px rgba(38, 35, 33, 0.2);
  color: var(--mono-paper);
  cursor: grab;
  display: grid;
  gap: var(--mono-space-2);
  margin-left: clamp(160px, 17vw, 300px);
  min-height: min(55svh, 530px);
  padding: clamp(38px, 6vw, 96px) clamp(42px, 10vw, 176px) clamp(42px, 6vw, 90px) clamp(36px, 6vw, 104px);
  position: relative;
  transform: translate3d(calc(7vw + var(--flow-drag) * 72px), 0, 0);
  transition: transform 420ms var(--mono-ease-out), border-radius 320ms ease;
}

.mono-next-chapter[data-temperature="human"] .mono-next-chapter__stage {
  background: linear-gradient(145deg, var(--mono-sage), var(--mono-olive), var(--mono-olive-bright));
}

.mono-next-chapter[data-temperature="clear"] .mono-next-chapter__stage {
  background: linear-gradient(145deg, var(--mono-sage), var(--mono-olive), var(--mono-gold));
}

.mono-next-chapter[data-temperature="local"] .mono-next-chapter__stage {
  background: linear-gradient(145deg, var(--mono-terracotta), var(--mono-clay), var(--mono-gold));
}

.mono-next-chapter__stage.is-dragging {
  cursor: grabbing;
  transition: none;
}

.mono-next-chapter__index,
.mono-next-chapter__eyebrow {
  color: var(--mono-butter);
}

.mono-next-chapter__title {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(54px, 7.2vw, 116px);
  letter-spacing: -0.045em;
  line-height: 0.94;
  max-width: 9ch;
}

.mono-next-chapter__preview {
  color: rgba(255, 249, 238, 0.82);
  font-size: clamp(17px, 1.35vw, 21px);
  line-height: 1.5;
  max-width: 44ch;
}

.mono-next-chapter__gesture {
  align-items: center;
  color: rgba(255, 249, 238, 0.68);
  display: flex;
  gap: 12px;
  margin-top: auto;
}

.mono-next-chapter__gesture i {
  font-size: 24px;
  font-style: normal;
  transition: transform 240ms ease;
}

.mono-next-chapter__stage:hover .mono-next-chapter__gesture i {
  transform: translateX(8px);
}

.mono-next-chapter__open {
  align-items: center;
  align-self: end;
  background: var(--mono-paper);
  border-radius: 999px;
  color: var(--mono-terracotta-dark);
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  text-decoration: none;
  width: fit-content;
}

.mono-next-chapter__o {
  align-items: center;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 249, 238, 0.58);
  border-radius: 50%;
  color: rgba(255, 249, 238, 0.82);
  display: flex;
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: clamp(54px, 7vw, 104px);
  justify-content: center;
  pointer-events: none;
  position: absolute;
  right: clamp(28px, 5vw, 88px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(112px, 14vw, 220px);
}

/* Cinematic system */
.chapter-film__badge,
.cinema-film-badge {
  align-items: center;
  background: var(--video-badge-bg, var(--mono-video-badge-bg));
  border: var(--video-badge-border, 1px solid rgb(var(--mono-gold-rgb) / 0.65));
  border-radius: 35%;
  bottom: var(--video-badge-bottom, 16px);
  box-shadow: var(--video-badge-shadow, 0 10px 30px rgba(38, 35, 33, 0.2));
  display: flex;
  height: var(--video-badge-size, 68px);
  justify-content: center;
  pointer-events: none;
  position: absolute;
  right: var(--video-badge-right, 16px);
  width: var(--video-badge-size, 68px);
  z-index: 8;
}

.chapter-film__badge img,
.cinema-film-badge img {
  height: calc(100% * var(--video-badge-logo-scale, 0.76));
  object-fit: contain;
  width: calc(100% * var(--video-badge-logo-scale, 0.76));
}

.chapter-film .cinematic-film__control {
  z-index: 12;
}

.chapter-film .cinematic-film__skip {
  right: 16%;
  top: 16%;
}

.chapter-film .cinematic-film__replay {
  bottom: 16%;
  left: 16%;
}

.chapter-film .cinematic-film__audio {
  left: 16%;
  top: 16%;
}

.chapter-film.is-complete video,
.chapter-film.is-poster-only video,
.cinematic-film.is-complete video,
.cinematic-film.is-poster-only video {
  opacity: 0;
}

.chapter-film.is-complete .chapter-film__poster,
.chapter-film.is-poster-only .chapter-film__poster,
.cinematic-film.is-complete .cinematic-film__poster,
.cinematic-film.is-poster-only .cinematic-film__poster {
  opacity: 1;
}

.cinema-cinematic-controls {
  bottom: clamp(22px, 3vw, 48px);
  display: flex;
  gap: 10px;
  position: absolute;
  right: clamp(22px, 3vw, 48px);
  z-index: 18;
}

.cinema-cinematic-controls .cinematic-film__control {
  inset: auto;
  position: relative;
}

.cinema-film-badge {
  z-index: 7;
}

[data-cinematic-state="playing"] {
  --cinematic-state-label: "SALTA";
}

[data-cinematic-state="complete"] {
  --cinematic-state-label: "RIVEDI";
}

.mono-cinematic-still {
  aspect-ratio: 16 / 9;
  background: var(--mono-anthracite);
  border: 1px solid rgba(203, 167, 90, 0.28);
  border-radius: var(--mono-radius-surface);
  box-shadow: var(--mono-shadow-paper);
  margin: clamp(40px, 7vw, 110px) auto;
  max-width: min(1120px, calc(100% - 36px));
  overflow: hidden;
  position: relative;
}

.mono-cinematic-still > img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.mono-cinematic-still figcaption {
  background: linear-gradient(90deg, rgba(38, 35, 33, 0.82), transparent);
  bottom: 0;
  color: var(--mono-paper);
  font-family: "Sora", sans-serif;
  font-size: clamp(14px, 1.2vw, 17px);
  left: 0;
  margin: 0;
  padding: 36px 92px 24px 26px;
  position: absolute;
  width: 100%;
}

.mono-cinematic-still__badge {
  align-items: center;
  background: var(--mono-cashmere);
  border: 1px solid rgba(203, 167, 90, 0.65);
  border-radius: 35%;
  bottom: var(--video-badge-bottom, 16px);
  box-shadow: 0 10px 30px rgba(38, 35, 33, 0.2);
  display: flex;
  height: var(--video-badge-size, 68px);
  justify-content: center;
  pointer-events: none;
  position: absolute;
  right: var(--video-badge-right, 16px);
  width: var(--video-badge-size, 68px);
}

.mono-cinematic-still__badge img {
  height: 76%;
  width: 76%;
}

/* MONO OLIO VIVO */
.has-mono-oil {
  isolation: isolate;
  overflow: hidden;
  position: relative;
}

.has-mono-oil > :not(.mono-oil-surface) {
  position: relative;
  z-index: 2;
}

.mono-oil-surface {
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 249, 238, 0.72), transparent 18%),
    radial-gradient(circle at 72% 78%, rgba(110, 106, 60, 0.42), transparent 56%),
    rgba(203, 167, 90, 0.3);
  border-radius: 43% 57% 54% 46% / 62% 40% 60% 38%;
  inset: -38%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transform: translate3d(-24%, 16%, 0) scale(0.55) rotate(-12deg);
  transition: opacity 220ms ease, transform 360ms cubic-bezier(0.18, 0.86, 0.22, 1);
  z-index: 1;
}

.has-mono-oil:hover .mono-oil-surface,
.has-mono-oil:focus-visible .mono-oil-surface {
  opacity: 0.72;
  transform: translate3d(12%, -8%, 0) scale(1.08) rotate(7deg);
}

.is-oil-alive-pulsing::before {
  animation: mono-oil-global-pulse 940ms ease-out both;
  background: radial-gradient(circle, rgba(203, 167, 90, 0.24), rgba(110, 106, 60, 0.12) 34%, transparent 68%);
  border-radius: 50%;
  content: "";
  height: 200px;
  left: var(--mono-oil-origin-x);
  pointer-events: none;
  position: fixed;
  top: var(--mono-oil-origin-y);
  transform: translate(-50%, -50%);
  width: 200px;
  z-index: 999;
}

@keyframes mono-oil-global-pulse {
  from { opacity: 0.86; transform: translate(-50%, -50%) scale(0.25); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(6.5); }
}

/* MONO DROP */
.mono-drop {
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 120ms ease;
  z-index: 1100;
}

.mono-drop.is-visible {
  opacity: 1;
}

.mono-drop__trail {
  inset: 0;
  pointer-events: none;
  position: absolute;
}

.mono-drop__lens {
  --drop-x: 50vw;
  --drop-y: 50vh;
  --drop-angle: 0deg;
  --drop-stretch: 0;
  align-items: center;
  background:
    radial-gradient(circle at 31% 24%, var(--mono-drop-highlight) 0 7%, transparent 20%),
    radial-gradient(circle at 68% 72%, var(--mono-drop-reflection), transparent 54%),
    var(--mono-drop-body);
  border: 1px solid var(--mono-drop-border);
  border-radius: 46% 54% 52% 48% / 58% 44% 56% 42%;
  box-shadow: inset 0 0 8px rgb(var(--mono-cashmere-rgb) / 0.34), var(--mono-shadow-oil);
  color: var(--mono-text-inverse);
  display: flex;
  height: 16px;
  justify-content: center;
  left: 0;
  min-width: 16px;
  position: absolute;
  top: 0;
  transform:
    translate3d(calc(var(--drop-x) - 50%), calc(var(--drop-y) - 50%), 0)
    rotate(var(--drop-angle))
    scaleX(calc(1 + var(--drop-stretch)))
    scaleY(calc(1 - var(--drop-stretch) * 0.28));
  transform-origin: center;
  transition: height 180ms ease, min-width 180ms ease, padding 180ms ease, background-color 180ms ease;
  will-change: transform;
}

.mono-drop.has-refraction .mono-drop__lens {
  backdrop-filter: saturate(1.16) contrast(1.05);
}

.mono-drop__highlight {
  border-radius: inherit;
  box-shadow: inset 2px 2px 3px rgb(var(--mono-white-rgb) / 0.52), inset -2px -2px 4px rgb(var(--mono-anthracite-rgb) / 0.22);
  inset: 0;
  position: absolute;
}

.mono-drop__label {
  font-family: "Sora", sans-serif;
  font-size: 0;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  opacity: 0;
  position: relative;
  text-transform: uppercase;
  transform: rotate(calc(var(--drop-angle) * -1));
  transition: font-size 140ms ease, opacity 140ms ease;
  white-space: nowrap;
  z-index: 2;
}

.mono-drop.has-label .mono-drop__lens {
  border-radius: 999px;
  height: 42px;
  min-width: 42px;
  padding-inline: 15px;
}

.mono-drop.has-label .mono-drop__label {
  font-size: 10px;
  opacity: 1;
}

.mono-drop.is-pressed .mono-drop__lens {
  filter: brightness(0.94);
  scale: 0.86;
}

@media (hover: hover) and (pointer: fine) {
  .mono-drop-active,
  .mono-drop-active body,
  .mono-drop-active a,
  .mono-drop-active button,
  .mono-drop-active [role="button"],
  .mono-drop-active [data-flow-drag-zone] {
    cursor: none !important;
  }

  .mono-table-object:hover .mono-table-object__shape,
  .mono-table-object:focus-visible .mono-table-object__shape {
    filter: saturate(1.12) brightness(1.05);
    transform: scale(1.18);
  }
}

/* Tavola MONO 2.5D */
.mono-table-memory {
  contain: layout paint;
}

.mono-table-memory__picture img {
  transform: scale(1.018);
  transition: transform 1.4s var(--mono-ease-out), filter 800ms ease;
}

.mono-table-memory.has-memory .mono-table-memory__picture img {
  filter: saturate(1.04) contrast(1.02);
  transform: scale(1);
}

.mono-table-object__shape {
  transition: transform 320ms var(--mono-ease-out), filter 320ms ease, opacity 320ms ease;
}

/* Fallback and quality levels */
html[data-mono-quality="balanced"] .mono-world::after,
html[data-mono-quality="balanced"] .mono-page-scene {
  filter: none;
}

html[data-mono-quality="reduced"] .mono-o-portal__oil,
html[data-mono-quality="static"] .mono-o-portal__oil,
html[data-mono-quality="reduced"] .mono-oil-surface,
html[data-mono-quality="static"] .mono-oil-surface {
  display: none;
}

@media (max-width: 1080px) {
  .mono-next-chapter {
    padding-left: 24px;
  }

  .mono-next-chapter__previous {
    display: none;
  }

  .mono-next-chapter__stage {
    margin-left: 6vw;
    padding-right: clamp(90px, 16vw, 150px);
  }
}

@media (max-width: 820px), (hover: none), (pointer: coarse) {
  .mono-next-chapter {
    min-height: auto;
    padding: 72px 0 48px 18px;
  }

  .mono-next-chapter__stage {
    border-radius: 28px 0 0 28px;
    margin-left: 0;
    min-height: 440px;
    padding: 42px 74px 42px 30px;
    transform: none;
  }

  .mono-next-chapter__title {
    font-size: clamp(48px, 15vw, 74px);
  }

  .mono-next-chapter__o {
    right: -34px;
    width: 116px;
  }

  .mono-next-chapter__gesture {
    font-size: 10px;
  }

  .chapter-film__badge,
  .cinema-film-badge {
    --video-badge-size: 50px !important;
  }

  .cinema-cinematic-controls {
    bottom: 14px;
    right: 14px;
  }

  .mono-drop {
    display: none !important;
  }
}

@media (max-width: 560px) {
  :root {
    --mono-type-hero: clamp(40px, 12vw, 56px);
    --mono-type-section: clamp(35px, 10vw, 48px);
    --mono-type-card: clamp(24px, 7.5vw, 32px);
  }

  .mono-next-chapter__stage {
    min-height: 410px;
    padding-left: 24px;
  }

  .mono-next-chapter__preview {
    max-width: 26ch;
  }

  .cinema-cinematic-controls .cinematic-film__control,
  .chapter-film .cinematic-film__control {
    min-height: 44px;
    min-width: 64px;
  }

  .chapter-film .cinematic-film__skip {
    right: 12%;
    top: 12%;
  }

  .chapter-film .cinematic-film__replay {
    bottom: 12%;
    left: 12%;
  }

  .chapter-film .cinematic-film__audio {
    left: 12%;
    top: 12%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mono-o-portal,
  .mono-o-portal__ring,
  .mono-o-portal__oil,
  .mono-next-chapter__stage,
  .mono-table-memory__picture img,
  .mono-table-object__shape,
  .mono-table-object__shape::before,
  .mono-oil-surface {
    animation: none !important;
    transition-duration: 1ms !important;
  }

  .mono-drop,
  .is-oil-alive-pulsing::before {
    display: none !important;
  }

  .is-mono-navigating .mono-o-portal {
    background: var(--mono-cashmere);
    clip-path: none;
    opacity: 1;
  }
}

@media print {
  .mono-drop,
  .mono-o-portal,
  .mono-next-chapter__gesture,
  .cinema-cinematic-controls,
  .cinematic-film__control {
    display: none !important;
  }
}
