/* 
  Theme: Mert Dikmen Portfolio
  Style: High-End Tech / Cyberpunk 3D
  Updated: Visual Matching (Red Glow, Constellations, Minimal Button)
*/

:root {
  /* Colors */
  --color-bg: #050510;
  /* Very Dark Navy/Black */
  --color-bg-alt: #0b1121;
  --color-surface: rgba(255, 255, 255, 0.03);

  --color-primary: #ff3b30;
  /* Neon Red */
  --color-secondary: #00d4ff;
  /* Electric Cyan */
  --color-accent-orange: #ff6b35;
  /* Orange Glow */

  --color-text: #e2e8f0;
  --color-muted: #94a3b8;
  --color-border: rgba(255, 255, 255, 0.1);

  /* Shadows & Glows */
  --shadow-strong: 0 25px 50px -12px rgba(0, 0, 0, 0.9);
  --glow-primary: 0 0 40px rgba(255, 59, 48, 0.6);
  --glow-cyan: 0 0 30px rgba(0, 212, 255, 0.4);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Orbitron', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing & Radius */
  --radius-md: 16px;
  --radius-full: 9999px;

  --container-width: 1400px;
  --header-height: 80px;
  --sidebar-width: 80px;
}

/* Base Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

img {
  max-width: 100%;
  display: block;
}

/* Typography */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

/* Layout */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 8rem 0;
  position: relative;
}

/* Header */
.header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0;
}

.header__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
}

.logo span {
  color: var(--color-primary);
}

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-icon {
  color: #fff;
  font-size: 1.2rem;
  opacity: 0.7;
  transition: all 0.3s ease;
}

.social-icon:hover {
  opacity: 1;
  color: var(--color-primary);
  transform: translateY(-3px);
  filter: drop-shadow(0 0 8px var(--color-primary));
}

/* Sidebar Nav */
.sidebar-nav {
  position: fixed;
  top: 50%;
  right: 2rem;
  transform: translateY(-50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 1.5rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.nav__link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-muted);
  font-size: 1.2rem;
  position: relative;
  transition: all 0.3s ease;
}

.nav__link:hover,
.nav__link.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--glow-primary);
  transform: scale(1.1);
}

.nav__link::before {
  content: attr(data-label);
  position: absolute;
  right: 140%;
  background: rgba(0, 0, 0, 0.8);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  white-space: nowrap;
  transform: translateX(10px);
}

.nav__link:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* Hero Section - Reference Match */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-right: var(--sidebar-width);
  /* Deep Dark Base */
  background-color: #050508;
  /* Reduced spacing adjustment */
  padding-top: 0;
}

/* Constellation Canvas */
.constellation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}

.constellation canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* GLOBAL EFFECTS */
.hero__effects {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* 1. The Atmosphere (Red Glow from Left) */
.effect-glow {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-30%, -50%);
  width: 80vw;
  height: 80vw;
  /* Strong, diffuse red glow */
  background: radial-gradient(circle, rgba(220, 38, 38, 0.6) 0%, rgba(127, 29, 29, 0.2) 50%, transparent 70%);
  filter: blur(60px);
  z-index: 1;
  opacity: 1;
}

/* 2. The Grid (Dots) */
.effect-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Visible dots */
  background-image: radial-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.8;
  z-index: 2;
}

/* 3. Rings (Subtle tech feel) */
.effect-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.ring-1 {
  width: 120vh;
  height: 120vh;
  animation: rotate 60s linear infinite;
}

.ring-2 {
  width: 160vh;
  height: 160vh;
  border-color: rgba(255, 59, 48, 0.1);
  animation: rotate-reverse 50s linear infinite;
}

/* Typography & Content */
.hero__content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  width: 100%;
  z-index: 10;
  /* Above effects */
  position: relative;
  margin-top: -80px;
}

.hero__text {
  position: relative;
  text-align: left;
}

.hero__headline {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Gradient Text for "DIGITAL REALITY" */
.text-highlight {
  background: linear-gradient(to right, #ff3b30, #ff6b35);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(255, 59, 48, 0.3);
  display: inline-block;
}

/* Circular Button - Minimal Ring */
.circular-btn-wrapper {
  position: absolute;
  bottom: 60px;
  left: 0;
  /* Align with text */
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  z-index: 20;
  background: transparent;
  /* Thin white border */
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.circular-text {
  position: absolute;
  width: 100%;
  height: 100%;
  animation: rotate 20s linear infinite;
}

.circular-text text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  fill: rgba(255, 255, 255, 0.7);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.circular-arrow {
  color: #fff;
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.circular-btn-wrapper:hover {
  border-color: var(--color-primary);
  box-shadow: 0 0 20px rgba(255, 59, 48, 0.2);
}

.circular-btn-wrapper:hover .circular-arrow {
  transform: translateX(5px);
  color: var(--color-primary);
}

/* Hero Media */
.hero__media {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 100px;
  /* Reset */
}

.portrait-img {
  width: 100%;
  max-width: 650px;
  height: auto;
  object-fit: contain;
  filter: contrast(1.1) brightness(0.9);
  /* Cinematic look */
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

/* Animations */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes rotate-reverse {
  from {
    transform: rotate(360deg);
  }

  to {
    transform: rotate(0deg);
  }
}

@keyframes pulse-glow {
  0% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

/* Staggered Animations */
.animate-stagger-1 {
  animation: fade-up 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(30px);
}

.animate-stagger-2 {
  animation: fade-up 0.8s ease-out 0.2s forwards;
  opacity: 0;
  transform: translateY(30px);
}

.animate-stagger-3 {
  animation: fade-up 0.8s ease-out 0.4s forwards;
  opacity: 0;
  transform: translateY(30px);
}

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards & Grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.card {
  background: rgba(11, 17, 33, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  backdrop-filter: blur(12px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--glow-primary);
  transform: translateY(-10px);
}

.project-img-wrapper {
  height: 240px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.card:hover .project-img {
  transform: scale(1.1);
}

.project-title {
  color: #fff;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.project-subtitle {
  color: var(--color-primary);
  font-family: var(--font-mono);
}

.about-content {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  align-items: start;
  text-align: left;
}

.section-title {
  margin-top: 0;
  line-height: 1;
  margin-bottom: 1rem;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
  grid-column: 1 / -1;
  /* Span full width */
  width: 100%;
}

@media (max-width: 768px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.skill-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
}

.skill-item:hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-5px);
  box-shadow: var(--glow-primary);
}

.skill-icon {
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  height: 32px;
}

.skill-icon svg {
  width: 24px;
  height: 24px;
}

/* Contact Form */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 4rem;
}

.form-input,
.form-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  color: #fff;
  border-radius: 8px;
  padding: 1rem;
  width: 100%;
  font-family: var(--font-sans);
  margin-bottom: 1.5rem;
}

.form-input:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 15px rgba(255, 59, 48, 0.3);
}

/* Fix for Select Options (Dropdown) */
select.form-input option {
  background-color: var(--color-bg);
  color: #fff;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 2rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--glow-primary);
  width: 100%;
  transition: all 0.3s ease;
}

.btn--primary:hover {
  background: #fff;
  color: var(--color-primary);
  transform: translateY(-3px);
}

/* Footer */
.footer {
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-text {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin: 0;
}

.footer-social {
  display: flex;
  gap: 1rem;
}

.footer-social .social-icon {
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.footer-social .social-icon:hover {
  opacity: 1;
}

/* Animations - REVEAL FIX */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Project Card Slide Animations */
.reveal--slide-left {
  opacity: 0;
  transform: translateX(-100px);
  transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal--slide-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal--slide-right {
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal--slide-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Tablet / Small Desktop */
@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    padding-top: 120px;
  }

  /* Adjust Hero Grid for Tablet */
  .hero__content {
    grid-template-columns: 1.1fr 0.9fr;
    /* Give text slightly more space */
    gap: 1rem;
  }

  .hero__text h1 {
    font-size: 3rem;
    /* Reduce font size */
  }

  .hero__media {
    height: auto;
    padding-bottom: 0;
    justify-content: center;
    align-items: center;
  }

  .portrait-wrapper {
    max-width: 100%;
    /* Allow image to fill column */
    width: 300px;
    /* Target width */
  }

  .portrait-img {
    max-width: 100%;
  }
}

/* Mobile */
@media (max-width: 768px) {
  h1 {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    width: 100%;
  }

  .header__container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .hero {
    padding-right: 0;
    min-height: 100dvh;
    align-items: center;
    justify-content: center;
    padding-top: 40px;
    overflow-x: hidden;
    width: 100%;
  }

  /* Reset Container Padding for Mobile Hero */
  .hero .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero__content {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 0;
    justify-items: center;
    padding-left: 0;
    padding-right: 0;
    margin-top: -40px;
    width: 100%;
    max-width: 100%;
  }

  .hero__text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 100%;
    padding: 0 0.5rem;
  }

  .hero__description {
    font-size: 0.95rem;
    max-width: 100%;
    padding: 0 1rem;
  }

  .hero__media {
    height: 45vh;
    margin-top: 1rem;
    padding-bottom: 60px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
  }

  .portrait-wrapper {
    max-width: 350px;
  }

  .portrait-img {
    max-width: 350px;
    width: 100%;
  }

  .circular-btn-wrapper {
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    margin: 0;
  }

  /* Fix Background Overflow */
  .ring-1 {
    width: 90vw;
    height: 90vw;
  }

  .ring-2 {
    width: 120vw;
    height: 120vw;
  }

  .effect-glow {
    width: 100vw;
    height: 100vw;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .sidebar-nav {
    bottom: 2rem;
    top: auto;
    right: 50%;
    transform: translateX(50%);
    flex-direction: row;
    width: auto;
    /* Auto-hide behavior */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
  }

  .sidebar-nav.visible {
    opacity: 1;
    visibility: visible;
  }

  .header {
    padding: 0 1.5rem;
  }

  .header__container {
    padding-right: 0;
  }

  .contact-wrapper {
    grid-template-columns: 1fr;
  }

  .grid-3,
  .grid-4,
  .grid-5,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .effect-ring {
    width: 80vw;
    height: 80vw;
  }

  .ring-2 {
    width: 100vw;
    height: 100vw;
  }
}

/* Scroll Animation Styles */
#about-image-target {
  width: 130px;
  height: 130px;
  margin: -20px 0 0 0;
  /* Remove auto margin */
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .about-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
    justify-items: center;
  }

  .about-card {
    text-align: center;
  }

  #about-image-target {
    margin: 0 auto;
    display: none;
  }
}

.hero-image-fixed {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  pointer-events: none;
  /* Let clicks pass through */
  transform-origin: top left;
  will-change: transform, width, height, top, left;
}

/* Hide original when fixed clone is active (if we use cloning) 
   OR if we move the original, we need a placeholder to keep layout.
   Let's use a placeholder approach in JS.
*/
.hero-image-placeholder {
  visibility: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* Fix for smaller vertical screens (e.g. iPhone 13/14/15) */
@media (max-width: 768px) and (max-height: 850px) {
  h1 {
    font-size: clamp(1.5rem, 4vh, 2rem) !important;
    /* Scale text with viewport height */
  }

  .hero {
    padding-top: 100px;
    padding-bottom: 20px;
    /* Add bottom padding */
    min-height: 100dvh;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Push content apart */
    gap: 1rem;
  }

  .hero__content {
    margin-top: 0;
    padding-top: 0;
    flex-shrink: 0;
  }

  .hero__media {
    height: auto;
    max-height: none;
    flex: 1;
    /* Fill remaining space */
    min-height: 0;
    padding-bottom: 0;
    margin-top: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
  }

  .portrait-wrapper {
    max-width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }

  .portrait-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .circular-btn-wrapper {
    bottom: 0;
  }
}

/* Project Links */
.project-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: 1rem;
}

.project-link {
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.project-link:hover {
  color: var(--color-primary);
}

.project-link--demo {
  color: #fff;
}

.project-link--demo:hover {
  color: var(--color-secondary);
}