@property --avatar-hue {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  --avatar-hue: 0deg;
  --accent: #57f287;
  --icon-hover: #3b82f6;
  --page-bg: #1e1f22;
  --card-bg: #282a2e;
  --surface-bg: #222428;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --border: #42454a;
  --shadow-deep: 0 24px 70px rgb(0 0 0 / 42%);
  --shadow-raised: 0 12px 30px rgb(0 0 0 / 28%);
  --edge-light: rgb(255 255 255 / 9%);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgb(91 120 255 / 12%), transparent 43rem),
    radial-gradient(ellipse at 92% 48%, rgb(87 242 135 / 5%), transparent 36rem),
    var(--page-bg);
  color: var(--text);
  transition: background-color 220ms ease, color 220ms ease;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse at 12% 78%, rgb(133 84 255 / 6%), transparent 34rem),
    linear-gradient(180deg, rgb(255 255 255 / 2%), transparent 24rem);
  content: "";
  pointer-events: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.page-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 18px;
}

.profile-card {
  position: relative;
  overflow: hidden;
  width: min(100%, 600px);
  padding: clamp(28px, 7vw, 50px);
  border: 1px solid var(--edge-light);
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% -20%, rgb(255 255 255 / 8%), transparent 65%),
    linear-gradient(145deg, rgb(255 255 255 / 3%), transparent 48%),
    var(--card-bg);
  box-shadow: var(--shadow-deep), inset 0 1px 0 rgb(255 255 255 / 5%);
  text-align: center;
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.profile-card::after {
  position: absolute;
  top: 0;
  left: 12%;
  width: 76%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 24%), transparent);
  content: "";
  pointer-events: none;
}

.profile-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar {
  width: 128px;
  height: 128px;
  border: 4px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(var(--surface-bg), var(--surface-bg)) padding-box,
    conic-gradient(
      from var(--avatar-hue),
      #ff3333,
      #ffcc33,
      #33dd66,
      #33ccff,
      #6655ff,
      #dd44ee,
      #ff3333
    ) border-box;
  object-fit: cover;
  animation: avatar-border-colors 6s linear infinite;
  filter: drop-shadow(0 0 14px hsl(var(--avatar-hue) 90% 60% / 30%));
}

@keyframes avatar-border-colors {
  to {
    --avatar-hue: 360deg;
  }
}

h1 {
  max-width: 100%;
  margin: 18px 0 16px;
  font-size: clamp(1.8rem, 8vw, 2.35rem);
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.social-links {
  display: grid;
  width: min(100%, 480px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.social-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 148px;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-left: 3px solid var(--social-accent, var(--icon-hover));
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 5%), transparent 62%),
    var(--surface-bg);
  color: var(--text);
  text-decoration: none;
  text-align: left;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%), 0 8px 20px rgb(0 0 0 / 18%);
  cursor: pointer;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.social-card-x {
  --social-accent: #3b82f6;
}

.social-card-youtube {
  --social-accent: #ff4b5c;
}

.social-card-steam {
  --social-accent: #7aa8ff;
}

.social-card-discord {
  --social-accent: #8b9cff;
}

.social-card:hover {
  transform: translateY(-3px);
  border-color: var(--social-accent);
  box-shadow: 0 14px 28px rgb(0 0 0 / 28%), 0 0 20px rgb(59 130 246 / 10%);
}

.social-card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.social-card-header {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.social-card-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 11px;
  background: rgb(255 255 255 / 7%);
  color: #fff;
  font-size: 1.15rem;
}

.social-card-title {
  font-size: 1rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.social-card-description {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.social-card-action {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 650;
}

.social-card:hover .social-card-action {
  color: var(--icon-hover);
}

.profile-email-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.profile-email-link:hover {
  border-color: var(--icon-hover);
  background: rgb(59 130 246 / 8%);
  color: var(--icon-hover);
}

.social-card[hidden],
.profile-email-link[hidden] {
  display: none;
}

.tooltip {
  margin-left: auto;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.tooltip.visible {
  opacity: 1;
}

.bio {
  max-width: 100%;
  margin: -6px 0 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.tagline {
  min-height: 1.7em;
  max-width: 100%;
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.tagline::after {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  background: var(--accent);
  content: "";
  vertical-align: -0.12em;
  animation: caret 850ms steps(2, start) infinite;
}

@keyframes caret {
  to {
    visibility: hidden;
  }
}

.social-link .fa-envelope {
  color: inherit;
}

.social-link i {
  color: inherit;
}

.gallery-section {
  width: min(100%, 1120px);
  margin-top: clamp(26px, 5vw, 42px);
  padding: clamp(16px, 2.2vw, 22px);
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgb(255 255 255 / 3%), transparent 52%),
    rgb(40 42 46 / 62%);
  box-shadow: var(--shadow-raised), inset 0 1px 0 rgb(255 255 255 / 4%);
}

.gallery-heading {
  margin: 0 0 14px;
  text-align: center;
}

.gallery-heading h2 {
  margin: 0;
  font-size: clamp(1.15rem, 4vw, 1.4rem);
}

.gallery-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.gallery-viewport {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.gallery-viewport::-webkit-scrollbar {
  display: none;
}

.gallery-track {
  display: flex;
  gap: 14px;
}

.gallery-item {
  min-width: 0;
  flex: 0 0 calc((100% - 42px) / 4);
  margin: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 14px;
  background:
    linear-gradient(150deg, rgb(255 255 255 / 5%), transparent 60%),
    var(--card-bg);
  box-shadow: 0 8px 20px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 4%);
  scroll-snap-align: start;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.gallery-item:hover {
  transform: translateY(-3px);
  border-color: rgb(87 242 135 / 35%);
  box-shadow: 0 14px 28px rgb(0 0 0 / 32%), 0 0 20px rgb(87 242 135 / 7%);
}

.gallery-image-button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--surface-bg);
  cursor: zoom-in;
}

.gallery-image-button img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  transition: transform 220ms ease;
}

.gallery-image-button:hover img {
  transform: scale(1.035);
}

.gallery-item figcaption {
  padding: 9px 12px;
  background: linear-gradient(180deg, rgb(255 255 255 / 2%), transparent);
  color: var(--text);
  font-size: 0.82rem;
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.gallery-position {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.gallery-navigation {
  display: flex;
  gap: 8px;
}

.gallery-nav-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--edge-light);
  border-radius: 12px;
  background: linear-gradient(145deg, rgb(255 255 255 / 5%), transparent 70%), var(--surface-bg);
  color: #fff;
  box-shadow: 0 5px 14px rgb(0 0 0 / 24%), inset 0 1px 0 rgb(255 255 255 / 5%);
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.gallery-nav-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--icon-hover);
  color: var(--icon-hover);
  box-shadow: 0 8px 20px rgb(59 130 246 / 20%);
}

.gallery-nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.gallery-nav-button:focus-visible,
.gallery-viewport:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.gallery-dialog {
  width: min(96vw, 1500px);
  max-width: none;
  max-height: 94vh;
  padding: clamp(10px, 2vw, 18px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 30px 100px rgb(0 0 0 / 65%), inset 0 1px 0 rgb(255 255 255 / 7%);
}

.gallery-dialog::backdrop {
  background: rgb(0 0 0 / 82%);
  backdrop-filter: blur(4px);
}

.dialog-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-toolbar p {
  margin: 0;
  color: var(--muted);
}

.dialog-viewer {
  position: relative;
  display: grid;
  min-height: 120px;
  place-items: center;
  margin-top: 8px;
}

.dialog-viewer > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 21 / 9;
  max-height: calc(94vh - 100px);
  border-radius: 10px;
  object-fit: contain;
}

.dialog-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-bg);
  color: #fff;
  cursor: pointer;
}

.dialog-button:hover {
  border-color: var(--icon-hover);
  color: var(--icon-hover);
}

.dialog-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.gallery-previous,
.gallery-next {
  position: absolute;
  z-index: 1;
  top: 50%;
  transform: translateY(-50%);
  background: rgb(30 31 34 / 82%);
}

.gallery-previous {
  left: 10px;
}

.gallery-next {
  right: 10px;
}

.page-footer {
  padding: 16px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

@media (max-width: 420px) {
  .page-shell {
    justify-content: flex-start;
    padding-top: 20px;
  }

  .social-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .social-card {
    min-height: 124px;
  }

  .profile-card {
    padding: 28px 18px 24px;
    border-radius: 20px;
  }

  .gallery-track {
    gap: 12px;
  }

  .gallery-item {
    flex-basis: calc((100% - 12px) / 2);
  }

  .gallery-dialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    padding: 10px;
    border-radius: 14px;
  }

  .dialog-viewer > img {
    max-height: calc(100dvh - 100px);
  }
}

@media (max-width: 560px) {
  .gallery-item {
    flex-basis: 100%;
  }
}

@media (min-width: 561px) and (max-width: 900px) {
  .gallery-item {
    flex-basis: calc((100% - 14px) / 2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .avatar {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
