@font-face {
  font-family: 'Nebulica';
  src: url('../fonts/Nebulica-VF.ttf') format('truetype');
}

body {
  font-family: 'Nebulica', sans-serif;
  margin: 0;
  padding: 0;
}

:root {
  --color-white: #FDFEFF;
  --color-blue: #2F63FF;
  --color-dark: #212329;
  --color-light: #E4E5E5;
  --color-yellow: #D0FF13;
  --color-border: #FDFEFF;
  --font-family: 'Nebulica', sans-serif;
  --font-size-responsive: clamp(16px, 2.1vw, 28px); /* Добавлено для размера шрифта */
  user-select: none; /* Добавлено для предотвращения выделения текста */
  cursor: default; /* Добавлено для предотвращения изменения курсора */
}

.container {
  height: 100vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-family);
}

.grid-container {
  display: flex;
  justify-content: space-between;
  padding: 0;
  margin: 0;
  font-family: var(--font-family);
}

.grid-container:nth-of-type(2) .box {
  padding: 3vh; /* Изменено для установки паддинга 3vh */
}

.grid-container:nth-of-type(2) .box-light {
  color: var(--color-dark); /* Установить черный цвет для текста и элементов */
}

.grid-item {
  height: 100%;
  position: relative;
  font-family: var(--font-family);
  text-decoration: none; /* Добавлено для удаления подчеркивания у ссылок */
  color: inherit; /* Добавлено для наследования цвета текста */
}

.box {
  height: 100%;
  overflow: hidden;
  padding: 6vh;
  box-sizing: border-box;
  position: relative;
  font-family: var(--font-family);
}

.box-white {
  background-color: var(--color-white);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

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

.box-dark {
  background-color: var(--color-dark);
}

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

h1 {
  font-size: clamp(27px, min(8.6vw, 15.5vh), 132px);
  white-space: nowrap;
  margin: 0;
  text-transform: uppercase;
  line-height: 90%;
  position: absolute;
  bottom: calc(5vh - 2%); /* Учитывает паддинг родительского блока */
  left: 5vh; /* Учитывает паддинг родительского блока */
  max-width: calc(100% - 10vh); /* Учитывает паддинг родительского блока */
  max-height: calc(100% - 10vh); /* Учитывает паддинг родительского блока */
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-dark);
  letter-spacing: 2%; /* Добавлено для увеличения межбуквенного расстояния */
}

h1 span {
  display: block;
}

h1 .line1 {
  font-weight: 100;
}

h1 .line2 {
  font-weight: 300;
}

h1 .line3 {
  font-weight: 500;
}

.hero-experience {
  position: absolute;
  top: 5vh;
  right: 5vh;
  max-width: 360px;
  text-align: right;
  font-size: 20px;
  line-height: 150%;
  font-weight: 400;
  color: var(--color-dark);
}

.box-projects {
  padding: 0;
}

.projects-grid {
  height: 100%;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0;
  place-content: center;
  padding: 0;
  box-sizing: border-box;
}

.project-tile {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  color: var(--color-white);
  background: transparent;
  overflow: hidden;
  cursor: pointer;
}

.project-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-dark);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 1;
}

.project-tile-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2vh;
  box-sizing: border-box;
  color: var(--color-yellow);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: scale(0.85);
  transform-origin: center;
  transition: opacity 0.2s ease, transform 0.25s ease;
  pointer-events: none;
  z-index: 2;
}

.project-tile-title {
  font-weight: 500;
  font-size: clamp(16px, 1.6vw, 32px);
  line-height: 1.05;
}

.project-tile-subtitle {
  margin-top: 0.6vh;
  font-weight: 100;
  font-size: clamp(12px, 1.05vw, 22px);
  line-height: 1;
}

.project-tile:is(:hover, :focus-visible)::before {
  opacity: 0.8;
}

.project-tile:is(:hover, :focus-visible) .project-tile-text {
  opacity: 1;
  transform: scale(1.1);
}

.project-tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1);
  transition: transform 0.2s;
}

.project-tile:is(:hover, :focus-visible) .project-tile-img {
  transform: scale(1.1);
}

.file-text {
  position: absolute;
  top: 0;
  left: 0;
  font-size: min(2vw, 5vh);
  font-weight: 500;
  z-index: 2;
}

.box-resume {
  position: relative;
  overflow: hidden;
}

.resume-link-wrap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  pointer-events: none;
  background-color: var(--color-yellow);
  transform: translateY(0);
  transition: transform 0.25s ease;
}

.box-resume .file-text.resume-link-wrap {
  left: 0;
  transform: translateY(100%);
  z-index: 2;
}

.box-resume .info-text.resume-link-wrap {
  right: 0;
  transform: translateY(-100%);
  z-index: 2;
}

.resume-link {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--color-dark);
  font-family: var(--font-family);
  font-weight: 500;
  text-align: center;
  box-sizing: border-box;
  cursor: pointer;
  transition: none;
}

.box-resume .file-text.resume-link-wrap .resume-link {
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 3vh;
}

.box-resume .info-text.resume-link-wrap .resume-link {
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  padding: 3vh;
}

.box-resume:is(:hover, :focus-within) .resume-link-wrap {
  pointer-events: auto;
  transform: translateY(0);
}

.resume-link-title {
  display: block;
  font-size: min(1.8vw, 4vh);
  line-height: 1;
  transition: transform 0.3s ease;
  text-transform: uppercase;
}

.resume-link-subtitle {
  display: block;
  font-size: min(1.4vw, 3vh);
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 0;
  font-weight: 200;
  opacity: 0;
  transform: translateY(0) scale(1);
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease, transform 0.3s ease, margin 0.3s ease;
  will-change: transform, opacity;
}

.box-resume .file-text.resume-link-wrap .resume-link-title {
  transform-origin: top left;
}

.box-resume .info-text.resume-link-wrap .resume-link-title {
  transform-origin: bottom right;
}

.box-resume .file-text.resume-link-wrap .resume-link-subtitle {
  transform-origin: top left;
  transform: translateY(-0.6vh) scale(1);
}

.box-resume .info-text.resume-link-wrap .resume-link-subtitle {
  transform-origin: bottom right;
  transform: translateY(0.6vh) scale(1);
}

.resume-link:hover .resume-link-title {
  transform: scale(1.2);
}

.resume-link:hover .resume-link-subtitle {
  opacity: 1;
  transform: translateY(0) scale(1.2);
  margin-top: 1.6vh;
  margin-bottom: 1.6vh;
  max-height: 2.4em;
}

.resume-center-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-family: var(--font-family);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 100;
  font-size: min(5vw, 10vh);
  line-height: 1;
  color: var(--color-dark);
  text-align: center;
  pointer-events: none;
  z-index: 3;
  transition: transform 0.25s ease;
}

.box-resume:hover .resume-center-text,
.box-resume:focus-within .resume-center-text {
  transform: translate(-50%, -50%) scale(0.7);
  z-index: 1;
}

.info-text {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: min(2vw, 5vh);
  font-weight: 500;
  z-index: 2;
}

.link-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: auto; /* Высота зависит от внутренних объектов */
  box-sizing: border-box;
}

.link-text {
  text-align: left;
  font-size: min(1.04vw, 2.4vh);
  color: var(--color-white);
  font-weight: 100;
}

.link-icon {
  text-align: right;
  font-size: var(--font-size-responsive);
  color: var(--color-white);
  width: min(2vw, 6vh); 
  height: min(2vw, 6vh); 
}

.link-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.link-second-text {
  color: var(--color-white);
  font-size: min(1.3vw, 3vh);
  font-weight: 100;
  position: absolute;
  bottom: 3vh;
  left: 3vh;
  transform-origin: bottom left;
  transition: transform 0.2s;
}

.link-second-text span {
  display: block; /* Добавлено для корректного применения отступов */
  font-weight: 500;
  font-size: min(2.6vw, 6vh);
  text-transform: uppercase;
  line-height: 1;
  margin-top: 0.5vh; /* Увеличьте значение для большего расстояния */
}

a:hover .link-second-text span {
  color: var(--color-yellow); /* Добавлено для изменения цвета текста при наведении на всю ссылку */
}

.dribbble-text {
  position: absolute;
  bottom: 4vh;
  left: -4vh;
  font-size: 22vh; /* Настройте размер текста по вашему усмотрению */
  color: var(--color-white); /* Полупрозрачный цвет для декоративного элемента */
  opacity: 0.02;
  pointer-events: none; /* Отключите взаимодействие с элементом */
}

.dark-box-content {
  position: absolute;
  bottom: 3vh;
  left: 3vh;
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 3vh;
  transform-origin: bottom left;
  transition: transform 0.2s;
}

.dark-box-image {
  width: min(6vw, 16vh);
  height: min(6vw, 16vh);
}

.dark-box-text {
  width: 50%; /* Настройте ширину текста по вашему усмотрению */
  color: var(--color-white);
  font-size: min(1.04vw, 2.4vh);
  font-weight: 200;
}

.dark-box-text h5 {
  font-weight: 500;
  font-size: min(1.3vw, 3vh);
  margin-bottom: 1.4vh;
  margin-top: 0;
  text-transform: uppercase;
}

.box-dark:hover .dark-box-text h5 {
  color: var(--color-yellow);
  transition: color 0.2s;
}

/*
.box-dark:hover .dribbble-text {
  opacity: 0.1;
  color: var(--color-blue);
}
*/

a:hover .dark-box-content,
a:hover .link-second-text {
  transform: scale(1.1);
  transform-origin: bottom left;
  transition: transform 0.2s;
}

a:hover .link-second-text span {
  transition: 0.2s;
}

.link-second-text:hover {
  transition: color 0.2s;
}

@media (max-width: 768px) {
  .container {
    height: auto;
    min-height: 100vh;
    justify-content: flex-start;
  }

  .grid-container {
    height: auto !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
  }

  .grid-item {
    width: 100% !important;
    height: auto;
    display: flex;
  }

  .grid-item > .box {
    width: 100%;
    flex: 1;
  }

  .grid-container:nth-of-type(1) .grid-item:nth-child(1) {
    min-height: auto;
  }

  .grid-container:nth-of-type(1) .grid-item:nth-child(2) {
    min-height: 60vw;
    aspect-ratio: 1 / 1;
  }

  /* Make blocks 3 & 4 sit side-by-side (tile height), and block 5 below them. */
  .grid-container:nth-of-type(2) {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 50vw 50vw;
    justify-content: stretch !important;
    align-items: stretch !important;
  }

  /* Block 3 (LinkedIn): match project tile height and use fixed type sizes. */
  .grid-container:nth-of-type(2) .grid-item:nth-child(1),
  .grid-container:nth-of-type(2) .grid-item:nth-child(2) {
    height: 50vw;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(1) .link-icon,
  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .link-icon {
    display: none;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(1) .link-content,
  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .link-content {
    justify-content: flex-start;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(1) .link-text,
  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .link-text {
    font-size: 14px;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(1) .link-second-text {
    font-size: 14px;
    line-height: 1.05;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(1) .link-second-text span {
    font-size: 24px;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) {
    grid-column: 1 / -1;
    height: 50vw;
  }

  .dribbble-text {
    font-size: 14vh;
    left: -2vh;
  }

  /* Block 4 (Dribbble): remove image and set fixed type sizes. */
  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .dark-box-content {
    right: 3vh;
    width: calc(100% - 6vh);
    box-sizing: border-box;
    gap: 0;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .dark-box-image {
    display: none;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .dark-box-text {
    width: 100%;
    font-size: 14px;
    font-weight: 100; /* Match "Let's connect on" weight */
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(2) .dark-box-text h5 {
    font-size: 14px;
    margin-bottom: 0.8vh;
  }

  /* Block 5 (Resume): yellow background, wrappers always visible, larger type. */
  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .box-resume {
    background-color: var(--color-yellow);
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link-wrap {
    transform: translateY(0) !important;
    pointer-events: auto;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link {
    gap: 0.8vh;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-center-text {
    display: none;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .box-resume:hover .resume-center-text,
  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .box-resume:focus-within .resume-center-text {
    transform: translate(-50%, -50%) scale(1);
    z-index: 3;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link-title {
    font-size: 24px;
    order: 1;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link-subtitle {
    font-size: 0; /* Replace "pdf" -> "resume" on mobile via pseudo-content. */
    opacity: 1;
    max-height: none;
    margin-top: 0;
    margin-bottom: 0;
    overflow: visible;
    order: 2;
  }

  /* Right wrapper: subtitle first (above title). */
  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .info-text .resume-link-title {
    order: 2;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .info-text .resume-link-subtitle {
    order: 1;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link-subtitle::after {
    content: "download resume";
    font-size: 14px;
    line-height: 1.2;
    display: block;
  }

  /* Block 5 (Resume): hover scaling like blocks 3 & 4. */
  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link-title,
  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link-subtitle {
    transition: transform 0.2s;
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link:hover .resume-link-title,
  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link:hover .resume-link-subtitle {
    transform: scale(1.1);
  }

  .grid-container:nth-of-type(2) .grid-item:nth-child(3) .resume-link:hover .resume-link-subtitle {
    max-height: none;
    margin-top: 0;
    margin-bottom: 0;
  }

  /* Block 1: keep type sizes fixed on mobile and place content at the top. */
  .grid-container:nth-of-type(1) .grid-item:nth-child(1) .box-white {
    justify-content: flex-start;
    padding: 3vh;
  }

  .grid-container:nth-of-type(1) .grid-item:nth-child(1) h1 {
    position: static;
    left: auto;
    bottom: auto;
    max-width: none;
    max-height: none;
    overflow: visible;
    text-overflow: clip;
    font-size: 48px;
    line-height: 100%;
  }

  .hero-experience {
    position: static;
    margin-top: 2vh;
    max-width: none;
    text-align: left;
    line-height: 150%;
    font-size: 20px;
  }
}
