:root {
  --bg-dark: #050505;
  --text-main: #ffffff;
  --text-dim: #a3a3a3;
  --accent: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.15);
  --font-body: "Outfit", sans-serif;
  --font-heading: "Space Grotesk", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

.bg-fixed {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.grid-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
  animation: grid-drift 30s linear infinite;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: #ffffff;
  top: -100px;
  left: -100px;
  animation: float 10s infinite alternate;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: #888888;
  bottom: -50px;
  right: -50px;
  animation: float 15s infinite alternate-reverse;
}

@keyframes float {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, 30px); }
}

@keyframes grid-drift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 120px 120px, -120px -120px; }
}

header {
  position: fixed;
  top: 20px;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 1000;
}

.nav-pill {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  padding: 10px 20px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  box-shadow: 0 10px 30px -10px rgba(255, 255, 255, 0.05);
}

.nav-tools {
  display: flex;
  align-items: center;
  position: relative;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
  justify-content: center;
}

nav a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  transition: 0.3s;
}

nav a:hover {
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.container {
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 120px 20px 40px;
}

.reveal {
  --reveal-x: 0px;
  --reveal-y: 16px;
  --reveal-scale: 0.98;
  opacity: 0;
  transform: translate(var(--reveal-x), var(--reveal-y)) scale(var(--reveal-scale));
  filter: blur(6px);
  transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease;
  will-change: transform, opacity;
}

.reveal.in-view {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  filter: blur(0);
}

.reveal-top { --reveal-y: -16px; }
.reveal-left { --reveal-x: -16px; }
.reveal-right { --reveal-x: 16px; }
.reveal-zoom { --reveal-y: 0px; --reveal-scale: 0.94; }
.delay-1 { transition-delay: 50ms; }
.delay-2 { transition-delay: 0.12s; }
.delay-3 { transition-delay: 0.2s; }
.delay-4 { transition-delay: 0.28s; }

.hero {
  text-align: center;
  padding: 20px 0 20px;
}

.avatar-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  transition: 0.5s;
}

.avatar:hover {
  border-color: #fff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  font-size: 0.75rem;
  color: #eee;
  margin-bottom: 15px;
  backdrop-filter: blur(5px);
}

.dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(to bottom, #fff, #666);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.hero p {
  color: var(--text-dim);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

.realname {
  margin: 0 auto 6px;
  color: #ddd;
  font-weight: 500;
  max-width: 600px;
}

.info-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.info-tag {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  color: #bbb;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: default;
  transition: 0.3s;
}

.info-tag:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  color: #fff;
  transform: translateY(-2px);
}

.section-header {
  margin: 50px 0 30px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--glass-border), transparent);
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: #fff;
  font-weight: 700;
}

.section-note {
  margin: -10px 0 24px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #d2d2d2;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.skill-card {
  --skill-accent: #ffffff;
  --skill-glow: rgba(255, 255, 255, 0.2);
  appearance: none;
  font: inherit;
  background:
    radial-gradient(circle at 50% 0, transparent, transparent 58%),
    var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: inherit;
  position: relative;
  overflow: hidden;
  min-height: 128px;
}

.skill-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--skill-accent);
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.skill-card i {
  font-size: 2.5rem;
  color: #888 !important;
  transition: color 0.25s ease, filter 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
  filter: grayscale(100%) saturate(0);
  opacity: 0.58;
}

.skill-card span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.25s ease;
  position: relative;
  z-index: 1;
}

.skill-card:hover {
  transform: translateY(-5px);
  background:
    radial-gradient(circle at 50% 0, var(--skill-glow), transparent 62%),
    rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.34);
}

.skill-card:focus-visible {
  outline: 2px solid var(--skill-accent);
  outline-offset: 4px;
}

.skill-card:hover span {
  color: #fff;
}

.skill-card:hover i {
  opacity: 0.86;
  transform: translateY(-1px);
}

.skill-card.is-active,
.skill-card[aria-pressed="true"] {
  background:
    radial-gradient(circle at 50% -10%, var(--skill-glow), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.028));
  border-color: color-mix(in srgb, var(--skill-accent) 58%, rgba(255, 255, 255, 0.2));
  box-shadow:
    0 16px 44px -24px var(--skill-accent),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.skill-card.is-active::after,
.skill-card[aria-pressed="true"]::after {
  opacity: 0.9;
  transform: scaleX(1);
}

.skill-card.is-active i,
.skill-card[aria-pressed="true"] i {
  color: var(--skill-accent) !important;
  filter: grayscale(0%) saturate(1.2) drop-shadow(0 0 12px var(--skill-glow));
  opacity: 1;
}

.skill-card.is-active span,
.skill-card[aria-pressed="true"] span {
  color: #fff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.repo-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 25px;
  transition: 0.3s;
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.repo-card:hover {
  transform: translateY(-5px);
  border-color: #fff;
  box-shadow: 0 10px 40px -10px rgba(255, 255, 255, 0.1);
}

.repo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.repo-name {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  word-break: break-word;
}

.repo-name svg {
  width: 16px;
  fill: currentColor;
}

.badge-vis {
  font-size: 0.65rem;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #999;
  white-space: nowrap;
}

.repo-desc {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 20px;
  flex-grow: 1;
  line-height: 1.5;
}

.repo-stats {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.75rem;
  color: #777;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 15px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-item svg {
  width: 12px;
  fill: currentColor;
}

.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  filter: grayscale(0.5);
}

.updated {
  margin-left: auto;
}

footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--glass-border);
}

.contact-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.contact-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 6px;
}

.contact-header p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.contact-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.contact-link {
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 12px 16px 12px 52px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: 0.3s;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
}

.contact-link:hover {
  border-color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -14px rgba(255, 255, 255, 0.4);
}

.contact-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.contact-icon svg {
  width: 16px;
  height: 16px;
  fill: var(--text-main);
  opacity: 0.9;
}

.contact-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.contact-value {
  font-size: 0.95rem;
  color: #fff;
}

.footer-note {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 24px;
}

.locale-menu {
  position: relative;
}

.locale-menu summary {
  list-style: none;
}

.locale-menu summary::-webkit-details-marker {
  display: none;
}

.locale-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.locale-menu-trigger:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.locale-menu[open] .locale-menu-trigger {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
}

.locale-menu-current-code {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-main);
  white-space: nowrap;
}

.locale-menu-chevron {
  font-size: 0.68rem;
  color: var(--text-dim);
  transition: transform 0.25s ease;
}

.locale-menu[open] .locale-menu-chevron {
  transform: rotate(180deg);
}

.locale-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 210px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.75);
}

.locale-menu-detected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.locale-menu-detected[hidden] {
  display: none;
}

.locale-menu-detected-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.locale-menu-detected-label {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.locale-menu-detected-code {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
}

.locale-menu-list {
  display: grid;
  gap: 4px;
}

.locale-menu-item {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.locale-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(2px);
}

.locale-menu-item.is-active {
  background: rgba(255, 255, 255, 0.1);
}

.locale-menu-item-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.locale-menu-item-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
}

.locale-menu-item-code {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.locale-menu-current-flag.fi,
.locale-menu-detected-flag.fi,
.locale-menu-item-flag.fi {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  aspect-ratio: 4 / 3;
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: cover;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

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

  .grid-bg,
  .orb {
    animation: none;
  }
}

@media (max-width: 768px) {
  .container {
    padding-top: 168px;
  }

  .nav-pill {
    padding: 10px 16px 14px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    margin: 40px 0 20px;
  }

  .section-line {
    display: none;
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .contact-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .contact-links {
    width: 100%;
    justify-content: stretch;
  }

  .contact-link {
    width: 100%;
    min-width: unset;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-tools {
    width: 100%;
    justify-content: center;
  }

  .locale-menu-panel {
    right: 50%;
    transform: translateX(50%);
  }

  .section-note {
    margin: -4px 0 24px;
    font-size: 0.9rem;
  }
}
