:root {
  --bg: #f7f7f2;
  --surface: #ffffff;
  --surface-soft: #efeee8;
  --text: #111111;
  --muted: #666866;
  --line: rgba(17, 17, 17, 0.10);
  --primary: #111111;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 32px;
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-md: 0 18px 50px rgba(17, 17, 17, 0.08);
  --shadow-lg: 0 28px 90px rgba(17, 17, 17, 0.12);
  --container: 1120px;
  --transition: 220ms ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 32rem),
    linear-gradient(180deg, #fbfbf8 0%, var(--bg) 38%, #f2f1eb 100%);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.36;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.container,
.hero-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 800;
}

h1 {
  font-size: clamp(3.2rem, 9vw, 7.4rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 4.4rem);
}

h3 {
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
}

/* ============================================
   NAVIGATION
   ============================================ */

.navbar {
  position: fixed;
  top: 16px;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: transparent;
  transition: var(--transition);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: min(1040px, calc(100% - 32px));
  padding: 0.72rem 0.86rem 0.72rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-sm);
}

.navbar-scrolled .container {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 60px rgba(17, 17, 17, 0.09);
}

.logo {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.18rem;
  margin-left: auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 1rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.nav-link::after {
  display: none;
}

.theme-toggle,
.hamburger {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover,
.hamburger:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
}

.hamburger span {
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: var(--transition);
}

.hamburger.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ============================================
   HERO
   ============================================ */

.hero {
  min-height: 100svh;
  padding: 150px 0 90px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  right: -18vw;
  top: 12%;
  width: min(54vw, 680px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.14), transparent 68%);
  pointer-events: none;
}

.hero-content {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: clamp(2.5rem, 7vw, 6rem);
  align-items: center;
  position: relative;
  z-index: 2;
}

.profile-image-container {
  position: relative;
}

.profile-image-wrapper {
  width: min(100%, 390px);
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-soft);
  box-shadow: var(--shadow-lg);
  transform: rotate(-2deg);
  transition: var(--transition);
}

.profile-image-wrapper:hover {
  transform: rotate(0deg) translateY(-6px);
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.92) contrast(1.04);
}

.profile-image-border,
.hero-accent-line,
.hero-floating-elements {
  display: none;
}

.profile-badge {
  position: absolute;
  left: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.82rem 1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 18px 45px rgba(17, 17, 17, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.hero-eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  padding: 0.46rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-eyebrow::before,
.section-kicker::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.hero-title {
  margin-bottom: 1.4rem;
}

.hero-title-line {
  display: block;
}

.hero-description {
  max-width: 620px;
  font-size: clamp(1.05rem, 1.6vw, 1.28rem);
  line-height: 1.8;
  margin-bottom: 2rem;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  max-width: 560px;
}

.stat-item,
.stat-card,
.skill-card,
.project-card,
.contact-form {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-item {
  padding: 1.1rem;
  border-radius: var(--radius-md);
}

.stat-item:hover,
.stat-card:hover,
.skill-card:hover,
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(17, 17, 17, 0.18);
  background: rgba(255, 255, 255, 0.92);
}

.stat-num {
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  font-weight: 900;
  letter-spacing: -0.07em;
  color: var(--text);
}

.stat-text {
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.95rem;
  margin-top: 2.25rem;
}

.cta-btn,
.cta-button,
.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.72rem;
  min-height: 52px;
  padding: 0 1.35rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.primary-btn,
.cta-button {
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-md);
}

.primary-btn:hover,
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  border-color: var(--line);
}

.secondary-btn:hover {
  background: var(--surface);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   SECTIONS
   ============================================ */

section {
  padding: clamp(72px, 10vw, 130px) 0;
  position: relative;
}

.about,
.skills,
.projects,
.contact {
  background: transparent;
}

.section-kicker {
  margin-left: 50%;
  transform: translateX(-50%);
}

.section-title {
  max-width: 760px;
  margin: 0 auto clamp(2.5rem, 6vw, 4.7rem);
  text-align: center;
}

.section-title::after {
  display: none;
}

/* Projects and About section styles moved to per-section files */

.slider-btn {
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-md);
}

.primary-btn:hover,
.cta-button:hover {
  transform: translateY(-3px);
}

/* Projects and About section styles moved to per-section files */

.slider-btn {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.slider-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-md);
}

.slider-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slider-dots {
  margin-top: 1.7rem;
  display: flex;
  justify-content: center;
  gap: 0.55rem;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 17, 17, 0.18);
  cursor: pointer;
  transition: var(--transition);
}

.slider-dot.active {
  width: 30px;
  background: var(--text);
}

/* Project dark-mode overrides live in css/index_projects.css */


/* Contact-form and related styles moved to css/index_contact.css */

.footer {
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--line);
  text-align: center;
  background: rgba(255, 255, 255, 0.36);
}

.footer p {
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}

.footer-subtext {
  font-size: 0.82rem !important;
}

/* Animations moved to per-section CSS where relevant */

/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode {
  --bg: #0c0d0f;
  --surface: #15171a;
  --surface-soft: #1d2025;
  --text: #f4f4f2;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.11);
  --primary: #f4f4f2;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.12), transparent 32rem),
    linear-gradient(180deg, #0a0b0d 0%, var(--bg) 46%, #111318 100%);
}

body.dark-mode::before {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  opacity: 0.28;
}

body.dark-mode .navbar .container,
body.dark-mode .navbar-scrolled .container,
body.dark-mode .hero-eyebrow,
body.dark-mode .section-kicker,
body.dark-mode .stat-item,
body.dark-mode .stat-card,
body.dark-mode .skill-card,
body.dark-mode .project-card,
body.dark-mode .contact-form,
body.dark-mode .about-text,
body.dark-mode .slider-btn,
body.dark-mode .social-icon,
body.dark-mode .secondary-btn,
body.dark-mode .tag,
body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
  background: rgba(21, 23, 26, 0.72);
}

body.dark-mode .logo,
body.dark-mode .primary-btn,
body.dark-mode .cta-button,
body.dark-mode .social-icon:hover,
body.dark-mode .slider-dot.active,
body.dark-mode .progress-bar {
  background: var(--text);
  color: var(--surface);
}

body.dark-mode .profile-badge,
body.dark-mode .project-link {
  background: rgba(21, 23, 26, 0.82);
  color: var(--text);
  border-color: var(--line);
}

body.dark-mode .footer {
  background: rgba(21, 23, 26, 0.38);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 992px) {
  .hero {
    padding-top: 130px;
  }

  .hero-content,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .profile-image-wrapper {
    max-width: 340px;
    margin: 0 auto;
  }

  .hero-text-content {
    text-align: center;
  }

  .hero-description,
  .hero-stats-grid {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta-group {
    justify-content: center;
    margin-left: 0;
  }

  /* skills-grid and project responsive rules moved to per-section files */
}

@media (max-width: 768px) {
  .navbar {
    top: 10px;
  }

  .navbar .container {
    max-width: calc(100% - 20px);
  }

  .hamburger {
    display: inline-flex;
  }

  .nav-menu {
    position: fixed;
    top: 76px;
    left: 10px;
    right: 10px;
    display: none !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.65rem;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.active {
    display: flex !important;
    animation: slideDown 180ms ease;
  }

  .nav-link {
    justify-content: center;
    min-height: 48px;
  }

  body.dark-mode .nav-menu {
    background: rgba(21, 23, 26, 0.96);
  }

  .theme-toggle {
    margin-left: auto;
  }

  .hero-stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-cta-group {
    flex-direction: column;
  }

  .cta-btn {
    width: 100%;
  }

  /* projects responsive rules moved to css/index_projects.css */
}

@media (max-width: 560px) {
  .container,
  .hero-container {
    padding: 0 18px;
  }

  h1 {
    font-size: clamp(2.65rem, 16vw, 4.3rem);
  }

  .hero {
    padding-bottom: 70px;
  }

  .profile-image-wrapper {
    max-width: 280px;
    border-radius: 26px;
  }

  .profile-badge {
    left: 14px;
    bottom: 14px;
    font-size: 0.78rem;
  }

  .section-kicker {
    white-space: nowrap;
  }

  /* about/contact/projects responsive rules moved to per-section files */

  /* detailed project responsive rules moved to css/index_projects.css */
}

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


/* ============================================
   INTEGRATED HOVER VIDEO & ACTION BUTTONS STYLES
   ============================================ */
/* Container for the side-by-side action buttons */
.project-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  flex-wrap: wrap;
}

/* Ensure project links scale correctly side by side */
.project-link {
  flex: 1;
  min-width: 120px;
  text-align: center;
  justify-content: center;
  white-space: nowrap;
}

/* Specific stylistic contrast for the View Demo button */
.demo-link {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid var(--line);
}

.demo-link:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

/* Dark mode configurations for the demo button */
body.dark-mode .demo-link {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

body.dark-mode .demo-link:hover {
  background: var(--accent);
  color: var(--surface);
}

/* Video Wrapper Styles */
.project-image {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: hidden;
  background: #000; /* fall-back color during transitions */
}

/* Image acts as the default fallback cover */
.card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--transition);
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Video element positioning rules */
.project-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 0;
  transition: opacity var(--transition);
}

/* Visual state alterations when hovering over the card parent */
.project-card:hover .card-thumb {
  opacity: 1;
}

.project-card:hover .project-video {
  opacity: 0;
  visibility: hidden;
}

/* Clean overlay adjustments to ensure indicators sit on top of the elements */
.project-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(17, 17, 17, 0.4), transparent 70%);
  z-index: 2; /* Sits over image and video elements */
  pointer-events: none;
}

.project-number {
  z-index: 3; /* Always viewable over the top of components */
}

/* ============================================
   CONSISTENT PAGE SWITCH TRANSITION
   ============================================ */

.page-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 50%, rgba(37, 99, 235, 0.18), transparent 28rem),
    #0c0d0f;
  visibility: hidden;
  opacity: 1;
  transform: translateY(100%);
  will-change: transform;
}

html.page-transition-preload .page-transition {
  visibility: visible;
  transform: translateY(0);
}

.page-transition span {
  color: #ffffff;
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  opacity: 0;
  transform: translateY(14px);
}

html.page-transition-preload .page-transition span {
  opacity: 1;
  transform: translateY(0);
}

body.page-transition-in .page-transition {
  visibility: visible;
  transform: translateY(0);
}

body.page-transition-in .page-transition span {
  opacity: 1;
  transform: translateY(0);
}

body.page-transition-out .page-transition {
  visibility: visible;
  animation: pageCoverIn 700ms cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

body.page-transition-out .page-transition span {
  animation: pageLogoIn 360ms ease 180ms forwards;
}

body.page-transition-in.page-transition-ready .page-transition {
  transform: translateY(-100%);
  transition: transform 700ms cubic-bezier(0.76, 0, 0.24, 1);
}

body.page-transition-in.page-transition-ready .page-transition span {
  opacity: 1;
  transform: translateY(0);
}

@keyframes pageCoverIn {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes pageLogoIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

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

@media (prefers-reduced-motion: reduce) {
  .page-transition,
  .page-transition span {
    animation: none;
    transition: none;
  }
}
