/* ================================
   VARIABLES
================================ */
:root {
  --bg: #0e1117;
  --footer-bg: #111418;
  --text: #e6e6e6;
  --accent: #4ea8de;
  --accent-hover: #74c0fc;
  --transition: all 0.3s ease-in-out;
  --radius: 10px;
  --font-main: "Inter", sans-serif;
  --header-h: 60px;
}

/* ================================
   RESET & BASE
================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  width: 100%;
  overflow-x: clip;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  line-height: 1.6;
}

/* ================================
   DECORATIVE GLOWS
================================ */
.top-left-glow,
.top-right-glow,
.bottom-left-glow,
.bottom-right-glow {
  position: fixed;
  width: 80vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  contain: layout paint style;
  will-change: opacity, transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}
.top-left-glow {
  top: -25vh;
  left: -10vw;
  background: radial-gradient(
    circle at 10% 15%,
    rgba(0, 255, 255, 0.85) 0%,
    rgba(0, 255, 255, 0.4) 22%,
    rgba(0, 255, 255, 0.16) 40%,
    transparent 70%
  );
  filter: blur(80px) saturate(180%);
  transform: rotate(-5deg);
}
.top-right-glow {
  top: -25vh;
  right: -10vw;
  background: radial-gradient(
    circle at 85% 15%,
    rgba(0, 255, 255, 0.7) 0%,
    rgba(0, 255, 255, 0.35) 25%,
    rgba(0, 255, 255, 0.15) 45%,
    transparent 70%
  );
  filter: blur(100px) saturate(160%);
  transform: rotate(5deg) translateZ(0);
}
.bottom-left-glow {
  bottom: -25vh;
  left: -15vw;
  background: radial-gradient(
    circle at 15% 85%,
    rgba(0, 255, 255, 0.7) 0%,
    rgba(0, 255, 255, 0.35) 25%,
    rgba(0, 255, 255, 0.15) 45%,
    transparent 70%
  );
  filter: blur(100px) saturate(160%);
  transform: rotate(-3deg);
  opacity: 0.5;
}
.bottom-right-glow {
  bottom: -25vh;
  right: -15vw;
  background: radial-gradient(
    circle at 85% 85%,
    rgba(0, 255, 255, 0.7) 0%,
    rgba(0, 255, 255, 0.35) 25%,
    rgba(0, 255, 255, 0.15) 45%,
    transparent 70%
  );
  filter: blur(100px) saturate(160%);
  transform: rotate(3deg);
  opacity: 0.5;
}
.hero .container,
.about-hero .container,
.work-hero .container,
.contact-hero .container {
  position: relative;
  z-index: 2;
}

/* ================================
   HEADER & NAV
================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-h);
  z-index: 1000;
  background: rgba(14, 17, 23, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  padding: 0 2rem;
}
.logo {
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
}
.logo:hover {
  color: var(--accent-hover);
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10000;
}
.nav-toggle span {
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-toggle.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.nav {
  display: none;
}
.nav.open {
  position: fixed;
  inset: 0;
  display: flex;
  width: 100vw;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: rgba(14, 17, 23, 0.9);
  backdrop-filter: blur(50px) saturate(200%);
  z-index: 9999;
  pointer-events: auto;
}
.nav.open ul {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  align-items: center;
  list-style: none;
}
.nav.open li {
  opacity: 0;
  animation: fadeSlide 0.4s ease forwards;
}
.nav.open li:nth-child(2) {
  animation-delay: 0.1s;
}
.nav.open li:nth-child(3) {
  animation-delay: 0.2s;
}
.nav.open li:nth-child(4) {
  animation-delay: 0.3s;
}
.nav.open a {
  color: var(--text);
  font-size: 1.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
}
.nav.open a:hover {
  color: var(--accent-hover);
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Body state when nav open */
body.nav-open {
  overflow: hidden;
  background: rgba(14, 17, 23, 0.85);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  backdrop-filter: blur(25px) saturate(180%);
  will-change: opacity, transform;
  contain: paint;
  transform: translateZ(0);
}

/* ================================
   LAYOUT WRAPPER & HERO
================================ */
.page-wrapper {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-h);
  position: relative;
  z-index: 1;
}
.hero {
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  overflow: hidden;
  padding: 0 1rem;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.hero-title span {
  color: var(--accent);
}
.hero-subtitle {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  color: var(--accent);
  font-weight: 400;
  margin-top: 0.5rem;
}

/* Avatar */
.profile-pic {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
}
.profile-pic img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 25%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 30px rgba(78, 168, 222, 0.4);
  transition: transform 0.3s, box-shadow 0.3s;
}
.profile-pic img:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(78, 168, 222, 0.7);
}

/* ================================
   ABOUT
================================ */
.about-hero {
  min-height: 60vh;
  display: flex;
  align-items: center;
  text-align: center;
  color: #f0f0f0;
  padding: 100px 20px 80px;
}
.about-hero .hero-content {
  max-width: 900px;
  margin: 0 auto;
}
.about-hero p {
  color: #d3d3d3;
  font-size: 1.05rem;
  line-height: 1.8;
  margin-top: 1rem;
}
.about-section {
  padding: 100px 20px;
}
.skills-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: #fff;
}
.skills-list {
  list-style: none;
}
.skills-list li {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
  color: #dcdcdc;
  font-size: 0.95rem;
}
.skills-list li strong {
  color: #fff;
}

/* ================================
   WORK — GRID & CARDS
   (Project 5 first, 3/2/1 columns, equal heights)
================================ */

/* Move Project 5 (live stream) visually first */
.work-hero .live-stream-card {
  order: -1;
}

/* Grid (max 3 columns) */
.work-hero .grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  justify-items: stretch;
  align-items: stretch;
  width: 100%;
  max-width: 1100px;
  margin: 2rem auto;
  grid-auto-rows: 1fr;
}

/* Card base */
.work-hero .card,
.work-hero .live-stream-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  background: #151a21;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  height: 100%;
  transition: var(--transition);
}
.work-hero .card:hover,
.work-hero .live-stream-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}
.work-hero .live-stream-card {
  grid-column: auto !important;
}

/* Media (images & video wrapper fill equally) */
.work-hero .card img,
.work-hero .video-wrapper {
  width: 100%;
  flex: 1 1 auto;
  object-fit: cover;
  flex-shrink: 0;
}
.video-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 0;
  overflow: hidden;
}
.video-wrapper video,
.live-stream-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 16/9;
  border-radius: 0;
}

/* Titles */
.work-hero .card h3,
.work-hero .live-stream-card h3 {
  padding: 1rem;
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  text-align: center;
}

/* Offline overlay & live badge (keep same look) */
.offline-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0e0e0e;
  color: #ff4d4d;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  border-radius: 0;
  z-index: 2;
}
.offline-message i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #ff4d4d;
}
.offline-message p {
  margin: 0;
  line-height: 1.4;
}
.live-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 0, 0, 0.85);
  color: #fff;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 14px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.05);
  }
}

/* ================================
   CONTACT
================================ */
.contact-hero {
  min-height: 60vh;
  display: flex;
  align-items: center;
  text-align: center;
  color: #f0f0f0;
  position: relative;
  padding: 100px 20px 80px;
}
.contact-hero .container {
  max-width: 900px;
  margin: 0 auto;
}
.contact-section {
  padding: 100px 20px;
}
.contact-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  max-width: 700px;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1.5rem;
}
.form-group {
  text-align: left;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #ccc;
  font-weight: 500;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1rem;
  outline: none;
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #aaa;
}

/* Buttons */
.btn-cv {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, var(--accent), #0096c7);
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 16px rgba(78, 168, 222, 0.25);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.4s;
}
.btn-cv::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  transform: skewX(-20deg);
  transition: all 0.4s ease;
}
.btn-cv:hover::before {
  left: 125%;
}
.btn-cv:hover {
  background: linear-gradient(135deg, var(--accent-hover), #00bcd4);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(78, 168, 222, 0.4);
}
.btn-submit {
  background: linear-gradient(135deg, #1e90ff, #00bcd4);
  color: #fff;
  font-weight: 600;
  padding: 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.btn-submit:hover {
  opacity: 0.85;
  transform: translateY(-2px);
}

.contact-info {
  margin-top: 2rem;
  color: #ccc;
  font-size: 0.95rem;
}
.contact-info a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.3s ease;
}
.contact-info a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.contact-info p {
  margin: 8px 0;
}
.contact-info i {
  color: #00bcd4;
  margin-right: 8px;
}

/* ================================
   FOOTER
================================ */
.socials a {
  color: #ccc;
  margin: 10px;
  font-size: 1.3rem;
  transition: color 0.3s ease, transform 0.3s ease;
}
.socials a:hover {
  color: #00bcd4;
  transform: translateY(-3px);
}
.footer {
  background: var(--footer-bg);
  color: var(--text);
  text-align: center;
  padding: 0;
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.footer .socials {
  margin-bottom: 0.5rem;
}
.footer .socials a {
  margin: 0 0.5rem;
  color: var(--text);
  font-size: 1.2rem;
  transition: var(--transition);
}
.footer .socials a:hover {
  color: var(--accent-hover);
}
.contact-page .footer {
  padding-top: 20px;
  padding-bottom: 20px;
}

/* ================================
   UTILITIES
================================ */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  margin-bottom: 1rem;
  transition: opacity 0.6s, transform 0.6s;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Section minimum heights (account for fixed header) */
.hero,
.about-hero,
.work-hero,
.contact-hero {
  min-height: calc(100dvh - var(--header-h) - var(--footer-h, 81px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.contact-hero,
.about-hero {
  min-height: 100%;
}

/* Screen-reader helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  clip: auto;
  white-space: normal;
}

/* ================================
   MEDIA QUERIES
================================ */

/* Desktop ≤1140px → 2 columns */
@media (max-width: 1140px) {
  .work-hero {
    margin: 0 20px 20px 20px;
  }
  .work-hero .grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 1100px;
    margin: auto;
  }
}

/* Very large screens ≥1600px: keep centered width */
@media (min-width: 1600px) {
  .work-hero .grid {
    max-width: 1300px;
  }
}

/* Tablet tweaks ≤1024px (scope to work grid to avoid global side-effects) */
@media (max-width: 1024px) {
  .work-hero .grid {
    max-width: 100%;
  }
}

/* Desktop nav (≥768px) */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  .nav {
    display: block;
    position: static;
    background: none;
  }
  .nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
  }
  .nav a {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
  }
  .nav a:hover,
  .nav a.active {
    color: var(--accent-hover);
  }
  .nav.open {
    display: none;
  }
}

/* Mobile ≤768px */
@media (max-width: 768px) {
  .profile-pic img {
    width: 180px;
    height: 180px;
  }
  .work-hero .grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .btn-cv {
    padding: 0.7rem 1.4rem;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    border-radius: 8px;
    width: auto;
  }
}
