/* ==========================================================================
   Sections: hero, about, skills, projects, cv, contact, footer
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* Hero                                                                       */
/* -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding-top: clamp(136px, 17vw, 196px);
  padding-bottom: clamp(40px, 6vw, 96px);
  overflow: clip;
}

.hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero__inner .skeleton__line {
  margin-inline: auto;
}

/* Title and tagline sized like VitePress's home hero (VPHero). */
.hero__title {
  max-width: 14em;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: -0.4px;
  color: var(--text);
  text-wrap: balance;
  overflow-wrap: break-word;
}

@media (min-width: 640px) {
  .hero__title {
    font-size: 48px;
    line-height: 56px;
  }
}

@media (min-width: 960px) {
  .hero__title {
    font-size: 56px;
    line-height: 64px;
  }
}

.hero__title[data-pending] {
  width: min(100%, 7.5em);
  --sk-h: 0.4em;
  --sk-gap: 0.31em;
}

/* The emphasised part gets the gradient of the VitePress docs hero name. */
.hero__title em {
  font-style: normal;
  background: var(--hero-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

:root:lang(zh) .hero__title {
  letter-spacing: 0;
}

.hero__subtitle {
  max-width: 576px;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 500;
  line-height: 28px;
  color: var(--text-muted);
  text-wrap: pretty;
}

@media (min-width: 640px) {
  .hero__subtitle {
    font-size: 20px;
    line-height: 32px;
  }
}

@media (min-width: 960px) {
  .hero__subtitle {
    font-size: 24px;
    line-height: 36px;
  }
}

.hero__subtitle[data-pending] {
  width: min(100%, 26em);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.hero__stage {
  position: relative;
  margin-top: clamp(56px, 7vw, 88px);
}

.hero__pin {
  position: relative;
}

.hero__glow {
  position: absolute;
  left: 50%;
  top: -8%;
  width: min(1100px, 110%);
  height: 90%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(var(--glow-rgb), var(--glow-strength)), transparent 72%);
  filter: blur(30px);
  pointer-events: none;
}

.hero__device {
  position: relative;
  width: min(100% - 2 * var(--gutter), 1100px);
  margin-inline: auto;
}

.hero__veil {
  display: none;
}

/*
 * Scroll scene (set up by motion.js, skipped when motion is reduced).
 * The stage is several screens tall and its content stays pinned while
 * --open (0 to 1) lifts the lid and turns the screen on, then the script
 * scales the laptop until its screen fills the window and --veil fades
 * everything into the page background.
 */
.has-scene .hero {
  padding-bottom: 0;
}

.has-scene .hero__stage {
  height: 300vh;
}

.has-scene .hero__pin {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100svh;
  padding-top: calc(var(--topbar-h) + 14px);
  overflow: hidden;
}

/* Fit the laptop in the window height as well (the laptop is about 0.59 times as tall as wide). */
.has-scene .hero__device {
  width: min(100% - 2 * var(--gutter), 1100px, (100svh - var(--topbar-h) - 64px) * 1.7);
  transform-origin: var(--origin, 50% 50%);
}

.has-scene .hero__device .device__lid {
  transform-origin: 50% 100%;
  transform: perspective(450cqw) rotateX(calc((1 - var(--lid, 1)) * -88deg));
}

/* Screen switched off while the lid is closed. */
.has-scene .hero__device .device__screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #000;
  opacity: var(--screen-off, 0);
  pointer-events: none;
}

/* Blurring what is behind the dock and menu bar costs a lot once zoomed in, for no visible gain on a smooth wallpaper. */
.has-scene .hero__device .wallpaper__bar,
.has-scene .hero__device .wallpaper__dock {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.has-scene .hero__glow {
  opacity: var(--glow, 1);
}

.has-scene .hero__veil {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  background: var(--bg);
  opacity: var(--veil, 0);
  pointer-events: none;
}

/* -------------------------------------------------------------------------- */
/* Shared pieces, from VitePress's default theme                              */
/* -------------------------------------------------------------------------- */

/* VPFeature card: soft background, 12px radius, no visible border. */
.card {
  padding: 24px;
  border-radius: 12px;
  background: var(--panel);
}

.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.card__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.card__title[data-pending] {
  width: 9em;
}

/* Muted detail line under a card title (VPFeature "details"). */
.card__meta {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.card__text {
  max-width: 65ch;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
  text-wrap: pretty;
}

/* List of points in a card. */
.points {
  display: grid;
  gap: 6px;
  max-width: 65ch;
  padding-left: 1.2em;
  list-style: disc;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
}

.points li::marker {
  color: var(--text-faint);
}

/* -------------------------------------------------------------------------- */
/* About                                                                      */
/* -------------------------------------------------------------------------- */

.about__grid {
  display: grid;
  gap: 32px;
}

@media (min-width: 960px) {
  .about__grid {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
    gap: 48px;
  }
}

.about__text p {
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.7;
  color: var(--text);
  text-wrap: pretty;
}

:root:lang(zh) .about__text p {
  line-height: 1.8;
}

.about__text p[data-pending] {
  --sk-h: 0.5em;
  --sk-gap: 0.6em;
}

.about__text p + p {
  margin-top: 1em;
}

/* Emphasised words take the brand color, like links in the VitePress docs. */
.about__text em,
.contact__lead em {
  font-style: normal;
  color: var(--brand-1);
}

/* Word-by-word reveal driven by scroll (see motion.js). */
.about__text .word {
  opacity: 0.25;
  transition: opacity 500ms var(--ease-out);
}

.about__text .word.is-lit {
  opacity: 1;
}

/* Key facts: a grid of small VPFeature-style cards. */
.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.facts:empty {
  display: none;
}

.fact {
  padding: 16px;
  border-radius: 12px;
  background: var(--panel);
}

.fact dt {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.fact dd {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* Experience                                                                 */
/* -------------------------------------------------------------------------- */

.jobs {
  display: grid;
  gap: 16px;
}

.job {
  display: grid;
  gap: 12px;
}

.job__company {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.job__company a {
  color: var(--brand-1);
  transition: color 0.25s;
}

.job__company a:hover {
  color: var(--brand-2);
}

/* -------------------------------------------------------------------------- */
/* Skills                                                                     */
/* -------------------------------------------------------------------------- */

.skills__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.skill-row .tags {
  margin-top: 16px;
}

/* -------------------------------------------------------------------------- */
/* Projects                                                                   */
/* -------------------------------------------------------------------------- */

.projects__grid {
  display: grid;
  gap: 16px;
}

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

  .project--wide {
    grid-column: 1 / -1;
  }
}

.project {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Optional screenshot, shown in a small browser window. */
.project__shot {
  container-type: inline-size;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 8px;
}

/* Pinned to the bottom so cards side by side line up. */
.project__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 4px;
}

/* VPFeature "link text": brand-colored, with an arrow. */
.project__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--brand-1);
  transition: color 0.25s;
}

.project__cta:hover {
  color: var(--brand-2);
}

.project__cta svg {
  width: 14px;
  height: 14px;
}

/* -------------------------------------------------------------------------- */
/* CV: a call-to-action card, like Nuxt UI's PageCTA (soft variant)           */
/* -------------------------------------------------------------------------- */

.cv__card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 12px;
  background: var(--panel);
}

.cv__name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.cv__meta {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.cv__langs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.cv__langs-label {
  margin-right: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.cv__langs a[aria-current="true"] {
  background: var(--brand-soft);
  color: var(--brand-1);
}

.cv__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* -------------------------------------------------------------------------- */
/* Contact                                                                    */
/* -------------------------------------------------------------------------- */

.contact__lead {
  max-width: 60ch;
  margin-bottom: 32px;
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  line-height: 1.6;
  color: var(--text-muted);
  text-wrap: pretty;
}

.email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.email__link {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--brand-1);
  overflow-wrap: anywhere;
  text-underline-offset: 4px;
  transition: color 0.25s;
}

.email__link:hover {
  color: var(--brand-2);
  text-decoration: underline;
}

.email__link[data-pending] {
  width: min(100%, 9em);
  --sk-h: 0.42em;
}

/* Round alt button (VPButton alt colors). */
.email__copy {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 20px;
  background: var(--button-alt-bg);
  color: var(--text);
}

.email__copy:hover {
  background: var(--button-alt-hover);
}

.email__copy svg {
  width: 16px;
  height: 16px;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.socials:empty {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* Footer, like VitePress's VPFooter                                          */
/* -------------------------------------------------------------------------- */

/* Logo rows ("built with", "design inspired by"): pills in the VPButton alt colors. */
.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 48px;
  padding-bottom: 32px;
}

.stack:empty {
  display: none;
}

.stack__label {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.stack__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stack__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--panel);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: background-color 0.25s;
}

a.stack__item:hover {
  background: var(--button-alt-bg);
}

.stack__item img {
  width: 18px;
  height: 18px;
}

.footer {
  padding: 32px 0 max(32px, env(safe-area-inset-bottom));
  font-size: 14px;
  color: var(--text-muted);
}

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

.footer__top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.25s;
}

.footer__top:hover {
  color: var(--brand-1);
}

.footer__top svg {
  width: 14px;
  height: 14px;
}
