/* ==========================================================================
   Selected Work — interactive gallery
   Layers on top of index.html's existing .proj / .media / .chrome / .reveal-bar
   ========================================================================== */

/* Shared-element page transitions (cross-document View Transitions).
   Browsers without support simply navigate normally. */
@view-transition { navigation: auto; }
::view-transition-group(*) { animation-duration: .7s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

.proj { --e: cubic-bezier(.2,.8,.2,1); --e-scroll: cubic-bezier(.45,.05,.35,1); outline: none; }
.proj:focus-visible { outline: 2px solid var(--c-indigo-soft); outline-offset: 8px; border-radius: 0 28px 0 28px; }
.proj:focus-visible .media { outline: 1px solid var(--c-indigo); outline-offset: 4px; }
.route-hero { position: relative; }
.route-hero .wrap { position: relative; }
.route-hero .wrap::after { content: ""; position: absolute; right: 40px; bottom: clamp(64px, 6vw, 88px); color: var(--c-text-3); font: 400 12px var(--f-mono); letter-spacing: .04em; text-transform: uppercase; }
.work-hero .wrap::after { display: none; }
.work-hero .wrap { min-height: 520px; }
.work-hero-copy { position: relative; z-index: 2; max-width: 48%; }
.hero-geometry { position: absolute; z-index: 1; right: 0; top: 44%; width: min(48%, 620px); transform: translateY(-45%); pointer-events: none; filter: drop-shadow(0 28px 48px rgba(0,0,0,.34)); }
.hero-geometry svg { display: block; width: 100%; height: auto; overflow: visible; }
.geo-orbits { transform-origin: 290px 205px; animation: geoOrbit 24s linear infinite; }
.geo-tiles { transform-origin: 260px 200px; animation: geoFloat 9s ease-in-out infinite; }
.geo-sphere { transform-box: fill-box; transform-origin: center; animation: geoSphere 8s ease-in-out infinite; }
.geo-link { animation: geoDash 7s ease-in-out infinite alternate; }
@keyframes geoOrbit { to { transform: rotate(360deg); } }
@keyframes geoFloat { 50% { transform: translateY(-8px) rotate(1deg); } }
@keyframes geoSphere { 50% { transform: translate(7px,-9px); } }
@keyframes geoDash { to { stroke-dashoffset: -24; opacity: .6; } }

/* Work cards: consistent rhythm without turning the entire card into an underline. */
.route-grid .proj { display: flex; flex-direction: column; align-items: stretch; color: var(--c-text); }
.route-grid .proj img { aspect-ratio: 16 / 10; object-fit: cover; }
.route-grid .proj h2 { transition: color var(--d-fast) var(--ease-out); }
.route-grid .proj:hover h2, .route-grid .proj:focus-visible h2 { color: var(--c-indigo-soft); }
.route-grid .proj p { flex: 1; }
.route-grid .proj .btn { align-self: flex-start; margin-top: 4px; }

/* Closing CTA: a deliberate final step, kept compact and editorial. */
.cta { position: relative; overflow: hidden; padding: clamp(80px, 9vw, 128px) 0; border-top: 1px solid var(--c-line); background: radial-gradient(48vw 28vw at 88% 50%, rgba(79,107,255,.2), transparent 70%), var(--c-bg-2); }
.cta::after { content: ""; position: absolute; right: -12vw; top: 50%; width: 38vw; height: 38vw; transform: translateY(-50%); border: 1px solid rgba(158,172,255,.14); border-radius: 50%; pointer-events: none; }
.cta .wrap { position: relative; z-index: 1; }
.cta-h { margin: 22px 0 0; font-size: clamp(58px, 8vw, 124px); letter-spacing: -.06em; line-height: .88; }
.cta-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; margin-top: 40px; }
.cta-row p { max-width: 520px; margin: 0; color: var(--c-text-2); font-size: clamp(18px, 2vw, 23px); }
.btn-white { background: var(--c-text); color: var(--c-bg); }
.btn-white:hover { background: var(--c-indigo-ui); color: #fff; }

/* Browser mockup */
.proj .media {
  background: #fff;
  transition: transform .9s var(--e), box-shadow .9s var(--e);
  transform-origin: 50% 40%;
  will-change: transform;
}
.proj .media .chrome { position: relative; z-index: 2; background: #F7F6F2; }
.proj.is-active .media { transform: scale(1.03); box-shadow: 0 36px 70px -36px rgba(11,11,13,.45); }

/* Viewport that holds the real screenshots */
.vp { position: absolute; left: 0; right: 0; top: 32px; bottom: 0; overflow: hidden; background: var(--paper2); }
.vp img { position: absolute; left: 0; top: 0; width: 100%; height: auto; display: block; max-width: none; }
.shot-full {
  opacity: 0;
  transform: translate3d(0,0,0);
  transition: opacity .45s ease, transform 1.1s var(--e-scroll);
  will-change: transform;
}
.shot-full.is-loaded { opacity: 1; }
.proj.is-scrolling .shot-full {
  transform: translate3d(0, calc(var(--travel, 0px) * -1), 0);
  transition: opacity .45s ease, transform var(--dur, 6s) var(--e-scroll) .3s;
}

/* Scroll progress rail */
.rail { position: absolute; right: 10px; top: 14px; bottom: 14px; width: 3px; border-radius: 3px; background: rgba(11,11,13,.14); opacity: 0; transition: opacity .3s; z-index: 2; }
.rail b { position: absolute; inset: 0; border-radius: 3px; background: var(--blue); transform: scaleY(0); transform-origin: top; transition: transform 1.1s var(--e-scroll); }
.proj.is-scrolling .rail { opacity: 1; }
.proj.is-scrolling .rail b { transform: scaleY(1); transition: transform var(--dur, 6s) var(--e-scroll) .3s; }

/* Cursor-following indicator (pointer devices only) */
.cursor-pill { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; will-change: transform; }
.cursor-pill > span {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  background: var(--ink); color: #fff; border-radius: 999px; padding: 8px 13px 8px 11px;
  font: 500 11px 'IBM Plex Mono', monospace; letter-spacing: .04em; text-transform: uppercase;
  transform: translate(-50%, calc(-100% - 14px)) scale(.6); opacity: 0;
  transition: opacity .25s ease, transform .35s var(--e);
}
.proj.is-pointer .cursor-pill > span { opacity: 1; transform: translate(-50%, calc(-100% - 14px)) scale(1); }
.wheel { width: 10px; height: 15px; border: 1.5px solid currentColor; border-radius: 6px; position: relative; flex: none; }
.wheel::after { content: ""; position: absolute; left: 50%; top: 3px; width: 2px; height: 3px; margin-left: -1px; border-radius: 1px; background: currentColor; animation: wheel 1.4s ease-in-out infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(5px); opacity: 0; } 100% { opacity: 0; } }

/* Action bar — "Explore Project ↗" */
.proj .reveal-bar { z-index: 3; }
.proj.is-active .reveal-bar { transform: none; }
.reveal-bar .bar-arrow { display: inline-block; transition: transform .45s var(--e); }
.proj.is-active .reveal-bar .bar-arrow { transform: translate(2px, -2px); }

/* ---------- Project personalities ---------- */

/* Josh's: bold, horizontal */
.proj[data-project="junk"] .reveal-bar { transform: none; clip-path: inset(0 100% 0 0); transition: clip-path .55s cubic-bezier(.7,0,.2,1); }
.proj[data-project="junk"].is-active .reveal-bar { clip-path: inset(0 0 0 0); }
.proj[data-project="junk"] .reveal-bar span:first-child { font-family: 'Schibsted Grotesk', sans-serif; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; }
.proj[data-project="junk"] .media::after {
  content: ""; position: absolute; left: 0; right: 0; top: 32px; height: 4px; background: var(--blue); z-index: 3;
  transform: scaleX(0); transform-origin: left; transition: transform .6s cubic-bezier(.7,0,.2,1);
}
.proj[data-project="junk"].is-active .media::after { transform: scaleX(1); }

/* Advanced Landscaping: slow, refined */
.proj[data-project="landscaping"] .media { transition-duration: 1.4s; }
.proj[data-project="landscaping"] .vp img { filter: saturate(.9); transition: filter 1.4s ease, opacity .6s ease, transform 1.1s var(--e-scroll); }
.proj[data-project="landscaping"].is-active .vp img { filter: saturate(1.06); }
.proj[data-project="landscaping"].is-scrolling .shot-full { transition: opacity .6s ease, filter 1.4s ease, transform var(--dur, 6s) var(--e-scroll) .3s; }
.proj[data-project="landscaping"] .reveal-bar { transform: translateY(101%); transition: transform .9s cubic-bezier(.16,1,.3,1); }
.proj[data-project="landscaping"].is-active .reveal-bar { transform: none; }

/* Sand Dollar: gentle, water */
.proj[data-project="sand-dollar"] .reveal-bar { transform: none; clip-path: circle(0% at 50% 140%); transition: clip-path .8s cubic-bezier(.33,1,.68,1); }
.proj[data-project="sand-dollar"].is-active .reveal-bar { clip-path: circle(140% at 50% 140%); }
.ripple { position: absolute; z-index: 3; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.85); box-shadow: 0 0 0 1px rgba(31,63,217,.25); pointer-events: none; animation: ripple 1.1s cubic-bezier(.2,.8,.2,1) forwards; }
.ripple.r2 { animation-delay: .18s; opacity: 0; }
@keyframes ripple { from { transform: scale(.4); opacity: .9; } to { transform: scale(9); opacity: 0; } }

/* ---------- Touch & small screens ---------- */
@media (hover: none) {
  .proj .reveal-bar,
  .proj[data-project] .reveal-bar { transform: none; clip-path: none; }
  .cursor-pill { display: none; }
}
@media (max-width: 860px) {
  .route-hero .wrap::after { right: 20px; bottom: 28px; }
  .work-hero .wrap { min-height: 0; }
  .work-hero-copy { max-width: none; }
  .hero-geometry { position: relative; right: auto; top: auto; width: 100%; max-width: 430px; margin: 42px auto 0; transform: none; }
  .route-grid .proj img { aspect-ratio: 16 / 10; }
  .cta { padding: 72px 0; }
  .cta-row { display: block; margin-top: 28px; }
  .cta-row p { margin-bottom: 24px; }
  .cta-row .btn { width: 100%; }
  .cta::after { width: 70vw; height: 70vw; right: -28vw; }
  .proj.is-active .media { transform: none; box-shadow: none; }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .hero-geometry { right: 0; width: 48%; max-width: 600px; }
}
@media (max-width: 389px) {
  .hero-geometry { max-width: 300px; margin-top: 32px; }
}

/* ---------- Reduced motion: keep states, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .geo-orbits, .geo-tiles, .geo-sphere, .geo-link { animation: none; }
  .proj .media, .proj.is-active .media { transform: none !important; transition: none; }
  .proj.is-scrolling .shot-full { transform: none; }
  .rail, .ripple, .wheel::after { display: none; }
  .proj[data-project] .reveal-bar { transform: none; clip-path: none; opacity: 0; transition: opacity .2s; }
  .proj[data-project].is-active .reveal-bar { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) and (hover: none) {
  .proj[data-project] .reveal-bar { opacity: 1; }
}
