* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: #ffe98f;
  color: #050505;
  font-family:
    "Bauhaus 93", "Arial Black", "Cooper Black", system-ui, sans-serif;
}

.site {
  width: 100%;
  min-height: 100vh;
}

/* ---------- ПЕРВАЯ СТРАНИЦА ---------- */

.home-screen {
  position: relative;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: #ffe98f;
}

.site-name {
  position: fixed;
  top: 31%;
  left: 50%;
  z-index: 120;

  margin: 0;
  transform: translate(-50%, -50%);

  font-size: clamp(30px, 4.2vw, 54px);
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.02em;

  transition:
    top 1s ease,
    left 1s ease,
    transform 1s ease,
    font-size 1s ease,
    text-shadow 0.25s ease;
}

body.menu-open .site-name,
body.section-open .site-name,
html.direct-section-load .site-name {
  top: 28px;
  left: 32px;
  transform: translate(0, 0);
  font-size: clamp(18px, 2vw, 25px);
  cursor: pointer;
}

body.menu-open .site-name:hover,
body.section-open .site-name:hover,
html.direct-section-load .site-name:hover {
  transform: translateY(-4px) scale(1.07);
  text-shadow: 0 4px 0 rgba(64, 163, 209, 0.25);
}

/* ---------- КНОПКА MENU ---------- */

.menu-button {
  position: absolute;
  top: 64%;
  left: 50%;
  z-index: 18;

  transform: translate(-50%, -50%);

  padding: 16px 34px;
  border: 2px solid #f45b80;
  border-radius: 18px;

  background: #ff8ca7;
  color: #111;

  font-family: inherit;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1;
  cursor: pointer;

  transition:
    transform 0.3s ease,
    background 0.3s ease,
    opacity 0.4s ease;
}

.menu-button:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: #ff9bb3;
}

body.menu-open .menu-button,
body.section-open .menu-button,
html.direct-section-load .menu-button {
  opacity: 0;
  pointer-events: none;
}

/* ---------- ТРАВА ---------- */

.grass {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 25;

  width: 100%;
  height: 100vh;

  pointer-events: none;
  overflow: hidden;
}

.grass-blade {
  position: absolute;
  bottom: -35vh;
  left: var(--x);

  width: 17vw;
  height: 96vh;

  background: #9bed49;
  border: 1px solid #3d922b;

  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  transform-origin: 50% 100%;

  transition:
    transform 0.65s ease,
    opacity 1s ease;
}

.menu-button:hover ~ .grass .left-blade {
  transform: translateX(-20px) rotate(-13deg);
}

.menu-button:hover ~ .grass .right-blade {
  transform: translateX(20px) rotate(13deg);
}

body.menu-open .grass-blade,
body.section-open .grass-blade,
html.direct-section-load .grass-blade {
  transform: translateY(45vh);
  opacity: 0.55;
}

/* ---------- ВТОРАЯ СТРАНИЦА С МОРЕМ ---------- */

.sea-screen {
  position: fixed;
  inset: 0;
  z-index: 30;

  width: 100%;
  height: 100svh;

  background-color: #b9def3;
  background-image: url("../img/sea-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  transform: translateY(100%);
  transition: transform 1s ease;
}

body.menu-open .sea-screen,
body.section-open .sea-screen {
  transform: translateY(0);
}

/* При возвращении с p5.js страницы море вообще не видно */
html.direct-section-load .sea-screen {
  visibility: hidden;
  opacity: 0;
  transform: translateY(100%);
}

/* Фото и подпись на странице с морем */
.sea-about-card {
  position: absolute;
  left: clamp(28px, 8vw, 120px);
  top: 52%;
  z-index: 35;

  width: min(310px, 72vw);

  transform: translateY(-50%);
}

.sea-about-image {
  width: 100%;
  aspect-ratio: 1 / 1;

  display: block;

  object-fit: cover;

  border: 2px solid #050505;
  background: #b9def3;
}

.sea-about-caption {
  margin: 16px 0 0;
  padding: 14px 16px;

  border: 2px solid #050505;

  background: rgba(255, 233, 143, 0.78);
  backdrop-filter: blur(4px);

  font-size: clamp(15px, 1.4vw, 19px);
  line-height: 1.25;
}

/* ---------- ОБЩАЯ ВЕРХНЯЯ ПЛАШКА ---------- */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 95;

  width: 100%;
  height: 86px;

  background: #ffe98f;

  opacity: 0;
  pointer-events: none;
}

body.menu-open .top-bar,
body.section-open .top-bar,
html.direct-section-load .top-bar {
  opacity: 1;
}

/* ---------- ОБЩИЕ РАЗДЕЛЫ СВЕРХУ ---------- */

.main-sections {
  position: fixed;
  top: 39px;
  right: 26px;
  z-index: 130;

  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: clamp(18px, 2vw, 30px);
  flex-wrap: wrap;

  max-width: 70vw;

  opacity: 0;
  pointer-events: none;
}

body.menu-open .main-sections,
body.section-open .main-sections,
html.direct-section-load .main-sections {
  opacity: 1;
  pointer-events: auto;
}

.main-section-link {
  display: inline-block;
  color: #050505;
  text-decoration: none;

  font-size: clamp(11px, 1.15vw, 15px);
  line-height: 1;
  white-space: nowrap;

  transition:
    transform 0.25s ease,
    text-shadow 0.25s ease;
}

.main-section-link:hover {
  transform: translateY(-4px) scale(1.07);
  text-shadow: 0 4px 0 rgba(64, 163, 209, 0.25);
}

/* ---------- СТРАНИЦЫ РАЗДЕЛОВ ---------- */

.work-screen {
  position: fixed;
  inset: 0;
  z-index: 45;

  width: 100%;
  height: 100svh;

  background: #ffe98f;

  transform: translateX(100%);
  transition: transform 0.8s ease;

  overflow-y: auto;
  padding: 120px 48px 90px;
}

.work-screen.is-active {
  transform: translateX(0);
}

html.direct-interactive #interactiveScreen,
html.direct-graphic #graphicScreen,
html.direct-photography #photographyScreen {
  transform: translateX(0);
}

.work-content {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.work-title-main {
  margin: 0 0 42px;

  font-size: clamp(36px, 6vw, 86px);
  line-height: 1;
}

/* ---------- КАРТОЧКИ ПРОЕКТОВ ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.project-card {
  position: relative;
  display: block;

  width: 100%;
  aspect-ratio: 4 / 3;

  padding: 0;
  border: 2px solid #050505;
  border-radius: 22px;

  overflow: hidden;
  background: #b9def3;

  cursor: pointer;

  font-family: inherit;
  color: #050505;
  text-decoration: none;
  text-align: left;
}

.project-card-image {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: cover;

  transition:
    transform 0.45s ease,
    filter 0.45s ease;
}

.project-card-image.is-missing {
  display: none;
}

.project-card-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  padding: 16px 20px;

  background: rgba(255, 233, 143, 0.72);
  backdrop-filter: blur(4px);

  color: #050505;
  font-size: clamp(20px, 3vw, 42px);
  line-height: 1;
  text-align: left;
}

.project-card:hover .project-card-image {
  transform: scale(1.06);
  filter: contrast(1.06);
}

.project-card:hover .project-card-title {
  background: rgba(255, 233, 143, 0.86);
}

/* ---------- BACK ---------- */

.section-back-button {
  position: fixed;
  right: 34px;
  bottom: 28px;
  z-index: 140;

  display: none;

  border: none;
  background: transparent;
  padding: 0;

  color: #050505;
  font-family: inherit;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1;

  cursor: pointer;

  transition:
    transform 0.25s ease,
    text-shadow 0.25s ease;
}

body.section-open .section-back-button,
html.direct-section-load .section-back-button {
  display: block;
}

.section-back-button:hover {
  transform: translateY(-4px) scale(1.07);
  text-shadow: 0 4px 0 rgba(64, 163, 209, 0.25);
}

/* ---------- ОКНО ПРОСМОТРА ФОТО / GIF ---------- */

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 200;

  display: none;

  background: rgba(255, 233, 143, 0.95);
  overflow: hidden;
}

.gallery-modal.is-open {
  display: block;
}

.gallery-modal-inner {
  position: relative;

  width: 100%;
  height: 100%;
  padding: 70px 90px 54px;

  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-figure {
  width: min(1280px, 86vw);
  height: min(860px, 82vh);

  margin: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gallery-image {
  max-width: 100%;
  max-height: 100%;

  display: block;

  object-fit: contain;
  border: 2px solid #050505;
  border-radius: 0;
  background: #b9def3;

  cursor: zoom-in;

  transition: transform 0.35s ease;
}

.gallery-image.is-zoomed {
  transform: scale(1.55);
  cursor: zoom-out;
  border-radius: 0;
}

.gallery-caption {
  margin-top: 16px;
  font-size: clamp(16px, 2vw, 24px);
  line-height: 1;
  text-align: center;
}

.gallery-close,
.gallery-arrow {
  position: fixed;
  z-index: 210;

  border: none;
  background: transparent;
  padding: 0;

  color: #050505;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;

  transition:
    transform 0.25s ease,
    text-shadow 0.25s ease;
}

.gallery-close {
  top: 28px;
  right: 34px;
  font-size: clamp(18px, 2vw, 25px);
}

.gallery-arrow {
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(20px, 2.2vw, 28px);
}

.gallery-arrow-left {
  left: 34px;
}

.gallery-arrow-right {
  right: 34px;
}

.gallery-close:hover,
.gallery-arrow:hover {
  text-shadow: 0 4px 0 rgba(64, 163, 209, 0.25);
}

.gallery-arrow:hover {
  transform: translateY(-50%) scale(1.08);
}

.gallery-counter {
  position: fixed;
  left: 34px;
  bottom: 28px;
  z-index: 210;

  font-size: clamp(18px, 2vw, 25px);
  line-height: 1;
}

/* ---------- IFRAME / A-FRAME MODAL ---------- */

.iframe-modal {
  position: fixed;
  inset: 0;
  z-index: 220;

  display: none;

  background: #ffe98f;
  padding: 88px 34px 34px;
}

.iframe-modal.is-open {
  display: block;
}

.iframe-close {
  position: fixed;
  top: 28px;
  right: 34px;
  z-index: 230;

  border: none;
  background: transparent;
  padding: 0;

  color: #050505;
  font-family: inherit;
  font-size: clamp(18px, 2vw, 25px);
  cursor: pointer;
}

.iframe-title {
  position: fixed;
  top: 28px;
  left: 34px;
  z-index: 230;

  margin: 0;

  font-size: clamp(18px, 2vw, 25px);
  line-height: 1;
}

.iframe-view {
  width: 100%;
  height: 100%;

  border: 2px solid #050505;
  background: #b9def3;
}

/* ---------- АДАПТИВНОСТЬ ---------- */

@media (max-width: 1000px) {
  .top-bar {
    height: 100px;
  }

  .main-sections {
    top: 62px;
    right: 24px;
    max-width: calc(100vw - 48px);
    gap: 14px 20px;
  }

  .project-grid {
    gap: 22px;
  }

  .sea-about-card {
    left: 36px;
    top: 54%;
    width: 270px;
  }
}

@media (max-width: 700px) {
  .site-name {
    top: 30%;
    font-size: 25px;
  }

  body.menu-open .site-name,
  body.section-open .site-name,
  html.direct-section-load .site-name {
    top: 18px;
    left: 18px;
    font-size: 18px;
  }

  .menu-button {
    top: 64%;
    padding: 14px 28px;
    font-size: 18px;
  }

  .grass-blade {
    bottom: -36vh;
    width: 25vw;
    height: 96vh;
  }

  .top-bar {
    height: 110px;
  }

  .main-sections {
    top: 56px;
    right: 18px;
    max-width: calc(100vw - 36px);
    gap: 12px 16px;
  }

  .main-section-link {
    font-size: 12px;
  }

  .sea-about-card {
    left: 50%;
    top: 56%;

    width: min(260px, 78vw);

    transform: translate(-50%, -50%);
  }

  .sea-about-caption {
    font-size: 14px;
  }

  .work-screen {
    padding: 110px 22px 70px;
  }

  .work-title-main {
    font-size: 42px;
    margin-bottom: 28px;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .project-card-title {
    font-size: 26px;
    padding: 14px 16px;
  }

  .section-back-button {
    right: 18px;
    bottom: 18px;
    font-size: 18px;
  }

  .gallery-modal-inner {
    padding: 72px 16px 70px;
  }

  .gallery-figure {
    width: 100%;
    height: 74vh;
  }

  .gallery-image.is-zoomed {
    transform: scale(1.35);
  }

  .gallery-close {
    top: 18px;
    right: 18px;
    font-size: 18px;
  }

  .gallery-arrow {
    top: auto;
    bottom: 18px;
    font-size: 18px;
    transform: none;
  }

  .gallery-arrow:hover {
    transform: scale(1.08);
  }

  .gallery-arrow-left {
    left: 18px;
  }

  .gallery-arrow-right {
    right: 82px;
  }

  .gallery-counter {
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    font-size: 18px;
  }

  .iframe-modal {
    padding: 80px 18px 18px;
  }

  .iframe-title {
    left: 18px;
    top: 18px;
    font-size: 18px;
  }

  .iframe-close {
    right: 18px;
    top: 18px;
    font-size: 18px;
  }
}
