/* Build Lab portfolio: the work as a rose window. Each project is a pane of glass with its own colour. */
:root {
  color-scheme: dark;
  --stone: #14121f;
  --lead: #07060c;
  --light: #f1eadb;
  --soft: #d9d3e4;
  --dim: #b9b3c9;
  --gold: #ffc24d;
  --display: 'Grenze Gotisch', 'Songti SC', 'STSong', 'SimSun', Georgia, serif;
  --body: 'Albert Sans', 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
/* Glass colours: --glass is the pane itself, --tint is the same hue light enough for text on stone. */
.g-amber { --glass: #f2a515; --tint: #ffc24d; }
.g-rose { --glass: #f0549a; --tint: #ff8cbf; }
.g-cobalt { --glass: #2f5bff; --tint: #8fa8ff; }
.g-emerald { --glass: #12a66a; --tint: #4fd79b; }
.g-orange { --glass: #f26a1b; --tint: #ff9a57; }
.g-violet { --glass: #8a4be8; --tint: #b693ff; }
.g-teal { --glass: #0fa9bd; --tint: #5cd9e8; }
.g-ruby { --glass: #e0223a; --tint: #ff8590; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; }
/* The glow spills and beams reach past the edges; clip them at the root so phones never scroll sideways.
   overflow-x: clip keeps the page scrolling normally; hidden is the fallback for older browsers. */
html, body { overflow-x: hidden; overflow-x: clip; }
body { margin: 0; background: var(--stone); color: var(--light); font: 17px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: auto; }
ul { list-style: none; margin: 0; padding: 0; }
a:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--gold); color: var(--stone); }
.wrap { width: min(1240px, 100% - 80px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 40; top: 10px; left: 16px; padding: 10px 18px; background: var(--gold); color: var(--stone); border-radius: 4px; transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.brand { padding: 8px 0; font: 700 30px/1 var(--display); white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 24px; }
/* Language picker: a small arched pane of amber glass. The chevron is drawn in CSS because the CSP forbids data: images. */
.language-picker { position: relative; }
.language-picker select { appearance: none; -webkit-appearance: none; min-height: 28px; padding: 2px 25px 2px 12px; border: 1.5px solid color-mix(in srgb, var(--gold) 65%, transparent); border-radius: 12px 12px 5px 5px; background: linear-gradient(color-mix(in srgb, var(--gold) 26%, transparent), transparent 75%) var(--lead); color: var(--gold); font: 600 14px/1 var(--display); letter-spacing: 0.01em; box-shadow: 0 0 26px -8px color-mix(in srgb, var(--gold) 70%, transparent); cursor: pointer; transition: box-shadow 0.25s, border-color 0.25s; }
.language-picker select:hover, .language-picker select:focus-visible { border-color: var(--gold); box-shadow: 0 0 34px -4px color-mix(in srgb, var(--gold) 85%, transparent); }
.language-picker select:focus-visible { border-radius: 12px 12px 5px 5px; }
.language-picker option { background: var(--lead); color: var(--light); font-family: var(--body); }
.language-picker::after { content: ''; position: absolute; right: 11px; top: 50%; width: 5px; height: 5px; border-right: 1.5px solid var(--gold); border-bottom: 1.5px solid var(--gold); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

/* Hero: the rose and the light it throws on the floor */
.hero { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 40px 56px; padding: 36px 0 130px; }
.hero-head { position: relative; flex: 1 1 380px; min-width: 0; }
h1 { margin: 0; font: 700 clamp(56px, 8.6vw, 128px)/0.9 var(--display); letter-spacing: -0.005em; text-wrap: balance; }
:lang(zh-CN) h1 { font-size: clamp(44px, 6.4vw, 92px); line-height: 1.1; }
.intro { margin: 28px 0 0; max-width: 460px; font-size: 20px; line-height: 1.55; color: var(--soft); }
.spill { position: absolute; z-index: 0; height: 300px; filter: blur(70px); transform: skewX(-28deg); pointer-events: none; }
.spill-ruby { left: 30%; bottom: -120px; width: 46%; background: #e0223a; opacity: 0.32; }
.spill-cobalt { left: 52%; bottom: -160px; width: 34%; background: #2f5bff; opacity: 0.4; }
.spill-amber { left: 12%; bottom: -150px; width: 30%; height: 260px; background: #f2a515; opacity: 0.26; }
.spill-violet { left: 6%; top: 40px; width: 40%; height: 220px; background: #8a4be8; opacity: 0.3; transform: none; }

.rose { position: relative; flex: 1 1 460px; max-width: 680px; min-width: 0; }
.rose svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 0 46px rgb(120 140 255 / 0.45)); }
.petal { fill: var(--glass); transition: fill 0.2s; }
.rose a:hover .petal, .rose a:focus-visible .petal { fill: var(--tint); }
.rose a:focus-visible { outline: none; }
.rose a:focus-visible .petal { stroke: #fff; stroke-width: 6; }
.lum { mix-blend-mode: overlay; pointer-events: none; }
.oculus { font: 700 46px var(--display); fill: var(--stone); pointer-events: none; }
.rose-name { margin: 18px 0 0; min-height: 1.3em; text-align: center; font: 600 26px/1.3 var(--display); color: var(--gold); }
/* One moment on load: the ring appears, then the panes light up one after another. */
@keyframes light { from { opacity: 0; } }
.ring { animation: light 0.9s ease-out backwards; }
.rose a { animation: light 0.7s ease-out backwards; }
.rose a:nth-of-type(1) { animation-delay: 0.3s; }
.rose a:nth-of-type(2) { animation-delay: 0.4s; }
.rose a:nth-of-type(3) { animation-delay: 0.5s; }
.rose a:nth-of-type(4) { animation-delay: 0.6s; }
.rose a:nth-of-type(5) { animation-delay: 0.7s; }
.rose a:nth-of-type(6) { animation-delay: 0.8s; }
.rose a:nth-of-type(7) { animation-delay: 0.9s; }
.rose a:nth-of-type(8) { animation-delay: 1s; }
/* After that the window stays alive: the outer band turns, a gleam walks round the panes, the sun breathes. */
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes gleam { 0%, 26%, 100% { fill: var(--glass); } 12% { fill: var(--tint); } }
@keyframes breathe { from { opacity: 0.7; } to { opacity: 1; } }
@keyframes pulse { from { fill: #ffc24d; } to { fill: #ffe29a; } }
@keyframes drift { from { translate: -5% 0; opacity: var(--from, 0.2); } to { translate: 6% 0; opacity: var(--to, 0.4); } }
.band { transform-origin: 0 0; animation: turn 180s linear infinite; }
.petal { transform-origin: 0 0; animation: gleam 8s ease-in-out 2s infinite; transition: fill 0.2s, transform 0.25s; }
.rose a:nth-of-type(2) .petal { animation-delay: 3s; }
.rose a:nth-of-type(3) .petal { animation-delay: 4s; }
.rose a:nth-of-type(4) .petal { animation-delay: 5s; }
.rose a:nth-of-type(5) .petal { animation-delay: 6s; }
.rose a:nth-of-type(6) .petal { animation-delay: 7s; }
.rose a:nth-of-type(7) .petal { animation-delay: 8s; }
.rose a:nth-of-type(8) .petal { animation-delay: 9s; }
.rose a:hover .petal, .rose a:focus-visible .petal, .rose a.on .petal { animation: none; fill: var(--tint); transform: scale(1.05); }
.rose a { transition: opacity 0.3s; }
.rose.calling a:not(.on) { opacity: 0.45; }
/* The oculus is a button: press it and the wheel of panes spins, then stops on one under the gold pointer. */
.spin { cursor: pointer; outline: none; }
.spin:hover .sun, .spin:focus-visible .sun { animation: none; fill: #ffe29a; }
.spin:focus-visible .sun { stroke: #fff; stroke-width: 6; }
.pointer { opacity: 0; transform: translateY(-14px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.rose.spinning .pointer, .rose.picked .pointer { opacity: 1; transform: none; }
.rose.spinning .wheel { pointer-events: none; }
.rose.spinning .petal { animation: none; }
.lum { animation: breathe 6s ease-in-out infinite alternate; }
.sun { animation: pulse 3s ease-in-out infinite alternate; }
.spill { animation: drift 16s ease-in-out infinite alternate; }
.spill-ruby { --from: 0.2; --to: 0.4; }
.spill-cobalt { --from: 0.48; --to: 0.26; animation-duration: 21s; }
.spill-amber { --from: 0.16; --to: 0.34; animation-duration: 13s; }
.spill-violet { --from: 0.2; --to: 0.38; }

/* Projects: a nave of arched windows */
.work { position: relative; padding-top: 40px; }
.work > h2 { margin: 0 0 64px; font: 600 clamp(36px, 4.4vw, 60px)/1 var(--display); }
.panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 84px 64px; }
.shot { position: relative; display: block; padding: 10px; background: var(--lead); border-radius: 50% 50% 0 0 / 36% 36% 0 0; box-shadow: 0 0 110px -18px color-mix(in srgb, var(--glass) 55%, transparent); transition: box-shadow 0.25s; }
.shot img { aspect-ratio: 16 / 11; object-fit: cover; object-position: center bottom; border-radius: 50% 50% 0 0 / 35% 35% 0 0; }
.shot::after { content: ''; position: absolute; inset: 10px; border-radius: 50% 50% 0 0 / 35% 35% 0 0; background: linear-gradient(color-mix(in srgb, var(--glass) 62%, transparent), transparent 46%); transition: opacity 0.25s; pointer-events: none; }
/* With JavaScript, a window stays unlit until it scrolls into view, then the light comes on once. */
.shot img { transition: filter 1.6s ease-out; }
.js .pane .shot { transition: box-shadow 1.6s ease-out; }
.js .pane:not(.lit) .shot { box-shadow: 0 0 0 0 transparent; }
.js .pane:not(.lit) .shot img { filter: brightness(0.18) saturate(0.3); }
.js .pane h3 { transition: color 1.6s ease-out; }
.js .pane:not(.lit) h3 { color: var(--dim); }
.shot:hover, .shot:focus-visible, .pane.called .shot { box-shadow: 0 0 120px -10px color-mix(in srgb, var(--glass) 80%, transparent); }
.shot:hover::after, .shot:focus-visible::after, .pane.called .shot::after { opacity: 0.25; }
.shot:focus-visible { border-radius: 50% 50% 0 0 / 36% 36% 0 0; }
.pane h3 { margin: 26px 0 10px; font: 600 44px/1 var(--display); letter-spacing: 0.005em; color: var(--tint); }
.pane p { margin: 0; max-width: 520px; font-size: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tags li { padding: 3px 12px; border: 1px solid color-mix(in srgb, var(--tint) 60%, transparent); border-radius: 999px 999px 4px 4px; font-size: 14px; color: var(--soft); }
.go { display: inline-block; margin-top: 12px; padding: 11px 0; font-weight: 600; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.go:hover { color: var(--tint); }

/* Beams: lab.js draws one from each petal of the rose to its window. */
main { position: relative; }
.beams { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.beam path { fill: none; stroke: var(--tint); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset 0.5s ease-in, opacity 0.5s; }
.beam-glow { stroke-width: 18; filter: blur(9px); }
.beam-core { stroke-width: 2.5; }
.beam.on path { stroke-dashoffset: 0; transition: stroke-dashoffset 0.7s ease-out, opacity 0.2s; }
.beam.on .beam-glow { opacity: 0.55; }
.beam.on .beam-core { opacity: 0.95; }

/* Closing */
.bench { position: relative; padding: 140px 0 96px; }
.bench h2 { position: relative; margin: 0; font: 700 clamp(44px, 6vw, 88px)/0.95 var(--display); }
:lang(zh-CN) .bench h2, :lang(zh-CN) .work > h2, :lang(zh-CN) .pane h3 { line-height: 1.2; }
.bench p { position: relative; margin: 24px 0 0; max-width: 480px; font-size: 20px; line-height: 1.55; color: var(--soft); }
.cta { position: relative; display: inline-block; margin-top: 32px; padding: 15px 28px; background: var(--gold); color: var(--stone); font-weight: 600; font-size: 18px; line-height: 1.2; border-radius: 999px 999px 6px 6px; }
.cta:hover { background: var(--light); }

/* Footer */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 28px; padding: 22px 0 36px; border-top: 2px solid rgb(241 234 219 / 0.25); font-size: 15px; }
.language-links { display: flex; gap: 20px; }
.language-links a { padding: 10px 0; }
.language-links a:hover, .footer-mail:hover { color: var(--gold); text-decoration: underline; }
.footer-mail { font: 700 22px var(--display); }
.footer p { margin: 0; color: var(--soft); }
.footer p span { margin: 0 8px; }

@media (max-width: 860px) {
  .wrap { width: min(1240px, 100% - 40px); }
  .brand { font-size: 24px; }
  .top-tools { gap: 14px; }
  .top { padding-bottom: 8px; }
  .hero { padding-top: 4px; padding-bottom: 90px; }
  .panes { grid-template-columns: minmax(0, 1fr); gap: 64px; }
  .pane h3 { font-size: 36px; }
  .bench { padding: 100px 0 72px; }
  .footer { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 370px) {
  .brand { font-size: 20px; }
  .top-tools { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ring, .rose a, .band, .petal, .lum, .sun, .spill { animation: none; }
  .petal, .shot, .shot::after, .shot img, .js .pane .shot, .js .pane h3, .beam path, .beam.on path, .rose a, .language-picker select { transition: none; }
}
