/* ============================================================
   Yiwei Wang — shared site styles  (dark theme)
   ============================================================ */

/* ---------- Self-hosted fonts (no external CDN) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300; font-display: swap; src: url(fonts/inter-latin-300-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/playfair-display-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/playfair-display-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/playfair-display-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/playfair-display-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/playfair-display-latin-400-italic.woff2) format("woff2"); }

:root {
  --bg: #2b2b30;
  --fg: #ededed;
  --muted: #9a9aa2;
  --line: rgba(255, 255, 255, .14);
  --panel: rgba(255, 255, 255, .05);
  --accent: #9bb4e0;
  --max: 1200px;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.65;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.14; margin: 0; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--pad); }
.eyebrow {
  font-size: .72rem; letter-spacing: .28em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 1rem;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; color: var(--fg);
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(1.7rem, 3vw, 2.6rem) var(--pad) 1.1rem;
  background: rgba(43, 43, 48, 0);
  transition: background .3s ease, box-shadow .3s ease;
}
.site-header.solid { background: rgba(33, 33, 37, .78); backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--line); }
.brand { font-family: var(--serif); font-size: 1.18rem; letter-spacing: .02em; }
.nav { display: flex; gap: clamp(1rem, 3vw, 2.5rem); list-style: none; margin: 0; padding: 0; }
.nav a {
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  padding-block: .25rem; color: var(--fg); opacity: .85; transition: opacity .2s ease;
}
.nav a:hover, .nav a:focus-visible { opacity: 1; }
.nav-toggle { display: none; }

/* Header nav: elegant serif with vertical separators (matches original) */
.site-header .nav { gap: clamp(.9rem, 1.8vw, 1.5rem); align-items: center; }
.site-header .nav li { display: flex; align-items: center; }
.site-header .nav li + li::before {
  content: ""; width: 1px; height: .95em; background: currentColor; opacity: .4;
  margin-right: clamp(.9rem, 1.8vw, 1.5rem);
}
.site-header .nav a {
  font-family: var(--serif); font-weight: 500; text-transform: uppercase;
  font-size: 1.02rem; letter-spacing: .1em;
}
.lang-toggle {
  font-family: var(--serif); font-weight: 500; text-transform: uppercase;
  font-size: .82rem; letter-spacing: .12em; color: var(--fg);
  background: none; border: 1px solid currentColor; border-radius: 999px;
  padding: .3rem .85rem; margin-left: .4rem; cursor: pointer; opacity: .85;
  transition: opacity .2s ease, background-color .2s ease, color .2s ease;
}
.lang-toggle:hover, .lang-toggle:focus-visible { opacity: 1; background: var(--fg); color: var(--bg); }
/* no separator line right before the boxed toggle */
.site-header .nav li:last-child::before { content: none; }

/* ---------- Page intro (left-aligned) ---------- */
.page-head { padding: calc(5.5rem + 2vw) 0 0; }
.page-head .wrap { max-width: var(--max); text-align: left; }
.page-head h1 {
  font-family: var(--sans); font-weight: 400;
  font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: .01em; color: #bcbcc3;
}
.page-head p { color: var(--muted); margin: .9rem 0 0; }

section { padding-block: clamp(3rem, 7vw, 6rem); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: clamp(3rem, 6vw, 4.5rem); margin-top: clamp(3rem, 7vw, 6rem); }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1fr auto; align-items: stretch; } }
.footer-left { display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem; }
.site-footer .brand { color: var(--fg); }
.site-footer address { font-style: normal; font-size: .9rem; line-height: 1.8; margin-top: .75rem; color: var(--muted); }
.site-footer a:hover { color: var(--fg); }
.copyright { margin: 0; font-size: .78rem; color: var(--muted); }

/* ---------- Mobile nav ---------- */
@media (max-width: 720px) {
  /* Always-open, stacked nav — no hamburger toggle */
  .nav-toggle { display: none; }
  .site-header {
    position: relative; flex-direction: column; align-items: stretch; gap: 1.5rem;
    background: var(--bg); padding-block: 1.5rem 2rem;
  }
  .nav {
    flex-direction: column; align-items: center; gap: 1.8rem;
    position: static; background: none; box-shadow: none; padding: 0;
  }
  .site-header .nav a { font-size: 1.2rem; padding-block: 0; }
  /* language toggle pinned to the top-right corner (next to the logo) */
  .site-header .nav li:last-child { position: absolute; top: 1rem; right: var(--pad); left: auto; margin: 0; }
  .site-header .nav .lang-toggle { font-size: .92rem; margin: 0; }
  .site-header .nav li { display: block; }
  .site-header .nav li + li::before { display: none; }
  /* header is static on mobile, so the page intro no longer needs to clear a fixed bar */
  .page-head { padding-top: 1.25rem; }
}

/* ---------- Project / detail pages ---------- */
.project-video { background: #000; }
.project-video .wrap { max-width: 1320px; padding-block: calc(4.5rem + 1vw) 0; }
.project-video video {
  width: 100%; max-height: 82svh; aspect-ratio: 16 / 9; object-fit: contain;
  background: #000; border-radius: 4px;
}
.project-intro { max-width: 60ch; }
.project-intro h1 { font-size: clamp(2.2rem, 5.5vw, 3.5rem); }
.project-intro .meta { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; margin-top: .6rem; }

/* stacked concept-art panels (each artwork already carries its own text) */
.panels { display: flex; flex-direction: column; gap: clamp(1rem, 3vw, 2rem); }
.panels img { width: 100%; height: auto; border-radius: 4px; background: var(--panel); }
.panels a { display: block; }

/* uniform-height gallery: every image shares one height baseline, full art preserved */
.masonry { display: flex; flex-wrap: wrap; gap: 1rem; }
.masonry a {
  display: block; height: clamp(190px, 24vw, 300px);
  border-radius: 4px; overflow: hidden; background: var(--panel);
}
.masonry img { height: 100%; width: auto; border-radius: 4px; transition: transform .4s ease, filter .3s ease; }
.masonry a:hover img { transform: scale(1.04); filter: brightness(1.08); }

.work { margin-top: clamp(2.5rem, 6vw, 4.5rem); }
.work:first-of-type { margin-top: clamp(1.5rem, 4vw, 3rem); }
.work__title { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.work__title h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
.work__title .meta { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.feature { max-width: 720px; }
.feature.wide { max-width: 100%; }
.feature img { width: 100%; height: auto; border-radius: 4px; }

/* ---------- Inline carousel (main image + thumbnail rail) ---------- */
.rcar { display: flex; align-items: center; justify-content: center; gap: clamp(.5rem, 2vw, 1.5rem); }
.rcar__main { height: min(76vh, 660px); width: auto; max-width: 100%; display: block; border-radius: 2px; cursor: zoom-in; }
.rcar__nav {
  flex: 0 0 auto; background: none; border: 0; color: var(--fg); cursor: pointer;
  font-family: var(--serif); font-size: 2.2rem; line-height: 1; padding: .3rem .55rem;
  opacity: .6; transition: opacity .2s ease;
}
.rcar__nav:hover, .rcar__nav:focus-visible { opacity: 1; }
.rcar__thumbs {
  --th: clamp(98px, 10vw, 134px); --tg: .55rem;
  display: flex; flex-direction: column; gap: var(--tg);
  /* show 4 full thumbs + half of the next, so it's clear more lie below */
  max-height: calc(var(--th) * 4.5 + var(--tg) * 4);
  /* extra room below so the last thumbs can still scroll to the centre */
  padding-bottom: calc(var(--th) * 2);
  overflow-y: auto; scrollbar-width: none; /* Firefox: hide scrollbar */
}
.rcar__thumbs::-webkit-scrollbar { display: none; } /* WebKit: hide scrollbar */
.rcar__thumb { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; flex: 0 0 auto; }
.rcar__thumb img { height: var(--th); width: auto; display: block; opacity: .4; transition: opacity .2s ease; }
.rcar__thumb[aria-current="true"] img { opacity: 1; outline: 1px solid rgba(255,255,255,.85); outline-offset: 1px; }
.rcar__thumb:hover img { opacity: .85; }
@media (max-width: 640px) {
  /* stacked: main image, then the ‹ › arrows, then a horizontal thumbnail strip */
  .rcar { flex-wrap: wrap; justify-content: center; gap: .9rem 1.8rem; }
  .rcar__main-link { order: 1; flex-basis: 100%; display: flex; justify-content: center; }
  .rcar__main { width: 100%; height: auto; }
  .rcar__prev { order: 2; }
  .rcar__next { order: 3; }
  .rcar__thumbs {
    order: 4; flex-basis: 100%; width: 100%;
    flex-direction: row; max-height: none;
    overflow-x: auto; overflow-y: hidden;
    padding: 0 45vw 0 0; /* end room so the last thumb can still centre */
  }
}

/* ---------- Lightbox (in-page gallery viewer) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30, 32, 37, .98);
  display: none; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s ease;
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox__img {
  max-width: min(88vw, 1200px); max-height: 86svh;
  width: auto; height: auto; object-fit: contain; user-select: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.lightbox__btn {
  position: absolute; background: none; border: 0; color: #fff; cursor: pointer;
  opacity: .65; transition: opacity .2s ease; line-height: 1; -webkit-tap-highlight-color: transparent;
}
.lightbox__btn:hover, .lightbox__btn:focus-visible { opacity: 1; }
.lightbox__prev, .lightbox__next { top: 50%; transform: translateY(-50%); font-size: 2.8rem; padding: .5rem 1rem; font-family: var(--serif); }
.lightbox__prev { left: clamp(.25rem, 3vw, 2.5rem); }
.lightbox__next { right: clamp(.25rem, 3vw, 2.5rem); }
.lightbox__close { top: 1rem; right: 1.3rem; font-size: 2rem; }
.lightbox__bar { position: absolute; top: 1.2rem; left: clamp(1rem, 4vw, 2.5rem); color: #fff; pointer-events: none; }
.lightbox__title { font-family: var(--serif); font-size: 1.15rem; letter-spacing: .02em; }
.lightbox__count { font-size: .76rem; color: #b9b9c0; letter-spacing: .14em; margin-top: .25rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
