/* =============================================
   Portfolio Homepage — Pure HTML/CSS
   Colors: #18181B (text), #8B5CF6 (brand), #f8fafc (bg)
   ============================================ */

:root {
  --text: #18181B;
  --brand: #8B5CF6;
  --bg: #E4E4E7; /* Измененный цвет фона страницы */
  --system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@view-transition {
  navigation: auto;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--system);
}

.wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --------------------------------------------
   1. Title "Portfolio"
   -------------------------------------------- */
.page-title {
  font-family: "Briem Hand", cursive;
  font-size: 56px;
  font-weight: 400;
  color: var(--text);
  text-align: center;
  margin: 0 0 16px;
}

/* --------------------------------------------
   2. Glassmorphism tags
   Fallback: older browsers may show solid bg if backdrop-filter unsupported
   -------------------------------------------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 56px;
}

/* Auto layout: H 48, padding 8 16, gap 8 | Fill: #FFF 10% | Radius 24 | Glass: Light -45°/80%, Refraction 100, Depth 37, Dispersion 50, Frost 0 | Black border, Dark shadow */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 24px;
  /* Liquid Glass Effect */
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.05),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  font-family: Inter, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  transition: all 0.3s ease;
}

/* --------------------------------------------
   3. Hero multi-line headline + profile photo
   Photo overlaps text on the right (screenshot layout)
   -------------------------------------------- */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px 0;
  margin-bottom: 64px;
  position: relative;
}

.hero-text {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.hero-full-image {
  max-width: 100%;
  max-height: 45vh; /* Ограничиваем высоту для посадки на один экран */
  width: auto;
  display: block;
  margin: 0 auto;
  transition: transform 0.1s ease-out; /* Плавность для 3D tilt */
  will-change: transform;
}

.hero-photo {
  width: 270px;
  height: 270px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: block;
}

/* --------------------------------------------
   4. Bottom navigation (5 cards)
   -------------------------------------------- */
.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px; /* Отступ между кнопками 32px -> 24px */
  margin-bottom: 24px;
}

.nav-button {
  position: relative; /* Для позиционирования tooltip */
  display: flex;
  align-items: center;
  gap: 8px; /* Добавлен отступ 8px между иконкой и текстом */
  background: transparent; /* Убран фоновый цвет */
  border-radius: 8px; /* Corner radius for the button */
  text-decoration: none;
  color: var(--text);
  font-family: Inter, sans-serif;
  font-weight: 500;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-button-icon-wrapper {
  width: 48px; /* Layout container 48x48px */
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px; /* Corner radius 8px */
  background-color: white; /* White background for the icon wrapper */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Плавное вращение с отскоком */
}

.nav-button-icon {
  font-size: 24px; /* Размер эмодзи */
  line-height: 1;
}

.nav-button-text {
  padding: 8px 24px; /* Padding 8px top/bottom, 24px left/right */
  background-color: white; /* Цвет текстового поля - белый */
  border-radius: 8px; /* Скругление 8 пикс. для текстового поля */
  font-size: 18px; /* Font size 18px */
  line-height: 32px; /* Line height 32px */
  text-align: center;
  transition: color 0.2s ease;
}

/* --- Hover Effects --- */

.nav-button:hover {
  background-color: transparent; /* Прозрачный фон при наведении */
  transform: translateY(0); /* Убираем стандартный сдвиг, так как у нас есть вращение */
}

.nav-button:hover .nav-button-icon-wrapper {
  transform: rotate(-10deg) scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.nav-button:hover .nav-button-text {
  color: var(--brand); /* Изменение цвета текста на фиолетовый */
}

/* --- Tooltip Styles --- */

.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: max-content; /* Allow width to fit text naturally, up to a max */
  max-width: 260px;
  padding: 8px 12px;
  background: #18181B; /* Dark tooltip */
  border-radius: 8px;
  font-family: Inter, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #fff; /* White text */
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nav-button:hover .tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-12px); /* Slide up slightly */
}

/* Tooltip Arrow */
.tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px; /* Position at bottom edge */
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: #18181B;
  border-radius: 1px;
  border: none;
  box-shadow: none;
  z-index: -1;
}

/* Remove old thought bubble tails */
.tooltip::after {
  display: none;
}

.footer-text {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 40px;
  color: #666;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .tag {
    font-size: 14px;
    min-height: 32px;
    padding: 6px 12px;
  }

  .nav-buttons {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .nav-button {
    width: 100%;
    height: 36px;
  }
  
  .nav-button-text {
    flex: 1;
    font-size: 14px;
    line-height: 20px;
    padding: 0 16px; /* Use flex alignment instead of vertical padding for precise height */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
  }
  
  .nav-button-icon-wrapper {
    width: 36px;
    height: 36px;
    min-width: 36px; /* Prevent shrinking */
  }
  
  .nav-button-icon {
    font-size: 18px;
  }
  
  .tooltip {
    display: none;
  }

  .footer-text {
    font-size: 12px;
  }
}

/* =============================================
   Interactive Page Transitions
   ============================================= */

/* Base transition state for elements to be animated out */
.page-title,
.tags,
.hero,
.nav-buttons,
.footer-text {
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

/* Exiting state - triggered by JS */
body.exiting {
  overflow: hidden; /* Prevent scrollbars during transition */
}

body.exiting .page-title {
  opacity: 0;
  transform: translateY(-20px);
}

body.exiting .tags {
  opacity: 0;
  transform: translateY(-20px);
  transition-delay: 0.05s;
}

body.exiting .hero {
  opacity: 0;
  transform: translateY(-20px) scale(0.98);
  transition-delay: 0.1s;
}

body.exiting .nav-buttons {
  opacity: 0;
  transform: translateY(20px); /* Move down to split the screen visually */
  transition-delay: 0.15s;
}

body.exiting .footer-text {
  opacity: 0;
  transition-delay: 0.2s;
}
