/* ═══════════════════════════════════════════
   linghuijin.art — Portfolio (Upgraded v3)
   ═══════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --bg-warm: #f6f4f0;
  --ink: #1a1a1e;
  --stone: #7d7872;
  --red: #c23c2e;
  --line: #e5e0d9;
  --serif: 'Cormorant Garamond', 'Noto Serif SC', Georgia, serif;
  --sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 48px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.nav-links {
  display: flex;
  gap: 8px;
}
.nav-links a {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--stone);
  padding: 6px 14px;
  border-radius: 4px;
  transition: color 0.25s, background 0.25s;
  letter-spacing: 0.01em;
}
.nav-links a:hover {
  color: var(--ink);
  background: var(--bg-warm);
}
.nav-links a.active {
  color: var(--red);
}

/* Hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.3s;
}

/* ── Hero ── */
.hero {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 420px;
  max-height: 700px;
  overflow: hidden;
  background: #111;
}
.hero-ink {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
/* Ink wash effect — layered animated gradients */
.hero-ink::before,
.hero-ink::after {
  content: '';
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
}
.hero-ink::before {
  background:
    radial-gradient(ellipse 40% 50% at 20% 50%, rgba(194,60,46,0.15) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 70% 30%, rgba(60,60,80,0.3) 0%, transparent 70%),
    radial-gradient(ellipse 60% 45% at 50% 80%, rgba(40,40,50,0.25) 0%, transparent 70%);
  animation: inkDrift1 20s ease-in-out infinite;
}
.hero-ink::after {
  background:
    radial-gradient(ellipse 45% 55% at 80% 60%, rgba(194,60,46,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 30% 70%, rgba(50,50,65,0.2) 0%, transparent 65%),
    radial-gradient(circle 30% at 60% 40%, rgba(30,30,40,0.15) 0%, transparent 60%);
  animation: inkDrift2 25s ease-in-out infinite;
}
@keyframes inkDrift1 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(5%, -3%) rotate(1deg); }
  66% { transform: translate(-3%, 4%) rotate(-0.5deg); }
}
@keyframes inkDrift2 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-4%, 3%) rotate(0.8deg); }
}
/* Ink splatter shapes */
.ink-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0;
  animation: blobPulse 12s ease-in-out infinite;
}
.ink-blob:nth-child(1) {
  width: 300px; height: 300px;
  left: 15%; top: 20%;
  background: rgba(194,60,46,0.12);
  animation-delay: 0s;
}
.ink-blob:nth-child(2) {
  width: 400px; height: 350px;
  right: 10%; top: 30%;
  background: rgba(40,40,55,0.18);
  animation-delay: 4s;
}
.ink-blob:nth-child(3) {
  width: 250px; height: 280px;
  left: 40%; bottom: 10%;
  background: rgba(100,90,80,0.12);
  animation-delay: 8s;
}
@keyframes blobPulse {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
}
.hero-content h1 {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 400;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  text-shadow: 0 2px 40px rgba(0,0,0,0.3);
}
.hero-content p {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 300;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.15em;
}
.hero-line {
  width: 40px;
  height: 1px;
  background: var(--red);
  margin-top: 28px;
  opacity: 0.7;
}

/* ── Portfolio Filter Bar ── */
.filter-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}
.filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--stone);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.02em;
}
.filter-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ── Portfolio Grid ── */
.portfolio-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 56px 48px 80px;
}
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.portfolio-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  background: var(--bg-warm);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.portfolio-item.hidden {
  display: none;
}
.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.5s;
}
.portfolio-item .overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,26,30, 0);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  transition: background 0.4s;
}
.portfolio-item .overlay .title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: #fff;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.35s 0.05s;
}
.portfolio-item .overlay .category {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  margin-top: 4px;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.35s 0.1s;
}
.portfolio-item:hover img {
  transform: scale(1.04);
}
.portfolio-item:hover .overlay {
  background: rgba(26,26,30, 0.55);
}
.portfolio-item:hover .overlay .title,
.portfolio-item:hover .overlay .category {
  transform: translateY(0);
  opacity: 1;
}

/* ── Project Detail ── */
.project-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 48px 80px;
}
.project-header {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.project-header h2 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}
.project-header .subtitle {
  font-size: 14px;
  color: var(--stone);
  letter-spacing: 0.02em;
}
.project-page p {
  font-size: 15px;
  line-height: 1.75;
  color: #4a4a4a;
  margin-bottom: 20px;
  max-width: 680px;
}
.project-page h3 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--ink);
  margin: 48px 0 16px;
}
.project-page h3:first-of-type {
  margin-top: 32px;
}

/* Image layouts + zoom cursor */
.project-page img {
  cursor: zoom-in;
  transition: opacity 0.2s;
}
.project-page img:hover {
  opacity: 0.95;
}
.img-full {
  margin: 20px 0;
}
.img-full img {
  width: 100%;
  display: block;
}
.img-row {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}
.img-row img {
  flex: 1;
  min-width: 0;
  object-fit: cover;
}
.img-row.two img { width: calc(50% - 6px); flex: none; }
.img-row.three img { width: calc(33.333% - 8px); flex: none; }
.img-row.symbols {
  justify-content: center;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.img-row.symbols img {
  flex: none;
  width: auto;
  max-height: 140px;
}

/* Prev / Next */
.project-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.project-nav-bar a {
  font-size: 14px;
  color: var(--stone);
  transition: color 0.25s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.project-nav-bar a:hover {
  color: var(--red);
}
.project-nav-bar .arrow {
  font-size: 18px;
  line-height: 1;
}

/* ── Lightbox Modal ── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 18, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 32px;
}
.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  cursor: zoom-out;
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
}
.lightbox-close:hover {
  color: #fff;
}

/* ── Simple pages ── */
.simple-page {
  max-width: 700px;
  margin: 0 auto;
  padding: 80px 48px 120px;
}
.simple-page h2 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 32px;
}
.simple-page p {
  font-size: 15px;
  line-height: 1.75;
  color: #4a4a4a;
  margin-bottom: 16px;
}
.simple-page a {
  color: var(--red);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}
.simple-page a:hover {
  border-bottom-color: var(--red);
}
.placeholder-notice {
  display: inline-block;
  padding: 12px 20px;
  background: var(--bg-warm);
  border-radius: 6px;
  font-size: 14px;
  color: var(--stone);
  margin-top: 8px;
}

/* ── Footer ── */
.site-footer {
  padding: 32px 48px;
  text-align: center;
  font-size: 12px;
  color: #bbb;
  border-top: 1px solid var(--line);
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .header-inner { padding: 0 32px; }
  .portfolio-section { padding: 48px 32px 64px; }
  .project-page { padding: 40px 32px 64px; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 16px 32px 24px;
    border-bottom: 1px solid var(--line);
    gap: 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a {
    padding: 12px 0;
    font-size: 16px;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-links a:last-child { border-bottom: none; }

  .hero {
    height: 55vh;
    min-height: 320px;
  }
  .hero-content h1 { font-size: 38px; }
  .hero-content p { font-size: 13px; letter-spacing: 0.1em; }

  .portfolio-grid { grid-template-columns: 1fr; gap: 16px; }
  .portfolio-section { padding: 32px 20px 48px; }
  .header-inner { padding: 0 20px; }

  .project-page { padding: 32px 20px 48px; }
  .project-header h2 { font-size: 28px; }
  .project-page h3 { font-size: 20px; margin-top: 36px; }
  .img-row { flex-direction: column; gap: 12px; }
  .img-row.two img,
  .img-row.three img { width: 100%; }
  .img-row.symbols { gap: 20px; }

  .simple-page { padding: 48px 20px 80px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-ink::before,
  .hero-ink::after,
  .ink-blob {
    animation: none !important;
  }
  .portfolio-item img { transition: none; }
}
