/*
 * B2B Success Story templates
 *
 * Loaded for:
 * - template-b2b-customer-story.php
 * - template-b2b-customer-story-index.php
 *
 * File structure:
 * 1. Shared design tokens used across both templates.
 * 2. Single customer story page styles.
 * 3. Single customer story page responsive overrides.
 * 4. Customer story index page styles.
 * 5. Customer story index page responsive overrides.
 */

/* ==========================================================================
   Shared Design Tokens
   ========================================================================== */

:root {
  --b2b-story-color-brand: #1b1750;
  --b2b-story-color-copy: #302c5f;
  --b2b-story-color-copy-muted: #6b6696;
  --b2b-story-color-surface: #fff;
  --b2b-story-color-surface-muted: #f5f4f8;
  --b2b-story-color-border: #e4e0eb;
  --b2b-story-color-border-strong: #d7d4e2;
  --b2b-story-color-border-muted: #dddce5;
  --b2b-story-color-border-subtle: #ece9f5;
  --b2b-story-color-control: #8e8aad;
  --b2b-story-focus-ring: rgba(27, 23, 80, 0.12);
  --b2b-story-radius-card: 4px;
  --b2b-story-radius-panel: 8px;
  --b2b-story-radius-media: 12px;
  --b2b-story-radius-image: 18px;
  --b2b-story-radius-pill: 999px;
  --b2b-story-transition-fast: 0.2s ease;
}

/* ==========================================================================
   Single Customer Story Page
   Template: template-b2b-customer-story.php
   ========================================================================== */

/* Page shell, header, and hero */

.b2b-customer-story-page {
  padding: 56px 0 96px;
}

.b2b-customer-story-header {
  margin-bottom: 18px;
}

.b2b-customer-story-header h1 {
  text-align: left;
}

.b2b-customer-story-hero {
  align-items: start;
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, 1.85fr) minmax(300px, 332px);
}

.b2b-customer-story-hero--single {
  grid-template-columns: minmax(0, 1fr);
}

.b2b-customer-story-main {
  min-width: 0;
}

.b2b-customer-story-image {
  margin: 140px 0 64px;
}

.b2b-customer-story-image .ch-gradient {
  border-radius: var(--b2b-story-radius-media);
  height: 528px;
  padding: 0 40px 40px;
}

.b2b-customer-story-image .article-image {
  height: 100%;
  overflow: visible;
  position: relative;
  width: 100%;
}

/*
 * The hero image intentionally hangs below the gradient frame to echo
 * the blog hero treatment used elsewhere on the site.
 */
.b2b-customer-story-image .hero-img {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  bottom: 0;
  height: 115%;
  position: absolute;
  width: 100%;
}

.b2b-customer-story-summary {
  margin-bottom: 30px;
  max-width: 820px;
}

.b2b-customer-story-summary-copy {
  color: var(--b2b-story-color-copy);
  font-size: 1.08rem;
  line-height: 1.4;
  margin-bottom: 0;
}

.b2b-customer-story-summary-copy p:last-child {
  margin-bottom: 0;
}

/* Social share treatment inside the hero image */

.b2b-customer-story-image .ch-blog-social {
  display: flex !important;
  justify-content: center;
  left: 0;
  margin: 0 auto;
  position: absolute;
  top: -20%;
  transform: none;
  width: 100%;
  z-index: 20;
}

.b2b-customer-story-social-link {
  align-items: center;
  background: var(--b2b-story-color-brand);
  border-radius: 50%;
  box-shadow: none;
  color: var(--b2b-story-color-surface) !important;
  display: flex !important;
  height: 48px;
  justify-content: center;
  margin: 0 12px;
  text-decoration: none !important;
  width: 48px;
}

.b2b-customer-story-social-link:hover,
.b2b-customer-story-social-link:focus {
  color: var(--b2b-story-color-surface) !important;
  opacity: 0.92;
  text-decoration: none !important;
}

.b2b-customer-story-social-link i {
  color: var(--b2b-story-color-surface);
  font-size: 20px;
  line-height: 1;
}

/* Summary card shown beside the hero */

.b2b-customer-story-sidebar {
  align-self: start;
  justify-self: end;
  padding-top: 18px;
  position: relative;
  width: 100%;
}

.b2b-customer-story-card {
  background: var(--b2b-story-color-surface-muted);
  border: 1px solid var(--b2b-story-color-border);
  border-radius: var(--b2b-story-radius-card);
  box-shadow: none;
  margin-left: auto;
  max-width: 332px;
  padding: 24px 24px 26px;
  position: static;
}

.b2b-customer-story-card-brand-mark {
  text-align: center;
}

.b2b-customer-story-card-item + .b2b-customer-story-card-item {
  border-top: 1px solid var(--b2b-story-color-border-subtle);
  margin-top: 20px;
  padding-top: 22px;
}

.b2b-customer-story-card-label {
  color: var(--b2b-story-color-brand);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.b2b-customer-story-card-value {
  color: var(--b2b-story-color-copy);
  font-size: 1rem;
  line-height: 1.35;
  margin: 0;
  white-space: pre-line;
}

.b2b-customer-story-card-cta {
  margin-top: 30px;
}

.b2b-customer-story-card-button {
  background: var(--b2b-story-color-brand);
  border-radius: var(--b2b-story-radius-card);
  color: var(--b2b-story-color-surface);
  display: block;
  font-size: 1rem;
  font-weight: 700;
  padding: 15px 16px;
  text-align: center;
  text-decoration: none;
  transition:
    opacity var(--b2b-story-transition-fast),
    transform var(--b2b-story-transition-fast);
}

.b2b-customer-story-card-button:hover,
.b2b-customer-story-card-button:focus {
  color: var(--b2b-story-color-surface);
  opacity: 0.92;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Main article body and optional sticky sidebar */

.b2b-customer-story-content {
  align-items: start;
}

.b2b-customer-story-content--with-sidebar {
  align-items: flex-start;
  display: flex;
  gap: 64px;
}

.b2b-customer-story-page
  .b2b-customer-story-content--with-sidebar
  .b2b-customer-story-body.article-body {
  flex: 1 1 0;
  margin: 0;
  max-width: none;
  min-width: 0;
}

.b2b-customer-story-body-sidebar {
  align-self: start;
  flex: 0 0 304px;
  position: sticky;
  top: 32px;
}

.b2b-customer-story-body-sidebar-card {
  background: var(--b2b-story-color-surface);
  border: 1px solid var(--b2b-story-color-border-strong);
  border-radius: var(--b2b-story-radius-panel);
  padding: 28px 24px 22px;
  position: static;
}

.b2b-customer-story-body-sidebar-title {
  color: var(--b2b-story-color-brand);
  font-size: 33px !important;
  line-height: 1.12;
  margin: 0 0 20px;
}

.b2b-customer-story-body-sidebar-items {
  border-top: 1px solid var(--b2b-story-color-border-muted);
  padding-top: 22px;
}

.b2b-customer-story-body-sidebar-item {
  color: var(--b2b-story-color-brand);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.25;
  margin: 0 0 18px;
}

.b2b-customer-story-body-sidebar-item p,
.b2b-customer-story-body-sidebar-item ul,
.b2b-customer-story-body-sidebar-item ol {
  margin: 0;
}

.b2b-customer-story-body-sidebar-item a {
  color: var(--b2b-story-color-brand);
  text-decoration: none;
  transition:
    color var(--b2b-story-transition-fast),
    font-weight var(--b2b-story-transition-fast);
}

.b2b-customer-story-body-sidebar-item a:hover {
  text-decoration: underline;
}

.b2b-customer-story-body-sidebar-item.is-active,
.b2b-customer-story-body-sidebar-item.is-active a,
.b2b-customer-story-body-sidebar-item a[aria-current="true"] {
  font-weight: 700;
}

.b2b-customer-story-body-sidebar-item:last-child {
  margin-bottom: 0;
}

.b2b-customer-story-body-sidebar-button {
  display: block;
  margin-top: 32px;
  text-align: center;
  width: 100%;
}

/* Article typography and embedded editor content */

.b2b-customer-story-body {
  color: var(--b2b-story-color-copy);
  font-size: 16px;
  line-height: 1.75;
  margin: 0 auto;
  max-width: 760px;
}

.b2b-customer-story-body h2,
.b2b-customer-story-body h3,
.b2b-customer-story-body h4 {
  color: var(--b2b-story-color-brand);
  margin: 40px 0 16px;
}

.b2b-customer-story-body h2[id] {
  scroll-margin-top: 48px;
}

.b2b-customer-story-body p,
.b2b-customer-story-body ul,
.b2b-customer-story-body ol,
.b2b-customer-story-body blockquote {
  margin-bottom: 20px;
}

.b2b-customer-story-body a {
  color: var(--b2b-story-color-brand);
  font-weight: 700;
  text-decoration: underline;
}

.b2b-customer-story-body ul,
.b2b-customer-story-body ol {
  padding-left: 24px;
}

.b2b-customer-story-body li + li {
  margin-top: 8px;
}

.b2b-customer-story-body .wp-block-image,
.b2b-customer-story-body figure {
  margin: 40px 0 24px;
}

.b2b-customer-story-body img {
  border-radius: var(--b2b-story-radius-image);
  display: block;
  height: auto;
  max-width: 100%;
}

.b2b-customer-story-body figcaption,
.b2b-customer-story-body .wp-caption-text {
  color: var(--b2b-story-color-copy-muted);
  font-size: 14px;
  margin-top: 12px;
}

.b2b-customer-story-body .wp-block-columns {
  gap: 32px;
  margin: 40px 0;
}

.b2b-customer-story-body blockquote {
  border-left: 4px solid var(--b2b-story-color-copy-muted);
  font-style: italic;
  margin-left: 0;
  padding-left: 20px;
}

.b2b-customer-story-body > *:last-child {
  margin-bottom: 0;
}

/* CTA and related stories */

.b2b-customer-story-cta {
  margin-top: 88px;
}

/*
 * Related stories reuse shared blog card components. These rules only handle
 * the spacing adjustments unique to the B2B customer story template.
 */
.b2b-customer-story-related {
  margin-top: 72px;
}

.b2b-customer-story-related h2 {
  margin-bottom: 28px;
}

.b2b-customer-story-related .article-info h3 {
  margin-top: 0;
}

/* ==========================================================================
   Single Customer Story Page Responsive Overrides
   ========================================================================== */

@media (max-width: 991px) {
  .b2b-customer-story-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .b2b-customer-story-content--with-sidebar {
    align-items: stretch;
    flex-direction: column;
    gap: 32px;
  }

  .b2b-customer-story-image {
    margin: 90px auto 64px;
  }

  .b2b-customer-story-image .ch-gradient {
    height: 258px;
    margin: 0 auto;
    max-width: 612px;
    padding: 0 20px 20px;
  }

  .b2b-customer-story-image .ch-blog-social {
    top: -60px;
  }

  .b2b-customer-story-sidebar {
    justify-self: start;
    max-width: 420px;
    padding-top: 0;
  }

  .b2b-customer-story-card {
    position: static;
  }

  .b2b-customer-story-body-sidebar {
    flex-basis: auto;
    position: static;
    top: auto;
    width: 100%;
  }

  .b2b-customer-story-body-sidebar-card {
    position: static;
  }

}

@media (max-width: 767px) {
  .b2b-customer-story-page {
    padding: 32px 0 72px;
  }

  .b2b-customer-story-header,
  .b2b-customer-story-body {
    max-width: none;
  }

  .b2b-customer-story-hero {
    gap: 24px;
    margin-bottom: 56px;
  }

  .b2b-customer-story-summary {
    margin-bottom: 22px;
  }

  .b2b-customer-story-body-sidebar-title {
    font-size: 2rem;
  }

}

@media (max-width: 480px) {
  .b2b-customer-story-image {
    margin: 64px auto 40px;
  }

  .b2b-customer-story-image .ch-gradient {
    height: 152px;
    margin: 0 auto;
    padding: 0 12px 12px;
  }

  .b2b-customer-story-image .ch-blog-social {
    top: -44px;
  }
}

/* ==========================================================================
   Customer Story Index Page
   Template: template-b2b-customer-story-index.php
   ========================================================================== */

/*
 * The shared React header bundle uses width utilities such as `w-screen`
 * (`width: 100vw`). Clamp the mount on both story templates so the header
 * cannot introduce horizontal overflow when a vertical scrollbar is present.
 */
body.page-template-template-b2b-customer-story,
body.page-template-template-b2b-customer-story-index {
  overflow-x: clip;
}

body.page-template-template-b2b-customer-story header#navbar,
body.page-template-template-b2b-customer-story-index header#navbar {
  max-width: 100%;
  overflow-x: clip;
}

body.page-template-template-b2b-customer-story header#navbar #ch-header-mount,
body.page-template-template-b2b-customer-story header#navbar #ch-header-mount > *,
body.page-template-template-b2b-customer-story-index header#navbar #ch-header-mount,
body.page-template-template-b2b-customer-story-index header#navbar #ch-header-mount > * {
  max-width: 100%;
}

body.page-template-template-b2b-customer-story header#navbar #ch-header-mount .w-screen,
body.page-template-template-b2b-customer-story-index header#navbar #ch-header-mount .w-screen {
  max-width: 100% !important;
  width: 100% !important;
}

/* Featured story block and intro */

/*
 * The featured-story content uses the editable `.b2b-success-lp-sxs*` markup
 * from the page builder/content area. This file only manages the spacing that
 * surrounds that block inside the index template.
 */
.b2b-customer-story-index-featured {
  margin-bottom: 56px;
}

.b2b-customer-story-index-hero {
  margin-bottom: 48px;
}

.b2b-customer-story-index-header {
  margin-bottom: 32px;
}

.b2b-customer-story-index-header h1 {
  text-align: left;
}

.b2b-customer-story-index-intro {
  color: var(--b2b-story-color-copy);
  margin-top: 18px;
  max-width: 860px;
}

.b2b-customer-story-index-intro > *:last-child {
  margin-bottom: 0;
}

/* Search and sector filters */

.b2b-customer-story-index-filter-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 20px 24px;
  margin-bottom: 40px;
}

.b2b-customer-story-index-search {
  flex: 1 1 420px;
  max-width: 540px;
  position: relative;
}

.b2b-customer-story-index-search-input,
.b2b-customer-story-index-select {
  background: var(--b2b-story-color-surface);
  border: 1px solid var(--b2b-story-color-control);
  border-radius: var(--b2b-story-radius-pill);
  color: var(--b2b-story-color-copy);
  font-size: 16px;
  height: 52px;
  transition:
    border-color var(--b2b-story-transition-fast),
    box-shadow var(--b2b-story-transition-fast);
  width: 100%;
}

.b2b-customer-story-index-search-input {
  padding: 0 56px 0 18px;
}

.b2b-customer-story-index-search-input:focus,
.b2b-customer-story-index-select:focus {
  border-color: var(--b2b-story-color-brand);
  box-shadow: 0 0 0 3px var(--b2b-story-focus-ring);
  outline: none;
}

/*
 * Reset shared button styles so the search submit control displays only
 * the icon without inheriting a filled button treatment.
 */
.b2b-customer-story-index-search-button {
  align-items: center;
  background: unset !important;
  border: 0;
  color: var(--b2b-story-color-brand);
  display: flex;
  height: 52px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 14px;
  top: 0;
  width: 32px;
}

.b2b-customer-story-index-select-wrap {
  min-width: 280px;
  position: relative;
}

.b2b-customer-story-index-select {
  appearance: none;
  padding: 0 52px 0 18px;
}

.b2b-customer-story-index-select-icon {
  align-items: center;
  color: var(--b2b-story-color-brand);
  display: flex;
  height: 52px;
  pointer-events: none;
  position: absolute;
  right: 18px;
  top: 0;
}

.b2b-customer-story-index-reset {
  color: var(--b2b-story-color-brand);
  font-weight: 700;
  text-decoration: underline;
}

/* Results grid and cards */

.b2b-customer-story-index-results {
  scroll-margin-top: 32px;
}

/*
 * Flexbox is used here intentionally instead of CSS grid so desktop cards
 * can stay wider and closer to the original creative reference.
 */
.b2b-customer-story-index-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 48px 24px;
  margin-bottom: 12px;
}

.b2b-customer-story-index-item {
  box-sizing: border-box;
  flex: 0 0 calc((100% - 48px) / 3);
  margin: 0 !important;
  max-width: calc((100% - 48px) / 3);
  width: calc((100% - 48px) / 3);
}

.b2b-customer-story-index-item > a {
  display: block;
}

.b2b-customer-story-index-item .article-info h2 {
  margin-top: 0;
}

.b2b-customer-story-index-item .article-info p:last-child {
  margin-bottom: 0;
}

/* Empty state, pagination, and injected content area */

.b2b-customer-story-index-empty {
  background: var(--b2b-story-color-surface-muted);
  border: 1px solid var(--b2b-story-color-border);
  border-radius: var(--b2b-story-radius-media);
  color: var(--b2b-story-color-copy);
  margin: 0 auto;
  max-width: 720px;
  padding: 40px 32px;
  text-align: center;
}

.b2b-customer-story-index-empty-title {
  color: var(--b2b-story-color-brand);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.b2b-customer-story-index-empty .btn-secondary {
  margin-top: 12px;
}

.b2b-customer-story-index-pagination {
  margin-top: 18px;
}

/*
 * The below-cards wrapper intentionally stays neutral so editors can inject
 * raw HTML or shortcodes that control their own internal layout and spacing.
 */
.b2b-customer-story-index-below-cards {
  margin: 0;
  padding: 0;
  width: 100%;
}

.b2b-customer-story-index-below-cards > *:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Customer Story Index Page Responsive Overrides
   ========================================================================== */

@media (max-width: 991px) {
  .b2b-customer-story-index-search {
    flex-basis: 100%;
    max-width: none;
  }

  .b2b-customer-story-index-featured {
    margin-bottom: 48px;
  }

  .b2b-customer-story-index-item {
    flex-basis: calc((100% - 24px) / 2);
    max-width: calc((100% - 24px) / 2);
    width: calc((100% - 24px) / 2);
  }
}

@media (max-width: 767px) {
  .b2b-customer-story-index-page {
    padding: 32px 0 72px;
  }

  .b2b-customer-story-index-hero {
    margin-bottom: 32px;
  }

  .b2b-customer-story-index-header {
    margin-bottom: 24px;
  }

  .b2b-customer-story-index-filter-form {
    align-items: stretch;
    gap: 16px;
    margin-bottom: 28px;
  }

  .b2b-customer-story-index-search,
  .b2b-customer-story-index-select-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .b2b-customer-story-index-empty {
    padding: 32px 20px;
  }

  .b2b-customer-story-index-grid {
    gap: 32px;
  }

  .b2b-customer-story-index-item {
    flex-basis: 100%;
    max-width: 100%;
    width: 100%;
  }

  .b2b-customer-story-index-below-cards {
    margin-top: 40px;
  }
}
