/*
 * work.html — view 1: the 3D cylinder carousel (js/orbit.js), its centre-card info and play button.
 *
 * Base rules = the no-JS / reduced-motion layout: a plain list of linked cards in a swipeable,
 * scroll-snapping row inside a rounded black stage. With JS and motion allowed the full-bleed perspective
 * stage applies from first paint (html.fx); in scroll mode (css/work.css) it fills the sticky frame, so the
 * box never changes size when the script arrives (CLS 0).
 * Colours: ink/bg tokens only (amber stays rationed, see css/inner.css).
 */

.orbit{
  --orbit-h: clamp(520px, 86vh, 860px);
  --radius: 14px;
  position: relative;
  /* .orbit is a flex item (.projects__main) with auto margins, so it does not stretch, and its list is
     absolutely positioned: without a width the row-mode stage collapsed to its padding (a 112px strip). */
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}
@supports (height: 1svh){ .orbit{ --orbit-h: clamp(520px, 86svh, 860px); } }
@media (max-width: 639.98px){
  .orbit{ --orbit-h: clamp(460px, 74svh, 640px); }
}

.orbit__viewport{
  position: relative;
  height: var(--orbit-h);
  border-radius: var(--round-xl);
  background: #000;
  overflow: hidden;
}

/* ---------- row mode (no JS, reduced motion) ---------- */
/* The list fills the stage in both modes (absolute, inset 0), so the 3D upgrade moves no box: CLS 0. */
.orbit__list{
  list-style: none;
  margin: 0;
  padding: 0 1.25rem;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.orbit__list::-webkit-scrollbar{ display: none; width: 0; height: 0; }

.orbit__item{
  flex: 0 0 min(78vw, 400px);
  scroll-snap-align: center;
}
.ocard{
  display: block;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius);
}
.ocard:focus-visible{ outline: 3px solid var(--ink); outline-offset: 4px; }
.ocard__body{ display: block; position: relative; }
.ocard__layer{ display: none; }

.ocard__face{
  display: block;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #17181b 0%, #262a31 100%);
}
.ocard__face--front{ aspect-ratio: 1.5925; container-type: inline-size; }
.ocard__poster{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ocard__shade{
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 34%),
    linear-gradient(0deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, 0) 40%);
  pointer-events: none;
}
.ocard__concept,
.ocard__mark,
.ocard__tag{
  position: absolute;
  line-height: 1.1;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}
.ocard__concept{
  top: 7.5%; left: 6%;
  font-size: max(9px, calc(var(--card-w, 360px) * .03));
  font-weight: 400;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .8;
}
.ocard__mark{
  top: 6.5%; right: 6%;
  max-width: 62%;
  text-align: right;
  font-size: max(11px, calc(var(--card-w, 360px) * .05));
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ocard__tag{
  left: 6%; bottom: 8%;
  padding: .35em .8em;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  font-size: max(9px, calc(var(--card-w, 360px) * .034));
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, .25);
}

/* Narrow cards (phones, small tablets, the no-JS row on a phone). The 9 px / 11 px font floors made "Concept build"
   and the name collide here, and on a 190 px card any free spot for the name lies over the subject. So the two
   stack top-left on small ink plates (the same family as the tag pill): >= 4.5:1 over any cover. */
@container (max-width: 330px){
  .ocard__concept,
  .ocard__mark{
    left: 6%; right: auto;
    max-width: 88%;
    text-align: left;
    border-radius: 6px;
    background: rgba(10, 11, 14, .62);
    text-shadow: none;
  }
  .ocard__concept{ top: 6%; padding: .3em .55em; font-size: max(9px, 3cqw); opacity: 1; }
  .ocard__mark{ top: calc(6% + max(9px, 3cqw) * 1.7 + 4px); padding: .2em .45em; }
  /* the tag keeps its 9 px floor, so it covers more of a small card: deeper bottom shade */
  .ocard__shade{
    background:
      linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 34%),
      linear-gradient(0deg, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, 0) 45%);
  }
}

/* back: in row mode it is simply the caption under the poster */
.ocard__face--back{ background: transparent; overflow: visible; padding: .9rem .25rem 0; }
.ocard__blur{ display: none; }
.ocard__back-text{ display: flex; flex-direction: column; gap: .35rem; }
.ocard__back-name{ font-weight: 500; text-transform: uppercase; letter-spacing: .04em; font-size: 1rem; }
.ocard__desc{ font-weight: 400; font-size: .9rem; line-height: 1.45; color: rgba(215, 226, 234, .78); }
.ocard__go{ font-weight: 500; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; margin-top: .25rem; }

.orbit__controls{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}
.orbit__btn{
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid rgba(215, 226, 234, .55);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s cubic-bezier(.22, 1, .36, 1), border-color .15s cubic-bezier(.22, 1, .36, 1), transform .1s cubic-bezier(.22, 1, .36, 1);
}
.orbit__btn:focus-visible{ outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- 3D mode ----------
   Applied from first paint whenever js/fx.js has run (html.fx) and motion is allowed, so the stage never
   switches layout under the visitor (that switch was a 0.8 CLS hit in QA). The cards stay hidden until
   js/orbit.js has placed them and their posters are decoded (.is-ready). Reduced motion, no 3D support
   or no JS keep the row above. */
@media (prefers-reduced-motion: no-preference){
@supports (transform-style: preserve-3d) and (backface-visibility: hidden){
  html.fx .orbit{
    --card-w: clamp(200px, calc(19vw + 168px), 450px);
    --card-h: calc(var(--card-w) / 1.5925);
    max-width: none;
  }
  @media (max-width: 639.98px){ html.fx .orbit{ --card-w: clamp(190px, 67.2vw, 370px); } }

  /* full-bleed (Jay 2026-10-13: "remove the arrows and the border, I want this to be fuller"): no frame, no
     panel colour; soft fades where the stage meets the heading and the info row */
  html.fx .orbit .orbit__viewport{ border-radius: 0; background: transparent; }
  html.fx .orbit .orbit__viewport::before,
  html.fx .orbit .orbit__viewport::after{
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    z-index: 3;
    height: clamp(28px, 6vh, 64px);
    pointer-events: none;
  }
  html.fx .orbit .orbit__viewport::before{ top: 0; background: linear-gradient(180deg, var(--bg), rgba(12, 12, 12, 0)); }
  html.fx .orbit .orbit__viewport::after{ bottom: 0; background: linear-gradient(0deg, var(--bg), rgba(12, 12, 12, 0)); }

  /* the step buttons stay for keyboards and screen readers, but only show while one of them has focus */
  html.fx .orbit .orbit__controls{
    position: absolute;
    left: 50%;
    top: 1rem;
    z-index: 6;
    margin: 0;
    transform: translateX(-50%);
  }
  html.fx .orbit .orbit__controls:not(:focus-within){ opacity: 0; pointer-events: none; }
  html.fx .orbit .orbit__btn{ background: rgba(12, 12, 12, .8); }

  /* ---------- the centre card's info + play button ---------- */
  html.fx .orbit .orbit__info{
    display: grid;
    transition: opacity .25s cubic-bezier(.22, 1, .36, 1), translate .25s cubic-bezier(.22, 1, .36, 1);
  }
  /* hidden while the cards open (js/orbit.js adds .info-on once the drum has settled); failsafe if it never runs */
  html.fx .orbit:not(.info-on) .orbit__info{
    opacity: 0;
    translate: 0 14px;
    visibility: hidden;
    animation: orbit-info-failsafe .25s linear 6s forwards;
  }
  @keyframes orbit-info-failsafe{ to{ opacity: 1; translate: 0 0; visibility: visible; } }
  /* opacity, not visibility: the links stay in the accessibility tree while the intro plays */
  html.fx .orbit:not(.is-ready) .orbit__item{ opacity: 0; animation: orbit-failsafe .2s linear 6s forwards; }
  @keyframes orbit-failsafe{ to{ opacity: 1; } }   /* orbit.js never ran: show the cards anyway */
  html.fx .orbit .orbit__viewport{
    overflow: clip;                    /* not just hidden: focusing a card must never scroll the stage (QA caught a 63px jump) */
    perspective: 1350px;
    touch-action: pan-y;               /* vertical swipes still scroll the page; horizontal ones turn the drum */
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
  }
  html.fx .orbit .orbit__viewport:active{ cursor: grabbing; }
  html.fx .orbit .orbit__list{
    position: absolute;
    inset: 0;
    display: block;
    padding: 0;
    overflow: visible;
    transform-style: preserve-3d;
  }
  html.fx .orbit .orbit__item{
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--card-w);
    height: var(--card-h);
    margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
    transform-style: preserve-3d;
  }
  html.fx .orbit .orbit__item.is-near{ will-change: transform; }
  html.fx .orbit .ocard,
  html.fx .orbit .ocard__body{
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
  }
  html.fx .orbit .ocard:focus-visible{ outline: none; }
  html.fx .orbit .ocard__layer{
    display: block;
    position: absolute;
    inset: .5px;                         /* a hair inside the faces: only the rim shows, never over a face */
    border-radius: var(--radius);
    background: #6f757d;
  }
  html.fx .orbit .ocard__face{
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }
  html.fx .orbit .ocard__face--front{ aspect-ratio: auto; transform: translateZ(2px); }
  /* js/orbit.js marks the cards turned past 90deg; only the face towards the camera is painted */
  html.fx .orbit .orbit__item:not(.is-flip) .ocard__face--back,
  html.fx .orbit .orbit__item.is-flip .ocard__face--front{ visibility: hidden; }
  html.fx .orbit .ocard__face--back{
    transform: rotateX(180deg) translateZ(2px);
    padding: 0;
    overflow: hidden;
    background: #101114;
  }
  html.fx .orbit .ocard__blur{
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .9;
  }
  html.fx .orbit .ocard__back-text{
    position: absolute;
    inset: 0;
    padding: 8% 7%;
    justify-content: flex-end;
    gap: .3em;
    background: linear-gradient(0deg, rgba(0, 0, 0, .72) 0%, rgba(0, 0, 0, .2) 100%);
    font-size: max(10px, calc(var(--card-w) * .042));
    color: #fff;
  }
  html.fx .orbit .ocard__back-name{ font-size: 1.15em; }
  html.fx .orbit .ocard__desc{ font-size: .92em; color: rgba(255, 255, 255, .82); }
  html.fx .orbit .ocard__go{ font-size: .85em; }

  /* hover / focus on the centre card: a glow ring + a sheen sweep (the lift is the JS translateZ).
     Both are pseudo-elements whose opacity / transform animate, never box-shadow. Hover is gated to
     real pointers, so a tap on a phone selects instead of leaving a stuck hover state. */
  html.fx .orbit .ocard__face--front::before{
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1.5px rgba(215, 226, 234, .75), inset 0 0 36px rgba(215, 226, 234, .22);
    opacity: 0;
    transition: opacity .2s cubic-bezier(.22, 1, .36, 1);
    pointer-events: none;
    z-index: 2;
  }
  html.fx .orbit .ocard__face--front::after{
    content: "";
    position: absolute;
    inset: -20% -60%;
    background: linear-gradient(105deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .26) 50%, rgba(255, 255, 255, 0) 62%);
    transform: translateX(-70%);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
  }
  html.fx .orbit .is-centre .ocard:focus-visible .ocard__face--front::before{ opacity: 1; }
  /* keyboard focus: a solid 3px ink ring, not just the hover glow (a11y pass 2026-10-25) */
  html.fx .orbit .is-centre .ocard:focus-visible .ocard__face--front::before{ box-shadow: inset 0 0 0 3px #D7E2EA, inset 0 0 36px rgba(215, 226, 234, .22); }
  html.fx .orbit .is-centre .ocard:focus-visible .ocard__face--front::after{ animation: orbit-sheen .6s cubic-bezier(.22, 1, .36, 1) both; }
  @media (hover: hover) and (pointer: fine){
    html.fx .orbit .is-centre .ocard:hover .ocard__face--front::before{ opacity: 1; }
    html.fx .orbit .is-centre .ocard:hover .ocard__face--front::after{ animation: orbit-sheen .6s cubic-bezier(.22, 1, .36, 1) both; }
    .orbit__btn:hover{ background-color: rgba(215, 226, 234, .1); border-color: var(--ink); }
  }
  .orbit__btn:active{ transform: scale(.97); }

  @keyframes orbit-sheen{
    0%{ transform: translateX(-70%); opacity: 0; }
    20%{ opacity: 1; }
    100%{ transform: translateX(70%); opacity: 0; }
  }

}
}

/* ---------- the centre card's info + play button (3D mode only; css/work.css places the block) ---------- */
.orbit__info{ display: none; }
.orbit__info{
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 1.25rem;
}
.orbit__about{
  min-width: 0;
  transition: opacity .11s cubic-bezier(.22, 1, .36, 1), transform .11s cubic-bezier(.22, 1, .36, 1);
}
.orbit__info.is-swap .orbit__about{ opacity: 0; transform: translateY(4px); transition-duration: .09s; }
.orbit__name{
  font-weight: 600;
  font-size: clamp(1.2rem, 1.9vw, 2rem);
  line-height: 1.1;
  letter-spacing: -.01em;
  color: #fff;
  text-wrap: balance;
}
.orbit__type{
  margin-top: .35rem;
  font-size: .75rem;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(215, 226, 234, .72);
}
.orbit__desc{
  margin-top: .6rem;
  font-size: clamp(.875rem, 1.05vw, 1rem);
  font-weight: 400;
  line-height: 1.5;
  color: rgba(215, 226, 234, .82);
  text-wrap: pretty;
}
.orbit__play{
  display: grid;
  place-items: center;
  width: clamp(56px, 5.4vw, 76px);
  height: clamp(56px, 5.4vw, 76px);
  border-radius: 50%;
  background: #fff;
  color: #0c0c0c;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  transition: transform .12s cubic-bezier(.22, 1, .36, 1), background-color .15s cubic-bezier(.22, 1, .36, 1);
  -webkit-tap-highlight-color: transparent;
}
.orbit__play svg{ width: 42%; height: 42%; margin-left: 6%; }
.orbit__play:active{ transform: scale(.95); }
.orbit__play:focus-visible{ outline: 3px solid var(--ink); outline-offset: 4px; }
@media (hover: hover) and (pointer: fine){
  .orbit__play:hover{ transform: scale(1.05); background: var(--ink); }
}
@media (max-width: 639.98px){
  .orbit__desc{
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* low-end / touch: no sheen animation work */
.orbit--lite .ocard__face--front::after{ display: none; }

@media (max-width: 639.98px){
  .orbit__viewport{ border-radius: 28px; }
}

@media (prefers-reduced-motion: reduce){
  .orbit__list{ scroll-behavior: auto; }
}
