/* =========================================================
   Zhe Ren — portfolio
   Minimal, image-first, zero web-font dependency.
   ========================================================= */

:root {
  --bg: #f6f5f2;
  --bg-alt: #ffffff;
  --ink: #161513;
  --muted: #6f6b64;
  --line: #e2dfd8;
  --accent: #161513;
  --maxw: 1240px;
  --gap: clamp(14px, 2.4vw, 28px);
  --serif: Georgia, "Times New Roman", "Songti SC", serif;
  --sans: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 48px); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0 0 .4em; }
.page-title { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: -.01em; }
.eyebrow {
  font-family: var(--sans);
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 1rem;
}
.lead { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--ink); }
.prose { max-width: 64ch; }
.prose p { margin: 0 0 1.2em; }
.muted { color: var(--muted); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246,245,242,.88);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--serif); font-size: 1.18rem; letter-spacing: .02em;
}
.brand:hover { text-decoration: none; }
.nav-links {
  display: flex; align-items: center; gap: clamp(16px, 2.4vw, 34px);
  list-style: none; margin: 0; padding: 0;
}
.nav-links a {
  font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  padding: 6px 0; position: relative;
}
.nav-links a:hover { text-decoration: none; color: var(--muted); }
.nav-links a.active { border-bottom: 1px solid var(--ink); }

/* Dropdown */
.has-dropdown { position: relative; }
.dropdown {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(6px);
  background: var(--bg-alt); border: 1px solid var(--line);
  min-width: 210px; padding: 8px 0; list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transition: opacity .16s ease, transform .16s ease;
  box-shadow: 0 14px 40px rgba(0,0,0,.10);
}
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.dropdown a { display: block; padding: 8px 18px; letter-spacing: .08em; }
.dropdown a:hover { background: var(--bg); text-decoration: none; }

.nav-toggle {
  display: none; background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px; padding: 8px; color: var(--ink);
}
.nav-toggle span { display: block; height: 1.5px; background: currentColor; margin: 5px 0; transition: .25s; }

/* ---------- Hero ---------- */
.hero { position: relative; height: min(86vh, 760px); overflow: hidden; background: #111; }
.hero img { width: 100%; height: 100%; object-fit: cover; opacity: .92; }
.hero-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  justify-content: flex-end; padding: clamp(24px, 6vw, 72px);
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,.05) 45%, rgba(0,0,0,.15));
  color: #fff;
}
.hero-overlay .hero-name { font-family: var(--serif); font-size: clamp(2.4rem, 7vw, 5rem); margin: 0; line-height: 1; }
.hero-overlay .hero-sub { font-size: .8rem; letter-spacing: .26em; text-transform: uppercase; margin-top: .9rem; opacity: .9; }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 8vw, 110px) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: clamp(22px, 4vw, 44px); flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin: 0; }
.link-arrow { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.pullquote {
  font-family: var(--serif); font-size: clamp(1.4rem, 3.4vw, 2.3rem);
  line-height: 1.35; max-width: 22ch; margin: 0 auto; text-align: center;
}
.pullquote .by { display: block; font-family: var(--sans); font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-top: 1.4rem; }

/* ---------- Series / work grid ---------- */
.series-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.series-card { display: block; position: relative; overflow: hidden; background: #ddd; }
.series-card:hover { text-decoration: none; }
.series-card .ratio { aspect-ratio: 4 / 3; overflow: hidden; }
.series-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.series-card:hover img { transform: scale(1.045); }
.series-card .cap {
  position: absolute; left: 0; bottom: 0; right: 0; padding: 18px 20px;
  background: linear-gradient(to top, rgba(0,0,0,.62), rgba(0,0,0,0));
  color: #fff;
}
.series-card .cap h3 { font-size: 1.3rem; margin: 0; color: #fff; }
.series-card .cap .meta { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; opacity: .85; }

/* ---------- Gallery (series pages) ---------- */
.gallery {
  columns: 3 280px; column-gap: var(--gap);
}
.gallery figure { break-inside: avoid; margin: 0 0 var(--gap); cursor: zoom-in; }
.gallery figure img { width: 100%; background: #e8e6e1; transition: filter .3s ease; }
.gallery figure:hover img { filter: brightness(.92); }
.gallery figcaption { padding: 8px 2px 0; font-size: .8rem; color: var(--muted); }
.gallery figcaption .t { color: var(--ink); font-style: italic; }

/* ---------- Video grid ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.video-embed {
  position: relative; aspect-ratio: 16 / 9; background: #111; cursor: pointer; overflow: hidden;
  border: 0; padding: 0; width: 100%; display: block;
}
.video-embed img { width: 100%; height: 100%; object-fit: cover; opacity: .8; transition: opacity .3s, transform .6s; }
.video-embed:hover img { opacity: .65; transform: scale(1.04); }
.video-embed .play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; transition: background .2s, transform .2s;
}
.video-embed:hover .play { background: rgba(0,0,0,.78); transform: scale(1.06); }
.video-embed .play svg { width: 22px; height: 22px; margin-left: 3px; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-label { font-size: .78rem; color: var(--muted); margin-top: 8px; }
.video-file { width: 100%; aspect-ratio: 16 / 9; background: #0c0c0c; display: block; object-fit: contain; }

/* ---------- Interactive embed ---------- */
.interactive-embed {
  position: relative;
  width: 100vw; margin-left: calc(50% - 50vw);   /* full-bleed, edge to edge */
  height: min(90vh, 960px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: #0c0c0c; overflow: hidden;
}
.interactive-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.interactive-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.interactive-meta .t { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.interactive-meta .m { color: var(--muted); font-size: .85rem; }
.interactive-meta a { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
@media (max-width: 560px) { .interactive-embed { height: min(82vh, 720px); } }

/* ---------- About / two-col ---------- */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.about-grid .portrait img { width: 100%; }
.statement { font-size: 1.05rem; }
.statement .xiang { font-family: var(--serif); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem; }
.btn {
  display: inline-block; border: 1px solid var(--ink); padding: 11px 20px;
  font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink);
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--ink); color: var(--bg); text-decoration: none; }

/* ---------- CV ---------- */
.cv-block { margin-bottom: clamp(34px, 5vw, 56px); }
.cv-block h2 { font-size: 1.4rem; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 18px; }
.cv-entry { display: grid; grid-template-columns: 90px 1fr; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cv-entry .yr { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .92rem; }
.cv-entry .what strong { font-weight: 600; }
.cv-list { list-style: none; padding: 0; margin: 0; }
.cv-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 72px); }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); background: var(--bg-alt);
  font: inherit; color: var(--ink); border-radius: 0;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
.contact-list { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.contact-list li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.contact-list .k { display: inline-block; min-width: 110px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-size: .72rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); letter-spacing: .04em; }
.footer-inner a:hover { color: var(--ink); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(16,15,13,.96); padding: 4vh 4vw;
}
.lightbox.open { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox img { max-width: 92vw; max-height: 78vh; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .lb-cap { color: #f3f1ec; text-align: center; margin-top: 18px; max-width: 70ch; }
.lightbox .lb-cap .t { font-family: var(--serif); font-style: italic; font-size: 1.1rem; }
.lightbox .lb-cap .m { display: block; font-size: .82rem; color: #b8b3aa; letter-spacing: .04em; margin-top: 4px; }
.lb-btn {
  position: absolute; background: none; border: 0; color: #fff; cursor: pointer;
  font-size: 2rem; line-height: 1; padding: 12px; opacity: .8;
}
.lb-btn:hover { opacity: 1; }
.lb-close { top: 10px; right: 16px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); font-size: 2.6rem; }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); font-size: 2.6rem; }
.lb-count { position: absolute; top: 18px; left: 22px; color: #b8b3aa; font-size: .8rem; letter-spacing: .1em; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: 64px 0 auto 0; flex-direction: column; align-items: flex-start;
    gap: 0; background: var(--bg-alt); border-bottom: 1px solid var(--line);
    padding: 8px 0; transform: translateY(-120%); transition: transform .28s ease;
    height: auto; max-height: calc(100vh - 64px); overflow:auto;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links > li { width: 100%; }
  .nav-links a { display: block; padding: 14px clamp(18px,4vw,48px); width: 100%; }
  .nav-links a.active { border-bottom: 0; color: var(--muted); }
  .dropdown {
    position: static; transform: none; opacity: 1; visibility: visible;
    box-shadow: none; border: 0; min-width: 0; padding: 0 0 8px;
  }
  .dropdown a { padding-left: clamp(34px,8vw,64px); font-size: .8rem; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .about-grid .portrait { order: -1; }
}
@media (max-width: 560px) {
  .series-grid { grid-template-columns: 1fr; }
  .cv-entry { grid-template-columns: 64px 1fr; gap: 12px; }
  .lb-prev, .lb-next { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
