/* ========== HoshiKoi 博客 · 终端科技风 ========== */
:root {
  --bg: #0a0a0f;
  --surface: #111118;
  --card: #15151e;
  --ink: #d6d6e0;
  --muted: #6b6b78;
  --accent: #2cc9ff;
  --accent-dim: rgba(44, 201, 255, 0.14);
  --line: #232330;
  --glow: 0 0 24px rgba(44, 201, 255, 0.25);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  /* 细网格背景 */
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
}
::selection { background: var(--accent-dim); color: var(--accent); }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }

/* ---------- 顶栏（终端式） ---------- */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 12.5px;
}
.logo {
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo .prompt { color: var(--accent); }
.logo .cursor {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
  vertical-align: -2px;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links { display: flex; gap: 26px; }
.nav-links a {
  color: var(--muted);
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
  position: relative;
}
.nav-links a::before { content: "./"; color: var(--accent); opacity: 0; transition: opacity 0.2s; }
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::before { opacity: 1; }

/* ---------- Hero ---------- */
.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: 96px 32px 72px;
}
.hero-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.15em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-tag::before {
  content: "";
  width: 32px; height: 1px;
  background: var(--accent);
}
.hero h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(38px, 6.5vw, 68px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 22px;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), #7be3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--muted);
  max-width: 52ch;
  font-size: 15.5px;
  margin-bottom: 36px;
}
.hero-stats {
  display: flex;
  gap: 40px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.hero-stats b { color: var(--accent); font-weight: 700; font-size: 20px; display: block; margin-bottom: 2px; }

/* ---------- 主体 ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 32px 96px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.section-head h3 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.05em;
}
.section-head h3::before { content: "# "; color: var(--accent); }
.section-head .count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }

/* 文章行 */
.post-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 22px 16px;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.post-row:hover {
  background: var(--surface);
  border-left-color: var(--accent);
}
.post-row .date {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.post-row h4 {
  font-weight: 600;
  font-size: 17.5px;
  color: #fff;
  margin-bottom: 5px;
  transition: color 0.2s;
}
.post-row:hover h4 { color: var(--accent); }
.post-row .excerpt { color: var(--muted); font-size: 13.5px; max-width: 64ch; }

.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(44, 201, 255, 0.3);
  padding: 3px 10px;
  border-radius: 3px;
  white-space: nowrap;
}

.empty-state {
  padding: 64px 0;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  padding: 11px 26px;
  border-radius: 4px;
  background: var(--accent);
  color: #06121a;
  font-weight: 700;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.btn:hover { box-shadow: var(--glow); color: #06121a; }
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  font-weight: 400;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.btn.small { padding: 7px 16px; font-size: 11.5px; }

/* ---------- 文章页 ---------- */
.article-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 32px 96px;
}
.article-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}
.article-title {
  font-weight: 700;
  font-size: clamp(28px, 4.5vw, 42px);
  line-height: 1.35;
  color: #fff;
  margin-bottom: 36px;
  letter-spacing: 0.01em;
}
.article-body { font-size: 16px; line-height: 1.9; }
.article-body p { margin-bottom: 1.4em; }
.article-body h1, .article-body h2, .article-body h3 {
  font-weight: 700;
  color: #fff;
  margin: 2em 0 0.8em;
  line-height: 1.4;
}
.article-body h1 { font-size: 26px; }
.article-body h2 { font-size: 22px; }
.article-body h2::before { content: "## "; color: var(--accent); font-family: var(--mono); font-size: 0.8em; }
.article-body h3 { font-size: 18px; }
.article-body h3::before { content: "### "; color: var(--accent); font-family: var(--mono); font-size: 0.8em; }
.article-body blockquote {
  border-left: 2px solid var(--accent);
  background: var(--surface);
  padding: 14px 20px;
  margin: 1.6em 0;
  color: var(--muted);
}
.article-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--accent);
}
.article-body pre {
  background: #0d1117;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 1.6em 0;
}
.article-body pre code { background: none; border: none; padding: 0; color: #9be9ff; }
.article-body ul, .article-body ol { margin: 0 0 1.4em 1.5em; }
.article-body li { margin-bottom: 0.4em; }
.article-body li::marker { color: var(--accent); }
.article-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-body hr { border: none; border-top: 1px dashed var(--line); margin: 2.4em 0; }
.article-body img { max-width: 100%; border-radius: 6px; border: 1px solid var(--line); }
.article-end {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 13px;
  margin-top: 48px;
}
.back-link {
  display: inline-block;
  margin-top: 40px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); }

/* ---------- 页脚 ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 32px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.footer .heart { color: var(--accent); }

/* ---------- Admin ---------- */
.admin-shell { max-width: 1000px; margin: 0 auto; padding: 48px 32px 96px; }
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.admin-head h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
}
.admin-head h1 span { color: var(--accent); }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.login-box {
  max-width: 400px;
  margin: 110px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 40px;
}
.login-box h1 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  margin-bottom: 6px;
}
.login-box h1 span { color: var(--accent); }
.login-box p { color: var(--muted); font-size: 13px; margin-bottom: 24px; font-family: var(--mono); }
.login-box .footer-note { margin-top: 18px; font-size: 11.5px; }

.field { margin-bottom: 18px; text-align: left; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 7px;
}
.field label::before { content: "> "; color: var(--accent); }
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field textarea { min-height: 340px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.75; }

.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.preview-pane {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 24px;
  min-height: 340px;
  font-size: 14.5px;
  line-height: 1.85;
  overflow-wrap: break-word;
}
.preview-pane h1, .preview-pane h2, .preview-pane h3 { color: #fff; margin: 1em 0 0.5em; }
.preview-pane p { margin-bottom: 1em; }
.preview-pane code { font-family: var(--mono); font-size: 0.88em; background: var(--bg); padding: 1px 6px; border-radius: 4px; color: var(--accent); }
.preview-pane pre { background: #0d1117; border-radius: 6px; padding: 14px 18px; overflow-x: auto; margin: 1em 0; }
.preview-pane pre code { background: none; padding: 0; color: #9be9ff; }
.preview-pane blockquote { border-left: 2px solid var(--accent); padding: 8px 14px; background: var(--surface); color: var(--muted); margin: 1em 0; }
.preview-pane ul, .preview-pane ol { margin: 0 0 1em 1.4em; }
.preview-pane img { max-width: 100%; }
.preview-pane a { color: var(--accent); }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--surface); }
.admin-table .title-cell { font-weight: 600; font-size: 15px; color: #fff; }
.admin-table .ops { white-space: nowrap; text-align: right; }
.link-btn {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.link-btn:hover { color: var(--accent); }
.link-btn.danger:hover { color: #ff5f56; }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 12px 24px;
  border-radius: 6px;
  box-shadow: var(--glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hint {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  padding: 16px 20px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.9;
}
.hint code { font-family: var(--mono); background: var(--card); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--accent); }
.hint b { color: var(--ink); }

/* ---------- 板块面板（层次分割） ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 36px 36px 32px;
  margin-bottom: 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  position: relative;
}
/* 每个面板左上角一点青色"端口"标记 */
.panel::before {
  content: "";
  position: absolute;
  top: -1px; left: 32px;
  width: 56px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 12px rgba(44, 201, 255, 0.5);
}
.panel .section-head {
  border-bottom: 1px dashed var(--line);
  padding: 0 0 18px;
  margin-bottom: 24px;
}
.panel-desc { color: var(--muted); font-size: 13px; margin: -10px 0 22px; font-family: var(--mono); }

/* ---------- 关于我 ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 36px;
  align-items: start;
}
.about-avatar svg { width: 100%; display: block; }
.about-main h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 26px;
  color: #fff;
  margin-bottom: 6px;
}
.about-title { color: var(--accent); font-family: var(--mono); font-size: 13px; margin-bottom: 16px; }
.about-bio { color: var(--ink); max-width: 62ch; margin-bottom: 22px; }
.about-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 24px;
  margin-bottom: 24px;
}
.fact {
  font-family: var(--mono);
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}
.fact-k { color: var(--accent); min-width: 70px; }
.fact-k::before { content: "> "; opacity: 0.6; }
.fact-v { color: var(--ink); }
.about-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- 摄影网格 ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.photo-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.photo-card:hover {
  transform: translateY(-4px);
  border-color: rgba(44, 201, 255, 0.5);
  box-shadow: var(--glow);
}
.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.photo-card figcaption {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.photo-title { font-weight: 600; font-size: 13.5px; color: #fff; }
.photo-meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); flex: 1; }
.photo-dl {
  font-family: var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}
.photo-dl:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 文件下载列表 ---------- */
.file-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.file-row:hover { background: var(--card); border-left-color: var(--accent); }
.file-kind {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(44, 201, 255, 0.3);
  border-radius: 4px;
  padding: 4px 8px;
  min-width: 44px;
  text-align: center;
}
.file-main { flex: 1; min-width: 0; }
.file-name { display: block; font-family: var(--mono); font-size: 14px; color: #fff; }
.file-desc { display: block; font-size: 12.5px; color: var(--muted); }
.file-size { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* ---------- 灯箱 ---------- */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 10, 0.92);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox img {
  max-width: min(1000px, 92vw);
  max-height: 76vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}
.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .hero { padding: 64px 20px 48px; }
  .topbar-inner, .container { padding-left: 20px; padding-right: 20px; }
  .article-wrap { padding-left: 20px; padding-right: 20px; }
  .post-row { grid-template-columns: 1fr; gap: 6px; }
  .post-row .tag { justify-self: start; margin-top: 8px; }
  .editor-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 24px; flex-wrap: wrap; }
  .panel { padding: 24px 20px; }
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .about-avatar { max-width: 120px; }
  .gallery-grid { grid-template-columns: 1fr 1fr; }
  .file-row { flex-wrap: wrap; gap: 10px; }
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
}
