/* Luxify Home — the lower half of the home (index.html) and the portfolio (index + projects.html).
   Driven by js/lower-story.js (timeline + fly) and js/portfolio.js (floating cards + viewer).
   Contract: WITHOUT .is-live (no JS, reduced motion, phones) the timeline is a vertical list of six cards, the word
   is a static marble heading and the portfolio is a plain collage / swipe row. .is-live pins the timeline and the
   fly section and gives them --p (0..1); every animated property is transform / opacity / clip-path. */

/* ---------- process timeline ---------- */
.tl { position: relative; background: radial-gradient(ellipse at 50% 0%, #15120d 0%, var(--obsidian) 62%); padding-block: clamp(72px, 10vw, 128px); }
.tl-head { display: grid; gap: 14px; margin-bottom: clamp(32px, 5vw, 56px); }
.tl-head .eyebrow, .tl-head .lede { margin: 0; }
.tl-title { font-size: clamp(2.4rem, 5.6vw, 5.4rem); line-height: 0.98; letter-spacing: -0.025em; max-width: 12em; }
.tl-title em, .pf-title em, .fly-line em { color: var(--gold); font-style: italic; }
.tl-track { list-style: none; display: grid; gap: 22px; padding: 0 var(--gutter); max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; }
.tl-card { margin: 0; display: grid; background: linear-gradient(180deg, #121311 0%, #0b0c0b 100%); border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9); }
.tl-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0a0b0a; }
.tl-media img, .tl-media svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tl-card figcaption { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; align-items: baseline; padding: 20px 22px 24px; }
.tl-n { grid-row: span 2; color: var(--gold); font: 400 clamp(1.8rem, 2.6vw, 2.6rem)/1 var(--serif); font-style: italic; }
.tl-card h3 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.tl-card p { margin: 6px 0 0; color: var(--muted); font-size: 0.98rem; max-width: 46ch; }
.tl-who { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; list-style: none; }
.tl-who li { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--gold-soft); font: 700 0.68rem/1.4 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; }
.tl-draw .tl-media { background: radial-gradient(ellipse at 50% 40%, #1a1712 0%, #0a0b0a 75%); }
.dr-grid path { stroke: rgba(232, 207, 156, 0.07); stroke-width: 1; fill: none; }
.dr-line path, .dr-line rect { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; }
.dr-line rect { fill: rgba(217, 173, 92, 0.06); }
.dr-dots circle { fill: #fff3d6; filter: drop-shadow(0 0 6px rgba(255, 210, 140, 0.9)); }
.dr-ray path { stroke: rgba(255, 220, 150, 0.45); stroke-width: 1.2; stroke-dasharray: 4 6; fill: none; }
.dr-ray circle { fill: var(--gold); }
.tl-rail { display: none; }
.tl-more { margin: 28px auto 0; }

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

.tl.is-live { height: 560vh; padding: 0; }
.tl.is-live .tl-pin { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; overflow: hidden; padding: calc(var(--header-h) + 18px) 0 22px; }
.tl.is-live .tl-head { margin-bottom: 26px; gap: 8px; }
.tl.is-live .tl-title { font-size: clamp(2rem, 4vw, 3.8rem); }
.tl.is-live .tl-head .lede { font-size: 1rem; }
.tl.is-live .tl-view { position: relative; min-width: 0; display: flex; align-items: center; min-height: 0; perspective: 1700px; perspective-origin: 50% 45%; }
.tl.is-live .tl-track { --cw: min(44vw, 720px, calc((100svh - 420px) * 1.6)); display: flex; gap: clamp(28px, 4vw, 64px); width: 100%; max-width: none; margin: 0; padding: 0 calc(50% - var(--cw) / 2); transform-style: preserve-3d; will-change: transform; }
.tl.is-live .tl-step { flex: 0 0 var(--cw); transform-style: preserve-3d; transition: opacity 0.2s linear; will-change: transform, opacity; }
.tl.is-live .tl-card figcaption { padding: 16px 20px 18px; }
.tl.is-live .tl-card p { transition: opacity 0.5s; }
.tl.is-live .tl-step:not(.is-on) .tl-card p, .tl.is-live .tl-step:not(.is-on) .tl-who { opacity: 0.35; }
.tl.is-live .tl-step.is-on .tl-card { border-color: var(--line); box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(217, 173, 92, 0.18); }
.tl.is-live .tl-rail { display: grid; gap: 12px; margin-top: 18px; }
.tl-bar { position: relative; display: block; height: 2px; background: rgba(241, 237, 229, 0.12); border-radius: 2px; overflow: hidden; }
.tl-fill { position: absolute; inset: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold), #fff0cc); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }
.tl-ticks { display: grid; grid-template-columns: repeat(6, 1fr); list-style: none; color: rgba(241, 237, 229, 0.38); font: 700 0.66rem/1.4 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; }
.tl-ticks li { transition: color 0.35s; }
.tl-ticks li:nth-child(n + 2) { text-align: center; }
.tl-ticks li:last-child { text-align: right; }
.tl-ticks li.is-on { color: var(--gold-soft); }
.tl.is-live .tl-more { margin-top: 6px; }

/* ---------- the word fly-through ---------- */
.fly { position: relative; background: var(--obsidian); overflow: clip; }
.fly-pin { position: relative; display: grid; place-items: center; align-content: center; gap: 18px; min-height: 80vh; padding: 14vh var(--gutter); overflow: hidden; isolation: isolate; }
.fly-word { margin: 0; font: 900 clamp(5rem, 21vw, 23rem)/0.86 var(--sans); letter-spacing: -0.04em; text-align: center; }
.fly-letters { display: inline-flex; background: url("/assets/story/story-slab-1400.webp") 40% 50% / cover; -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, 0.7)); transform-origin: 55% 52%; }
.fly-line { margin: 0; color: var(--text); font: 400 clamp(1.4rem, 2.6vw, 2.4rem)/1.2 var(--serif); text-align: center; }
.fly-gl { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }
.fly-word, .fly-line { position: relative; z-index: 1; }
.fly-fade { position: absolute; inset: 0; z-index: 2; background: var(--paper); opacity: 0; pointer-events: none; }

.fly.is-live { height: 340vh; }
.fly.is-live .fly-pin { position: sticky; top: 0; height: 100vh; height: 100svh; min-height: 0; padding: 0 var(--gutter); }
.fly.is-live .fly-letters { transform: scale(calc(1 + var(--p, 0) * var(--p, 0) * var(--p, 0) * 46)); opacity: clamp(0, calc((0.86 - var(--p, 0)) * 8), 1); will-change: transform, opacity; }
.fly.is-live .fly-line { opacity: clamp(0, calc(1 - var(--p, 0) * 4), 1); transform: translate3d(0, calc(var(--p, 0) * 120px), 0); }
.fly.is-live .fly-fade { opacity: clamp(0, calc((var(--p, 0) - 0.86) * 7.2), 1); }
.fly.gl-own .fly-letters { visibility: hidden; }
.fly.gl-own .fly-line { margin-top: 46vh; text-shadow: 0 2px 20px rgba(3, 5, 4, 0.9); }

/* ---------- portfolio ---------- */
.pf { position: relative; padding-block: clamp(72px, 10vw, 140px); overflow: hidden; }
.pf-head { display: grid; gap: 16px; margin-bottom: clamp(36px, 5vw, 64px); }
.pf-head .eyebrow, .pf-head .lede { margin: 0; }
.pf-title { font-size: clamp(2.8rem, 7vw, 6.6rem); line-height: 0.95; letter-spacing: -0.03em; }
.ivory .pf-title em { color: var(--gold-deep); }
.pf-stage { position: relative; perspective: 1400px; }
.pf-cards, .pf-grid { list-style: none; }
.pf-cards { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px var(--gutter) 28px; scrollbar-width: none; }
.pf-cards::-webkit-scrollbar { display: none; }
.pf-card { flex: 0 0 78vw; scroll-snap-align: center; transform-style: preserve-3d; }
.pf-open { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: zoom-in; border-radius: 6px; }
.pf-frame { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 6px; background: #ddd5c6; box-shadow: 0 40px 70px -36px rgba(20, 16, 10, 0.55), 0 12px 24px -16px rgba(20, 16, 10, 0.35); }
.pf-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.1, 1); }
.pf-open:hover .pf-img, .pf-open:focus-visible .pf-img { transform: scale(1.04); }
.pf-cap { display: grid; gap: 2px; padding: 16px 2px 0; }
.pf-cap strong { font: 400 1.25rem/1.25 var(--serif); }
.pf-cap > span:not(.pf-badge) { color: var(--on-ivory-muted); font-size: 0.9rem; }
.pf-cap em { color: var(--gold-deep); font: 700 0.68rem/1.4 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; font-style: normal; }
.pf-badge { justify-self: start; margin-bottom: 6px; padding: 3px 10px; border-radius: 999px; background: var(--on-ivory); color: var(--paper); font: 700 0.62rem/1.5 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; }
.pf-more { margin-top: 18px; }

@media (min-width: 901px) {
  .pf-cards { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: clamp(20px, 2.4vw, 36px); row-gap: 40px; align-items: start; max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; overflow: visible; padding: 0 var(--gutter) 40px; }
  .pf-card { grid-column: span 4; }
  .pf-c0 { grid-column: 1 / 6; margin-top: 70px; }
  .pf-c1 { grid-column: 6 / 9; margin-top: 0; }
  .pf-c2 { grid-column: 9 / 13; margin-top: 150px; }
  .pf-c3 { grid-column: 2 / 6; }
  .pf-c4 { grid-column: 7 / 11; margin-top: -60px; }
  .pf-c1 .pf-frame { aspect-ratio: 3 / 4; }
  .pf-stage.is-floating .pf-card { will-change: transform; }
}

.pf-real .section-head { margin-bottom: 28px; }
.pf-grid { display: grid; gap: 32px; }
@media (min-width: 761px) { .pf-grid { grid-template-columns: repeat(2, 1fr); } }
.pf-grid .pf-frame { aspect-ratio: 16 / 10; }
.pf-empty { grid-column: 1 / -1; padding: 28px; border: 1px dashed rgba(20, 19, 18, 0.25); border-radius: 6px; color: var(--on-ivory-muted); }
.pf-empty p { margin: 0; max-width: 60ch; }

/* ---------- cinematic viewer ---------- */
html.pfv-open { overflow: hidden; }
.pfv { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100svh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #030504; color: var(--text); }
.pfv::backdrop { background: rgba(3, 5, 4, 0.92); }
.pfv-stage { position: absolute; inset: 0 0 92px; overflow: hidden; }
.pfv-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; }
.pfv-before { position: absolute; inset: 0; display: none; clip-path: inset(0 calc(100% - var(--cut, 50%)) 0 0); }
.pfv.has-before .pfv-before { display: block; }
.pfv-range, .pfv-lab { display: none; }
.pfv.has-before .pfv-range { display: block; position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.pfv.has-before .pfv-stage::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); z-index: 2; width: 2px; margin-left: -1px; background: #fff3d6; box-shadow: 0 0 18px rgba(255, 220, 160, 0.8); pointer-events: none; }
.pfv.has-before .pfv-lab { display: block; position: absolute; bottom: 18px; z-index: 2; padding: 4px 12px; border-radius: 999px; background: rgba(3, 5, 4, 0.7); color: var(--gold-soft); font: 700 0.66rem/1.5 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; }
.pfv-lb { left: 18px; }
.pfv-la { right: 18px; }
.pfv.has-before .pfv-range:focus-visible + .pfv-lab { outline: 2px solid var(--gold); }
.pfv-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 92px; display: flex; align-items: center; gap: 10px; padding: 0 var(--gutter); border-top: 1px solid var(--line-soft); }
.pfv-cap { flex: 1; display: grid; min-width: 0; }
.pfv-cap strong { font: 400 1.2rem/1.25 var(--serif); }
.pfv-cap > span { color: var(--muted); font-size: 0.88rem; }
.pfv-cap em { display: none; }
.pfv-cap .pf-badge { background: var(--gold); color: var(--obsidian); }
.pfv-btn { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.pfv-btn:hover { border-color: var(--gold); color: var(--gold); }
@media (max-aspect-ratio: 1/1) { .pfv-stage img { object-fit: contain; } }
@media (prefers-reduced-motion: no-preference) {
  .pfv.kb .pfv-stage img { animation: pfv-kb 16s cubic-bezier(0.25, 0.1, 0.25, 1) both; }
}
@keyframes pfv-kb { from { transform: scale(1.0) translate3d(0, 0, 0); } to { transform: scale(1.07) translate3d(-1.2%, -0.8%, 0); } }

.feature-solo { grid-template-columns: minmax(0, 760px); }
