@font-face {
  font-family: "Carlito";
  src: url("assets/fonts/carlito-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/manrope-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/manrope-medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/manrope-semibold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --paper: #e0d5c7;
  --ink: #11100e;
  --muted-ink: #3f3a35;
  --vermilion: #a52c16;
  --amber: #efab43;
  --focus: #2169e8;
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --art-width: min(54vw, 96svh);
  --page-edge: clamp(32px, 4vw, 78px);
  --content-gap: clamp(28px, 2.8vw, 54px);
  --content-left: calc(var(--art-width) + var(--content-gap));
  --support-column: clamp(150px, 15vw, 230px);
  --support-gap: clamp(24px, 3.5vw, 58px);

  --r-lamp-sculpture-x: 0%; --r-lamp-sculpture-y: 0%; --r-lamp-sculpture-w: 60%; --r-lamp-sculpture-h: 100%;
  --r-paper-ground-x: 0%; --r-paper-ground-y: 0%; --r-paper-ground-w: 100%; --r-paper-ground-h: 100%;
  --r-mascot-still-x: 47.8%; --r-mascot-still-y: 51.5%; --r-mascot-still-w: 8.6%; --r-mascot-still-h: 22%;
  --r-language-toggle-x: 88.4%; --r-language-toggle-y: 4.3%; --r-language-toggle-w: 8.2%; --r-language-toggle-h: 3.4%;
  --r-identity-name-x: 58.3%; --r-identity-name-y: 15.8%; --r-identity-name-w: 34.5%; --r-identity-name-h: 8.7%;
  --r-identity-intro-x: 58.3%; --r-identity-intro-y: 27.7%; --r-identity-intro-w: 29.8%; --r-identity-intro-h: 9.8%;
  --r-now-heading-x: 58.3%; --r-now-heading-y: 45.6%; --r-now-heading-w: 7.4%; --r-now-heading-h: 3.4%;
  --r-now-copy-x: 58.3%; --r-now-copy-y: 50.8%; --r-now-copy-w: 31.6%; --r-now-copy-h: 9.8%;
  --r-interests-heading-x: 58.3%; --r-interests-heading-y: 71.6%; --r-interests-heading-w: 9%; --r-interests-heading-h: 2.5%;
  --r-interests-copy-x: 58.3%; --r-interests-copy-y: 75.8%; --r-interests-copy-w: 15.5%; --r-interests-copy-h: 8.6%;
  --r-dispatches-heading-x: 74.7%; --r-dispatches-heading-y: 71.6%; --r-dispatches-heading-w: 10.8%; --r-dispatches-heading-h: 2.5%;
  --r-dispatches-copy-x: 74.7%; --r-dispatches-copy-y: 75.8%; --r-dispatches-copy-w: 13%; --r-dispatches-copy-h: 5.8%;
  --r-github-link-x: 85.6%; --r-github-link-y: 88.4%; --r-github-link-w: 11%; --r-github-link-h: 5.5%;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(244, 236, 222, .45), rgba(244, 236, 222, .45)),
    url("assets/images/paper-ground.png");
  background-size: auto, 620px 620px;
  background-repeat: repeat;
}

::selection { color: #fff8eb; background: var(--vermilion); }

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

button, a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  color: white;
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 180ms var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

.comp-frame {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
}

.paper-ground {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(244, 236, 222, .45), rgba(244, 236, 222, .45)),
    url("assets/images/paper-ground.png");
  background-size: auto, 620px 620px;
  background-repeat: repeat;
}

.lamp {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--art-width);
  height: 100%;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

.lamp::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 190, 79, .08);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 800ms var(--ease-out);
}

.lamp img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 50%;
  filter: brightness(1.06) saturate(.96);
}

.mascot {
  position: relative;
  width: clamp(60px, 5.4vw, 94px);
  aspect-ratio: 1218 / 1292;
  height: auto;
  flex: none;
  z-index: 4;
  margin: 0 0 0 clamp(10px, 1.2vw, 20px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.mascot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: none;
  transform: none;
  transform-origin: 50% 70%;
}

.mascot-hint {
  position: absolute;
  left: 50%;
  top: 92%;
  color: #5c321d;
  font-size: clamp(8px, .66vw, 11px);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 7px);
  transition: opacity 220ms ease, transform 220ms var(--ease-out);
}

.mascot:hover .mascot-hint,
.mascot:focus-visible .mascot-hint { opacity: .72; transform: translate(-50%, 0); }

.language {
  position: absolute;
  left: auto;
  right: var(--page-edge);
  top: clamp(24px, 4.3svh, 48px);
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .62em;
  font-size: clamp(17px, 1.33vw, 21px);
  white-space: nowrap;
}

.language button {
  padding: .3em 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.language button[aria-pressed="true"] { color: var(--vermilion); }

.identity-heading,
.identity p,
.now h2,
.now p,
.interests h2,
.interests p,
.dispatches h2,
.dispatches p,
.github {
  position: absolute;
  margin: 0;
}

.identity-heading {
  left: var(--content-left);
  right: var(--page-edge);
  top: clamp(84px, 14.5svh, 156px);
  display: flex;
  align-items: center;
  width: auto;
  min-width: 0;
}

.r-identity-name {
  margin: 0;
  font-family: "Carlito", sans-serif;
  font-size: clamp(54px, 5.25vw, 96px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.03em;
  white-space: nowrap;
}

.r-identity-intro {
  left: var(--content-left);
  top: 28.8%;
  width: min(32vw, 520px);
  color: var(--ink);
  font-size: clamp(17px, 1.47vw, 23px);
  font-weight: 400;
  line-height: 1.58;
  letter-spacing: -.018em;
}

.section-title {
  color: var(--vermilion);
  font-weight: 600;
  letter-spacing: -.02em;
}

.r-now-heading {
  left: var(--content-left);
  top: var(--r-now-heading-y);
  width: var(--r-now-heading-w);
  min-height: var(--r-now-heading-h);
  font-size: clamp(16px, 1.14vw, 18px);
  line-height: 1;
  transform: translateY(17px) scaleX(1.85);
  transform-origin: left bottom;
}

.r-now-copy {
  left: var(--content-left);
  top: var(--r-now-copy-y);
  width: min(32vw, 520px);
  min-height: var(--r-now-copy-h);
  font-size: clamp(16px, 1.33vw, 21px);
  line-height: 1.65;
  letter-spacing: -.018em;
  transform: translateY(5px);
}

.r-interests-heading,
.r-dispatches-heading {
  top: var(--r-interests-heading-y);
  min-height: var(--r-interests-heading-h);
  font-size: clamp(14px, 1.12vw, 18px);
  line-height: 1.2;
  transform: translateY(17px);
}

.r-interests-heading { left: var(--content-left); width: var(--support-column); }
.r-dispatches-heading { left: calc(var(--content-left) + var(--support-column) + var(--support-gap)); width: var(--support-column); }

.r-interests-copy,
.r-dispatches-copy {
  top: var(--r-interests-copy-y);
  min-height: var(--r-interests-copy-h);
  color: var(--muted-ink);
  font-size: clamp(14px, 1.12vw, 18px);
  line-height: 1.55;
  letter-spacing: -.012em;
  transform: translateY(18px);
}

.r-dispatches-copy { letter-spacing: .045em; }

.r-interests-copy { left: var(--content-left); width: var(--support-column); }
.r-dispatches-copy { left: calc(var(--content-left) + var(--support-column) + var(--support-gap)); width: var(--support-column); }

.section-rule {
  position: absolute;
  left: var(--content-left);
  right: var(--page-edge);
  top: 69.6%;
  width: auto;
  height: 1px;
  background: rgba(111, 91, 67, .28);
}

.github {
  left: auto;
  right: var(--page-edge);
  top: auto;
  bottom: clamp(26px, 4.5svh, 52px);
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: .72em;
  padding-left: 14px;
  color: var(--ink);
  font-size: clamp(18px, 1.26vw, 20px);
  text-decoration-color: transparent;
  text-underline-offset: .28em;
  transition: color 180ms ease, text-decoration-color 180ms ease;
  transform: translateY(14px);
}

.github:hover { color: var(--vermilion); text-decoration-color: currentColor; }
.github svg { width: 1.8em; height: 1.8em; fill: currentColor; flex: none; }

.noscript { position: absolute; left: 60%; bottom: 1rem; margin: 0; }

.plates-only :is(.language, .identity, .now, .interests, .dispatches, .github, .mascot-hint) { visibility: hidden; }

.comp-frame.is-awake .lamp::after { opacity: 1; }
.comp-frame.is-awake .mascot img { animation: companion-awake 950ms var(--ease-out) both; }

@keyframes companion-awake {
  0% { transform: none; filter: none; }
  38% { transform: translateY(-12px) scale(1.06) rotate(-2deg); filter: drop-shadow(0 18px 18px rgba(165, 44, 22, .22)); }
  67% { transform: translateY(3px) scale(.98) rotate(1.5deg); }
  100% { transform: none; filter: none; }
}

html[lang="zh"] .r-identity-name { letter-spacing: -.025em; }
html[lang="zh"] :is(.r-identity-intro, .r-now-copy, .r-interests-copy, .r-dispatches-copy) {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  letter-spacing: .01em;
}

@media (max-width: 1023px), (orientation: portrait) and (max-width: 1180px) {
  .comp-frame {
    height: auto;
    min-height: 100svh;
    overflow: clip;
    padding-bottom: max(84px, env(safe-area-inset-bottom));
  }

  .lamp {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: clamp(440px, 58svh, 600px);
    min-height: 0;
  }

  .lamp img { object-position: 57% 48%; }

  .language {
    position: absolute;
    z-index: 6;
    left: auto;
    right: 22px;
    top: 20px;
    width: auto;
    height: auto;
    padding: 0 4px;
    background: rgba(239, 225, 206, .78);
    box-shadow: 0 8px 24px rgba(65, 42, 19, .12);
  }

  .language button {
    display: grid;
    min-width: 44px;
    min-height: 44px;
    place-items: center;
  }

  .identity-heading,
  .identity p,
  .now h2,
  .now p,
  .interests h2,
  .interests p,
  .dispatches h2,
  .dispatches p,
  .github {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: auto;
    min-height: 0;
  }

  .identity-heading,
  .identity p,
  .now,
  .interests,
  .dispatches,
  .github { margin-left: 24px; margin-right: 24px; }

  .identity-heading {
    display: flex;
    align-items: center;
    width: auto;
    margin-top: 42px;
  }

  .mascot {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: clamp(68px, 10vw, 88px);
    height: auto;
  }

  .section-rule {
    position: relative;
    left: auto;
    top: auto;
    width: auto;
    margin: 64px 24px 0;
  }

  .r-identity-name {
    font-size: clamp(64px, 10vw, 84px);
    line-height: .9;
    white-space: normal;
  }

  .r-identity-intro {
    margin-top: 28px;
    max-width: 24em;
    font-size: 18px;
    line-height: 1.58;
  }

  .now { margin-top: 74px; }
  .r-now-heading { font-size: 25px; }
  .r-now-copy { margin-top: 19px; max-width: 26em; font-size: 17px; line-height: 1.6; }

  .interests { margin-top: 34px; }
  .dispatches { margin-top: 64px; }
  .r-interests-heading, .r-dispatches-heading { font-size: 15px; }
  .r-now-heading,
  .r-interests-heading,
  .r-dispatches-heading,
  .r-interests-copy,
  .r-dispatches-copy { transform: none; }
  .r-now-copy { transform: none; }
  .r-interests-copy, .r-dispatches-copy { margin-top: 17px; font-size: 17px; line-height: 1.6; }

  .github {
    width: max-content;
    justify-content: flex-start;
    margin-top: 72px;
    font-size: 17px;
    padding-left: 0;
    transform: none;
  }
}

@media (max-width: 480px) {
  .identity-heading {
    position: relative;
    display: block;
    min-height: clamp(118px, 39vw, 152px);
  }

  .r-identity-name {
    font-size: clamp(64px, 21vw, 84px);
  }

  .r-identity-name span { display: block; }

  .mascot {
    position: absolute;
    left: clamp(108px, 35vw, 146px);
    bottom: -2px;
    width: clamp(58px, 18vw, 70px);
    margin-left: 0;
  }
}

@media (max-width: 1023px) and (max-height: 520px) {
  .lamp { height: clamp(320px, 100svh, 440px); }
}

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