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

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e5e5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-lg: 16px;
  --max-width: 1100px;
  --nav-height: 64px;
}

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-height); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

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

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

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(250,250,249,.85); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  transition: box-shadow .3s;
}
.navbar.scrolled { box-shadow: var(--shadow-sm); }

.nav-container {
  max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}

.nav-logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }

.nav-menu { display: flex; list-style: none; gap: 32px; }

.nav-link {
  font-size: .9rem; color: var(--text-secondary); padding: 6px 0;
  border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.nav-link:hover,
.nav-link.active { color: var(--text); border-bottom-color: var(--accent); }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .3s, opacity .3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 120px 24px 80px; position: relative;
}

.hero-name { font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: 16px; }

.hero-tags { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 20px; }
.hero-tags .dot { margin: 0 8px; color: var(--text-tertiary); }

.hero-desc { font-size: 1.15rem; color: var(--text-secondary); max-width: 480px; margin: 0 auto 36px; }

.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn-primary, .btn-outline, .btn-small {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 28px;
  border-radius: 999px; font-size: .95rem; font-weight: 500; cursor: pointer;
  transition: all .25s; border: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--text); }
.btn-small { padding: 6px 18px; font-size: .85rem; background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-small:hover { background: var(--border); }

.hero-scroll { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); }
.hero-scroll span {
  display: block; width: 24px; height: 40px; border: 2px solid var(--text-tertiary);
  border-radius: 12px; position: relative;
}
.hero-scroll span::after {
  content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 8px; background: var(--text-tertiary); border-radius: 2px;
  animation: scrollDown 1.5s ease-in-out infinite;
}
@keyframes scrollDown {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  50% { opacity: .3; transform: translateX(-50%) translateY(8px); }
}

/* ===== Section Common ===== */
section { padding: 100px 0; }
.section-title { font-size: 1.75rem; font-weight: 700; text-align: center; margin-bottom: 48px; letter-spacing: -.02em; }

/* ===== Filter Bar ===== */
.filter-bar { display: flex; gap: 10px; justify-content: center; margin-bottom: 40px; flex-wrap: wrap; }

.filter-btn {
  padding: 8px 20px; border-radius: 999px; font-size: .9rem; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-secondary); cursor: pointer;
  transition: all .2s; display: flex; align-items: center; gap: 6px;
}
.filter-btn:hover { border-color: var(--text-tertiary); color: var(--text); }
.filter-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ===== Works Grid ===== */
.works-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}

.work-card {
  background: var(--surface); border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
  transition: transform .3s, box-shadow .3s;
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.work-card-thumb {
  width: 100%; height: 220px; background: #f0f0f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: var(--text-tertiary); overflow: hidden;
}
.work-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.work-card-body { padding: 20px; }

.work-card-category {
  display: inline-block; font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
  background: #eff6ff; color: #2563eb;
}
.cat-photo { background: #fef3c7; color: #d97706; }
.cat-script { background: #f0fdf4; color: #16a34a; }

.work-card-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }

.work-card-desc {
  font-size: .85rem; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.work-card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.work-card-tags span {
  font-size: .75rem; color: var(--text-tertiary); background: var(--bg);
  padding: 2px 8px; border-radius: 4px;
}

.work-card-date { font-size: .8rem; color: var(--text-tertiary); margin-top: 10px; }

/* No works placeholder */
.no-works {
  grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--text-tertiary);
}
.no-works i { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ===== About ===== */
.about-section { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.about-content { display: flex; gap: 56px; align-items: flex-start; }

.about-avatar { flex-shrink: 0; }
.about-avatar img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder {
  width: 160px; height: 160px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text-tertiary);
}

.about-text p { margin-bottom: 14px; color: var(--text-secondary); font-size: .95rem; }

.skill-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.skill-tags span {
  font-size: .8rem; padding: 5px 14px; border-radius: 999px;
  background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border);
}

/* ===== Contact ===== */
.contact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 48px; }

.contact-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 32px 24px; text-align: center; transition: box-shadow .3s;
}
.contact-card:hover { box-shadow: var(--shadow-md); }
.contact-card i { font-size: 2rem; color: var(--accent); margin-bottom: 14px; }
.contact-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.contact-card p { color: var(--text-secondary); font-size: .9rem; margin-bottom: 10px; word-break: break-all; }
.contact-note { font-size: .78rem; color: var(--text-tertiary); }

.social-links { display: flex; justify-content: center; gap: 20px; }
.social-link {
  width: 48px; height: 48px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  color: var(--text-secondary); transition: all .2s;
}
.social-link:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ===== Footer ===== */
.footer { text-align: center; padding: 32px 24px; color: var(--text-tertiary); font-size: .85rem; }

/* ===== Modal ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface); border-radius: var(--radius-lg); max-width: 720px;
  width: 100%; max-height: 85vh; overflow-y: auto; position: relative;
  box-shadow: var(--shadow-lg); animation: modalIn .3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal-close {
  position: sticky; top: 12px; float: right; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border);
  font-size: 1.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  margin: 12px 12px 0 0; transition: background .2s;
}
.modal-close:hover { background: var(--border); }

.modal-body { padding: 0 32px 32px; clear: both; }

.modal-body .modal-category {
  display: inline-block; font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; margin-bottom: 12px;
  background: #eff6ff; color: #2563eb;
}

.modal-body h2 { font-size: 1.4rem; margin-bottom: 8px; }
.modal-body .modal-date { font-size: .85rem; color: var(--text-tertiary); margin-bottom: 16px; }
.modal-body .modal-desc { color: var(--text-secondary); margin-bottom: 20px; line-height: 1.7; }

.modal-video { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; background: #000; }
.modal-video iframe { width: 100%; height: 100%; border: 0; }
.modal-video video { width: 100%; height: 100%; object-fit: contain; }

.modal-images { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
.modal-images img { height: 280px; border-radius: var(--radius); flex-shrink: 0; object-fit: cover; }

.modal-script {
  background: var(--bg); border-radius: var(--radius); padding: 24px;
  white-space: pre-wrap; font-size: .9rem; line-height: 1.8; color: var(--text-secondary);
  max-height: 400px; overflow-y: auto;
}

.modal-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.modal-tags span {
  font-size: .75rem; color: var(--text-tertiary); background: var(--bg); padding: 3px 10px; border-radius: 4px;
}

/* ===== Copy Toast ===== */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 24px; border-radius: 999px;
  font-size: .9rem; z-index: 9999; opacity: 0; transition: opacity .3s;
}
.toast.show { opacity: 1; }

/* ===== Admin UI ===== */
.nav-actions { display: flex; align-items: center; gap: 8px; }

.nav-admin-btn {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  width: 36px; height: 36px; cursor: pointer; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; font-size: .9rem;
}
.nav-admin-btn:hover { border-color: var(--text); color: var(--text); }

.admin-only { display: none !important; }
body.is-admin .add-work-wrap.admin-only { display: flex !important; }
body.is-admin .nav-admin-btn.admin-only { display: flex !important; }
body.is-admin .inline-edit-btn.admin-only { display: inline-block !important; }
body.is-admin .work-card-admin-actions { display: flex; }

.add-work-wrap { justify-content: center; margin-top: 40px; flex-wrap: wrap; gap: 8px; }

.work-card { position: relative; }
.work-card-admin-actions {
  display: none; position: absolute; top: 8px; right: 8px; gap: 6px; z-index: 5;
}
.work-card-admin-actions button {
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  font-size: .8rem; color: #fff; transition: transform .2s;
}
.work-card-admin-actions button:hover { transform: scale(1.1); }
.btn-edit { background: var(--accent); }
.btn-delete { background: #ef4444; }

.inline-edit-btn {
  background: none; border: 1px solid var(--border); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; color: var(--text-secondary);
  font-size: .85rem; vertical-align: middle; margin-left: 8px; transition: all .2s;
}
.inline-edit-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ===== Forms ===== */
.modal-sm { max-width: 480px; }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: .9rem; font-family: inherit; background: var(--bg); color: var(--text);
  transition: border-color .2s; resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { outline: none; border-color: var(--accent); }
.form-group textarea { min-height: 80px; }
.form-group .help-text { font-size: .75rem; color: var(--text-tertiary); margin-top: 4px; }

.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--bg); min-height: 42px; align-items: center; }
.tag-input-wrap .tag-chip {
  display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px; font-size: .8rem;
}
.tag-input-wrap .tag-chip button { background: none; border: none; cursor: pointer; color: var(--text-tertiary); padding: 0; font-size: 1rem; line-height: 1; }
.tag-input-wrap input { border: none; padding: 4px; min-width: 80px; flex: 1; background: transparent; font-size: .85rem; }
.tag-input-wrap input:focus { outline: none; }

.form-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-menu { position: fixed; top: var(--nav-height); left: 0; right: 0;
    background: var(--surface); flex-direction: column; gap: 0; padding: 16px 0;
    border-bottom: 1px solid var(--border); transform: translateY(-100%); opacity: 0;
    pointer-events: none; transition: all .3s;
  }
  .nav-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-link { display: block; padding: 12px 24px; border: none; font-size: 1rem; }
  .hamburger { display: flex; }

  .works-grid { grid-template-columns: repeat(2, 1fr); }
  .about-content { flex-direction: column; gap: 28px; align-items: center; text-align: center; }
  .contact-cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .works-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: center; }
  .filter-bar { gap: 6px; }
  .filter-btn { padding: 6px 14px; font-size: .82rem; }
  .section-title { font-size: 1.4rem; }
}
