/*
 * Monex About Section — frontend styles.
 *
 * Layout, colors, and card theming for the About Section Breakdance Element.
 * Ported from the Next.js app's .about-* rules (app/globals.css lines
 * 2288–2789) with two structural differences:
 *
 *   1. Container-scoped responsiveness. The 2-column → 1-column collapse
 *      and the gallery 2-col → 1-col collapse fire on the Element's own
 *      inline-size (container-type: inline-size). An About Section dropped
 *      into a narrow Breakdance column responds to that column, not the
 *      viewport.
 *
 *   2. CSS custom properties for every value a Breakdance Design control
 *      can override. css.twig writes the vars at %%SELECTOR%%; this file
 *      consumes them with the app's original values as fallbacks.
 */

.monex-about,
.monex-about * { box-sizing: border-box; }

/* Shell contract — outer self-caps at 1280 and centers regardless of
 * parent (landing shell OR non-landing page). Padding matches the
 * app's .about-section defaults. */
.monex-bd-about-section {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  box-sizing: border-box;
}

.monex-about {
  position: relative;
  padding:
    var(--monex-about-pad-top, 120px)
    var(--monex-about-pad-x, 32px)
    var(--monex-about-pad-bottom, 120px);
  background: var(--monex-about-bg, #bed2db);
  color: #102f49;
  font-family: "Open Sans", Arial, sans-serif;
  container-type: inline-size;
  container-name: monex-about;
}

/* Inner fills the padded outer. No max-width or margin auto — the
 * outer now owns width capping so the content column is uniform with
 * every other section. */
.monex-about__inner {
  width: 100%;
}

.monex-about__grid {
  display: grid;
  grid-template-columns: var(--monex-about-grid-cols, minmax(0, 1.1fr) minmax(0, 0.9fr));
  gap: var(--monex-about-grid-gap, 48px);
  align-items: var(--monex-about-grid-align, center);
  min-width: 0;
}

/* -------- Copy column -------- */

.monex-about__copy { min-width: 0; }

/* Wrapper-scoped so specificity beats bare `h2` normalize + theme
 * `.entry-content h2 {}`. Author's Breakdance typography preset
 * still wins via %%SELECTOR%% at higher specificity. */
.monex-bd-about-section .monex-about__heading {
  margin: 0 0 28px;
  color: #102f49;
  font-size: clamp(3rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.monex-bd-about-section .monex-about__heading-primary,
.monex-bd-about-section .monex-about__heading-accent {
  display: block;
}

.monex-bd-about-section .monex-about__heading-accent {
  font-style: italic;
  font-weight: 400;
}

.monex-about__paragraph {
  max-width: var(--monex-about-p-max-width, 560px);
  margin: 0 0 var(--monex-about-p-gap, 18px);
  color: #4f5663;
  font-size: 1.1rem;
  line-height: 1.7;
}

.monex-about__paragraph:last-of-type {
  margin-bottom: 0;
}

/* -------- CTA -------- */

/* CTA — shared landing-page interaction pattern (see .product-call-button
 * for the reference doc-block). Same background, hover, active and
 * transition behavior as Hero, Video and Product Card CTAs. */
.monex-about__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--monex-about-cta-gap, 10px);
  margin-top: var(--monex-about-cta-margin-top, 28px);
  padding:
    var(--monex-about-cta-pad-y, 16px)
    var(--monex-about-cta-pad-x, 28px);
  border-radius: var(--monex-about-cta-radius, 10px);
  background: var(--monex-about-cta-bg, #32a866);
  color: var(--monex-about-cta-color, #ffffff) !important;
  font-family: inherit;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, filter 160ms ease;
}

.monex-about__cta:hover,
.monex-about__cta:focus-visible {
  color: var(--monex-about-cta-color, #ffffff);
  text-decoration: none;
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.monex-about__cta:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* Real 3px focus ring for keyboard users. Meets WCAG 2.4.7 with an
 * outline offset that keeps the ring visible against the CTA's own
 * background. Hover doesn't get this — it's a keyboard-only cue.
 * Navy ring against the green CTA gives ~5:1 contrast (SC 1.4.11). */
.monex-about__cta:focus-visible {
  outline: 3px solid #102f49;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .monex-about__cta,
  .monex-about__cta:hover,
  .monex-about__cta:focus-visible,
  .monex-about__cta:active {
    transition: none;
    transform: none;
    filter: none;
  }
}

.monex-about__cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--monex-about-cta-icon-size, 20px);
  height: var(--monex-about-cta-icon-size, 20px);
  flex: 0 0 auto;
}

.monex-about__cta-icon svg {
  width: 100%;
  height: 100%;
}


/* -------- Awards & recognition -------- */

/*
 * Independent content group below the CTA. The SSR chooses a 1-4 column
 * class from the number of rendered awards; 5+ items keep four columns and
 * wrap naturally. Cards retain one shared aspect ratio as they get smaller.
 */
.monex-bd-about-section .monex-about__awards {
  border-top: 1px solid #102f492e;
  max-width: 560px;
  margin-top: 32px;
  padding-top: 26px;
}

.monex-bd-about-section .monex-about__awards-eyebrow {
  display: block;
  margin-bottom: 16px;
  color: #3f7a96;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.monex-bd-about-section .monex-about__awards-grid {
  display: grid;
  gap: 28px;
  align-items: stretch;
}

.monex-bd-about-section .monex-about__awards-grid--cols-1 {
  grid-template-columns: minmax(0, 266px);
}

.monex-bd-about-section .monex-about__awards-grid--cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.monex-bd-about-section .monex-about__awards-grid--cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.monex-bd-about-section .monex-about__awards-grid--cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.monex-bd-about-section .monex-about__award-card {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  min-width: 0;
  aspect-ratio: 1.15 / 1;
  margin: 0;
  padding: clamp(10px, 8%, 20px);
  overflow: hidden;
  border-top: 2px solid #102f4957;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(
    #ffffffdb 0%,
    #ffffff75 54%,
    #fff0 100%
  );
  box-shadow: 0 -8px 20px #102f4906;
}

.monex-bd-about-section .monex-about__award-link {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}

.monex-bd-about-section .monex-about__award-link:focus-visible {
  outline: 3px solid #102f49;
  outline-offset: 3px;
}

.monex-bd-about-section .monex-about__award-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px #102f491f);
}

/* -------- Gallery --------
 *
 * Grid on the gallery gives us two side-by-side columns; align-items: start
 * ensures each stack starts at the top of the section and never stretches
 * to gallery height when the opposite stack happens to be taller (e.g., a
 * portrait image with two stat cards adjacent).
 *
 * Stacks themselves are flex columns — a single-track grid was giving us
 * nothing flex can't. align-self: start also anchors each stack to the
 * top of its grid track, preserving the intended two-row composition:
 *
 *   Image 1        Stat 2
 *   Stat 1         Image 2
 *
 * with the first stack offset downward by --monex-about-first-offset.
 */

.monex-about__gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--monex-about-gallery-gap, 16px);
  align-items: start;
  min-width: 0;
}

.monex-about__stack {
  display: flex;
  flex-direction: column;
  gap: var(--monex-about-stack-gap, 16px);
  align-self: start;
  min-width: 0;
}

.monex-about__stack--first {
  padding-top: var(--monex-about-first-offset, 48px);
}

/*
 * Gallery images are DESIGN CARDS, not raw attachments. Give each image
 * predictable geometry via aspect-ratio, then use object-fit: cover to
 * fill the card regardless of the source image's natural dimensions.
 *
 * width: 100% + aspect-ratio: 4/5 defines a definite width and derived
 * height (height: auto is computed from CSS aspect-ratio, which per spec
 * overrides the replaced element's intrinsic aspect and the HTML
 * width/height attributes that wp_get_attachment_image() emits).
 * object-fit: cover then fills the box centrally cropped.
 */
.monex-about__image {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: var(--monex-about-image-ratio, 1);
  object-fit: var(--monex-about-image-fit, cover);
  height: auto;
  border-radius: var(--monex-about-image-radius, 12px);
  box-shadow: var(--monex-about-image-shadow, 0 16px 28px rgba(20, 27, 42, 0.12));
}

.monex-about__stat {
  padding: var(--monex-about-stat-pad, 24px);
  border-radius: var(--monex-about-stat-radius, 12px);
}

.monex-about__stat-value {
  display: block;
  margin-bottom: 6px;
  font-size: 1.9rem;
}

.monex-about__stat-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.monex-about__stat--dark {
  color: var(--monex-about-stat-dark-color, #ffffff);
  background: var(--monex-about-stat-dark-bg, #102f49);
}

.monex-about__stat--light {
  color: var(--monex-about-stat-light-color, #102f49);
  background: var(--monex-about-stat-light-bg, #ecf2f5);
}


/* -------- Optional BBB seal (Content > Gallery > Include BBB Seal) --------
 * Direct gallery-grid child: spans both columns beneath the two stacks,
 * right-aligned in desktop and single-column container layouts. */
.monex-bd-about-section .monex-about__bbb-seal {
  display: block;
  width: min(100%, 293px);
  grid-column: 1 / -1;
  justify-self: end;
  margin-top: var(--space-sm, 16px);
}

.monex-bd-about-section .monex-about__bbb-seal img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
}

.monex-bd-about-section .monex-about__bbb-seal:focus-visible {
  outline: 3px solid #102f49;
  outline-offset: 3px;
}

/*
 * Container-scoped responsiveness.
 *
 * 960px  → section collapses to single column (copy above gallery). Gallery
 *          keeps its 2-column layout so long as there's room.
 * 520px  → gallery collapses to single column and the first-stack offset
 *          disappears (the stagger only reads right when both stacks are
 *          side by side).
 */

@container monex-about (max-width: 960px) {
  .monex-about__grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@container monex-about (max-width: 720px) {
  .monex-about {
    padding-top: 64px;
    padding-bottom: 64px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .monex-bd-about-section .monex-about__heading {
    font-size: clamp(2.4rem, 8vw, 3.4rem);
  }
  .monex-about__cta {
    width: 100%;
  }
}

@container monex-about (max-width: 520px) {
  .monex-about__awards-grid--cols-3,
  .monex-about__awards-grid--cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .monex-about__gallery {
    grid-template-columns: 1fr;
  }
  .monex-about__stack--first {
    padding-top: 0;
  }
}

@container monex-about (max-width: 360px) {
  .monex-about__awards-grid--cols-1,
  .monex-about__awards-grid--cols-2,
  .monex-about__awards-grid--cols-3,
  .monex-about__awards-grid--cols-4 {
    grid-template-columns: 1fr;
  }
}