/* ============================================
   林予白 / Yubai Lin — 作品集主样式
   ============================================ */

:root {
  --bg: #0e0e0e;
  --bg-warm: #111009;
  --fg: #d4cfc7;
  --fg-dim: #7a7570;
  --fg-muted: #4a4540;
  --accent-sand: #c8b99a;
  --accent-blue: #4a6a8a;
  --accent-grey-blue: #7a9ab0;
  --accent-rust: #b06040;
  --accent-olive: #7a8a60;
  --accent-paper: #e8ddc8;
  --border: rgba(212, 207, 199, 0.12);
  --border-mid: rgba(212, 207, 199, 0.25);
  --font-serif: 'Noto Serif SC', 'Source Han Serif CN', Georgia, serif;
  --font-sans: 'IBM Plex Sans', 'Noto Sans SC', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

p {
  margin-bottom: 1rem;
  color: var(--fg-dim);
  font-size: 0.95rem;
  line-height: 1.8;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* ── Noise overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ── Navigation ── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  mix-blend-mode: normal;
  background: linear-gradient(to bottom, rgba(14,14,14,0.95) 0%, transparent 100%);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.nav-logo span {
  color: var(--fg);
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--fg);
}

/* Mobile nav */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--fg-dim);
  transition: all 0.3s;
}

.nav-drawer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14,14,14,0.97);
  z-index: 99;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2.5rem;
}

.nav-drawer.open {
  display: flex;
}

.nav-drawer a {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--fg-dim);
  transition: color 0.2s;
}

.nav-drawer a:hover {
  color: var(--fg);
}

.nav-drawer-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 1.5rem;
  color: var(--fg-dim);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-mono);
}

/* ── Sections ── */
section {
  padding: 6rem 2.5rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Project back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-muted);
  transition: color 0.2s;
  margin-bottom: 3rem;
}

.back-link:hover {
  color: var(--fg-dim);
}

.back-link::before {
  content: '←';
  font-size: 0.85rem;
}

/* ── Label / tag ── */
.label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  display: inline-block;
}

.label-inline {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

/* ── Horizontal rule ── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── Monospace code ── */
code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg-dim);
}

/* ── Grid utilities ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* ── Page footer ── */
footer {
  padding: 3rem 2.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

footer .footer-left {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

footer .footer-right {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
}

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slowPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes noiseDrift {
  0%   { background-position: 0 0; }
  100% { background-position: 100px 100px; }
}

@keyframes scanLine {
  from { transform: translateY(-100%); }
  to   { transform: translateY(100vh); }
}

.anim-fade-up {
  animation: fadeUp 0.8s ease both;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  nav {
    padding: 1rem 1.5rem;
  }
  
  .nav-links {
    display: none;
  }
  
  .nav-hamburger {
    display: flex;
  }
  
  section {
    padding: 4rem 1.5rem;
  }
  
  footer {
    padding: 2.5rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
