/* ==========================================================================
   Homepage: Application Scenarios + Laser Accessories & Parts
   Created 2026-11-11. Rebuilt 2026-11-11 (v2):
     - Application card text block now reserves a fixed 2-line title + 1-line
       subtitle so the "Learn more" pill always sits 16px below the copy and on
       the same baseline in every card.
     - Media box auto-flips 4:3 <-> 3:4 depending on the covers in use
       (.app-rail--portrait is emitted by home-solutions.php).
     - Accessories switched from a 7-up grid to a 5-up horizontal rail with
       reference-sized 244px tiles, arrow buttons and edge fades.
   Loaded only on the front page (functions.php -> is_front_page()).
   ASCII only - no smart quotes, no CJK.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Application Scenarios - compact card rail
   Desktop: 5 cards per row (card ~258px at a 1368px container, close to the
   248px Cloudray reference). 8 solutions wrap to 5 + 3 with the last row
   centred, so there is never a lopsided gap on the right.
   -------------------------------------------------------------------------- */
.app-rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}

.app-card {
  flex: 0 1 calc(20% - 16px);
  max-width: calc(20% - 16px);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform .35s cubic-bezier(.165, .84, .44, 1);
}
.app-card:hover {
  transform: translateY(-4px);
}

.app-card__media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-gray-100, #F1F4F7);
  /* Hairline ring keeps white-background posters from dissolving into the page. */
  box-shadow: inset 0 0 0 1px rgba(16, 32, 48, .06);
}
/* All covers are portrait -> the whole rail becomes a 3:4 rail. */
.app-rail--portrait .app-card__media {
  aspect-ratio: 3 / 4;
}

.app-card__media img,
.app-card__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* One card whose cover/video disagrees with the rest of the rail: show the
   whole frame instead of cropping the machine out of it. */
.app-card--fit .app-card__media img,
.app-card--fit .app-card__video {
  object-fit: contain;
}

.app-card__media img {
  transition: transform .55s cubic-bezier(.165, .84, .44, 1);
}
.app-card:hover .app-card__media img {
  transform: scale(1.04);
}
/* Video sits on top of the poster but only becomes visible on hover. */
.app-card__video {
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
}
.app-card:hover .app-card__video {
  opacity: 1;
}
.app-card__placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #E9EFF5 0%, #DCE6EF 100%);
}

.app-card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding-top: 14px;
}

/* Fixed-height copy block: 2 title lines + 1 subtitle line, in every card.
   That is what makes the 16px gap below it identical across the rail. */
.app-card__text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.app-card__title {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--color-gray-900, #131820);
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-card__sub {
  font-size: 12.5px;
  line-height: 1.4;
  min-height: 1.4em;
  color: var(--color-gray-500, #6F7A8A);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 16px;
  padding: 9px 14px;
  border: 1px solid var(--color-border, #DEE3E9);
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--color-gray-900, #131820);
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
.app-card__cta svg {
  flex: 0 0 auto;
  transition: transform .25s ease;
}
.app-card:hover .app-card__cta {
  background: var(--color-primary, #0095DA);
  border-color: var(--color-primary, #0095DA);
  color: #fff;
}
.app-card:hover .app-card__cta svg {
  transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   2. Laser Accessories & Parts - 5-up horizontal rail
   Tiles are reference-sized (244px cap) and exactly five fit the container;
   the remaining categories sit to the right and are reached by swipe,
   trackpad, shift+wheel or the arrow buttons. No second row.
   -------------------------------------------------------------------------- */
.acc-slider {
  --acc-gap: 20px;
  --acc-nav-top: 50%;
  --acc-media-top: 6px;
  --acc-media-h: 244px;
  position: relative;
}

.acc-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(180px, calc((100% - 4 * var(--acc-gap)) / 5), 244px);
  gap: var(--acc-gap);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  /* Room for the hover lift + shadow so they are not clipped. */
  padding: 6px 2px 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.acc-rail::-webkit-scrollbar {
  display: none;
}

.acc-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
}

.acc-cat__media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 10%;
  background: #fff;
  border: 1px solid #EDF1F5;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .3s ease, box-shadow .3s ease, transform .3s ease;
}
.acc-cat__media img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform .4s ease;
}
.acc-cat:hover .acc-cat__media {
  border-color: var(--color-primary, #0095DA);
  box-shadow: 0 12px 28px rgba(15, 32, 48, .10);
  transform: translateY(-4px);
}
.acc-cat:hover .acc-cat__media img {
  transform: scale(1.06);
}
.acc-cat__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #B6C2CE;
}
.acc-cat__name {
  margin-top: 14px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  color: var(--color-gray-900, #131820);
  transition: color .25s ease;
}
.acc-cat:hover .acc-cat__name {
  color: var(--color-primary, #0095DA);
}
.acc-cat__count {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.3;
  color: var(--color-gray-500, #6F7A8A);
}

/* Edge fades: only shown on the side that still hides content. */
.acc-slider::before,
.acc-slider::after {
  content: "";
  position: absolute;
  top: var(--acc-media-top);
  height: var(--acc-media-h);
  width: 34px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.acc-slider::before {
  left: 0;
  background: linear-gradient(to right, #F7F9FB 12%, rgba(247, 249, 251, 0));
}
.acc-slider::after {
  right: 0;
  background: linear-gradient(to left, #F7F9FB 12%, rgba(247, 249, 251, 0));
}
.acc-slider:not(.is-start):not(.is-static)::before { opacity: 1; }
.acc-slider:not(.is-end):not(.is-static)::after { opacity: 1; }

/* Arrow buttons - pointer devices only, and only while there is overflow. */
.acc-nav {
  position: absolute;
  top: var(--acc-nav-top);
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #E3E8EE;
  border-radius: 50%;
  background: #fff;
  color: var(--color-gray-900, #131820);
  box-shadow: 0 6px 18px rgba(15, 32, 48, .12);
  cursor: pointer;
  z-index: 3;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, opacity .2s ease;
}
.acc-nav:hover {
  background: var(--color-primary, #0095DA);
  border-color: var(--color-primary, #0095DA);
  color: #fff;
}
.acc-nav:focus-visible {
  outline: 2px solid var(--color-primary, #0095DA);
  outline-offset: 2px;
}
.acc-nav[disabled] {
  opacity: 0;
  pointer-events: none;
}
/* Sit 10px inside the rail edge so they never collide with the floating
   contact widget in the page's right margin. */
.acc-nav--prev { left: 10px; }
.acc-nav--next { right: 10px; }

@media (hover: hover) and (min-width: 900px) {
  .acc-nav { display: flex; }
  .acc-slider.is-static .acc-nav { display: none; }
}

.acc-rail__footer {
  text-align: center;
  margin-top: 40px;
}
/* Ghost pill, same language as the application card CTA */
.acc-rail__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 26px;
  border: 1px solid var(--color-border, #DEE3E9);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--color-gray-900, #131820);
  text-decoration: none;
  transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}
.acc-rail__link:hover {
  background: var(--color-primary, #0095DA);
  border-color: var(--color-primary, #0095DA);
  color: #fff;
}

/* --------------------------------------------------------------------------
   3. Responsive
   App rail: 5 -> 4 (<=1023) -> 3 (<=767) -> 2 (<=559).
   Acc rail keeps its fixed tile rhythm and simply reveals fewer tiles at once.
   -------------------------------------------------------------------------- */
@media (max-width: 1023.98px) {
  .app-card {
    flex-basis: calc(25% - 15px);
    max-width: calc(25% - 15px);
  }
}

@media (max-width: 899.98px) {
  .app-rail { gap: 16px; }
  .app-card {
    flex-basis: calc(25% - 12px);
    max-width: calc(25% - 12px);
  }
  .app-card__title { font-size: 14px; }
  .acc-slider { --acc-gap: 14px; }
  .acc-cat__name { font-size: 16px; margin-top: 12px; }
  .acc-cat__count { font-size: 13px; }
}

@media (max-width: 767.98px) {
  .app-rail { gap: 14px; }
  .app-card {
    flex-basis: calc(33.3333% - 9.4px);
    max-width: calc(33.3333% - 9.4px);
  }
  .app-card__body { padding-top: 12px; }
  .app-card__text { gap: 4px; }
  .app-card__title { font-size: 13.5px; }
  .app-card__sub { font-size: 12px; }
  .app-card__cta { margin-top: 12px; }

  .acc-rail {
    /* 3 up plus a sliver of the 4th as a swipe hint */
    grid-auto-columns: clamp(140px, calc((100% - 2 * var(--acc-gap)) / 3.25), 200px);
  }
  .acc-cat__name { font-size: 15px; }
  .acc-cat__count { font-size: 12.5px; }
  .acc-rail__footer { margin-top: 26px; }
}

@media (max-width: 559.98px) {
  .app-rail { gap: 12px 10px; }
  .app-card {
    flex-basis: calc(50% - 5px);
    max-width: calc(50% - 5px);
  }
  .app-card__media { border-radius: 8px; }
  .app-card__body { padding-top: 10px; }
  .app-card__title { font-size: 13px; }
  .app-card__sub { font-size: 11.5px; }
  .app-card__cta { margin-top: 11px; padding: 8px 8px; font-size: 12px; gap: 4px; }
  .app-card__cta svg { width: 11px; height: 11px; }

  .acc-slider { --acc-gap: 12px; }
  .acc-rail {
    /* 2 up plus a sliver of the 3rd */
    grid-auto-columns: clamp(124px, calc((100% - 2 * var(--acc-gap)) / 2.3), 190px);
    padding-bottom: 10px;
  }
  .acc-cat__media { border-radius: 10px; padding: 9%; }
  .acc-cat__name { font-size: 14px; margin-top: 10px; }
  .acc-cat__count { font-size: 12px; }
}
