/* ==========================================================================
   MoA Graphic — Mechanism of Action Interactive Component
   Design reference: 1920 × 1295 px Figma frame
   Left half  (0–960 px):  illustration, active tab, dots
   Right half (960–1920 px): label badge, text panels, inactive tabs
   ========================================================================== */

/* ── Custom properties ──────────────────────────────────────────────────── */
.moa-graphic {
  --moa-bg:          #0D0C41;
  --moa-heading:     #C0E0E0;
  --moa-text-active: #80C0C0;
  --moa-text-read:   #FFFFFF;
  --moa-tab-bg:      #008080;
  --moa-dot-active:  #D9D9D9;
  --moa-dot-idle:    rgba(217, 217, 217, 0.5);

  /* 12.5 % ≈ 240 px at 1920 px — outer horizontal inset on each side */
  --moa-inset: clamp(24px, 12.5%, 240px);
}

/* Suppress all transitions during height measurement */
.moa--measuring * {
  transition: none !important;
}

/* ── Root element ───────────────────────────────────────────────────────── */
.moa-graphic {
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: var(--moa-bg);
  font-family: 'Red Hat Display', sans-serif;
  color: var(--moa-text-read);
  box-sizing: border-box;
  padding-top: 60px;
  padding-bottom: 56px;
}

/* ==========================================================================
   Header (above the two-column graphic)
   Figma: x:100 in 1920px frame → 5.21% inset; 12px gap between lines
   ========================================================================== */

.moa-header {
  padding-left: clamp(24px, 5.21%, 100px);
  padding-right: clamp(24px, 5.21%, 100px);
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.moa-header__eyebrow {
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 900;
  font-size: clamp(26px, 2.71vw, 52px);
  line-height: 1.323;
  color: var(--moa-text-active);
  margin: 0;
}

.moa-header__title {
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 700;
  font-size: clamp(22px, 2.08vw, 40px);
  line-height: 1.323;
  color: var(--moa-text-read);
  margin: 0;
}

/* ==========================================================================
   Two-column halves
   ========================================================================== */

.moa-columns {
  display: flex;
  flex: 1;
}

.moa-left,
.moa-right {
  flex: 0 0 50%;
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

/* Left half: inset from the outer left edge */
.moa-left {
  padding-left: var(--moa-inset);
  padding-right: 32px;
}

/* Right half: inset from the outer right edge, content starts at 50% */
.moa-right {
  padding-right: var(--moa-inset);
  padding-left: 0;
}

/* ==========================================================================
   Illustration (left half, top)
   CSS-grid stacking: all SVGs share the same cell; only one is opaque
   ========================================================================== */

.moa-illustration-frame {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.moa-illustration {
  display: grid;
  width: 100%;
  max-width: 376px;
}

.moa-svg {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.7s ease;
}

.moa-svg.is-visible {
  opacity: 1;
}

/* ==========================================================================
   Left controls: active tab button + step dots
   ========================================================================== */

.moa-controls-left {
  display: flex;
  align-items: center;
  gap: clamp(16px, 5vw, 96px);
  padding-top: 40px;
  flex-wrap: nowrap;
}

/* Only the active tab button is shown in the left column */
.moa-tab.moa-tab--left {
  display: none;
}

.moa-tab.moa-tab--left.is-active {
  display: inline-flex;
}

/* ── Dots ───────────────────────────────────────────────────────────────── */

.moa-dots {
  display: none;
  align-items: center;
  gap: 25px; /* Figma: dots spaced 50 px center-to-center, 25 px diameter */
  flex-shrink: 0;
}

.moa-dots.is-active {
  display: flex;
}

.moa-dot {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: none;
  background-color: var(--moa-dot-idle);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.moa-dot.is-active {
  background-color: var(--moa-dot-active);
}

.moa-dot:hover:not(.is-active) {
  background-color: rgba(217, 217, 217, 0.75);
}

/* ==========================================================================
   Label badge area (right half, above text)
   316 × 84 px annotation SVG — only present for select steps
   ========================================================================== */

.moa-label-area {
  flex-shrink: 0;
}

.moa-label {
  display: none;
  width: 190px;
  height: 50px;
  object-fit: contain;
  margin-bottom: 16px;
}

.moa-label.is-visible {
  display: block;
}

/* ==========================================================================
   Text panels (right half, middle)
   ========================================================================== */

.moa-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.moa-panel {
  display: none;
  flex-direction: column;
}

.moa-panel.is-active {
  display: flex;
}

/* Heading — Red Hat Display 700 40 px, left-aligned, Light Blue */
.moa-heading {
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 700;
  font-size: clamp(22px, 2.08vw, 40px);
  line-height: 1.323;
  color: var(--moa-heading);
  text-align: left;
  margin: 0 0 24px;
}

/* Paragraphs container */
.moa-paragraphs {
  display: flex;
  flex-direction: column;
}

/* Body text — Red Hat Display 500 28 px, center-aligned (per Figma Body style) */
.moa-paragraphs p {
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 500;
  font-size: clamp(16px, 1.46vw, 28px);
  line-height: 1.323;
  text-align: left;
  margin: 0;
  overflow: hidden;
  transition: color 0.3s ease, opacity 0.3s ease,
              max-height 0.4s ease, padding-bottom 0.4s ease;
}

/* Future paragraph — hidden */
.moa-text--hidden {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
}

/* Currently active paragraph — Light Teal */
.moa-text--active {
  color: var(--moa-text-active);
  max-height: 600px;
  opacity: 1;
  padding-bottom: 24px;
}

/* Previously read paragraph — White */
.moa-text--read {
  color: var(--moa-text-read);
  max-height: 600px;
  opacity: 1;
  padding-bottom: 24px;
}

/* ==========================================================================
   Right controls: inactive tab buttons
   ========================================================================== */

.moa-controls-right {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 40px;
  flex-wrap: wrap;
}

/* Hide the active tab from the right column */
.moa-tab--right.is-active {
  display: none;
}

/* ==========================================================================
   Tab buttons (shared styles)
   ========================================================================== */

.moa-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--moa-tab-bg);
  color: #FFFFFF;
  border: none;
  border-radius: 48px;
  padding: 10px 32px;
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 500;
  font-size: clamp(14px, 1.46vw, 28px);
  line-height: 1.323;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

/* Active tab (left column): full opacity */
.moa-tab--left.is-active {
  opacity: 1;
}

/* Inactive tabs (right column): 50 % opacity */
.moa-tab--right {
  opacity: 0.5;
}

.moa-tab--right:hover {
  opacity: 0.75;
}

/* ==========================================================================
   Mobile controls (hidden on desktop)
   ========================================================================== */

.moa-controls-mobile {
  display: none;
}

/* ── Dropdown ───────────────────────────────────────────────────────────── */

.moa-dropdown {
  position: relative;
  width: 100%;
}

.moa-dropdown__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--moa-tab-bg);
  color: #fff;
  border: none;
  border-radius: 48px;
  padding: 10px 32px;
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.323;
  cursor: pointer;
  box-sizing: border-box;
}

.moa-dropdown__chevron {
  flex-shrink: 0;
  margin-left: 12px;
}

.moa-dropdown__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: var(--moa-tab-bg);
  border-radius: 16px;
  list-style: none;
  margin: 0;
  padding: 8px 0;
  z-index: 100;
}

.moa-dropdown__menu[hidden] {
  display: none;
}

.moa-dropdown__option {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #fff;
  padding: 10px 32px;
  text-align: left;
  font-family: 'Red Hat Display', sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.323;
  cursor: pointer;
  box-sizing: border-box;
}

.moa-dropdown__option:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Hide the currently active option — matches desktop pattern */
.moa-dropdown__option.is-active {
  display: none;
}

/* ==========================================================================
   Responsive — stack columns on narrower viewports
   ========================================================================== */

@media (max-width: 1024px) {
  .moa-graphic {
    flex-direction: column;
    padding-top: 40px;
    padding-bottom: 40px;
    padding-left: var(--moa-inset);
    padding-right: var(--moa-inset);
    /* Override JS-set height lock — on mobile the stacked layout height
       varies by step, so locking to the tallest state leaves empty space. */
    min-height: unset !important;
    max-height: unset !important;
  }

  .moa-header {
    padding-left: 0;
    padding-right: 0;
  }

  .moa-columns {
    flex-direction: column;
  }

  .moa-left,
  .moa-right {
    flex: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
  }

  .moa-illustration {
    max-width: 312px;
  }

  /* Hide desktop controls on mobile */
  .moa-controls-left,
  .moa-controls-right {
    display: none;
  }

  .moa-right {
    margin-top: 32px;
  }

  /* Show mobile controls */
  .moa-controls-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-top: 24px;
  }

  /* Mobile dots: 12 px diameter, 12 px gap (24 px centre-to-centre per Figma) */
  .moa-dots--mobile .moa-dot {
    width: 12px;
    height: 12px;
  }

  .moa-dots--mobile {
    gap: 12px;
  }
}
