@font-face {
  font-family: 'Hagrid';
  src: url('assets/fonts/Hagrid-Variable-trial.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
}

@font-face {
  font-family: 'Hagrid Text';
  src: url('assets/fonts/Hagrid-Text-Variable-trial.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
}

@font-face {
  font-family: 'MyIcon';
  src: url('assets/fonts/MyIcon.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-color: #BDBDBD;
  --text-color: #424242;
  --border-radius: 8px;
  --transition: all 0.3s ease;
  --display-font: 'Hagrid', sans-serif;
  --text-font: 'Hagrid Text', sans-serif;
}

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

html, body {
  height: 100%;
  background-color: var(--bg-color);
  overflow: hidden; /* Hide all scrollbars to enforce strict bounding */
}

body {
  font-family: var(--text-font);
  color: var(--text-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display-font);
}

/* Icon Font Classes */
.icon {
  font-family: 'MyIcon' !important;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 24px;
}

.icon-github::before { content: "\f09b"; }
.icon-linkedin::before { content: "\f08c"; }
.icon-dribbble::before { content: "\f17d"; }
.icon-medium::before { content: "\f23a"; }
.icon-vimeo::before { content: "\f27d"; }
.icon-youtube::before { content: "\f431"; }
.icon-telegram::before { content: "\e802"; }
.icon-mail::before { content: "\f0e0"; }

/* Hero Section */
.hero {
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Pin entire inner wrapper to the bottom */
  overflow: hidden;
}

.hero-inner {
  display: flex;
  flex-direction: row; /* Landscape: Content left, Canvas right */
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  align-items: center; /* This perfectly centers the left-text relative to the height of the right-canvas! */
}

.content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-left: 8vw;
  max-width: 700px;
  z-index: 2;
}

.canvas-container {
  flex: 1.2;
  display: flex;
  justify-content: center;
  align-items: flex-end; /* Ensure inner canvas is pinned exactly to bottom */
}

#rive-canvas {
  width: 100%;
  max-width: 950px;
  max-height: 100vh;
  aspect-ratio: 1; /* In desktop mode, a square preserves structural height for vertical centering */
  display: block;
}

.fallback-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-color);
  font-size: 1.2rem;
  z-index: 1;
}

.content-wrapper h1 {
  font-size: 4.5rem;
  margin-bottom: 0.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 1.8rem;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

/* Social Buttons */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  justify-content: center; /* Align buttons relative to the flex container */
  max-width: 360px; /* Forces exactly 5 buttons top row, 3 centered bottom row */
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background-color: rgba(224, 224, 224, 0.49);
  color: var(--brand-color);
  border-radius: var(--border-radius);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-social:hover, .btn-social:focus {
  background-color: var(--brand-color-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  outline: none;
}

.github { --brand-color: #24292e; --brand-color-hover: rgba(36, 41, 46, 0.25); }
.linkedin { --brand-color: #2867b2; --brand-color-hover: rgba(40, 103, 178, 0.25); }
.dribbble { --brand-color: #ea4c89; --brand-color-hover: rgba(234, 76, 137, 0.25); }
.medium { --brand-color: #000000; --brand-color-hover: rgba(0, 0, 0, 0.25); }
.vimeo { --brand-color: #1ab7ea; --brand-color-hover: rgba(26, 183, 234, 0.25); }
.youtube { --brand-color: #ff0000; --brand-color-hover: rgba(255, 0, 0, 0.25); }
.telegram { --brand-color: #0088cc; --brand-color-hover: rgba(0, 136, 204, 0.25); }
.mail { --brand-color: #424242; --brand-color-hover: rgba(66, 66, 66, 0.25); }

/* Tooltip */
.tooltip-container {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  background-color: var(--text-color);
  color: var(--bg-color);
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 20;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  font-size: 1rem;
  font-family: var(--text-font);
  pointer-events: none;
}

.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: var(--text-color) transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text,
.tooltip-container:active .tooltip-text,
.tooltip-container:focus-within .tooltip-text {
  visibility: visible;
  opacity: 1;
  transition-delay: 0.3s;
}

/* Responsive */
@media (max-width: 900px) {
  .hero {
    justify-content: flex-start; /* Flow from top */
  }

  .hero-inner {
    flex-direction: column;
    height: 100vh;
    justify-content: flex-start;
    align-items: center;
    padding: 0;
  }

  .content-wrapper {
    flex: none; /* Let text take natural height */
    padding: 8vh 2rem 1rem 2rem; /* Buffer on top */
    align-items: center;
    text-align: center;
  }

  .content-wrapper h1 {
    font-size: 3.5rem;
  }

  .subtitle {
    font-size: 1.4rem;
  }

  .social-links {
    margin: 0 auto;
    max-width: 320px; /* Slightly tighter on mobile to ensure wrapping */
  }

  .canvas-container {
    flex: 1; /* Fill the remaining vertical space */
    width: 100%;
    align-items: flex-end; /* Force canvas down to the bottom */
    min-height: 0; /* Important flex fix to allow shrinking inside parent height */
  }

  #rive-canvas {
    height: 100%; /* Instead of aspect-ratio, inherit EXACT remaining height */
    width: 100%;
    max-width: 750px;
    max-height: 100%;
    aspect-ratio: auto; /* Remove aspect-ratio so the element bounds precisely to the screen */
  }
}

@media (max-width: 480px) {
  .content-wrapper h1 {
    font-size: 2.8rem;
  }
  
  .subtitle {
    font-size: 1.2rem;
  }
  
  .social-links {
    max-width: 290px;
    gap: 1rem;
  }
  
  .btn-social {
    width: 50px;
    height: 50px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}