/* ====================================================
   MAX LU PORTFOLIO — style.css
   B2 琥珀黄昏配色系统
   ==================================================== */

/* ---- CSS Variables ---- */
:root {
  --bg:        #FDF9F1;
  --surface:   #F0DFC8;
  --primary:   #C8956A;
  --warm:      #E6C9A8;
  --text:      #3D3027;
  --muted:     #8A7B6B;
  --white:     #FFFFFF;

  --font-pixel: 'Press Start 2P', monospace;
  --font-zh:    'ZCOOL KuaiLe', 'PingFang SC', sans-serif;
  --font-body:  -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  --nav-h:     68px;
  --radius-lg: 32px;
  --radius-md: 16px;
  --radius-sm: 8px;

  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);

  --shadow-sm: 0 2px 12px rgba(61,48,39,.08);
  --shadow-md: 0 8px 32px rgba(61,48,39,.12);
  --shadow-lg: 0 20px 60px rgba(61,48,39,.18);
}

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

html {
  scroll-behavior: smooth;
  font-size: 20px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

p {
  font-size: 22px;
  line-height: 1.8;
}

/* ---- Utility ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
}

.pixel-font { font-family: var(--font-pixel); }

.accent { color: var(--primary); }

/* ---- Reveal animation ---- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover {
  background: #b37d56;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200,149,106,.35);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--warm);
}
.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* ---- Tags / Capsules ---- */
.tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 16px;
  font-family: var(--font-mono);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--warm);
  white-space: nowrap;
  transition: all 0.2s;
}
.tag:hover { background: var(--warm); }

.tag-sm { font-size: 11px; padding: 4px 10px; }

.tag-primary {
  background: rgba(200,149,106,.12);
  color: var(--primary);
  border-color: rgba(200,149,106,.3);
}
.tag-primary:hover { background: rgba(200,149,106,.25); }

.tag-secondary {
  background: rgba(108,99,255,.08);
  color: #6C63FF;
  border-color: rgba(108,99,255,.2);
}

.tag-tertiary {
  background: rgba(0,195,154,.08);
  color: #009E7C;
  border-color: rgba(0,195,154,.2);
}

.tag-dev {
  background: rgba(61,48,39,.06);
  color: var(--text);
  border-color: var(--warm);
}

/* ---- Section Common ---- */
.section { position: relative; }

.section-label {
  font-family: var(--font-pixel);
  font-size: 11px;
  color: var(--primary);
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-zh);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 48px;
  line-height: 1.2;
}

.section-desc {
  font-size: 16px;
  color: var(--muted);
  margin-top: -32px;
  margin-bottom: 48px;
}

/* ========================================
   NAVBAR
   ======================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  transition: background 0.4s, backdrop-filter 0.4s, box-shadow 0.4s;
}

.navbar.scrolled {
  background: rgba(253,249,241,.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 0 rgba(61,48,39,.08);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.nav-logo {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.05em;
  transition: color 0.2s;
}
.nav-logo:hover { color: var(--primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(61,48,39,.06);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}

/* ========================================
   HERO SECTION
   ======================================== */
.section-hero {
  width: 100%;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#fluid-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.section {
  position: relative;
  z-index: 1;
}

.hero-gradient-fallback {
  display: none;
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #FDF9F1 0%, #F0DFC8 40%, #E6C9A8 70%, #C8956A 100%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 24px;
}

.hero-eyebrow {
  font-size: 12px;
  color: var(--primary);
  letter-spacing: 0.15em;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.2s forwards;
}

.hero-name {
  font-family: var(--font-pixel);
  font-size: clamp(56px, 8vw, 96px);
  color: var(--text);
  letter-spacing: 0.05em;
  line-height: 1.1;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.4s forwards;
  text-shadow: 3px 3px 0 rgba(200,149,106,.15);
}

.hero-name-cn {
  font-family: "ZCOOL QingKe HuangYou", sans-serif;
  font-size: clamp(28px, 3.5vw, 42px);
  color: #8A7B6B;
  letter-spacing: 0.3em;
  margin-top: 8px;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.5s forwards;
}

.hero-subtitle {
  font-family: var(--font-zh);
  font-size: clamp(20px, 3vw, 32px);
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.6s forwards;
}

.hero-sub2 {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.75s forwards;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 0.9s forwards;
}

.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  color: var(--primary);
  animation: float 2.5s ease-in-out infinite;
  opacity: 0;
  animation: float 2.5s ease-in-out 1.5s infinite, fadeIn 0.8s ease 1.5s forwards;
}

.scroll-arrow svg { width: 28px; height: 28px; }

/* ---- Typewriter ---- */
.typewriter-container {
  margin-top: 30px;
  font-size: clamp(20px, 2.5vw, 32px);
  color: var(--color-accent, var(--primary));
  font-family: var(--font-pixel);
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 1.1s forwards;
}
.typewriter-prefix {
  color: var(--muted);
  font-family: inherit;
}
.typewriter-cursor {
  animation: blink 1s infinite;
  color: var(--primary);
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ========================================
   ABOUT SECTION
   ======================================== */
.section-about {
  padding: 120px 0;
}

.about-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 60px;
  align-items: center;
  max-width: 1100px;
}

.about-photo-wrap {
  position: relative;
}

.about-photo-frame {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: visible;
}

.about-photo {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transition: transform 0.5s var(--ease-out);
}

.about-photo-wrap:hover .about-photo { transform: translateY(-8px); }

.photo-deco {
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 80%;
  height: 80%;
  border: 3px solid var(--warm);
  border-radius: var(--radius-lg);
  z-index: -1;
  transition: transform 0.5s var(--ease-out);
}

.about-photo-wrap:hover .photo-deco { transform: translate(6px, 6px); }

.about-text { display: flex; flex-direction: column; gap: 24px; }

.about-bio p {
  font-size: 22px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 12px;
}

.about-bio strong { color: var(--primary); }

.about-edu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edu-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--warm);
}

.edu-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }

.edu-item strong {
  display: block;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 2px;
}

.edu-item span {
  font-size: 18px;
  color: var(--muted);
}

.about-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ========================================
   EXPERIENCE / TIMELINE
   ======================================== */
.section-experience {
  padding: 120px 0;
  background: var(--surface);
}

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 28px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), var(--warm), transparent);
}

.timeline-item {
  display: flex;
  gap: 32px;
  padding-bottom: 40px;
  position: relative;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}
.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-dot {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8px;
}

.timeline-dot::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 3px var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}

.timeline-card {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(230,201,168,.5);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.timeline-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.company-badge {
  display: flex;
  align-items: center;
  gap: 14px;
}

.company-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
  background: white;
  padding: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-zh);
  font-size: 24px;
  font-weight: 700;
  color: white;
}
img.company-logo {
  display: block;
  padding: 4px;
}

.company-name {
  font-family: var(--font-zh);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  color: var(--text);
}

.job-title {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 2px;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

.timeline-bullets {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-bullets li {
  font-size: 20px;
  line-height: 1.8;
  color: var(--text);
  padding-left: 16px;
  position: relative;
}

.timeline-bullets li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: 12px;
}

.timeline-bullets strong { color: var(--primary); }

.timeline-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ========================================
   PROJECTS — RANDOM SHAPES
   ======================================== */
.section-projects {
  padding: 120px 0 80px;
  overflow: hidden;
  position: relative;
}

/* Decorative background circles */
.section-projects::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -120px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,149,106,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.section-projects::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230,201,168,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Decorative underline for section title in projects */
.section-projects .section-title {
  position: relative;
  display: inline-block;
}

.section-projects .section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--warm), transparent);
  border-radius: 2px;
}

.section-projects .container { margin-bottom: 0; position: relative; z-index: 1; }

.projects-canvas {
  position: relative;
  width: 100%;
  min-height: 600px;
  padding: 40px 48px 80px;
  max-width: 1400px;
  margin: 0 auto;
  z-index: 1;
  overflow: hidden;
}

/* Each project shape — positioned via JS, but CSS defines the look */
.project-shape {
  position: absolute;
  cursor: pointer;
  transition: transform 0.5s var(--ease-out), filter 0.4s, box-shadow 0.4s;
  will-change: transform;
  box-shadow: 0 20px 60px rgba(200,149,106,0.15);
}

.project-shape:hover {
  transform: scale(1.06) rotate(1deg) !important;
  filter: brightness(1.03);
  z-index: 10;
}

.shape-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
}

/* Different blob shapes via clip-path */
.project-shape:nth-child(1) .shape-inner {
  clip-path: path('M50,0 C80,5 100,30 95,60 C90,90 70,105 45,100 C20,95 0,75 5,45 C10,15 25,-5 50,0 Z');
  background: linear-gradient(135deg, #FDF9F1, #F0DFC8);
  border: 2px solid var(--warm);
  border-radius: 60% 40% 55% 45% / 45% 55% 40% 60%;
}

.project-shape:nth-child(2) .shape-inner {
  clip-path: none;
  background: linear-gradient(145deg, #C8956A, #E6C9A8);
  border-radius: 45% 55% 65% 35% / 55% 35% 65% 45%;
}

.project-shape:nth-child(3) .shape-inner {
  background: linear-gradient(120deg, #3D3027, #6B5240);
  border-radius: 55% 45% 38% 62% / 42% 58% 42% 58%;
}

.project-shape:nth-child(4) .shape-inner {
  background: linear-gradient(160deg, #F0DFC8, #C8956A);
  border-radius: 65% 35% 55% 45% / 35% 65% 35% 65%;
}

.project-shape:nth-child(5) .shape-inner {
  background: linear-gradient(110deg, #E6C9A8, #3D3027 180%);
  border-radius: 40% 60% 45% 55% / 60% 40% 65% 35%;
}

.shape-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.project-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  opacity: 0.7;
}

.project-name {
  font-family: var(--font-zh);
  font-size: clamp(22px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 8px;
}

.project-metric {
  font-size: clamp(16px, 1.8vw, 22px);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.project-metric strong { font-size: clamp(18px, 2vw, 24px); }

.project-desc {
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}

.project-shape:hover .project-desc {
  opacity: 0.85;
  transform: translateY(0);
}

/* Light shapes - dark text */
.project-shape:nth-child(1) .project-label,
.project-shape:nth-child(1) .project-name,
.project-shape:nth-child(1) .project-metric,
.project-shape:nth-child(1) .project-desc { color: var(--text); }

.project-shape:nth-child(2) .project-label,
.project-shape:nth-child(2) .project-name,
.project-shape:nth-child(2) .project-metric,
.project-shape:nth-child(2) .project-desc { color: #3D3027; }

/* Dark shapes - light text */
.project-shape:nth-child(3) .project-label,
.project-shape:nth-child(3) .project-name,
.project-shape:nth-child(3) .project-metric,
.project-shape:nth-child(3) .project-desc { color: #FDF9F1; }

.project-shape:nth-child(4) .project-label,
.project-shape:nth-child(4) .project-name,
.project-shape:nth-child(4) .project-metric,
.project-shape:nth-child(4) .project-desc { color: var(--text); }

.project-shape:nth-child(5) .project-label,
.project-shape:nth-child(5) .project-name,
.project-shape:nth-child(5) .project-metric,
.project-shape:nth-child(5) .project-desc { color: #FDF9F1; }

/* ---- Project Detail Overlay ---- */
.project-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(61,48,39,.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}

.project-detail-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.detail-inner {
  background: var(--bg);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 48px;
  position: relative;
  transform: translateY(30px) scale(0.96);
  transition: transform 0.4s var(--ease-out);
  scrollbar-width: thin;
  scrollbar-color: var(--warm) transparent;
}

.project-detail-overlay.open .detail-inner { transform: none; }

.detail-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--warm);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text);
}

.detail-close:hover { background: var(--warm); }

.detail-title-hero {
  font-family: var(--font-zh);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--warm);
}

.detail-title {
  font-family: var(--font-zh);
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-meta {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-bottom: 24px;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 24px 0 8px;
}

.detail-body p {
  font-size: 20px;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 12px;
}

.detail-kpi {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--warm);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  flex: 1;
  min-width: 120px;
}

.kpi-value {
  font-family: var(--font-pixel);
  font-size: 18px;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ========================================
   SKILLS SECTION
   ======================================== */
.section-skills {
  padding: 120px 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 100%);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.skill-group {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  border: 1px solid rgba(230,201,168,.6);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.skill-group:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.skill-group-title {
  font-family: var(--font-zh);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.skill-icon { font-size: 20px; }

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Stagger bounce animation */
.stagger-tag {
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.4s, transform 0.4s var(--ease-out);
}

.stagger-tag.visible {
  opacity: 1;
  transform: scale(1);
}

/* ========================================
   GALLERY / CLOTHESLINE
   ======================================== */
.section-gallery {
  padding: 120px 0;
}

/* Clothesline rope */
.gallery-scroll {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 20px 60px 40px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.gallery-scroll::-webkit-scrollbar { display: none; }

.photo-item {
  flex-shrink: 0;
  background: white;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  scroll-snap-align: center;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.03,0.98,0.52,0.99), box-shadow 0.4s;
  position: relative;
}

.photo-item:hover {
  transform: scale(1.03) translateY(-8px);
  box-shadow: 0 16px 50px rgba(0,0,0,0.12);
  z-index: 10;
}

.photo-item::before { display: none; }
.photo-item::after { display: none; }

.photo-item img {
  max-height: 300px;
  width: auto;
  display: block;
  border-radius: 4px;
  pointer-events: none;
  image-orientation: from-image;
  object-fit: contain;
}

/* Alternate vertical offset for staggered rows feel */
.photo-item:nth-child(odd) {
  margin-top: 20px;
}
.photo-item:nth-child(even) {
  margin-top: 55px;
}

.gallery-overlay {
  position: absolute;
  inset: 10px;
  background: rgba(61,48,39,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.photo-item:hover .gallery-overlay { opacity: 1; }

.gallery-overlay span {
  color: white;
  font-size: 13px;
  font-weight: 500;
  background: rgba(255,255,255,.2);
  padding: 6px 16px;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}

/* Keep .gallery-item as alias for JS compatibility */
.gallery-item {
  break-inside: avoid;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(20,15,10,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255,255,255,.3); }

.lightbox-inner {
  max-width: calc(100vw - 200px);
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 0 80px rgba(0,0,0,.5);
}

.lightbox-caption {
  color: rgba(255,255,255,.7);
  font-size: 14px;
  text-align: center;
}

.lightbox-nav {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 22px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.lightbox-nav:hover { background: rgba(255,255,255,.25); }

/* ========================================
   CONTACT SECTION
   ======================================== */
.section-contact {
  padding: 120px 0 0;
  text-align: center;
}

.contact-subtitle {
  font-size: 17px;
  color: var(--muted);
  margin-top: -32px;
  margin-bottom: 56px;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
  text-decoration: none;
}

.contact-icon {
  width: 64px;
  height: 64px;
  background: var(--surface);
  border: 1.5px solid var(--warm);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-out);
  color: var(--text);
}

.contact-icon svg { width: 26px; height: 26px; }

.contact-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: #3D3027;
  color: #FDF9F1;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.23,1,0.32,1);
  font-family: monospace;
  z-index: 10;
}
.contact-item[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.contact-item:hover .contact-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(200,149,106,.35);
}

.contact-item span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.2s;
}

.contact-item:hover span { color: var(--primary); }

/* WeChat QR popup */
.contact-wechat { cursor: default; }

.wechat-qr {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease-out);
  z-index: 100;
}

.contact-wechat:hover .wechat-qr {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.qr-placeholder {
  background: white;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--warm);
  min-width: 140px;
}

.qr-placeholder p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.contact-email-display {
  margin-bottom: 60px;
}

.email-link {
  font-family: var(--font-mono);
  font-size: clamp(14px, 2vw, 20px);
  color: var(--muted);
  transition: color 0.2s;
  border-bottom: 1px dashed var(--warm);
  padding-bottom: 4px;
}

.email-link:hover { color: var(--primary); border-color: var(--primary); }

/* ---- Footer ---- */
.footer {
  border-top: 1px solid var(--warm);
  padding: 32px 0;
  margin-top: 0;
}

.footer-text {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-align: center;
}

/* ========================================
   SCROLL TRANSITIONS
   ======================================== */
.sections-wrapper {
  perspective: none;
}

.section:not(.section-hero) {
  will-change: transform, opacity;
  margin-bottom: 4vh;
}

/* ========================================
   KEYFRAMES
   ======================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(-10px); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

/* ========================================
   RESPONSIVE — Tablet (768-1199px)
   ======================================== */
@media (max-width: 1199px) {
  .container { padding: 0 32px; }
  .nav-inner { padding: 0 32px; }

  .about-grid {
    grid-template-columns: 280px 1fr;
    gap: 48px;
  }

  .skills-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }

  .gallery-clothesline {
    padding: 60px 32px 30px;
  }

  .gallery-masonry {
    columns: 2;
    padding: 0 32px;
  }

  .projects-canvas { padding: 20px 32px 60px; }
}

/* ========================================
   RESPONSIVE — Mobile (<768px)
   ======================================== */
@media (max-width: 767px) {
  :root { --nav-h: 60px; }

  .container { padding: 0 20px; }
  .nav-inner { padding: 0 20px; }

  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  /* Mobile nav open */
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: rgba(253,249,241,.97);
    backdrop-filter: blur(20px);
    padding: 20px;
    gap: 4px;
    box-shadow: var(--shadow-md);
    z-index: 999;
  }
  .nav-links.open a { padding: 12px 16px; font-size: 16px; }

  /* Hero — disable fluid canvas, show gradient */
  #fluid-canvas { display: none; }
  .hero-gradient-fallback { display: block; }

  .hero-name { font-size: clamp(24px, 8vw, 40px); }
  .hero-cta { flex-direction: column; align-items: center; }

  .section-about { padding: 80px 0; }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-photo-frame { max-width: 280px; margin: 0 auto; }

  .section-experience { padding: 80px 0; }
  .timeline::before { display: none; }
  .timeline-item { flex-direction: column; gap: 16px; padding-bottom: 24px; }
  .timeline-dot { display: none; }
  .timeline-header { flex-direction: column; }

  .section-projects { padding: 80px 0 40px; }

  .projects-canvas {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px 40px;
    min-height: auto;
  }

  /* Stack shapes on mobile */
  .project-shape {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
  }

  .shape-inner {
    clip-path: none !important;
    border-radius: 20px !important;
    padding: 28px !important;
  }

  .project-shape:hover {
    transform: scale(1.02) !important;
  }

  .project-desc { opacity: 1 !important; transform: none !important; }

  .skills-grid { grid-template-columns: 1fr; }

  .gallery-clothesline {
    padding: 60px 20px 30px;
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: center;
  }

  .photo-item img {
    max-height: 200px;
    width: auto;
  }

  .gallery-masonry {
    columns: 1;
    padding: 0 20px;
  }

  .section-contact { padding: 80px 0 0; }

  .contact-links { gap: 16px; }

  .section-title { font-size: 28px; }

  .detail-inner { padding: 28px 20px; }
  .lightbox-inner { max-width: calc(100vw - 40px); }
  .lightbox-nav { display: none; }

  .footer-text { font-size: 8px; }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }

  .stagger-tag {
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-indicator { display: none; }
  #fluid-canvas { display: none; }
  .hero-gradient-fallback { display: block; }
}
