/* === Google Fonts 已在 HTML 中引入 === */
/* Caveat (手写英文) · Ma Shan Zheng (中文行楷) · ZCOOL XiaoWei (中文艺术) */

/* === 全局 === */
:root {
  --bg: #ffffff;
  --bg2: #f5f5f7;
  --fg: #1d1d1f;
  --fg2: #3a3a3c;
  --fg3: #6e6e73;

  --accent:   #007aff;
  --red:      #ff3b30;

  /* 实底卡片 + 清晰边框 */
  --card-bg:  rgba(255, 255, 255, 0.95);
  --card-border: rgba(0, 0, 0, 0.1);

  /* 字体 */
  --font-hand:  'Caveat', cursive;
  --font-cn:    'Ma Shan Zheng', 'ZCOOL XiaoWei', cursive;
  --font-mono:  'Courier New', 'Source Code Pro', 'Consolas', monospace;
}

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

html { scroll-behavior: smooth; }

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

a { text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }

/* ============================================================
   登录门 (全屏)
   ============================================================ */
#login-gate {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100vh;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(0.3);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#login-gate.fade-out {
  opacity: 0; transform: scale(1.05);
  pointer-events: none;
}

.gate-inner {
  position: relative; z-index: 2;
  text-align: center;
  max-width: 500px; width: 100%;
  padding: 0 24px;
}

/* 名字——Apple 开机风格 */
.gate-name {
  font-family: var(--font-hand);
  font-size: 5rem;
  font-weight: 700;
  color: #1d1d1f;
  text-shadow: 0 0 80px rgba(0,0,0,0.08), 0 0 120px rgba(0,0,0,0.04);
  margin-bottom: 8px;
  letter-spacing: 2px;
  animation: apple-reveal 2.8s cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards,
             apple-breath 6s 3s ease-in-out infinite;
}
@keyframes apple-reveal {
  0%   { opacity: 0; transform: scale(0.92); text-shadow: 0 0 0px rgba(0,0,0,0); }
  50%  { opacity: 0.6; transform: scale(1.0); text-shadow: 0 0 40px rgba(0,0,0,0.05); }
  100% { opacity: 1; transform: scale(1.0); text-shadow: 0 0 80px rgba(0,0,0,0.08), 0 0 120px rgba(0,0,0,0.04); }
}
@keyframes apple-breath {
  0%, 100% { text-shadow: 0 0 80px rgba(0,0,0,0.08), 0 0 120px rgba(0,0,0,0.04); }
  50% { text-shadow: 0 0 100px rgba(0,0,0,0.12), 0 0 160px rgba(0,0,0,0.06); }
}

/* 副标题 */
.gate-subtitle {
  font-family: var(--font-cn);
  font-size: 1.2rem;
  color: var(--fg3);
  margin-bottom: 48px;
  letter-spacing: 3px;
  animation: apple-fade-up 2.2s 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}
@keyframes apple-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 登录表单延迟浮现 */
.gate-form-wrap {
  text-align: left;
  animation: apple-fade-up 2.2s 0.9s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}

/* 底部提示最后浮现 */
.gate-hint {
  margin-top: 36px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #86868b;
  animation: apple-fade-up 2.2s 1.4s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}

.gate-input-row {
  display: flex; align-items: center;
  margin-bottom: 16px;
  background: rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 10px 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.gate-input-row:focus-within {
  border-color: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.06);
}
.gate-prompt {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg2);
  white-space: nowrap;
  margin-right: 10px;
}
.gate-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: #1d1d1f;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
}
.gate-input-row input::placeholder {
  color: #aeaeb2;
}

.gate-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  color: #1d1d1f;
  font-family: var(--font-mono);
  font-size: 0.9rem; font-weight: 400;
  letter-spacing: 3px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.gate-btn:hover {
  background: rgba(0, 0, 0, 0.92);
  border-color: #000;
  color: #fff;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.15);
}
.gate-btn.loading .gate-btn-text { display: block; /* was none for login gate */ }
.gate-btn.loading .gate-btn-load { display: inline; }
.gate-btn-load { display: block; /* was none for login gate */ }

.gate-error {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

.gate-hint::before {
  content: '';
  display: block; width: 40px; height: 1px;
  background: var(--border);
  margin: 0 auto 16px;
}

.gate-public {
  margin-top: 12px;
  text-align: center;
  animation: apple-fade-up 2.2s 1.6s cubic-bezier(0.25, 0.1, 0.25, 1.0) both;
}
.gate-public a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #86868b;
  text-decoration: none;
  transition: color 0.2s;
}
.gate-public a:hover {
  color: #1d1d1f;
  text-decoration: none;
}

/* ============================================================
   主站点 (初始隐藏)
   ============================================================ */
#site-content { /* login removed */
  display: block; /* was none for login gate */
  animation: site-reveal 0.7s ease;
}
#site-content.visible {
  display: block;
}
@keyframes site-reveal {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === 导航 === */
#navbar {
  position: fixed; top: 0; width: 100%; z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.nav-inner {
  max-width: 1000px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  height: 56px;
}
.logo {
  font-family: var(--font-hand);
  font-size: 1.6rem; font-weight: 700;
  color: var(--fg);
}
.nav-links { list-style: none; display: flex; gap: 28px; }
.nav-links a {
  color: var(--fg3); font-size: 0.85rem;
  font-family: var(--font-mono);
  position: relative;
  letter-spacing: 1px;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0;
  width: 0; height: 1px; border-radius: 1px;
  background: rgba(0,0,0,0.4);
  transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}
.nav-links a:hover { color: #1d1d1f; text-decoration: none; }
.nav-links a:hover::after { width: 100%; }

.menu-toggle { display: none; background: none; border: none; color: var(--fg); font-size: 1.6rem; cursor: pointer; }

/* === Hero (登录后欢迎) === */
#home {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 80px 24px 40px;
  background: transparent;
}
.hero { text-align: center; max-width: 700px; }

.gate-welcome {
  font-family: var(--font-hand);
  font-size: 3.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1d1d1f;
  text-shadow: 0 0 60px rgba(0,0,0,0.06);
}
.gate-welcome span {
  font-family: var(--font-cn);
  color: #1d1d1f;
}

/* 旧 h1 glitch 保留给 blog 文章等使用 */
.hero h1.glitch {
  font-size: 4rem; color: var(--fg); margin-bottom: 16px;
  letter-spacing: 4px;
  font-family: var(--font-cn);
}
.glitch {
  position: relative;
  animation: glitch-skew 4s infinite linear alternate-reverse;
}
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; opacity: 0.4;
}
.glitch::before {
  color: rgba(0,0,0,0.2); z-index: -1;
  animation: glitch-anim 2s infinite linear alternate-reverse;
}
.glitch::after {
  color: rgba(0,0,0,0.1); z-index: -2;
  animation: glitch-anim 3s infinite linear alternate-reverse;
}
@keyframes glitch-anim {
  0%, 100% { transform: translate(0); }
  33% { transform: translate(-2px, 1px); }
  66% { transform: translate(2px, -1px); }
}
@keyframes glitch-skew {
  0%, 100% { transform: skew(0deg); }
  50% { transform: skew(0.3deg); }
}

.subtitle {
  font-family: var(--font-cn);
  font-size: 1.1rem; color: var(--fg3); margin-bottom: 8px;
  display: inline-block;
}
.subtitle::after {
  content: '';
  /* 去掉闪烁光标，Apple风格不搞这个 */
}
.tagline {
  font-family: var(--font-mono);
  color: var(--fg3); margin-bottom: 24px; font-size: 0.9rem;
}
.hero-badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badge {
  background: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.12);
  padding: 6px 16px; border-radius: 20px; font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--fg2);
  animation: badge-pulse 4s ease-in-out infinite;
}
.badge:nth-child(2) { animation-delay: 0.6s; }
.badge:nth-child(3) { animation-delay: 1.2s; }
.badge:nth-child(4) { animation-delay: 1.8s; }
@keyframes badge-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* === 通用 Section === */
section { padding: 80px 24px; }
.section-title {
  font-family: var(--font-cn);
  font-size: 2.2rem; margin-bottom: 48px;
  text-align: center;
  letter-spacing: 2px;
  color: #1d1d1f;
  font-weight: 400;
}
.section-title::before { content: "// "; color: var(--fg3); font-family: var(--font-mono); font-size: 1.1rem; }
.section-title::after  { content: ""; }

/* === About === */
.about-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.about-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 32px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.about-card h3 {
  font-family: var(--font-cn);
  margin-bottom: 16px; font-size: 1.25rem;
  color: #1d1d1f; font-weight: 400;
  letter-spacing: 1px;
}
.about-card ul { list-style: none; }
.about-card li {
  padding: 6px 0; font-size: 0.95rem;
  color: var(--fg2); line-height: 1.6;
}
.about-card:hover {
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-4px);
}

/* === Blog === */
.blog-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.blog-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 32px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
}
.blog-card:hover {
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-4px);
}
.blog-card .date {
  font-size: 0.8rem; color: var(--fg3); margin-bottom: 10px;
  font-family: var(--font-mono);
}
.blog-card h3 {
  color: #1d1d1f;
  font-family: var(--font-cn);
  margin-bottom: 10px; font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 1px;
}
.blog-card p { font-size: 0.95rem; color: var(--fg2); line-height: 1.6; }

/* === Projects === */
.project-grid {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px; padding: 32px;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.project-card h3 {
  font-family: var(--font-cn);
  margin-bottom: 10px; font-size: 1.15rem;
  color: #1d1d1f; font-weight: 400;
  letter-spacing: 1px;
}
.project-card p { font-size: 0.95rem; color: var(--fg2); margin-bottom: 14px; line-height: 1.6; }
.project-card:hover {
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-4px);
}
.tag {
  background: rgba(0,0,0,0.06);
  color: var(--fg2);
  padding: 3px 12px; border-radius: 6px;
  font-size: 0.75rem; font-family: var(--font-mono);
  letter-spacing: 0.5px;
}

/* === Contact === */
.contact-content { text-align: center; }
.contact-content p { margin-bottom: 12px; font-size: 1.05rem; }
.contact-content a { color: var(--fg2); }
.contact-content a:hover { color: var(--fg); }

/* === Footer === */
footer {
  text-align: center; padding: 24px;
  background: rgba(0, 0, 0, 0.03);
  border-top: 1px solid rgba(0,0,0,0.06);
  color: var(--fg3); font-size: 0.78rem;
}

/* ============================================================
   滚动揭示
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   成功登录提示
   ============================================================ */
.login-toast {
  position: fixed; top: 30px; left: 50%; transform: translateX(-50%);
  z-index: 10001;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--fg);
  padding: 12px 28px;
  border-radius: 10px;
  backdrop-filter: blur(20px);
  animation: toast-in 0.5s cubic-bezier(0.25,0.1,0.25,1), toast-out 0.4s ease 2s forwards;
}
@keyframes toast-in  { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .gate-name { font-size: 3.5rem; }
  .gate-welcome { font-size: 2.2rem; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--bg2); padding: 16px 24px; border-bottom: 1px solid var(--border); }
  .menu-toggle { display: block; }
  section { padding: 60px 16px; }
  .section-title { font-size: 1.5rem; }
}

/* ============================================================
   Blog 文章页
   ============================================================ */
.blog-article h1 {
  font-family: var(--font-cn);
  color: var(--fg);
  font-weight: 400;
}
.blog-post { max-width: 760px; margin: 0 auto; }
.blog-post h2 {
  color: var(--fg); margin: 32px 0 16px;
  font-size: 1.3rem; font-family: var(--font-cn); font-weight: 400;
}
.blog-post h3 {
  color: var(--fg2); margin: 24px 0 12px;
  font-family: var(--font-cn); font-weight: 400;
}
.blog-post p { margin-bottom: 16px; color: var(--fg3); }
.blog-post pre {
  background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.1); border-radius: 8px;
  padding: 18px; overflow-x: auto; font-size: 0.85rem; margin-bottom: 16px;
  color: var(--fg);
}
.blog-post code {
  background: rgba(0,0,0,0.05); padding: 2px 6px; border-radius: 4px; font-size: 0.88rem;
  color: var(--fg2);
}
.blog-post pre code { background: none; padding: 0; }
.blog-post ul, .blog-post ol { margin: 0 0 16px 24px; color: var(--fg3); }
.blog-post li { margin-bottom: 6px; }
.blog-post .back-link {
  display: inline-block; margin-top: 40px;
  color: var(--fg3); font-family: var(--font-mono);
}

/* ============================================================
   文件上传 & 分享
   ============================================================ */

#files {
  padding-top: 100px;
}

/* 上传区域 */
.upload-zone {
  max-width: 600px; margin: 0 auto 40px;
  background: var(--card-bg);
  border: 1px dashed var(--card-border);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  transition: border-color 0.3s, box-shadow 0.3s;
  cursor: pointer;
  position: relative;
}
.upload-zone:hover {
  border-color: rgba(0,0,0,0.3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.upload-zone.drag-over {
  border-color: #1d1d1f;
  box-shadow: 0 0 40px rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.03);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.upload-text {
  font-family: var(--font-cn);
  font-size: 1.1rem;
  color: var(--fg2);
  margin-bottom: 6px;
  letter-spacing: 1px;
}
.upload-hint {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg3);
  margin-bottom: 18px;
}

.upload-btn {
  display: inline-block;
  padding: 10px 28px;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 8px;
  color: var(--fg2);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.upload-btn:hover {
  background: rgba(0,0,0,0.92);
  border-color: #000;
  color: #fff;
}

/* 进度条 */
.upload-progress-wrap {
  display: none;
  align-items: center; gap: 12px;
  margin-top: 20px;
  padding: 0 16px;
}
.upload-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: #1d1d1f;
  border-radius: 2px;
  width: 0%;
  transition: width 0.15s ease;
}
.upload-progress-text {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fg3);
  min-width: 40px;
  text-align: right;
}

/* 拖拽覆盖层 */
.upload-overlay {
  display: none;
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  z-index: 10000;
  align-items: center; justify-content: center;
  font-family: var(--font-cn);
  font-size: 2rem;
  color: #1d1d1f;
  letter-spacing: 2px;
}
.upload-overlay.show { display: flex; }

/* 文件列表 */
.file-list {
  max-width: 700px; margin: 0 auto;
}

.file-list-empty {
  text-align: center;
  color: var(--fg3);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 24px;
}

.file-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.file-card:hover {
  border-color: rgba(0,0,0,0.2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.file-card-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 40px; text-align: center;
}

.file-card-info {
  flex: 1; min-width: 0;
}
.file-card-name {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.file-card-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg3);
}

.file-card-actions {
  display: flex; gap: 6px;
  flex-shrink: 0;
}
.file-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s, border-color 0.2s;
}
.file-btn:hover {
  background: rgba(0,0,0,0.1);
  border-color: rgba(0,0,0,0.25);
}
.file-btn-del:hover {
  background: rgba(255,69,58,0.2);
  border-color: var(--red);
}
