/* ==========================================================================
   VINCENZO RIILI — HOMEPAGE V2 (MOBILE-FIRST KINETIC & DESKTOP 3D EDITION)
   Preserves exact colors, editorial elegance, and moving logo ribbon of
   vincenzoriili.com, enhanced with:
   - Living Hero Title Roller
   - Desktop: 3D Perspective Tilt + Cursor Radial Spotlight
   - Mobile/Touch: Scroll-Center Virtual Spotlight + Touch Spring Physics +
     Native Horizontal Scroll-Snap Carousels for Principles
   ========================================================================== */

:root {
  --ink: #101719;
  --muted: #657174;
  --paper: #fafaf7;
  --warm: #efeee8;
  --accent: #c5e5cf;
  --accent-deep: #489876;
  --accent-title: #49826b;
  --line: rgba(16, 23, 25, 0.14);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 100px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  font: inherit;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 5px;
}

.wrap {
  width: min(1320px, calc(100% - 96px));
  margin-inline: auto;
}

.skip {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 100;
  background: white;
  padding: 12px;
  transform: translateY(-160%);
}
.skip:focus {
  transform: none;
}

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent-deep);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  z-index: 90;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  gap: 24px;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.04em;
  font-size: 22px;
}

.brand-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--accent-deep);
  border-radius: 50%;
  margin-left: 9px;
}

.navlinks {
  display: flex;
  gap: 24px;
  font-size: 13px;
}

.navlinks a {
  text-decoration: none;
  position: relative;
}

.navlinks a::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-deep);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}

.navlinks a:hover::after,
.navlinks a.current::after {
  transform: scaleX(1);
}

.menu {
  display: none;
  background: none;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 24px;
}

/* ==========================================================================
   HERO & LIVING TITLE ROLLER
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 64px;
  align-items: center;
  padding-block: 80px 64px;
}

.kicker {
  text-transform: uppercase;
  font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.12em;
  margin: 0 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-deep);
  box-shadow: 0 0 0 0 rgba(72, 152, 118, 0.6);
  animation: pulse-sage 2.5s infinite;
}

@keyframes pulse-sage {
  0% { box-shadow: 0 0 0 0 rgba(72, 152, 118, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(72, 152, 118, 0); }
  100% { box-shadow: 0 0 0 0 rgba(72, 152, 118, 0); }
}

.hero h1 {
  font-size: clamp(36px, 4vw, 60px);
  line-height: 1.12;
  letter-spacing: -0.055em;
  margin: 0 0 28px;
  font-weight: 600;
}

/* Smooth Vertical Roller inside H1 */
.hero-roller {
  display: inline-grid;
  vertical-align: bottom;
  height: 1.12em;
  overflow: hidden;
  position: relative;
}

.hero-roller-track {
  display: flex;
  flex-direction: column;
  will-change: transform;
  transition: transform 0.72s var(--ease-spring);
}

.hero-roller-item {
  font-style: normal;
  color: var(--accent-title);
  height: 1.12em;
  line-height: 1.12em;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.lead {
  font-size: 19px;
  line-height: 1.65;
  max-width: 570px;
  margin: 0;
}

.companyline {
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0;
}

.btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  border: 1px solid currentColor;
  border-radius: 40px;
  padding: 13px 20px;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), translate 0.25s var(--ease), transform 0.2s var(--ease-spring);
}

.btn.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.btn:hover {
  translate: 0 -3px;
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}

.btn:active {
  transform: scale(0.96);
}

/* Hero Portrait Carousel with Smooth Dissolve */
.hero-media {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: 24px;
  overflow: hidden;
  background: var(--warm);
  transition: transform 0.4s var(--ease);
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}

.hero-frame {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.035);
  transition: opacity 0.8s var(--ease), transform 1.1s var(--ease), visibility 0.8s;
}

.hero-frame.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  z-index: 1;
}

.hero-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-frame figcaption {
  position: absolute;
  bottom: 70px;
  left: 24px;
  color: white;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 11px;
}

.hero-dots {
  position: absolute;
  bottom: 25px;
  left: 24px;
  z-index: 2;
  display: flex;
  gap: 9px;
}

.hero-dot, .stage-dot {
  width: 12px;
  height: 12px;
  border: 1px solid white;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  transition: background 0.25s, transform 0.25s;
}

.hero-dot.active, .stage-dot.active {
  background: white;
  transform: scale(1.12);
}

.carousel-pause {
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: white;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  border-radius: 30px;
  padding: 6px 12px;
  font-size: 11px;
  z-index: 2;
}

.hero-media > .carousel-pause {
  position: absolute;
  right: 20px;
  bottom: 20px;
}

/* ==========================================================================
   PROOF & MOVING LOGO STREAM (ORIGINAL VINCENZORIILI.COM STYLE)
   ========================================================================== */
.proof {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  padding-block: 32px 48px;
  gap: 28px;
}

.proof strong {
  display: block;
  font-size: 29px;
  letter-spacing: -0.04em;
}

.proof span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.logoshell {
  padding: 34px 0 46px;
  background: var(--warm);
  overflow: hidden;
}

.logotitle {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 28px;
}

.logo-marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.logo-track {
  display: flex;
  width: max-content;
  animation: logo-glide 34s linear infinite;
}

.logo-marquee:hover .logo-track {
  animation-play-state: paused;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 32px;
  padding-right: 32px;
}

.logo {
  background: white;
  border-radius: 12px;
  min-width: 185px;
  height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  border: 1px solid rgba(16, 23, 25, 0.06);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.logo:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -10px rgba(16, 23, 25, 0.12);
}

.logo img {
  max-height: 42px;
  object-fit: contain;
}

.logo small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
}

.logo-text span {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

@keyframes logo-glide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ==========================================================================
   SECTIONS & INTERACTIVE MOVING SQUARES (DESKTOP + MOBILE)
   ========================================================================== */
.section {
  padding-block: 100px;
}

.white {
  background: var(--paper);
}

.warm {
  background: var(--warm);
}

.dark {
  background: var(--ink);
  color: #f2f3ed;
  --line: rgba(255, 255, 255, 0.16);
  --muted: #b2bcb9;
}

.sectionhead {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  align-items: end;
  margin-bottom: 50px;
}

h2 {
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.045em;
  font-weight: 550;
  margin: 0;
}

h3 {
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 600;
}

.sectionhead > p {
  color: var(--muted);
  max-width: 480px;
  margin: 0;
}

/* Journey Grid + Interactive Squares */
.journey {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding-top: 32px;
}

.journey::before,
.journey::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--line);
}

.journey::after {
  background: var(--accent-deep);
  transform: scaleX(var(--fill, 0));
  transform-origin: left;
}

.journey article {
  position: relative;
  isolation: isolate;
  padding: 22px 18px;
  border-radius: 16px;
  border: 1px solid transparent;
  transition: transform 0.4s var(--ease-spring), border-color 0.35s var(--ease), background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.journey article::before {
  content: "";
  position: absolute;
  top: -38px;
  left: 18px;
  width: 10px;
  height: 10px;
  background: var(--accent-deep);
  border-radius: 50%;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.journey article:hover::before,
.journey article.in-focus::before {
  transform: scale(1.45);
  box-shadow: 0 0 0 5px rgba(72, 152, 118, 0.22);
}

.journey span,
.principles span {
  font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

.journey p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 0;
}

/* Principles & Cards (3D Kinetic Tilt + Mobile Scroll Focus + Touch Spring) */
.principles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.principles article,
.card {
  position: relative;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  overflow: hidden;
  will-change: transform;
  transform: perspective(900px) rotateX(var(--card-rx, 0deg)) rotateY(var(--card-ry, 0deg)) translateY(var(--card-lift, 0px)) scale(var(--card-scale, 1));
  transition: transform 0.4s var(--ease-spring), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.principles b {
  display: block;
  color: var(--accent);
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-bottom: 30px;
}

.principles p {
  font-size: 14px;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.42);
  min-height: 330px;
}

.white .card {
  background: rgba(255, 255, 255, 0.85);
}

.card h3 {
  margin: 0 0 18px;
}

.card > p:not(.kicker) {
  font-size: 15px;
  color: var(--muted);
}

.link {
  margin-top: auto;
  padding-top: 22px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.link .arrow {
  display: inline-block;
  transition: transform 0.25s var(--ease-spring);
}

.card:hover .link .arrow,
.card.in-focus .link .arrow {
  transform: translate(5px, -1px);
}

/* Soft Radial Spotlight Inside Every Moving Square */
.tilt-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(112, 183, 144, 0.22), transparent 72%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.tilt-card:hover::after,
.tilt-card:focus-within::after,
.tilt-card.in-focus::after,
.tilt-card.is-pressed::after {
  opacity: 1;
}

/* Tactile Touch Compression State */
.tilt-card.is-pressed {
  --card-scale: 0.975 !important;
  border-color: var(--accent-deep) !important;
}

/* ==========================================================================
   SCROLL-DRIVEN WORD REVEAL (DYNAMIC ABOUT / MANIFESTO)
   ========================================================================== */
.scroll-word {
  transition: opacity 0.28s var(--ease), color 0.28s var(--ease);
  opacity: 0.26;
}

.scroll-word.is-lit {
  opacity: 1;
}

/* ==========================================================================
   STAGE CAROUSEL
   ========================================================================== */
.stage {
  position: relative;
  min-height: 650px;
  background: var(--ink);
  color: white;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  min-height: 650px;
  display: flex;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.85s var(--ease), visibility 0.85s;
}

.slide.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.slide > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.03);
  transition: transform 5.5s ease-out;
}

.slide.active > img {
  transform: scale(1);
}

.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.4) 65%, rgba(0, 0, 0, 0.2));
}

.slidecopy {
  position: relative;
  z-index: 1;
  max-width: 650px;
  padding: 90px 48px 120px;
  margin-left: max(0px, calc((100vw - 1320px) / 2));
}

.slidecopy h2 {
  font-size: clamp(32px, 4vw, 52px);
}

.slidecopy p:not(.kicker) {
  max-width: 460px;
}

.stage-controls {
  position: absolute;
  bottom: 32px;
  left: 48px;
  right: 48px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 20px;
}

.stage-prev, .stage-next {
  border: 1px solid white;
  background: transparent;
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  transition: background 0.25s, color 0.25s;
}

.stage-prev:hover, .stage-next:hover {
  background: white;
  color: var(--ink);
}

.stage-dots {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   SPLIT, BIG QUESTION & FOOTER
   ========================================================================== */
.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 80px;
}

.bodycopy p:first-child {
  margin-top: 0;
}

.bodycopy p {
  font-size: 18px;
  line-height: 1.7;
}

.bigquestion {
  text-align: center;
}

.bigquestion blockquote {
  font-size: clamp(30px, 4.4vw, 58px);
  line-height: 1.25;
  letter-spacing: -0.035em;
  max-width: 1000px;
  margin: 30px auto 45px;
}

.bigquestion .btns {
  justify-content: center;
}

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

.footer {
  background: var(--ink);
  color: #b2bcb9;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding: 32px 0;
  font-size: 11px;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 30px;
}

.footer a {
  margin-right: 18px;
}

/* Reveal on Scroll */
.reveal-ready {
  opacity: 0;
  translate: 0 20px;
  transition: opacity 0.7s var(--ease), translate 0.7s var(--ease);
}

.reveal-ready.is-visible {
  opacity: 1;
  translate: 0 0;
}

/* Desktop Hover Lift + Border Highlight */
@media (hover: hover) and (pointer: fine) {
  .card:hover,
  .principles article:hover {
    --card-lift: -6px;
    border-color: var(--accent-deep);
    box-shadow: 0 18px 36px -16px rgba(16, 23, 25, 0.16);
  }
  .journey article:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--accent-deep);
    box-shadow: 0 14px 28px -14px rgba(16, 23, 25, 0.1);
  }
}

/* Touch / Mobile Scroll-Center Virtual Spotlight Active States */
@media (hover: none), (pointer: coarse), (max-width: 800px) {
  .card.in-focus,
  .principles article.in-focus {
    --card-lift: -5px;
    border-color: var(--accent-deep);
    box-shadow: 0 16px 32px -14px rgba(16, 23, 25, 0.16);
  }
  .journey article.in-focus {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--accent-deep);
    box-shadow: 0 12px 24px -12px rgba(16, 23, 25, 0.1);
  }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS & NATIVE MOBILE SWIPE DECKS
   ========================================================================== */
@media (max-width: 1100px) {
  .wrap { width: calc(100% - 48px); }
  .hero { gap: 32px; }
  .navlinks { gap: 14px; font-size: 12px; }
  .journey { grid-template-columns: repeat(3, 1fr); row-gap: 40px; }
  .journey article::before { display: none; }
  .principles { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .menu { display: block; }
  .navlinks {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 82px;
    left: 0;
    right: 0;
    background: var(--paper);
    padding: 24px;
    gap: 22px;
    border-bottom: 1px solid var(--line);
  }
  .navlinks[hidden] { display: none; }
  .hero { grid-template-columns: 1fr; padding-block: 48px; }
  .hero-media { max-width: 540px; width: 100%; justify-self: center; }
  .hero h1 { font-size: clamp(34px, 7vw, 52px); }
  .proof { grid-template-columns: repeat(2, 1fr); }
  .section { padding-block: 64px; }
  .sectionhead, .split { grid-template-columns: 1fr; gap: 24px; }

  /* Vertical Animated Timeline with Focus Cards on Mobile */
  .journey {
    grid-template-columns: 1fr;
    padding-left: 26px;
    padding-top: 0;
    gap: 16px;
  }
  .journey::before, .journey::after {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: 2px;
    height: auto;
  }
  .journey::after {
    transform: scaleY(var(--fill, 0));
    transform-origin: top;
  }
  .journey article::before {
    display: block;
    left: -31px;
    top: 24px;
  }
  .journey h3 { margin: 8px 0; }

  /* Horizontal Apple-style Swipe Deck for Principles on Mobile */
  .principles {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 14px;
    padding-bottom: 14px;
    margin-inline: -24px;
    padding-inline: 24px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .principles::-webkit-scrollbar {
    display: none;
  }
  .principles article {
    flex: 0 0 78%;
    max-width: 310px;
    scroll-snap-align: center;
  }

  .footer-grid { flex-direction: column; }
  .slidecopy { padding: 64px 24px 120px; margin: 0; }
  .stage-controls { left: 24px; right: 24px; gap: 12px; }
  .slide, .stage { min-height: 580px; }
}

@media (max-width: 520px) {
  .wrap { width: calc(100% - 36px); }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .proof strong { font-size: 24px; }
  .btn { padding: 12px 16px; }
  .stage-controls .carousel-pause { margin-left: auto; font-size: 10px; }
  .principles {
    margin-inline: -18px;
    padding-inline: 18px;
  }
  .principles article {
    flex: 0 0 82%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .reveal-ready { opacity: 1; translate: none; }
  .scroll-word { opacity: 1 !important; }
  .hero-media, .card, .principles article { transform: none !important; }
  .card:hover, .principles article:hover, .btn:hover { translate: none; }
}
