/*
 * Page "Голова партії" (page-leader.php).
 * Profile: one grid; on mobile the intro moves below the name (order).
 * Stories: text + photo; on desktop the photo stays in the middle of the screen while the text scrolls
 * (position: sticky; .ab_sec clips overflow, so stories switch it off).
 */

@media (min-width: 1281px) {
  .hd_top,
  .hd_story {
    --pad: 80px;
  }
}

/* ---------- Profile ---------- */

.hd_top_grid {
  display: grid;
  grid-template-columns: minmax(0, 540fr) minmax(0, 1132fr);
  grid-template-rows: auto 56px 1fr auto auto auto auto auto 1fr;
  column-gap: 48px;
}

.hd_intro_txt {
  grid-column: 1 / -1;
  grid-row: 1;
  font-size: 26px;
  line-height: 40px;
  color: var(--palette-v2-t1);
}

.hd_intro_txt p + p,
.hd_quote_txt p + p {
  margin-top: 40px;
}

.hd_photo_img {
  grid-column: 1;
  grid-row: 3 / 10;
  overflow: hidden;
  aspect-ratio: 540 / 675;
  border-radius: 24px;
  background: var(--palette-v2-d2);
}

.hd_photo_img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hd_head,
.hd_role_txt,
.hd_desc_txt,
.hd_quote_txt,
.hd_chips {
  grid-column: 2;
}

.hd_head {
  grid-row: 4;
}

.hd_role_txt {
  grid-row: 5;
  margin-top: 16px;
  font-family: "Nata Sans", sans-serif;
  font-weight: 800;
  font-size: 20px;
  line-height: 28px;
  color: var(--palette-v2-br);
}

.hd_desc_txt {
  grid-row: 6;
  max-width: 750px;
  margin-top: 16px;
  font-size: 18px;
  line-height: 30px;
  color: var(--palette-v2-t2);
}

.hd_quote_txt {
  grid-row: 7;
  margin-top: 49px;
  font-size: 26px;
  line-height: 40px;
  color: var(--palette-v2-t1);
}

.hd_chips {
  grid-row: 8;
  margin-top: 52px;
}

/* Outline chip on dark backgrounds (Figma: Chip Outline, Surface=Dark) */
.chip--outline {
  height: auto;
  min-height: 38px;
  padding: 6px 20px; /* long titles wrap on mobile */
  border: 1px solid var(--palette-v2-t3-tint);
  background: transparent;
  color: var(--palette-v2-t2);
  text-decoration: none;
}

.chip--outline:hover {
  background: var(--palette-v2-d2);
  color: var(--palette-v2-t2);
}

.chip--outline:active {
  background: var(--palette-v2-d3);
}

/* ---------- Stories ---------- */

.hd_story {
  overflow: visible;
}

.hd_story_grid {
  display: grid;
  grid-template-columns: minmax(0, 852fr) minmax(0, 804fr);
  column-gap: 64px;
}

.hd_story--rev .hd_story_grid {
  grid-template-columns: minmax(0, 804fr) minmax(0, 852fr);
}

.hd_story_media {
  container-type: inline-size;
  grid-column: 2;
  grid-row: 1;
}

.hd_story--rev .hd_story_media {
  grid-column: 1;
}

.hd_story_text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 94px; /* 80 + 14 bottom padding of an article in the mockup */
  grid-column: 1;
  grid-row: 1;
}

.hd_story--rev .hd_story_text {
  grid-column: 2;
}

/* stays in the middle of the screen (photo height = 452/804 of its column), below the fixed header */
.hd_story_img {
  position: sticky;
  top: max(121px, calc(50vh - 28.11cqw));
  overflow: hidden;
  aspect-ratio: 804 / 452;
  border-radius: 24px;
  background: var(--palette-v2-d2);
}

.hd_story_img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hd_art {
  scroll-margin-top: 121px;
}

.hd_art_title {
  font-weight: 800;
  font-size: 36px;
  line-height: 44px;
  color: var(--palette-v2-bg);
}

.hd_art_txt {
  margin-top: 20px;
  font-size: 18px;
  line-height: 30px;
  color: var(--palette-v2-d1);
}

.hd_art_txt p + p {
  margin-top: 30px;
}

.hd_story--dark .hd_art_title {
  color: var(--palette-v2-t1);
}

.hd_story--dark .hd_art_txt {
  color: var(--palette-v2-t2);
}

/* ---------- 1024 (tablet) ---------- */

@media (max-width: 1024px) {
  .hd_top_grid {
    grid-template-columns: minmax(0, 416fr) minmax(0, 504fr);
    grid-template-rows: auto 40px 1fr auto auto auto auto 1fr auto;
    column-gap: 24px;
  }

  .hd_intro_txt,
  .hd_quote_txt {
    font-size: 22px;
    line-height: 34px;
  }

  .hd_intro_txt p + p,
  .hd_quote_txt p + p {
    margin-top: 34px;
  }

  .hd_photo_img {
    grid-row: 3 / 9;
  }

  .hd_desc_txt {
    font-size: 16px;
    line-height: 26px;
  }

  .hd_chips {
    grid-column: 1 / -1;
    grid-row: 9;
    gap: 12px;
    margin-top: 40px;
  }

  .hd_story_grid,
  .hd_story--rev .hd_story_grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 32px;
  }

  .hd_story_media,
  .hd_story--rev .hd_story_media,
  .hd_story_text,
  .hd_story--rev .hd_story_text {
    grid-column: 1;
    grid-row: auto;
  }

  .hd_story_img {
    position: static;
    aspect-ratio: 944 / 531;
  }

  .hd_story_text {
    gap: 54px;
  }

  .hd_art_title {
    font-size: 32px;
    line-height: 40px;
  }

  .hd_art_txt {
    font-size: 16px;
    line-height: 26px;
  }

  .hd_art_txt p + p {
    margin-top: 26px;
  }
}

/* ---------- 601-1280 (tablet, small laptop): photo with the name next to it, the quote and chips under them (designer review) ---------- */

@media (min-width: 601px) and (max-width: 1280px) {
  .hd_top_grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    /* text next to the photo is centred vertically: equal 1fr rows above and below it (designer review 23.11) */
    grid-template-rows: auto 40px 1fr auto auto auto 1fr auto auto;
    column-gap: 32px;
  }

  .hd_photo_img {
    grid-column: 1;
    grid-row: 3 / 8;
  }

  .hd_head { grid-row: 4; }
  .hd_role_txt { grid-row: 5; }
  .hd_desc_txt { grid-row: 6; }

  .hd_quote_txt,
  .hd_chips {
    grid-column: 1 / -1;
  }

  .hd_quote_txt {
    grid-row: 8;
    margin-top: 40px;
  }

  .hd_chips {
    grid-row: 9;
    margin-top: 40px;
  }
}

/* ---------- 600 (mobile) ---------- */

@media (max-width: 600px) {
  .hd_top_grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
  }

  .hd_top_grid > * {
    grid-column: 1;
    grid-row: auto;
  }

  .hd_photo_img { order: 1; }
  .hd_head { order: 2; margin-top: 24px; }
  .hd_role_txt { order: 3; margin-top: 12px; }
  .hd_desc_txt { order: 4; margin-top: 12px; }
  .hd_intro_txt { order: 5; margin-top: 24px; }
  .hd_quote_txt { order: 6; margin-top: 24px; }
  .hd_chips { order: 7; gap: 10px; margin-top: 60px; }

  .hd_story_grid,
  .hd_story--rev .hd_story_grid {
    row-gap: 24px;
  }

  .hd_story_img {
    aspect-ratio: 324 / 182;
  }

  .hd_story_text {
    gap: 50px;
  }

  .hd_art_title {
    font-size: 28px;
    line-height: 36px;
  }
}
