/* ========================================
   Juan131ng 个人主页 - 统一样式
   设计：深绿复古 · 文艺质感
   ======================================== */

/* ---- CSS 变量 ---- */
:root {
  --bg: #faf7f2;
  --text: #2c2416;
  --muted: #6b5e48;
  --accent: #2d6a3f;
  --accent-hover: #1f4f2b;
  --accent-soft: rgba(45, 106, 63, 0.08);
  --gold: #b8943e;
  --gold-hover: #9a7b2f;
  --gold-soft: rgba(184, 148, 62, 0.12);
  --border: #d4c9b8;
  --card: #fefdf9;
  --card-hover: #fdfaf3;
  --shadow: rgba(44, 36, 22, 0.06);
  --shadow-lg: rgba(44, 36, 22, 0.10);
  --overlay: rgba(44, 36, 22, 0.03);
}

html.dark {
  --bg: #111a14;
  --text: #e0d8c8;
  --muted: #8b8470;
  --accent: #4a9c5d;
  --accent-hover: #5cb86e;
  --accent-soft: rgba(74, 156, 93, 0.12);
  --gold: #c9a96e;
  --gold-hover: #d4b87a;
  --gold-soft: rgba(201, 169, 110, 0.10);
  --border: #2a3528;
  --card: #162018;
  --card-hover: #1a251d;
  --shadow: rgba(0, 0, 0, 0.15);
  --shadow-lg: rgba(0, 0, 0, 0.25);
  --overlay: rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #111a14;
    --text: #e0d8c8;
    --muted: #8b8470;
    --accent: #4a9c5d;
    --accent-hover: #5cb86e;
    --accent-soft: rgba(74, 156, 93, 0.12);
    --gold: #c9a96e;
    --gold-hover: #d4b87a;
    --gold-soft: rgba(201, 169, 110, 0.10);
    --border: #2a3528;
    --card: #162018;
    --card-hover: #1a251d;
    --shadow: rgba(0, 0, 0, 0.15);
    --shadow-lg: rgba(0, 0, 0, 0.25);
    --overlay: rgba(0, 0, 0, 0.04);
  }
}

/* ---- 基础重置 ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-focus-ring-color: transparent;
}

*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Serif SC", "Source Serif 4", "Crimson Text", Georgia,
    "Times New Roman", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    serif;
  line-height: 1.85;
  letter-spacing: 0.3px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* 噪点纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

html.dark body::before { opacity: 0.25; }

@media (prefers-color-scheme: dark) {
  :root:not(.light) body::before {
    opacity: 0.25;
  }
}

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

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

/* ---- 容器 ---- */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 24px;
  animation: fadeInUp 0.6s ease;
  position: relative;
  z-index: 1;
}

/* ---- 导航 ---- */
.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 3px double var(--border);
}

.brand {
  position: absolute;
  left: 0;
  font-family: "Playfair Display", "Noto Serif SC", serif;
  font-size: 26px;
  letter-spacing: 1px;
  color: var(--accent);
  transition: color 200ms ease;
  font-weight: 700;
}

.brand:hover {
  color: var(--gold);
}

.nav-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-right: 48px;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  font-family: "Noto Serif SC", serif;
  letter-spacing: 0.4px;
  transition: all 200ms ease;
}

.nav-links a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-bottom: 2px solid var(--gold);
  border-radius: 6px 6px 0 0;
}

/* ---- 主题切换按钮 ---- */
.theme-toggle {
  position: absolute;
  right: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  transition: all 220ms ease;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}
.theme-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--card-hover);
}
html:not(.dark) .theme-toggle .icon-dark,
html.dark .theme-toggle .icon-light {
  display: none;
}

/* ---- 装饰分隔线 ---- */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 40px 0;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 8px;
  user-select: none;
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  max-width: 80px;
  background: linear-gradient(
    to right,
    transparent,
    var(--gold),
    transparent
  );
}

/* ---- 英雄区 ---- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  align-items: end;
  margin: 44px 0 28px;
}

.title {
  font-family: "Playfair Display", "Noto Serif SC", serif;
  font-size: 46px;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: 0.8px;
  color: var(--text);
  text-shadow: 1px 1px 0 var(--bg), 2px 2px 0 var(--overlay);
}

.subtitle {
  color: var(--muted);
  font-size: 16px;
  max-width: 680px;
  line-height: 1.8;
}

.poem {
  border-left: 3px double var(--gold);
  padding-left: 20px;
  color: var(--muted);
  font-style: italic;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.poem::after {
  content: "¶";
  position: absolute;
  bottom: -18px;
  right: 8px;
  color: var(--gold);
  font-size: 16px;
  font-style: normal;
  opacity: 0.6;
}

/* ---- 区块 ---- */
.section {
  margin: 56px 0;
}

.section h2 {
  font-family: "Playfair Display", "Noto Serif SC", serif;
  font-size: 28px;
  margin: 0 0 24px;
  letter-spacing: 0.8px;
  color: var(--accent);
  position: relative;
  display: inline-block;
}

.section h2::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 60%;
  height: 2px;
  background: linear-gradient(to right, var(--gold), transparent);
  border-radius: 1px;
}

/* ---- 卡片网格 ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 22px 20px;
  transition: all 220ms ease;
  will-change: transform;
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px var(--shadow-lg);
  border-color: var(--gold);
  background: var(--card-hover);
}

.card:hover::before {
  opacity: 1;
  border-color: var(--gold);
}

.card h3 {
  margin: 4px 0 8px;
  font-size: 18px;
  font-family: "Playfair Display", serif;
  letter-spacing: 0.4px;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

/* 无动效卡片（关于页等） */
.card-static {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 22px 20px;
}

.meta {
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}

/* ---- 图片网格 ---- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.image-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
  transition: all 220ms ease;
}

.image-card img {
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--border);
  filter: sepia(0.12);
  transition: filter 300ms ease, transform 300ms ease;
}

.image-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px var(--shadow-lg);
  border-color: var(--gold);
}

.image-card:hover img {
  filter: sepia(0);
}

.caption {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
  letter-spacing: 0.4px;
}

/* ---- 画廊 ---- */
.gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 220ms ease;
  cursor: pointer;
  will-change: transform;
  border: 1px solid var(--border);
}

.gallery-item:hover {
  box-shadow: 0 8px 28px var(--shadow-lg);
  border-color: var(--gold);
}

.gallery-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 300ms ease, filter 300ms ease;
  filter: sepia(0.15);
}

.gallery-item:hover img {
  transform: scale(1.05);
  filter: sepia(0);
}

.gallery-item .gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(17, 26, 20, 0.92));
  color: #e0d8c8;
  padding: 18px 20px;
  transform: translateY(100%);
  transition: transform 250ms ease;
}

.gallery-item:hover .gallery-overlay {
  transform: translateY(0);
}

.gallery-item h4 {
  margin: 0 0 6px;
  font-size: 16px;
  font-family: "Playfair Display", serif;
  letter-spacing: 0.6px;
}

.gallery-item p {
  margin: 0;
  font-size: 14px;
  opacity: 0.85;
}

/* ---- 文章列表 ---- */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.article-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 22px 24px;
  transition: all 220ms ease;
  border-left: 4px solid var(--accent);
  will-change: transform;
  position: relative;
}

.article-item:hover {
  transform: translateX(6px);
  box-shadow: 0 8px 28px var(--shadow-lg);
  border-left-width: 4px;
  border-left-color: var(--gold);
  background: var(--card-hover);
}

.article-item h3 {
  font-family: "Playfair Display", serif;
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: 0.4px;
}

.article-item .article-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
  font-style: italic;
}

.article-item .article-excerpt {
  color: var(--muted);
  line-height: 1.75;
}

/* ---- 关于页 ---- */
.about-info {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.about-info img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px double var(--accent);
  box-shadow: 0 4px 20px rgba(45, 106, 63, 0.2);
  flex-shrink: 0;
  filter: sepia(0.15);
  transition: filter 300ms ease, border-color 300ms ease;
}

.about-info img:hover {
  filter: sepia(0);
  border-color: var(--gold);
}

.about-content {
  flex: 1;
  min-width: 280px;
}

.about-content p {
  margin-bottom: 15px;
  font-size: 1.1rem;
  line-height: 1.85;
}

.skills {
  margin-top: 30px;
}

.skills h3 {
  font-family: "Playfair Display", serif;
  font-size: 24px;
  margin: 0 0 15px;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-item {
  background: var(--accent);
  color: #faf7f2;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 220ms ease;
  will-change: transform;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.skill-item:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 16px rgba(45, 106, 63, 0.3);
  background: var(--gold);
  border-color: var(--gold-hover);
}

/* ---- 联系页 ---- */
.contact-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.contact-info {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  padding: 26px;
  border-left: 4px double var(--accent);
}

.contact-info h3 {
  font-family: "Playfair Display", serif;
  font-size: 24px;
  margin: 0 0 20px;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.contact-info p {
  margin-bottom: 16px;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.75;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-form input,
.contact-form textarea {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.contact-form textarea {
  resize: vertical;
  min-height: 150px;
}

.contact-form button {
  padding: 14px 28px;
  background: var(--accent);
  color: #faf7f2;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 220ms ease;
  will-change: transform;
  letter-spacing: 0.6px;
}

.contact-form button:hover {
  background: var(--gold);
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(184, 148, 62, 0.35);
}

/* ---- 表单反馈 ---- */
.success-message {
  background: #d4edda;
  color: #155724;
  padding: 15px 18px;
  border-radius: 10px;
  margin-top: 4px;
  display: none;
  border: 1px solid #c3e6cb;
  font-family: inherit;
}

.error {
  border-color: #c44 !important;
  box-shadow: 0 0 0 3px rgba(204, 68, 68, 0.1) !important;
}

.error-message {
  color: #c44;
  font-size: 0.85rem;
  margin-top: -8px;
  display: none;
}

/* ---- 展示区 ---- */
.showcase {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.art {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 20px;
  background: linear-gradient(
    135deg,
    var(--accent-soft),
    var(--gold-soft)
  );
}

/* ---- 图片模态框 ---- */
.img-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 26, 20, 0.92);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.img-modal.show {
  display: flex;
  opacity: 1;
}

.img-modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border: 3px double var(--border);
}

.img-modal.show img {
  transform: scale(1);
  opacity: 1;
}

/* ---- 页脚 ---- */
.footer {
  margin-top: 52px;
  padding-top: 24px;
  border-top: 3px double var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.4px;
}

.social {
  display: flex;
  gap: 12px;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--card);
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: all 220ms ease;
  will-change: transform, border-color, box-shadow;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 20px var(--shadow-lg);
  transform: translateY(-2px);
  color: var(--accent);
}

/* ---- 工具类 ---- */
.accent-underline {
  background: linear-gradient(
    transparent 60%,
    rgba(184, 148, 62, 0.28) 40%
  );
  padding: 0 3px;
}

/* ---- 动画 ---- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- 响应式 ---- */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  .showcase {
    grid-template-columns: 1fr;
  }
  .contact-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .image-grid {
    grid-template-columns: 1fr;
  }
  .title {
    font-size: 32px;
  }
  .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }
  .brand {
    position: static;
    font-size: 22px;
    margin-right: auto;
  }
  .theme-toggle {
    position: static;
    width: 32px;
    height: 32px;
    font-size: 14px;
    flex-shrink: 0;
  }
  .nav-links {
    gap: 0;
    width: 100%;
    width: 100%;
    justify-content: space-between;
  }
  .nav-links a {
    font-size: 14px;
    padding: 6px 4px;
    letter-spacing: 0;
  }
  .container {
    padding: 32px 16px;
  }
}
