:root {
  --paper: #f3f0e9;
  --paper-deep: #e9e3d7;
  --ink: #171717;
  --muted: #666159;
  --line: rgba(23, 23, 23, .16);
  --purple: #6548ee;
  --purple-soft: #d9d0ff;
  --mint: #a8e6cf;
  --project-bg: #191919;
  --project-ink: #faf8f2;
  --project-muted: #aaa69e;
  --shadow: 0 34px 80px rgba(55, 46, 31, .16);
}

html[data-theme="dark"] {
  --paper: #151515;
  --paper-deep: #1e1d1b;
  --ink: #f4f0e8;
  --muted: #aaa49a;
  --line: rgba(244, 240, 232, .14);
  --purple: #9b87ff;
  --purple-soft: #352d59;
  --mint: #65bea1;
  --project-bg: #eee9df;
  --project-ink: #171717;
  --project-muted: #6d685f;
  --shadow: 0 34px 90px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--purple) var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  transition: color .35s ease, background-color .35s ease;
}

a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { color: white; background: var(--purple); }

.ambient {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.wash {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: .75;
  transition: background .35s ease;
}

.wash-one {
  width: min(55vw, 720px);
  height: min(55vw, 720px);
  right: -12vw;
  top: -23vw;
  background: radial-gradient(circle at center, var(--purple-soft), transparent 69%);
}

.wash-two {
  width: min(44vw, 600px);
  height: min(44vw, 600px);
  left: -18vw;
  bottom: -20vw;
  background: radial-gradient(circle at center, rgba(168, 230, 207, .45), transparent 68%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.pointer-light {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(101, 72, 238, .12), transparent 68%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .25s ease;
}

.scroll-line {
  position: fixed;
  z-index: 50;
  left: 0;
  top: 0;
  width: 0;
  height: 3px;
  background: var(--purple);
}

.topbar,
.intro,
.project,
footer {
  width: min(1240px, calc(100% - 64px));
  margin-inline: auto;
}

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.nameplate {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 25px;
}

.topbar nav > a {
  position: relative;
  color: var(--muted);
  font-size: 13px;
}

.topbar nav > a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -5px;
  height: 1px;
  background: var(--ink);
  transition: right .2s ease;
}

.topbar nav > a:hover { color: var(--ink); }
.topbar nav > a:hover::after { right: 0; }

.theme-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.theme-icon {
  position: relative;
  width: 15px;
  height: 15px;
  display: block;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.theme-icon::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 6px;
  top: -3px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform .3s ease, background .3s ease;
}

html[data-theme="dark"] .theme-icon::after { transform: translate(-6px, 3px); }

.intro {
  position: relative;
  min-height: calc(100svh - 92px);
  padding: 72px 0 105px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
  align-items: center;
  gap: 62px;
}

.intro-copy {
  position: relative;
  z-index: 2;
}

.intro h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(78px, 9vw, 132px);
  font-weight: 900;
  line-height: .98;
  letter-spacing: -.07em;
}

.identity {
  margin: 38px 0 0;
  color: var(--muted);
  font-size: clamp(17px, 1.7vw, 22px);
  letter-spacing: .01em;
}

.intro-links {
  margin-top: 42px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.primary-link {
  min-height: 52px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  color: white;
  border-radius: 999px;
  background: var(--purple);
  box-shadow: 0 14px 30px rgba(101, 72, 238, .18);
  font-size: 13px;
  font-weight: 750;
  transition: box-shadow .2s ease, filter .2s ease;
}

.primary-link:hover {
  filter: saturate(1.15);
  box-shadow: 0 18px 36px rgba(101, 72, 238, .27);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.portrait-area {
  position: relative;
  width: min(100%, 480px);
  aspect-ratio: .88;
  justify-self: end;
  perspective: 950px;
}

.portrait-backdrop {
  position: absolute;
  inset: 8% 0 0 9%;
  border: 1px solid var(--line);
  border-radius: 46% 54% 52% 48% / 40% 42% 58% 60%;
  transform: rotate(6deg);
}

.portrait-backdrop::before,
.portrait-backdrop::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  border: 1px solid var(--line);
}

.portrait-backdrop::before { inset: 7%; }
.portrait-backdrop::after { inset: 14%; }

.portrait {
  position: absolute;
  inset: 11% 6% 5% 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 43% 57% 49% 51% / 39% 43% 57% 61%;
  background: var(--paper-deep);
  box-shadow: var(--shadow);
  transform: rotate(-2deg) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .16s ease-out;
}

.portrait img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.03);
  transition: transform .35s ease;
}

.portrait:hover img { transform: scale(1.06); }

.portrait-mark {
  position: absolute;
  z-index: 3;
  color: var(--purple);
  user-select: none;
}

.mark-one { right: -2%; top: 10%; font-size: 40px; }
.mark-two { left: -8%; top: 33%; font-size: 60px; }
.mark-three { right: 5%; bottom: -2%; font-size: 28px; color: var(--muted); }

.down-link {
  position: absolute;
  left: 0;
  bottom: 28px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}

.down-link:hover {
  color: var(--ink);
  border-color: var(--ink);
  transform: translateY(4px);
}

.project {
  padding: 110px 0 130px;
}

.project-card {
  position: relative;
  min-height: 590px;
  padding: 68px;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: 72px;
  overflow: hidden;
  color: var(--project-ink);
  border-radius: 44px;
  background: var(--project-bg);
  box-shadow: var(--shadow);
}

.project-card::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  left: -230px;
  top: -230px;
  border: 1px solid rgba(155, 135, 255, .3);
  border-radius: 50%;
  box-shadow:
    0 0 0 55px rgba(155, 135, 255, .035),
    0 0 0 110px rgba(155, 135, 255, .025);
}

.project-copy {
  position: relative;
  z-index: 1;
}

.project-heading {
  min-height: 30px;
  display: flex;
  align-items: center;
}

.project-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--project-muted);
  font-size: 12px;
}

.project-status i {
  width: 8px;
  height: 8px;
  display: block;
  border-radius: 50%;
  background: #d7a850;
}

.project-status.online i {
  background: #64c6a2;
  box-shadow: 0 0 0 5px rgba(100, 198, 162, .1);
}

.project-status.offline i { background: #d86f7d; }

.project h2 {
  margin: 38px 0 24px;
  font-size: clamp(52px, 7vw, 94px);
  line-height: .98;
  letter-spacing: -.065em;
}

.project-copy > p {
  max-width: 500px;
  margin: 0 0 36px;
  color: var(--project-muted);
  font-size: 15px;
  line-height: 1.9;
}

.nutrition-widget {
  position: relative;
  z-index: 1;
  padding: 28px;
  color: var(--ink);
  border-radius: 30px;
  background: var(--paper);
  transform: rotate(1.3deg);
  box-shadow: 0 25px 65px rgba(0, 0, 0, .22);
  transition: transform .22s ease;
}

.nutrition-widget:hover { transform: rotate(0deg) translateY(-4px); }

.widget-title {
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
}

.widget-title button {
  padding: 4px 0;
  color: var(--muted);
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.food-list {
  margin-bottom: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.food-list button {
  padding: 8px 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.food-list button:hover,
.food-list button.active {
  color: white;
  border-color: var(--purple);
  background: var(--purple);
}

.macro {
  margin: 17px 0;
  display: grid;
  grid-template-columns: 50px 1fr 40px;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.macro > span { color: var(--muted); }

.macro > div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-deep);
}

.macro i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), #8c74f7);
  transition: width .45s cubic-bezier(.2, .8, .2, 1);
}

.macro b {
  color: var(--muted);
  text-align: right;
  font: 700 10px ui-monospace, monospace;
}

#food-summary {
  min-height: 20px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 11px;
}

footer {
  min-height: 150px;
  padding: 35px 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 40px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

footer strong { color: var(--ink); }
footer > div { display: flex; gap: 24px; }
footer a:hover { color: var(--ink); }

.noscript {
  position: fixed;
  z-index: 100;
  left: 20px;
  right: 20px;
  bottom: 20px;
  margin: 0;
  padding: 12px;
  color: white;
  border-radius: 12px;
  background: var(--purple);
  text-align: center;
}

.magnetic {
  --mx: 0px;
  --my: 0px;
  transform: translate(var(--mx), var(--my));
  transition: transform .15s ease-out, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

@media (max-width: 900px) {
  .intro {
    grid-template-columns: 1fr;
    padding-top: 90px;
    text-align: center;
  }

  .intro-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .portrait-area {
    width: min(460px, 90vw);
    justify-self: center;
    margin-top: 20px;
  }

  .down-link { left: 50%; transform: translateX(-50%); }
  .down-link:hover { transform: translate(-50%, 4px); }

  .project-card {
    grid-template-columns: 1fr;
    gap: 55px;
  }
}

@media (max-width: 620px) {
  .topbar,
  .intro,
  .project,
  footer {
    width: min(100% - 30px, 1240px);
  }

  .topbar { height: 74px; }
  .topbar nav { gap: 15px; }
  .topbar nav > a:first-child { display: none; }
  .nameplate { font-size: 14px; }

  .intro {
    min-height: auto;
    padding: 84px 0 105px;
    gap: 48px;
  }

  .intro h1 {
    font-size: clamp(52px, 16vw, 72px);
    line-height: 1;
  }

  .identity {
    max-width: 330px;
    margin-top: 28px;
    font-size: 16px;
  }

  .intro-links {
    margin-top: 34px;
    justify-content: center;
    gap: 18px;
  }

  .text-link { font-size: 12px; }

  .portrait-area {
    width: min(350px, 88vw);
  }

  .mark-two { left: -3%; }

  .project { padding: 72px 0 90px; }

  .project-card {
    min-height: 0;
    padding: 36px 22px 28px;
    gap: 40px;
    border-radius: 30px;
  }

  .project h2 {
    margin-top: 28px;
    font-size: clamp(44px, 14vw, 58px);
  }

  .project-copy > p {
    font-size: 14px;
  }

  .nutrition-widget {
    padding: 22px 18px;
    border-radius: 22px;
    transform: none;
  }

  footer {
    grid-template-columns: 1fr auto;
    gap: 20px;
  }

  footer > div {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

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