/* ===================================================================
   runsky_daily — 视频日记
   炫酷且移动友好。规范见 docs/html-tech-spec.md
   =================================================================== */

/* === reset === */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, video, iframe { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
* { -webkit-tap-highlight-color: transparent; }
a, button { touch-action: manipulation; }

/* === tokens === */
:root {
  --bg: #0b0b0d;
  --bg-soft: #131316;
  --fg: #ececec;
  --fg-mute: #8a8a93;
  --line: #25252a;
  --accent: #ff5a36;
  --accent-soft: color-mix(in oklch, var(--accent) 35%, transparent);
  --accent-strong: color-mix(in oklch, var(--accent) 80%, white);

  --container: 1080px;
  --radius: 14px;
  --radius-lg: 24px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
          "Helvetica Neue", "Inter", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

@property --hue-shift {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

html, body { background: var(--bg); color: var(--fg); }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a { color: inherit; text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: #fff; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 40px);
}

/* === 噪点纹理（全屏覆盖） === */
.noise {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: overlay;
  z-index: 1;
}

/* === 渐变 mesh 背景 === */
.mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 50% at 15% 10%, var(--accent-soft), transparent 70%),
    radial-gradient(50% 50% at 85% 25%, color-mix(in oklch, var(--accent) 30%, #4f46e5) 0%, transparent 65%),
    radial-gradient(60% 60% at 50% 110%, color-mix(in oklch, var(--accent) 25%, #ec4899) 0%, transparent 60%);
  filter: blur(40px) saturate(1.2);
  animation: mesh-drift 24s ease-in-out infinite alternate;
}

@keyframes mesh-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(2%, -3%, 0) scale(1.08); }
}

/* === header === */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 14px 0;
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in oklch, var(--line) 60%, transparent);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.85); }
}
.brand-name {
  display: inline-flex;
  align-items: baseline;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand-name .b-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  background: linear-gradient(115deg, var(--accent), color-mix(in oklch, var(--accent) 50%, #fbbf24));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-name .b-tail {
  font-weight: 600;
  margin-left: 4px;
}
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--fg-mute); font-size: 14px; }
.site-nav a:hover { color: var(--fg); }

/* === hero === */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: clamp(80px, 12vh, 140px) 0 60px;
  z-index: 2;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--accent);
  margin: 0 0 22px;
  text-transform: uppercase;
}
.hero-title {
  font-size: clamp(2.6rem, 9vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 800;
  margin: 0 0 28px;
  text-wrap: balance;
  color: var(--fg);
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title em {
  font-style: normal;
  background: linear-gradient(115deg, var(--accent), color-mix(in oklch, var(--accent) 50%, #fbbf24));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: var(--fg-mute);
  max-width: 560px;
  margin: 0 0 36px;
  line-height: 1.65;
}
.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--fg-mute);
  background: color-mix(in oklch, var(--bg-soft) 70%, transparent);
  backdrop-filter: blur(10px);
}
.hero-meta strong { color: var(--fg); font-weight: 600; }
.hero-meta .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}
.hero-meta .sep { opacity: .5; }
.hero-scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 36px;
  border: 1.5px solid var(--fg-mute);
  border-radius: 12px;
  opacity: .6;
}
.hero-scroll-hint span {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: var(--fg);
  animation: scroll-hint 1.6s ease-in-out infinite;
}
@keyframes scroll-hint {
  0%, 100% { transform: translate(-50%, 0); opacity: 1; }
  50% { transform: translate(-50%, 12px); opacity: .2; }
}

/* === posts section === */
.posts-section {
  position: relative;
  padding: 80px 0 100px;
  z-index: 2;
}
.section-title {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 36px;
  font-size: clamp(1.5rem, 4vw, 2rem);
  letter-spacing: -0.02em;
  font-weight: 700;
}
.section-title .num {
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--accent);
  font-weight: 500;
}

/* === posts list === */
.posts { display: grid; gap: 0; }
.loading { color: var(--fg-mute); padding: 40px 0; text-align: center; }

.post-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(16px, 3vw, 32px);
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  transition: padding .3s ease;
}
.post-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
  border-radius: var(--radius);
}
.post-card:hover::before { opacity: 1; }
.post-card:hover { padding-left: 16px; padding-right: 16px; }
.post-card .date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-mute);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.post-card .body h3 {
  margin: 0 0 6px;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.post-card .body p {
  margin: 0;
  color: var(--fg-mute);
  font-size: 14.5px;
  line-height: 1.55;
}
.post-card .arrow {
  font-family: var(--font-mono);
  color: var(--fg-mute);
  font-size: 18px;
  transition: transform .3s ease, color .3s ease;
}
.post-card:hover .arrow {
  transform: translateX(6px);
  color: var(--accent);
}
@media (max-width: 600px) {
  .post-card { grid-template-columns: 1fr auto; }
  .post-card .date { grid-column: 1 / -1; font-size: 12px; }
}

/* === post page === */
.post {
  padding-top: 120px;
  padding-bottom: 80px;
  position: relative;
  z-index: 2;
}
.post-header { margin-bottom: 32px; }
.post-date {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0 0 12px;
}
.post-title {
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 16px;
  text-wrap: balance;
}
.post-excerpt {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--fg-mute);
  margin: 0;
}
.video-wrap {
  margin: 32px 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
  box-shadow: 0 30px 80px -20px color-mix(in oklch, var(--accent) 30%, black);
  border: 1px solid var(--line);
}
.video-wrap iframe,
.video-wrap video,
.video-wrap img { width: 100%; height: 100%; border: 0; object-fit: contain; }
.post-content { font-size: 16.5px; max-width: 720px; }
.post-content h2 { font-size: 1.5rem; margin: 48px 0 16px; letter-spacing: -0.015em; }
.post-content h3 { font-size: 1.2rem; margin: 32px 0 12px; }
.post-content p { margin: 16px 0; }
.post-content ul,
.post-content ol { padding-left: 1.25em; margin: 18px 0; }
.post-content li { margin: 8px 0; }
.post-content a { color: var(--accent-strong); border-bottom: 1px solid currentColor; }
.post-content img { border-radius: var(--radius); margin: 20px 0; }
.post-content figure { margin: 28px 0; }
.post-content figure img { margin: 0; border: 1px solid var(--line); }
.post-content figcaption {
  margin-top: 10px;
  color: var(--fg-mute);
  font-size: 13px;
  line-height: 1.6;
}
.post-content pre {
  background: var(--bg-soft);
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  border: 1px solid var(--line);
}
.post-content code { font-family: var(--font-mono); font-size: 0.92em; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 22px 0;
  padding: 4px 18px;
  color: var(--fg-mute);
}
.post-footer { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.back { color: var(--fg-mute); font-family: var(--font-mono); font-size: 13px; }
.back:hover { color: var(--accent); }

/* === 平台卡片（about 页面） === */
.platforms {
  list-style: none;
  padding: 0;
  margin: 24px 0 36px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.platforms li { margin: 0; }
.post-content .platforms a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line); /* override post-content default underline */
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--bg-soft) 60%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--fg);
  transition: transform .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
  text-decoration: none;
}
.post-content .platforms a:hover {
  border-color: var(--platform-color, var(--accent));
  color: var(--platform-color, var(--accent));
  transform: translateY(-2px);
  box-shadow: 0 16px 40px -16px var(--platform-color, var(--accent));
}
.platforms .p-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: color-mix(in oklch, var(--platform-color, var(--accent)) 18%, transparent);
  color: var(--platform-color, var(--accent));
  flex-shrink: 0;
}
.platforms .p-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.platforms .p-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.platforms .p-handle {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-mute);
  margin-top: 2px;
}
.platforms .p-arrow {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--fg-mute);
  transition: transform .25s ease, color .25s ease;
}
.post-content .platforms a:hover .p-arrow {
  color: var(--platform-color, var(--accent));
  transform: translate(3px, -3px);
}
.platforms .p-douyin  { --platform-color: #fe2c55; }
.platforms .p-wechat  { --platform-color: #07c160; }
.platforms .p-redbook { --platform-color: #ff2442; }

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
  gap: 16px;
  margin: 18px 0 34px;
}
.qr-card {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--bg-soft) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.post-content .qr-card img {
  width: 100%;
  aspect-ratio: 1;
  margin: 0;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.qr-card figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  color: var(--fg);
  line-height: 1.45;
}
.qr-card figcaption span {
  color: var(--fg-mute);
  font-size: 13px;
}
.qr-douyin { --platform-color: #fe2c55; }
.qr-wechat-channel { --platform-color: #07c160; }

/* === footer === */
.site-footer {
  position: relative;
  padding: 32px 0 calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--fg-mute);
  font-size: 13.5px;
  z-index: 2;
}
.site-footer .tiny { font-family: var(--font-mono); font-size: 11.5px; opacity: .55; margin: 4px 0 0; }

/* === 404 === */
.center-screen {
  min-height: calc(100dvh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* === reveal 入场动画 === */
body.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s cubic-bezier(.16,1,.3,1), transform .9s cubic-bezier(.16,1,.3,1);
}
body.reveal-ready [data-reveal].in { opacity: 1; transform: none; }

/* === View Transitions === */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .35s; }

/* === 减弱动画偏好 === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .mesh { animation: none; }
}

/* === 浅色主题（系统切换） === */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fffaf7;
    --bg-soft: #fff3ed;
    --fg: #171316;
    --fg-mute: #57505a;
    --line: #eadfd9;
  }
  .mesh {
    opacity: .62;
    filter: blur(48px) saturate(1.08);
  }
  .noise { opacity: .018; mix-blend-mode: multiply; }
  .site-header {
    background: color-mix(in oklch, white 78%, transparent);
  }
  .hero-title {
    color: #151216;
    text-shadow: 0 1px 0 rgba(255,255,255,.36);
  }
  .hero-sub,
  .hero-meta {
    color: #4f4652;
  }
  .post-content pre { background: #f0f0f2; }
}
