/* ===========================================
   Problem Section
   Figma: y=902-1517
   Background: #F0F0F0 + bottom triangle polygon
   PC: 2-column cards (left 3 + right 4) with illustrations centered
   SP: stacked groups with inline illustrations
   =========================================== */

.problem {
  position: relative;
  background-color: #F4F4F4;
  padding: 40px 16px 56px;
  overflow: hidden;
}

/* SP: downward triangle overlapping transition - 20px tall */
.problem::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: #F4F4F4;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  z-index: 2;
}

.problem__inner {
  position: relative;
  z-index: 1;
  max-width: 343px;
  margin: 0 auto;
}

/* ===========================================
   Heading group
   =========================================== */

.problem__heading {
  text-align: center;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.problem__heading-sub {
  font-size: 24px;
  font-weight: var(--font-weight-bold);
  line-height: 1.45;
  color: var(--color-black);
  display: block;
}

.problem__heading-main {
  font-size: 31px;
  font-weight: var(--font-weight-bold);
  line-height: 1.45;
  color: var(--color-blue-accent);
  display: block;
}

/* ===========================================
   Problem Group (horizontal layout: illust + items)
   SP: each group is a flex row with illustration + cards
   =========================================== */

.problem__group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

.problem__group--upper {
  flex-direction: row-reverse;
}

.problem__group--lower {
  flex-direction: row;
}

/* Illustration (small, fixed size) */
.problem__illust {
  width: 70px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
  align-self: center;
}

/* Items container */
.problem__items {
  flex: 0 0 220px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* Individual item card */
.problem__item {
  background: var(--color-white);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Heading icon (ぐるぐるマーク) */
.problem__heading-icon {
  display: inline-block;
  width: 27px;
  height: 30px;
  vertical-align: super;
  margin-left: 2px;
}

.problem__item-text {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  line-height: 1.5;
  color: var(--color-black);
}

/* Legacy fallback */
.problem__list {
  display: none;
}

/* ============================================================
   PC (>=768px) — Problem: title top, 2-col cards with center illustrations
   Figma: [left-cards] [male-illust] [female-illust] [right-cards]
   ============================================================ */
@media (min-width: 768px) {
  .problem {
    padding: 80px 0 40px;
    overflow: visible;
    z-index: 2;
    position: relative;
  }

  /* Downward triangle overlapping transition - 90px tall */
  .problem::after {
    display: block;
    content: '';
    position: absolute;
    bottom: -88px;
    left: 0;
    width: 100%;
    height: 88px;
    background: #F4F4F4;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: 2;
    transform: none;
    border: none;
  }

  .problem__inner {
    max-width: 1200px;
    padding: 0 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
  }

  /* Heading spans full width */
  .problem__heading {
    width: 100%;
    margin-bottom: 48px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
  }
  .problem__heading-sub,
  .problem__heading-main {
    font-size: 40px;
    line-height: 58px;
    display: inline;
  }
  .problem__heading-main {
    margin: 0 4px;
  }

  /* Both groups sit side by side */
  .problem__group {
    margin-bottom: 0;
    align-items: center;
  }

  /* Upper group = LEFT half: [items(3 cards)] [male-illust]
     DOM order: img.male, div.items
     row-reverse: items first, then male on the right */
  .problem__group--upper {
    flex-direction: row-reverse;
    width: 50%;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
  }

  /* Lower group = RIGHT half: [female-illust] [items(4 cards)]
     DOM order: img.female, div.items
     row: female first on left, items on the right */
  .problem__group--lower {
    flex-direction: row;
    width: 50%;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
  }

  /* Illustrations sizing */
  .problem__illust {
    width: 110px;
    flex-shrink: 0;
    align-self: center;
  }

  /* Items container: let them take remaining space */
  .problem__items {
    gap: 12px;
    flex: 0 0 350px;
    width: 350px;
    min-width: 0;
  }

  /* Left column cards (upper group) */
  .problem__group--upper .problem__item {
    padding: 16px 20px;
    border-radius: 6px;
  }
  .problem__group--upper .problem__item-text {
    font-size: 16px;
    font-weight: var(--font-weight-bold);
    line-height: 26px;
    text-align: left;
  }

  /* Right column cards (lower group) */
  .problem__group--lower .problem__item {
    padding: 16px 20px;
    border-radius: 6px;
  }
  .problem__group--lower .problem__item-text {
    font-size: 16px;
    font-weight: var(--font-weight-bold);
    line-height: 26px;
    text-align: right;
  }
}

/* ============================================================
   Large screens (>=1200px) — closer to Figma 1920px proportions
   ============================================================ */
@media (min-width: 1200px) {
  .problem__inner {
    max-width: 1200px;
    padding: 0 40px;
  }

  .problem__illust {
    width: 140px;
  }

  .problem__group--upper .problem__item-text,
  .problem__group--lower .problem__item-text {
    font-size: 18px;
  }

  .problem__group--upper,
  .problem__group--lower {
    gap: 16px;
  }
}
