:root {
  --color-accent: #d9563a;
  --color-dark: #130606;
  --color-light: #ededed;
  --color-muted: #747578;

  --shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);

  --padding-x: clamp(1.25rem, -0.5106rem + 7.5117vw, 6.25rem);
  --padding-top-section: clamp(5rem, 4.0317rem + 4.1315vw, 7.75rem);

  --fs-h2: clamp(2rem, 1.6479rem + 1.5023vw, 3rem);
  --fs-h3: clamp(1.25rem, 1.0739rem + 0.7512vw, 1.75rem);
  --fs-body: clamp(0.875rem, 0.743rem + 0.5634vw, 1.25rem);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

img {
  max-width: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
}

header {
  padding-top: 1.5rem;
  padding-left: var(--padding-x);
  padding-right: var(--padding-x);
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
}

nav .home {
  margin-right: auto;
}

.home a {
  height: 60px;
}

.home a img {
  height: 60px;
  width: auto;
}

nav a {
  color: var(--color-dark);
  display: flex;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

.contacts-link {
  margin-right: min(3.5em, 2%);
}

.nav-hamburger-item {
  display: none;
}

.nav-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--color-dark);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

nav.open .nav-hamburger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
nav.open .nav-hamburger span:nth-child(2) {
  opacity: 0;
}
nav.open .nav-hamburger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: var(--color-dark);
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dropdown-toggle:hover {
  text-decoration: underline;
}

.dropdown-toggle::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-bottom: 3px;
  transition: transform 0.2s, margin-bottom 0.2s;
}

.dropdown.open .dropdown-toggle::after {
  transform: rotate(-135deg);
  margin-bottom: -3px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1.5px solid #d0d0d0;
  border-radius: 12px;
  box-shadow: var(--shadow);
  list-style: none;
  padding: 8px 0;
  z-index: 200;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  padding: 10px 20px;
  white-space: nowrap;
}

.header-link {
  min-width: 0;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
}

.hero {
  text-align: center;
  align-content: center;
  font-size: clamp(1.875rem, 1.1268rem + 3.1925vw, 4rem);
  font-weight: 500;
}

.hero-text {
  padding-right: clamp(1.25rem, -2.8213rem + 17.3709vw, 12.8125rem);
  padding-left: clamp(1.25rem, -2.8213rem + 17.3709vw, 12.8125rem);
  padding-top: var(--padding-top-section);
}

.hero-desktop {
  width: 100%;
  max-width: 1400px;
  padding-top: 60px;
  padding-bottom: 60px;
}

.hero-mobile {
  padding-top: 20px;
  padding-bottom: 20px;
  display: none;
  margin-left: auto;
  margin-right: auto;
}

.accent {
  color: var(--color-accent);
}

.accent-link {
  background-color: var(--color-accent);
  border-radius: 15px;
  padding-top: min(1em, 3%);
  padding-bottom: min(1em, 3%);
  padding-right: min(2em, 6%);
  padding-left: min(2em, 6%);
}

.accent-link a {
  color: #ffffff;
}

.about {
  min-height: 700px;
  border-radius: 100px 100px 0 0;
  background-color: var(--color-light);
  display: grid;
  grid-template-columns: auto auto;
  padding-top: var(--padding-top-section);
  padding-left: var(--padding-x);
  padding-right: var(--padding-x);
}

.about-text {
  color: var(--color-dark);
  padding-right: 6.5rem;
  max-width: 54rem;
}

.about-text-header {
  font-weight: 500;
  font-size: var(--fs-h2);
  line-height: 4rem;
}

.about-text-text {
  padding-top: clamp(3.375rem, 1rem, 5rem);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 2rem;
}

.about-text-paragraph {
  color: var(--color-dark);
  line-height: 1.5rem;
  font-weight: 400;
  margin-bottom: 15px;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  padding-top: clamp(2.25rem, 1.8979rem + 1.5023vw, 3.25rem);
  padding-bottom: clamp(2.25rem, 1.8979rem + 1.5023vw, 3.25rem);
  padding-right: clamp(2rem, 1.8239rem + 0.7512vw, 2.5rem);
  padding-left: clamp(2rem, 1.8239rem + 0.7512vw, 2.5rem);
  background: #ffffff;
  box-shadow: var(--shadow);
  border-radius: 30px;
  width: clamp(20rem, 16.0387rem + 16.9014vw, 31.25rem);
  height: clamp(27.5rem, 26.3996rem + 4.6948vw, 30.625rem);
}

.card-text {
  font-weight: 700;
  font-size: var(--fs-h3);
  line-height: 100%;
  color: var(--color-dark);
}

.card-text-header {
  padding-bottom: clamp(1.25rem, 1.162rem + 0.3756vw, 1.5rem);
}

.card-text-text {
  font-weight: 400;
  font-size: clamp(0.875rem, 0.831rem + 0.1878vw, 1rem);
  line-height: 150%;
}

.card-buttons {
  padding-top: 40px;
  padding-bottom: 10px;
  cursor: default;
}

.card-button {
  background: #ffffff;
  box-shadow: var(--shadow);
  border-radius: 8px;
  color: var(--color-dark);
  padding: 8px 14px;
  display: inline-block;
  cursor: pointer;
  user-select: none;
}

.second-card-button {
  margin-left: 8px;
}

.fade {
  animation-name: fade;
  animation-duration: 1.5s;
}

@keyframes fade {
  from {
    opacity: 0.4;
  }
  to {
    opacity: 1;
  }
}

.goal {
  height: 1190px;
}

.goal-text {
  position: relative;
  min-height: 431px;
  background: var(--color-light);
  border-radius: 0 0 100px 100px;
  z-index: 100;
  color: var(--color-muted);
  text-align: center;
  align-content: center;
}

.goal-text-header {
  font-weight: 500;
  font-size: clamp(0.875rem, 0.6549rem + 0.939vw, 1.5rem);
  line-height: 100%;
  border: 1px solid var(--color-muted);
  border-radius: 20px;
  padding: 20px 32px;
  display: inline;
}

.goal-text-text {
  font-weight: 300;
  font-size: var(--fs-h2);
  line-height: 100%;
  padding-top: clamp(3.75rem, 3.4859rem + 1.1268vw, 4.5rem);
  padding-right: clamp(1.25rem, -2.8213rem + 17.3709vw, 12.8125rem);
  padding-left: clamp(1.25rem, -2.8213rem + 17.3709vw, 12.8125rem);
}

.splash {
  position: relative;
  height: 942px;
  top: -95px;
  background: url(splash.jpg) center / cover;
  z-index: 0;
}

.how-it-works {
  background-color: var(--color-dark);
  height: 800px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.gradient-top {
  background: linear-gradient(180deg, var(--color-dark) 4.03%, rgba(6, 8, 2, 0) 100%);
  width: 100%;
  height: 124px;
  position: absolute;
}

.gradient-bottom {
  position: absolute;
  width: 100%;
  height: 124px;
  bottom: 0;
  background: linear-gradient(0deg, var(--color-dark) 4.03%, rgba(6, 8, 2, 0) 100%);
}

.how-text {
  color: var(--color-light);
  padding-top: var(--padding-top-section);
  padding-left: var(--padding-x);
  padding-right: var(--padding-x);
}

.how-text-header {
  font-weight: 500;
  font-size: var(--fs-h2);
  line-height: 100%;
}

.how-text-p {
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 150%;
  padding-top: 20px;
}

.how-text-header + .how-text-p {
  padding-top: 80px;
}

.how-cards-container {
  overflow: auto;
  padding-top: 20px;
  padding-bottom: 20px;
  padding-right: var(--padding-x);
  gap: 20px;
  display: flex;
  flex-direction: column;
}

.how-card {
  display: flex;
  align-items: center;
  gap: 33px;
}

.how-card-text {
  border: 1px solid var(--color-muted);
  box-shadow: 0px 2px 4px 0px #00000033;
  color: var(--color-muted);
  border-radius: 30px;
  padding: 52px 40px;
}

.how-card-text p:nth-child(1) {
  font-weight: 700;
  font-size: var(--fs-h3);
}

.how-card-text p:nth-child(2) {
  margin-top: 24px;
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: 150%;
}

.universities {
  min-height: 540px;
  background-color: var(--color-dark);
  padding: 100px;
}

.uni-wrapper {
  border: 1px solid;
  border-radius: 30px;
  border-image-source: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    var(--color-muted) 100%
  );
  border-image-slice: 1;
  box-shadow: 0px 2px 4px 0px #00000033;
  display: flex;
  gap: 60px;
  padding: 52px 40px;
}

.uni-text {
  font-weight: 400;
  font-size: 24px;
  line-height: 150%;
  color: var(--color-light);
}

.uni-text-two {
  padding-top: 20px;
  font-weight: 600;
}

.support {
  min-height: 750px;
  background-color: #ffffff;
  padding-top: var(--padding-top-section);
  padding-bottom: clamp(2.25rem, 3.6092rem + 11.2676vw, 6.75rem);
  padding-left: clamp(1.5625rem, -0.088rem + 7.0423vw, 6.25rem);
  padding-right: clamp(1.5625rem, -0.088rem + 7.0423vw, 6.25rem);
  display: flex;
}

.support-wrapper {
  background-color: var(--color-accent);
  box-shadow: var(--shadow);
  border-radius: 30px;
  align-content: center;
  text-align: center;
  flex-grow: 1;
  color: var(--color-light);
}

.support-wrapper p {
  padding: 32px 0 74px 0;
  font-weight: 500;
  font-size: clamp(2rem, 1.2958rem + 3.0047vw, 4rem);
  line-height: 100%;
}

.support-index-btn ul {
  list-style: none;
  display: flex;
  justify-content: space-evenly;
  font-size: 150%;
}

.support-index-btn ul li {
  width: 300px;
  height: 73px;
  border: 1px solid #ffffff;
  border-radius: 15px;
  align-content: center;
}

.support-index-btn a {
  color: inherit;
  text-decoration: none;
}

.support-index-btn a:hover {
  text-decoration: underline;
}

.footer {
  min-height: 150px;
  display: flex;
  justify-content: space-between;
  gap: 35px;
  align-items: flex-start;
  padding-left: var(--padding-x);
  padding-right: var(--padding-x);
  padding-bottom: 20px;
}

.logo-social {
  display: flex;
  align-items: center;
  gap: 24px;
}

.about-cards {
  margin-left: auto;
}

.concept {
  padding: 50px 100px;
}

.social-links {
  display: flex;
  gap: 20px;
}

.legal {
  font-size: 95%;
}

.legal p + p {
  margin-top: 10px;
}

.pre-line-text {
  white-space: pre-line;
}

.scroll-top {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-dark);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-top::after {
  content: '';
  display: block;
  width: 10px;
  height: 10px;
  border-left: 2px solid #ffffff;
  border-top: 2px solid #ffffff;
  transform: rotate(45deg);
  margin-top: 4px;
}

@media (max-width: 500px) {
  .scroll-top {
    display: flex;
  }
}

@media (max-width: 900px) {
  .about {
    display: flex;
    flex-direction: column;
  }

  .about-text {
    padding-right: 0;
  }

  .about-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: clamp(3.375rem, 1.5rem + 8vw, 6rem);
    padding-bottom: 1rem;
    margin-left: 0;
  }

  .how-it-works {
    display: flex;
    flex-direction: column;
    height: auto;
    padding-bottom: 60px;
  }

  .how-cards-container {
    flex-direction: row;
    padding: 40px;
  }

  .how-card {
    flex-direction: column;
    min-width: 350px;
  }

  .how-card-text {
    min-height: 270px;
  }

  .how-card img {
    max-width: fit-content;
    align-self: center;
  }

  .uni-svg {
    display: none;
  }

  .buttons ul {
    flex-direction: column;
    align-items: center;
  }

  .buttons ul li {
    margin-bottom: 30px;
  }
}

@media (max-width: 600px) {
  /* Goal — remove hardcoded heights */
  .goal {
    height: auto;
  }

  .goal-text {
    min-height: auto;
    padding: 60px var(--padding-x);
    border-radius: 0 0 50px 50px;
  }

  .splash {
    height: 260px;
    top: 0;
  }

  /* How-it-works cards — back to vertical stack */
  .how-cards-container {
    flex-direction: column;
    overflow: visible;
    padding: 24px var(--padding-x);
  }

  .how-card {
    flex-direction: row;
    min-width: 0;
  }

  .how-card-text {
    padding: 20px 24px;
    min-height: 0;
  }

  /* Universities */
  .universities {
    padding: 48px var(--padding-x);
  }

  .uni-text {
    font-size: var(--fs-body);
  }

  /* Concept / Legal pages */
  .concept {
    padding: 40px var(--padding-x);
  }

  /* Footer */
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  /* Support buttons */
  .support-index-btn ul {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .support-index-btn ul li {
    width: 100%;
    max-width: 300px;
    margin-bottom: 0;
    padding: 0 20px;
  }
}

@media (max-width: 500px) {
  /* Hero image swap */
  .hero-desktop {
    display: none;
  }

  .hero-mobile {
    display: block;
  }

  /* About — smaller corner radius */
  .about {
    border-radius: 40px 40px 0 0;
  }

  .card {
    width: 100%;
  }

  /* Hamburger nav */
  header {
    background: #ffffff;
    position: relative;
    z-index: 100;
  }

  .nav-hamburger-item {
    display: flex;
    align-items: center;
  }

  .contacts-link,
  .accent-link {
    display: none;
  }

  nav.open ul {
    flex-wrap: wrap;
    padding-bottom: 12px;
  }

  /* "Падтрымаць" — flat item */
  nav.open .accent-link {
    display: flex;
    align-items: center;
    width: 100%;
    margin-right: 0;
    padding: 14px 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: none;
    border-radius: 0;
  }

  nav.open .accent-link a {
    color: var(--color-dark);
  }

  /* Dropdown — "Аб фондзе" toggle as full-width item, sub-items stack inline below */
  nav.open .contacts-link.dropdown {
    display: block;
    width: 100%;
    margin-right: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  nav.open .dropdown-toggle {
    width: auto;
    padding: 14px 0;
    justify-content: flex-start;
  }

  nav.open .dropdown .dropdown-menu {
    position: static;
    border: none;
    box-shadow: none;
    padding: 0 0 8px 16px;
    border-radius: 0;
    width: 100%;
  }

  nav.open .dropdown-menu a {
    display: flex;
    padding: 10px 0;
  }
}
