html {
  background: #050505;
}

body {
  min-height: 100vh;
}

.hero-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.1), transparent 28rem),
    url("../assets/images/hero sequence/0001.jpg") center / cover no-repeat;
  opacity: 0.45;
}

.reveal-image-wrap {
  background: #050505;
}

.cg-img,
.about-photo,
.contact-frame-img,
#proj-cover,
.detail-selected img,
.detail-thumbs img {
  background: #111;
}

.skill-header,
.proj-item,
.award-item,
.detail-back,
a {
  cursor: pointer;
}

.skill-group:not(.open) .skill-body {
  max-height: 0;
  overflow: hidden;
}

.skill-group.open .skill-body {
  max-height: 18rem;
}

.local-asset-note {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 9999;
  max-width: 20rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(10, 10, 10, 0.82);
  color: rgba(255, 255, 255, 0.76);
  font: 12px/1.35 Inter, Arial, sans-serif;
  backdrop-filter: blur(12px);
}

@media (max-width: 768px) {
  .local-asset-note {
    display: none;
  }
}

.hero-tagline { max-width: min(38rem, calc(100vw - 3rem)); }
.hero-tagline .other-accent { font-style: italic; }


.reveal-video {
  z-index: 1;
  background: #061d31;
}

#reveal-canvas {
  opacity: 0;
}

.reveal-frame,
.reveal-overlay,
.reveal-phrase {
  z-index: 2;
}

/* Fixed project preview */
.proj-preview {
  left: auto !important;
  top: 50% !important;
  right: clamp(4rem, 9vw, 9rem) !important;
  width: min(31vw, 460px) !important;
  height: auto !important;
  transform: translate3d(0, -50%, 0) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.32s ease, right 0.42s cubic-bezier(.2,.8,.2,1);
}

.proj-preview.visible {
  right: clamp(5rem, 10vw, 10rem) !important;
  opacity: 1;
}

.proj-card {
  width: 100% !important;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.42s cubic-bezier(.2,.8,.2,1);
}

.proj-preview.visible .proj-card {
  transform: translateY(0) scale(1);
}

.proj-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.cg-phrase {
  max-width: min(70vw, 900px);
  text-align: center;
}

/* Optimized gallery roll images */
.cg-img {
  background: #06192a;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

.cg-img .slice,
.cg-img img {
  background-color: #06192a;
  background-size: cover !important;
  background-position: center !important;
}

/* Latest browser comment polish */
.about-text {
  max-width: min(58vw, 760px);
  font-size: clamp(2rem, 3.8vw, 4.65rem);
  line-height: 1.18;
  letter-spacing: 0;
}

.about-photo-wrap {
  overflow: hidden;
}

.about-photo {
  filter: blur(1.15px) saturate(0.98) contrast(1.04);
  transform: scale(1.025);
  transform-origin: center;
}

.skills-text {
  font-size: clamp(1.55rem, 2.7vw, 3.1rem);
  line-height: 1.22;
  letter-spacing: 0;
}

.skill-group.open .skill-body {
  max-height: 24rem;
}

.skill-body-inner {
  row-gap: 0.36rem;
}

.cg-img {
  background: transparent !important;
  box-shadow: none !important;
}

.cg-img img {
  background-color: transparent !important;
}

.cg-slice {
  background-color: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.contact-info-list {
  display: grid !important;
  gap: 0.65rem !important;
  font-family: Inter, Arial, sans-serif;
  color: #080808;
}

.contact-info-item {
  display: grid;
  gap: 0.1rem;
  line-height: 1.05;
}

.contact-info-label {
  font-size: clamp(0.86rem, 1vw, 1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.55;
  text-transform: uppercase;
}

.contact-info-value {
  font-size: clamp(1.05rem, 1.35vw, 1.35rem);
  font-weight: 700;
}

.footer-top-col .chr-hover .ch-bot,
.contact-socials .chr-hover .ch-bot {
  display: none !important;
}

.footer-top-col .chr-hover:hover .ch-top,
.contact-socials .chr-hover:hover .ch-top {
  transform: none !important;
}

.footer-mail {
  white-space: nowrap;
}
/* July 8 browser comment polish */
.internship-list {
  gap: 0;
}

.internship-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(11rem, 0.8fr);
  align-items: center;
  min-height: clamp(6rem, 10vh, 8rem);
  padding: 1.8rem 1.45rem !important;
  color: rgba(255, 255, 255, 0.42);
}

.internship-item > div {
  flex: none !important;
  width: auto;
}

.internship-item .award-prize {
  text-align: center;
}

.internship-item .award-date {
  text-align: right;
  white-space: nowrap;
}

.internship-item:nth-child(-n+2)::before {
  clip-path: inset(0 0 0 0) !important;
}

.internship-item:nth-child(-n+2) {
  color: #0a0a0a;
}

.internship-item:nth-child(3)::before {
  background-color: #ffffff !important;
}

.internship-item:nth-child(3).active-award::before,
.internship-item:nth-child(3):hover::before {
  clip-path: inset(0 0 0 0) !important;
}

.internship-item:nth-child(3).active-award,
.internship-item:nth-child(3):hover {
  color: #0a0a0a;
}

#contact-dispo-2 {
  width: 14.5%;
}

#contact-dispo-2 p {
  text-align: left;
  line-height: 1.16;
  word-break: keep-all;
}

.footer-top-col .chr-hover {
  font-size: 0 !important;
}

.footer-top-col .chr-hover .ch-wrap {
  font-size: clamp(1rem, 1.35vw, 1.18rem) !important;
}

.footer-top-col .footer-mail .ch-wrap {
  font-size: clamp(0.9rem, 1.25vw, 1.08rem) !important;
}

.footer-top-col .chr-hover .ch-bot {
  display: none !important;
}

.footer-top-col .chr-hover:hover .ch-top {
  transform: none !important;
}

@media (max-width: 768px) {
  .internship-item {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    min-height: auto;
  }

  .internship-item .award-prize,
  .internship-item .award-date {
    text-align: left;
  }

  .internship-item .award-date {
    display: block !important;
  }

  #contact-dispo-2 {
    width: 85%;
  }
}

/* React Bits galaxy homepage background */
.react-bits-galaxy-mode {
  background: #050505 !important;
}

.galaxy-home-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(42, 78, 150, 0.22), transparent 34rem),
    radial-gradient(circle at 50% 50%, rgba(240, 188, 43, 0.1), transparent 22rem),
    #050505;
}

.galaxy-home-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.88;
}

.react-bits-galaxy-mode .hero-canvas {
  z-index: 1;
}

.react-bits-galaxy-mode .hero-canvas::before {
  opacity: 0.34;
}

.react-bits-galaxy-mode .hero-content {
  z-index: 2;
}

.react-bits-galaxy-mode .hero-tagline,
.react-bits-galaxy-mode .hero-line,
.react-bits-galaxy-mode .hero-bar {
  display: initial;
}

.react-bits-galaxy-mode .hero-bar,
.react-bits-galaxy-mode .hero-line,
.react-bits-galaxy-mode .hero-tagline {
  display: block;
}

.react-bits-galaxy-mode .hero-bar-center,
.react-bits-galaxy-mode .hero-bar-right {
  display: flex;
}

.react-bits-galaxy-mode .reveal-image-wrap {
  display: block !important;
  z-index: 1;
  pointer-events: none;
  opacity: 0.82;
}
/* Typography and motion polish */
@font-face {
  font-family: 'AlimamaShuHeiTi';
  src: url('../assets/fonts/AlimamaShuHeiTi.otf') format('opentype');
  font-weight: 400 900;
  font-display: swap;
}

.hero-title,
.about-text,
.skills-text,
.skill-header-title,
.awards-title,
.contact-title,
.footer-name,
.detail-title {
  font-family: 'AlimamaShuHeiTi', 'Microsoft YaHei', 'PingFang SC', sans-serif !important;
  letter-spacing: 0 !important;
}

.react-bits-galaxy-mode .hero-canvas::before {
  display: none !important;
}

.react-bits-galaxy-mode .reveal-image-wrap {
  display: none !important;
}

.about {
  background: #050505;
}

.about-text {
  max-width: min(54vw, 760px);
  font-size: clamp(2.4rem, 4.3vw, 5.15rem);
  line-height: 1.12;
  font-weight: 700;
}

.about-sub {
  max-width: min(28rem, 34vw);
  font-size: clamp(1.05rem, 1.6vw, 1.45rem);
  line-height: 1.52;
  letter-spacing: 0;
  text-align: left;
}

.about-photo-wrap {
  overflow: hidden;
  -webkit-mask-image: radial-gradient(115% 110% at 50% 50%, #000 62%, rgba(0,0,0,0.72) 74%, transparent 100%);
  mask-image: radial-gradient(115% 110% at 50% 50%, #000 62%, rgba(0,0,0,0.72) 74%, transparent 100%);
}

.about-photo-wrap::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(5,5,5,0.36), transparent 18%, transparent 82%, rgba(5,5,5,0.24));
  mix-blend-mode: multiply;
}

.about-photo {
  filter: blur(1.2px) saturate(0.96) contrast(1.04);
  transform: scale(1.035);
}

.internship-item::before {
  clip-path: inset(0 0 100% 0) !important;
}

.internship-item {
  color: rgba(255, 255, 255, 0.42);
}

.internship-item:nth-child(2)::before,
.internship-item:nth-child(3)::before,
.internship-item:nth-child(2).active-award::before,
.internship-item:nth-child(3).active-award::before,
.internship-item:nth-child(2):hover::before,
.internship-item:nth-child(3):hover::before {
  clip-path: inset(0 0 0 0) !important;
  background-color: #ffffff !important;
}

.internship-item:nth-child(2),
.internship-item:nth-child(3),
.internship-item:nth-child(2).active-award,
.internship-item:nth-child(3).active-award,
.internship-item:nth-child(2):hover,
.internship-item:nth-child(3):hover {
  color: #0a0a0a;
}

.internship-item:nth-child(1)::before,
.internship-item:nth-child(1).active-award::before,
.internship-item:nth-child(1):hover::before {
  clip-path: inset(0 0 100% 0) !important;
}

.internship-item:nth-child(1),
.internship-item:nth-child(1).active-award,
.internship-item:nth-child(1):hover {
  color: rgba(255, 255, 255, 0.42) !important;
}

@media (max-width: 768px) {
  .about-text {
    max-width: 100%;
    font-size: clamp(2rem, 10vw, 3.4rem);
  }

  .about-sub {
    max-width: 88vw;
    font-size: 1rem;
  }
}
/* Alimama broad title pass */
.proj-item,
.cg-phrase,
.hero-tagline,
.award-item,
.contact-dispo p,
.footer-top-col .ch-top {
  font-family: 'AlimamaShuHeiTi', 'Microsoft YaHei', 'PingFang SC', sans-serif !important;
  letter-spacing: 0 !important;
}
/* July 9 galaxy visibility and hero nav fix */
.react-bits-galaxy-mode {
  background: #000 !important;
}

.react-bits-galaxy-mode .galaxy-home-background {
  z-index: 1 !important;
  background: #000 !important;
  opacity: 1 !important;
}

.react-bits-galaxy-mode .galaxy-home-canvas {
  opacity: 1 !important;
  filter: saturate(1.35) contrast(1.08);
}

.react-bits-galaxy-mode .hero-canvas {
  z-index: 0 !important;
  background: transparent !important;
}

.react-bits-galaxy-mode .hero-canvas::before {
  display: none !important;
}

.react-bits-galaxy-mode .hero-content {
  z-index: 3 !important;
}

.react-bits-galaxy-mode .hero-bar {
  display: flex !important;
  align-items: flex-end;
}

.react-bits-galaxy-mode .hero-bar-left {
  display: flex !important;
  position: static !important;
  flex: 0 0 auto;
}

.react-bits-galaxy-mode .hero-bar-center {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: flex !important;
}

.react-bits-galaxy-mode .hero-bar-right {
  margin-left: auto !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: clamp(1.5rem, 3vw, 2.6rem) !important;
  position: static !important;
}

.react-bits-galaxy-mode .hero-bar-right .chr-hover .ch-top,
.react-bits-galaxy-mode .hero-bar-right .chr-hover .ch-bot,
.react-bits-galaxy-mode .hero-bar-center .chr-hover .ch-top,
.react-bits-galaxy-mode .hero-bar-center .chr-hover .ch-bot {
  font-size: clamp(1.02rem, 1.55vw, 1.35rem);
}

@media (max-width: 768px) {
  .react-bits-galaxy-mode .hero-bar-center {
    display: none !important;
  }

  .react-bits-galaxy-mode .hero-bar-right {
    display: flex !important;
  }
}

/* React Bits Galaxy shader background */
.react-bits-galaxy-shader {
  background: #06040b !important;
}

.react-bits-galaxy-shader .galaxy-home-background {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  background:
    radial-gradient(circle at 54% 42%, rgba(38, 34, 54, 0.42), transparent 38rem),
    #06040b !important;
  opacity: 1 !important;
}

.react-bits-galaxy-shader .galaxy-home-canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  opacity: 1 !important;
}

.react-bits-galaxy-shader .galaxy-static-fallback {
  background:
    radial-gradient(circle at 54% 42%, rgba(80, 75, 120, 0.32), transparent 36rem),
    radial-gradient(circle at 24% 32%, rgba(255, 255, 255, 0.16) 0 1px, transparent 2px),
    #06040b !important;
}

.react-bits-galaxy-shader .hero-canvas {
  z-index: 0 !important;
  background: transparent !important;
}

.react-bits-galaxy-shader .hero-canvas::before,
.react-bits-galaxy-shader .reveal-image-wrap {
  display: none !important;
}

.react-bits-galaxy-shader .hero-content {
  position: relative !important;
  z-index: 3 !important;
}
/* Scroll scrub reveal video and footer cleanup */
.react-bits-galaxy-shader .reveal-image-wrap,
.react-bits-galaxy-mode .reveal-image-wrap {
  display: flex !important;
}

#reveal-video {
  object-fit: cover;
}

.footer-ascii.left {
  display: none !important;
}
/* Performance pass */
.galaxy-home-canvas,
#reveal-video,
#reveal-canvas,
.reveal-image-wrap,
.proj-preview,
.contact-frame-img {
  backface-visibility: hidden;
  transform: translateZ(0);
}

@media (prefers-reduced-motion: reduce) {
  .galaxy-home-background {
    display: none !important;
  }
}
/* Keep long Chinese project titles and the gallery inside the viewport. */
.detail-title-wrap { max-width: calc(45vw - 8rem); flex-wrap: wrap; }
.detail-title { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 768px) {
  .detail-title-wrap { max-width: 100%; gap: .5rem; }
  .detail-title { font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.3; }
  .detail-info { padding-bottom: 1rem; }
  .detail-desc { margin-top: 1rem; }
  .detail-tags { margin-top: .75rem; }
  .detail-gallery-wrap, .detail-thumbs { height: 50svh; }
  .detail-thumbs-inner { padding: 25svh 0; }
  .detail-selected { padding: 1rem; min-width: 0; }
  .detail-selected img { max-height: 45svh; }
}
