@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* =========================================================
   Wanling Yu — Portfolio
   Style: insdim-inspired (left sidebar + minimal grid)
   Typography: DM Sans + IBM Plex Mono
   Palette: near-white canvas + deep navy ink
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-tint: #f6f9fc;
  --ink: #061b31;          /* Stripe Deep Navy */
  --ink-soft: #3a4562;
  --muted: #64748d;        /* Stripe Slate */
  --line: #e5edf5;         /* Stripe border */
  --accent: #533afd;       /* Stripe Purple */
  --link: #061b31;
  --hover: #533afd;
  --shadow-sm: 0 2px 5px rgba(50, 50, 93, 0.06), 0 1px 2px rgba(50, 50, 93, 0.08);
  --shadow-md: 0 7px 14px rgba(50, 50, 93, 0.08), 0 3px 6px rgba(50, 50, 93, 0.05);
  --shadow-lg: 0 15px 35px rgba(50, 50, 93, 0.10), 0 5px 15px rgba(0, 0, 0, 0.05);
  --sidebar-w: 240px;
  --page-max: 1400px;
  --pad-x: 48px;
  --pad-y: 40px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  font-feature-settings: "ss01", "tnum";
  letter-spacing: 0.012em;
  word-spacing: 0.04em;
}

a { color: var(--link); text-decoration: none; transition: opacity 0.15s ease; }
a:hover { opacity: 0.55; }

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

/* =========================================================
   Layout — sidebar + main
   ========================================================= */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  padding: var(--pad-y) 32px;
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg);
}

.brand {
  display: block;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 48px;
}
.brand .brand-sub {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: -0.005em;
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  color: var(--muted);
  position: relative;
}
.nav a::after {
  content: "→";
  display: inline-block;
  margin-left: 8px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav a:hover::after {
  opacity: 1;
  transform: translateX(0);
}
.nav a:hover { opacity: 1; color: var(--ink); font-weight: 600; }
.nav a.active {
  font-weight: 600;
  color: var(--ink);
}

.sidebar-foot {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.02em;
}
.sidebar-foot p { margin-bottom: 4px; }

/* ---------- Main ---------- */
.main {
  padding: var(--pad-y) var(--pad-x);
  max-width: var(--page-max);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-header h1 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
}
.page-header .page-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* =========================================================
   Filter tabs
   ========================================================= */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.filter-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s ease;
}
.filter-btn:hover { color: var(--ink); }
.filter-btn.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2px;
}
.filter-btn .count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-left: 4px;
  vertical-align: super;
}

/* =========================================================
   Project grid
   ========================================================= */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px 32px;
}
@media (max-width: 1100px) {
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .projects-grid { grid-template-columns: 1fr; gap: 32px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: row; justify-content: flex-start; gap: 24px; padding: 24px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 16px; }
  :root { --pad-x: 24px; --pad-y: 24px; }
}

.project-card {
  display: block;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.project-card:hover { transform: translateY(-4px); }
.project-card:hover .project-thumb {
  box-shadow: var(--shadow-lg);
}
.project-card:hover .project-thumb img { transform: scale(1.03); }

.project-card[href="#"],
.project-card:not([href]) {
  cursor: default;
  pointer-events: none;
}
.project-card[href="#"]:hover,
.project-card:not([href]):hover {
  transform: none;
  opacity: 1;
}
.project-card[href="#"]:hover .project-thumb,
.project-card:not([href]):hover .project-thumb {
  box-shadow: var(--shadow-sm);
}
.project-card[href="#"]:hover .project-thumb img,
.project-card:not([href]):hover .project-thumb img {
  transform: none;
}

.project-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-tint);
  margin-bottom: 16px;
  position: relative;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.project-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.project-thumb.placeholder span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.project-thumb.placeholder-ink {
  background: #0a0a0a;
}
.project-thumb.placeholder-ink span {
  color: #fafaf8;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.project-title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
  margin-bottom: 8px;
  color: var(--ink);
  transition: color 0.2s ease;
}

.project-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

/* =========================================================
   About page
   ========================================================= */

.about-hero {
  max-width: 760px;
  margin-bottom: 72px;
}
.about-hero h2 {
  font-size: 48px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink);
}
.about-hero h2 em {
  font-style: italic;
  font-weight: 400;
}

.about-section {
  max-width: 680px;
  margin-bottom: 56px;
}
.about-section h3 {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  font-family: 'IBM Plex Mono', monospace;
}
.about-section p {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.005em;
  line-height: 1.85;
  color: var(--ink);
  margin-bottom: 22px;
}
.about-section p.quiet {
  color: var(--muted);
  font-size: 15px;
}

.bio-block {
  max-width: 680px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.bio-block p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.bio-block a { border-bottom: 1px solid var(--line); }
.bio-block a:hover { border-bottom-color: var(--ink); opacity: 1; }

/* =========================================================
   News list
   ========================================================= */

.news-list {
  list-style: none;
  max-width: 920px;
}
.news-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.news-item:first-child { border-top: 1px solid var(--line); }
.news-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  padding-top: 4px;
}
.news-title {
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.55;
}
.news-source {
  font-size: 13px;
  color: var(--muted);
}
.news-source a { border-bottom: 1px solid var(--line); }

/* =========================================================
   Contact
   ========================================================= */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 48px;
  max-width: 680px;
}
.contact-block h3 {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  font-family: 'IBM Plex Mono', monospace;
}
.contact-block a,
.contact-block p {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.6;
}
.contact-block a { border-bottom: 1px solid var(--line); }
.contact-block a:hover { border-bottom-color: var(--ink); opacity: 1; }

@media (max-width: 700px) {
  .contact-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-hero h2 { font-size: 32px; }
  .about-section p { font-size: 16px; }
  .news-item { grid-template-columns: 1fr; gap: 8px; }
}

/* =========================================================
   Project Detail Page
   ========================================================= */

.back-link {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 24px;
  margin-bottom: 64px;
}

.detail-hero {
  max-width: 880px;
  margin-bottom: 48px;
}
.detail-hero .detail-subtitle {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}
.detail-hero h1 {
  font-size: 64px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 32px;
}
.detail-hero .detail-tagline {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.005em;
  color: var(--ink-soft);
  line-height: 1.75;
  max-width: 850px;
}
.detail-hero .detail-tagline + .detail-tagline {
  margin-top: 20px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 64px;
}
.detail-meta .meta-item h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.detail-meta .meta-item p {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
}

.detail-body {
  max-width: 850px;
  margin-bottom: 64px;
}
.detail-body p {
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.005em;
  line-height: 1.85;
  color: var(--ink);
  margin-bottom: 24px;
}
.detail-body p:last-child { margin-bottom: 0; }

.detail-section {
  max-width: 880px;
  margin-bottom: 64px;
}
.detail-section h3 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
  font-weight: 500;
}
.detail-section ol {
  list-style: none;
  padding: 0;
  max-width: 720px;
  counter-reset: li-counter;
}
.detail-section ol li {
  font-size: 17px;
  font-weight: 300;
  letter-spacing: 0.005em;
  line-height: 1.8;
  color: var(--ink);
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
}
.detail-section ol li:first-child { border-top: 1px solid var(--line); }
.detail-section ol li::before {
  content: counter(li-counter, decimal-leading-zero);
  counter-increment: li-counter;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 4px;
  font-weight: 500;
}

.detail-visual {
  width: 100%;
  margin: 0 0 64px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--bg-tint);
}
.detail-visual img,
.detail-visual video {
  width: 100%;
  display: block;
}
.detail-visual iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
}
.detail-visual figcaption,
.detail-visual .image-caption {
  display: block;
  padding: 12px 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  background: var(--bg-tint);
  border-top: 1px solid var(--line);
}

.detail-link {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  margin-bottom: 64px;
}
.detail-visual--portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.detail-visual--portrait video {
  width: auto;
  max-height: 65vh;
  max-width: 100%;
}
.detail-visual--portrait .image-caption {
  width: 100%;
}

.detail-visual:has(+ .detail-link) {
  margin-bottom: 10px;
}
.detail-visual + .detail-link {
  margin-top: 0;
}
.detail-link::after {
  content: " ↗";
  display: inline-block;
  font-weight: 400;
}

.detail-credits {
  max-width: 880px;
  padding: 48px 0 24px;
  border-top: 1px solid var(--line);
}
.detail-credits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 48px;
  max-width: 720px;
}
.detail-credits-grid .credit-item h4 {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.detail-credits-grid .credit-item p {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .detail-meta { grid-template-columns: repeat(2, 1fr); }
  .detail-hero h1 { font-size: 48px; }
}
@media (max-width: 700px) {
  .detail-hero h1 { font-size: 36px; }
  .detail-hero .detail-tagline { font-size: 17px; }
  .detail-meta { grid-template-columns: 1fr 1fr; gap: 24px; }
  .detail-credits-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Next project link (detail pages)
   ========================================================= */

.next-project {
  max-width: 880px;
  margin-top: 48px;
  padding-top: 48px;
  border-top: 1px solid var(--line);
}
.next-project-link {
  display: block;
}
.next-project-link .next-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.next-project-link .next-title {
  font-size: 44px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}
.next-project-link:hover .next-title { opacity: 0.55; }
.next-project-link .next-arrow {
  display: inline-block;
  margin-left: 12px;
  transition: transform 0.2s ease;
}
.next-project-link:hover .next-arrow { transform: translateX(8px); }

@media (max-width: 700px) {
  .next-project-link .next-title { font-size: 30px; }
}

/* =========================================================
   Back-to-top button
   ========================================================= */

.back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  line-height: 1;
}
.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
