/* ------------------------------------------------------------------
 * Design tokens — the "cinematic" motion system.
 * Every animation in the app should reference one of the 2–3 duration
 * tiers below instead of hand-writing timing per component.
 * ------------------------------------------------------------------ */
:root {
  /* --- duration tiers -------------------------------------------- */
  --dur-fast: 150ms;   /* micro feedback: taps, toggles, hovers   */
  --dur-base: 300ms;   /* cards, sheets, shared-element default   */
  --dur-slow: 550ms;   /* page / route / hero transitions         */

  /* --- easing ----------------------------------------------------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- color ------------------------------------------------------ */
  --bg: #08080d;
  --bg-2: #0d0d15;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f3f3f8;
  --text-2: rgba(243, 243, 248, 0.62);
  --text-3: rgba(243, 243, 248, 0.38);
  --accent: #ff5c7c;
  --accent-2: #ff9a6b;
  --accent-soft: rgba(255, 92, 124, 0.14);
  --like: #ff4d6d;

  /* --- shape ------------------------------------------------------ */
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.75);
  --maxw: 640px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
/* ------------------------------------------------------------------
 * Base / global styles + the native View Transitions "底座".
 * ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* Lenis smooth-scroll hooks */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ambient cinematic backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 12% 0%, rgba(255, 92, 124, 0.16), transparent 62%),
    radial-gradient(52% 46% at 92% 8%, rgba(110, 120, 255, 0.14), transparent 62%),
    radial-gradient(70% 60% at 50% 104%, rgba(255, 154, 107, 0.08), transparent 62%);
}

a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
}
::selection {
  background: var(--accent);
  color: #fff;
}

/* Thin scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

/* ------------------------------------------------------------------
 * Cross-document View Transitions
 * Opt every same-origin navigation into a native transition. The
 * shared-element morph is driven purely by matching view-transition-name
 * values on the two documents (see PostCard / PostDetail).
 * ------------------------------------------------------------------ */
@view-transition {
  navigation: auto;
}

::view-transition-group(*) {
  animation-duration: var(--dur-slow);
  animation-timing-function: var(--ease-out);
}
::view-transition-group(root) {
  animation-duration: var(--dur-base);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--dur-base);
  animation-timing-function: var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  ::view-transition-group(*),
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 1ms !important;
  }
}

/* ------------------------------------------------------------------ */
/* Small shared primitives                                            */
/* ------------------------------------------------------------------ */
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  font-weight: 700;
  color: #fff;
  border-radius: 14px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.tag-chip {
  font-size: 11px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(255, 92, 124, 0.25);
  white-space: nowrap;
}
/* Shared UI across both documents */

.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 120;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(255, 92, 124, 0.6);
}

/* Header ---------------------------------------------------------- */
.app-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(8, 8, 13, 0.86), rgba(8, 8, 13, 0));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.app-header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand-dot {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 22px rgba(255, 92, 124, 0.55);
}
.brand-sub {
  margin-left: 2px;
  color: var(--text-3);
  font-weight: 500;
  font-size: 12px;
}
.publish-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(10px);
}
.publish-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.publish-icon {
  width: 15px;
  height: 15px;
}

/* Like button ----------------------------------------------------- */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}
.like-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}
.like-btn.is-liked {
  color: var(--like);
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.3);
}
.like-btn .heart {
  width: 18px;
  height: 18px;
  display: block;
}
.like-btn--md {
  padding: 9px 18px 9px 14px;
  font-size: 14px;
}
.like-btn--md .heart {
  width: 20px;
  height: 20px;
}
.like-count {
  min-width: 1ch;
}

/* Comment metric */
.card-metric {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.metric-icon {
  width: 17px;
  height: 17px;
}
