/* ==========================================
   BASE STYLES & RESET
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* ==========================================
   CSS CUSTOM PROPERTIES
   ========================================== */
:root {
  /* Brand Colors */
  --cloudy-sky: #5697d3;
  --bright-ocean: #418cc7;
  --blue-grey: #5a9cd3;
  --vanilla-custard: #ecdca0;
  --baby-blue-ice: #90b9e2;
  --dust-grey: #D4CCC7;
  --dark-coffee: #3D2824;
  --chocolate-plum: #5B4747;
  --pale-oak: #CDB7A2;
}

/* ==========================================
   LAYOUT & SECTIONS
   ========================================== */
.scroll-container {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
  scroll-behavior: smooth;
}

.section {
  min-height: 100vh;
  scroll-snap-align: start;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */
.scroll-container::-webkit-scrollbar {
  width: 8px;
}

.scroll-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.scroll-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--cloudy-sky), var(--bright-ocean));
  border-radius: 4px;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--bright-ocean), var(--blue-grey));
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-100%);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

/* ==========================================
   MENU ICON
   ========================================== */
.menu-icon {
  cursor: pointer;
  transition: transform 0.3s ease, color 0.3s ease;
  user-select: none;
}

.menu-icon:hover {
  transform: scale(1.1) rotate(5deg);
}

.menu-icon:active {
  transform: scale(0.95);
}

/* ==========================================
   NAVIGATION LINKS
   ========================================== */
.nav-link {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: rgba(86, 151, 211, 0.25);
  transition: width 0.3s ease;
  z-index: -1;
}

.nav-link:hover::before {
  width: 100%;
}

.nav-link:hover {
  transform: translateX(5px);
  color: var(--baby-blue-ice);
}

/* ==========================================
   BUTTONS
   ========================================== */
.scroll-btn,
.carousel-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.scroll-btn:hover,
.carousel-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

.scroll-btn:active,
.carousel-btn:active {
  transform: translateY(0);
}

/* ==========================================
   THEME TOGGLE
   ========================================== */
#themeToggle {
  position: relative;
  overflow: hidden;
}

#themeToggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(86, 151, 211, 0.4);
}

#themeIcon {
  display: inline-block;
  transition: transform 0.3s ease;
}

#themeToggle:hover #themeIcon {
  transform: rotate(20deg) scale(1.1);
}

/* ==========================================
   SKILL BADGES
   ========================================== */
.skill-badge {
  background: linear-gradient(135deg, var(--bright-ocean), var(--cloudy-sky));
  box-shadow: 0 2px 8px rgba(86, 151, 211, 0.3);
  transition: all 0.3s ease;
  cursor: default;
}

.skill-badge:hover {
  box-shadow: 0 6px 16px rgba(86, 151, 211, 0.5);
  transform: translateY(-3px) scale(1.05);
}

/* ==========================================
   CAROUSEL
   ========================================== */
.carousel-wrapper {
  overflow: visible;
}

.carousel-container {
  perspective: 1200px;
  position: relative;
  overflow: visible;
}

.carousel-item {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.5s ease,
              filter 0.5s ease;
  pointer-events: none;
  text-decoration: none;
  color: inherit;
  display: block;
}

.carousel-item.active {
  transform: translateX(-50%) scale(1) translateZ(0);
  opacity: 1;
  z-index: 10;
  filter: blur(0px);
  pointer-events: auto;
}

.carousel-item.prev {
  transform: translateX(-50%) scale(0.85) translateX(-40%) rotateY(15deg) translateZ(-100px);
  opacity: 0;
  z-index: 5;
  filter: blur(2px);
  pointer-events: none;
}

.carousel-item.next {
  transform: translateX(-50%) scale(0.85) translateX(40%) rotateY(-15deg) translateZ(-100px);
  opacity: 0;
  z-index: 5;
  filter: blur(2px);
  pointer-events: none;
}

.carousel-item.hidden {
  opacity: 0;
  transform: translateX(-50%) scale(0.7) translateZ(-200px);
  z-index: 0;
  filter: blur(4px);
  pointer-events: none;
}

/* ==========================================
   PROJECT CARDS
   ========================================== */
.project-card {
  border: 1px solid rgba(86, 151, 211, 0.2);
  transition: all 0.3s ease;
  height: 100%;
}

.project-card:hover {
  border-color: var(--cloudy-sky);
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(86, 151, 211, 0.2);
}

.project-card img {
  transition: transform 0.3s ease;
}

.project-card:hover img {
  transform: scale(1.05);
}

.project-card .text-xs {
  transition: all 0.2s ease;
}

.project-card .text-xs:hover {
  transform: scale(1.05);
}

/* ==========================================
   CONTACT CARDS
   ========================================== */
.contact-card {
  backdrop-filter: blur(10px);
  border-left: 4px solid var(--cloudy-sky);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.contact-card:hover {
  border-left-color: var(--bright-ocean);
  transform: translateY(-5px);
}

.contact-item {
  cursor: pointer;
  transition: all 0.3s ease;
}

.contact-item:hover {
  background: rgba(90, 156, 211, 0.2);
  border-left: 3px solid var(--baby-blue-ice);
  padding-left: calc(1rem - 3px);
}

/* ==========================================
   STAT CARDS
   ========================================== */
.stat-card {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--cloudy-sky), var(--bright-ocean));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  transform: scale(1.05);
}

.stat-card:hover::before {
  opacity: 1;
}

/* ==========================================
   DOWNLOAD BUTTON
   ========================================== */
.download-btn {
  box-shadow: 0 4px 12px rgba(86, 151, 211, 0.3);
  transition: all 0.3s ease;
}

.download-btn:hover {
  box-shadow: 0 8px 24px rgba(86, 151, 211, 0.5);
  transform: scale(1.02) translateY(-2px);
}

/* ==========================================
   GALLERY
   ========================================== */
.gallery-carousel-wrapper {
  width: 100%;
  overflow: hidden;
  position: relative;
}

.gallery-carousel {
  display: flex;
  gap: 2rem;
  width: fit-content;
}

.gallery-carousel.scroll-right {
  animation: scrollRight 30s linear infinite;
}

.gallery-carousel.scroll-left {
  animation: scrollLeft 30s linear infinite;
}

.gallery-carousel:hover {
  animation-play-state: paused;
}

.gallery-item {
  flex-shrink: 0;
  width: 300px;
  height: 300px;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
  border: 3px solid transparent;
  background-clip: padding-box;
  position: relative;
}

.gallery-item::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 1rem;
  padding: 3px;
  background: linear-gradient(135deg, var(--cloudy-sky), var(--bright-ocean), var(--baby-blue-ice));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-item:hover {
  transform: scale(1.05);
  z-index: 10;
}

.gallery-item:hover::before {
  opacity: 1;
}

.gallery-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.8s ease forwards;
  opacity: 0;
}

.fade-in-up.animated {
  opacity: 1;
}

.fade-in-up:nth-child(1) { animation-delay: 0.1s; }
.fade-in-up:nth-child(2) { animation-delay: 0.2s; }
.fade-in-up:nth-child(3) { animation-delay: 0.3s; }
.fade-in-up:nth-child(4) { animation-delay: 0.4s; }

@keyframes scrollRight {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes scrollLeft {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ==========================================
   TYPING EFFECT
   ========================================== */
.typing::after {
  content: '|';
  animation: blink 0.7s infinite;
  margin-left: 2px;
  color: var(--baby-blue-ice);
}

.typing-complete::after {
  content: '';
}

#about-heading {
  min-height: 1.2em;
  display: inline-block;
}

#connect-heading {
  min-height: 1.2em;
  display: inline-block;
  width: 100%;
  text-align: center;
}

/* ==========================================
   SECTION TITLE ACCENTS
   ========================================== */
h2[id$="-heading"] {
  position: relative;
  padding-bottom: 0.5rem;
}

h2[id$="-heading"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--cloudy-sky), var(--bright-ocean));
  border-radius: 2px;
}

/* ==========================================
   IMAGE HOVER EFFECTS
   ========================================== */
.about-image-container {
  transition: transform 0.3s ease;
}

.about-image-container:hover {
  transform: scale(1.02);
}

.about-image-container img {
  transition: filter 0.3s ease;
}

.about-image-container:hover img {
  filter: brightness(1.05);
}

/* ==========================================
   SELECTION & FOCUS STATES
   ========================================== */
::selection {
  background-color: var(--cloudy-sky);
  color: white;
}

::-moz-selection {
  background-color: var(--cloudy-sky);
  color: white;
}

*:focus-visible {
  outline: 2px solid var(--bright-ocean);
  outline-offset: 2px;
}

button:focus-visible,
.carousel-btn:focus-visible,
.scroll-btn:focus-visible {
  outline: 2px solid var(--baby-blue-ice);
  outline-offset: 3px;
}

/* ==========================================
   LINKS
   ========================================== */
a:not(.nav-link):not(.carousel-btn):not(.scroll-btn):not(.download-btn) {
  color: var(--bright-ocean);
  transition: color 0.2s ease;
}

a:not(.nav-link):not(.carousel-btn):not(.scroll-btn):not(.download-btn):hover {
  color: var(--baby-blue-ice);
  text-decoration-color: var(--baby-blue-ice);
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 768px) {
  .sidebar {
    width: 80vw;
  }

  .carousel-item {
    width: 90vw !important;
    height: 60vh !important;
  }
}