/* #why section (app/views/home/_why.html.erb), design D. */
/*
 * A bento of six tiles in three flexible columns (300px basis, wrapping to
 * two and one): the tall taste tile | plant + fasting | delivery + free
 * delivery + the order CTA. The text sits inside the tiles.
 */
@layer sections {
  .why {
    scroll-margin-top: var(--pl-scroll-margin);
    padding: 0 0 clamp(52px, 6.4vw, 88px);
  }

  /* No menu between them (no product on the site): the menu's top padding. */
  .hero + .why {
    padding-top: clamp(56px, 7vw, 96px);
  }

  .why__title {
    margin-bottom: clamp(24px, 3.2vw, 40px);
    max-width: 17em;
    text-wrap: balance;
  }

  .why__board {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 16px;
  }

  .why__col {
    flex: 1 1 300px;
    min-width: 0;
  }

  /* Columns 2 and 3: tiles stacked, sharing the column's height. */
  .why__stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  /* Each tile starts from its own height (its flex-basis) and the tiles share
     what is left equally; a tile whose text needs more grows (min-height: auto). */
  .why__stack > .why__tile {
    flex-grow: 1;
    flex-shrink: 0;
  }

  .why__tile {
    border-radius: var(--pl-r-card);
  }

  /* The products' drawings, decoration only */
  .why__art {
    position: absolute;
    height: auto;
    fill: var(--pl-paper);
  }

  /* 1. Familiar taste (tall, green) */
  .why__tile--taste {
    position: relative;
    min-height: 576px;
    padding: 28px;
    overflow: hidden;
    background: var(--pl-green-800);
    color: var(--pl-paper);
  }

  .why__taste-text {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .why__name {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.01em;
  }

  .why__text {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--pl-green-200);
  }

  .why__art--taste-side {
    left: 52%;
    top: 176px;
    width: 40%;
    transform: rotate(8deg);
  }

  .why__art--taste-mid {
    left: 6%;
    top: 214px;
    width: 46%;
    transform: rotate(-10deg);
  }

  .why__art--taste-big {
    left: 14%;
    top: 372px;
    width: 108%;
    transform: rotate(-9deg);
  }

  /* Stat headings: a big figure with a label */
  .why__stat {
    margin: 0;
    display: flex;
    font-weight: 800;
  }

  .why__stat--stack {
    flex-direction: column;
  }

  /* The label drops under a figure that leaves no room for its longest word. */
  .why__stat--row {
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 14px;
  }

  /* 2. 100% plant-based (cream) */
  .why__tile--plant {
    flex-basis: 280px;
    padding: 26px;
    background: var(--pl-cream);
    color: var(--pl-green-800);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
  }

  .why__badge {
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: var(--pl-r-pill);
    background: var(--pl-green-800);
    color: var(--pl-cream);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .why__plant-body {
    display: flex;
    flex-direction: column;
  }

  .why__plant-figure {
    font-size: 84px;
    line-height: 0.95;
    letter-spacing: -0.04em;
  }

  .why__plant-label {
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: -0.01em;
  }

  .why__plant-text {
    margin: 8px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--pl-muted);
  }

  /* 3. Fasting-friendly (dark green, rotated yellow pill) */
  .why__tile--fasting {
    position: relative;
    flex-basis: 280px;
    padding: 26px;
    overflow: hidden;
    background: var(--pl-green-950);
    color: var(--pl-paper);
  }

  .why__pill {
    margin: 0;
    display: inline-block;
    padding: 5px 18px;
    border-radius: var(--pl-r-pill);
    background: var(--pl-yellow);
    color: var(--pl-ink);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;
    transform: rotate(-6deg);
  }

  .why__fasting-text {
    position: relative;
    z-index: 1;
    margin: 18px 0 0;
    max-width: 170px;
    font-size: 15px;
    line-height: 1.5;
    color: var(--pl-green-200);
  }

  .why__art--fasting {
    right: -12%;
    bottom: -18%;
    width: 62%;
    transform: rotate(7deg);
  }

  /* 4. Delivery time and area (sand), 5. free delivery (light green) */
  .why__tile--delivery,
  .why__tile--free {
    flex-basis: 170px;
    padding: 22px 26px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  /* A size container: the time's type follows the tile's width (cqi). */
  .why__tile--delivery {
    container-type: inline-size;
    background: var(--pl-sand-100);
    color: var(--pl-ink);
  }

  /* The time is the owner's text. 42px, not the design's 44px: Noto Sans
     Georgian runs wider than the mockup's font. The size follows the tile's
     width, so "დღეს ან ხვალ" (12 characters) stays on one line in every
     tile, from a 320px phone to the 304px column at 1024px; a longer text
     (home/_why: --m from 13 characters, --l from 17) gets smaller type
     ("Same or next day"). What still does not fit wraps in balanced lines.
     The vw sizes are for browsers without container units. */
  .why__delivery-big {
    font-size: clamp(34px, 11vw, 42px);
    font-size: clamp(28px, 13.2cqi, 42px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
    text-wrap: balance;
  }

  .why__delivery-big--m {
    font-size: clamp(28px, 9vw, 34px);
    font-size: clamp(24px, 10cqi, 34px);
  }

  .why__delivery-big--l {
    font-size: clamp(24px, 7.6vw, 30px);
    font-size: clamp(22px, 8.4cqi, 30px);
  }

  /* The area line: 22px, a little smaller in a narrow tile, so "მიმდებარე
     ტერიტორია" shares a line there too. */
  .why__delivery-small {
    font-size: 22px;
    font-size: clamp(19px, 7.4cqi, 22px);
    line-height: 1.25;
    letter-spacing: -0.01em;
    text-wrap: balance;
  }

  .why__tile--free {
    background: var(--pl-green-150);
    color: var(--pl-green-950);
  }

  .why__free-figure {
    flex: none;
    font-size: 96px;
    line-height: 0.78;
    letter-spacing: -0.04em;
  }

  /* Every figure of the tile is a sum ("50 ₾", "5 ₾"): smaller than the
     base size, on one line. 60px with the row's 14px gap: at 360px "50 ₾"
     leaves room beside it for the label's longest Georgian word. */
  .why__free-figure--money {
    font-size: 60px;
    line-height: 0.9;
    white-space: nowrap;
  }

  /* The sum is the owner's (Settings takes up to 1000 ₾, with tetri): a longer
     one (home/_why: --m from 5 characters, --l from 7) gets smaller type, so
     "120.50 ₾" fits a 320px phone's tile. */
  .why__free-figure--m {
    font-size: 52px;
  }

  .why__free-figure--l {
    font-size: 44px;
  }

  /* Beside the figure while its longest word fits there (min-content; 6em for
     browsers without it), under it otherwise; never out of the tile. */
  .why__free-label {
    flex: 1 1 6em;
    flex-basis: min-content;
    min-width: 0;
    overflow-wrap: break-word;
    font-size: 22px;
    line-height: 1.22;
    letter-spacing: -0.01em;
  }

  /* 6. Order CTA (yellow) */
  .why__cta {
    flex-basis: 170px;
    padding: 22px 26px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    background: var(--pl-yellow);
    color: var(--pl-ink);
    text-decoration: none;
  }

  .why__cta-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .why__cta-title {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }

  .why__cta-sub {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
  }

  .why__arrow {
    flex: none;
    width: 54px;
    height: 54px;
    border-radius: var(--pl-r-pill);
    background: var(--pl-ink);
    color: var(--pl-paper);
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
