@font-face {
  font-family: Kodchasan;
  src: url("assets/kodchasan-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --paper: #000;
  --red: #ff485a;
  --blue: #4d7eff;
  --pink: #e448d4;
  --green: #53ac45;
  --orange: #ffa438;
  --stage-width: 1800px;
  --menu-top: 70px;
  --menu-inset: 70px;
  --footer-inset: 100px;
  --float: cubic-bezier(.44, 0, .56, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: #fff; }
body { font-family: Kodchasan, sans-serif; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; }
:focus-visible { outline: 2px solid #fff; outline-offset: 5px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  html:not(.gallery-open):has(body:is([data-page="home"], [data-page="uiux"], [data-page="web"])) {
    scroll-behavior: smooth;
  }
}

.palette-uiux { --accent: var(--red); }
.palette-web { --accent: var(--blue); }
.palette-logo { --accent: var(--pink); }
.palette-skills { --accent: var(--green); }
.palette-about { --accent: var(--orange); }

.navigation {
  position: fixed;
  z-index: 10;
  top: var(--menu-top);
  width: min(100%, var(--stage-width));
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  justify-content: flex-end;
  padding-right: var(--menu-inset);
}
.menu, .footer-links {
  --nav-transition: .76s cubic-bezier(.18, .8, .25, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
  .menu, .footer-links {
    /* Sampled from the Framer spring (stiffness 500, damping 60). */
    --nav-transition: .76s linear(0, .069 2.63%, .196 5.26%, .326 7.89%,
      .443 10.53%, .585 14.47%, .692 18.42%, .813 25%, .897 32.89%,
      .954 43.42%, .981 55.26%, .994 71.05%, .998 85.53%, 1);
  }
}
.menu {
  position: relative;
  width: 90px;
  height: 90px;
  max-height: 75vh;
  border-radius: 100px;
  overflow: hidden;
  pointer-events: auto;
  transition: width var(--nav-transition), height var(--nav-transition),
    border-radius var(--nav-transition), background-color var(--nav-transition),
    backdrop-filter var(--nav-transition);
}
.menu.is-open {
  width: 232px;
  height: 448.5px;
  max-width: calc(100vw - var(--menu-inset));
  border-radius: 36px;
  background: rgba(43, 43, 43, .7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow: hidden auto;
  scrollbar-width: none;
}
.menu-toggle {
  position: absolute;
  top: 20px;
  right: 10px;
  z-index: 1;
  width: 70px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  animation: menu-appear 1s var(--float) both;
  transition: top var(--nav-transition), right var(--nav-transition);
}
.menu.is-open .menu-toggle { top: 10px; right: 20px; }
@keyframes menu-appear { from { opacity: 0; } }
.palm-swing {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 34px;
  height: 100px;
  pointer-events: none;
  translate: -50% -50%;
  transform: rotate(-10deg);
  transition: left .5s var(--float), top .5s var(--float);
}
.menu.is-open .palm-swing {
  top: 50%;
  left: 20px;
  transform: rotate(90deg);
}
.palm {
  position: relative;
  display: block;
  width: 100%;
  height: 50px;
  overflow: hidden;
  border-radius: 0 0 17px 17px;
}
.finger {
  position: absolute;
  bottom: 0;
  width: 6px;
  border-radius: 3px 3px 0 0;
  transition: height .5s var(--float);
}
.finger-red { left: 0; height: 28px; background: var(--red); }
.finger-blue { left: 7px; height: 45px; background: var(--blue); }
.finger-pink { left: 14px; height: 50px; background: var(--pink); }
.finger-green { left: 21px; height: 45px; background: var(--green); }
.finger-orange { left: 28px; height: 36px; background: var(--orange); }
.menu.is-open .finger-blue { height: 50px; }
.menu.is-open .finger-pink { height: 34px; }
.menu.is-open .finger-green { height: 29px; }
.menu.is-open .finger-orange { height: 25px; }
.menu-links, .footer-links {
  display: flex;
  flex-direction: column;
  width: max-content;
}
.menu-links {
  position: absolute;
  top: 70px;
  right: 20px;
  align-items: flex-end;
  gap: 10px;
  padding-bottom: 20px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-37px);
  transition: opacity var(--nav-transition), transform var(--nav-transition),
    visibility 0s .76s;
}
.menu.is-open .menu-links {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.menu-links a, .footer-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--accent, white);
  font-size: 20px;
  line-height: .8;
  white-space: nowrap;
  touch-action: manipulation;
}
.menu-links a { background: rgb(0 0 0 / .5); padding: 10px 20px; border-radius: 100px; }
.menu-links a:focus-visible { background: #000; }
.menu-links img, .footer-links img { width: 23px; height: 16px; object-fit: contain; }
.nav-link-hand {
  position: relative;
  flex: none;
  width: 23px;
  height: 15.58px;
  transition: width var(--nav-transition), margin-inline-end var(--nav-transition),
    opacity var(--nav-transition), translate var(--nav-transition);
}
.nav-link-hand img {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  max-width: none;
}
a:not([aria-current="page"], :focus-visible) .nav-link-hand {
  width: 0;
  margin-inline-end: -10px;
  opacity: 0;
}
/* The left-aligned footer palm slides toward the edge as it appears. */
.footer-links a:not([aria-current="page"], :focus-visible) .nav-link-hand {
  translate: 20px 0;
}
@media (hover: hover) and (pointer: fine) {
  a:hover .nav-link-hand {
    width: 23px;
    margin-inline-end: 0;
    opacity: 1;
  }
  .footer-links a:hover .nav-link-hand { translate: none; }
}
@media (prefers-reduced-motion: no-preference) {
  a:not([aria-current="page"]):focus-visible .nav-link-title {
    animation: nav-title-flip .42s var(--nav-title-ease, cubic-bezier(.22, .72, .26, 1)) both;
  }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  a:not([aria-current="page"]):hover .nav-link-title {
    animation: nav-title-flip .42s var(--nav-title-ease, cubic-bezier(.22, .72, .26, 1)) both;
  }
}
@supports (animation-timing-function: linear(0, 1)) {
  .menu-links, .footer-links {
    /* The hover variant briefly holds the word edge-on, then springs into view. */
    --nav-title-ease: linear(0, 0 4%, .04 8%, .28 16%, .55 26%,
      .85 39%, .94 54%, .988 71%, .998 94%, 1);
  }
}
@keyframes nav-title-flip {
  from { opacity: 0; transform: rotateX(90deg); }
  to { opacity: 1; transform: rotateX(0); }
}

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  min-height: 500px;
  height: 100vh;
  padding: 0 var(--footer-inset);
  overflow: hidden;
}
.site-footer::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 240px;
  z-index: 1;
  background: linear-gradient(to right, #000, transparent);
  pointer-events: none;
}
.footer-mark {
  --footer-letter-spring: cubic-bezier(.33, .02, .32, 1.16);
  position: absolute;
  right: 0;
  top: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  width: auto;
  min-width: 0;
  height: 100%;
  aspect-ratio: 220 / 740;
  gap: calc(100% * 40 / 740);
  opacity: .1;
  pointer-events: none;
}
.footer-mark img { width: 100%; height: auto; aspect-ratio: 220 / 116; }
@media (prefers-reduced-motion: no-preference) {
  /* Keep the observed boxes in place until the entrance can play. */
  .footer-links a.awaiting-entry:not(:focus-visible),
  .footer-letter.awaiting-entry img { opacity: 0; }
  .footer-letter.is-visible img {
    animation: footer-letter-enter 2s var(--footer-letter-spring);
  }
  .footer-links a.is-visible { animation: footer-link-enter 1s var(--float); }
  .footer-links a:focus-visible { animation: none; }
}
@keyframes footer-letter-enter {
  from { opacity: 0; transform: translateX(200px); }
}
@keyframes footer-link-enter {
  from { opacity: 0; transform: translateY(100px); }
}
@supports (transition-timing-function: linear(0, 1)) {
  .footer-mark {
    /* Sampled from the original letter entrance and its spring rebound. */
    --footer-letter-spring: linear(0, .007 1.4%, .019 2.2%, .078 4.6%, .108 5.5%,
      .205 8%, .312 10.5%, .465 13.9%, .536 15.5%, .697 19.7%, .828 23.9%,
      .905 27.2%, .975 31.3%, 1.01 34.7%, 1.036 38.9%, 1.046 45.5%, 1.041 50.5%,
      1.026 58%, 1.011 66.4%, 1.003 73%, .999 80.5%, 1);
  }
}
.footer-links { position: relative; z-index: 2; align-items: flex-start; gap: 5px; translate: 0 4.75px; }
.footer-links a { padding: 10px 10px 10px 0; }

@media (900px <= width < 1200px) {
  :root { --menu-inset: 40px; }
}

@media (600px <= width < 900px) {
  :root {
    --menu-top: 40px;
    --menu-inset: 20px;
    --footer-inset: 50px;
  }
}

@media (width < 600px) {
  :root {
    --menu-top: 30px;
    --menu-inset: 0px;
    --footer-inset: 20px;
    --footer-top-gap: 100px;
  }
  .site-footer {
    margin-top: var(--footer-top-gap);
    padding-top: 50px;
    padding-bottom: 100px;
  }
  .footer-mark {
    display: flex;
    justify-content: space-between;
    gap: 0;
  }
  .footer-letter {
    flex: 0 0 calc(100% * 116 / 740);
    min-height: 0;
  }
  .footer-letter img { height: 100%; object-fit: contain; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-toggle, .palm-swing, .menu, .finger, .menu-links, .nav-link-hand {
    animation: none;
    transition: none;
  }
  .menu:not(.is-open) .palm-swing { transform: none; }
}
