/* Developer Handoff:
   File: css/pages/features.css
   Role: page-specific-styles
   Runtime: served-to-browser
   Maintainer Notes: Keep selectors aligned with markup and avoid redefining global tokens outside base/variables.css.
*/
/* =============================================
   FEATURES PAGE
   ============================================= */

/* Active link colors for Features page */
.navbar-custom:not(.scrolled) .nav-custom-link.active {
  color: var(--brand-bg-light);
}

.navbar-custom.scrolled .nav-custom-link.active {
  color: var(--brand-blue);
}

.navbar-custom.scrolled .nav-custom-link.active:hover {
  background: var(--brand-bg-light);
  color: var(--brand-blue);
}

/* =============================================
   HERO SECTION
   ============================================= */
.features-page .hero-section {
  padding-top: calc(var(--nav-height) + 2.5rem);
  padding-bottom: 20rem;
  background: linear-gradient(180deg, var(--brand-blue) 51%, var(--bg-white) 100%);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: visible;
}

.features-page .hero-container {
  max-width: 70rem;
  margin: 0 auto;
  padding: 2.5rem var(--desktop-padding) 7.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.features-page .hero-title {
  color: var(--cs-white);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.features-page .hero-subtitle {
  color: var(--cs-white);
  font-size: 1.5rem;
  line-height: 1.3;
  max-width: 56.25rem;
  margin: 0;
}

/* =============================================
   FEATURED IMAGE
   ============================================= */
.featured-image-section {
  padding: 2.5rem var(--desktop-padding);
  margin-top: -22.5rem;
  position: relative;
  z-index: 20;
  max-width: var(--max-content-width);
  margin-left: auto;
  margin-right: auto;
}

.featured-image-container {
  position: relative;
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
}

.featured-image-container img {
  width: 100%;
  height: auto;
  display: block;
}

.featured-image-wrapper {
  width: 100%;
  overflow: hidden;
  border-radius: 1rem;
}

.featured-image-wrapper picture,
.featured-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

/* =============================================
   TAB NAVIGATION (Figma-aligned Logic)
   ============================================= */
.features-tabs-wrapper {
  width: 100%;
  position: sticky;
  top: var(--nav-height);
  z-index: 1050;
  background: var(--bg-white);
  transition: top 0.3s ease, box-shadow 0.3s;
  border-bottom: 0.0625rem solid var(--border-color);
}

.features-tabs-wrapper.stuck {
  top: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.tabs-viewport {
  overflow: hidden;
  margin: 0 auto;
}

.tabs-center {
  margin: 0 auto;
  overflow: visible;
}

.tabs-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  transition: transform 0.5s ease-in-out;
}

.tab-item {
  flex-shrink: 0;
  width: 129.5px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  color: var(--text-body);
}

.tab-item:hover {
  color: var(--brand-blue);
}

.tab-item.active {
  border-bottom-color: var(--brand-blue);
  color: var(--brand-blue);
}

.tab-item.in-window {
  color: var(--text-dark);
}

.tab-item.in-window:hover {
  color: var(--brand-blue);
}

.tab-item.outside {
  color: #ADACAB;
}

.tab-item.hidden-tab {
  opacity: 0;
  pointer-events: none;
}

.tab-icon {
  width: 24px;
  height: 24px;
  position: relative;
}

.tab-icon svg {
  width: 24px;
  height: 24px;
  transition: all 0.3s ease;
  stroke-width: 1.5;
}

.tab-item span {
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  line-height: 130%;
  white-space: pre-line;
  display: block;
}

.tabs-mobile {
  display: none;
}

/* =============================================
   CONTENT SECTIONS
   ============================================= */
.content-section {
  width: 100%;
  max-width: 100%;
  padding: 5rem var(--desktop-padding);
  margin: 0 auto;
}

.content-section.gray-bg {
  background-color: var(--bg-form);
}

.content-section.blue-bg {
  background-color: var(--brand-blue);
}

.content-section.f9-bg {
  background-color: #f9f9f9;
}

.content-section.blue-bg .feature-content h3,
.content-section.blue-bg .feature-content p,
.content-section.blue-bg .benefit-item span,
.content-section.blue-bg .benefit-icon {
  color: var(--cs-white);
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-header h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.section-header p {
  font-size: 1.5rem;
  color: var(--text-body);
  line-height: 1.3;
}

/* Feature Row — float-based wrap layou
   Text wraps underneath the image once it exceeds the image height,
   rather than remaining locked in a separate column.
   ----------------------------------------------------------- */
.feature-row {
  overflow: hidden;           /* BFC to contain floats              */
  margin-bottom: 2.5rem;
  max-width: 70rem;
  margin-left: auto;
  margin-right: auto;
}

.feature-row:last-child {
  margin-bottom: 0;
}

/* --- Default: image LEFT, text wraps to the right then below --- */
.feature-row .feature-image {
  float: left;
  width: 33.75rem;            /* 540 px – matches Official design  */
  margin-right: 2.5rem;       /* gap between image and text         */
  margin-bottom: 1rem;        /* spacing when text wraps below      */
}

/* --- Reversed: image RIGHT, text wraps to the left then below --- */
.feature-row.reversed-layout .feature-image {
  float: right;
  margin-right: 0;
  margin-left: 2.5rem;
}

.feature-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Feature text — no flex, no fixed width. It fills the remaining
   space beside the float and naturally wraps underneath.           */
.feature-content {
  /* no float, no width — block flow beside the floated image      */
}

.feature-content h3 {
  font-size: 2.5rem;          /* 40 px – matches Official spec     */
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  line-height: 1.3;           /* ≈ 52 px at 40 px                  */
}

.feature-content p {
  font-size: 1.5rem;          /* 24 px – matches Official spec     */
  color: var(--text-body);
  line-height: 1.3;           /* ≈ 31.2 px at 24 px                */
  margin-bottom: 1rem;
}

.feature-content p:last-child {
  margin-bottom: 0;
}

/* Benefits Row */
.benefits-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2.5rem 0;
  max-width: 70rem;
  margin: 0 auto;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.benefit-item .benefit-icon {
  width: 1.375rem;
  height: 1.375rem;
  flex-shrink: 0;
  color: var(--success-green);
}

.benefit-item .benefit-icon svg {
  width: 1.375rem;
  height: 1.375rem;
}

.benefit-item span {
  font-size: 1.125rem;
  color: var(--text-body);
  line-height: 1.3;
}

/* Two-column benefits with divider */
.benefits-columns {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.5rem 0;
  max-width: 70rem;
  margin: 0 auto;
}

.benefits-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.benefits-column .benefit-item {
  align-items: flex-start;
}

.benefits-column .benefit-item .benefit-icon {
  margin-top: 0.125rem;
}

.benefits-divider {
  width: 0.0625rem;
  align-self: stretch;
  background-color: var(--border-color);
  border-radius: 0.0625rem;
}

/* Benefits with description (text left + benefits right with divider) */
.benefits-with-desc {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.5rem 0;
  max-width: 70rem;
  margin: 0 auto;
}

.benefits-desc-text {
  flex: 1;
  font-size: 1.125rem;
  color: var(--text-body);
  line-height: 1.3;
}

/* Inline benefits within feature content */
.feature-content .benefits-inline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.feature-content .benefits-inline .benefit-item {
  align-items: flex-start;
}

.feature-content .benefits-inline .benefit-item span {
  font-size: 1.125rem;
}

/* =============================================
   TRUST CARDS GRID
   ============================================= */
.trust-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  max-width: 70rem;
  margin: 2rem auto 0;
}

.trust-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 0.0625rem solid var(--border-light);
  background: var(--bg-white);
  transition: all 0.3s ease;
}

.trust-card:hover {
  transform: translateY(-0.125rem);
  box-shadow: var(--shadow-card);
}

.trust-card h4 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  margin: 0;
}

.trust-card p {
  font-size: 1rem;
  color: var(--text-body);
  line-height: 1.5;
  margin: 0;
}

/* Trailing text after benefits */
.section-trailing-text {
  font-size: 1.5rem;
  color: var(--text-body);
  line-height: 1.3;
  max-width: 70rem;
  margin: 1.5rem auto 0;
}

.section-trailing-text.small {
  font-size: 1.125rem;
  line-height: 1.5;
  margin-top: 2rem;
}

/* Sub-row with top spacing */
.feature-row-spaced {
  margin-top: 2.5rem;
}

/* =============================================
   CTA SECTION (Features page variant)
   ============================================= */
.features-cta-section {
  background-image: url('/assets/images/bgd-cta.webp');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  display: flex;
  gap: 2.5rem;
  align-items: center;
  justify-content: center;
  overflow: clip;
  padding: 5rem 0;
  position: relative;
  width: 100%;
  min-height: 37.5rem;
}

.features-cta-section .cta-section-inner {
  width: 100%;
  max-width: 70rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  gap: 2.5rem;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.cta-content-wrapper {
  display: flex;
  gap: 2.5rem;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

.cta-text-content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
  position: relative;
  flex: 1;
  max-width: 33.75rem;
}

.cta-title {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  line-height: 1.3;
  position: relative;
  color: var(--cs-blue-dark);
  font-size: 2.5rem;
  width: 100%;
  margin: 0;
}

.cta-description {
  font-family: 'Sora', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  position: relative;
  color: var(--cs-text);
  font-size: 1.5rem;
  width: 100%;
  margin: 0;
}

.cta-buttons {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  position: relative;
}

.btn-cta {
  display: flex;
  gap: 0.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  border-radius: 0.5rem;
  width: 12.5rem;
  border: 0.0625rem solid var(--border-color);
  box-shadow: 0 0.25rem 0.125rem 0 rgba(188, 188, 188, 0);
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  line-height: 1.3;
  font-size: 1.125rem;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-cta.primary {
  background-color: var(--cs-white);
  color: var(--text-body);
}

.btn-cta.primary:hover {
  background-color: var(--bg-gray-light);
}

.btn-cta.secondary {
  background: transparent;
  color: var(--text-body);
}

.btn-cta.secondary:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.cta-image-container {
  flex: 1;
  max-width: 33.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cta-image-wrapper {
  width: 100%;
  overflow: hidden;
}

.cta-image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 87.5rem) {
  .features-tabs {
    padding: 0.75rem 3.75rem;
  }

  .featured-image-section {
    padding: 2.5rem 3.75rem;
  }

  .content-section {
    padding: 5rem 3.75rem;
  }

  .features-cta-section .cta-section-inner {
    padding: 0 1.25rem;
  }
}

@media (max-width: 62rem) {
  .features-page .hero-section {
    padding-top: calc(var(--nav-height-mobile) + 2.5rem);
    padding-bottom: 3.75rem;
  }

  .features-page .hero-container {
    padding: 2.5rem 1.5rem 10rem;
  }

  .features-page .hero-title {
    font-size: 2.5rem;
  }

  .features-page .hero-subtitle {
    font-size: 1.125rem;
  }

  .featured-image-section {
    padding: 1.5rem;
    margin-top: -12.5rem;
  }

  .features-tabs-wrapper {
    top: var(--nav-height-mobile);
    border-bottom: none;
  }

  .features-tabs-wrapper.stuck {
    top: 0;
  }

  .tabs-viewport {
    display: none !important;
  }

  .tabs-mobile {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 12px 1.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tabs-mobile::-webkit-scrollbar {
    display: none;
  }

  .tabs-mobile .tab-item {
    flex: 0 0 auto;
    min-width: 7.5rem;
    min-height: 3.75rem;
    padding: 10px 12px;
  }

  .tabs-mobile .tab-item span {
    font-size: 0.75rem;
    min-height: auto;
  }

  .content-section {
    padding: 2.5rem 1.5rem;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .section-header p {
    font-size: 1.125rem;
  }

  .feature-row {
    overflow: hidden;
  }

  .feature-row .feature-image,
  .feature-row.reversed-layout .feature-image {
    float: none;
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    margin-bottom: 1.5rem;
  }

  .feature-content {
    clear: both;
  }

  .feature-content h3 {
    font-size: 1.5rem;
  }

  .feature-content p {
    font-size: 1rem;
  }

  .benefits-list {
    flex-direction: column;
    align-items: flex-start;
  }

  .benefit-item span {
    white-space: normal;
  }

  .benefits-columns {
    flex-direction: column;
    gap: 1rem;
  }

  .benefits-divider {
    width: 100%;
    height: 0.0625rem;
    align-self: auto;
  }

  .benefits-with-desc {
    flex-direction: column;
    gap: 1rem;
  }

  .trust-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .features-cta-section {
    padding: 2.5rem 1.25rem;
    min-height: 0;
    background-attachment: scroll;
  }

  .features-cta-section .cta-section-inner {
    padding: 0 1.25rem;
    flex-direction: column;
    gap: 1.5rem;
  }

  .cta-content-wrapper {
    flex-direction: column;
    gap: 1.5rem;
  }

  .cta-image-container {
    order: -1;
    width: 100%;
    max-width: 100%;
    margin-bottom: 0.5rem;
  }

  .cta-text-content {
    width: 100%;
    max-width: 100%;
    gap: 1rem;
  }

  .cta-title {
    font-size: 1.75rem;
    margin-top: 0.5rem;
  }

  .cta-description {
    font-size: 1rem;
    line-height: 1.5;
  }

  .cta-buttons {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .btn-cta {
    width: 100%;
  }
}

@media (max-width: 30rem) {
  .features-hero-title {
    font-size: 2rem;
  }

  .features-hero-subtitle {
    font-size: 1rem;
  }
}
