/* =========================================
   Jakob Breivik Grimstveit — Profile Page Styles
   ========================================= */

/* --- Design Tokens --- */
:root {
  --color-bg: hsl(225 25% 6%);
  --color-surface: hsl(225 20% 10%);
  --color-surface-hover: hsl(225 20% 14%);
  --color-border: hsl(225 15% 18%);
  --color-border-hover: hsl(225 15% 32%);
  --color-text: hsl(225 10% 94%);
  --color-text-muted: hsl(225 10% 60%);
  --color-accent: hsl(217 92% 65%);
  --color-accent-glow: hsl(217 92% 65% / 0.3);
  --color-accent-2: hsl(280 80% 65%);
  --color-accent-3: hsl(340 75% 60%);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-full: 9999px;

  --shadow-glow: 0 10px 40px -10px hsl(0 0% 0% / 0.5), 0 0 80px hsl(217 92% 65% / 0.08);
  --transition-smooth: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* --- Background Layers --- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(hsl(225 15% 18% / 0.35) 1px, transparent 1px),
    linear-gradient(90deg, hsl(225 15% 18% / 0.35) 1px, transparent 1px);
  background-size: 50px 50px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.bg-noise {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* Atmospheric Ambient Glows */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  will-change: translate;
}

.glow-1 {
  width: 550px;
  height: 550px;
  background: hsl(217 92% 50% / 0.16);
  top: -15%;
  left: -10%;
  animation: float-glow 14s ease-in-out infinite;
}

.glow-2 {
  width: 450px;
  height: 450px;
  background: hsl(280 80% 50% / 0.13);
  bottom: -10%;
  right: -10%;
  animation: float-glow 16s ease-in-out infinite reverse;
}

.glow-3 {
  width: 350px;
  height: 350px;
  background: hsl(200 85% 55% / 0.1);
  top: 40%;
  left: 45%;
  animation: float-glow 20s ease-in-out infinite 3s;
}

@keyframes float-glow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(35px, -25px) scale(1.08); }
  66% { transform: translate(-25px, 35px) scale(0.92); }
}

/* Mouse-following spotlight */
.mouse-spotlight {
  position: fixed;
  width: 600px;
  height: 600px;
  translate: -50% -50%;
  background: radial-gradient(circle, hsl(217 92% 65% / 0.08) 0%, transparent 65%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  will-change: left, top;
}

/* --- Main Container --- */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
}

/* --- Glass Card --- */
.card {
  position: relative;
  background: hsl(225 20% 9% / 0.65);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 32px 32px;
  box-shadow: var(--shadow-glow);
  overflow: hidden;
  will-change: transform;
  transform-style: preserve-3d;
  animation: card-enter 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes card-enter {
  from {
    opacity: 0;
    translate: 0 40px;
    scale: 0.95;
  }
  to {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
}

/* Dynamic light reflection on card surface */
.card-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  transition: background 0.15s ease-out;
}

.card-border-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: destination-out;
  padding: 1px;
  transition: background 0.15s ease-out;
}

/* --- Profile Section --- */
.profile {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 36px;
}

/* Avatar */
.avatar-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 24px;
  cursor: pointer;
}

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 25%;
  position: relative;
  z-index: 2;
  border: 3px solid hsl(225 15% 22%);
  box-shadow: 0 8px 24px hsl(0 0% 0% / 0.4);
  filter: contrast(1.04) brightness(1.02);
  transition: scale var(--transition-bounce), border-color var(--transition-smooth), filter var(--transition-smooth);
}

.avatar-wrapper:hover .avatar {
  scale: 1.05;
  border-color: var(--color-accent);
  filter: contrast(1.08) brightness(1.05);
}

/* Glowing halo behind avatar */
.avatar-glow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--color-accent) 0%, var(--color-accent-2) 50%, transparent 70%);
  filter: blur(16px);
  opacity: 0.25;
  z-index: 0;
  transition: opacity var(--transition-smooth);
}

.avatar-wrapper:hover .avatar-glow {
  opacity: 0.65;
}

/* Spinning gradient ring */
.avatar-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  z-index: 1;
  background: conic-gradient(
    from 0deg,
    var(--color-accent),
    var(--color-accent-2),
    var(--color-accent-3),
    var(--color-accent)
  );
  opacity: 0;
  animation: ring-spin 4s linear infinite;
  transition: opacity var(--transition-smooth);
}

.avatar-wrapper:hover .avatar-ring {
  opacity: 1;
}

@keyframes ring-spin {
  to { rotate: 360deg; }
}

/* Directional shine overlay */
.avatar-shine {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(135deg, hsl(0 0% 100% / 0.15) 0%, transparent 55%);
  transition: background 0.1s ease-out;
}

/* Name */
.name {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 8px;
  background: linear-gradient(
    135deg,
    hsl(0 0% 98%) 0%,
    hsl(217 92% 82%) 50%,
    hsl(0 0% 98%) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Bio */
.bio {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

/* Status indicator */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: hsl(142 70% 45% / 0.12);
  border: 1px solid hsl(142 70% 45% / 0.25);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  color: hsl(142 70% 68%);
  box-shadow: 0 0 16px hsl(142 70% 45% / 0.15);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(142 70% 55%);
  box-shadow: 0 0 8px hsl(142 70% 55%);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; scale: 1; }
  50% { opacity: 0.5; scale: 0.85; }
}

/* --- Links Section --- */
.links {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
}

.link-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: radial-gradient(
    300px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    hsl(225 20% 16% / 0.9),
    var(--color-surface) 60%
  );
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  overflow: hidden;
  transition:
    border-color var(--transition-smooth),
    translate var(--transition-smooth),
    box-shadow var(--transition-smooth);
  animation: link-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes link-enter {
  from {
    opacity: 0;
    translate: 0 20px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}

/* Highlight flare on hover */
.link-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    200px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    hsl(0 0% 100% / 0.08),
    transparent 70%
  );
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.link-item:hover {
  border-color: var(--color-border-hover);
  translate: 0 -3px;
  box-shadow: 0 10px 30px -5px hsl(225 50% 4% / 0.5), 0 0 20px hsl(217 92% 65% / 0.1);
}

.link-item:hover::before {
  opacity: 1;
}

/* Custom hover accents per link */
#link-email:hover {
  border-color: hsl(217 92% 65% / 0.5);
  box-shadow: 0 10px 30px -5px hsl(225 50% 4% / 0.5), 0 0 24px hsl(217 92% 65% / 0.18);
}

#link-linkedin:hover {
  border-color: hsl(210 90% 55% / 0.5);
  box-shadow: 0 10px 30px -5px hsl(225 50% 4% / 0.5), 0 0 24px hsl(210 90% 55% / 0.18);
}

#link-github:hover {
  border-color: hsl(260 60% 65% / 0.5);
  box-shadow: 0 10px 30px -5px hsl(225 50% 4% / 0.5), 0 0 24px hsl(260 60% 65% / 0.18);
}

.link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: hsl(225 20% 14%);
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: color var(--transition-smooth), background var(--transition-smooth), transform var(--transition-bounce);
}

.link-item:hover .link-icon {
  transform: scale(1.08);
}

#link-email:hover .link-icon {
  background: hsl(217 92% 65% / 0.15);
  color: var(--color-accent);
}

#link-linkedin:hover .link-icon {
  background: hsl(210 90% 55% / 0.15);
  color: hsl(210 90% 65%);
}

#link-github:hover .link-icon {
  background: hsl(260 60% 65% / 0.15);
  color: hsl(260 60% 75%);
}

.link-text {
  font-size: 0.95rem;
  font-weight: 500;
  flex-grow: 1;
}

.link-arrow {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  opacity: 0;
  translate: -8px 0;
  transition: opacity var(--transition-smooth), translate var(--transition-smooth), color var(--transition-smooth);
}

.link-item:hover .link-arrow {
  opacity: 1;
  translate: 0 0;
  color: var(--color-text);
}

/* Click ripple */
.ripple {
  position: absolute;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: hsl(0 0% 100% / 0.15);
  animation: ripple-out 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-out {
  to {
    width: 450px;
    height: 450px;
    margin-left: -225px;
    margin-top: -225px;
    opacity: 0;
  }
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 2;
  text-align: center;
}

.divider {
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-border) 50%,
    transparent 100%
  );
  margin-bottom: 20px;
}

.footer-text {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .container {
    padding: 16px;
  }

  .card {
    padding: 36px 20px 24px;
    border-radius: var(--radius-md);
  }

  .name {
    font-size: 1.35rem;
  }

  .link-item {
    padding: 14px 16px;
  }
}
