/*------------------------------------------------------------------------------
  Customer Stories
  Editorial case-study cards built on the Geist tokens declared in
  geist-4geeks.css. The first story is treated as the hero; the remaining
  stories sit underneath in a compact grid.
------------------------------------------------------------------------------*/

.customer-stories {
  --cs-text: var(--text, #000000);
  --cs-muted: var(--subtext, #666666);
  --cs-border: var(--border, #eaeaea);
  --cs-border-hover: var(--border-hover, #000000);
  --cs-accent: var(--accent, #ff2a42);
  --cs-canvas: var(--canvas, #ffffff);
  --cs-radius: var(--radius, 8px);
  --cs-font-mono: var(--font-mono, "Geist Mono", monospace);
  color: var(--cs-text);
  font-family: inherit;
}

/* --------------------------------------------------------------------------
   Grid: 1 column on phones, 2 columns from tablet up. With three stories the
   first card spans the full row; with two stories both cards share the row.
   With four stories the remainder forms a three-up row under the hero.
   -------------------------------------------------------------------------- */
.customer-stories__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.customer-stories__card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  color: var(--cs-text);
  background-color: var(--cs-canvas);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius);
  transition: transform 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.customer-stories__card:hover {
  transform: translateY(-2px);
  border-color: var(--cs-border-hover);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.07);
}

.customer-stories__card--featured {
  color: #ffffff;
  background-color: #000000;
  border-color: #000000;
}

.customer-stories__card--featured::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  height: 3px;
  background-color: var(--cs-accent);
  pointer-events: none;
}

.customer-stories__card--featured:hover {
  border-color: #000000;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

/* --------------------------------------------------------------------------
   Stretched link: the whole card is clickable, but only one link is exposed
   to assistive technology and keyboard navigation.
   -------------------------------------------------------------------------- */
.customer-stories__hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  color: inherit;
  text-decoration: none;
}

.customer-stories__hit:focus-visible {
  outline: none;
}

.customer-stories__card:focus-within {
  outline: 2px solid var(--cs-accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Logo panel
   The Ghost feature images are client logos on a white background, so they
   are contained (never cropped) and multiplied over the light panel. This
   makes the white image background disappear into the panel texture.
   -------------------------------------------------------------------------- */
.customer-stories__media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  padding: 1.25rem;
  overflow: hidden;
  background-color: #f6f6f6;
  background-image: radial-gradient(rgba(0, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 14px 14px;
}

.customer-stories__card:not(.customer-stories__card--featured) .customer-stories__media {
  border-bottom: 1px solid var(--cs-border);
}

.customer-stories__card--featured .customer-stories__media {
  height: 220px;
  padding: clamp(2rem, 4vw, 3.5rem);
  border-bottom: 1px solid #222222;
}

.customer-stories__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform 0.35s ease;
}

.customer-stories__card:hover .customer-stories__media img {
  transform: scale(1.035);
}

/* The featured panel is much wider, so the logo needs a little more presence. */
.customer-stories__card--featured .customer-stories__media img {
  transform: scale(1.15);
}

.customer-stories__card--featured:hover .customer-stories__media img {
  transform: scale(1.2);
}

/* Logos arrive as 16:9 files with generous white margins. Scale the
   secondary panels up so the brand mark stays legible without cropping it. */
.customer-stories__card:not(.customer-stories__card--featured) .customer-stories__media img {
  transform: scale(1.45);
}

.customer-stories__card:not(.customer-stories__card--featured):hover .customer-stories__media img {
  transform: scale(1.5);
}

.customer-stories__fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #9ca3af;
  font-size: 2rem;
}

/* --------------------------------------------------------------------------
   Copy
   -------------------------------------------------------------------------- */
.customer-stories__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding: 1.25rem;
}

.customer-stories__card--featured .customer-stories__body {
  padding: clamp(1.5rem, 3vw, 2.75rem);
}

.customer-stories__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
  color: var(--cs-muted);
  font-family: var(--cs-font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
}

.customer-stories__client {
  color: var(--cs-text);
}

.customer-stories__dot {
  width: 3px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.5;
}

.customer-stories__card--featured .customer-stories__meta {
  color: #a1a1aa;
}

.customer-stories__card--featured .customer-stories__client {
  color: #ffffff;
}

.customer-stories__title {
  display: -webkit-box;
  margin: 0 0 0.75rem;
  overflow: hidden;
  color: var(--cs-text);
  font-size: clamp(1rem, 1.2vw, 1.125rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.customer-stories__card--featured .customer-stories__title {
  margin-bottom: 1rem;
  color: #ffffff;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  letter-spacing: -0.035em;
  line-height: 1.08;
  -webkit-line-clamp: 4;
}

.customer-stories__excerpt {
  display: -webkit-box;
  margin: 0 0 1.25rem;
  overflow: hidden;
  color: var(--cs-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.customer-stories__card--featured .customer-stories__excerpt {
  margin-bottom: 1.5rem;
  color: #a1a1aa;
  font-size: clamp(0.9375rem, 1.1vw, 1.0625rem);
  line-height: 1.65;
  -webkit-line-clamp: 4;
}

.customer-stories__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  color: var(--cs-text);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.customer-stories__cta i {
  color: var(--cs-accent);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.customer-stories__card:hover .customer-stories__cta i {
  transform: translateX(4px);
}

.customer-stories__card--featured .customer-stories__cta {
  margin-top: 1.5rem;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Footer link
   -------------------------------------------------------------------------- */
.customer-stories__more {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--cs-border);
}

.customer-stories__more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--cs-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}

.customer-stories__more-link i {
  color: var(--cs-accent);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.customer-stories__more-link:hover {
  color: var(--cs-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.customer-stories__more-link:hover i {
  transform: translateX(4px);
}

.customer-stories__more-link:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Responsive layout
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
  .customer-stories__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .customer-stories__card:not(.customer-stories__card--featured) .customer-stories__media {
    height: 160px;
  }

  .customer-stories__grid--1 > .customer-stories__card--featured,
  .customer-stories__grid--3 > .customer-stories__card--featured {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  }

  .customer-stories__grid--1 > .customer-stories__card--featured .customer-stories__media,
  .customer-stories__grid--3 > .customer-stories__card--featured .customer-stories__media {
    height: 100%;
    min-height: 320px;
    border-bottom: 0;
  }

  .customer-stories__grid--2 > .customer-stories__card--featured .customer-stories__media {
    height: 190px;
  }

  /* With only two stories, both cards share the row. Keep the featured
     card's typography in line with its neighbour so the grid does not
     stretch one card into a tall empty column. */
  .customer-stories__grid--2 > .customer-stories__card--featured .customer-stories__title {
    font-size: clamp(1rem, 1.2vw, 1.125rem);
    letter-spacing: -0.025em;
    line-height: 1.25;
    -webkit-line-clamp: 3;
  }

  .customer-stories__grid--2 > .customer-stories__card--featured .customer-stories__excerpt {
    font-size: 0.875rem;
    line-height: 1.6;
    -webkit-line-clamp: 2;
  }

  .customer-stories__grid--2 > .customer-stories__card--featured .customer-stories__cta {
    margin-top: auto;
  }

  /* Four stories: one hero across the top. On tablets the third secondary
     card spans the row; from 992px the three cards form a single row. */
  .customer-stories__grid--4 > .customer-stories__card--featured {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  }

  .customer-stories__grid--4 > .customer-stories__card--featured .customer-stories__media {
    height: 100%;
    min-height: 320px;
    border-bottom: 0;
  }

  .customer-stories__grid--4 > .customer-stories__card--featured .customer-stories__body {
    justify-content: center;
  }

  .customer-stories__grid--1 > .customer-stories__card--featured .customer-stories__body,
  .customer-stories__grid--3 > .customer-stories__card--featured .customer-stories__body {
    justify-content: center;
  }
}

@media (min-width: 768px) and (max-width: 1199.98px) {
  .customer-stories__grid--4 > .customer-stories__card:nth-child(4) {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  }

  .customer-stories__grid--4 > .customer-stories__card:nth-child(4) .customer-stories__media {
    height: 100%;
    min-height: 200px;
    border-bottom: 0;
  }
}

@media (min-width: 1200px) {
  .customer-stories__grid {
    gap: 1.5rem;
  }

  .customer-stories__grid--4 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customer-stories__card:not(.customer-stories__card--featured) .customer-stories__media {
    height: 180px;
  }

  .customer-stories__grid--1 > .customer-stories__card--featured,
  .customer-stories__grid--3 > .customer-stories__card--featured {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }

  .customer-stories__grid--4 > .customer-stories__card--featured {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }
}

@media (max-width: 767.98px) {
  .customer-stories__more {
    justify-content: flex-start;
  }
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .customer-stories__card,
  .customer-stories__media img,
  .customer-stories__cta i,
  .customer-stories__more-link i {
    transition: none;
  }

  .customer-stories__card:hover {
    transform: none;
  }

  .customer-stories__card--featured:hover .customer-stories__media img {
    transform: scale(1.15);
  }

  .customer-stories__card:not(.customer-stories__card--featured):hover .customer-stories__media img {
    transform: scale(1.45);
  }

  .customer-stories__cta i,
  .customer-stories__more-link i {
    transform: none !important;
  }

  .customer-stories [data-aos] {
    opacity: 1 !important;
    transform: none !important;
  }
}
