/* lei-cao.com — the dark room. Tokens first; everything below uses them. */

@font-face { font-family: "Boska"; src: url("fonts/boska-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Boska"; src: url("fonts/boska-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Boska"; src: url("fonts/boska-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --bg: #1c1c1c;
  --surface: #262626;
  --ink: #f1f1ef;
  --muted: #b4b5b0;
  --accent: #8fa68e;
  --accent-ink: #1c1c1c;
  --field-1: #c8c5ba;
  --field-1-ink: #1c1c1c;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-title: clamp(1.625rem, 1.2rem + 1.5vw, 2.375rem);
  --step-head: clamp(2.25rem, 1.3rem + 3.6vw, 4rem);
  --step-display: clamp(3.5rem, 15vw, 15rem);

  --margin: clamp(16px, 2.1vw, 30px);
  --gap-section: clamp(120px, 14vw, 200px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --face: "Boska", "Iowan Old Style", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--face); font-size: var(--step-body); line-height: 1.55; letter-spacing: .005em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1, h2, h3 { font-weight: 400; letter-spacing: -.02em; line-height: 1; text-wrap: balance; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: var(--margin); top: -100px; z-index: 10; background: var(--ink); color: var(--bg); padding: 10px 14px; }
.skip:focus { top: 10px; }

/* Bar: wordmark and links top-left, the one light rectangle top-right */
.bar {
  position: absolute; inset: 0 0 auto 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: var(--margin);
  font-size: var(--step-small);
}
.bar__links { display: flex; gap: clamp(14px, 2vw, 28px); align-items: baseline; flex-wrap: wrap; }
.bar__links a { text-decoration: none; color: var(--ink); transition: color .2s; }
.bar__links a:hover { color: var(--accent); }
.bar__mark { font-weight: 500; margin-right: clamp(4px, 1.5vw, 24px); }
.button {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  padding: 11px 18px; text-decoration: none; font-weight: 500; font-size: var(--step-small); line-height: 1;
  transition: transform .18s var(--ease), background-color .2s;
}
.button:hover { color: var(--accent-ink); background: #a3b8a2; transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.98); }

/* Hero: 12-column field, two prints, headline bottom-left */
.hero {
  position: relative; min-height: max(100svh, 720px);
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 16px;
  grid-template-rows: 14svh auto 1fr auto;
  padding: 0 var(--margin) var(--margin);
}
.hero__play { grid-column: 6 / 10; grid-row: 2; }
.hero__print {
  grid-column: 2 / 4; grid-row: 2; align-self: start; margin-top: 38svh;
  position: relative; aspect-ratio: 1; overflow: hidden; filter: brightness(.7);
}
.hero__print img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; opacity: 0; transition: opacity 1.6s ease; }
.hero__print img.is-on { opacity: 1; }
.hero__title { grid-column: 1 / 7; grid-row: 4; align-self: end; font-size: var(--step-title); line-height: 1.05; margin-top: 48px; }
.hero__note { grid-column: 10 / 13; grid-row: 4; align-self: end; color: var(--muted); font-size: var(--step-body); max-width: 28ch; line-height: 1.45; }

/* The playable: a real little game in a 4:5 frame */
.playable {
  position: relative; aspect-ratio: 4 / 5; width: 100%;
  background: #23262b; color: #f6f3ea; overflow: hidden; user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.playable noscript img { width: 100%; height: 100%; object-fit: cover; }
.pl__head { position: absolute; inset: 0 0 auto 0; padding: 4.5% 6% 0; display: flex; justify-content: space-between; align-items: baseline; font-size: var(--step-small); }
.pl__head b { font-weight: 500; }
.pl__moves { color: #c9c6bd; font-variant-numeric: tabular-nums; }
.pl__board { position: absolute; left: 16%; right: 16%; top: 14%; aspect-ratio: 4 / 5; background: #2d3138; }
.pl__arch { position: absolute; background: var(--c); }
.pl__block {
  position: absolute; border: 0; padding: 0; cursor: pointer;
  background: var(--c); border-radius: 14%/18%;
  transition: transform .42s var(--ease), opacity .3s ease .25s;
  color: #1c1c1c; font: inherit; font-size: var(--step-lead); line-height: 1;
  display: grid; place-items: center;
}
.pl__block::after { content: ""; position: absolute; left: 12%; right: 12%; top: 10%; height: 22%; border-radius: 999px; background: rgba(255,255,255,.35); }
.pl__block:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.pl__block.is-bump { animation: bump .32s var(--ease); }
.pl__block.is-out { opacity: 0; pointer-events: none; }
@keyframes bump { 40% { translate: var(--bx, 0) var(--by, 0); } }
.pl__foot { position: absolute; inset: auto 0 0 0; padding: 0 6% 4.5%; font-size: var(--step-small); color: #c9c6bd; }
.pl__end {
  position: absolute; inset: 0; display: grid; align-content: center; gap: 18px; padding: 10%;
  background: #23262b; text-align: left; opacity: 0; pointer-events: none; transition: opacity .5s ease;
}
.pl__end.is-on { opacity: 1; pointer-events: auto; }
.pl__end p { font-size: var(--step-lead); line-height: 1.2; max-width: 18ch; }
.pl__end .pl__small { font-size: var(--step-small); color: #c9c6bd; max-width: 30ch; line-height: 1.45; }
.pl__cta { display: inline-block; justify-self: start; background: #f6f3ea; color: #23262b; padding: 12px 18px; text-decoration: none; font-weight: 500; transition: transform .18s var(--ease); }
.pl__cta:hover { color: #23262b; transform: translateY(-2px); }
.pl__again { justify-self: start; background: none; border: 0; padding: 4px 0; color: #f6f3ea; font: inherit; font-size: var(--step-small); text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }

/* Work: loose scatter with pauses */
.work { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 16px; padding: var(--gap-section) var(--margin) 0; }
.work__title { grid-column: 1 / -1; font-size: var(--step-head); margin-bottom: clamp(48px, 8vh, 96px); }
.exhibit { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; align-items: end; margin-bottom: clamp(120px, 24vh, 260px); }
.exhibit figure { position: relative; }
.exhibit img { width: 100%; object-fit: cover; filter: grayscale(1) brightness(.85) contrast(1.05); transition: filter .6s ease; }
.exhibit figure:hover img { filter: grayscale(1) brightness(.98) contrast(1.05); }
.exhibit figcaption { margin-top: 10px; font-size: var(--step-small); color: var(--muted); }
.exhibit h3 { font-size: var(--step-lead); line-height: 1.15; margin-bottom: 16px; }
.exhibit h3 a { text-decoration: none; }
.exhibit p { max-width: 60ch; }
.exhibit p + p { margin-top: 1em; }
.exhibit--left figure { grid-column: 1 / 7; }
.exhibit--left figure img { aspect-ratio: 3 / 2; }
.exhibit--left .exhibit__text { grid-column: 8 / 13; }
.exhibit--right figure { grid-column: 8 / 13; grid-row: 1; }
.exhibit--right figure img { aspect-ratio: 4 / 5; }
.exhibit--right .exhibit__text { grid-column: 2 / 7; grid-row: 1; }
.exhibit--inset { align-items: start; }
.exhibit--inset figure { grid-column: 3 / 10; }
.exhibit--inset figure img { aspect-ratio: 16 / 9; object-position: 50% 30%; }
.exhibit--inset .exhibit__text { grid-column: 3 / 10; margin-top: 32px; display: grid; grid-template-columns: 1fr 1.6fr; gap: 32px; }
.exhibit--inset .exhibit__text h3 { margin: 0; }
.work__remark { grid-column: 2 / 7; font-size: var(--step-lead); line-height: 1.25; margin: calc(clamp(120px, 24vh, 260px) * -0.6) 0 clamp(120px, 22vh, 240px); max-width: 24ch; }

/* About: side facts, wide paragraph */
.about { display: grid; grid-template-columns: 34% 1fr; column-gap: 0; row-gap: 120px; padding: var(--gap-section) var(--margin) 0; }
.about__facts { display: grid; gap: 20px; align-content: start; font-size: var(--step-small); width: 200px; }
.about__facts dt { color: var(--muted); }
.about__facts dd { font-size: var(--step-body); }
.about__body { max-width: calc(90vw - 34vw); }
.about__lead { font-size: var(--step-lead); line-height: 1.35; }
.about__lead + .about__lead { margin-top: 1.35em; }
.about__lead--soft { color: var(--muted); }
.about__record { grid-column: 1 / -1; display: grid; grid-template-columns: 34% minmax(0, 260px) minmax(0, 260px); column-gap: 0; }
.about__record .about__list:last-child { margin-left: 64px; }
.about__word { font-size: var(--step-small); color: var(--muted); }
.about__list li { font-size: var(--step-body); line-height: 1.6; }

/* How I work: one slider drives two fields */
.how {
  margin-top: var(--gap-section);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; min-height: 88svh;
}
.how__words { background: var(--surface); padding: clamp(32px, 5vw, 72px) var(--margin) 40px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.how__clause { font-size: var(--step-head); line-height: .98; max-width: 17ch; transition: opacity .2s ease; }
.how__clause.is-fading { opacity: 0; }
.how__note { max-width: 44ch; }
.how__stage { background: var(--field-1); color: var(--field-1-ink); display: grid; place-items: center; padding: 48px var(--margin); }
.frag {
  grid-area: 1 / 1; width: min(440px, 100%); background: #f6f6f4; color: #1d1f22;
  padding: 22px 24px 24px; border-radius: 10px; border: 1px solid #dedbd2; /* taste-skill-ignore: data-ui fragment */
  font-size: var(--step-small); line-height: 1.45;
  opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .2s ease, transform .3s var(--ease), visibility 0s linear .2s;
}
.frag.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.frag__top { display: flex; justify-content: space-between; color: #5b5e63; font-size: var(--step-small); margin-bottom: 14px; }
.frag__top span:last-child { background: #e8ece6; color: #33503a; padding: 2px 8px; border-radius: 4px; }
.frag__title { font-size: var(--step-lead); line-height: 1.2; font-weight: 500; margin-bottom: 12px; }
.frag__body { color: #3a3d42; margin-bottom: 18px; }
.frag__meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid #e6e3da; padding-top: 14px; } /* taste-skill-ignore: data-ui fragment */
.frag__meta dt { font-size: var(--step-small); color: #5b5e63; }
.frag__log li { display: grid; grid-template-columns: 76px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid #ebe8df; } /* taste-skill-ignore: data-ui fragment */
.frag__log b { font-weight: 500; color: #33503a; }
.how__control { grid-column: 1 / -1; background: var(--bg); padding: 28px var(--margin) 32px; }
.how__control input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; margin: 0; }
/* Base line under the input, the input (transparent track, thumb), then the passed part on top up to the thumb. */
.how__track { position: relative; --thumb: 32px; }
.how__track::after { content: ""; position: absolute; inset: calc(50% - 4px) 0 auto; height: 8px; background: #6e6e6e; pointer-events: none; }
.how__track::before { content: ""; position: absolute; left: 0; top: calc(50% - 4px); height: 8px; width: calc((100% - var(--thumb)) * var(--frac, 0)); background: var(--ink); pointer-events: none; z-index: 2; transition: width .25s var(--ease); }
.how__control input[type="range"] { position: relative; z-index: 1; display: block; }
.how__control input[type="range"]::-webkit-slider-runnable-track { height: 8px; background: transparent; }
.how__control input[type="range"]::-moz-range-track { height: 8px; background: transparent; }
.how__control input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; margin-top: -12px; background: var(--accent); border: 0; border-radius: 0; transition: transform .15s var(--ease); }
.how__control input[type="range"]::-moz-range-thumb { width: 32px; height: 32px; background: var(--accent); border: 0; border-radius: 0; }
.how__control input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
.how__names { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 14px; font-size: var(--step-body); color: var(--muted); }
.how__names li { cursor: pointer; transition: color .2s; }
.how__names li:nth-child(2) { text-align: center; text-indent: -33%; }
.how__names li:nth-child(3) { text-align: center; text-indent: 33%; }
.how__names li:last-child { text-align: right; }
.how__names li.is-on { color: var(--ink); }

/* Experience: one size, fixed column starts */
.record { padding: var(--gap-section) var(--margin) 0; font-size: var(--step-title); }
.record__part { font-size: inherit; letter-spacing: 0; color: var(--accent); margin: 0 0 20px; line-height: 1.5; }
.record__part + .record__table + .record__part { margin-top: 72px; }
.record__table { width: 100%; border-collapse: collapse; }
.record__table th, .record__table td { font-weight: 400; text-align: left; padding: 0; line-height: 1.5; vertical-align: baseline; }
.record__table th { width: 33%; }
.record__table td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record__table tr { transition: color .2s; }
.record__table tr:hover { color: var(--accent); }
.record__note { font-size: var(--step-body); color: var(--muted); max-width: 62ch; margin: 56px 0 0 33%; }

/* Apps: staggered pairs */
.apps { padding: var(--gap-section) var(--margin) 0; }
.apps__intro { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 16px; margin-bottom: 96px; }
.apps__intro h2 { grid-column: 1 / 6; font-size: var(--step-head); }
.apps__intro p { grid-column: 7 / 12; align-self: end; max-width: 46ch; }
.apps__grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 16px; row-gap: 0; }
.app a { display: block; text-decoration: none; }
.app img { width: 100%; transition: transform .5s var(--ease), filter .4s; filter: brightness(.92); }
.app a:hover img { transform: translateY(-6px); filter: brightness(1); }
.app span { display: block; margin-top: 10px; font-size: var(--step-small); color: var(--muted); }
.app a:hover span { color: var(--ink); }
.app--a { grid-column: 1 / 4; grid-row: 1; }
.app--b { grid-column: 5 / 8; grid-row: 1; margin-top: 18vh; }
.app--c { grid-column: 10 / 13; grid-row: 1; margin-top: 6vh; }
.app--d { grid-column: 2 / 5; grid-row: 2; margin-top: 10vh; }
.app--e { grid-column: 6 / 9; grid-row: 2; margin-top: 4vh; }
.app--f { grid-column: 10 / 13; grid-row: 2; margin-top: 22vh; }

/* Contact: the address as display type on the pale field */
.contact {
  margin-top: var(--gap-section); min-height: 100svh; position: relative;
  background: var(--field-1); color: var(--field-1-ink);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr auto auto;
  padding: var(--margin);
}
.contact a:hover { color: #2f4a30; }
.contact :focus-visible { outline-color: var(--field-1-ink); }
.contact__ask { grid-column: 1 / -1; font-size: var(--step-lead); line-height: 1.3; letter-spacing: 0; max-width: 34ch; padding-top: 8px; }
.contact__mail {
  grid-column: 1 / -1; grid-row: 3; align-self: end;
  font-size: clamp(34px, 11.4vw, 220px); line-height: .95; letter-spacing: -.035em;
  text-decoration: none; margin-bottom: 12vh; white-space: nowrap;
  transition: color .25s;
}
.contact__mail:hover { color: #2f4a30; }
.contact__city, .contact__links { grid-row: 4; font-size: var(--step-body); }
.contact__links { justify-self: end; display: flex; gap: 24px; }

/* Footer: the name across the last photograph */
.foot { position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: space-between; color: #f4f1e8; overflow: hidden; }
.foot__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.55); }
.foot > :not(img) { position: relative; }
.foot__top { display: flex; justify-content: space-between; gap: 24px; padding: 32px var(--margin); font-size: var(--step-body); }
.foot__top ul { display: grid; gap: 4px; }
.foot__top a { text-decoration: none; }
.foot__top a:hover, .foot__legal a:hover { color: var(--accent); }
.foot__top p { text-align: right; }
.foot__mark { font-size: clamp(96px, 24vw, 380px); line-height: .8; letter-spacing: -.04em; padding: 0 var(--margin); margin-top: auto; white-space: nowrap; }
.foot__legal { font-size: var(--step-small); line-height: 1.5; padding: 24px var(--margin) 24px; max-width: 120ch; color: #e6e2d6; }

/* Entrances: content is visible without script; script adds .will-rise first */
.will-rise { opacity: 0; transform: translateY(24px); }
.rise { opacity: 1; transform: none; transition: opacity .7s ease, transform .8s var(--ease); transition-delay: var(--d, 0ms); }

/* Phone: its own composition */
@media (max-width: 760px) {
  .bar__links a:not(.bar__mark) { display: none; }
  .hero { grid-template-rows: 12svh auto auto auto; min-height: auto; padding-bottom: 32px; }
  .hero__play { grid-column: 2 / 13; }
  .hero__print { grid-column: 1 / 5; grid-row: 3; margin-top: 16px; filter: brightness(.8); }
  .hero__title { grid-column: 1 / -1; grid-row: 4; margin-top: 28px; }
  .hero__note { grid-column: 1 / -1; grid-row: 5; margin-top: 14px; max-width: none; }

  .exhibit, .exhibit--inset .exhibit__text { display: block; margin-bottom: 72px; }
  .exhibit figure { width: 100%; }
  .exhibit--right figure { width: 74%; margin-left: auto; }
  .exhibit--inset figure { width: 88%; }
  .exhibit__text { margin-top: 24px; }
  .exhibit--inset .exhibit__text h3 { margin-bottom: 16px; }
  .work__remark { margin: 0 0 72px; }

  .about { display: flex; flex-direction: column; gap: 0; }
  .about__body { order: 1; }
  .about__record { order: 3; }
  .about__facts { width: auto; grid-template-columns: 1fr 1fr; margin-top: 40px; }
  .about__body { max-width: none; }
  .about__facts { order: 2; }
  .about__record { grid-template-columns: 1fr 1fr; column-gap: 16px; margin-top: 56px; }
  .about__word { grid-column: 1 / -1; }
  .about__record .about__list:last-child { margin: 0; }
  .about__word { color: var(--ink); margin-bottom: 8px; }

  .how { grid-template-columns: 1fr; grid-template-rows: auto auto auto; min-height: 0; }
  .how__stage { grid-row: 1; min-height: 46svh; padding: 32px var(--margin); }
  .how__control { grid-row: 2; padding: 20px var(--margin) 24px; }
  .how__control input[type="range"] { height: 40px; }
  .how__track { --thumb: 40px; }
  .how__control input[type="range"]::-webkit-slider-thumb { width: 40px; height: 40px; margin-top: -16px; }
  .how__names { grid-template-columns: 1fr 1fr; row-gap: 6px; }
  .how__names li, .how__names li:nth-child(n) { text-align: left; text-indent: 0; }
  .how__words { grid-row: 2; }
  .how__control { grid-row: 3; }
  .how__clause { font-size: 8vw; }

  .record__table tr { display: grid; grid-template-columns: 1fr auto; padding-bottom: 18px; }
  .record__table th { width: auto; grid-column: 1 / -1; }
  .record__table td { font-size: var(--step-small); color: var(--muted); }
  .record__table td:last-child { text-align: right; }
  .record__note { margin-left: 0; margin-top: 32px; }

  .apps__intro { display: block; margin-bottom: 48px; }
  .apps__intro p { margin-top: 20px; }
  .apps__grid { grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .app, .app:nth-child(n) { grid-column: auto; grid-row: auto; margin: 0 0 40px; }
  .app:nth-child(even) { margin-top: 64px; margin-bottom: -24px; }

  .contact { min-height: 86svh; grid-template-columns: 1fr; }
  .contact__mail { white-space: normal; font-size: 11.5vw; margin-bottom: 40px; }
  .contact__city { grid-row: 4; }
  .contact__links { grid-row: 5; justify-self: start; flex-direction: column; gap: 12px; margin-top: 12px; }

  .foot { min-height: 88svh; }
  .foot__top { flex-direction: column; }
  .foot__top p { text-align: left; }
  .foot__legal { font-size: var(--step-small); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .will-rise { opacity: 1; transform: none; }
}

/* 404 */
.lost { min-height: 100svh; display: grid; align-content: end; gap: 24px; padding: var(--margin); }
.lost h1 { font-size: var(--step-head); }
