/* =====================================================================
   nikolens — motion layer
   Rules (Emil Kowalski's skills): transform / opacity / clip-path only;
   ease-out for entering, ease-in-out for moving on screen, ease for
   colour; hover motion only on real mouse pointers; presses are instant;
   reduced motion keeps fades and drops travel.
   ===================================================================== */

:root {
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --float: 0 10px 24px -12px rgba(46, 26, 25, .35);   /* the soft shadow of a lifted control */
}

/* smooth scroll owns the scrolling, so the browser's own smoothing steps aside */
html.lenis, html.lenis body { scroll-behavior: auto !important; }

/* ---------------------------------------------------------------------
   BUTTONS — float up a touch on hover, press on click
   --------------------------------------------------------------------- */
.btn { position: relative; transition: transform 280ms var(--ease-out), background-color 200ms ease, color 200ms ease; }
/* the lift shadow is drawn once and faded in, so hovering never repaints the button */
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  box-shadow: var(--float); opacity: 0; transition: opacity 280ms var(--ease-out);
}
.btn:active { transform: scale(.97); transition-duration: 120ms; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-2px); }
  .btn:hover::after { opacity: 1; }
  .btn:hover:active { transform: translateY(-1px) scale(.97); }
  .btn:hover:active::after { opacity: 0; }
  .nav .btn::after { display: none; }
  .btn .arrow { transition: transform 280ms var(--ease-out); }
  .btn:hover .arrow { transform: translateX(3px); }
}

/* text links: the colour eases and the line redraws — nothing jumps */
.ul-draw { text-decoration: none !important; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; }
@media (hover: hover) and (pointer: fine) {
  .ul-draw { transition: background-size 420ms var(--ease-out); }
  a:hover > .ul-draw, a.ul-draw:hover { background-size: 0% 1px; background-position: 100% 100%; animation: ul-redraw 560ms var(--ease-out) 140ms forwards; }
  .text-link, .works-index a { transition: opacity 200ms ease; }
  .text-link:hover, .works-index a:hover { opacity: .72; }
  .works-index a:hover span:first-child { text-decoration: none; }
}
@keyframes ul-redraw { from { background-size: 0% 1px; background-position: 0 100%; } to { background-size: 100% 1px; background-position: 0 100%; } }

/* social icons and the software tiles: the same small float */
@media (hover: hover) and (pointer: fine) {
  .socials a, .mail-link img, .tiles li { transition: transform 300ms var(--ease-out); }
  .socials a:hover, .mail-link:hover img, .tiles li:hover { transform: translateY(-3px); }
}

/* ---------------------------------------------------------------------
   FLOATING NAV — widens a little when hovered; chips tint and float
   --------------------------------------------------------------------- */
.bar.has-bg { position: relative; background: none; border-color: transparent; box-shadow: none; isolation: isolate; }
.bar-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: rgba(251, 250, 246, .94); border: 1px solid rgba(217, 72, 62, .28); border-radius: 999px;
  box-shadow: 0 8px 28px rgba(46, 26, 25, .08);
  transition: transform 360ms var(--ease-out);
}
.bar.has-bg > .wordmark { transition: translate 360ms var(--ease-out); }
.bar.has-bg .nav > a { transition: translate 360ms var(--ease-out), transform 180ms var(--ease-out), background-color 200ms ease, color 200ms ease, box-shadow 200ms ease; }
@media (hover: hover) and (pointer: fine) {
  .nav a:not(.btn):hover { background: #fff; transform: translateY(-1px); }
  .nav .btn:hover { background: var(--red-deep); transform: translateY(-1px); }
}
.nav a:not(.btn):active, .nav .btn:active { transform: scale(.95); }

/* ---------------------------------------------------------------------
   SCROLL REVEALS — a soft fade, with a hint of drift for text and a
   barely-there settle for pictures (base timings live in style.css)
   --------------------------------------------------------------------- */

/* scroll-linked depth where the browser can run it off the main thread */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .gallery .media > img, .portrait > img {
      animation: drift linear both; animation-timeline: view(); animation-range: entry 0% exit 100%;
    }
    @keyframes drift { from { translate: 0 -4%; scale: 1.1; } to { translate: 0 4%; scale: 1.1; } }
    .hero-visual .cutout { animation: hero-lift linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    @keyframes hero-lift { to { translate: 0 -40px; scale: 1.03; } }
  }
}

/* ---------------------------------------------------------------------
   HOVER TO PLAY — the screenshot sits over the player and fades away
   --------------------------------------------------------------------- */
.media > img { position: relative; z-index: 2; }
.media.playing > img { position: absolute; inset: 0; }
.media > video:not(.frame-poster), .media > iframe { z-index: 1; }
/* the faded cover must let clicks through to the player underneath */
.media.is-live > img, .media.playing > img { pointer-events: none; }
.media.is-live > img { opacity: 0; }
.media .play { z-index: 3; }
.card .media { cursor: pointer; }
.card .media:not([data-src]) { cursor: default; }
.hover-hint {
  position: absolute; left: 12px; bottom: 12px; z-index: 3; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 10px; border-radius: 999px;
  background: var(--cream); color: var(--red); font-family: var(--font-display); font-weight: 700; font-size: .8125rem; letter-spacing: -0.01em;
  opacity: 0; transform: translateY(6px); transition: opacity 240ms ease, transform 320ms var(--ease-out);
}
.hover-hint svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) {
  .media[data-src]:not(.is-live) .hover-hint { opacity: 1; transform: none; }
}

/* the arrow + sound + play controls all press */
.arrow-btn, .sound, .play .disc { transition: transform 200ms var(--ease-out), background-color 200ms ease, opacity 200ms ease; }
@media (hover: hover) and (pointer: fine) {
  .sound:hover { transform: translateY(-2px); }
}

/* ---------------------------------------------------------------------
   PHOTO VIEWER (lightbox)
   --------------------------------------------------------------------- */
.gallery .media { cursor: zoom-in; }
.lb { position: fixed; inset: 0; z-index: 100; }
.lb[hidden] { display: none; }
.lb-backdrop { position: absolute; inset: 0; background: rgba(20, 8, 10, .9); opacity: 0; }
.lb-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.lb-stage.zoomed { cursor: grab; }
.lb-stage.dragging { cursor: grabbing; }
.lb-img {
  position: absolute; display: block; max-width: none; user-select: none; -webkit-user-drag: none;
  transform-origin: 50% 50%; will-change: transform;
}
.lb-ui { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.lb-ui > * { pointer-events: auto; }
.lb-top { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
.lb-top > * { pointer-events: auto; }
.lb-count { color: var(--cream-text); font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lb-tools { display: flex; gap: 8px; }
.lb-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--cream); color: var(--red);
  transition: transform 200ms var(--ease-out), opacity 200ms ease;
}
.lb-btn svg { width: 22px; height: 22px; }
.lb-btn:active { transform: scale(.92); }
.lb-btn:disabled { opacity: .35; cursor: default; }
@media (hover: hover) and (pointer: fine) { .lb-btn:not(:disabled):hover { transform: translateY(-2px); } }
.lb-prev, .lb-next { position: absolute; top: 50%; margin-top: -24px; }
.lb-prev { left: 16px; } .lb-next { right: 16px; }
.lb-hint {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  color: var(--cream-text); font-size: .875rem; white-space: nowrap; opacity: .8; pointer-events: none;
}
@media (max-width: 600px) { .lb-prev, .lb-next { top: auto; bottom: 56px; margin-top: 0; } .lb-hint { bottom: 18px; font-size: .8125rem; } }

/* ---------------------------------------------------------------------
   REDUCED MOTION — fades stay, travel goes
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .bar-bg, .bar.has-bg > *, .bar.has-bg .nav > * { transition: none; }
  .btn, .btn:hover { transform: none; }
}

/* added sections: no movement when reduced motion is on */
@media (prefers-reduced-motion: reduce) {
  .qa .a, .qa .a > div, .qa .pm, .qa .pm::before, .qa .pm::after { transition: none; }
}

/* the photography wall: the narrow column drifts at its own pace (scroll-linked, off the main thread) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) and (min-width: 601px) {
    .lane-b { animation: lane-drift linear both; animation-timeline: view(); animation-range: cover; }
    @keyframes lane-drift { from { translate: 0 5vw; } to { translate: 0 -5vw; } }
  }
}
