/* Studio Deng — stylesheet
   Palette is taken from the portfolio: logo ink, white page, pale grey panel. */

/* Titillium Web, self-hosted (SIL Open Font License, see fonts/OFL-LICENSE.txt) */
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/titillium-web-latin-ext-300-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/titillium-web-latin-300-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/titillium-web-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/titillium-web-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/titillium-web-latin-ext-600-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Titillium Web'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/titillium-web-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --paper: #F7F7F5;
  --ink: #050608;
  --text: #222325;
  --muted: #707274;
  --line: #D9DAD6;
  --panel: #ECEDEA;
  --veil: rgba(247, 247, 245, 0.97);

  --font: "Titillium Web", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --pad: clamp(18px, 3.2vw, 44px);
  --header-h: 68px;
  --gap: 14px;

  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121314;
    --ink: #F2F2EF;
    --text: #E2E2DF;
    --muted: #9A9C9B;
    --line: #2E2F30;
    --panel: #1D1E1F;
    --veil: rgba(18, 19, 20, 0.97);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121314;
  --ink: #F2F2EF;
  --text: #E2E2DF;
  --muted: #9A9C9B;
  --line: #2E2F30;
  --panel: #1D1E1F;
  --veil: rgba(18, 19, 20, 0.97);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--header-h)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; z-index: 30;
  height: env(safe-area-inset-top, 0px); background: var(--paper);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p { margin: 0 0 1em; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }

.sr {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: fixed; left: var(--pad); top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 6px 12px;
}
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 10px); }

/* ---------- header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding: env(safe-area-inset-top, 0px) var(--pad) 0;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: var(--paper);
  transition: background-color .3s;
}
.is-home .site-header { background: transparent; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); line-height: 1; }
.brand-mark { height: 24px; width: auto; fill: currentColor; flex: none; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.brand-zh { font-size: 13px; color: var(--muted); }
.site-header nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(14px, 2.2vw, 30px); }
.site-header nav a {
  font-size: 15px; color: var(--muted); padding: 6px 0;
  text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 6px; text-decoration-thickness: 1px;
  transition: color .2s, text-decoration-color .2s;
}
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--ink); text-decoration-color: currentColor; }

@media (max-width: 560px) {
  .brand-name, .brand-zh { display: none; }
  .site-header nav a { font-size: 15px; }
}

/* ---------- page frame ---------- */
main { min-height: 100%; outline: none; }
.page {
  padding: calc(var(--header-h) + 28px) var(--pad) 0;
  max-width: 1680px; margin: 0 auto;
  animation: page-in .35s ease-out both;
}
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
.site-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 120px; padding: 20px 0 28px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}

/* ---------- home ---------- */
.is-home, .is-home body { height: 100%; overflow: hidden; }
.home { position: fixed; inset: 0; }
.home canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.home-hint {
  position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  text-align: center; font-size: 13px; color: var(--muted); letter-spacing: .02em;
  pointer-events: none; transition: opacity 1.2s ease;
}
.home-hint span[lang] { margin-left: 1.2em; }
.home-hint.is-gone { opacity: 0; }
.home-foot {
  position: absolute; left: var(--pad); bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  font-size: 13px; color: var(--muted); padding: 4px 0;
}
.home-foot:hover { color: var(--ink); }
@media (max-width: 640px) { .home-foot { display: none; } }

/* ---------- projects ---------- */
.toolbar {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 26px; font-size: 14px; color: var(--muted);
}
.view-toggle { display: flex; gap: 18px; }
.view-toggle button { color: var(--muted); padding: 4px 0; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.view-toggle button:hover { color: var(--ink); }
.view-toggle button[aria-pressed="true"] { color: var(--ink); text-decoration-color: currentColor; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap); row-gap: 52px;
}
@media (max-width: 1080px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px)  { .grid { grid-template-columns: 1fr; row-gap: 40px; } }
.card { display: block; }
.card-img {
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--panel);
  transition: opacity .25s;
}
.card:hover .card-img { opacity: .88; }
.card-title {
  margin: 14px 0 0; font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--ink);
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.card:hover .card-title, .card:focus-visible .card-title { text-decoration-color: currentColor; }
.card-meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.card-bio { margin: 8px 0 0; font-size: 14px; line-height: 1.55; max-width: 34em; }

.index { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.index a {
  display: grid; grid-template-columns: 88px minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 20px; padding: 13px 0; border-top: 1px solid var(--line);
  font-size: 15px; line-height: 1.4; transition: color .15s;
}
.index .ix-year, .index .ix-place, .index .ix-type { color: var(--muted); }
.index .ix-title { color: var(--ink); }
.index a:hover .ix-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
@media (max-width: 760px) {
  .index a { grid-template-columns: 64px minmax(0, 1fr); row-gap: 2px; }
  .index .ix-place { grid-column: 2; font-size: 13px; }
  .index .ix-type { display: none; }
}
.index-peek {
  position: fixed; left: 0; top: 0; z-index: 15; width: 260px; aspect-ratio: 4 / 5; object-fit: cover;
  pointer-events: none; opacity: 0; transition: opacity .18s; background: var(--panel);
}
.index-peek.is-on { opacity: 1; }
@media (hover: none), (max-width: 900px) { .index-peek { display: none; } }

/* ---------- single project ---------- */
.project {
  display: grid; grid-template-columns: minmax(300px, 4fr) minmax(0, 7fr);
  gap: clamp(28px, 4vw, 72px); align-items: start;
}
.project-text {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--header-h) + 28px);
  max-height: calc(100vh - var(--header-h) - 56px - env(safe-area-inset-top, 0px));
  overflow-y: auto; scrollbar-width: thin; padding-right: 8px;
}
.back { font-size: 14px; color: var(--muted); }
.back:hover { color: var(--ink); }
.project-title { margin: 18px 0 0; font-size: clamp(26px, 2.4vw, 34px); font-weight: 400; line-height: 1.15; color: var(--ink); letter-spacing: -.005em; }
.project-subtitle { margin: 6px 0 0; font-size: 18px; color: var(--muted); font-weight: 300; }
.meta {
  display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px;
  margin: 26px 0 28px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 14px; line-height: 1.45;
}
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.project-body { max-width: 36em; }
.dialogue { margin: 28px 0 8px; font-size: 14px; }
.dialogue-head, .dialogue-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dialogue-head { color: var(--ink); font-weight: 600; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.dialogue-row { padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.dialogue-row span:first-child { word-break: break-all; }

.shots { display: flex; flex-direction: column; gap: var(--gap); }
.shot { display: block; width: 100%; cursor: zoom-in; background: var(--panel); }
.shot img { width: 100%; height: auto; }

.pager {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-top: 72px; padding-top: 18px; border-top: 1px solid var(--line);
}
.pager a { display: block; }
.pager small { display: block; font-size: 13px; color: var(--muted); }
.pager span { font-size: 16px; color: var(--ink); }
.pager a:hover span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.pager .next { text-align: right; }

@media (max-width: 900px) {
  .project { grid-template-columns: 1fr; }
  .project-text { position: static; max-height: none; overflow: visible; padding-right: 0; }
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 40; background: var(--veil);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) var(--pad) calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.lightbox[hidden] { display: none; }
.lb-close { justify-self: end; font-size: 14px; color: var(--muted); padding: 6px 0; }
.lb-figure { margin: 0; display: grid; place-items: center; min-height: 0; }
.lb-img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; }
.lb-bar { display: flex; justify-content: center; align-items: center; gap: 28px; font-size: 14px; color: var(--muted); padding-top: 10px; }
.lightbox button:hover { color: var(--ink); }

/* ---------- about & contact ---------- */
.lead {
  margin: 36px 0 88px; max-width: 21em;
  font-size: clamp(26px, 3.3vw, 44px); font-weight: 300; line-height: 1.22; color: var(--ink); letter-spacing: -.01em;
}
.lead [lang="zh-Hans"] { font-weight: 400; }
.section {
  display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 3fr);
  gap: 32px; padding: 22px 0 56px; border-top: 1px solid var(--line);
}
.section h2 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.6; }
.section-body { max-width: 40em; }
.section-mark { height: 76px; width: auto; fill: var(--ink); display: block; }
.char-list { list-style: none; margin: 0 0 1.2em; padding: 0; }
.char-list li { display: grid; grid-template-columns: 4.4em 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.char-list li:first-child { border-top: 1px solid var(--line); }
.char-list b { font-weight: 400; color: var(--ink); font-size: 18px; line-height: 1.4; }
.people { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 32px; }
.people li { break-inside: avoid; padding: 2px 0; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
.rows li:first-child { border-top: 1px solid var(--line); }
.rows .yr { color: var(--muted); }
.rows a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.rows a:hover { text-decoration-color: currentColor; }
@media (max-width: 760px) {
  .section { grid-template-columns: 1fr; gap: 14px; padding-bottom: 44px; }
  .people { columns: 1; }
}

.email {
  display: inline-block; margin: 40px 0 88px;
  font-size: clamp(28px, 5vw, 64px); font-weight: 300; line-height: 1.1; color: var(--ink); letter-spacing: -.01em;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .16em; text-decoration-color: var(--line);
  word-break: break-word;
}
.email:hover { text-decoration-color: currentColor; }

.empty { padding: 20vh 0; color: var(--muted); }
.empty a { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  .page { animation: none; }
  * { transition-duration: 0s !important; }
}

/* ---------- additions ---------- */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--panel); color: var(--muted); font-size: 13px;
}
.ph-mark { height: 64px; width: auto; fill: none; stroke: currentColor; stroke-width: .5; opacity: .7; }
.shot-placeholder { aspect-ratio: 4 / 3; width: 100%; }
a.inline { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a.inline:hover { text-decoration-color: currentColor; }
.about-text p { font-size: 18px; line-height: 1.65; max-width: 34em; }
.zh { font-size: 1.08em; letter-spacing: .04em; }
