/* =========================================================
   spoon's home — pixel night sky theme
   ========================================================= */

:root {
  --night-900: #140b2e;
  --night-800: #18103a;
  --night-700: #1b1035;
  --night-600: #2a1a56;
  --line: #33206b;
  --slime: #7cf03d;
  --coin: #ffc93c;
  --star: #ede8ff;
  --dim: #a99fd0;
  --shadow: rgba(6, 3, 18, 0.55);

  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --font-body: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;

  --wrap: 1080px;
  --gutter: clamp(1.1rem, 4vw, 2rem);
  --nav-h: 62px;
  --step: 8px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--night-900);
  color: var(--star);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--coin);
}

:focus-visible {
  outline: 3px solid var(--coin);
  outline-offset: 3px;
}

::selection {
  background: var(--slime);
  color: var(--night-900);
}

.container {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.en {
  font-family: var(--font-pixel);
}

/* ---------- night sky ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1px 1px at 12% 24%, var(--star) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 14%, var(--star) 50%, transparent 51%),
    radial-gradient(2px 2px at 42% 68%, var(--slime) 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 58%, var(--coin) 50%, transparent 51%),
    radial-gradient(1px 1px at 26% 86%, var(--star) 50%, transparent 51%),
    radial-gradient(1px 1px at 62% 36%, var(--star) 50%, transparent 51%),
    var(--night-900);
}

.sky__star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--star);
  animation: twinkle 3.4s steps(2, end) infinite;
}

.sky__star--big {
  width: 6px;
  height: 6px;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.9; }
}

.sky__meteor {
  position: absolute;
  top: 14%;
  left: -140px;
  width: 120px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--coin));
  transform: rotate(18deg);
  animation: meteor 1.1s ease-in forwards;
}

@keyframes meteor {
  from { translate: 0 0; opacity: 1; }
  to { translate: 105vw 34vh; opacity: 0; }
}

/* ---------- pixel frame ---------- */

.px-box {
  position: relative;
  background: var(--night-700);
  border: 2px solid var(--line);
  box-shadow: 6px 6px 0 var(--shadow);
}

.px-box::after {
  content: "";
  position: absolute;
  inset: -2px;
  background:
    linear-gradient(var(--slime), var(--slime)) top left / 6px 6px no-repeat,
    linear-gradient(var(--slime), var(--slime)) bottom right / 6px 6px no-repeat;
  pointer-events: none;
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--night-800);
  border-bottom: 2px solid var(--line);
}

.nav__inner {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: 14px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__logo {
  font-family: var(--font-pixel);
  font-size: 0.82rem;
  color: var(--slime);
  text-decoration: none;
}

.nav__logo span {
  color: var(--star);
}

.nav__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: 2px solid var(--line);
  cursor: pointer;
}

.nav__burger span {
  width: 22px;
  height: 3px;
  background: var(--slime);
}

.nav__menu {
  display: flex;
  gap: clamp(0.9rem, 3vw, 2rem);
}

.nav__menu a {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  color: var(--star);
  text-decoration: none;
  font-size: 0.95rem;
  padding-bottom: 4px;
  border-bottom: 3px solid transparent;
}

.nav__menu a .en {
  font-size: 0.44rem;
  color: var(--dim);
}

.nav__menu a:hover,
.nav__menu a.is-active {
  color: var(--slime);
  border-bottom-color: var(--slime);
}

/* ---------- hero ---------- */

.hero {
  padding-top: clamp(2.4rem, 7vw, 4.5rem);
}

.hero__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1.6rem, 5vw, 3.4rem);
}

.hero__avatar {
  padding: 10px;
  flex: 0 0 auto;
}

.avatar-btn {
  display: block;
  padding: 0;
  border: 0;
  background: var(--night-600);
  cursor: pointer;
  line-height: 0;
}

.avatar-btn picture {
  display: block;
  line-height: 0;
}

.avatar-btn img {
  width: clamp(132px, 34vw, 188px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  image-rendering: auto;
}

.avatar-btn.is-pixel img {
  image-rendering: pixelated;
  filter: saturate(1.5) contrast(1.25) hue-rotate(12deg);
}

.hero__player {
  display: block;
  margin-top: 10px;
  font-family: var(--font-pixel);
  font-size: 0.46rem;
  line-height: 1.6;
  text-align: center;
  color: var(--coin);
}

.hero__body {
  flex: 1 1 340px;
  min-width: 0;
}

.hero__title {
  margin: 0 0 1.1rem;
  font-family: var(--font-pixel);
  font-size: clamp(1.45rem, 5.2vw, 2.7rem);
  line-height: 1.5;
  font-weight: 400;
  color: var(--star);
  text-shadow: 4px 4px 0 var(--shadow);
}

.hero__title span[data-split] {
  display: block;
}

.hero__title .ltr {
  display: inline-block;
  white-space: pre;
}

.js .hero__title .ltr {
  opacity: 0;
  transform: translateY(6px);
  animation: ltr-in 0.14s steps(3, end) forwards;
  animation-delay: calc(var(--i) * 55ms);
}

@keyframes ltr-in {
  to { opacity: 1; transform: translateY(0); }
}

.hero__lede {
  margin: 0 0 1.7rem;
  max-width: 46ch;
  color: var(--dim);
  font-size: clamp(0.95rem, 2.4vw, 1.06rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding: 0.72em 1.5em;
  border: 2px solid var(--night-900);
  box-shadow: 5px 5px 0 var(--shadow);
  transition: translate 0.06s steps(2, end), box-shadow 0.06s steps(2, end);
}

.btn--primary {
  background: var(--slime);
  color: var(--night-900);
}

.btn--ghost {
  background: var(--night-700);
  color: var(--star);
  border-color: var(--line);
}

.btn:active {
  translate: 4px 4px;
  box-shadow: 1px 1px 0 var(--shadow);
}

.hero__strip {
  list-style: none;
  margin: clamp(2.2rem, 6vw, 3.6rem) 0 0;
  padding-inline: max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter)));
  display: flex;
  gap: 0;
  overflow-x: auto;
  background: var(--night-800);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  scrollbar-width: thin;
}

.hero__strip li {
  flex: 0 0 auto;
  padding: 12px 18px;
  font-size: 0.9rem;
  color: var(--star);
  white-space: nowrap;
}

.hero__strip li:first-child {
  padding-left: 0;
}

.hero__strip li + li {
  border-left: 2px solid var(--line);
}

.hero__strip .en {
  display: block;
  font-size: 0.44rem;
  color: var(--coin);
  margin-bottom: 4px;
}

/* ---------- sections ---------- */

.section {
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}

.section--alt {
  background: var(--night-800);
  border-top: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
}

.sec__title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4em 1em;
  margin: 0 0 clamp(1.6rem, 4vw, 2.6rem);
}

.sec__en {
  font-family: var(--font-pixel);
  font-size: clamp(1.15rem, 3.6vw, 1.85rem);
  font-weight: 400;
  color: var(--slime);
  text-shadow: 3px 3px 0 var(--shadow);
}

.sec__zh {
  font-size: clamp(0.92rem, 2.4vw, 1.05rem);
  font-weight: 400;
  letter-spacing: 0.35em;
  color: var(--dim);
}

/* ---------- about ---------- */

.about {
  display: grid;
  gap: clamp(1.6rem, 4vw, 2.6rem);
}

@media (min-width: 860px) {
  .about {
    grid-template-columns: 1.2fr 1fr;
    align-items: start;
  }
}

.about__prose p {
  margin: 0 0 1.2rem;
  max-width: 42ch;
  color: var(--star);
}

.about__prose p:last-child {
  margin-bottom: 0;
}

.now {
  padding: clamp(1.2rem, 3vw, 1.8rem);
}

.now__hd {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--coin);
}

.now__hd .en {
  display: block;
  font-size: 0.5rem;
  color: var(--dim);
  margin-bottom: 6px;
}

.now ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.now li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
  color: var(--star);
}

.now li:last-child {
  margin-bottom: 0;
}

.now li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 10px;
  height: 10px;
  background: var(--slime);
}

/* ---------- skills ---------- */

.bars {
  display: grid;
  gap: clamp(1.3rem, 3.5vw, 2rem);
  max-width: 640px;
}

.bar__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.bar__name {
  font-family: var(--font-pixel);
  font-size: clamp(0.56rem, 2.2vw, 0.72rem);
  color: var(--star);
}

.bar__pct {
  font-family: var(--font-pixel);
  font-size: clamp(0.5rem, 2vw, 0.62rem);
  color: var(--coin);
}

.bar__track {
  position: relative;
  height: 22px;
  background: var(--night-900);
  border: 2px solid var(--line);
}

.section--alt .bar__track {
  background: var(--night-700);
}

.bar__fill {
  position: absolute;
  inset: 0;
  width: var(--level);
  background: repeating-linear-gradient(
    90deg,
    var(--slime) 0 14px,
    transparent 14px 18px
  );
  transition: width 0.9s steps(20, end);
}

.js .bar__fill {
  width: 0;
}

.js .bar__fill.is-on {
  width: var(--level);
}

.toolkit {
  margin: clamp(1.8rem, 4vw, 2.4rem) 0 0;
  font-size: 0.92rem;
  color: var(--dim);
}

.toolkit .en {
  font-size: 0.5rem;
  color: var(--coin);
  margin-right: 1em;
}

/* ---------- collection ---------- */

.grid {
  display: grid;
  gap: clamp(1.2rem, 3vw, 1.7rem);
  grid-template-columns: 1fr;
}

@media (min-width: 620px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 980px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

.card {
  padding: clamp(1.2rem, 3vw, 1.6rem);
  transition: translate 0.1s steps(2, end), box-shadow 0.1s steps(2, end);
}

.card:hover {
  translate: -3px -3px;
  box-shadow: 9px 9px 0 var(--shadow);
}

.card__en {
  margin: 0 0 0.7rem;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  line-height: 1.7;
  color: var(--coin);
}

.card__zh {
  margin: 0 0 0.7rem;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--slime);
}

.card__text {
  margin: 0;
  font-size: 0.93rem;
  color: var(--dim);
}

/* ---------- works ---------- */

.work {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  padding: clamp(1.4rem, 4vw, 2.2rem);
}

.work__body {
  flex: 1 1 320px;
  min-width: 0;
}

.work__title {
  margin: 0 0 0.7rem;
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  font-weight: 700;
  color: var(--star);
}

.work .btn {
  flex: 0 0 auto;
}

/* ---------- quote ---------- */

.quote {
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}

.quote__box {
  padding: clamp(1.8rem, 6vw, 3.4rem) clamp(1.2rem, 5vw, 3rem);
  text-align: center;
}

.quote__en {
  margin: 0 0 1.2rem;
  font-family: var(--font-pixel);
  font-size: 0.5rem;
  color: var(--coin);
}

.quote__box blockquote {
  margin: 0;
  font-size: clamp(1.1rem, 3.4vw, 1.55rem);
  font-weight: 700;
  line-height: 2;
  color: var(--star);
}

/* ---------- footer ---------- */

.footer {
  border-top: 2px solid var(--line);
  background: var(--night-800);
  padding: clamp(1.8rem, 5vw, 2.6rem) 0;
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.footer__inner p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--dim);
}

.footer__logo {
  font-family: var(--font-pixel);
  font-size: 0.6rem !important;
  color: var(--slime) !important;
}

.footer__top {
  font-size: 0.85rem;
  color: var(--coin);
  text-decoration: none;
  border-bottom: 2px solid var(--coin);
  padding-bottom: 2px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  translate: -50% 140%;
  z-index: 90;
  padding: 12px 18px;
  background: var(--coin);
  color: var(--night-900);
  font-weight: 700;
  font-size: 0.88rem;
  border: 2px solid var(--night-900);
  box-shadow: 5px 5px 0 var(--shadow);
  opacity: 0;
  transition: translate 0.28s steps(6, end), opacity 0.28s steps(6, end);
  pointer-events: none;
}

.toast.is-on {
  translate: -50% 0;
  opacity: 1;
}

/* ---------- mobile nav ---------- */

@media (max-width: 760px) {
  .nav__inner {
    flex-wrap: wrap;
    position: relative;
  }

  .nav__menu {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
  }

  .js .nav__burger {
    display: flex;
  }

  .js .nav__menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--night-800);
    border-bottom: 2px solid var(--line);
    padding: 6px var(--gutter) 14px;
    display: none;
  }

  .js .nav__menu.is-open {
    display: flex;
  }

  .nav__menu a {
    padding: 13px 0;
    border-bottom: 2px solid var(--line);
    justify-content: space-between;
  }

  .nav__menu a:last-child {
    border-bottom: 0;
  }

  .nav__inner {
    position: relative;
  }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }

  .js .hero__title .ltr {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .sky__star { opacity: 0.6; animation: none; }
  .sky__meteor { display: none; }
}
