/* ==========================================================================
   VARIABLES & TYPOGRAPHY SETTINGS
   ========================================================================== */

:root {
  --main-color: rgba(88, 19, 255, 1);
  --main-color-light: rgba(88, 19, 255, 0.6);
  --light-gray: rgba(139, 135, 158, 0.2);
  --text-color: rgba(139, 135, 158, 1);
}

@supports (font-variation-settings: normal) {
  :root {
    font-family: InterVariable, sans-serif;
    font-feature-settings: 'liga' 1, 'calt' 1, 'dlig' 1, 'dlig' 1;
    -webkit-font-smoothing: antialiased;
  }
}


/* ==========================================================================
   BASE & GLOBAL STYLES
   ========================================================================== */

html {
  font-size: 20px;
  color: var(--main-color);
  min-height: 0vw;
  cursor: default;
  font-optical-sizing: auto;
  font-weight: 300;
  font-style: normal;
  background: #111;
}

body {
  margin: 0;
  padding: 20px;
  font-weight: 400;
}

main {
  display: flex;
  gap: 16px;
  flex-direction: column;
  width: 100%;
}

*::selection {
  color: none;
  background: none;
}

span.n {
  font-style: normal;
  white-space: nowrap;
}


/* ==========================================================================
   LINKS & INTERACTIVE ELEMENTS
   ========================================================================== */

a {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  transition: color 1s ease;
}

a:hover,
a.is-hovered {
  color: red;
  transition: none;
}

a::after {
  content: "";
  font-weight: 800 !important;
  display: inline-block;
  vertical-align: top;
  font-size: 0.3em;
  margin-top: 0.6em;
  margin-left: 0.2em;
  margin-right: -0.5em;
  transform: rotate(-45deg);
  color: inherit;
}

.lang-switch {
  font-weight: 700;
}

.lang-switch::after {
  content: "⊘";
  transform: none;
  font-weight: 1000 !important;
}

/* 1. Убираем стрелочку ::after для любых ссылок, содержащих медиа */
a:has(video)::after,
a:has(img)::after {
  content: none;
  display: none;
}

/* 2. Ссылочная обертка под медиа */
a:has(video),
a:has(img) {
  display: block;
  width: 100%;
  line-height: 0;
}

/* 3. Базовый контур для видео/изображений внутри карточек */
.projects-block a video,
.projects-block a img {
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

/* 4. Красный бордер при наведении курсора */
.projects-block a:hover video,
.projects-block a:hover img,
.projects-block a.is-hovered video,
.projects-block a.is-hovered img {
  border-color: red;
}


/* ==========================================================================
   HEADER
   ========================================================================== */

header {
  margin: 0;
  padding: 0;
  transform: skew(0, 10deg);
  position: relative;
  margin-top: calc(50% * tan(10deg) + 20px);
  margin-bottom: calc(50% * tan(10deg) + 20px);
  /* text-wrap: balance; */
  max-width: 1700px;
  line-height: 1.05;
}

@media (max-width: 768px) {
  header {
    text-wrap: wrap;
  }
}

header h1,
header p {
  letter-spacing: -0.03em;
  line-height: 1;
  font-style: normal;
  font-size: calc(0.8em + (2vw * 1.8));
  display: inline;
  position: relative;
  margin: 0;
  padding: 0;
  font-weight: 300;
}

header h1 {
  font-weight: 700;
}

h2 {
  font-weight: 700;
  font-size: 1em;
}


/* ==========================================================================
   PERSON / AVATAR WIDGET
   ========================================================================== */

.person {
  position: fixed;
  right: 20px;
  top: 20px;
  width: calc(64px + 8vw);
  height: calc(64px + 8vw);
  border-radius: calc((64px + 8vw)/2);
  z-index: 100;
  overflow: hidden;
  touch-action: none;
  border: 1px solid #111;
  background: #6a50f1;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1), height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateZ(0);
}

.person:hover {
  width: clamp(20vw, calc(100vw - 40px), 600px);
  height: clamp(20vw, calc(100vw - 40px), 600px);
  corner-shape: superellipse(1.2);
}

.person video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.person img {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
}


/* ==========================================================================
   INFO CARDS & SKILLS
   ========================================================================== */

.info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1500px;
  color: var(--text-color);
}

.info-block {
  border: 1px solid var(--main-color-light);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-radius: 16px;
  position: relative;
  flex: 1 1 250px;
}

.info-block * {
  padding: 0;
  margin: 0;
}

.info-block h3 {
  display: inline;
  font-size: 1em;
  float: left;
  margin-right: 8px;
}

.info-block .about {
  display: flex;
  gap: 24px;
  flex-direction: column;
}

.info-block.skills-block {
  flex: 2 1 250px;
  display: flex;
}

.info p {
  text-wrap: balance;
  max-width: 800px;
}

.skills-block .skills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.skills-block .skills .skill {
  background: var(--main-color-light);
  padding: 8px 14px;
  border-radius: 16px;
  font-size: 0.7em;
  font-weight: 700;
}

.consult-block:after {
  animation: spin 5s linear infinite;
  content: "";
  display: block;
  position: absolute;
  right: 0;
  top: 0;
  margin: 16px;
  width: 32px;
  height: 32px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.999 0L14.5086 3.61184L18.5543 1.94452L18.7325 6.3536L23.0266 7.15892L20.8175 10.967L24 13.9901L20.1025 15.9872L21.162 20.2688L16.8158 19.8196L15.4158 24L11.999 21.2481L8.58416 24L7.18418 19.8196L2.83802 20.2688L3.89752 15.9872L0 13.9901L3.18251 10.967L0.971376 7.15892L5.26746 6.3536L5.44571 1.94452L9.48944 3.61184L11.999 0Z" fill="%23520bf5"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}


/* ==========================================================================
   PROJECT CARDS (RESPONSIVE GRID: 3 -> 2 -> 1)
   ========================================================================== */

.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 1500px;
  color: var(--text-color);
  align-items: start;
}

/* На десктопе все 3 карточки стоят в один ряд */
.projects-block {
  border: 1px solid var(--light-gray);
  padding: 16px;
  border-radius: 16px;
  position: relative;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* Планшеты и средние экраны (2 колонки без вертикальных дыр) */
@media (max-width: 1100px) and (min-width: 651px) {
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Высокая карточка LunaObscura встает во 2-ю колонку на 2 ряда,
     а левые карточки (Плагины и Эмбиент) плотно смыкаются друг под другом */
  .projects-block:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

/* Смартфоны (1 колонка) */
@media (max-width: 650px) {
  .projects {
    grid-template-columns: 1fr;
  }
}

/* Внутренние отступы */
.projects-block * {
  padding: 0;
  margin: 0;
}

.projects-block > * + * {
  margin-top: 24px !important;
}

/* Адаптивные медиа */
.projects-block img,
.projects-block video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  object-fit: cover;
}

.projects-block p {
  text-wrap: balance;
  line-height: 1.35;
}


/* ==========================================================================
   PAGE LOAD ANIMATIONS & ACCESSIBILITY
   ========================================================================== */

.fade-in {
  opacity: 0;
  -webkit-transform: translateY(48px);
  transform: translateY(48px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: opacity, transform;
}

.fade-in.is-ready {
  -webkit-animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) var(--delay, 0s) both;
  animation: fadeInUp 1s cubic-bezier(0.16, 1, 0.3, 1) var(--delay, 0s) both;
}

@-webkit-keyframes fadeInUp {
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    -webkit-transform: none;
    transform: none;
  }
  .fade-in.is-ready {
    -webkit-animation: none;
    animation: none;
  }
}