/* ═══════════════════════════════════════════════════════
   Patrik Neumann — Portfolio
   Custom CSS: themes, animations, textures, refinements
   ═══════════════════════════════════════════════════════ */

/* ── Theme Variables ── */
:root {
  --bg-deep: #050507;
  --bg-primary: #08080c;
  --bg-secondary: #0e0e14;
  --bg-card: #111118;
  --bg-card-hover: #16161f;
  --border: #1a1a25;
  --border-hover: #2a2a3a;
  --text-primary: #ededf0;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --accent: #8b5cf6;
  --accent-secondary: #6366f1;
  --accent-text: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.10);
  --accent-glow-strong: rgba(139, 92, 246, 0.25);
  --gradient-accent: linear-gradient(135deg, #8b5cf6, #6366f1, #818cf8);
  --noise-opacity: 0.03;
  --terminal-green: #4ade80;
  --terminal-dim: #3a5a3a;
}

[data-theme="light"] {
  --bg-deep: #f8f8fa;
  --bg-primary: #ffffff;
  --bg-secondary: #f3f3f6;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f8fb;
  --border: #e2e2ea;
  --border-hover: #c8c8d6;
  --text-primary: #111118;
  --text-secondary: #555570;
  --text-muted: #9090a8;
  --accent: #7c3aed;
  --accent-secondary: #4f46e5;
  --accent-text: #6d28d9;
  --accent-glow: rgba(124, 58, 237, 0.08);
  --accent-glow-strong: rgba(124, 58, 237, 0.18);
  --gradient-accent: linear-gradient(135deg, #7c3aed, #4f46e5, #6366f1);
  --noise-opacity: 0.015;
  --terminal-green: #16a34a;
  --terminal-dim: #86efac;
}

/* ── Base ── */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  transition: background 0.5s ease, color 0.4s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Noise Texture Overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' 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: 200px 200px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Selection ── */
::selection {
  background: var(--accent);
  color: #fff;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Syne', 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.font-display {
  font-family: 'Syne', 'Outfit', system-ui, sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Gradient Text ── */
.gradient-text {
  background: linear-gradient(135deg, #e0d4fc 0%, #8b5cf6 40%, #6366f1 70%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .gradient-text {
  background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 40%, #4f46e5 70%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Gradient Border Card ── */
.gradient-border {
  position: relative;
  background: var(--bg-card);
  border-radius: 1rem;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  padding: 1px;
  background: var(--gradient-accent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

.gradient-border:hover::before {
  opacity: 1;
}

/* ── Card Base ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px -8px var(--accent-glow),
              0 4px 12px -4px rgba(0, 0, 0, 0.3);
}

/* ── Pill Badge ── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  background: var(--accent-glow);
  color: var(--accent-text);
  border: 1px solid rgba(139, 92, 246, 0.15);
  transition: all 0.3s ease;
  white-space: nowrap;
}

.pill:hover {
  background: var(--accent-glow-strong);
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ── Hero Gradient Orbs ── */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  will-change: transform;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.20) 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: orbDrift1 20s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, transparent 70%);
  bottom: -5%;
  right: -8%;
  animation: orbDrift2 25s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.12) 0%, transparent 70%);
  top: 40%;
  left: 50%;
  animation: orbDrift3 18s ease-in-out infinite;
}

[data-theme="light"] .orb-1 { background: radial-gradient(circle, rgba(124, 58, 237, 0.10) 0%, transparent 70%); }
[data-theme="light"] .orb-2 { background: radial-gradient(circle, rgba(79, 70, 229, 0.08) 0%, transparent 70%); }
[data-theme="light"] .orb-3 { background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%); }

@keyframes orbDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(60px, 40px) scale(1.05); }
  50% { transform: translate(20px, -30px) scale(0.95); }
  75% { transform: translate(-40px, 20px) scale(1.02); }
}

@keyframes orbDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-50px, -40px) scale(1.08); }
  66% { transform: translate(30px, 50px) scale(0.96); }
}

@keyframes orbDrift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(-30px, 50px) scale(1.1); }
  50% { transform: translate(50px, 20px) scale(0.9); }
  75% { transform: translate(20px, -40px) scale(1.05); }
}

/* ── PN Initials Badge ── */
.pn-badge {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 1.25rem;
  background: var(--bg-secondary);
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  color: var(--accent-text);
  transform: rotate(-3deg);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pn-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1.25rem;
  padding: 2px;
  background: var(--gradient-accent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.pn-badge::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 1.5rem;
  background: var(--gradient-accent);
  opacity: 0.12;
  filter: blur(16px);
  z-index: -1;
  transition: opacity 0.4s ease;
}

.pn-badge:hover {
  transform: rotate(0deg) scale(1.05);
}

.pn-badge:hover::after {
  opacity: 0.25;
}

/* ── Terminal Card ── */
.terminal {
  background: #0a0a10;
  border: 1px solid #1a1a28;
  border-radius: 0.875rem;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.8;
}

[data-theme="light"] .terminal {
  background: #1a1a2e;
  border-color: #2a2a40;
}

.terminal-chrome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid #1a1a28;
}

[data-theme="light"] .terminal-chrome {
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: #2a2a40;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-body {
  padding: 1.25rem;
  color: #b8b8d0;
}

.terminal-body .prompt {
  color: var(--terminal-green);
}

.terminal-body .cmd {
  color: #e0e0f0;
}

.terminal-body .result {
  color: #8888a8;
  padding-left: 1rem;
}

/* ── Typing Cursor ── */
.typing-cursor {
  display: inline-block;
  width: 3px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 1s step-end infinite;
}

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

/* ── Scroll Animations ── */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-animate].animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* ── Navbar ── */
.navbar {
  background: rgba(5, 5, 7, 0.65);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: all 0.4s ease;
}

.navbar.scrolled {
  border-bottom-color: var(--border);
  background: rgba(5, 5, 7, 0.88);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.65);
}

[data-theme="light"] .navbar.scrolled {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: var(--border);
}

.nav-link {
  position: relative;
  color: var(--text-secondary);
  transition: color 0.3s ease;
  font-weight: 500;
  font-size: 0.875rem;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 1px;
  transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

/* ── Toggle Buttons ── */
.toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.toggle-btn:hover {
  border-color: var(--border-hover);
  color: var(--accent-text);
  background: var(--accent-glow);
}

.lang-toggle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  width: auto;
  padding: 0 0.625rem;
  letter-spacing: 0.05em;
}

/* ── Section Divider ── */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  max-width: 600px;
  margin: 0 auto;
}

/* ── Project Icon ── */
.project-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: var(--accent-glow);
  border: 1px solid rgba(139, 92, 246, 0.15);
  color: var(--accent-text);
  transition: all 0.35s ease;
}

.card:hover .project-icon {
  background: var(--accent-glow-strong);
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ── GitHub Repo Card ── */
.repo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.25rem;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  text-decoration: none;
  color: inherit;
  display: block;
}

.repo-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px var(--accent-glow);
}

/* Featured repo card (compact layout for few repos) */
.repo-card-featured {
  padding: 1.5rem;
  border-color: var(--border-hover);
}

.repo-card-featured h4 {
  font-size: 0.9rem;
}

/* ── GitHub Avatar ── */
.github-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid transparent;
  background-image: var(--gradient-accent);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 4px 16px var(--accent-glow);
  object-fit: cover;
  transition: box-shadow 0.35s ease, transform 0.35s ease;
}

.github-avatar:hover {
  box-shadow: 0 4px 24px var(--accent-glow-strong);
  transform: scale(1.05);
}

/* ── Coming Soon Note ── */
.coming-soon-note {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

/* ── Contact Button ── */
.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.35s ease;
}

.contact-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}

.contact-btn svg {
  color: var(--accent-text);
  transition: transform 0.3s ease;
}

.contact-btn:hover svg {
  transform: scale(1.1);
}

/* ── CTA Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 0.75rem;
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.35s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.35);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 0.75rem;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.35s ease;
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
}

/* ── Mobile Menu Overlay ── */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 5, 7, 0.96);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

[data-theme="light"] .mobile-menu {
  background: rgba(255, 255, 255, 0.96);
}

.mobile-menu a {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
}

.mobile-menu.open a {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger mobile menu items */
.mobile-menu a:nth-child(1) { transition-delay: 0.05s; }
.mobile-menu a:nth-child(2) { transition-delay: 0.1s; }
.mobile-menu a:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu a:nth-child(4) { transition-delay: 0.2s; }
.mobile-menu a:nth-child(5) { transition-delay: 0.25s; }

/* ── Grid Lines (decorative) ── */
.grid-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.03;
}

.grid-decoration::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.4) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ── Hamburger ── */
.hamburger {
  width: 24px;
  height: 18px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.35s ease;
  transform-origin: center;
}

.hamburger.open span:first-child {
  transform: translateY(8px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.open span:last-child {
  transform: translateY(-8px) rotate(-45deg);
}

/* ── Scroll Down Indicator ── */
.scroll-indicator {
  animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* ── Language Badge (in hero) ── */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .orb-1 { width: 300px; height: 300px; }
  .orb-2 { width: 250px; height: 250px; }
  .orb-3 { width: 200px; height: 200px; }

  .pn-badge {
    width: 90px;
    height: 90px;
    font-size: 2rem;
  }
}

/* ── Print ── */
@media print {
  body::before,
  .orb,
  .navbar,
  .mobile-menu,
  .grid-decoration { display: none !important; }

  body { background: #fff; color: #000; }
  .gradient-text { -webkit-text-fill-color: #000; }
}
