/* The page reads like a camera viewfinder: a thirds grid, an AF box that
   locks onto the subject, a coaching tip on top and a zoom selector at the
   bottom. That vocabulary lives in the hero and the nav; the project
   sections stay quiet and let their pictures do the talking. */

@font-face {
  font-family: "Smiley Sans";
  src: url("fonts/smiley-sans-subset.woff2?v=20261005") format("woff2");
  font-display: swap;
}

:root {
  --paper: #EDEFE9;
  --sheet: #F6F7F3;
  --ink: #1D2320;
  --ink-2: #48504B;
  --muted: #5F6762;
  --hair: #D3D8CF;
  --grid: rgba(29, 35, 32, .11);
  --af: #E39B2E;
  --coach: #2A2725;
  --coach-ink: #F5F2EE;
  --coach-red: #FF5A4C;
  --xhs: #FF2442;
  --zhihu: #1772F6;
  --display: "Smiley Sans", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans",
          "Microsoft YaHei", "Noto Sans SC", "Segoe UI", Roboto, sans-serif;
  --av: clamp(128px, 14vw, 208px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121513;
    --sheet: #181C19;
    --ink: #E9ECE6;
    --ink-2: #BAC2BB;
    --muted: #949C96;
    --hair: #2C322E;
    --grid: rgba(233, 236, 230, .08);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.7 var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px; /* room for the zoom selector */
}

img { max-width: 100%; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 16px; top: -64px; z-index: 20;
  padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: var(--paper); text-decoration: none;
}
.skip:focus { top: 16px; }

/* ---------------------------------------------------------------- hero */

.finder {
  position: relative;
  margin: 12px;
  height: calc(100svh - 24px);
  min-height: 600px;
  max-height: 1000px;
  border-radius: 28px;
  background: var(--sheet);
  overflow: hidden;
}

/* Rule-of-thirds lines */
.finder__grid::before,
.finder__grid::after {
  content: "";
  position: absolute;
  border: 0 solid var(--grid);
  pointer-events: none;
}
.finder__grid::before { top: 0; bottom: 0; left: 33.333%; width: 33.333%; border-width: 0 1px; }
.finder__grid::after { left: 0; right: 0; top: 33.333%; height: 33.333%; border-width: 1px 0; }

/* English visitors: hold the page until site.js has swapped the text. */
.i18n-wait body { visibility: hidden; }

/* Language switch, in the same dark pill as the camera controls */
.lang {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  height: 40px;
  min-width: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--coach);
  color: rgba(245, 242, 238, .78);
  font: 500 14px/1 var(--text);
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  transition: color .15s;
}
.lang:hover { color: #fff; }

/* Coaching tip, styled after the one in 上手拍 */
.tip {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 10px 22px 10px 10px;
  border-radius: 20px;
  background: var(--coach);
  color: var(--coach-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
}
.tip__face { grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; }
.tip__head { font-size: 12px; line-height: 1.4; color: var(--coach-red); font-weight: 600; }
.tip__head::before { content: "→ "; }
.tip__text { grid-column: 2; font-size: 16px; line-height: 1.45; font-weight: 500; }
.tip__text--a { display: none; }

.subject {
  position: absolute;
  left: calc(33.333% - var(--av) / 2);
  top: calc(54% - var(--av) / 2);
}

.subject__photo { position: relative; width: var(--av); height: var(--av); }
.subject__photo img { display: block; width: 100%; height: 100%; border-radius: 50%; }

/* AF box: four corner marks around the avatar */
.af { position: absolute; inset: -18px; }
.af i {
  position: absolute;
  width: 24px; height: 24px;
  border: 0 solid var(--af);
}
.af i:nth-child(1) { left: 0; top: 0; border-width: 3px 0 0 3px; border-top-left-radius: 4px; }
.af i:nth-child(2) { right: 0; top: 0; border-width: 3px 3px 0 0; border-top-right-radius: 4px; }
.af i:nth-child(3) { left: 0; bottom: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 4px; }
.af i:nth-child(4) { right: 0; bottom: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 4px; }

.subject__text {
  position: absolute;
  left: calc(var(--av) + 48px);
  top: calc(var(--av) / 2);
  transform: translateY(-56%);
  width: max-content;
}

h1, h2, .foot__hello { font-family: var(--display); font-weight: 400; margin: 0; }

h1 {
  font-size: clamp(76px, 11vw, 176px);
  line-height: .9;
  letter-spacing: -.01em;
}

.subject__text .social { margin: 28px 0 0 4px; }

/* ---------------------------------------------------------------- intro (one orchestrated moment) */

.intro .subject { opacity: 0; transform: translateX(8vw); }
.intro .af { opacity: 0; transform: scale(1.45); }
.intro .tip__text--a { display: block; }
.intro .tip__text--b { display: none; }

.intro.is-in .subject {
  opacity: 1; transform: none;
  transition: opacity .5s ease-out, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.intro.is-locked .af {
  opacity: 1; transform: none;
  transition: opacity .15s, transform .35s cubic-bezier(.3, 1.4, .5, 1);
}
.intro.is-locked .tip__text--a { display: none; }
.intro.is-locked .tip__text--b { display: block; animation: tip-in .4s ease-out; }

@keyframes tip-in { from { opacity: 0; transform: translateY(4px); } }

/* ---------------------------------------------------------------- social chips */

.social { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px 0 7px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 15px/1 var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.chip:hover { border-color: var(--ink-2); }

.tile {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  flex: none;
}
.tile--xhs { background: var(--xhs); font-size: 8.5px; letter-spacing: -.02em; }
.tile--zhihu { background: var(--zhihu); font-size: 16px; }
.tile--gh { background: var(--ink); fill: var(--sheet); padding: 6px; border-radius: 50%; }
.tile--mail { background: var(--ink); color: var(--sheet); padding: 5px; }

/* ---------------------------------------------------------------- work */

.work {
  max-width: 1248px;
  margin: 0 auto;
  padding: 144px 24px 0;
}

.work__head {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 32px;
  margin-bottom: 36px;
}
.work__head > * { grid-column: 1; }

h2 {
  font-size: clamp(60px, 8.4vw, 112px);
  line-height: .92;
}
h2 small {
  font: 500 clamp(18px, 2vw, 24px)/1 var(--text);
  color: var(--muted);
  margin-left: .3em;
  vertical-align: .9em;
}

.work__line { margin: 16px 0 18px; font-size: clamp(18px, 1.8vw, 22px); color: var(--ink-2); text-wrap: balance; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--sheet);
  box-shadow: inset 0 0 0 1px var(--hair);
  font-size: 14px;
  color: var(--ink-2);
}

.work__links {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: end;
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--ink-2); }
.btn--quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--hair); }
.btn--quiet:hover { background: var(--sheet); }

.plate { margin: 0; }
.plate img { display: block; width: 100%; height: auto; }
.plate figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* Agent的十四行诗: a reading screenshot, then the chapters written so far */
.work--sonnet h2 [data-display] { white-space: nowrap; }
.work--sonnet .plate img { border-radius: 16px; }

.chapters {
  display: grid;
  grid-template-columns: repeat(3, 1fr) .5fr;
  gap: 16px;
  margin-top: 16px;
}
.chapters img { display: block; width: 100%; height: auto; border-radius: 12px; }
.chapters p { margin: 10px 0 0; font-size: 15px; color: var(--ink-2); }
.chapters__no { display: inline-block; min-width: 1.9em; font-family: var(--display); font-size: 18px; color: var(--muted); }
.chapters__rest { display: flex; flex-direction: column; justify-content: space-between; }
.chapters__rest .chapters__numerals {
  margin: 0;
  font: 400 clamp(20px, 2vw, 28px)/1.35 var(--display);
  word-spacing: .2em;
  color: var(--muted);
  opacity: .55;
}

.shots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.shots img { display: block; width: 100%; height: auto; border-radius: 20px; }

/* ---------------------------------------------------------------- footer */

.foot {
  max-width: 1248px;
  margin: 160px auto 0;
  padding: 0 24px 32px;
}
.foot::before { content: ""; display: block; border-top: 1px solid var(--hair); margin-bottom: 48px; }
.foot__hello { font-size: clamp(44px, 6vw, 72px); line-height: 1; margin-bottom: 28px; }
.foot__fine { margin: 40px 0 0; font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- zoom selector nav */

.zoom {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10;
  width: max-content;
  display: flex;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(42, 39, 37, .84);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
}
.zoom a {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: rgba(245, 242, 238, .7);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.zoom a:hover { color: #fff; }
.zoom a[aria-current] { background: rgba(255, 255, 255, .13); color: var(--af); }
.zoom a:focus-visible { outline-color: var(--af); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 64px);
  transform: translate(-50%, 8px);
  z-index: 11;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--coach);
  color: var(--coach-ink);
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .work { padding-top: 104px; }
  .work__head { grid-template-columns: 1fr; }
  .work__links { grid-column: 1; grid-row: auto; margin-top: 24px; }

  .shots {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 0 -24px;
    padding: 0 24px 8px;
    scrollbar-width: none;
  }
  .shots::-webkit-scrollbar { display: none; }
  .shots li { flex: 0 0 min(64%, 300px); scroll-snap-align: center; }

  .chapters {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin: 16px -24px 0;
    padding: 0 24px 8px;
    scrollbar-width: none;
  }
  .chapters::-webkit-scrollbar { display: none; }
  .chapters li { flex: 0 0 min(72%, 360px); scroll-snap-align: center; }
  .chapters li.chapters__rest { flex-basis: min(36%, 180px); }
}

@media (max-width: 720px) {
  :root { --av: 112px; }
  body { font-size: 16px; }

  .finder {
    margin: 8px;
    height: auto;
    min-height: calc(100svh - 16px);
    max-height: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px 20px 168px;
  }
  /* share the top row with the language switch instead of centring */
  .tip { top: 14px; left: 14px; transform: none; max-width: calc(100% - 92px); }
  .lang { top: 14px; right: 14px; }
  .zoom { gap: 0; }
  .zoom a { min-width: 40px; padding: 0 10px; }
  .tip__text { font-size: 15px; }
  .subject { position: relative; left: auto; top: auto; }
  /* keep the avatar's centre on the left thirds line */
  .subject__photo { margin-left: calc(33.333vw - 28px - var(--av) / 2); }
  .subject__text { position: static; transform: none; width: auto; margin-top: 44px; }
  .intro .subject { transform: translateX(16vw); }
  h1 { font-size: 84px; }
  .subject__text .social { margin-top: 20px; }
  .chip { height: 42px; font-size: 14px; }

  .work { padding: 88px 16px 0; }
  .shots { margin: 0 -16px; padding: 0 16px 8px; }
  .chapters { margin: 16px -16px 0; padding: 0 16px 8px; }
  .work--sonnet h2 { font-size: min(60px, calc((100vw - 32px) / 6.3)); }
  .work--sonnet h2 small { display: block; margin: 12px 0 0 2px; }
  .work--sonnet .plate { margin: 0; }
  /* the drawings are wide; let them be panned instead of shrunk */
  .plate { margin: 0 -16px; }
  .plate__pan { overflow-x: auto; padding: 0 16px; scrollbar-width: none; }
  .plate__pan::-webkit-scrollbar { display: none; }
  .plate__pan img { width: 760px; max-width: none; }
  .plate figcaption { padding: 0 16px; }
  .foot { margin-top: 112px; padding: 0 16px 24px; }
  .foot::before { margin-bottom: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
