/* ==========================================================
   我的小站 · 样式表
   颜色都定义成变量，浅色 / 深色模式只需要换一组变量
   ========================================================== */

/* ---------- 浅色模式（默认） ---------- */
:root {
  --css-loaded: 1;            /* 给 main.js 检测"CSS 有没有加载成功"用的 */

  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #1c1d26;
  --muted: #6b6f80;
  --line: #e4e5ee;
  --primary: #5b5bd6;
  --primary-soft: #ececfd;
  --ok: #16a34a;
  --warn: #d97706;
  --fail: #dc2626;
  --shadow: 0 1px 2px rgba(20, 20, 50, .04), 0 8px 24px rgba(20, 20, 50, .06);

  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, Menlo, monospace;
}

/* ---------- 深色模式 ----------
   1. 没手动选过：跟随系统
   2. 手动点了按钮：按 data-theme 来 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111218;
    --surface: #1a1b23;
    --text: #ececf3;
    --muted: #9a9db0;
    --line: #2a2c38;
    --primary: #8b8bf5;
    --primary-soft: #26264a;
    --ok: #4ade80;
    --warn: #fbbf24;
    --fail: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  --bg: #111218;
  --surface: #1a1b23;
  --text: #ececf3;
  --muted: #9a9db0;
  --line: #2a2c38;
  --primary: #8b8bf5;
  --primary-soft: #26264a;
  --ok: #4ade80;
  --warn: #fbbf24;
  --fail: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}

code { font-family: var(--mono); font-size: .92em; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 导航 ---------- */
.nav {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .2s;
}
.theme-btn:hover { transform: rotate(-15deg); }
.theme-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 浅色时显示月亮，深色时显示太阳 */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------- 首屏 ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 48px 0 56px;
}

.version {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

h1 {
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: 16px;
}

.lead {
  font-size: 18px;
  color: var(--muted);
  max-width: 30em;
  margin-bottom: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 500;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.status.live .dot { background: var(--ok); animation: pulse 2s infinite; }
.status.local .dot { background: var(--warn); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
  margin: -8px 0 16px;
}

/* ---------- 访问信息 ---------- */
.info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 24px;
}
.info dt {
  font-size: 13px;
  color: var(--muted);
}
.info dd {
  font-size: 16px;
  font-weight: 600;
  word-break: break-all;
}

/* ---------- 文件清单 ---------- */
.files { list-style: none; }

.files li {
  display: grid;
  grid-template-columns: 56px minmax(150px, auto) 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.files li:first-child { border-top: none; }

.tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 4px 0;
  border-radius: 6px;
  color: #fff;
}
.tag-html { background: #e44d26; }
.tag-css  { background: #2965f1; }
.tag-js   { background: #d4a20b; }
.tag-svg  { background: #d14b8f; }
.tag-img  { background: #0d9488; }
.tag-ico  { background: #7c3aed; }
.tag-md   { background: #64748b; }

.desc {
  color: var(--muted);
  font-size: 14px;
}

/* 右侧状态：默认是灰色的"等待中" */
.state {
  font-size: 13px;
  color: var(--muted);
  min-width: 28px;
  text-align: right;
}
.state:empty::after { content: "…"; }
.state.ok   { color: var(--ok);   font-size: 18px; font-weight: 700; }
.state.fail { color: var(--fail); font-size: 18px; font-weight: 700; }
.state.skip { font-size: 12px; }

/* ---------- 更新记录 ---------- */
.log {
  list-style: none;
}
.log li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.log-v {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 10px;
  border-radius: 999px;
}

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 20px 48px;
}

.noscript {
  text-align: center;
  color: var(--warn);
  padding-bottom: 32px;
}

/* ---------- 手机屏幕 ---------- */
@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 24px 0 36px;
  }
  .lead { font-size: 16px; }
  .card { padding: 22px 18px; }
  .info { grid-template-columns: 1fr; }
  .files li {
    grid-template-columns: 48px 1fr auto;
    gap: 4px 12px;
  }
  .files .tag { grid-row: 1 / 3; }
  .files .desc {
    grid-column: 2 / 3;
    grid-row: 2;
  }
  .files .state { grid-row: 1 / 3; grid-column: 3; }
}
