/* Linktree-style centred profile on top, bento-style tile grid below. No external resource. */
:root {
  --bg: #08060d;
  --card: rgba(24, 19, 34, 0.62);
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f4f0fa;
  --muted: #a59cb5;
  --accent-1: #8b5cf6;
  --accent-2: #d946ef;
  --accent-3: #22d3ee;
  --radius: 26px;
  --gap: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "SF Pro Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- Animated background ---------- */

.glow {
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 20% 15%, rgba(139, 92, 246, 0.42), transparent 60%),
    radial-gradient(34vmax 34vmax at 85% 25%, rgba(217, 70, 239, 0.30), transparent 60%),
    radial-gradient(40vmax 40vmax at 60% 95%, rgba(34, 211, 238, 0.18), transparent 60%);
  filter: blur(20px);
  animation: drift 22s ease-in-out infinite alternate;
}

.glow::after {
  /* Faint dotted grid over the glow. */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 65%);
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
  50%  { transform: translate3d(3vmax, -2vmax, 0) rotate(8deg); }
  100% { transform: translate3d(-3vmax, 2vmax, 0) rotate(-6deg); }
}

/* ---------- Layout ---------- */

.page {
  width: min(760px, 100% - 32px);
  margin: 0 auto;
  padding: 64px 0 32px;
}

/* ---------- Profile (Linktree-like hero) ---------- */

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 40px;
  animation: rise 0.7s cubic-bezier(.2, .8, .2, 1) both;
}

.avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  padding: 4px;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    conic-gradient(from var(--angle, 0deg), var(--accent-1), var(--accent-2), var(--accent-3), var(--accent-1)) border-box;
  border: 4px solid transparent;
  box-shadow: 0 0 60px rgba(168, 85, 247, 0.45);
  animation: spin 6s linear infinite;
}

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

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

.profile h1 {
  margin: 20px 0 2px;
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(100deg, #fff 20%, #e9d5ff 50%, #f0abfc 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.handle {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.bio {
  max-width: 460px;
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: #d9d2e6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
}

.flag {
  display: inline-flex;
  width: 18px;
  height: 12px;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.flag svg { width: 100%; height: 100%; }

/* ---------- Bento grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 168px;
  grid-auto-flow: dense;
  gap: var(--gap);
}

.tile {
  --brand: #a78bfa;
  --brand-2: #7c3aed;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 55%),
    var(--card);
  backdrop-filter: blur(18px) saturate(140%);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .35s, box-shadow .35s;
  animation: rise 0.6s cubic-bezier(.2, .8, .2, 1) both;
}

.tile:nth-child(1) { animation-delay: .08s; }
.tile:nth-child(2) { animation-delay: .14s; }
.tile:nth-child(3) { animation-delay: .20s; }
.tile:nth-child(4) { animation-delay: .26s; }
.tile:nth-child(5) { animation-delay: .32s; }
.tile:nth-child(6) { animation-delay: .38s; }
.tile:nth-child(n+7) { animation-delay: .44s; }

/* Big blurred brand pictogram in the corner. */
.tile::before {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 55%, transparent), transparent 70%);
  opacity: .35;
  z-index: -1;
  transition: opacity .35s, transform .5s;
}

a.tile, button.tile { cursor: pointer; }

a.tile:hover, button.tile:hover,
a.tile:focus-visible, button.tile:focus-visible {
  transform: translateY(-4px) scale(1.015);
  border-color: color-mix(in srgb, var(--brand) 60%, transparent);
  box-shadow: 0 18px 50px -12px color-mix(in srgb, var(--brand) 55%, transparent);
  outline: none;
}

a.tile:hover::before, button.tile:hover::before { opacity: .7; transform: scale(1.25); }

a.tile:active, button.tile:active { transform: translateY(-1px) scale(.99); }

.tile--wide  { grid-column: span 2; }
.tile--tall  { grid-row: span 2; }
.tile--large { grid-column: span 2; grid-row: span 2; }

.tile__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--brand) 70%, transparent);
  flex: none;
}

.tile__icon svg { width: 24px; height: 24px; }

.tile__mark {
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 128px;
  height: 128px;
  color: var(--brand);
  opacity: .09;
  transform: rotate(-12deg);
  z-index: -1;
  pointer-events: none;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .35s;
}

.tile__mark svg { width: 100%; height: 100%; }
.tile--wide .tile__mark { width: 150px; height: 150px; right: 10px; bottom: -34px; }
.tile--large .tile__mark { width: 250px; height: 250px; right: -30px; top: 50px; bottom: auto; }
.tile--github .tile__mark { color: #fff; opacity: .05; }

a.tile:hover .tile__mark, button.tile:hover .tile__mark { transform: rotate(-4deg) scale(1.08); opacity: .16; }

.tile__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.tile__title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.tile__sub {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile__cta {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--card-border);
  transition: background .3s, color .3s;
}

.tile__cta::after { content: " ↗"; }
button.tile .tile__cta::after { content: " ⧉"; }

a.tile:hover .tile__cta, button.tile:hover .tile__cta {
  background: var(--brand);
  color: #fff;
}

.tile__text {
  margin: 0;
  color: #d9d2e6;
  line-height: 1.45;
  font-size: 0.95rem;
}

.tile--note { justify-content: flex-start; }
.tile--note .tile__icon { width: 36px; height: 36px; border-radius: 11px; }
.tile--note .tile__icon svg { width: 18px; height: 18px; }

/* GitHub: latest repositories. */
.tile__repos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.tile__repos li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

.repo__lang { color: var(--muted); }
.repo__lang::before { content: "● "; color: var(--accent-2); }

/* Not configured yet. */
.tile.is-pending { opacity: .55; filter: grayscale(.7); }

/* ---------- Brand colours ---------- */

.tile--github       { --brand: #6e7681; --brand-2: #24292f; }
.tile--lol          { --brand: #c89b3c; --brand-2: #0a5f70; }
.tile--rocketleague { --brand: #1f8ef1; --brand-2: #f97316; }
.tile--discord      { --brand: #5865f2; --brand-2: #3c45a5; }
.tile--twitch       { --brand: #9146ff; --brand-2: #5c16c5; }
.tile--youtube      { --brand: #ff0033; --brand-2: #b0001f; }
.tile--note         { --brand: #d946ef; --brand-2: #8b5cf6; }

/* ---------- Misc ---------- */

.footer {
  padding: 8px 0 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  opacity: .7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(24, 19, 34, 0.92);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  font-weight: 600;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s;
}

.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.error { grid-column: 1 / -1; text-align: center; color: var(--muted); }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

/* Desktop: profile on the left, grid on the right, everything fits in one screen (no scroll). */
@media (min-width: 1000px) and (min-height: 540px) {
  .page {
    width: min(1180px, 100% - 64px);
    min-height: 100vh;
    padding: 40px 0;
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr auto;
    column-gap: 56px;
    align-items: center;
  }

  .profile {
    grid-column: 1;
    grid-row: 1;
    align-items: flex-start;
    text-align: left;
    margin: 0;
  }

  .avatar { width: 150px; height: 150px; }
  .tags { justify-content: flex-start; }

  .grid {
    grid-column: 2;
    grid-row: 1 / span 2;
    /* Three rows sized from the window height, capped so tiles stay close to square. */
    grid-auto-rows: clamp(120px, calc((100vh - 80px - 2 * var(--gap)) / 3), 200px);
  }

  .footer {
    grid-column: 1;
    grid-row: 2;
    padding: 0;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .page { padding-top: 44px; }
  .grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; gap: 12px; }
  .tile { padding: 16px; }
  .tile__cta { top: 16px; right: 16px; }
  .tile--small .tile__cta { display: none; }
  .avatar { width: 112px; height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
