/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- 设计变量：亮色（纸） ---------- */
:root {
  --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --font-mono: 'Space Mono', 'JetBrains Mono', ui-monospace, 'PingFang SC', 'Microsoft YaHei', monospace;
  --font-art: 'Ma Shan Zheng', 'Kaiti SC', 'STKaiti', 'KaiTi', 'Noto Serif SC', serif;

  --canvas: #F5F6F3;
  --surface: #FFFFFF;
  --ink: #1A201D;
  --muted: #5F6B65;
  --faint: #939E98;
  --line: #E4E7E2;
  --accent: #2C8776;
  --accent-soft: rgba(44, 135, 118, 0.10);
  --grid: rgba(26, 32, 29, 0.04);

  /* 星尘：亮色下是灰绿微尘，整层压暗 */
  --star: #6B7A73;
  --stars-opacity: 0.45;

  --shadow: 0 1px 2px rgba(26, 32, 29, .04), 0 8px 24px rgba(26, 32, 29, .05);
  --shadow-lift: 0 2px 6px rgba(44, 135, 118, .06), 0 14px 34px rgba(44, 135, 118, .13);
}

/* ---------- 设计变量：暗色（夜） ---------- */
[data-theme="dark"] {
  --canvas: #101418;
  --surface: #171C21;
  --ink: #E7EBE8;
  --muted: #8B968F;
  --faint: #5F6A64;
  --line: #262C31;
  --accent: #55B7A2;
  --accent-soft: rgba(85, 183, 162, 0.12);
  --grid: rgba(231, 235, 232, 0.028);

  /* 星尘：暗色下是近白星光，整层更亮 */
  --star: #E3EAE6;
  --stars-opacity: 0.9;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 6px rgba(85, 183, 162, .10), 0 16px 40px rgba(0, 0, 0, .5);
}

/* ---------- 页面基底 ---------- */
html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .45s ease, color .45s ease;
}

/* ---------- 背景网格纹理 ---------- */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 85% 65% at 50% -5%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 85% 65% at 50% -5%, #000 35%, transparent 100%);
}

/* ---------- 星尘点缀层 ---------- */
.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  /* 与网格同层，DOM 在后故叠于网格之上、内容之下 */
  pointer-events: none;
  opacity: var(--stars-opacity);
  transition: opacity .45s ease;
}

.star {
  position: absolute;
  border-radius: 50%;
  color: var(--star);
  background: currentColor;
  opacity: var(--o-min, .1);
  animation: twinkle 5s ease-in-out infinite;
  transition: color .45s ease;
}

.star--accent {
  color: var(--accent);
}

.star--bright {
  box-shadow: 0 0 6px 1px currentColor;
}

@keyframes twinkle {

  0%,
  100% {
    opacity: var(--o-min, .08);
  }

  50% {
    opacity: var(--o-max, .8);
  }
}

/* ---------- 容器：撑满视口，让页脚贴底 ---------- */
.wrap {
  width: 100%;
  max-width: 940px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 24px 24px;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏：站名居左，主题按钮居右，垂直齐平 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 42px;
}

/* 书法体站名 */
.brand {
  font-family: var(--font-art);
  font-weight: 400;
  font-size: 27px;
  line-height: 1;
  letter-spacing: .05em;
  color: var(--ink);
  user-select: none;
}

.brand-no {
  color: var(--accent);
  font-size: .78em;
  margin: 0 3px;
}

.theme-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .25s, border-color .25s, background-color .45s, transform .15s;
}

.theme-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-btn:active {
  transform: scale(.93);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- 时间 · 问候 ---------- */
.hero {
  margin-bottom: 58px;
}

.greeting {
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .04em;
  margin-bottom: 14px;
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(54px, 12vw, 92px);
  line-height: .92;
  letter-spacing: -.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.clock-sec {
  font-size: clamp(20px, 4vw, 30px);
  font-weight: 400;
  color: var(--faint);
}

.date {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: .01em;
}

/* ---------- 卡片网格：少而大 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 64px;
}

/* ---------- 入口卡片 ---------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  min-height: 136px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .22s cubic-bezier(.2, .7, .3, 1), border-color .22s, box-shadow .22s, background-color .45s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}

.card:focus-visible {
  outline: none;
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift), 0 0 0 4px var(--accent-soft);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

/* 图标方块 */
.card-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--canvas);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  /* 文字兜底时使用 */
  font-weight: 700;
  font-size: 17px;
  color: var(--muted);
  transition: color .22s, background-color .22s, border-color .22s;
}

.card-mark svg {
  width: 21px;
  height: 21px;
}

.card:hover .card-mark,
.card:focus-visible .card-mark {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}

.card-arrow {
  display: flex;
  color: var(--accent);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity .22s, transform .22s;
}

.card:hover .card-arrow,
.card:focus-visible .card-arrow {
  opacity: 1;
  transform: translate(0, 0);
}

.card-arrow svg {
  width: 15px;
  height: 15px;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  font-size: 12px;
  color: var(--faint);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 页脚 · 版权与备案 ---------- */
.foot {
  margin-top: auto;
  /* 内容不足一屏时贴住底部 */
  padding: 20px 0 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}

.foot .dot {
  color: var(--line);
  user-select: none;
}

.foot a {
  color: inherit;
  text-decoration: none;
  transition: color .2s;
}

.foot a:hover {
  color: var(--accent);
}

/* ---------- 载入动画 ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand,
.hero,
.card,
.foot {
  animation: rise .6s cubic-bezier(.2, .7, .3, 1) both;
}

.card {
  animation-delay: calc(.1s + var(--d, 0) * .055s);
}

.foot {
  animation-delay: .5s;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 20px 18px 20px;
  }

  .topbar {
    margin-bottom: 32px;
  }

  .brand {
    font-size: 23px;
  }

  .hero {
    margin-bottom: 44px;
  }

  .cards {
    margin-bottom: 48px;
  }
}

@media (max-width: 400px) {
  .cards {
    gap: 10px;
  }

  .card {
    min-height: 118px;
    padding: 16px;
    gap: 18px;
  }

  .card-mark {
    width: 40px;
    height: 40px;
  }

  .card-mark svg {
    width: 19px;
    height: 19px;
  }
}

/* ---------- 尊重「减少动态效果」偏好 ---------- */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-delay: 0ms !important;
    transition-duration: .001ms !important;
  }

  .star {
    animation: none !important;
    opacity: .35;
  }
}