/* Andrea0x home — motion layer. Loaded after styles.css. */

@property --ring {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@property --fill {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Field ---------- */

#field {
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}

body.field-on #field {
  opacity: 1;
}

/* ---------- Entrance ---------- */

.js [data-rise] {
  opacity: 0;
  translate: 0 18px;
  transition: opacity 900ms var(--ease), translate 900ms var(--ease);
}

.js body.is-ready [data-rise] {
  opacity: 1;
  translate: 0 0;
}

body.is-ready .hero-copy .lead { transition-delay: 1.1s; }
body.is-ready .hero-copy .cta-row { transition-delay: 1.25s; }
body.is-ready .hero-copy .fine { transition-delay: 1.4s; }
body.is-ready .hero-copy .socials { transition-delay: 1.55s; }

.js .stage {
  opacity: 0;
  scale: 0.96;
  transition: opacity 1.2s var(--ease) 0.35s, scale 1.4s var(--ease) 0.35s;
}

.js body.is-ready .stage {
  opacity: 1;
  scale: 1;
}

.now-tag {
  animation: bob 6s ease-in-out infinite;
}

/* ---------- Active projects counter ---------- */

.js .now-scroll {
  height: 15rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

.js .now-scroll.rolling ul {
  animation: now-roll 32s linear infinite;
}

.now-scroll:hover ul {
  animation-play-state: paused;
}

.count {
  display: inline-block;
  min-width: 1ch;
  font-weight: 400;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}

.count.bump {
  animation: bump 420ms var(--spring);
}

/* ---------- Focus reveal title ---------- */

.focus-title {
  position: relative;
  font-size: clamp(2.7rem, 1rem + 4.4vw, 5.4rem);
}

.focus-title .w {
  display: inline-block;
  transition: filter 520ms var(--ease), opacity 520ms var(--ease);
}

.js .focus-title .w {
  filter: blur(14px);
  opacity: 0.28;
}

.js .focus-title .w.sharp {
  filter: blur(0);
  opacity: 1;
}

.focus-title .w.accent {
  color: var(--signal);
}

.focus-frame {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  border-radius: 6px;
  opacity: 0;
  transition:
    translate 460ms var(--ease),
    width 460ms var(--ease),
    height 460ms var(--ease),
    opacity 300ms var(--ease);
}

.focus-frame.on {
  opacity: 1;
}

.focus-frame i {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--signal);
}

.focus-frame i:nth-child(1) { left: -6px; top: -6px; border-right: 0; border-bottom: 0; }
.focus-frame i:nth-child(2) { right: -6px; top: -6px; border-left: 0; border-bottom: 0; }
.focus-frame i:nth-child(3) { left: -6px; bottom: -6px; border-right: 0; border-top: 0; }
.focus-frame i:nth-child(4) { right: -6px; bottom: -6px; border-left: 0; border-top: 0; }

/* ---------- Buttons: glow ring + liquid glass ---------- */

.btn-ring,
.btn-glass {
  position: relative;
  isolation: isolate;
  padding: 0;
  border: 0;
  align-items: stretch;
}

.btn-ring > span,
.btn-glass > span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem;
  border-radius: inherit;
}

.btn-lg.btn-ring > span,
.btn-lg.btn-glass > span {
  padding: 0.85rem 1.35rem;
}

.btn-ring {
  color: var(--ink);
  background: conic-gradient(
    from var(--ring),
    #fff6ef,
    var(--signal) 25%,
    #f2efe8 50%,
    var(--signal-2) 75%,
    #fff6ef
  );
  padding: 1.5px;
  box-shadow: 0 14px 40px -14px rgba(242, 164, 119, 0.55);
  animation: ring 6s linear infinite;
}

.btn-ring > span {
  background: linear-gradient(180deg, #fbf7f1, #eae1d5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.btn-ring::after {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: inherit;
  background: inherit;
  filter: blur(14px);
  opacity: 0.35;
  transition: opacity 260ms var(--ease);
}

.btn-glass {
  --mx: 50%;
  --my: 50%;
  color: var(--paper);
  background:
    radial-gradient(120px 80px at var(--mx) var(--my), rgba(255, 255, 255, 0.22), transparent 70%),
    rgba(242, 239, 232, 0.06);
  backdrop-filter: blur(14px) saturate(170%);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(242, 239, 232, 0.16),
    0 10px 30px -14px rgba(0, 0, 0, 0.8);
}

@media (hover: hover) {
  .btn-ring:hover {
    transform: translateY(-1px);
    animation-duration: 2.4s;
  }
  .btn-ring:hover::after {
    opacity: 0.7;
  }
  .btn-ring:hover svg {
    transform: translateX(2px);
  }
  .btn-glass:hover {
    transform: translateY(-1px);
    background:
      radial-gradient(140px 90px at var(--mx) var(--my), rgba(255, 255, 255, 0.3), transparent 70%),
      rgba(242, 239, 232, 0.09);
  }
}

.btn-ring:active,
.btn-glass:active {
  transform: translateY(1px) scale(0.985);
}

/* ---------- Story (sticky window) ---------- */

.story {
  position: relative;
  display: grid;
  max-width: calc(var(--measure) + 2 * var(--pad));
  margin: 0 auto;
  padding: 0 var(--pad) clamp(3rem, 8vw, 6rem);
}

.chapter {
  padding: clamp(3rem, 8vw, 5rem) 0;
}

.kick-num {
  font-family: var(--mono);
  color: var(--signal);
  letter-spacing: 0.04em;
}

.chapter-shot {
  margin-top: 2rem;
}

.story-visual {
  display: none;
}

@media (min-width: 1000px) {
  .story {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 4.5rem;
  }

  .chapter {
    min-height: 88svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0;
    transition: opacity 600ms var(--ease), filter 600ms var(--ease);
  }

  .js .chapter {
    opacity: 0.28;
    filter: blur(2px);
  }

  .js .chapter.on {
    opacity: 1;
    filter: none;
  }

  .chapter-shot {
    display: none;
  }

  .story-visual {
    display: block;
    order: 2;
  }

  .story-sticky {
    position: sticky;
    top: 0;
    height: 100svh;
    display: grid;
    place-items: center;
    perspective: 1600px;
  }
}

.story-frame {
  position: relative;
  width: 100%;
  transform: rotateY(-8deg) rotateX(3deg);
  transform-style: preserve-3d;
  transition: transform 900ms var(--ease);
}

.story[data-step="1"] .story-frame { transform: rotateY(6deg) rotateX(3deg); }
.story[data-step="2"] .story-frame { transform: rotateY(-4deg) rotateX(1deg) translateY(-6px); }
.story[data-step="3"] .story-frame { transform: rotateY(5deg) rotateX(2deg); }
.story[data-step="4"] .story-frame { transform: rotateY(-6deg) rotateX(2deg) translateY(-4px); }

.story-frame .shot {
  position: absolute;
  inset: 0;
  clip-path: inset(100% 0 0 0);
  scale: 1.06;
  transition: clip-path 900ms var(--ease), scale 1200ms var(--ease);
}

.story-frame .shot.on {
  clip-path: inset(0 0 0 0);
  scale: 1;
  z-index: 1;
}

.story-frame .shot.out {
  clip-path: inset(0 0 100% 0);
}

.story-url {
  position: relative;
  height: 1em;
}

.story-url span {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transition: opacity 400ms var(--ease);
}

.story-url span.on {
  opacity: 1;
}

.story-rail {
  position: absolute;
  left: 0;
  bottom: 9%;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-4);
}

.story-rail li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: color 400ms var(--ease);
}

.story-rail span {
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--paper-4);
  transition: width 500ms var(--ease), background 500ms var(--ease);
}

.story-rail li.on {
  color: var(--paper);
}

.story-rail li.on span {
  width: 28px;
  background: var(--signal);
}

.story-chips {
  position: absolute;
  right: -1%;
  top: 14%;
  width: 270px;
  height: 64px;
  transform: translateZ(60px);
}

.chip-card {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 1rem;
  border-radius: 18px;
  background: rgba(28, 26, 24, 0.94);
  border: 1px solid var(--line-2);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.95);
  font-size: 0.84rem;
  color: var(--paper-2);
  opacity: 0;
  translate: 0 14px;
  scale: 0.96;
  transition: opacity 500ms var(--ease), translate 600ms var(--spring), scale 600ms var(--spring);
}

.chip-card b {
  display: block;
  color: var(--paper);
  font-weight: 500;
}

.chip-card.on {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}

/* ---------- Method: step path ---------- */

.path {
  --p: 0;
  position: relative;
  margin-top: 3.5rem;
}

.path-steps {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.path-steps li {
  position: relative;
  padding: 1.6rem 1.6rem 1.6rem 3.6rem;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(30, 28, 26, 0.85), rgba(16, 15, 14, 0.85));
  border: 1px solid var(--line);
  opacity: 0.4;
  translate: 0 16px;
  transition: opacity 600ms var(--ease), translate 700ms var(--ease), border-color 600ms var(--ease);
}

.path-steps li.lit {
  opacity: 1;
  translate: 0 0;
  border-color: rgba(242, 164, 119, 0.28);
}

.path-steps h3 {
  margin: 1.2rem 0 0.5rem;
  font-size: 1.5rem;
  letter-spacing: -0.035em;
}

.path-steps p {
  margin: 0;
  color: var(--paper-2);
  max-width: 32ch;
}

.path-steps .num {
  display: inline-grid;
  place-items: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--paper-2);
}

.path-dot {
  position: absolute;
  left: 1.25rem;
  top: 2.2rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #1a1816;
  border: 2px solid var(--paper-4);
  transition: background 400ms var(--ease), border-color 400ms var(--ease), box-shadow 600ms var(--ease);
}

.path-steps li.lit .path-dot {
  background: var(--signal);
  border-color: var(--signal);
  box-shadow: 0 0 0 6px rgba(242, 164, 119, 0.12), 0 0 22px rgba(242, 164, 119, 0.6);
}

.path-track {
  position: absolute;
  left: calc(1.25rem + 5px);
  top: 2.6rem;
  bottom: 2.6rem;
  width: 2px;
  background: repeating-linear-gradient(180deg, var(--paper-4) 0 6px, transparent 6px 13px);
  z-index: 1;
}

.path-track i {
  position: absolute;
  inset: 0;
  transform-origin: top;
  transform: scaleY(var(--p));
  background: linear-gradient(180deg, var(--signal), #f2efe8);
  box-shadow: 0 0 12px rgba(242, 164, 119, 0.7);
}

@media (min-width: 820px) {
  .path-steps {
    grid-template-columns: repeat(3, 1fr);
    padding-top: 2.6rem;
  }

  .path-steps li {
    padding: 1.6rem;
  }

  .path-dot {
    left: 1.6rem;
    top: -2.6rem;
    translate: 0 -50%;
  }

  .path-track {
    left: calc(1.6rem + 6px);
    right: calc((100% - 2rem) / 3 - 1.6rem - 6px);
    top: 0;
    bottom: auto;
    width: auto;
    height: 2px;
    background: repeating-linear-gradient(90deg, var(--paper-4) 0 6px, transparent 6px 13px);
  }

  .path-track i {
    transform-origin: left;
    transform: scaleX(var(--p));
    background: linear-gradient(90deg, var(--signal), #f2efe8);
  }
}

/* ---------- Domains: spotlight cards ---------- */

.spot-grid {
  list-style: none;
  margin: 3rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 620px) {
  .spot-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 980px) {
  .spot-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.spot-grid + .read {
  margin-top: 1.6rem;
}

.spot {
  --mx: -400px;
  --my: -400px;
  position: relative;
  display: grid;
  align-content: start;
  gap: 0.5rem;
  padding: 1.6rem;
  border-radius: 22px;
  background:
    radial-gradient(360px circle at var(--mx) var(--my), rgba(242, 164, 119, 0.09), transparent 60%),
    #0f0e0d;
  border: 1px solid var(--line);
  overflow: hidden;
}

.spot::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(240px circle at var(--mx) var(--my), rgba(242, 164, 119, 0.75), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.spot .metric {
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 1.35rem;
  color: var(--signal);
  letter-spacing: -0.02em;
}

.spot .metric small {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--paper-3);
  letter-spacing: 0;
}

.spot b {
  font-weight: 500;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.spot span {
  color: var(--paper-3);
  font-size: 0.92rem;
}

/* ---------- Final: particle word + composer ---------- */

.final {
  position: relative;
  overflow: hidden;
  min-height: 100svh;
  display: grid;
  place-items: start center;
  padding: clamp(6rem, 14vh, 10rem) var(--pad) 0;
  text-align: center;
}

.particle-word {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero {
  align-content: center;
}

.hero-word {
  --hw: clamp(5.5rem, 11vw, 9.5rem);
  position: relative;
  z-index: 0;
  height: var(--hw);
  margin: -2.5rem 0 calc(var(--hw) * -0.42);
}

.hero-word + .hero-grid {
  position: relative;
  z-index: 1;
}

.no-js .hero-word {
  display: none;
}

.final-inner {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.final-inner > * {
  pointer-events: auto;
}

.final h2 {
  margin-bottom: 1rem;
}

.final .lead {
  margin: 0 auto 2.2rem;
}

.final .cta-row {
  justify-content: center;
  margin-top: 0;
}

.halo-composer {
  --fill: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(100%, 520px);
  margin-bottom: 1.8rem;
  padding: 0.45rem 0.45rem 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(26, 24, 22, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 calc(var(--fill) * 1px) rgba(242, 164, 119, 0.5),
    0 24px 60px -18px rgba(0, 0, 0, 0.9);
  transition: --fill 200ms linear;
}

.halo-composer:focus-within {
  border-color: var(--paper-3);
}

.halo-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.95rem;
  color: var(--paper);
}

.halo-input::placeholder {
  color: var(--paper-3);
}

.halo-send {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) calc(35% + var(--fill) * 65%), #3a3632);
  box-shadow:
    0 0 0 calc(2px + var(--fill) * 4px) rgba(242, 164, 119, calc(var(--fill) * 0.22)),
    0 0 calc(var(--fill) * 26px) rgba(242, 164, 119, calc(var(--fill) * 0.8));
}

.halo-send::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(var(--signal) calc(var(--fill) * 360deg), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%);
  mask: radial-gradient(circle, transparent 62%, #000 64%);
  opacity: 0.9;
}

.halo-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.halo-composer.sent .halo-send {
  animation: sent 700ms var(--spring);
}

.final .fine {
  margin-top: 1.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--paper-3);
}

/* ---------- Pointer-only effects ---------- */

@media not ((hover: hover) and (pointer: fine)) {
  .stage-inner {
    transform: none;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js [data-rise],
  .js .stage,
  .js .focus-title .w,
  .js [data-reveal] {
    opacity: 1;
    translate: none;
    scale: none;
    filter: none;
    transition: none;
  }
  .focus-frame {
    display: none;
  }
  .chapter {
    opacity: 1 !important;
    filter: none !important;
  }
  .path-steps li {
    opacity: 1;
    translate: none;
  }
  .story-frame,
  .story-frame .shot,
  .stage-inner {
    transition: none;
  }
  .btn-ring,
  .now-tag,
  .count.bump {
    animation: none;
  }
  .js .now-scroll {
    overflow-y: auto;
  }
  .js .now-scroll ul {
    animation: none;
  }
}

/* ---------- Keyframes ---------- */

@keyframes ring {
  to { --ring: 360deg; }
}

@keyframes sent {
  0% { scale: 1; }
  40% { scale: 0.86; }
  100% { scale: 1; }
}

@keyframes now-roll {
  to { translate: 0 -50%; }
}

@keyframes bump {
  0% { scale: 1; }
  40% { scale: 1.35; color: var(--signal); }
  100% { scale: 1; }
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
