/* =============================================================
   KARLIE KING STUDIO — home.css
   Homepage motion: hero slideshow (Ken Burns), headline reveal,
   discipline marquee, scroll reveals, AI Content section.
   All motion is switched off for prefers-reduced-motion.
   ============================================================= */

/* ---------- Hero: slow zoom + crossfade ---------- */
.hero-media img, .hero-media video { position: absolute; inset: 0; }
.hero-media img.kb { animation: kenburns 14s ease-out forwards; transform-origin: 50% 40%; }
.hero-media img.kb:nth-child(even) { transform-origin: 60% 55%; }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }
.hero-media::after { z-index: 1; }

/* headline lines rise one after another */
.hero-content { animation: none; }
.hero-content > * { opacity: 0; transform: translateY(24px); animation: heroUp 1.1s cubic-bezier(.2,.7,.2,1) forwards; }
.hero-content > .eyebrow { animation-delay: .15s; }
.hero-content > h1 { animation-delay: .35s; }
.hero-content > p { animation-delay: .6s; }
.hero-content > .btn { animation-delay: .8s; }
@keyframes heroUp { to { opacity: 1; transform: none; } }

.scroll-indicator::after { animation: scrollLine 2.2s ease-in-out infinite; transform-origin: top; }
@keyframes scrollLine { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); transform-origin: top; } 55% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Scroll reveal ---------- */
.js-motion [data-reveal] { opacity: 0; transform: translateY(32px); transition: opacity 1s cubic-bezier(.2,.7,.2,1), transform 1s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.js-motion [data-reveal].in { opacity: 1; transform: none; }
.js-motion .highlight-tile.rv { opacity: 0; transform: translateY(28px); transition: opacity .9s ease, transform .9s cubic-bezier(.2,.7,.2,1); transition-delay: var(--d, 0s); }
.js-motion .highlight-tile.rv.in { opacity: 1; transform: none; }

/* ---------- Services: line draws on hover, 5 columns on wide screens ---------- */
.service-card { position: relative; }
.service-card::before { content: ''; position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--color-text); transform: scaleX(0); transform-origin: left; transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.service-card:hover::before { transform: scaleX(1); }
.service-card--ai .num { color: var(--color-text); }
@media (min-width: 1180px) { .services { grid-template-columns: repeat(5, 1fr); } }

/* ---------- AI Content section ---------- */
.home-ai { background: #0a0a0a; color: #fff; overflow: hidden; padding-bottom: 0; position: relative; }
.home-ai::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at 70% 40%, #000 0%, transparent 70%); -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 0%, transparent 70%); }
.home-ai-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; position: relative; }
.home-ai .eyebrow { color: rgba(255,255,255,.6); }
.home-ai h2 { color: #fff; margin: .75rem 0 1.25rem; }
.home-ai h2 em { font-style: italic; }
.home-ai .lead { color: rgba(255,255,255,.75); }
.home-ai-steps { list-style: none; margin: 2rem 0 2.5rem; border-top: 1px solid rgba(255,255,255,.14); }
.home-ai-steps li { display: flex; gap: 1.25rem; align-items: baseline; padding: .8rem 0; border-bottom: 1px solid rgba(255,255,255,.14); font-size: .95rem; color: rgba(255,255,255,.85); }
.home-ai-steps span { font-size: .7rem; letter-spacing: .2em; color: rgba(255,255,255,.45); }
.js-motion .home-ai-copy.in .home-ai-steps li { animation: stepIn .8s cubic-bezier(.2,.7,.2,1) both; }
.js-motion .home-ai-copy .home-ai-steps li { opacity: 0; }
.js-motion .home-ai-copy.in .home-ai-steps li:nth-child(1) { animation-delay: .35s; }
.js-motion .home-ai-copy.in .home-ai-steps li:nth-child(2) { animation-delay: .5s; }
.js-motion .home-ai-copy.in .home-ai-steps li:nth-child(3) { animation-delay: .65s; }
.js-motion .home-ai-copy.in .home-ai-steps li:nth-child(4) { animation-delay: .8s; }
@keyframes stepIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.btn--light { border-color: #fff; color: #fff; }

/* node visual */
.home-ai-visual { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) minmax(0, 7fr); align-items: center; }
.hai-node { background: #161616; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; overflow: hidden; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.hai-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem .75rem; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.85); border-bottom: 1px solid rgba(255,255,255,.08); }
.hai-head b { font-weight: 400; color: rgba(255,255,255,.45); letter-spacing: .08em; white-space: nowrap; }
.hai-live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: .4rem; vertical-align: 1px; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .2; } }
.hai-in img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #fff; }
.hai-wire { width: 100%; height: 100%; min-height: 260px; overflow: visible; }
.hai-wire path { fill: none; stroke: rgba(255,255,255,.35); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-dasharray: 4 6; animation: flow 1.6s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -20; } }
.hai-vwire { display: none; width: 1px; height: 44px; margin: 0 auto; background: repeating-linear-gradient(180deg, rgba(255,255,255,.45) 0 4px, transparent 4px 10px); background-size: 1px 10px; animation: vflow 1.2s linear infinite; }
@keyframes vflow { to { background-position: 0 10px; } }
.hai-out { display: grid; grid-template-columns: 1.25fr 1fr; grid-template-rows: auto auto; gap: 12px; }
.hai-film { grid-row: 1 / span 2; display: flex; flex-direction: column; }
.hai-film video { width: 100%; flex: 1 1 auto; min-height: 0; height: 100%; object-fit: cover; display: block; background: #222; }
.hai-cycle { position: relative; aspect-ratio: 4 / 5; background: #222; }
.hai-cycle img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.1s ease, filter 1.1s ease; filter: blur(8px) saturate(.6); }
.hai-cycle img.is-on { opacity: 1; filter: none; }
.hai-scan { position: absolute; left: 0; right: 0; top: 30px; height: 40%; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.18) 85%, rgba(255,255,255,.6) 100%); }
.hai-img.scan .hai-scan { animation: scan 1.2s ease-in forwards; }
@keyframes scan { 0% { opacity: 1; transform: translateY(-100%); } 90% { opacity: 1; } 100% { opacity: 0; transform: translateY(160%); } }
.hai-shop img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.hai-out .hai-node { transform: translateY(18px); opacity: 0; transition: transform .9s cubic-bezier(.2,.7,.2,1), opacity .9s ease; }
.home-ai-visual.in .hai-out .hai-node, html:not(.js-motion) .hai-out .hai-node { transform: none; opacity: 1; }
.home-ai-visual.in .hai-film { transition-delay: .5s; }
.home-ai-visual.in .hai-img { transition-delay: .7s; }
.home-ai-visual.in .hai-shop { transition-delay: .9s; }

/* endless strip */
.home-ai-strip { margin-top: clamp(3rem, 8vh, 6rem); overflow: hidden; padding-bottom: clamp(3rem, 8vh, 5rem); position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.home-ai-strip-track { display: flex; gap: 0; width: max-content; animation: marquee 60s linear infinite; }
.home-ai-strip img { margin-right: 12px; flex: none; height: clamp(150px, 20vw, 260px); width: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; }

@media (max-width: 960px) {
  .home-ai-grid { grid-template-columns: 1fr; }
  .home-ai-visual { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 6fr); }
}
@media (max-width: 560px) {
  .home-ai-visual { grid-template-columns: 1fr; gap: 0; }
  .hai-in { width: 62%; margin: 0 auto; }
  .hai-wire { display: none; }
  .hai-vwire { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-media img.kb, .home-ai-strip-track, .hai-wire path, .hai-vwire, .hai-live::before, .scroll-indicator::after { animation: none !important; }
  .hero-content > * { animation: none; opacity: 1; transform: none; }
  .js-motion [data-reveal], .js-motion .highlight-tile.rv, .hai-out .hai-node, .js-motion .home-ai-copy .home-ai-steps li { opacity: 1 !important; transform: none !important; transition: none !important; animation: none !important; }
}

/* ---------- In Motion: vertical films ---------- */
.home-motion { padding-bottom: clamp(5rem, 12vh, 9rem); }
.home-motion-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem 4rem; flex-wrap: wrap; margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.home-motion-head h2 { margin-top: .5rem; }
.home-motion-head h2 em { font-style: italic; }
.home-motion-head .lead { max-width: 44ch; color: var(--color-muted); }
.home-motion-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.75rem, 1.6vw, 1.5rem); align-items: start; }
.motion-tile { margin: 0; }
.motion-frame { position: relative; aspect-ratio: 9 / 16; overflow: hidden; background: #ececec; }
.motion-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 1.6s cubic-bezier(.2,.7,.2,1); }
.motion-tile:hover .motion-frame video { transform: scale(1); }
.motion-tile figcaption { display: flex; gap: .75rem; align-items: baseline; padding-top: .9rem; font-size: .8rem; color: var(--color-muted); }
.motion-tile figcaption span { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--color-text); font-weight: 500; }
@media (max-width: 760px) {
  .home-motion-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem .5rem; }
  .motion-tile figcaption { padding-top: .5rem; gap: .5rem; font-size: .72rem; flex-wrap: wrap; }
  .motion-tile figcaption span { font-size: .62rem; letter-spacing: .16em; }
}
@media (prefers-reduced-motion: reduce) { .motion-frame video { transform: none; transition: none; } }

/* tap-to-play fallback when a phone blocks autoplay */
.motion-frame { cursor: pointer; }
.motion-frame.needs-tap::after { content: ''; position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
  background: rgba(0,0,0,.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l9 5-9 5z' fill='%23fff'/%3E%3C/svg%3E") center / 26px no-repeat;
  border: 1px solid rgba(255,255,255,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: none; }

/* phones: when the hero plays the mobile film, the "In Motion" section is not repeated below */
@media (max-width: 760px) { .hero-film-mobile .home-motion { display: none; } }

/* phones with hero film: the first-frame still must not zoom, so it matches the video exactly */
.hero-film-mobile .hero-media img.kb { animation: none; transform: none; }
