@layer reset, tokens, base, layout, components, motion, utilities;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
  }

  body {
    min-height: 100svh;
    margin: 0;
  }

  img,
  svg {
    display: block;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

@layer tokens {
  :root {
    color-scheme: dark light;
    --bg: #111316;
    --bg-soft: #17191d;
    --text: #f1f3f5;
    --muted: #b9bec6;
    --accent: #6aa8e8;
    --ring: #6f879f;
    --ring-line: rgb(255 255 255 / 10%);
    --focus: #93c5fd;
    --line: rgb(255 255 255 / 10%);
    --shadow: 0 1.25rem 4rem rgb(0 0 0 / 35%);
    --ease-out: cubic-bezier(0.2, 0.75, 0.25, 1);
  }

  @media (prefers-color-scheme: light) {
    :root {
      --bg: #f5f7f9;
      --bg-soft: #ffffff;
      --text: #14171b;
      --muted: #5a6470;
      --accent: #2f6fa8;
      --ring: #8d9fb0;
      --ring-line: rgb(36 47 59 / 14%);
      --focus: #245f99;
      --line: rgb(20 23 27 / 12%);
      --shadow: 0 1.25rem 3.5rem rgb(34 48 68 / 15%);
    }
  }
}

@layer base {
  body {
    overflow-x: hidden;
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    background:
      linear-gradient(145deg, rgb(106 168 232 / 8%) 0%, transparent 32rem),
      radial-gradient(circle at 74% 12%, rgb(255 255 255 / 5%), transparent 24rem),
      linear-gradient(180deg, var(--bg-soft), var(--bg));
  }

  body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    opacity: 0.22;
    background-image:
      linear-gradient(var(--line) 1px, transparent 1px),
      linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 4.5rem 4.5rem;
    -webkit-mask-image: linear-gradient(120deg, black 0%, rgb(0 0 0 / 70%) 34%, transparent 72%);
    mask-image: linear-gradient(120deg, black 0%, rgb(0 0 0 / 70%) 34%, transparent 72%);
  }
}

@layer layout {
  .site-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100svh;
    align-items: start;
    justify-items: start;
    padding: clamp(2.75rem, 7vw, 5.75rem) clamp(1.5rem, 14vw, 12.5rem);
  }

  .profile {
    width: 100%;
    max-width: 42rem;
    transform: translate3d(var(--profile-x, 0), var(--profile-y, 0), 0);
    transition: transform 500ms var(--ease-out);
  }
}

@layer components {
  .portrait {
    position: relative;
    isolation: isolate;
    width: clamp(7.5rem, 11vw, 9.5rem);
    aspect-ratio: 1;
    padding: 0.48rem;
    border-radius: 50%;
    filter: drop-shadow(var(--shadow));
    animation: portrait-in 900ms var(--ease-out) both;
  }

  .portrait::before,
  .portrait::after {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    content: "";
  }

  .portrait::before {
    background: var(--ring);
  }

  .portrait::after {
    inset: -0.45rem;
    border: 1px solid var(--ring-line);
    opacity: 0.5;
  }

  .portrait picture {
    display: block;
    overflow: hidden;
    height: 100%;
    border: 0.26rem solid var(--bg);
    border-radius: inherit;
    background: #e9edf2;
    clip-path: circle(50%);
  }

  .portrait img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
  }

  .name {
    max-width: 12ch;
    margin: 1.25rem 0 0;
    font-size: clamp(2.1rem, 4vw, 4.15rem);
    font-weight: 760;
    line-height: 0.98;
  }

  .claim {
    max-width: 22rem;
    margin: 0.65rem 0 0;
    color: var(--muted);
    font-size: clamp(1.08rem, 1.6vw, 1.45rem);
    line-height: 1.35;
    text-wrap: balance;
  }

  .socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.8rem;
  }

  .social-link {
    --magnet-x: 0px;
    --magnet-y: 0px;
    --hover-y: 0px;
    --hover-scale: 1;
    display: grid;
    width: 2.55rem;
    height: 2.55rem;
    place-items: center;
    border: 1px solid rgb(98 168 238 / 26%);
    border-radius: 999px;
    color: var(--accent);
    background: rgb(98 168 238 / 6%);
    box-shadow: 0 0.8rem 2rem rgb(0 0 0 / 0%);
    transform: translate3d(var(--magnet-x), calc(var(--magnet-y) + var(--hover-y)), 0) scale(var(--hover-scale));
    transition:
      color 180ms ease,
      border-color 180ms ease,
      background-color 180ms ease,
      box-shadow 180ms ease,
      transform 220ms var(--ease-out);
  }

  .social-link:hover {
    --hover-y: -3px;
    --hover-scale: 1.04;
    color: var(--text);
    border-color: rgb(106 168 232 / 48%);
    background: rgb(98 168 238 / 14%);
    box-shadow: 0 1rem 2.75rem rgb(0 0 0 / 18%);
  }

  .social-link:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 4px;
  }

  .icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
  }

  .social-icon {
    width: 1.15rem;
    height: 1.15rem;
  }

  .brand-icon {
    fill: currentColor;
  }

  .line-icon {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.85;
  }
}

@layer motion {
  .reveal {
    opacity: 0;
    transform: translateY(0.65rem);
    animation: reveal-up 760ms var(--ease-out) both;
  }

  .name {
    animation-delay: 120ms;
  }

  .claim {
    clip-path: inset(0 100% 0 0);
    animation:
      reveal-up 760ms var(--ease-out) 210ms both,
      line-reveal 980ms var(--ease-out) 210ms both;
  }

  .socials {
    animation-delay: 360ms;
  }

  @keyframes reveal-up {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes line-reveal {
    to {
      clip-path: inset(0 0 0 0);
    }
  }

  @keyframes portrait-in {
    from {
      opacity: 0;
      transform: translateY(0.75rem) scale(0.92);
    }
  }

}

@layer utilities {
  @media (max-width: 80rem) {
    .site-shell {
      align-content: start;
      align-items: start;
      justify-items: center;
      padding: 2rem;
      text-align: center;
    }

    .profile {
      max-width: 24rem;
      margin-inline: auto;
    }

    .portrait,
    .claim {
      margin-inline: auto;
    }

    .name {
      max-width: 9ch;
      margin-inline: auto;
    }

    .claim {
      max-width: 12rem;
      font-size: clamp(1rem, 4vw, 1.2rem);
    }

    .socials {
      justify-content: center;
      gap: 0.55rem;
      margin-top: 1.35rem;
    }

    .social-link {
      width: 2.4rem;
      height: 2.4rem;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 1ms !important;
      animation-iteration-count: 1 !important;
      scroll-behavior: auto !important;
      transition-duration: 1ms !important;
    }

    .profile,
    .social-link {
      transform: none;
    }
  }

  @media (hover: none), (pointer: coarse) {
    .profile,
    .social-link {
      transform: none;
    }
  }
}
