/* ==========================================================================
   Home page
   ========================================================================== */

/* ==========================================================================
   Hero — sits inside the page-top box (layout.css): dark blue, grid pattern
   on top, glow at the bottom
   ========================================================================== */

.page-top--hero {
  margin-bottom: var(--spacing-xl);
  background-color: var(--color-additional-blue-dark);
  background-image:
    url("../../img/backgrounds/grid.webp"),
    url("../../img/backgrounds/gradient.webp");
  background-repeat: no-repeat;
  background-position:
    top center,
    bottom center;
  background-size:
    1000px auto,
    auto;
}

.hero {
  position: relative;
  display: grid;
  gap: var(--spacing-lg);
  padding: var(--spacing-xl) var(--spacing-md) var(--spacing-lg);
}

.hero__title {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  width: 100%;
  font-size: var(--fs-header-xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-base);
  color: var(--color-white);
}

.hero__title-sub {
  font-size: var(--fs-header-md);
  font-weight: var(--fw-semi-bold);
}

.hero__title-accent {
  color: var(--color-additional-green);
}

/* The accent phrase ends with three hand-drawn strokes */
.hero__title-mark {
  display: inline-block;
  padding-right: 26px;
  padding-bottom: 8px;
  background: url("../../icons/title-lines.svg") no-repeat right bottom / 25px
    25px;
}

.hero__images {
  display: grid;
}

.hero__mobile-image {
  width: 100%;
  text-align: center;
}

.hero__description {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  line-height: var(--lh-large);
  color: var(--color-white);
}

.hero__description p + p {
  margin-top: var(--spacing-md);
}

.hero__button {
  width: 100%;
}

/* ---------- Hero subjects (from 992px) ----------
   A collage of subject photos; each switches to a second shot on hover
   (plain :hover on purpose — it should also react to taps on tablets). */

.hero-subjects {
  position: relative;
  display: none;
  width: 100%;
  max-width: 400px;
  height: 575px;
  place-self: center;
}

.hero-subject {
  position: absolute;
}

.hero-subject__photos {
  position: relative;
}

.hero-subject__photo {
  position: relative;
  z-index: 1;
  width: var(--photo-width);
  border-radius: var(--border-radius-lg);
}

.hero-subject__photo--hover {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  opacity: 0;
  transition: all var(--transition-base);
}

.hero-subject:hover .hero-subject__photo--hover {
  opacity: 1;
}

.hero-subject__badge {
  position: absolute;
  z-index: var(--ui-index-2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-xl);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  color: var(--subject-color);
  background-color: rgb(6 38 74 / 75%); /* --color-primary-950 @ 75% */
  backdrop-filter: blur(10px);
}

/* Positions in the 400 × 575 box (992–1399px) */

.hero-subject--ukrainian-language {
  --subject-color: var(--color-ukrainian);
  --photo-width: 82px;
  top: 0;
  left: 53px;
}

.hero-subject--ukrainian-language .hero-subject__badge {
  right: -26px;
  bottom: 7px;
}

.hero-subject--biology {
  --subject-color: var(--color-biology);
  --photo-width: 94px;
  top: 200px;
  left: 0;
}

.hero-subject--biology .hero-subject__badge {
  bottom: -15px;
  left: -5px;
}

.hero-subject--english {
  --subject-color: var(--color-english);
  --photo-width: 103px;
  top: 392px;
  left: 27px;
}

.hero-subject--english .hero-subject__badge {
  right: 5px;
  bottom: 5px;
}

.hero-subject--history {
  --subject-color: var(--color-history);
  --photo-width: 131px;
  top: 161px;
  right: 0;
  left: 0;
  width: 131px;
  margin: 0 auto;
}

.hero-subject--history .hero-subject__badge {
  right: 10px;
  bottom: 10px;
}

.hero-subject--geography {
  --subject-color: var(--color-geography);
  --photo-width: 90px;
  top: 273px;
  right: 0;
}

.hero-subject--geography .hero-subject__badge {
  bottom: -8px;
  left: -12px;
}

.hero-subject--maths {
  --subject-color: var(--color-maths);
  --photo-width: 100px;
  top: 395px;
  right: 6px;
}

.hero-subject--maths .hero-subject__badge {
  right: 0;
  bottom: 5px;
}

.hero-subject--chemistry {
  --subject-color: var(--color-chemistry);
  --photo-width: 90px;
  top: 148px;
  right: 10px;
}

.hero-subject--chemistry .hero-subject__badge {
  bottom: -16px;
  left: -2px;
}

.hero-subject--physics {
  --subject-color: var(--color-physics);
  --photo-width: 94px;
  top: 17px;
  right: 100px;
}

.hero-subject--physics .hero-subject__badge {
  bottom: -8px;
  left: -2px;
}

.hero-subject--ukrainian-literature {
  --subject-color: var(--color-literature);
  --photo-width: 100px;
  top: 400px;
  left: 150px;
}

.hero-subject--ukrainian-literature .hero-subject__badge {
  bottom: -8px;
  left: -20px;
}

@media (min-width: 992px) {
  .page-top--hero {
    margin-bottom: var(--spacing-xxl);
    background-size: auto, auto;
  }

  .hero {
    grid-template: min-content min-content 1fr / 6fr 6fr;
    grid-template-areas:
      "title   images"
      "text    images"
      "actions images";
    row-gap: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-xl) var(--spacing-xl);
  }

  .hero__title {
    grid-area: title;
    align-self: end;
    margin-top: 30px;
  }

  .hero__images {
    grid-area: images;
  }

  .hero__description {
    grid-area: text;
    font-size: var(--fs-md);
  }

  .hero__actions {
    grid-area: actions;
  }

  .hero__button {
    max-width: 360px;
  }

  .hero__mobile-image {
    display: none;
  }

  .hero-subjects {
    display: block;
  }
}

@media (min-width: 1200px) {
  .hero {
    grid-template-columns: 7fr 5fr;
  }

  .hero__title {
    font-size: 60px;
  }

  .hero__title-sub {
    font-size: var(--fs-header-xl);
    font-weight: var(--fw-bold);
  }

  .hero__title-mark {
    padding-bottom: 4px;
    background-size: 27px 27px;
  }

  .hero-subject__badge {
    font-size: var(--fs-header-xxs);
  }

  .hero-subject--physics .hero-subject__badge {
    left: -6px;
  }
}

/* Positions in the 740 × 715 box (from 1400px) */
@media (min-width: 1400px) {
  .hero {
    grid-template-columns: 1fr 740px;
  }

  .hero__title {
    margin-top: 60px;
  }

  .hero-subjects {
    width: 740px;
    max-width: 100%;
    height: 715px;
  }

  .hero-subject--ukrainian-language {
    --photo-width: 125px;
    top: 40px;
    left: 140px;
  }

  .hero-subject--ukrainian-language .hero-subject__badge {
    right: 21px;
    bottom: 10px;
  }

  .hero-subject--biology {
    --photo-width: 145px;
    top: 300px;
  }

  .hero-subject--biology .hero-subject__badge {
    bottom: 20px;
    left: 120px;
  }

  .hero-subject--english {
    --photo-width: 157px;
    top: auto;
    bottom: 0;
    left: 114px;
  }

  .hero-subject--english .hero-subject__badge {
    right: auto;
    bottom: 16px;
    left: 52px;
  }

  .hero-subject--history {
    --photo-width: 228px;
    top: 172px;
    right: auto;
    left: 300px;
    width: 228px;
    margin: 0;
  }

  .hero-subject--history .hero-subject__badge {
    right: auto;
    bottom: 40px;
    left: 95px;
  }

  .hero-subject--geography {
    --photo-width: 155px;
    top: 230px;
  }

  .hero-subject--geography .hero-subject__badge {
    bottom: 16px;
    left: -38px;
  }

  .hero-subject--maths {
    --photo-width: 160px;
    top: auto;
    right: 16px;
    bottom: 24px;
  }

  .hero-subject--maths .hero-subject__badge {
    right: auto;
    bottom: 40px;
    left: -48px;
  }

  .hero-subject--chemistry {
    --photo-width: 155px;
    top: 15px;
    right: 30px;
  }

  .hero-subject--chemistry .hero-subject__badge {
    bottom: 16px;
    left: -38px;
  }

  .hero-subject--physics {
    --photo-width: 145px;
    top: -10px;
    right: 250px;
  }

  .hero-subject--physics .hero-subject__badge {
    bottom: 16px;
    left: -38px;
  }

  .hero-subject--ukrainian-literature {
    --photo-width: 136px;
    top: 565px;
    bottom: 0;
    left: 355px;
  }

  .hero-subject--ukrainian-literature .hero-subject__badge {
    bottom: -20px;
    left: 40px;
  }
}

/* ==========================================================================
   Why TURBO
   ========================================================================== */

.why__grid {
  display: grid;
  gap: var(--spacing-md);
}

.why__item {
  width: 100%;
  padding: var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-gray-light);
}

.why__stat {
  margin-bottom: var(--spacing-sm);
  font-size: var(--fs-header-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-base);
  color: var(--color-primary-600);
}

.why__title {
  margin-bottom: var(--spacing-sm);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi-bold);
  line-height: var(--lh-base);
  color: var(--color-black);
}

.why__text {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-gray);
}

@media (min-width: 768px) {
  .why__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas:
      "score    score"
      "students years"
      "platform atmosphere"
      "teachers format";
    gap: var(--spacing-lg);
  }

  .why__item {
    padding: var(--spacing-lg);
  }

  .why__item--score {
    grid-area: score;
  }
  .why__item--students {
    grid-area: students;
  }
  .why__item--years {
    grid-area: years;
  }
  .why__item--platform {
    grid-area: platform;
  }
  .why__item--atmosphere {
    grid-area: atmosphere;
  }
  .why__item--teachers {
    grid-area: teachers;
  }
  .why__item--format {
    grid-area: format;
  }

  .why__title {
    font-size: var(--fs-header-xs);
  }

  .why__text {
    font-size: var(--fs-md);
  }
}

@media (min-width: 1200px) {
  .why__grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
      "score    students   years"
      "platform atmosphere atmosphere"
      "platform teachers   format";
  }

  .why__item {
    padding: var(--spacing-xl);
  }

  /* The screenshot fills the bottom 460px of the card, scaled to fit */
  .why__item--platform {
    position: relative;
    padding-bottom: 460px;
  }

  .why__item--platform::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 460px;
    background: url("../../img/why/platform.webp") no-repeat bottom right /
      contain;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
  }

  .why__item--atmosphere {
    padding-bottom: 290px;
    background: var(--color-gray-light) url("../../img/why/atmosphere.webp")
      no-repeat bottom center / 80%;
  }
}

@media (min-width: 1400px) {
  .why__stat {
    margin-bottom: var(--spacing-md);
    font-size: var(--fs-header-xl);
    font-weight: var(--fw-semi-bold);
  }
}

/* ==========================================================================
   Courses — a swipeable row below 1200px, a mosaic grid from 1200px
   ========================================================================== */

/* ---------- Buttons above the row (below 1200px) ---------- */

.courses__tabs {
  display: grid;
  grid-template-areas:
    "t1 t1 t1 t2 t2 t2"
    "t3 t3 t4 t4 t5 t5"
    "t6 t6 t6 t6 t6 t6"
    "t7 t7 t7 t8 t8 t8";
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.courses__tab:nth-child(1) {
  grid-area: t1;
}
.courses__tab:nth-child(2) {
  grid-area: t2;
}
.courses__tab:nth-child(3) {
  grid-area: t3;
}
.courses__tab:nth-child(4) {
  grid-area: t4;
}
.courses__tab:nth-child(5) {
  grid-area: t5;
}
.courses__tab:nth-child(6) {
  grid-area: t6;
}
.courses__tab:nth-child(7) {
  grid-area: t7;
}
.courses__tab:nth-child(8) {
  grid-area: t8;
}

.courses__tab {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 44px;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-gray-stroke);
  border-radius: var(--border-radius-xl);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  text-align: center;
  color: var(--color-gray);
  background-color: var(--color-white);
}

.courses__tab.is-active {
  border-color: var(--color-primary-300);
  color: var(--color-black);
  background-color: var(--color-gray-light);
}

@media (hover: hover) and (pointer: fine) {
  .courses__tab:hover {
    border-color: var(--color-primary-300);
    color: var(--color-primary-600);
    background-color: var(--color-gray-light);
  }
}

/* ---------- The row ----------
   Runs to the right edge of the screen (negative margin = container padding);
   --per-view is how many cards fit, the fraction hints there is more. */

.courses__list {
  --per-view: 1.1;
  --gap: var(--spacing-md);

  position: relative; /* offsetParent for carousel.js */
  display: flex;
  gap: var(--gap);
  margin-right: calc(-1 * var(--spacing-container-sm));
  padding-right: var(--spacing-container-sm);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.courses__list::-webkit-scrollbar {
  display: none;
}

.courses__list > .course-card {
  flex: 0 0 calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
  scroll-snap-align: start;
}

@media (min-width: 576px) {
  .courses__tab {
    font-size: var(--fs-base);
  }
}

@media (min-width: 600px) {
  .courses__list {
    --per-view: 2.1;
  }
}

@media (min-width: 768px) {
  .courses__list {
    margin-right: calc(-1 * var(--spacing-container-md));
    padding-right: var(--spacing-container-md);
  }
}

@media (min-width: 900px) {
  .courses__list {
    --per-view: 3.1;
  }
}

@media (min-width: 992px) {
  .courses__list {
    margin-right: calc(-1 * var(--spacing-container-lg));
    padding-right: var(--spacing-container-lg);
  }
}

@media (min-width: 1200px) {
  .courses__tabs {
    display: none;
  }

  .courses__list {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-areas:
      "history   history   history   history   history   history   history   english   english   english   english   english"
      "biology   biology   biology   biology   maths     maths     maths     maths     geography geography geography geography"
      "ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian ukrainian"
      "chemistry chemistry chemistry chemistry chemistry physics   physics   physics   physics   physics   physics   physics";
    gap: var(--spacing-lg);
    margin-right: 0;
    padding-right: 0;
    overflow: visible;
  }

  .course-card--history {
    grid-area: history;
  }
  .course-card--english {
    grid-area: english;
  }
  .course-card--biology {
    grid-area: biology;
  }
  .course-card--maths {
    grid-area: maths;
  }
  .course-card--geography {
    grid-area: geography;
  }
  .course-card--ukrainian {
    grid-area: ukrainian;
  }
  .course-card--chemistry {
    grid-area: chemistry;
  }
  .course-card--physics {
    grid-area: physics;
  }
}

/* ---------- Course card ----------
   The teacher photo sits at the bottom (centred; bottom-right from 1200px),
   the bottom padding keeps the text clear of it. */

.course-card {
  --photo-height: 320px;

  position: relative;
  overflow: hidden;
  padding: var(--spacing-md) var(--spacing-md) 330px;
  border-radius: var(--border-radius-lg);
  background-color: var(--color-gray-light);
}

.course-card__photo {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: center;
  height: var(--photo-height);
  pointer-events: none;
}

.course-card__photo img {
  width: auto;
  max-width: none;
  height: 100%;
}

.course-card__content {
  position: relative;
}

.course-card__title {
  margin-bottom: var(--spacing-xs);
  font-size: var(--fs-header-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-base);
  color: var(--color-black);
}

.course-card__tutor {
  margin-bottom: var(--spacing-md);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi-bold);
  line-height: var(--lh-base);
  color: var(--color-black);
}

.course-card__description {
  margin-bottom: var(--spacing-md);
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-gray);
}

.course-card__rating {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.course-card__score {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-black);
}

.course-card__button {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: calc(100% - 48px);
  white-space: pre;
}

@media (min-width: 768px) {
  .course-card {
    padding: var(--spacing-lg) var(--spacing-lg) 330px;
  }
}

@media (min-width: 1200px) {
  .course-card {
    --photo-height: 346px;

    padding: var(--spacing-xl) var(--spacing-xl) 88px;
  }

  .course-card__photo {
    justify-content: flex-end;
  }

  .course-card__title {
    font-size: var(--fs-header-lg);
  }

  .course-card__tutor,
  .course-card__description {
    margin-bottom: var(--spacing-lg);
    font-size: var(--fs-md);
  }

  .course-card__rating {
    margin-bottom: var(--spacing-lg);
  }

  .course-card__score {
    font-size: var(--fs-md);
  }

  .course-card__button {
    bottom: 40px;
    left: 40px;
    width: 240px;
  }

  /* Per-card layout: room for the photo on the right / below */
  .course-card--history {
    padding-right: 360px;
  }

  .course-card--english,
  .course-card--chemistry {
    padding-right: 184px;
  }

  .course-card--physics {
    padding-right: 320px;
  }

  .course-card--biology,
  .course-card--maths,
  .course-card--geography {
    --photo-height: 320px;

    padding-bottom: 248px;
  }

  /* Wide card: photo on the left, text on the right */
  .course-card--ukrainian {
    --photo-height: 303px;

    padding-left: 320px;
  }

  .course-card--ukrainian .course-card__photo {
    justify-content: flex-start;
    padding-left: 50px;
  }

  .course-card--ukrainian .course-card__button {
    left: 320px;
  }
}

/* ==========================================================================
   Printed notes (promo)
   ========================================================================== */

.promo {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding: var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-blue-light);
}

.promo__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-lg);
  text-align: center;
}

.promo__text {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-black);
}

.promo__banner {
  width: 100%;
  overflow: hidden;
  border-radius: var(--border-radius-lg);
}

.promo__banner img {
  width: 100%;
}

@media (min-width: 992px) {
  .promo {
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
  }

  .promo__content {
    flex: 1;
    align-items: flex-start;
    text-align: left;
  }

  .promo__banner {
    flex: 1;
  }
}

@media (min-width: 1200px) {
  .promo__text {
    font-size: var(--fs-md);
  }
}

/* ==========================================================================
   Bonus content — dark card with social links, a preview and two numbers
   ========================================================================== */

.bonus {
  display: grid;
  gap: var(--spacing-lg);
  padding: var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-additional-blue-dark);
  background-image:
    url("../../img/backgrounds/grid.webp"),
    url("../../img/backgrounds/gradient-bonus.webp");
  background-repeat: no-repeat;
  background-position:
    top -100px center,
    bottom center;
  background-size:
    1000px auto,
    auto;
}

.bonus__intro {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.bonus__social {
  display: flex;
  gap: var(--spacing-md);
}

.bonus__social-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  transition: all var(--transition-base);
}

/* Brand colours of the networks */
.bonus__social-link--instagram {
  background: linear-gradient(
    -115.324deg,
    #d416c7 0%,
    #f1168b 52%,
    #ff7719 100%
  );
}

.bonus__social-link--youtube {
  background-color: #ff0032;
}

.bonus__social-link--tiktok {
  background-color: #291422;
}

.bonus__social-link--telegram {
  background-color: #23a2df;
}

@media (hover: hover) and (pointer: fine) {
  .bonus__social-link:hover {
    opacity: 0.7;
  }
}

/* The preview has its shadow baked in, so it is nudged up-left to line up */
.bonus__image {
  margin-top: -2.3%;
  margin-left: -2.3%;
}

.bonus__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-sm);
}

.bonus__stat {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-lg);
}

.bonus__stat--light {
  background-color: var(--color-blue-light);
}

.bonus__stat--blue {
  background-color: var(--color-primary-300);
}

.bonus__stat-value {
  font-size: var(--fs-header-md);
  font-weight: var(--fw-bold);
  color: var(--color-additional-blue-dark);
}

.bonus__stat-label {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-black);
}

.bonus__text {
  color: var(--color-white);
}

/* An empty line between paragraphs */
.bonus__text p + p {
  margin-top: 1lh;
}

@media (min-width: 768px) {
  .bonus__stats {
    gap: var(--spacing-md);
  }
}

@media (min-width: 992px) {
  .bonus {
    grid-template-columns: 310px 1fr;
    grid-template-areas:
      "intro info"
      "text  info";
    gap: var(--spacing-xl);
    padding: var(--spacing-lg);
    background-size: auto, auto;
  }

  .bonus__intro {
    grid-area: intro;
    gap: var(--spacing-xl);
  }

  .bonus__info {
    grid-area: info;
  }

  .bonus__text {
    grid-area: text;
  }

  .bonus__stats {
    gap: var(--spacing-lg);
  }
}

@media (min-width: 1200px) {
  .bonus {
    grid-template-columns: 410px 1fr;
    padding: var(--spacing-xl);
  }

  .bonus__stat {
    padding: var(--spacing-xl);
  }

  .bonus__stat-value {
    font-size: var(--fs-header-xxl);
  }

  .bonus__stat-label {
    font-size: var(--fs-md);
  }
}

/* ==========================================================================
   Free topics — cards that open the sign-up modal.
   From 992px the cards stand in one row as tall photos; the hovered one widens.
   ========================================================================== */

.free-courses__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.free-course {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.free-course__image {
  position: relative;
  display: block;
  overflow: hidden;
  margin-bottom: var(--spacing-sm);
  border-radius: var(--border-radius-lg);
  background-size: cover;
}

/* Dark veil over the photo */
.free-course__image::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgb(6 38 74 / 20%); /* --color-primary-950 @ 20% */
}

.free-course__image img {
  width: 100%;
}

.free-course__subject,
.free-course__title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.free-course__subject {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-gray);
}

.free-course__title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semi-bold);
  line-height: var(--lh-base);
  color: var(--color-black);
}

.free-courses__action {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 768px) {
  .free-courses__list {
    grid-template-columns: repeat(3, 1fr);
  }

  .free-courses__action {
    flex-direction: row;
  }
}

@media (min-width: 992px) {
  .free-courses__list {
    display: flex;
    justify-content: space-between;
    gap: 0;
    width: calc(100% + 8px);
    margin: 0 calc(-1 * var(--spacing-xs)) var(--spacing-xl);
  }

  /* Transparent side borders make the gaps and widen with the card */
  .free-course {
    flex: 1 1 100%;
    width: 0;
    border-inline: var(--spacing-xs) solid transparent;
    transition: all 0.4s ease-in-out;
  }

  .free-course:hover {
    flex-basis: 200%;
  }

  .free-course__image {
    height: 600px;
    margin-bottom: var(--spacing-md);
    background-position: top center;
    background-repeat: no-repeat;
  }

  .free-course__image::after {
    background-color: rgb(6 38 74 / 50%);
    transition: all 0.4s ease-in-out;
  }

  .free-course:hover .free-course__image::after {
    opacity: 0;
  }

  .free-course__image img {
    display: none;
  }

  .free-course__subject {
    margin-bottom: var(--spacing-xs);
    font-size: var(--fs-md);
  }

  .free-course__title {
    font-size: var(--fs-header-xs);
  }

  .free-course--history .free-course__image {
    background-color: var(--color-history);
    background-image: url("../../img/free-courses/history.webp");
  }

  .free-course--ukrainian-language .free-course__image {
    background-color: var(--color-ukrainian);
    background-image: url("../../img/free-courses/ukrainian-language.webp");
  }

  .free-course--ukrainian-literature .free-course__image {
    background-color: var(--color-literature);
    background-image: url("../../img/free-courses/ukrainian-literature.webp");
  }

  .free-course--english .free-course__image {
    background-color: var(--color-english);
    background-image: url("../../img/free-courses/english.webp");
  }

  .free-course--biology .free-course__image {
    background-color: var(--color-biology);
    background-image: url("../../img/free-courses/biology.webp");
  }

  .free-course--maths .free-course__image {
    background-color: var(--color-maths);
    background-image: url("../../img/free-courses/maths.webp");
  }

  .free-course--geography .free-course__image {
    background-color: var(--color-geography);
    background-image: url("../../img/free-courses/geography.webp");
  }

  .free-course--chemistry .free-course__image {
    background-color: var(--color-chemistry);
    background-image: url("../../img/free-courses/chemistry.webp");
  }

  .free-course--physics .free-course__image {
    background-color: var(--color-physics);
    background-image: url("../../img/free-courses/physics.webp");
  }
}

@media (min-width: 1200px) {
  .free-courses__list {
    width: calc(100% + 16px);
    margin-inline: calc(-1 * var(--spacing-sm));
  }

  .free-course {
    border-inline-width: var(--spacing-sm);
  }

  .free-course:hover {
    flex-basis: 150%;
  }
}

/* ---------- Sign-up modal content ---------- */

.free-courses-modal__text {
  line-height: var(--lh-large);
}

.free-courses-modal__form,
.free-courses-modal__policy {
  margin-top: var(--spacing-lg);
}

/* ==========================================================================
   On the course — two columns of ticked points
   ========================================================================== */

.included__columns {
  display: grid;
  gap: var(--spacing-md);
}

.included__list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.included__item {
  display: flex;
  gap: var(--spacing-sm);
}

.included__icon {
  flex: none;
  display: flex;
  align-items: center;
  height: calc(var(--fs-base) * var(--lh-large));
}

.included__text {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
}

@media (min-width: 768px) {
  .included__icon {
    height: calc(var(--fs-md) * var(--lh-large));
  }

  .included__text {
    font-size: var(--fs-md);
  }
}

@media (min-width: 992px) {
  .included__columns {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
  }

  .included__list {
    gap: var(--spacing-lg);
  }
}

/* ==========================================================================
   Reviews — a quote card above a row of photos; the centred photo is active
   ========================================================================== */

/* Full-bleed below 992px: the row runs from one screen edge to the other.
   It is also the size container for the row (cqw units below). */
.reviews__carousel {
  container-type: inline-size;
  margin-inline: calc(-1 * var(--spacing-container-sm));
}

.reviews__card {
  padding-inline: var(--spacing-container-sm);
}

.review-card {
  position: relative;
  margin-bottom: 32px; /* room for the pointer */
  padding: var(--spacing-lg) var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-gray-light);
}

/* Pointer towards the photos */
.review-card::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 20px;
  height: 20px;
  background-color: var(--color-gray-light);
  transform: translate(-50%, 50%) rotate(45deg);
}

.review-card__quote {
  position: relative;
  margin-bottom: var(--spacing-md);
  padding-left: 56px;
}

/* Big blue quotation marks (the closing one from 992px) */
.review-card__quote::before,
.review-card__quote::after {
  position: absolute;
  top: -18px;
  font-size: 120px;
  line-height: 1;
  color: var(--color-primary);
}

.review-card__quote::before {
  content: "“";
  left: 0;
}

.review-card__quote::after {
  content: "”";
  right: 0;
  display: none;
}

.review-card__text {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  white-space: pre-line;
}

.review-card__author {
  margin-bottom: var(--spacing-xs);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi-bold);
  line-height: var(--lh-base);
  text-align: end;
}

.review-card__date {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-large);
  text-align: end;
}

/* ---------- The row of photos ----------
   --per-view photos fit the row; the side padding lets the first and the
   last photo reach the middle. */

.reviews__track {
  --per-view: 4;
  --slide: calc(100cqw / var(--per-view));

  position: relative; /* offsetParent for carousel.js */
  display: flex;
  padding-inline: calc(50cqw - var(--slide) / 2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.reviews__track::-webkit-scrollbar {
  display: none;
}

.reviews__slide {
  display: flex;
  flex: 0 0 var(--slide);
  justify-content: center;
  align-items: center;
  scroll-snap-align: center;
}

.reviews__avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  width: 48px;
  height: 80px;
  opacity: 0.8;
  transition: all var(--transition-base);
}

.reviews__slide.is-active .reviews__avatar {
  width: 80px;
  opacity: 1;
}

.reviews__avatar img {
  width: 100%;
  border: 1px solid var(--color-gray-stroke);
  border-radius: 50%;
}

@media (min-width: 410px) {
  .reviews__track {
    --per-view: 6;
  }
}

@media (min-width: 600px) {
  .reviews__track {
    --per-view: 8;
  }
}

@media (min-width: 750px) {
  .reviews__track {
    --per-view: 10;
  }
}

@media (min-width: 768px) {
  .reviews__carousel {
    margin-inline: calc(-1 * var(--spacing-container-md));
  }

  .reviews__card {
    padding-inline: var(--spacing-container-md);
  }

  .review-card {
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-lg);
  }

  .review-card__text {
    font-size: var(--fs-md);
  }
}

@media (min-width: 900px) {
  .reviews__track {
    --per-view: 12;
  }
}

@media (min-width: 992px) {
  .reviews__carousel {
    margin-inline: 0;
  }

  .reviews__card {
    padding-inline: 0;
  }

  .review-card::after {
    width: 40px;
    height: 40px;
  }

  .review-card__quote {
    margin-bottom: var(--spacing-lg);
    padding: 0 64px;
  }

  .review-card__quote::before,
  .review-card__quote::after {
    top: -30px;
    font-size: 136px;
  }

  .review-card__quote::after {
    display: block;
  }

  .review-card__author {
    font-size: var(--fs-md);
  }

  .review-card__date {
    font-size: var(--fs-sm);
  }
}

@media (min-width: 1100px) {
  .reviews__track {
    --per-view: 16;
  }
}

@media (min-width: 1200px) {
  .review-card {
    padding: var(--spacing-xl);
  }
}

/* ==========================================================================
   Action plan — a flow of steps joined by arrows
   ========================================================================== */

.plan__flow {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-blue-light);
}

/* ---------- Step card ---------- */

.plan-step {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-white);
}

.plan-step__title {
  margin-bottom: var(--spacing-sm);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi-bold);
  line-height: var(--lh-base);
}

.plan-step__text {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-gray);
}

/* Steps with a picture on the left */
.plan-step--icon {
  padding-left: 88px;
}

.plan-step--icon::before {
  content: "";
  position: absolute;
  top: 24px;
  left: 24px;
  width: 40px;
  height: 40px;
  background: no-repeat center / contain;
}

.plan-step--hand::before {
  background-image: url("../../img/plan/hand.webp");
}

.plan-step--rocket::before {
  background-image: url("../../img/plan/rocket.webp");
}

.plan-step--cup::before {
  background-image: url("../../img/plan/cup.webp");
}

/* ---------- Connectors ---------- */

/* A dot with an arrow under it, between two steps */
.plan__arrow {
  position: relative;
  height: 76px;
}

/* The wrapper is 0px wide, so the base `img { max-width: 100% }` would
   shrink these to nothing */
.plan__arrow-dot,
.plan__arrow-line {
  position: absolute;
  left: 50%;
  max-width: none;
  transform: translateX(-50%);
}

.plan__arrow-dot {
  top: -8px;
}

.plan__arrow-line {
  top: 8px;
}

/* The long one shares a row with the yellow note (see .plan__result) and
   stretches with it: the line is a background, the head sits at the bottom.
   It runs down the left side on phones. */
.plan__arrow--long {
  width: 100%;
  height: auto;
  min-height: 234px;
}

.plan__arrow--long::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 0;
  left: 36px;
  width: 16px;
  background:
    url("../../icons/arrow-short.svg") no-repeat center bottom / 16px 65px,
    linear-gradient(var(--color-primary), var(--color-primary)) no-repeat
      center top / 2px 100%;
  transform: translateX(-50%);
}

.plan__arrow--long .plan__arrow-dot {
  left: 36px;
}

/* ---------- Groups ---------- */

/* Dashed box: notes + lectures + tests */
.plan__group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
  padding: var(--spacing-lg);
  border: 2px dashed var(--color-primary);
  border-radius: var(--border-radius-lg);
}

/* Puzzle piece stuck to the corner of the "Tests" step */
.plan__puzzle {
  position: relative;
  display: flex;
}

.plan__puzzle::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  z-index: var(--ui-index-1);
  width: 40px;
  height: 40px;
  background: url("../../img/plan/puzzle.webp") no-repeat center / contain;
  transform: translate(50%, -50%);
}

/* Blue frame around the platform step */
.plan__highlight {
  border: 3px solid var(--color-primary);
  border-radius: var(--border-radius-lg);
}

/* The long arrow and the yellow note share the first row, so the row grows
   with the note and nothing overlaps; the result step comes under them */
.plan__result {
  display: grid;
  width: 100%;
}

.plan__result > .plan__arrow--long,
.plan-help {
  grid-area: 1 / 1;
}

.plan__final {
  position: relative;
}

.plan__curve {
  display: none;
}

/* ---------- Yellow "support" note ----------
   Sits on the right of the long arrow, right above the result step. On phones
   its own short arrow points down to the step, from 768px the curved one. */

.plan-help {
  position: relative;
  z-index: var(--ui-index-1);
  justify-self: end;
  align-self: end;
  width: clamp(250px, 50%, 325px);
  margin-top: var(--spacing-md);
}

.plan-help::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  width: 24px;
  height: 24px;
  background: url("../../img/plan/smile-small.webp") no-repeat center / contain;
}

.plan-help__card {
  margin-bottom: calc(-1 * var(--spacing-sm));
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-yellow);
}

.plan-help__title {
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-lg);
  font-size: var(--fs-base);
  font-weight: var(--fw-semi-bold);
  line-height: var(--lh-base);
  color: var(--color-primary-800);
}

.plan-help__text {
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--color-primary-800);
}

@media (min-width: 768px) {
  .plan__flow {
    padding: var(--spacing-xl);
  }

  .plan-step {
    max-width: 448px;
    padding: var(--spacing-lg);
  }

  .plan-step__title {
    font-size: var(--fs-header-xs);
  }

  .plan-step--icon {
    padding-left: 104px;
  }

  .plan-step--icon::before {
    top: 32px;
    left: 32px;
  }

  .plan__group {
    padding: var(--spacing-xl);
  }

  .plan__highlight {
    max-width: 384px;
  }

  .plan__arrow--long .plan__arrow-dot,
  .plan__arrow--long::after {
    left: 50%;
  }

  .plan__final {
    justify-self: center;
  }

  .plan__curve {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    transform: translate(90%, -50%) rotate(-15deg);
  }

  /* Reaches into the flow padding; the curved arrow starts under its bottom */
  .plan-help {
    margin-right: -32px;
    margin-bottom: 56px;
  }

  .plan-help .plan__arrow {
    display: none;
  }

  .plan-help::before {
    top: 32px;
    left: 32px;
    width: 40px;
    height: 40px;
    background-image: url("../../img/plan/smile.webp");
  }

  .plan-help__card {
    margin-bottom: 0;
  }

  .plan-help__title {
    padding-left: 72px;
    font-size: var(--fs-header-xs);
  }

  .plan-help__text {
    padding-left: 72px;
  }
}

@media (min-width: 992px) {
  /* Three steps in a row only from here: narrower, the texts overflow */
  .plan__group {
    flex-direction: row;
    align-items: stretch;
    gap: var(--spacing-sm);
  }

  .plan__group > .plan-step,
  .plan__group > .plan__puzzle {
    width: calc(33% - 28px);
  }

  .plan__group > img {
    align-self: center;
  }

  .plan__curve {
    transform: translate(105%, -50%) rotate(0);
  }

  .plan-help {
    margin-right: 0;
  }
}

@media (min-width: 1200px) {
  .plan-help {
    margin-right: 10%;
  }
}

/* ==========================================================================
   Have questions? — dark card with the contact form
   ========================================================================== */

.questions {
  display: flex;
  flex-direction: column;
  row-gap: var(--spacing-xl);
  padding: var(--spacing-md);
  border-radius: var(--border-radius-lg);
  background-color: var(--color-additional-blue-dark);
  background-image:
    url("../../img/backgrounds/grid.webp"),
    url("../../img/backgrounds/gradient.webp");
  background-repeat: no-repeat;
  background-position:
    top -100px center,
    bottom center;
  background-size:
    1000px auto,
    auto;
}

.questions__intro {
  display: flex;
  flex-direction: column;
  row-gap: var(--spacing-lg);
}

.questions__points {
  display: flex;
  flex-direction: column;
  row-gap: var(--spacing-md);
  color: var(--color-white);
}

.questions__point {
  display: flex;
  align-items: flex-start;
  column-gap: var(--spacing-sm);
  font-size: var(--fs-base);
  line-height: var(--lh-large);
}

.questions__point img {
  flex-shrink: 0;
}

.questions__form {
  position: relative;
  display: grid;
  row-gap: var(--spacing-lg);
}

/* Hand-written note with an arrow pointing at the form (from 1400px) */
.questions__note {
  display: none;
}

@media (min-width: 768px) {
  .questions__point {
    font-size: var(--fs-md);
  }
}

@media (min-width: 992px) {
  .questions {
    position: relative;
    flex-direction: row;
    justify-content: space-between;
    column-gap: var(--spacing-lg);
    padding: var(--spacing-lg);
    background-size: auto, auto;
  }

  .questions__intro {
    max-height: 300px;
  }

  .questions__points {
    margin-top: auto;
  }

  .questions__form {
    flex: 0 1 400px;
  }
}

@media (min-width: 1200px) {
  .questions {
    padding: var(--spacing-xl);
  }

  .questions__form {
    flex-basis: 480px;
  }
}

@media (min-width: 1400px) {
  .questions__form {
    flex-basis: 500px;
  }

  .questions__note {
    position: absolute;
    top: 46%;
    left: -200px;
    display: block;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--color-white);
    transform: translate(-50%, -50%) rotate(-11deg);
  }

  .questions__note::after {
    content: url("../../icons/arrow-contact.svg");
    position: absolute;
    top: 50px;
    left: 80px;
    transform: rotate(11deg);
  }
}

/* ==========================================================================
   Sign-up modal: the code step and the final step. Their markup is
   commented out in index.html until the forms are connected to the backend.
   ========================================================================== */

.code-step,
.code-step__intro,
.done-step {
  display: grid;
  row-gap: var(--spacing-lg);
}

.code-step__email {
  overflow: hidden;
  width: 100%;
  max-width: 300px;
  font-weight: var(--fw-semi-bold);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.code-step__change {
  padding: 0;
}

.code-step__form .field,
.code-step__form .btn {
  margin-bottom: var(--spacing-lg);
}

.code-step__timer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xs);
}

.code-step__no-code {
  font-size: var(--fs-base);
  line-height: var(--lh-large);
  color: var(--color-gray);
}

.code-step__timer {
  padding: 0 var(--spacing-xs);
  font-size: var(--fs-md);
  line-height: var(--lh-large);
  color: var(--color-gray-disabled);
}

.code-step__resend {
  padding-inline: 0;
  background-color: transparent;
}

@media (min-width: 768px) {
  .code-step__email-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .code-step__email {
    max-width: 200px;
  }

  .code-step__change {
    padding: var(--spacing-xs) var(--spacing-md);
  }
}

/* The code button is small below 992px and large from 992px */
@media (min-width: 992px) {
  .code-step__submit {
    height: 64px;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--fs-md);
    font-weight: var(--fw-semi-bold);
  }
}
