* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: #1b1b1b;
  color: #ffffff;
}

body {
  background-image: url("../assets/bg/main-bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* HEADER */

.site-header {
  position: fixed;
  top: 28px;
  left: 36px;
  z-index: 100;
}

.brand-mark {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.88);
}

/* INTRO */

.hero-symbol {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
  transition: opacity 1.2s ease, transform 1.2s ease;
}

.hero-ms {
  font-family: "Cormorant Garamond", serif;
  font-size: 180px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.05);
  user-select: none;
}

body.menu-visible .hero-symbol {
  opacity: 0;
  transform: scale(1.08);
}

.intro-hint {
  position: fixed;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  opacity: 0.65;
  transition: opacity 0.8s ease;
}

.intro-hint span {
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.72);
  text-transform: lowercase;
  animation: breathe 2.8s ease-in-out infinite;
}

body.menu-visible .intro-hint {
  opacity: 0;
}

@keyframes breathe {
  0% {
    opacity: 0.45;
    transform: translateY(0);
  }

  50% {
    opacity: 0.9;
    transform: translateY(-4px);
  }

  100% {
    opacity: 0.45;
    transform: translateY(0);
  }
}

/* LAYOUT */

.portfolio-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 24px;
  padding: 72px 40px 40px;
  perspective: 1200px;

  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;

  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}

body.menu-visible .portfolio-layout {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.tile-main {
  grid-column: 1;
  grid-row: 1 / 3;
}

.tile-top {
  grid-column: 2;
  grid-row: 1;
}

.tile-bottom {
  grid-column: 2;
  grid-row: 2;
}

/* TILES */

.tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 24px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;

  opacity: 0;
  transform-style: preserve-3d;
  will-change: transform;

  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.05),
      rgba(255, 255, 255, 0.02)
    );

  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);

  border: 1px solid rgba(255, 255, 255, 0.06);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 80px rgba(0, 0, 0, 0.35);

  transition:
    transform 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease;
}

body.menu-visible .tile {
  animation: tileReveal 1.8s ease forwards;
}

body.menu-visible .tile:nth-child(1) {
  animation-delay: 0.15s;
}

body.menu-visible .tile:nth-child(2) {
  animation-delay: 0.28s;
}

body.menu-visible .tile:nth-child(3) {
  animation-delay: 0.41s;
}

@keyframes tileReveal {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
    filter: blur(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.tile:hover {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.035),
      rgba(255, 255, 255, 0.015)
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 32px 100px rgba(0, 0, 0, 0.45);
}

/* TILE MAIN PORTRAIT */

.tile-main {
  background: transparent;
}

.portrait-layer {
  position: absolute;
 inset: 32px 32px 120px 32px;
  z-index: 1;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* первый кадр: цветной портрет */
.portrait.color {
  opacity: 0.58;
  filter: blur(0px) saturate(1.15) contrast(1.05);
  transition:
    opacity 2s ease,
    filter 2s ease;
}

/* второй слой: ч/б портрет изначально скрыт */
.portrait.bw {
  opacity: 0;
  filter: grayscale(1) contrast(1.05);
  transition:
    opacity 2.2s ease,
    filter 2.2s ease;
}

/* плавный переход color → bw */
body.menu-visible .tile-main .portrait.color {
  opacity: 0.05;
  filter: blur(14px) saturate(0.2) contrast(0.9);
  transition-delay: 1.3s;
}

body.menu-visible .tile-main .portrait.bw {
  opacity: 0.75;
  filter: grayscale(1) contrast(1.2);
  transition-delay: 1.3s;
}

/* glass overlay только для большой плитки */
.tile-main .tile-glass {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;

  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.045),
      rgba(255, 255, 255, 0.018)
    );

backdrop-filter: blur(2px) saturate(105%);
-webkit-backdrop-filter: blur(2px) saturate(105%);
}

/* CONTENT */

.tile-content {
  position: absolute;
  left: 40px;
  bottom: 40px;
  z-index: 3;
}

h1 {
  font-size: 42px;
  font-weight: 300;
}

h2 {
  font-size: 28px;
  font-weight: 300;
}

.swap-text {
  transition: opacity 0.6s ease;
}

/* GROUP TILES */

.tile-group {
  padding: 28px;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.028),
      rgba(255, 255, 255, 0.010)
    );
  border-color: rgba(255, 255, 255, 0.04);
}

.tile-group .group-title {
  position: relative;
  z-index: 2;
  margin-bottom: 22px;
}

.group-title h2 {
  font-size: 28px;
  font-weight: 300;
  margin-bottom: 6px;
}

.group-title p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.58);
  letter-spacing: 0.04em;
}

.mini-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mini-tile {
  min-height: 82px;
  border-radius: 18px;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  padding: 14px;

  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.095),
      rgba(255, 255, 255, 0.045)
    );

  border: 1px solid rgba(255, 255, 255, 0.11);

  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;

  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.04em;

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 14px 40px rgba(0, 0, 0, 0.18);

  transition: 0.35s ease;
}

.mini-tile:hover {
  transform: translateY(-3px);
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.13),
      rgba(255, 255, 255, 0.06)
    );

  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* MOBILE */

@media (max-width: 700px) {
  body {
    background-attachment: scroll;
  }

  .site-header {
    top: 28px;
    left: 28px;
  }

  .brand-mark {
    font-size: 20px;
    letter-spacing: 0.2em;
  }

  .portfolio-layout {
    min-height: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 96px 20px 28px;
  }

  .tile-main,
  .tile-top,
  .tile-bottom {
    grid-column: auto;
    grid-row: auto;
  }

  .tile {
    min-height: auto;
    border-radius: 24px;
  }

  .tile-main {
    min-height: 420px;
  }

  .tile-group {
    padding: 24px;
  }

  .tile-content {
    left: 28px;
    bottom: 32px;
  }

  h1 {
    font-size: 38px;
    line-height: 1.08;
  }

  .group-title h2 {
    font-size: 30px;
  }

  .group-title p {
    font-size: 14px;
    margin-top: 6px;
  }

  .mini-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .mini-tile {
    min-height: 76px;
    font-size: 13px;
  }
}

.portrait-layer::after {
  content: "";
  position: absolute;
  inset: 0;

  background: radial-gradient(
    circle,
    transparent 60%,
    rgba(0,0,0,0.35) 100%
  );

  pointer-events: none;
}

.animated-link.is-launching {
  pointer-events: none;
  color: #ffffff;
  animation: identityLaunch 0.9s ease forwards;
}

.animated-link.is-launching {
  animation: identityLaunch 0.9s ease forwards;
}

@keyframes identityLaunch {
  0% {
    letter-spacing: 0.04em;
    filter: blur(0);
    transform: scale(1);
  }

  45% {
    letter-spacing: 0.18em;
    filter: blur(1px);
    transform: scale(1.03);
  }

  100% {
    letter-spacing: 0.28em;
    filter: blur(4px);
    opacity: 0;
    transform: scale(1.08);
  }
}

.animated-link::after {
  content: "↗";
  margin-left: 6px;
  opacity: 0.5;
}

.mini-tile {
  text-decoration: none;
  color: inherit;
}