/* ===========================================
   Portfolio — Custom Styles
   =========================================== */

/* ---------- Design Tokens ---------- */
:root {
  --bg: #0C0C0C;
  --surface: #161616;
  --text: #F5F5F5;
  --muted: #888888;
  --accent: #E8563A;
  --border: #2A2A2A;
}

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

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Grain Texture Overlay ---------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px;
}

/* ---------- Hero Entry Animation ---------- */
.hero-fade {
  opacity: 0;
  transform: translateY(16px);
  animation: heroIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-fade:nth-child(2) { animation-delay: 0.12s; }
.hero-fade:nth-child(3) { animation-delay: 0.24s; }

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

/* ---------- Scroll Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Staggered children */
.stagger > .reveal:nth-child(2) { transition-delay: 80ms; }
.stagger > .reveal:nth-child(3) { transition-delay: 160ms; }
.stagger > .reveal:nth-child(4) { transition-delay: 240ms; }
.stagger > .reveal:nth-child(5) { transition-delay: 320ms; }

/* ---------- Scroll Indicator ---------- */
.scroll-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.scroll-indicator span {
  font-family: 'Syne', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
}

.scroll-line {
  width: 1px;
  height: 40px;
  position: relative;
  overflow: hidden;
  background: var(--border);
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 60%;
  background: var(--accent);
  animation: scroll-pulse 2s ease-in-out infinite;
}

@keyframes scroll-pulse {
  0% { top: -60%; }
  100% { top: 160%; }
}

/* ---------- Section Label ---------- */
.section-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

/* ---------- Experience Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 2rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-3px);
}

/* ---------- Project Card ---------- */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}

.project-card:hover {
  border-color: #3a3a3a;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

/* ---------- Tech Pill ---------- */
.tech-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  transition: border-color 0.2s ease;
}

.tech-pill:hover {
  border-color: var(--accent);
}

.tech-pill img {
  width: 18px;
  height: 18px;
}

/* ---------- Social Link ---------- */
.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: all 0.25s ease;
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Language Toggle ---------- */
.lang-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lang-option {
  padding: 5px 14px;
  border-radius: 7px;
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.lang-option:hover {
  color: var(--text);
}

.lang-option.active {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Accent Link ---------- */
.accent-link {
  color: var(--accent);
  text-decoration: none;
  font-family: 'Syne', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  transition: opacity 0.2s ease;
}

.accent-link:hover {
  opacity: 0.8;
}

/* ---------- Floating Orbs ---------- */
.floating-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: var(--accent);
  opacity: 0.12;
  top: -15%;
  right: -10%;
  animation: drift-1 14s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  opacity: 0.08;
  bottom: 5%;
  left: -8%;
  animation: drift-2 18s ease-in-out infinite;
}

.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--accent);
  opacity: 0.09;
  top: 45%;
  left: 25%;
  animation: drift-3 16s ease-in-out infinite;
}

@keyframes drift-1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  25% { transform: translate3d(-80px, 60px, 0) scale(1.08); }
  50% { transform: translate3d(60px, -40px, 0) scale(0.92); }
  75% { transform: translate3d(-40px, -70px, 0) scale(1.05); }
}

@keyframes drift-2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33% { transform: translate3d(70px, 50px, 0) scale(1.06); }
  66% { transform: translate3d(-60px, -60px, 0) scale(0.94); }
}

@keyframes drift-3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(50px, -80px, 0) scale(1.1); }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero-fade {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .scroll-indicator {
    animation: none;
  }

  .floating-orb {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}
