/* =====================================================================
   Computer Xperts — website showcases (css/showcase.css)
   Shared by the homepage and the four website Portfolio pages, after css/site.css.
   Built by xperts-tools/showcase_parts.py; moved by js/showcase.js.

   Contents
    1. Wall band: copy on the left, three drifting columns of pages on the right
       (homepage: Alibaba minisites in orange; Portfolio: websites in Xperts red)
    2. "Featured work" slider: a website on a laptop, tablet and phone
       (homepage: with its name and text; Portfolio hero: the devices only)
    3. Motion (only with .motion-ok)
    4. Responsive: 1023px, 640px
   ===================================================================== */


/* 1. Wall band ----------------------------------------------------------------
   Each theme sets its colours: --ws-base (main), --ws-mid, --ws-deep (darkest; also the button text),
   --ws-hi (the glow top right), --ws-extra (an optional extra light layer). A white wave sweeps in
   from the bottom left on wide screens.
   Each column drifts up or down (its cards are listed three times, so the loop is seamless) and slides
   as the page scrolls (its `translate`, set by js/showcase.js); pointing at the wall stops the drift,
   and the page under the pointer scrolls through all of it (--t = how long). */
.wallsec {
  --wave: radial-gradient(70% 60% at 0% 112%, var(--white) 0 58%, transparent 58.4%);
  overflow: hidden; color: var(--white);
  background:
    var(--wave),
    var(--ws-extra, none),
    radial-gradient(60% 70% at 100% 0%, var(--ws-hi), transparent 70%),
    linear-gradient(115deg, var(--ws-deep) 0%, var(--ws-mid) 38%, var(--ws-base) 100%);
}
.wallsec--alibaba { --ws-base: var(--alibaba); --ws-mid: #e65500; --ws-deep: #c84300; --ws-hi: #ff9a2e; }
.wallsec--red {
  --ws-base: var(--red); --ws-mid: var(--red-deep); --ws-deep: #7a0000; --ws-hi: #ff4a4a;
  --ws-extra:   /* a second, fainter white wave top left, and a bright band behind the wall */
    radial-gradient(42% 34% at 30% -8%, rgba(255, 255, 255, .16) 0 60%, transparent 60.5%),
    linear-gradient(100deg, transparent 52%, rgba(255, 255, 255, .1) 52% 64%, transparent 64%);
}
.wallsec__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 40px; align-items: center; }
.wallsec__copy { padding: var(--section-y) 0 calc(var(--section-y) + 60px); }
.wallsec .section-title { color: var(--white); }
.wallsec__copy p { margin-top: 12px; font-size: 18px; }
.wallsec__btn {
  gap: 9px; margin-top: 24px; border-radius: 999px; background: var(--white); color: var(--ws-deep);
  box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .6);
}
.wallsec__btn:hover { background: var(--ink); color: var(--white); }
.wallsec__btn .ic { width: 18px; height: 18px; transition: transform .2s ease; }
.wallsec__btn:hover .ic { transform: translateX(3px); }

.wall {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; height: 680px;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}
.wall__col { overflow: hidden; }
.wall__col:nth-child(2) { margin-top: -90px; }   /* stagger the middle column */
.wall__track { display: grid; gap: 18px; padding-bottom: 18px; will-change: transform; }
.wall__card {
  display: block; overflow: hidden; border-radius: 12px; background: var(--white);
  border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 22px 36px -22px rgba(0, 0, 0, .75);
  text-decoration: none; transition: border-color .25s ease;
}
.wall__bar { display: flex; align-items: center; gap: 5px; padding: 7px 10px; background: #f1f1f1; }
.wall__bar i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #d0d0d0; }
.wall__bar i:first-child { background: var(--ws-base); }
.wall__bar b {   /* a website's address */
  overflow: hidden; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--white);
  color: #555; font-size: 11px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis;
}
.wall__view { display: block; overflow: hidden; aspect-ratio: 3 / 4; container-type: size; background: var(--white); }
.wallsec--red .wall__view { aspect-ratio: 4 / 5; }
.wall__view picture { display: block; }
.wall__view img {
  display: block; width: 100%; height: auto; min-height: 100cqh;   /* a page shorter than the card still fills it */
  object-fit: cover; object-position: top; transition: transform .6s cubic-bezier(.45, 0, .55, 1);
}
.wall__card:hover, .wall__card:focus-visible { border-color: var(--ink); }
.wall__card:hover img,
.wall__card:focus-visible img { transform: translateY(min(0px, calc(-100% + 100cqh))); transition-duration: var(--t, 3s); }


/* 2. "Featured work" slider ---------------------------------------------------
   One website per slide, on a laptop, a tablet and a phone over a softened picture from the site
   itself (set on the stage in the HTML, darkened by the stage's ::before). The laptop scrolls through
   the whole homepage by itself. Only one slide shows, also while the page is still loading (the first
   one), so nothing is listed or stacked for a moment; js/showcase.js adds .is-ready and turns the slides.
   Made for a dark background. */
.feat__slides { display: grid; }
.feat__slide {
  display: grid; grid-area: 1 / 1; grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); gap: 56px; align-items: center;
  visibility: hidden; opacity: 0; transition: opacity .5s ease, visibility 0s linear .5s;
}
.feat--hero .feat__slide { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.feat:not(.is-ready) .feat__slide:first-child,
.feat__slide.is-active { visibility: visible; opacity: 1; transition-delay: 0s; }

/* the devices: sizes are shares of the stage width (cqw) */
.feat__stage {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 20px; container-type: inline-size;
  background: #2a2a2a center / cover;
}
.feat__stage::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(14, 14, 14, .1), rgba(14, 14, 14, .6)); }
.feat--hero .feat__stage { box-shadow: 0 0 0 1px rgba(255, 255, 255, .12), 0 30px 60px -30px rgba(0, 0, 0, .8); }
.feat__laptop {
  position: absolute; left: 21%; top: 8%; width: 64%; padding: 1.4cqw 1.4cqw 1.8cqw;
  border-radius: 1.6cqw 1.6cqw 0 0; background: #0f0f0f; box-shadow: 0 2.4cqw 4cqw -1.6cqw rgba(0, 0, 0, .8);
}
.feat__laptop::after {   /* the base */
  content: ""; position: absolute; left: -9%; right: -9%; top: 100%; height: 2cqw;
  border-radius: 0 0 1.4cqw 1.4cqw; background: linear-gradient(#d9d9d9, #8f8f8f);
}
.feat__screen { display: block; overflow: hidden; aspect-ratio: 16 / 10; container-type: size; background: #1c1c1c; }   /* dark while the screenshot loads */
.feat__screen img { display: block; width: 100%; height: auto; }
.feat__tablet, .feat__phone { position: absolute; display: block; overflow: hidden; background: #0f0f0f; box-shadow: 0 2cqw 3.6cqw -1.4cqw rgba(0, 0, 0, .85); }
.feat__tablet { left: 5%; bottom: 6%; width: 23%; padding: .9cqw; border-radius: 2cqw; --screen-r: 1.1cqw; }
.feat__phone { right: 5%; bottom: 5%; width: 14%; padding: .6cqw; border-radius: 2.2cqw; --screen-r: 1.6cqw; }
.feat__tablet img, .feat__phone img { display: block; width: 100%; height: auto; border-radius: var(--screen-r); }

/* Portfolio hero: the website's name and a link under the devices */
.feat__cap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; font-size: 16px; }
.feat__cap b { color: var(--white); font-weight: 900; }
.feat__cap a { display: inline-flex; align-items: center; gap: 6px; color: var(--red-on-dark); font-weight: 700; text-decoration: none; }
.feat__cap a:hover { text-decoration: underline; }
.feat__cap .ic { width: 16px; height: 16px; }

/* arrows and dots */
.feat__controls { display: flex; align-items: center; gap: 16px; margin-top: 26px; }   /* in place from the start: the hero keeps its height */
.feat--hero .feat__controls { margin-top: 14px; }
.feat__arrow {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #4a4a4a; border-radius: 50%;
  background: transparent; color: var(--white); cursor: pointer; transition: background-color .2s ease, border-color .2s ease;
}
.feat__arrow:hover { background: var(--red); border-color: var(--red); }
.feat__arrow .ic { width: 20px; height: 20px; }
.feat__arrow--prev .ic { transform: scaleX(-1); }
.feat__dots { display: flex; }
/* each dot is a 24px-tall button (easy to tap); the dot itself is drawn inside it */
.feat__dot { position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; transition: width .3s ease; }
.feat__dot::before {
  content: ""; position: absolute; left: 7px; right: 7px; top: 7px; height: 10px; border-radius: 5px;
  background: #555; transition: background-color .3s ease;
}
.feat__dot[aria-current="true"] { width: 44px; }
.feat__dot[aria-current="true"]::before { background: var(--red); }


/* 3. Motion -------------------------------------------------------------------
   The showing slide's homepage scrolls down to the bottom by itself; when it gets there js/showcase.js
   brings up the next website. Pointing at the laptop sends the page back to the top and runs it down
   quickly, then the next website comes. The scroll waits while the slider is off screen (.is-seen). */
@media (prefers-reduced-motion: no-preference) {
  .motion-ok .feat .is-active .feat__screen img { animation: feat-browse calc(var(--t, 4s) * 1.2 + 2s) ease-in-out both; }
  .motion-ok .feat:not(.is-seen) .is-active .feat__screen img { animation-play-state: paused; }
  /* pointing at the laptop: the page glides back to the top (.is-rewind), then runs down quickly (.is-quick) */
  .motion-ok .feat .is-active.is-rewind .feat__screen img { animation: none; transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
  .motion-ok .feat .is-active.is-quick .feat__screen img { animation: feat-rush calc(var(--t, 4s) * .35 + .8s) ease-in-out both; }

  /* the devices slide in as a new slide turns up (not the first one, which shows with the page) */
  .motion-ok .feat.is-turned .is-active .feat__laptop { animation: feat-in-up .7s cubic-bezier(.2, .7, .2, 1) both; }
  .motion-ok .feat.is-turned .is-active .feat__tablet { animation: feat-in-left .7s cubic-bezier(.2, .7, .2, 1) .15s both; }
  .motion-ok .feat.is-turned .is-active .feat__phone { animation: feat-in-right .7s cubic-bezier(.2, .7, .2, 1) .3s both; }

  /* wall: the columns drift (up, down, up) and stop while the pointer is on the wall */
  .motion-ok .wall__track { animation: wall-drift 38s linear infinite; }
  .motion-ok .wall__col:nth-child(2) .wall__track { animation-direction: reverse; animation-duration: 44s; }
  .wall:hover .wall__track, .wall:focus-within .wall__track { animation-play-state: paused; }
}

@keyframes feat-browse {   /* a moment at the top, down to the bottom of the page, a moment there */
  0%, 12% { transform: none; }
  88%, 100% { transform: translateY(min(0px, calc(-100% + 100cqh))); }
}
@keyframes feat-rush {
  0%, 8% { transform: none; }
  92%, 100% { transform: translateY(min(0px, calc(-100% + 100cqh))); }
}
@keyframes feat-in-up { from { opacity: 0; transform: translateY(8%); } }
@keyframes feat-in-left { from { opacity: 0; transform: translateX(-30%); } }
@keyframes feat-in-right { from { opacity: 0; transform: translateX(30%); } }
@keyframes wall-drift { to { transform: translateY(-33.333%); } }


/* 4. Responsive ---------------------------------------------------------------- */
@media (max-width: 1023px) {
  .feat__slide { grid-template-columns: 1fr; gap: 26px; }
  .wallsec { --wave: none; }
  .wallsec__grid { grid-template-columns: 1fr; gap: 0; }
  .wallsec__copy { padding: var(--section-y) 0 8px; }
  .wall { height: 460px; }
}

/* phones: two columns on the wall */
@media (max-width: 640px) {
  .wall { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; height: 420px; }
  .wall__track { gap: 12px; padding-bottom: 12px; }
  .wall__col:nth-child(3) { display: none; }
  .wall__bar b { display: none; }
  .feat__cap { font-size: 15px; }
}
