/* ============================================================================
   SELECTED WORK: the homepage overview (js/modules/workArchive.js). Homepage only.
   A wine title band, then the projects as strips on warm white; the project's main image
   opens behind a strip on hover / focus (tap on touch screens).
   Colours, type and grain come from the tokens in css/atelier.css.
   ============================================================================ */

.work {
  position: relative;
  background: var(--warm-white, #f8f4ed);
  color: var(--ink);
}

/* ---------- the title band ---------- */
.work__head {
  position: relative;
  overflow: hidden;
  color: var(--ivory);
  background-color: var(--wine);
  background-image:
    var(--grain-light),
    radial-gradient(ellipse 70% 90% at 20% 100%, rgba(134, 32, 47, 0.55), transparent 70%),
    linear-gradient(180deg, var(--wine-deep), var(--wine));
  background-size: 180px 180px, 100% 100%, 100% 100%;
}

.work__head-inner {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  align-items: end;
  min-height: clamp(22rem, 62svh, 38rem);
  padding-block: clamp(6rem, 12vw, 10rem) clamp(3rem, 6vw, 5rem);
}

.work__label {
  grid-column: 1 / -1;
  align-self: start;
  color: rgba(242, 232, 214, 0.62);
}

/* size: the headline step of the type scale (css/atelier.css); the "work" in gold leaf there */
.work__title {
  grid-column: 1 / span 10;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ivory);
}

.work__title em {
  font-style: italic;
}

.work__count {
  grid-column: 11 / span 2;
  justify-self: end;
  padding-bottom: 1.2em;
  color: rgba(242, 232, 214, 0.62);
  white-space: nowrap;
}

/* ---------- the strips ---------- */
.work__body {
  padding-block: clamp(4rem, 8vw, 7rem) clamp(5rem, 10vw, 9rem);
}

.strips {
  list-style: none;
}

.strip {
  --mx: 0%;
  --my: 0%;
  --bleed: 0.22; /* how far the open image reaches beyond the strip, above and below */
  position: relative;
  z-index: 0;
  transition: z-index 0s linear 0.7s;
}

.strip__rule {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  background: rgba(31, 19, 17, 0.2);
}

.strip__rule--end {
  position: relative;
}

.strip__link {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: var(--gutter);
  min-height: clamp(6rem, 3rem + 5.5vw, 9.5rem);
  padding-block: clamp(1.2rem, 2vw, 2rem);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.strip__no {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  font-variant-numeric: tabular-nums;
  transition: color 0.5s var(--ease-out);
}

.strip__title {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-display);
  font-weight: 400;
  /* size: the display step of the type scale (css/atelier.css) */
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  transition: color 0.5s var(--ease-out), opacity 0.5s var(--ease-out);
}

/* the tag: a small outlined pill, right of the name (the reference's detail, kept quiet) */
.strip__tags {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  gap: 0.4rem;
}

.strip__tag {
  padding: 0.35em 0.85em 0.3em;
  border: 1px solid currentColor;
  border-radius: 99px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0.7;
  transition: color 0.5s var(--ease-out), opacity 0.5s var(--ease-out);
}

/* the call to action only shows when a strip is open by touch */
.strip__cta {
  display: none;
}

.strip__arrow {
  display: inline-block;
  margin-left: 0.7em;
}

/* ---------- the image behind the strip ---------- */
.strip__media {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--bleed) * -100%);
  bottom: calc(var(--bleed) * -100%);
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--umber);
  /* closed: a line across the middle; open: the whole (taller) box */
  clip-path: inset(50% 0 50% 0);
  transition: clip-path 0.75s cubic-bezier(0.65, 0, 0.35, 1);
}

/* a soft veil, darker in the middle where the name sits */
.strip__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 45% 70% at 50% 50%, rgba(20, 8, 8, 0.42), transparent 75%),
    rgba(20, 8, 8, 0.28);
}

.strip__img {
  position: absolute;
  inset: -4%;
  display: block;
  transform: translate3d(var(--mx), var(--my), 0) scale(1.14);
  transition: transform 1.1s var(--ease-out);
  will-change: transform;
}

.strip__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* app screens (Mother Tracker): shown whole on their own dark ground, two at each end, the
   project's name in the space between */
.strip__img--screens {
  display: flex;
  align-items: center;
  /* clear of the number (left) and the category (right), which stay over the strip */
  padding-inline: 9% 14.5%;
  gap: 1.2%;
}

.strip__img--screens img {
  width: auto;
  height: 70%;
  max-width: none;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.strip__img--screens img:nth-child(2) {
  margin-right: auto;
}

.strip__img--screens img:nth-child(3) {
  margin-left: auto;
}

/* ---------- a project's own mark, in the middle of its strip (workArchive.js HOME) ---------- */
.strip__logo {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1; /* over the veil */
  display: block;
  transform: translate(-50%, -50%) scale(0.94);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out) 0.1s, transform 1.1s var(--ease-out) 0.1s;
}

.strip__logo img {
  display: block;
  width: auto;
  height: 100%;
}

/* VU: the cream logo, large and unobstructed over the photographed bubbles: a soft pool of the
   photograph's own black lies behind it, so no bubble ever runs through the letters */
.strip__logo--vu {
  z-index: 2;
  height: 54%;
  filter: drop-shadow(0 6px 22px rgba(0, 0, 0, 0.5));
}

.strip__logo--vu::before {
  content: '';
  position: absolute;
  inset: -55% -150%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.92) 30%, rgba(0, 0, 0, 0.6) 62%, rgba(0, 0, 0, 0) 100%);
}

/* Mother Tracker: the logo alone, the centre of the strip, whole and never cut */
.strip__logo--mt {
  height: min(64%, 88cqw / 2.43); /* never wider than the strip (the logo is 2.43 : 1) */
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
}

/* VU's soap bubbles: thin iridescent rims, drifting up a little while the strip is open */
.strip__bubbles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.strip__bubbles i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(var(--s) * 100cqh);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    /* the window highlight */
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.75) 0 5%, rgba(255, 255, 255, 0) 13%),
    /* a soft inner sheen */
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 0 58%, rgba(255, 255, 255, 0.12) 70%, rgba(255, 255, 255, 0) 72%),
    /* the film's colours, around the rim */
    conic-gradient(from 200deg, rgba(255, 196, 120, 0.55), rgba(255, 120, 190, 0.45), rgba(140, 150, 255, 0.5), rgba(120, 230, 210, 0.45), rgba(255, 236, 140, 0.5), rgba(255, 196, 120, 0.55));
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 74%, #000 84% 97%, transparent 100%), radial-gradient(circle at 32% 28%, #000 0 13%, transparent 14%);
  mask: radial-gradient(circle closest-side, transparent 0 74%, #000 84% 97%, transparent 100%), radial-gradient(circle at 32% 28%, #000 0 13%, transparent 14%);
  opacity: 0;
  transform: translate3d(0, 12%, 0) scale(0.85);
  transition: opacity 0.9s var(--ease-out), transform 1.4s var(--ease-out);
}

.strip__media {
  container-type: size;
}

/* open: the mark appears, the typeset name gives way */
.strip--mark .strip__title {
  transition: color 0.5s var(--ease-out), opacity 0.45s var(--ease-out);
}

/* !important: the scroll reveal leaves an inline opacity on the name */
.strip--mark.is-open .strip__title,
.strip--mark:has(.strip__link:focus-visible) .strip__title {
  opacity: 0 !important;
}

.strip.is-open :is(.strip__logo, .strip__bubbles i),
.strip:has(.strip__link:focus-visible) :is(.strip__logo, .strip__bubbles i) {
  opacity: 1;
}

.strip.is-open .strip__logo,
.strip:has(.strip__link:focus-visible) .strip__logo {
  transform: translate(-50%, -50%);
}

.strip.is-open .strip__bubbles i,
.strip:has(.strip__link:focus-visible) .strip__bubbles i {
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .strip--mark:hover .strip__title {
    opacity: 0 !important;
  }
  .strip:hover :is(.strip__logo, .strip__bubbles i) {
    opacity: 1;
  }
  .strip:hover .strip__logo {
    transform: translate(-50%, -50%);
  }
  .strip:hover .strip__bubbles i {
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .strip:is(:hover, .is-open) .strip__bubbles i {
    animation: bubble-drift var(--t) ease-in-out var(--d) infinite alternate;
  }
}

@keyframes bubble-drift {
  from { translate: 0 0; }
  to { translate: 6% -18%; }
}

/* ---------- open: hover, keyboard focus, or a tap (.is-open) ---------- */
.strip:has(.strip__link:focus-visible),
.strip.is-open {
  z-index: 3;
  transition: z-index 0s;
}

.strip__link:focus-visible .strip__media,
.strip.is-open .strip__media {
  clip-path: inset(0 0 0 0);
}

.strip__link:focus-visible .strip__img,
.strip.is-open .strip__img {
  transform: translate3d(var(--mx), var(--my), 0) scale(1);
}

.strip__link:focus-visible :is(.strip__no, .strip__title, .strip__tag),
.strip.is-open :is(.strip__no, .strip__title, .strip__tag) {
  color: var(--ivory);
}

.strip__link:focus-visible {
  outline: none;
}

/* the open strip's own hairline gives way to the picture */
.strip__rule {
  transition: opacity 0.4s var(--ease-out);
}

.strip:has(.strip__link:focus-visible) .strip__rule,
.strip.is-open .strip__rule {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .strip:hover .strip__rule {
    opacity: 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .strip:hover {
    z-index: 3;
    transition: z-index 0s;
  }
  .strip:hover .strip__media {
    clip-path: inset(0 0 0 0);
  }
  .strip:hover .strip__img {
    transform: translate3d(var(--mx), var(--my), 0) scale(1);
  }
  .strip:hover :is(.strip__no, .strip__title, .strip__tag) {
    color: var(--ivory);
  }
  .strip:hover .strip__tag {
    opacity: 1;
  }
  /* the others step back while one is open */
  .strips:hover .strip:not(:hover) .strip__title {
    opacity: 0.32;
  }
}

/* ---------- touch screens: the tapped strip grows to show its image ---------- */
@media (hover: none), (pointer: coarse) {
  .strip {
    --bleed: 0;
  }
  .strip__link {
    transition: padding 0.7s var(--ease-out);
  }
  .strip.is-open .strip__link {
    padding-block: clamp(5.5rem, 22vw, 9rem);
  }
  .strip.is-open .strip__cta {
    display: block;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    margin-top: 1.1rem;
    color: var(--ivory);
    animation: strip-cta 0.6s var(--ease-out) 0.25s both;
  }
}

@keyframes strip-cta {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- narrow screens: the number and tag move under the name ---------- */
@media (max-width: 760px) {
  .work__head-inner {
    min-height: clamp(20rem, 62svh, 30rem);
  }
  .work__title {
    grid-column: 1 / -1;
  }
  .work__count {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 1.4rem 0 0;
  }
  .strip__link {
    grid-template-columns: 1fr;
    justify-items: center;
    row-gap: 0.7rem;
    min-height: 0;
    padding-block: 2.2rem 2rem;
  }
  .strip__no {
    display: none;
  }
  .strip__title {
    grid-column: 1;
    white-space: normal;
  }
  .strip__tags {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
  }
  .strip.is-open .strip__cta {
    grid-row: 3;
    margin-top: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .strip__media,
  .strip__img,
  .strip__link {
    transition: none;
  }
  .strip__img {
    transform: none !important;
  }
}
