/* ============================================================
   style.css — Shared styles for ningyuansun.github.io
   ============================================================ */

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* TOKENS */
:root {
  --bg: #fafaf8;
  --surface: #f2f1ed;
  --ink: #1a1a18;
  --ink-muted: #6b6b67;
  --ink-faint: #b0afa9;
  --accent: #2d5a3d;
  --accent-light: #e8f0eb;
  --border: rgba(26,26,24,0.10);
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --max: 780px;
  --nav-h: 64px;
}

/* BASE */
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* NAV */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(250,250,248,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(1.5rem, 5vw, 3rem);
}
.nav-name {
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--accent); }
.nav-back {
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-decoration: none;
  display: flex; align-items: center; gap: 0.4rem;
  transition: color 0.2s;
}
.nav-back:hover { color: var(--accent); }

/* LAYOUT */
main { padding-top: var(--nav-h); }
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 6rem clamp(1.5rem, 5vw, 2rem);
}
.section + .section { border-top: 1px solid var(--border); }
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 5rem clamp(1.5rem, 5vw, 2rem) 8rem;
}

/* TYPOGRAPHY */
h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
h2 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.5vw, 2.2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 3rem;
  color: var(--ink);
}
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.3rem 0.75rem;
  border-radius: 2rem;
  margin-bottom: 1.75rem;
}
.section-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}

blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.75rem 0 0.75rem 1.5rem;
  font-style: italic;
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.8;
}

/* LINKS */
a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* TAGS */
.tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.2rem 0.55rem;
  border-radius: 2rem;
}
.project-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 0.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1f4129; text-decoration: none; }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--ink-muted); background: var(--surface); text-decoration: none; }

/* BACK LINK */
.back-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

/* PROJECT CARDS */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--surface);
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.25s, box-shadow 0.25s;
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.07);
}
.project-thumb {
  width: 100%;
  height: 180px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-body { padding: 1.25rem 1.5rem 1.5rem; flex: 1; display: flex; flex-direction: column; }
.project-title {
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.3;
  margin-bottom: 0.6rem;
  color: var(--ink);
}
.project-desc { font-size: 0.9rem; color: var(--ink-muted); line-height: 1.65; flex: 1; margin-bottom: 1rem; }
.project-link { font-size: 0.82rem; font-weight: 500; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; }
.project-link:hover { text-decoration: underline; }

/* PROJECT PAGE */
.project-intro { font-size: 1rem; color: var(--ink-muted); line-height: 1.8; margin-bottom: 1rem; }
.project-intro a { color: var(--accent); }
.project-meta {
  display: flex; gap: 2rem; flex-wrap: wrap;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}
.meta-item { display: flex; flex-direction: column; gap: 0.15rem; }
.meta-label { font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.meta-value { font-size: 0.9rem; color: var(--ink); }
.project-links { display: flex; gap: 0.75rem; flex-wrap: wrap; padding-top: 2rem; border-top: 1px solid var(--border); margin-top: 2rem; }

/* DESCRIPTION BLOCKS */
.description { margin: 1.5rem 0; }
.description p { font-size: 1rem; color: var(--ink-muted); line-height: 1.8; margin-bottom: 1rem; }
.description a { color: var(--accent); }
.description h2 { font-family: var(--serif); font-size: 1.4rem; letter-spacing: -0.01em; margin-bottom: 1rem; color: var(--ink); }

/* IMAGES */
.full-img {
  width: 100%; height: auto; display: block;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}
.media-caption { font-size: 0.83rem; color: var(--ink-faint); margin-top: 0.6rem; line-height: 1.5; font-style: italic; }

/* VIDEO */
.video-section { margin: 2rem 0 2.5rem; }
.video-facade {
  aspect-ratio: 16/9; border-radius: 0.5rem; overflow: hidden;
  background: #000; cursor: pointer; position: relative;
}
.video-facade img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.2s; }
.video-facade:hover img { opacity: 0.85; }
.video-facade .play-btn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.video-facade .play-btn svg { width: 68px; height: 68px; filter: drop-shadow(0 2px 12px rgba(0,0,0,0.5)); transition: transform 0.2s; }
.video-facade:hover .play-btn svg { transform: scale(1.08); }
.video-embed { aspect-ratio: 16/9; border-radius: 0.5rem; overflow: hidden; }
.video-embed iframe { width: 100%; height: 100%; border: none; display: block; }

/* PUBLICATIONS */
.pub-list { display: flex; flex-direction: column; gap: 0; }
.pub-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0 1.25rem;
  align-items: start;
}
.pub-year { font-size: 0.78rem; font-weight: 500; color: var(--ink-faint); padding-top: 0.2rem; letter-spacing: 0.04em; }
.pub-title { font-weight: 500; font-size: 0.95rem; line-height: 1.45; color: var(--ink); margin-bottom: 0.3rem; }
.pub-venue { font-size: 0.85rem; color: var(--ink-muted); font-style: italic; }
.pub-meta { font-size: 0.82rem; color: var(--ink-faint); margin-top: 0.2rem; }
.pub-links { display: flex; gap: 0.75rem; margin-top: 0.6rem; }
.pub-link { font-size: 0.78rem; font-weight: 500; color: var(--accent); text-decoration: none; letter-spacing: 0.02em; }
.pub-link:hover { text-decoration: underline; }

/* MASONRY GALLERY */
.masonry { columns: 2 280px; column-gap: 1rem; margin-top: 0.5rem; }
.masonry-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.masonry-item img { width: 100%; height: auto; display: block; }
.masonry-caption {
  padding: 0.65rem 0.9rem 0.75rem;
  font-size: 0.82rem; color: var(--ink-faint);
  line-height: 1.5; font-style: italic;
  border-top: 1px solid var(--border);
}

/* LIGHTBOX */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(10,10,8,0.88);
  align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: min(90vw, 1100px); max-height: 88vh; border-radius: 0.35rem; object-fit: contain; box-shadow: 0 24px 80px rgba(0,0,0,0.5); }
.lightbox-caption {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  background: rgba(10,10,8,0.7); color: #e8e8e4;
  font-size: 0.82rem; font-style: italic;
  padding: 0.4rem 1rem; border-radius: 2rem;
  white-space: nowrap; max-width: 80vw;
  overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.lightbox-close {
  position: absolute; top: 1.25rem; right: 1.5rem;
  background: none; border: none; cursor: pointer;
  color: #e8e8e4; font-size: 1.5rem; line-height: 1;
  opacity: 0.7; transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

/* CONTACT */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.contact-intro { font-size: 1rem; color: var(--ink-muted); line-height: 1.75; }
.contact-details { display: flex; flex-direction: column; gap: 1rem; }
.contact-row { display: flex; flex-direction: column; gap: 0.15rem; }
.contact-label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.contact-value { font-size: 0.95rem; color: var(--ink); text-decoration: none; }
a.contact-value:hover { color: var(--accent); text-decoration: underline; }

/* FOOTER */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem clamp(1.5rem, 5vw, 3rem);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem;
}
.footer-copy { font-size: 0.82rem; color: var(--ink-faint); }

/* ANIMATIONS */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.6s ease both; }
.hero-fade > * { animation: fadeUp 0.7s ease both; }
.hero-fade > *:nth-child(1) { animation-delay: 0.05s; }
.hero-fade > *:nth-child(2) { animation-delay: 0.15s; }
.hero-fade > *:nth-child(3) { animation-delay: 0.25s; }
.hero-fade > *:nth-child(4) { animation-delay: 0.35s; }

/* RESPONSIVE */
@media (max-width: 600px) {
  .hero-inner { flex-direction: column-reverse; gap: 2rem; }
  .hero-photo-wrap { width: 100%; }
  .hero-photo, .hero-photo-placeholder { width: 100%; height: 220px; }
}
@media (max-width: 560px) {
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .nav-links { gap: 1.25rem; }
  .nav-links a { font-size: 0.78rem; }
  .masonry { columns: 1; }
}

figure.zoomable { cursor: zoom-in; }

.contact-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-card:hover {
  border-color: var(--ink-faint);
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  text-decoration: none;
}
.contact-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
}