/* ---------------------------------------------------------
   Lu Liu — portfolio
   Edit the tokens in :root to restyle the whole site.
--------------------------------------------------------- */

:root {
  --bg:        #ffffff;
  --surface:   #ffffff;
  --ink:       #16150f;
  --ink-soft:  #55524a;
  --ink-faint: #8a867c;
  --rule:      #e4e3e0;
  --accent:    #9a5b2e;
  --accent-bg: #f5f5f3;

  --max: 1080px;
  --gap: clamp(3rem, 7vw, 6rem);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14140f;
    --surface:   #1c1c16;
    --ink:       #f0eee7;
    --ink-soft:  #b3afa4;
    --ink-faint: #7d7a70;
    --rule:      #33322a;
    --accent:    #d99b62;
    --accent-bg: #26231c;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* anchor targets clear the sticky nav */
:target, section[id], main[id] { scroll-margin-top: 4.5rem; }


body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga";
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); }
.narrow { max-width: 660px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.nav-in {
  max-width: var(--max); margin: 0 auto;
  padding: 0.9rem clamp(1.25rem, 5vw, 2.5rem);
  display: flex; align-items: baseline; gap: 1.5rem;
}
.nav-name { font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
.nav-name:hover { text-decoration: none; }
.nav-links { margin-left: auto; display: flex; gap: 1.4rem; font-size: 0.9rem; }
.nav-links a { color: var(--ink-soft); }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }

/* ---------- type ---------- */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.025em; font-weight: 640; margin: 0; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
h3 { font-size: 1.12rem; letter-spacing: -0.015em; }

.eyebrow {
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; margin: 0 0 0.9rem;
}

.lede { font-size: clamp(1.1rem, 2.2vw, 1.32rem); line-height: 1.55; color: var(--ink-soft); }

p { margin: 0 0 1.15em; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }

section { padding-block: var(--gap); }
section + section { border-top: 1px solid var(--rule); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(4rem, 11vw, 8rem) var(--gap); }
.hero h1 { max-width: 19ch; }
.hero .lede { max-width: 52ch; margin-top: 1.6rem; }

.meta-row {
  display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem;
  margin-top: 2.2rem; font-size: 0.9rem; color: var(--ink-faint);
}

/* ---------- work cards ---------- */
.work-list { display: grid; gap: 2.5rem; margin-top: 2.5rem; }

.card {
  display: grid; grid-template-columns: 1fr; gap: 1.4rem;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; overflow: hidden;
  transition: border-color .18s ease, transform .18s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
@media (min-width: 760px) {
  .card { grid-template-columns: 1.05fr 1fr; align-items: stretch; gap: 0; }
}
.card-media { background: var(--accent-bg); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.card-media.diagram { background: #fff; padding: clamp(1.25rem, 3vw, 2rem); }
.card-media img { border-radius: 6px; }
.card-body { padding: clamp(1.5rem, 3vw, 2.2rem); display: flex; flex-direction: column; }
.card-body h3 { margin-bottom: 0.5rem; }
.card-body .tags { margin-top: auto; padding-top: 1.2rem; }

.card.stub { opacity: 0.72; }
.card.stub .card-media { background: var(--rule); min-height: 140px; }

.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-size: 0.74rem; letter-spacing: 0.04em; padding: 0.25rem 0.6rem;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--ink-faint);
}

/* ---------- case study ---------- */
.case-head { padding-block: clamp(3rem, 8vw, 5.5rem) 2.5rem; }
.case-head h1 { max-width: 20ch; }
.case-facts {
  display: grid; gap: 1.2rem 2.5rem; margin-top: 2.5rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding-top: 1.8rem; border-top: 1px solid var(--rule);
}
.case-facts dt { font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; margin-bottom: 0.3rem; }
.case-facts dd { margin: 0; font-size: 0.95rem; }

.case-body {
  display: grid;
  grid-template-columns: 1fr min(660px, 100%) 1fr;
}
.case-body > * { grid-column: 2; }
.case-body > figure.wide { grid-column: 1 / -1; }
.case-body h2 { margin: 3.2rem 0 1rem; }
.case-body h3 { margin: 2.2rem 0 0.6rem; }
.case-body ul { padding-left: 1.15rem; margin: 0 0 1.15em; }
.case-body li { margin-bottom: 0.5em; }

/* --- case study: the four studies --- */
.study-nav { margin: 2.4rem 0 1rem; border-top: 1px solid var(--rule); }
.study-nav a {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.2rem;
  padding: 0.95rem 0; border-bottom: 1px solid var(--rule); color: var(--ink);
}
.study-nav a:hover { text-decoration: none; color: var(--accent); }
.study-nav .n { font-size: 0.82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; padding-top: 0.15rem; }
.study-nav a:hover .n { color: var(--accent); }
.study-nav .t { font-weight: 500; }
.study-nav .d { display: block; font-weight: 400; font-size: 0.9rem; color: var(--ink-faint); margin-top: 0.15rem; }

.study-head { margin: 4.2rem 0 1.4rem; padding-top: 2.4rem; border-top: 1px solid var(--rule); }
.study-head h2 { margin: 0 0 0.9rem; }
.study-num {
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin: 0 0 0.7rem;
}
.study-meta {
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.3rem;
  font-size: 0.86rem; color: var(--ink-faint); margin: 0;
}
.study-meta span + span::before { content: "· "; margin-right: 0.4rem; }

.answer-head { margin-top: 4.6rem !important; padding-top: 2.6rem; border-top: 2px solid var(--ink); }
.answer-head + .lede { margin-bottom: 1.6rem; }


figure { margin: 2.8rem 0; }

/* no border: on the white page the art should run straight into the page */
figure img { border-radius: 8px; background: var(--surface); }
/* figures exported on a white page: keep the white plate and give the art room to breathe,
   so they read as a plate rather than a glowing slab in dark mode */
figure.diagram img { background: #fff; padding: clamp(1rem, 2.6vw, 2rem); }
figcaption { margin-top: 0.7rem; font-size: 0.85rem; color: var(--ink-faint); line-height: 1.5; }

blockquote {
  margin: 2.2rem 0; padding: 1.3rem 1.5rem;
  background: var(--accent-bg); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
blockquote p:last-child { margin-bottom: 0; }

/* ---------- publications ---------- */
.pubs { margin-top: 2.5rem; display: grid; gap: 0; }
.pub { padding: 1.5rem 0; border-top: 1px solid var(--rule); display: grid; gap: 0.35rem; }
.pub:last-child { border-bottom: 1px solid var(--rule); }
.pub-title { font-weight: 600; color: var(--ink); }
.pub-venue { font-size: 0.9rem; color: var(--ink-soft); }
.pub-note { font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); padding-block: 3rem 4rem; font-size: 0.9rem; color: var(--ink-faint); }
.foot-links { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-bottom: 1.2rem; }
.foot-links a { color: var(--ink); }

/* ---------- utility ---------- */
.btn {
  display: inline-block; padding: 0.6rem 1.15rem; border: 1px solid var(--ink);
  border-radius: 999px; color: var(--ink); font-size: 0.92rem; font-weight: 500;
}
.btn:hover { background: var(--ink); color: var(--bg); text-decoration: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.6rem 1rem; z-index: 50; border-radius: 6px; }

/* ---------- image grids ---------- */
.grid2, .grid3, .grid4 { display: grid; gap: 1rem; margin: 2.8rem 0; align-items: start; }
.grid2 { grid-template-columns: 1fr; }
.grid3, .grid4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 620px) { .grid2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) {
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .grid4 { grid-template-columns: repeat(4, 1fr); }
}
.grid2 > figure, .grid3 > figure, .grid4 > figure { margin: 0; }
.grid2 img, .grid3 img, .grid4 img { width: 100%; }

/* uniform-height row: letterbox mixed aspect ratios so captions line up */
.grid-even .shot > a, .grid-even > figure > img { height: clamp(220px, 26vw, 360px); }
.grid-even .shot > a { display: flex; align-items: center; justify-content: center; }
.grid-even img { width: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.case-body .grid2, .case-body .grid3, .case-body .grid4 { grid-column: 1 / -1; }

img.round { border-radius: 999px; aspect-ratio: 1; object-fit: cover; }

/* ---------- video ---------- */
video { width: 100%; height: auto; display: block; border-radius: 8px; background: #000; }

.next-case {
  margin-top: 3.5rem; padding-top: 1.6rem; border-top: 1px solid var(--rule);
  font-weight: 500;
}

/* ---------- screenshot plates (design work) ---------- */
.shot { margin: 0; }
.shot > a, .shot > .plate {
  display: block; position: relative; overflow: hidden;
  border: 1px solid var(--rule); border-radius: 10px; background: #fff;
}
.shot > a:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--rule)); text-decoration: none; }
.shot.tall > a { height: 480px; }   /* fixed, not max — keeps captions aligned across a row */
.shot.tall > a::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 88px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
  pointer-events: none;
}
.shot img { border-radius: 0; }
.shot figcaption { margin-top: 0.55rem; }
.shot-note { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.35rem; }

/* ---------- design-work page ---------- */
.proj { padding-block: var(--gap); }
.proj + .proj { border-top: 1px solid var(--rule); }
.proj-head { max-width: 660px; margin-bottom: 2.2rem; }
.proj-head h2 { margin-bottom: 0.8rem; }
.proj-head .tags { margin-top: 1.2rem; }
.proj-kind {
  font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin: 0 0 0.7rem;
}
.marks { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin: 2.4rem 0 0; }
.marks figure { margin: 0; }
.marks img { background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 1.4rem;
  height: clamp(150px, 18vw, 210px); width: 100%; object-fit: contain; }

.proj-sub {
  margin: 3rem 0 0.9rem; font-size: 1rem; font-weight: 650;
  color: var(--ink); letter-spacing: -0.01em;
}
.proj-sub + * { margin-top: 0.9rem; }
.proj .narrow { max-width: 660px; }
.proj .narrow + .grid2, .proj .narrow + .grid3, .proj .narrow + .grid4,
.proj .narrow + .shot { margin-top: 2rem; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(14, 13, 10, 0.92);
  /* flex-start + auto margins on the stage, NOT align-items:center: a centred flex item
     taller than its container overflows in both directions and its top can never be
     scrolled to. Full-length page shots are several thousand pixels tall. */
  display: none; align-items: flex-start; justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  overflow: auto;
  overscroll-behavior: contain;
}
/* the [hidden] attribute is what toggles it; never let display win over it */
.lightbox:not([hidden]) { display: flex; }
/* auto margins centre the stage when it fits and resolve to zero when it overflows */
.lb-stage { margin: auto; max-width: 100%; }
.lb-img {
  max-width: min(1400px, 100%);
  margin: 0 auto;
  border-radius: 6px;
  background: #fff;
}
.lb-cap {
  margin-top: 0.9rem; text-align: center;
  color: rgba(255, 255, 255, 0.72); font-size: 0.88rem; line-height: 1.5;
}
.lb-close, .lb-nav {
  position: fixed; z-index: 2;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px;
  cursor: pointer; font-family: inherit; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, 0.24); }
.lb-close:focus-visible, .lb-nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb-close { top: 1rem; right: 1rem; width: 2.6rem; height: 2.6rem; font-size: 1.6rem; padding-bottom: 0.15em; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 2.8rem; height: 2.8rem; font-size: 1.7rem; padding-bottom: 0.12em; }
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
@media (max-width: 640px) {
  .lb-nav { top: auto; bottom: 1rem; transform: none; }
}

/* cursor hint on the plates that open it */
.shot > a { cursor: zoom-in; }
