@font-face {
  font-family: Kodchasan;
  src: url("../assets/portfolio/kodchasan-medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

.web-page {
  --card-side: 50px;
  --card-top: 50px;
  --card-radius: 100px;
  --card-content-width: 80%;
  --card-column-gap: 40px;
  --card-gap: 300px;
  --copy-size: 24px;
  --title-gap-ratio: 6.44;
  --device-left: -13.6201%;
  --device-width: 115%;
  --device-height: 60%;
  --device-radius: 50px;
  --device-tilt: -30deg;
  --hint-ratio: 1.41304;
  --hint-width: 21%;
  --hint-font: 16px;
}

.web-mark {
  --rotation-start: .5s;
  position: absolute;
  top: 50%;
  left: 36%;
  width: max(28%, 340px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) perspective(500px) rotateY(15deg);
  transform-style: preserve-3d;
}
.web-disc, .web-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}
.web-disc {
  width: var(--disc-width);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 180deg, #000, var(--disc-color));
  /* Layer the entrance over the running rotation to avoid a pause or a jump. */
  animation: disc-enter .5s cubic-bezier(.12,.23,.5,1) var(--intro-delay, 0s) both,
    web-spin var(--turn-duration) linear var(--rotation-start) infinite,
    var(--depth-animation, none);
}
.web-disc-red { --disc-width: 100%; --disc-color: var(--red); --turn-duration: 10s; }
.web-disc-blue { --disc-width: 82%; --disc-color: var(--blue); --turn-duration: 9s; --intro-delay: .2s; }
.web-disc-pink { --disc-width: 65%; --disc-color: var(--pink); --turn-duration: 8s; --intro-delay: .4s; }
.web-disc-green { --disc-width: 47%; --disc-color: var(--green); --turn-duration: 7s; --intro-delay: .6s; }
.web-disc-orange {
  --disc-width: 29%;
  --disc-color: var(--orange);
  --turn-duration: 6s;
  --intro-delay: .8s;
  --depth-animation: orange-depth 1s var(--float) var(--rotation-start) both;
}
@keyframes disc-enter {
  from { opacity: 0; transform: rotate(-360deg); }
}
@keyframes web-spin {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}
@keyframes orange-depth { to { translate: -50% -50% 11px; } }
.web-orbit {
  width: 147%;
  aspect-ratio: .994036;
  overflow: visible;
  fill: #fff;
  font: 500 16px/1 Kodchasan, sans-serif;
  letter-spacing: .3em;
  animation: orbit-enter 1s cubic-bezier(.12,.23,.5,1) both,
    web-spin 16s linear var(--rotation-start) infinite reverse;
}
@keyframes orbit-enter {
  from { opacity: 0; transform: rotate(360deg); }
}
.web-hero.is-offscreen .web-disc, .web-hero.is-offscreen .web-orbit { animation-play-state: paused; }

.web-projects {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  row-gap: var(--card-gap);
}
.web-projects::after { content: ""; }
.web-projects .project {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 500px;
  z-index: 1;
  padding: var(--card-top) 0 0 var(--card-side);
  transform: scale(var(--project-scale, 1));
  overflow: clip;
}
.web-card {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-radius: var(--card-radius) var(--card-right-radius, 0px) 0 0;
  background: linear-gradient(transparent, #000), linear-gradient(90deg, var(--project-color), #000);
  overflow: hidden;
}
.masha-music {
  --project-color: #c53a3d;
  --art-color: #c53a3c;
  --title-ratio: 5.8169;
  --title-width: 168%;
  --title-offset: -119px;
}
.masha-agency {
  --project-color: #ff4d77;
  --art-color: #ff4d77;
  --title-ratio: 3.04651;
  --title-width: 143%;
  --title-offset: -113px;
}
.nexvox-retreat {
  --project-color: #e655f9;
  --art-color: #d852ed;
  --title-ratio: 6.40833;
  --title-width: 181%;
  --title-offset: -157px;
  --art-width: 84%;
  --art-height: 72%;
  --art-top: 13.8542%;
  --art-left: 7.90569%;
}
.nexvox-onepager {
  --project-color: #007cf8;
  --art-color: #007cf8;
  --title-ratio: 7.72816;
  --title-width: 200%;
  --title-offset: -118px;
  --art-width: 74%;
  --art-height: 62%;
  --art-top: 19.1268%;
  --art-left: 13.0374%;
}
.web-project-inner {
  display: flex;
  align-items: center;
  gap: var(--card-column-gap);
  width: var(--card-content-width);
  height: 100%;
}
.web-project-info {
  z-index: 1;
  display: flex;
  flex: 0 0 35%;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  pointer-events: none;
}
.web-project-title {
  width: var(--title-width);
  aspect-ratio: var(--title-ratio);
  margin: 0;
  filter: drop-shadow(8px 8px 14px #0008);
}
.web-project-title img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.web-project-description {
  display: grid;
  gap: 40px;
  width: 100%;
  margin-top: calc(100% / var(--title-gap-ratio));
}
.web-project-info::after {
  content: "";
  width: 100%;
  aspect-ratio: var(--trailing-gap-ratio, var(--title-gap-ratio));
}
.masha-agency .web-project-info::after { content: none; }
.web-project-description p {
  margin: 0;
  font-size: var(--copy-size);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.web-project-instruction {
  display: grid;
  padding-right: 20px;
}
.web-page .project-hint img {
  height: auto;
  aspect-ratio: 1.5;
  object-fit: contain;
}

.web-device {
  position: relative;
  flex: 1;
  height: 100%;
}
.web-project-link {
  position: absolute;
  top: calc((100% - var(--device-height)) / 2);
  left: var(--device-left);
  display: block;
  width: var(--device-width);
  height: var(--device-height);
  border-radius: var(--device-radius);
  background: var(--art-color);
  transform: perspective(1200px) rotateY(var(--device-tilt));
  overflow: hidden;
}
.web-project-link img {
  position: absolute;
  top: var(--art-top, 0%);
  left: var(--art-left, 0%);
  width: var(--art-width, 100%);
  height: var(--art-height, 100%);
  object-fit: contain;
}
.masha-music .web-project-link img { object-fit: cover; }
.web-project-link:focus-visible { outline-offset: -5px; }

.motion-ready .web-project-title {
  transition: transform 1s cubic-bezier(.16, .62, .28, 1);
}
.motion-ready .project:not(.has-entered) .web-project-title {
  transform: translateX(var(--title-offset)) scale(var(--title-start-scale, .5));
}
.motion-ready .web-project-description p {
  transition: opacity .9s var(--float), translate .9s var(--float);
}
.motion-ready .project:not(.has-entered) .web-project-description p {
  opacity: 0;
  translate: 0 100px;
}
.motion-ready .web-device {
  --entry-scale: calc(.5 + .5 * var(--device-entered, 1));
}
.motion-ready .web-project-link {
  transform: perspective(1200px) scale(var(--entry-scale)) rotateY(var(--device-tilt));
  animation: screen-turn 5s var(--float) infinite alternate;
  animation-play-state: paused;
}
.motion-ready .project.is-visible .web-project-link { animation-play-state: running; }
@keyframes screen-turn {
  to { transform: perspective(1200px) scale(var(--entry-scale)) rotateY(calc(var(--device-tilt) + 10deg)); }
}
.motion-ready .project:focus-within .web-project-title,
.motion-ready .project:focus-within .web-project-description p {
  transform: none;
  translate: none;
  opacity: 1;
}

@media (900px <= width < 1200px) {
  .web-page {
    --card-radius: 75px;
    --copy-size: 20px;
    --title-gap-ratio: 4.76;
    --device-radius: 40px;
    --hint-width: 28%;
    --hint-ratio: 1.5;
    --hint-font: 12px;
  }
  .web-mark {
    left: 178px;
    width: min(34%, 340px);
    transform: translateY(-50%) perspective(500px) rotateY(15deg);
  }
  .nexvox-retreat { --card-right-radius: 61px; }
}

@media (600px <= width < 900px) {
  .web-page {
    --card-radius: 50px;
    --card-content-width: 85%;
    --copy-size: 16px;
    --title-gap-ratio: 3.28;
    --device-left: -6.09319%;
    --device-width: 100%;
    --device-radius: 30px;
    --hint-width: 60px;
    --hint-ratio: 1.5;
    --hint-font: 12px;
  }
  .web-mark {
    left: 118px;
    width: 34%;
    transform: translateY(-50%) perspective(500px) rotateY(15deg);
  }
  .masha-music { --title-width: 190%; }
  .masha-agency { --title-width: 158%; }
  .nexvox-retreat { --title-width: 180%; }
  .nexvox-onepager { --title-width: 210%; }
}

@media (width < 600px) {
  .web-page {
    --card-side: 0px;
    --card-top: 30px;
    --card-radius: 36px;
    --card-right-radius: 36px;
    --card-content-width: 94%;
    --card-column-gap: 0px;
    --card-gap: 200px;
    --copy-size: 14px;
    --title-gap-ratio: 2.1;
    --trailing-gap-ratio: 1.05;
    --title-start-scale: .6;
    --device-left: 0%;
    --device-width: 100%;
    --device-height: 50%;
    --device-radius: 20px;
    --device-tilt: -40deg;
    --hint-width: 45px;
    --hint-ratio: 1.5;
    --hint-font: 12px;
  }
  .web-mark {
    left: 48%;
    width: 56%;
    transform: translate(-50%, -50%) perspective(500px) rotateY(27deg);
  }
  .web-hero .hero-design { aspect-ratio: .160622; }
  .web-card { justify-content: flex-end; }
  .web-project-title { filter: drop-shadow(8px 8px 11px #0008); }
  .masha-music { --title-width: 230%; --title-offset: -56px; }
  .masha-agency { --title-width: 170%; --title-offset: -47px; }
  .nexvox-retreat { --title-width: 210%; --title-offset: -51px; }
  .nexvox-onepager { --title-width: 210%; --title-offset: -42px; }
  .web-project-instruction { padding-right: 0; }
  .motion-ready .web-project-info {
    transition: opacity .9s var(--float), translate .9s var(--float);
  }
  .motion-ready .project:not(.has-entered) .web-project-info {
    opacity: 0;
    translate: 0 100px;
  }
  .motion-ready .project:not(.has-entered) .web-project-description p {
    opacity: 1;
    translate: none;
  }
  .motion-ready .web-device { --entry-scale: 1; }
  .motion-ready .project:focus-within .web-project-info { opacity: 1; translate: none; }
}

@media (prefers-reduced-motion: reduce) {
  .web-disc, .web-orbit, .motion-ready .web-project-link { animation: none; }
  .web-projects .project { position: relative; transform: none; }
  .motion-ready .project .web-project-info,
  .motion-ready .project .web-project-title,
  .motion-ready .project .web-project-description p {
    transition: none;
    opacity: 1;
    transform: none;
    translate: none;
  }
}
