/* ========================================
   Jonas Krogh — Digital Business Card
   Modern, responsive, with Safari-safe animations
   ======================================== */

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

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-light: #1a1a2e;
  --border: rgba(255, 255, 255, 0.06);
  --text: #e8e8ed;
  --text-muted: #8888a0;
  --text-dim: #55556a;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --gradient-1: #6366f1;
  --gradient-2: #8b5cf6;
  --gradient-3: #a78bfa;
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

/* --- Film grain overlay --- */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* --- Floating glow orbs --- */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

.glow-orb--1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  top: -100px;
  right: -100px;
  animation: orb-float-1 20s ease-in-out infinite;
}

.glow-orb--2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
  bottom: -80px;
  left: -80px;
  animation: orb-float-2 25s ease-in-out infinite;
}

@keyframes orb-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-60px, 40px) scale(1.1); }
  66% { transform: translate(30px, -30px) scale(0.95); }
}

@keyframes orb-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(50px, -40px) scale(1.05); }
  66% { transform: translate(-40px, 30px) scale(0.9); }
}

/* --- Card wrapper --- */
.card-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  padding: 20px;
}

/* --- Card --- */
.card {
  position: relative;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(30px) scale(0.97);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.card.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Animated gradient border */
.card-border {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(
    var(--border-angle, 0deg),
    var(--gradient-1),
    var(--gradient-2),
    var(--gradient-3),
    transparent,
    transparent,
    var(--gradient-1)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: border-spin 6s linear infinite;
  opacity: 0.6;
}

@property --border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

@keyframes border-spin {
  to { --border-angle: 360deg; }
}

/* Fallback for browsers that don't support @property */
@supports not (background: paint(something)) {
  .card-border {
    animation: border-spin-fallback 6s linear infinite;
  }
  @keyframes border-spin-fallback {
    0% { opacity: 0.3; }
    50% { opacity: 0.7; }
    100% { opacity: 0.3; }
  }
}

.card-inner {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 32px 32px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Subtle inner shine */
.card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), transparent);
  pointer-events: none;
}

/* --- Animate-in elements --- */
[data-animate="fade-up"] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-animate="fade-up"].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Profile Section --- */
.profile-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.avatar-ring {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));
  animation: avatar-pulse 4s ease-in-out infinite;
}

@keyframes avatar-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--accent-glow), 0 0 60px rgba(99, 102, 241, 0.1); }
  50% { box-shadow: 0 0 30px var(--accent-glow), 0 0 80px rgba(99, 102, 241, 0.15); }
}

.avatar-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(20px);
  animation: glow-breathe 4s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 1;
}

.name-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.name {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, #fff 0%, #c4c4d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent-light);
  letter-spacing: 0.02em;
}

.company {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Divider --- */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.divider-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
}

/* --- Pitch --- */
.pitch {
  text-align: center;
  margin-bottom: 28px;
}

.pitch-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto;
}

.pitch-text strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Competencies Grid --- */
.competencies {
  margin-bottom: 28px;
}

.comp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.comp-item {
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.3s ease,
              box-shadow 0.3s ease;
  cursor: default;
}

.comp-item:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
}

.comp-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  color: var(--accent-light);
  opacity: 0.8;
}

.comp-icon svg {
  width: 100%;
  height: 100%;
}

.comp-title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.comp-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Stats --- */
.stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 28px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-light);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-suffix {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-light);
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* --- Career Highlights --- */
.highlights {
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}

.highlight-item:last-child {
  border-bottom: none;
}

.highlight-year {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 500;
  min-width: 80px;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.highlight-content {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.highlight-content strong {
  color: var(--text);
  font-weight: 600;
}

/* --- Contact Links --- */
.contact-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.contact-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-light);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.contact-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.contact-btn:hover {
  transform: translateY(-2px);
  color: var(--text);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
}

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

.contact-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contact-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}

.contact-btn span {
  position: relative;
  z-index: 1;
}

.contact-btn.linkedin:hover {
  border-color: rgba(10, 102, 194, 0.4);
  box-shadow: 0 8px 30px rgba(10, 102, 194, 0.1);
}

/* --- Location --- */
.location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 500px) {
  .card-wrapper {
    padding: 16px;
  }

  .card-inner {
    padding: 32px 20px 24px;
  }

  .name {
    font-size: 1.5rem;
  }

  .comp-grid {
    gap: 8px;
  }

  .comp-item {
    padding: 16px 12px;
  }

  .comp-title {
    font-size: 0.75rem;
  }

  .comp-desc {
    font-size: 0.6875rem;
  }

  .stats {
    gap: 20px;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .contact-links {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .contact-btn {
    flex-direction: row;
    justify-content: center;
    padding: 12px;
    gap: 8px;
  }

  .highlight-year {
    min-width: 70px;
  }

  .glow-orb--1 {
    width: 250px;
    height: 250px;
  }

  .glow-orb--2 {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 360px) {
  .comp-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    flex-direction: column;
    gap: 16px;
  }
}

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

  .card {
    opacity: 1;
    transform: none;
  }

  [data-animate="fade-up"] {
    opacity: 1;
    transform: none;
  }

  .glow-orb {
    display: none;
  }
}
