/* Секции */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  overflow: hidden;
}

.video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  will-change: transform;
  transition: transform 0.1s ease-out;
}

.video-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(29, 30, 34, 0.5);
  z-index: 1;
}

.hero-content {
  position: relative;
  top: 0;
  z-index: 2;
  width: 100%;
  max-width: 800px;
  margin-inline: auto;
  padding-inline: max(20px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  will-change: transform;
}

.hero-title {
  width: 100%;
  margin: 0;
}

.hero-title__static,
.hero-title__dynamic {
  text-align: center;
}

.hero-content h1 {
  margin-bottom: 20px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-title__static {
  display: block;
  margin-bottom: 0.01em;
}

.hero-title__dynamic {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  width: 100%;
  min-height: 1.1em;
  margin-top: 0.01em;
}

.hero-title__dynamic .typed-text,
.hero-title__dynamic .cursor {
  display: inline-block;
}

.hero-content p {
  font-size: 1.2rem;
  margin-bottom: 30px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.hero-content h1 {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  line-height: 1.1;
}

.hero-content p {
  font-size: 1.2rem;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
  max-width: 36rem;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.hero-content .cta-button {
  margin-left: auto;
  margin-right: auto;
}

.video-overlay {
  background: linear-gradient(to bottom, 
    rgba(29, 30, 34, 0.7) 0%, 
    rgba(29, 30, 34, 0.3) 50%,
    rgba(29, 30, 34, 0.7) 100%);
}

/* Эффект печатной машинки */
.cursor {
    display: inline-block;
    width: 3px;
    background-color: var(--bee-yellow);
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.typed-text {
    color: var(--bee-yellow);
}

.scroll-arrow {
  position: absolute;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 60px;
  cursor: pointer;
  opacity: 0;
  animation: fadeIn 1s ease forwards 1.8s, bounce 2s infinite;
  z-index: 5;
  text-align: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.backstage-title {
  position: relative;
  font-size: clamp(3rem, 10vw, 8rem);
  text-align: center;
  color: var(--bee-yellow);
  margin-bottom: 10px;
  margin-top: -35px;
  z-index: 5;
  text-transform: capitalize;
  font-weight: 700;
  letter-spacing: 0.2em;
  opacity: 0.9;
}

.scroll-arrow i,
.scroll-arrow__icon {
  font-size: 2.5rem;
  color: rgba(255,255,255,0.8);
  transition: all 0.3s ease;
}

.scroll-arrow:hover i,
.scroll-arrow:hover .scroll-arrow__icon {
  color: white;
  transform: scale(1.1);
}

.portfolio {
  position: relative;
  z-index: 2;
  margin-top: -190px;
  padding-top: 170px;
  background: var(--darker-slate);
  clip-path: polygon(
    0 90px,
    100% 0px,
    100% 100%,
    0 100%
  );
}

.portfolio-section {
  position: relative;
  padding: -50px 0;
  background: var(--darker-slate);
}

/* Общий контейнер для заголовка «ПОРТФОЛИО» и жёлтой секции с роликами — один transform при скролле */
.portfolio-overlap-stack {
  position: relative;
  z-index: 12;
  will-change: transform;
}

.portfolio-header {
  text-align: center;
  margin-bottom: -130px;
  padding: 0 20px;
}

.portfolio-title {
  font-size: clamp(1.25rem, 4.5vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bee-yellow);
  margin-bottom: 20px;
  line-height: 1.2;
}

.portfolio-subtitle {
  font-size: 1.2rem;
  color: var(--silver-fox);
  max-width: 700px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

.portfolio-divider {
  width: 100px;
  height: 3px;
  background: var(--bee-yellow);
  margin: 0 auto;
  position: relative;
}

.portfolio-divider::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--bee-yellow);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.portfolio-main-text-section {
  text-align: center;
  padding: 0 clamp(28px, 7vw, 120px) clamp(32px, 5vw, 64px);
  z-index: 1;
  position: relative;
  background: rgba(254, 218, 106);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.14);
  clip-path: polygon(
    0 0px, 
    100% 90px, 
    100% 95%, 
    0 100%);
  overflow: hidden;
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Полоса под заголовок «ПОРТФОЛИО» внутри жёлтого блока (учёт диагонали clip-path) */
.portfolio-main-heading {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: clamp(104px, 15vw, 200px) clamp(24px, 6vw, 72px) clamp(28px, 4vw, 44px);
}

.portfolio-main-heading .portfolio-main {
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  pointer-events: auto;
}

.portfolio-main-text {
  margin: 0 auto;
  position: relative;
  padding-top: clamp(8px, 2vw, 24px);
  padding-bottom: clamp(8px, 1.5vw, 16px);
  padding-left: clamp(0px, 2vw, 24px);
  padding-right: clamp(0px, 2vw, 24px);
}

.portfolio-main-text-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path fill="rgba(0,0,0,0.05)" d="M0,0 L100,0 L100,100 L0,100 Z"></path></svg>');
  background-size: 50px 50px;
  opacity: 0.3;
  z-index: -1;
  will-change: transform;
}

@media (max-width: 768px) {
  .hero {
    min-height: 100svh;
    min-height: 100dvh;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: calc(var(--header-height-mobile) + var(--scroll-anchor-gap));
    padding-bottom: max(72px, calc(48px + env(safe-area-inset-bottom, 0px)));
    box-sizing: border-box;
  }

  .hero .video-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    will-change: auto;
  }

  .hero .video-background video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .hero-content {
    position: relative;
    top: 0;
    flex: 1;
    align-self: center;
    width: 100%;
    max-width: min(800px, 100%);
    margin-inline: auto;
    padding-inline: max(20px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
    padding-bottom: 0;
    box-sizing: border-box;
    will-change: auto;
  }

  .hero-content p {
    max-width: 100%;
  }
  
  .portfolio {
    margin-top: 0;
    padding-top: clamp(32px, 8vw, 56px);
    clip-path: none;
  }

  .portfolio-section {
    padding-bottom: clamp(16px, 4vw, 32px);
  }

  .portfolio-header {
    margin-bottom: clamp(20px, 5vw, 36px);
    padding-top: clamp(8px, 2vw, 20px);
  }

  .portfolio-title {
    font-size: clamp(1.15rem, 5vw, 1.65rem);
    line-height: 1.25;
  }

  .team-section {
    scroll-margin-top: var(--scroll-anchor-offset);
  }
  
  .portfolio-main-text-section {
    padding: 0 clamp(20px, 6vw, 36px) clamp(28px, 5vw, 44px);
    clip-path: none;
  }

  .portfolio-main-heading {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: clamp(64px, 16vw, 120px);
    padding-bottom: clamp(18px, 5vw, 32px);
    padding-left: clamp(8px, 3vw, 20px);
    padding-right: clamp(8px, 3vw, 20px);
  }

  .portfolio-main::before,
  .portfolio-main::after {
    display: none;
  }

  .portfolio-overlap-stack {
    transform: none !important;
  }

  .backstage-title {
    margin-top: clamp(12px, 4vw, 28px);
    margin-bottom: clamp(8px, 3vw, 16px);
    font-size: clamp(1.75rem, 7.5vw, 2.75rem);
    letter-spacing: 0.12em;
  }
  
  .scroll-arrow {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: max(20px, env(safe-area-inset-bottom, 0px));
    margin: 0;
  }
}