:root {
  --bg: #1A1A1A;
  --card-bg: rgba(42, 42, 42, 0.5);
  --muted: rgba(133, 133, 133, 0.3);
  --muted-hover: rgba(154, 154, 154, 0.6);
  --accent: rgba(84, 84, 84, 0.3);
  --white: #ffffff;
  --selection-color: rgba(203, 115, 107, 0.8);

  --radius: 12px;
  --card-max-width: 800px;
  --card-padding: 20px;
  --transition-fast: 0.3s ease;
  --modal-blur: 4px;

  --static-glow-w: 380px;
  --static-glow-h: 380px;
  --static-glow-blur: 28px;

  --avatar-glow-w: 250px;
  --avatar-glow-h: 250px;
  --avatar-glow-blur: 28px;
}

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

img {
  user-select: none;
  -webkit-user-drag: none;
}

/* =========== base =========== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: "Montserrat", "JetBrains Mono";
  background: var(--bg);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* =========== card =========== */
.profile-card {
  width: 100%;
  max-width: var(--card-max-width);
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(84, 84, 84, 0.5);
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  z-index: 2;
  will-change: transform;
  transform-style: preserve-3d;
  transition: transform 300ms cubic-bezier(.2, .9, .2, 1), opacity 0.8s cubic-bezier(.2, .9, .2, 1);

  opacity: 0;
  transform: scale(0.97);
}

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

.profile-card__header {
  display: flex;
  gap: 16px;
  align-items: center;
}

.profile-card__avatar {
  position: relative;
  z-index: 30;
  overflow: visible;
  width: 150px;
  height: 150px;
  border-radius: 12px;
  background: #2a2a2a;
  flex-shrink: 0;
}

.profile-card__avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  position: relative;
  z-index: 40;
}

.profile-card__meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.profile-card__name {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  margin: 0;
  cursor: default;
}

.profile-card__desc {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--white);
  opacity: 0.95;
  max-width: 900px;
}

.profile-card__bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.projects,
.links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  cursor: default;
}

.projects-list,
.links-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.project-item,
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--accent);
  border: 1px solid var(--muted);
  min-height: 46px;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.93rem;
  transition: border-color var(--transition-fast);
  cursor: pointer;
}

.project-item:hover,
.link-chip:hover {
  border-color: var(--muted-hover);
}

.project-item img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
}

.project-item__title {
  font-weight: 600;
  font-size: 0.93rem;
  user-select: none;
}

.link-chip {
  font-weight: 500;
  user-select: none;
}

.link-chip i {
  font-size: 1.125rem;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========== modals =========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast), backdrop-filter var(--transition-fast);
}

.modal-overlay.open {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(var(--modal-blur));
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid var(--muted);
  border-radius: 12px;
  padding: 18px;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform: scale(0.95);
  opacity: 0;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
  position: relative;
}

.modal-overlay.open .modal {
  transform: scale(1);
  opacity: 1;
}

.modal__banner {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin-bottom: 12px;
}

.modal__title {
  margin: 0 0 8px 0;
  font-size: 1.4rem;
  cursor: default;
}

.modal__desc {
  margin: 0 0 12px 0;
  color: var(--white);
  opacity: 0.95;
  line-height: 1.4;
}

.modal__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tag {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  font-size: 0.81rem;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: default;
  user-select: none;
}

.modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--muted);
  background: var(--accent);
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}

.btn--primary,
.btn--secondary {
  background: rgba(61, 61, 61, 0.2);
  border: 1px solid rgba(175, 175, 175, 0.14);
  transition: border-color var(--transition-fast);
  user-select: none;
}

.btn--primary:hover,
.btn--secondary:hover {
  border-color: rgba(175, 175, 175, 0.35);
}

.btn--disabled {
  opacity: 0.6;
  cursor: default;
  user-select: none;
}

.profile-card::before {
  display: none !important;
}

/* =========== static glow =========== */
.profile-card-static-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  width: var(--static-glow-w);
  height: var(--static-glow-h);
  border-radius: 50%;
  background: radial-gradient(
    circle at 40% 40%,
    rgba(32, 106, 133, 0.30) 0%,
    rgba(32, 106, 133, 0.18) 35%,
    rgba(32, 106, 133, 0.08) 60%,
    transparent 100%
  );
  filter: blur(var(--static-glow-blur));
  transition: opacity 0.35s ease, transform 0.35s ease;
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.profile-card__avatar::after {
  content: "";
  position: absolute;
  z-index: 20;
  left: 50%;
  top: -15%;
  transform: translate(-50%, -10%);
  width: var(--avatar-glow-w);
  height: var(--avatar-glow-h);
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 45%,
    rgba(144, 73, 67, 0.30) 40%,
    rgba(144, 73, 67, 0.16) 60%,
    rgba(144, 73, 67, 0.06) 80%,
    transparent 100%
  );
  filter: blur(var(--avatar-glow-blur));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* =========== Adaptive =========== */
@media (max-width: 880px) {
  html, body {
    padding: 14px;
  }

  .profile-card {
    padding: 16px;
  }

  .profile-card__header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-card__bottom {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 14px;
  }

  .profile-card-static-glow {
    width: 300px;
    height: 300px;
    filter: blur(22px);
  }

  .profile-card__avatar::after {
    opacity: 0;
  }
}

@media (max-width: 420px) {
  .profile-card__name {
    font-size: 1.6rem;
  }

  .profile-card__desc {
    font-size: 0.9rem;
  }

  .profile-card__avatar {
    width: 120px;
    height: 120px;
  }

  .profile-card {
    max-width: 380px;
  }

  .profile-card-static-glow {
    width: 240px;
    height: 240px;
    filter: blur(18px);
    opacity: 0.8;
  }

  .profile-card__avatar::after {
    opacity: 0;
  }
}

@media (hover: none) and (pointer: coarse) {
  .profile-card-static-glow {
    display: none !important;
  }

  .profile-card {
    transition: none !important;
    transform: none !important;
  }
}