/* Original webfont files supplied by Xiaomi. See fonts/MiSans-License.pdf. */
@font-face {
  font-family: MiSans;
  src: url("/fonts/v1/MiSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: MiSans;
  src: url("/fonts/v1/MiSans-Heavy.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MiSans Latin";
  src: url("/fonts/v1/MiSansLatin-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "MiSans Latin";
  src: url("/fonts/v1/MiSansLatin-Heavy.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #0e0d18;
  --ink: #f9f6ef;
  --lime: #ceff36;
  font-family: MiSans, sans-serif;
  color: var(--ink);
  background: var(--background);
}

:root[lang="en"] { font-family: "MiSans Latin", sans-serif; }

* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid white; outline-offset: 5px; }
.page { width: min(100%, 1640px); margin: auto; padding: 0 clamp(16px, 2.2vw, 34px) 28px; }

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0 0;
}
.brand { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-size: 22px; font-weight: 900; line-height: .88; letter-spacing: -.06em; }
.language { display: flex; gap: 8px; }
.language button {
  color: var(--ink);
  background: #0e0d18;
  border: 1px solid #bfbcc8;
  border-radius: 99px;
  min-width: 62px;
  min-height: 40px;
  padding: 5px 14px;
  font-weight: 800;
}
.language button[aria-pressed="true"] { color: #12140a; background: var(--lime); border-color: var(--lime); }

.hero {
  position: relative;
  min-height: clamp(380px, 36vw, 560px);
  display: flex;
  align-items: center;
  isolation: isolate;
  overflow: clip;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0 0 0 40%;
  background: radial-gradient(circle, #6c2bb9 1px, transparent 2px) 0 0 / 8px 8px;
  mask-image: radial-gradient(ellipse at 56% 45%, black, transparent 69%);
  opacity: .65;
}
.hero-art {
  position: absolute;
  z-index: -1;
  right: -3%;
  width: 67%;
  height: 110%;
  object-fit: contain;
  mix-blend-mode: screen;
  mask-image: radial-gradient(ellipse at 54% 50%, #000 48%, transparent 76%);
}
.hero-copy { padding: 24px 0 28px; }
h1, h2, p { margin: 0; }
h1 {
  font-size: clamp(88px, 12vw, 188px);
  font-weight: 900;
  font-style: italic;
  line-height: .79;
  letter-spacing: -.093em;
  padding-right: .1em;
}
h1 span { display: block; color: var(--lime); font-size: 1.46em; }
.tagline {
  display: inline-block;
  background: var(--lime);
  color: #14150a;
  margin: 22px 0 0 6px;
  padding: 8px 20px;
  transform: skewX(-10deg) rotate(-2deg);
  font-size: clamp(17px, 2.13vw, 32px);
  font-weight: 900;
}
.tagline span { display: block; transform: skewX(10deg); }

.projects { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr); gap: 16px; }
.project {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: clamp(305px, 26vw, 398px);
  padding: clamp(16px, 2vw, 28px);
  border: 2px solid var(--accent);
  border-radius: 22px;
  overflow: hidden;
}
.atlas { --accent: #c553ff; background: radial-gradient(ellipse at 82% 100%, #6b1e9b, transparent 65%), #20102f; }
.ridgeline { --accent: #49e8d5; background: radial-gradient(ellipse at 85% 100%, #126058, transparent 90%), #092522; gap: clamp(12px, 1.6vw, 24px); }
.project-copy { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-start; justify-content: center; z-index: 1; }
.project h2 { font-weight: 900; letter-spacing: -.055em; font-style: italic; line-height: .97; }
.atlas h2 { font-size: clamp(58px, 7vw, 112px); }
.game-name { display: block; font-size: clamp(29px, 3.5vw, 54px); }
.game-subtitle { display: block; margin-top: 6px; font-size: clamp(21px, 2.35vw, 36px); }
:lang(en) .game-subtitle { display: none; }
.project h2::after { content: ""; display: block; width: 66px; height: 7px; background: var(--accent); transform: skewX(-18deg); margin: 17px 0 15px 3px; }
.project p { font-size: clamp(16px, 1.65vw, 25px); font-weight: 700; line-height: 1.35; }
:lang(en) .ridgeline p { max-width: 14ch; }
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-top: clamp(23px, 3vw, 46px);
  padding: 8px clamp(14px, 1.5vw, 24px);
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--lime);
  color: #101207;
  font-size: clamp(17px, 1.8vw, 28px);
  font-weight: 900;
  text-decoration: none;
  transition: background-color .18s, transform .18s;
}
.action:hover { background: #e4ff91; transform: translateY(-3px); }
.action:active { transform: translateY(0); }
.game-frame {
  position: relative;
  align-self: center;
  min-width: 0;
  flex: 1 1 0;
  border: 1px solid #62918b;
  border-radius: 11px;
  box-shadow: 0 12px 36px #020e0c93;
}
.game-shot { display: block; width: 100%; height: auto; border-radius: 10px; }

.cartridge {
  position: absolute;
  z-index: 0;
  right: 8%;
  bottom: 11%;
  width: 42%;
  aspect-ratio: .96;
  border: 3px solid #e399ff;
  border-radius: 18% 15% 13% 11%;
  padding: 18px 10% 18px 10%;
  transform: rotate(-14deg) skewY(-5deg);
  background: linear-gradient(135deg, #eab0ffab, #8d23d65e 27%, #290849 55%, #a94ff6 85%, #f0b7ff);
  box-shadow: inset 0 0 0 7px #d984fc75, inset 0 0 0 11px #4d1a79bb, 8px 11px 0 #2c114d, 11px 13px 0 #aa49e4, 14px 24px 34px #13091d;
}
.cartridge-label { position: absolute; inset: 19% 13% 20%; display: grid; place-content: center; justify-items: center; gap: 8px; background: linear-gradient(155deg, #381054, #1a092c); border: 1px solid #d36eff; border-radius: 9px; font-size: clamp(24px, 3.4vw, 52px); font-weight: 900; font-style: italic; }
.folder { width: clamp(30px, 4vw, 56px); height: clamp(18px, 2.4vw, 36px); background: #d287ff; border-radius: 4px; clip-path: polygon(0 0, 36% 0, 48% 17%, 100% 17%, 100% 100%, 0 100%); }
.contacts { position: absolute; bottom: 3%; left: 20%; width: 62%; height: 7%; border: 2px solid #2e133f; background: repeating-linear-gradient(90deg, #f9d98b 0 7%, #3b194e 7% 10%); }
.contacts::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: repeating-linear-gradient(90deg, #fff9c6 0 7%, transparent 7% 10%);
  clip-path: inset(0 100% 0 0);
}
.sparks { position: absolute; inset: 0; pointer-events: none; }
.sparks i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 5px;
  height: 5px;
  background: #e9adff;
  box-shadow: 0 0 8px #cd59ff;
  opacity: 0;
}
.sparks i:nth-child(1) { --x: 93%; --y: 14%; --dx: 17px; --dy: -24px; --delay: 55ms; }
.sparks i:nth-child(2) { --x: 73%; --y: 3%; --dx: 4px; --dy: -24px; --delay: 120ms; }
.sparks i:nth-child(3) { --x: 100%; --y: 23%; --dx: 11px; --dy: -16px; --delay: 180ms; }
.sparks i:nth-child(4) { --x: 10%; --y: 22%; --dx: -13px; --dy: -23px; --delay: 220ms; }

@property --scan-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.game-frame::after {
  content: "";
  position: absolute;
  inset: -2px;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from var(--scan-angle), transparent 0 290deg, #49e8d530 311deg, #a7fff2 352deg, transparent 360deg);
  mask: linear-gradient(black 0 0) content-box, linear-gradient(black 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
}

.atlas:has(.action:focus-visible) .cartridge { outline: 1px solid #f0c3ff; }
.ridgeline:has(.action:focus-visible) .game-frame { border-color: #a7fff2; }
@media (hover: hover) {
  .atlas:hover .cartridge { outline: 1px solid #f0c3ff; }
  .ridgeline:hover .game-frame { border-color: #a7fff2; }
}

@media (prefers-reduced-motion: no-preference) {
  .cartridge { transition: transform 240ms ease-out; }
  .atlas:is(:has(.action:focus-visible), :hover) .cartridge {
    transform: translateY(-8px) rotate(-17deg) skewY(-5deg);
  }
  .atlas:is(:has(.action:focus-visible), :hover) .contacts::after { animation: power-on 380ms steps(10) forwards; }
  .atlas:is(:has(.action:focus-visible), :hover) .sparks i { animation: pixel-pop 390ms ease-out var(--delay); }
  .ridgeline:is(:has(.action:focus-visible), :hover) .game-frame::after { animation: scan-frame 850ms ease-out; }

  @keyframes power-on {
    to { opacity: 1; clip-path: inset(0); }
  }
  @keyframes pixel-pop {
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.5); }
  }
  @keyframes scan-frame {
    0% { --scan-angle: 0deg; opacity: 0; }
    12%, 78% { opacity: 1; }
    100% { --scan-angle: 360deg; opacity: 0; }
  }
}

@media (max-width: 1100px) {
  .projects { grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); }
  .cartridge { right: 6%; }
}
@media (max-width: 780px) {
  .masthead { padding-top: 14px; }
  .brand { font-size: 17px; }
  .brand img { width: 34px; height: 34px; }
  .hero { min-height: 0; }
  .hero-copy { padding: clamp(28px, 12vw, 78px) 0 26px; }
  h1 { font-size: clamp(57px, 13vw, 112px); }
  .hero-art { width: 82%; right: -19%; opacity: .8; }
  .projects { grid-template-columns: 1fr; gap: 12px; }
  .project { min-height: 240px; border-radius: 16px; }
  .cartridge { right: 10%; width: min(33%, 185px); }
  .ridgeline { flex-direction: column; gap: 16px; }
  .game-frame { flex: none; width: 100%; }
  .ridgeline .project-copy { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px 12px; }
  .ridgeline h2, .ridgeline p { grid-column: 1; }
  .ridgeline h2::after { display: none; }
  .ridgeline p { font-size: 15px; }
  .ridgeline .action { grid-column: 2; grid-row: 1 / 3; margin: 0; }
}
@media (max-width: 370px) {
  .game-name { font-size: 25px; }
  .ridgeline .action { padding-inline: 8px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .action { transition: none; }
  .action:hover { transform: none; }
}

.font-credit {
  color: #91889e;
  font-size: .75rem;
  text-decoration: none;
}
.font-credit:hover, .font-credit:focus-visible { text-decoration: underline; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; }
.label-link { font-size: .875rem; color: var(--ink); text-underline-offset: 4px; }
