/* ==========================================================================
   Work reel: client sites on a curved glass lens.
   Base rules are the no-script layout (a plain grid of project cards). reel.js adds
   .is-reel to the section when WebGL is available and draws the scene into the canvas.
   The section scrolls with the page like any other; only sideways input moves the reel.
   ========================================================================== */

.work { padding-block: var(--section); }
.work__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(46rem 30rem at 10% -8%, oklch(0.5 0.12 246 / 0.55), transparent 65%), radial-gradient(40rem 28rem at 98% 110%, oklch(0.58 0.12 55 / 0.38), transparent 65%); }
.work__inner { position: relative; z-index: 1; }
.work__head { position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: end; gap: 2rem 4rem; margin: 0 auto clamp(2.25rem, 4.5vw, 3.5rem); max-width: var(--max); }
.work__head h2 { font-size: var(--fs-h2); line-height: 1.02; letter-spacing: -0.032em; max-width: 12ch; }
.work__head p { color: var(--on-dark-2); font-size: var(--fs-lede); line-height: 1.55; max-width: 44ch; }
.work__head p a { color: var(--on-dark); font-weight: 700; text-underline-offset: 0.25em; }
.work__head p a:hover { color: var(--accent-light); }

/* No-script layout: stacked glass cards */
.reel__canvas, .reel__stage, .reel__nav { display: none; }
.reel__details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.5rem); max-width: var(--max); margin-inline: auto; }
.project { display: flex; flex-direction: column; gap: 1.25rem; padding: clamp(0.9rem, 1.6vw, 1.25rem); border-radius: var(--r-lg); background: linear-gradient(158deg, oklch(1 0 0 / 0.1), oklch(1 0 0 / 0.03)); border: 1px solid oklch(1 0 0 / 0.16); box-shadow: 0 1px 0 oklch(1 0 0 / 0.2) inset; }
.project__media { order: -1; }
.project__text { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.25rem 0.5rem 0.5rem; }
.project__place { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent-light); font-weight: 500; font-size: 0.95rem; }
.project__place .icon { width: 1.05em; height: 1.05em; }
.project__name { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem); line-height: 1.04; letter-spacing: -0.03em; }
.project__desc { color: var(--on-dark-2); max-width: 52ch; }
.project__facts { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.6rem; }
.project__facts li { padding: 0.34rem 0.8rem; border-radius: 99px; border: 1px solid oklch(1 0 0 / 0.18); background: oklch(1 0 0 / 0.05); color: var(--on-dark); font-size: 0.84rem; font-weight: 500; }
.project__link { display: inline-flex; align-items: center; align-self: flex-start; gap: 0.45rem; margin-top: 0.9rem; padding-bottom: 0.2rem; color: var(--on-dark); font-weight: 700; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1.5px no-repeat; transition: background-size 0.45s var(--ease-out), color 0.3s; }
.project__link:hover { color: var(--accent-light); background-size: 0% 1.5px; background-position: 100% 100%; }
.project__link .icon { width: 1.1em; height: 1.1em; transition: transform 0.4s var(--ease-out); }
.project__link:hover .icon { transform: translate(2px, -2px); }
.shot { border-radius: 14px; overflow: hidden; background: var(--night-2); border: 1px solid oklch(1 0 0 / 0.14); }
.shot__bar { display: flex; align-items: center; gap: 1rem; height: 34px; padding-inline: 12px; background: oklch(1 0 0 / 0.06); border-bottom: 1px solid oklch(1 0 0 / 0.08); }
.browser__dots { display: flex; gap: 7px; }
.browser__dots i { width: 9px; height: 9px; border-radius: 50%; background: oklch(1 0 0 / 0.22); }
.shot__url { padding: 0.12rem 0.8rem; border-radius: 99px; background: oklch(1 0 0 / 0.07); color: var(--on-dark-2); font-size: 0.76rem; }
.shot__view { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.shot__view img { width: 100%; }
.shot-phone { display: none; }
/* With script, the reel draws its own screenshots, so the grid's copies stay unloaded */
html.js:not(.reel-off) .project__media { display: none; }

/* --------------------------------------------------------------------------
   Reel mode: the canvas fills the panel; text and controls float above it
   -------------------------------------------------------------------------- */
.work.is-reel { height: clamp(640px, calc(100svh - 16px), 940px); margin-block: 8px; padding: 0; display: flex; touch-action: pan-y; cursor: grab; background: #050e19; }
.work.is-reel.is-dragging { cursor: grabbing; }
.is-reel .reel__canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.is-reel .work__bg { display: none; }
.is-reel .work__inner { width: 100%; max-width: none; display: flex; flex-direction: column; gap: clamp(0.4rem, 1.4vh, 1rem); padding: 92px var(--gutter) clamp(16px, 2.6vh, 28px); pointer-events: none; }
.is-reel .work__inner a, .is-reel .work__inner button, .is-reel .reel__tabs { pointer-events: auto; }
.is-reel .work__head { width: 100%; margin: 0 auto; }
.is-reel .work__head h2 { font-size: clamp(1.9rem, 1.1rem + 2.4vw, 3.3rem); max-width: none; }
.is-reel .work__head p { font-size: clamp(1rem, 0.95rem + 0.25vw, 1.15rem); }
.is-reel .reel { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: clamp(0.5rem, 1.6vh, 1rem); }
.is-reel .reel__stage { display: block; position: relative; min-height: 220px; outline: none; }
.is-reel .reel__stage:focus-visible { outline: 1.5px solid oklch(1 0 0 / 0.4); outline-offset: -6px; border-radius: 28px; }

/* Corner marks around the project in the middle */
.reel__focus { position: absolute; left: 50%; top: 50%; width: var(--cw, 0px); height: var(--ch, 0px); transform: translate(-50%, -50%); pointer-events: none; opacity: var(--focus, 0); transition: opacity 0.35s var(--ease-out); }
.reel__focus i { position: absolute; width: 14px; height: 14px; }
.reel__focus i::before, .reel__focus i::after { content: ""; position: absolute; background: oklch(1 0 0 / 0.9); }
.reel__focus i::before { left: 6px; top: 0; width: 1.5px; height: 14px; }
.reel__focus i::after { left: 0; top: 6px; width: 14px; height: 1.5px; }
.reel__focus i:nth-child(1) { left: -8px; top: -8px; }
.reel__focus i:nth-child(2) { right: -8px; top: -8px; }
.reel__focus i:nth-child(3) { left: -8px; bottom: -8px; }
.reel__focus i:nth-child(4) { right: -8px; bottom: -8px; }

.reel__arrow { position: absolute; z-index: 3; top: 50%; width: 48px; height: 48px; margin-top: -24px; display: grid; place-items: center; border-radius: 50%; border: 0; color: var(--on-dark); background: linear-gradient(180deg, oklch(1 0 0 / 0.2), oklch(1 0 0 / 0.08)); box-shadow: 0 1px 0 oklch(1 0 0 / 0.34) inset, 0 0 0 1px oklch(1 0 0 / 0.16) inset, 0 14px 26px -14px rgb(0 0 0 / 0.7); transition: transform 0.4s var(--ease-out), background-color 0.3s, opacity 0.4s; }
.reel__arrow:hover { transform: scale(1.08); }
.reel__arrow:active { transform: scale(0.95); }
.reel__arrow:disabled { opacity: 0.25; pointer-events: none; }
.reel__arrow .icon { width: 22px; height: 22px; stroke-width: 2; }
.reel__arrow--left { left: clamp(10px, 3vw, 44px); }
.reel__arrow--left .icon { transform: rotate(180deg); }
.reel__arrow--right { right: clamp(10px, 3vw, 44px); }

/* Details: the project in the middle of the screen, centred under it like a caption */
.is-reel .reel__details { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 920px; margin-inline: auto; opacity: var(--ui, 1); text-align: center; }
.is-reel .project { grid-area: 1 / 1; display: block; padding: 0; background: none; border: 0; box-shadow: none; opacity: 0; visibility: hidden; transform: translateY(14px); filter: blur(8px); transition: opacity 0.5s var(--ease-out), transform 0.8s var(--ease-out), filter 0.5s var(--ease-out), visibility 0s linear 0.5s; }
.is-reel .project.is-active { opacity: 1; visibility: visible; transform: none; filter: none; transition-delay: 0.12s, 0.12s, 0.12s, 0s; }
.is-reel .project__media { display: none; }
.is-reel .project__text { display: flex; flex-direction: column; align-items: center; padding: 0; gap: 0.2rem; }
.is-reel .project__place { order: 2; justify-content: center; color: var(--on-dark-3); font-size: 0.9rem; }
.is-reel .project__name { order: 1; margin: 0; font-size: clamp(1.6rem, 1.15rem + 1.5vw, 2.4rem); }
.is-reel .project__desc { order: 3; margin: 0.45rem auto 0; font-size: 0.98rem; line-height: 1.5; max-width: 62ch; }
.is-reel .project__facts { order: 4; justify-content: center; margin: 0.7rem 0 0; }
.is-reel .project__link { order: 5; align-self: center; margin: 0.8rem 0 0; }

.is-reel .reel__nav { display: flex; align-items: center; justify-content: center; gap: 1.25rem; width: 100%; max-width: var(--max); margin-inline: auto; position: relative; opacity: var(--ui, 1); }
.reel__tabs { display: flex; gap: 2px; padding: 5px; border-radius: 99px; background: oklch(1 0 0 / 0.06); border: 1px solid oklch(1 0 0 / 0.14); box-shadow: 0 1px 0 oklch(1 0 0 / 0.14) inset; }
.reel__tab { padding: 0.45rem 1rem; white-space: nowrap; border: 0; border-radius: 99px; background: transparent; color: var(--on-dark-2); font-weight: 500; font-size: 0.9rem; transition: background-color 0.4s var(--ease-out), color 0.3s; }
.reel__tab:hover { color: var(--on-dark); }
.reel__tab[aria-current="true"] { background: oklch(1 0 0 / 0.17); color: var(--on-dark); box-shadow: 0 1px 0 oklch(1 0 0 / 0.3) inset; }
.reel__hint { position: absolute; right: 0; display: inline-flex; align-items: center; gap: 0.6rem; color: var(--on-dark-3); font-size: 0.86rem; transition: opacity 0.6s var(--ease-out); }
.reel__hint svg { width: 34px; height: 12px; overflow: visible; }
.reel__hint path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.reel__hint .nudge { animation: nudge 2.4s var(--ease-in-out) infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(-3px); } 50% { transform: translateX(3px); } }
.reel__hint.is-gone { opacity: 0; }

@media (max-width: 960px) {
  .work__head { grid-template-columns: minmax(0, 1fr); }
  .reel__details { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .is-reel .work__head p { display: none; }
  .is-reel .work__inner { padding-top: 84px; }
  .is-reel .project__desc { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.95rem; }
  .is-reel .project__facts { display: none; }
  .reel__arrow { width: 42px; height: 42px; margin-top: -21px; }
  .reel__hint { display: none; }
  .reel__tab { padding: 0.42rem 0.62rem; font-size: 0.8rem; }
}
@media (max-height: 760px) and (min-width: 801px) {
  .is-reel .work__head p { display: none; }
  .is-reel .work__inner { padding-top: 84px; }
  .is-reel .project__facts { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reel__hint .nudge { animation: none; }
}
