/* =====================================================================
   InstaFarm · Chapter 01 "The problem" section
   Drop-in component, measured from problem-reference.png.
   Inner sizes use container-query units (cqi = 1% of .problem__wrap width,
   reference width = 1170 CSS px) with px floors, so it scales as one piece.
   DO NOT replace cqi values with px / vw / clamp.
   ===================================================================== */

.problem {
  --pb-bg: #FAF8F6;
  --pb-ink: #161616;
  --pb-text: #4E4644;
  --pb-muted: #5E5553;
  --pb-card: #FDFCFB;
  --pb-line: #ECE5E2;
  --pb-red: #C4161C;
  --pb-red-dark: #B3141A;
  --pb-icon-bg: #FCE4E2;

  background: var(--pb-bg);
  padding: clamp(28px, 4vh, 56px) 24px clamp(56px, 8vh, 96px);
  scroll-margin-top: 80px;
}

.problem__wrap {
  container-type: inline-size;
  max-width: 1170px;
  margin: 0 auto;
}

/* ---------- header: headline left, paragraph right ---------- */
.problem__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42.5cqi;
  column-gap: 4cqi;
  align-items: start;
}
.problem__eyebrow {
  margin: 0;
  font: 700 max(12px, 1.2cqi)/1 'Instrument Sans', system-ui, sans-serif;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pb-muted);
}
.problem__title {
  margin: max(18px, 2.1cqi) 0 0;
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: "opsz" 40, "SOFT" 0, "WONK" 0;
  font-weight: 700;
  font-size: max(32px, 4.6cqi);
  line-height: 1.06;
  letter-spacing: -.02em;
  color: var(--pb-ink);
}
.problem__title span { display: block; white-space: nowrap; }   /* exactly 2 lines on desktop */
.problem__lede {
  margin: max(6px, .4cqi) 0 0;
  font: 400 max(16px, 1.5cqi)/1.57 'Instrument Sans', system-ui, sans-serif;
  color: var(--pb-text);
}

/* ---------- three cards ---------- */
.problem__cards {
  list-style: none;
  margin: max(28px, 3.3cqi) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: max(14px, 1.9cqi);
}
.problem__card {
  box-sizing: border-box;
  min-height: 18.6cqi;
  padding: max(22px, 2.2cqi) max(22px, 2.2cqi) max(20px, 2cqi);
  background: var(--pb-card);
  border: 1px solid var(--pb-line);
  border-radius: max(16px, 1.55cqi);
  box-shadow: 0 1px 2px rgba(60, 30, 20, .03);
  transition: transform .4s cubic-bezier(.2,.7,.2,1), box-shadow .4s cubic-bezier(.2,.7,.2,1), border-color .4s;
}
.problem__icon {
  width: max(44px, 4cqi);
  height: max(44px, 4cqi);
  border-radius: max(10px, .85cqi);
  background: var(--pb-icon-bg);
  display: grid;
  place-items: center;
  color: var(--pb-red);
}
.problem__icon svg {
  width: 45%;
  height: 45%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.problem__card h3 {
  margin: max(16px, 1.5cqi) 0 0;
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: "opsz" 40, "SOFT" 0, "WONK" 0;
  font-weight: 700;
  font-size: max(21px, 1.95cqi);
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--pb-ink);
}
.problem__card p {
  margin: max(10px, 1cqi) 0 0;
  font: 400 max(15px, 1.34cqi)/1.48 'Instrument Sans', system-ui, sans-serif;
  color: var(--pb-text);
}
@media (hover: hover) {
  .problem__card:hover {
    transform: translateY(-4px);
    border-color: #E6D6D2;
    box-shadow: 0 18px 40px rgba(120, 40, 30, .08);
  }
}

/* ---------- red stat bar ---------- */
.problem__bar {
  margin-top: max(20px, 2.25cqi);
  box-sizing: border-box;
  min-height: 9.85cqi;
  padding: max(20px, 2cqi) 3.4cqi;
  border-radius: max(18px, 1.8cqi);
  background: linear-gradient(100deg, #C4161C 0%, #C2151B 60%, #BA141A 100%);
  box-shadow: 0 20px 44px rgba(196, 22, 28, .22);
  color: #FFFFFF;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 2.5cqi;
}
.problem__stat {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  font-variation-settings: "opsz" 72, "SOFT" 0, "WONK" 0;
  font-weight: 700;
  font-size: max(44px, 5.4cqi);
  line-height: 1;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.problem__divider {
  width: 1px;
  height: max(44px, 4.1cqi);
  background: rgba(255, 255, 255, .55);
}
.problem__stat-text {
  margin: 0;
  max-width: 33cqi;
  font: 400 max(16px, 1.45cqi)/1.5 'Instrument Sans', system-ui, sans-serif;
  color: #FFF1EF;
}
.problem__source {
  display: block;
  margin-top: 4px;
  font-size: max(11px, .85cqi);
  color: rgba(255, 241, 239, .75);
}
.problem__link {
  justify-self: end;
  display: inline-flex;
  flex-direction: column;
  gap: max(10px, .9cqi);
  font: 600 max(16px, 1.4cqi)/1 'Instrument Sans', system-ui, sans-serif;
  color: #FFFFFF;
  text-decoration: none;
  white-space: nowrap;
}
.problem__link::after {
  content: "";
  height: 1px;
  background: rgba(255, 255, 255, .9);
  transform-origin: left;
  transition: transform .3s ease;
}
.problem__link .arr { display: inline-block; margin-left: .4em; transition: transform .3s ease; }
.problem__link:hover .arr { transform: translateX(4px); }
.problem__link:hover { color: #FFFFFF; }
.problem__link:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 6px; border-radius: 4px; }

/* ---------- reveal (JS adds .is-in) ---------- */
.problem [data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.problem [data-reveal].is-in { opacity: 1; transform: none; }
.problem__card[data-reveal]:nth-child(2) { transition-delay: .08s; }
.problem__card[data-reveal]:nth-child(3) { transition-delay: .16s; }

/* ---------- responsive ---------- */
/* Tablet: header stacks, cards stay 3-up until 760px */
@media (max-width: 999px) {
  .problem__head { grid-template-columns: 1fr; row-gap: 18px; }
  .problem__title span { white-space: normal; }
  .problem__lede { margin-top: 0; max-width: 40rem; }
  .problem__bar { grid-template-columns: auto auto minmax(0, 1fr); row-gap: 18px; padding: 26px 28px; }
  .problem__link { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 759px) {
  .problem__cards { grid-template-columns: 1fr; }
  .problem__card { min-height: 0; }
  .problem__title { font-size: clamp(30px, 8.4vw, 40px); }
  .problem__title span { display: inline; }
  .problem__bar { grid-template-columns: 1fr; padding: 26px 22px; }
  .problem__divider { width: 56px; height: 1px; }
  .problem__stat { font-size: clamp(48px, 15vw, 64px); }
  .problem__stat-text { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .problem *, .problem [data-reveal] { transition: none !important; }
  .problem [data-reveal] { opacity: 1; transform: none; }
  .problem__card:hover { transform: none; }
}
