/**
 * 沸点（长文）· 移动首页高保真编排（Mobile / m/ only）
 * 方案 A：字标 + 汉堡抽屉；禁止日报底栏 5 项；禁止靠挤小桌面验收
 * @import 令牌相对路径
 */
@import url("./tokens.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body.drawer-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

button {
  font-family: inherit;
}

/* —— 顶栏：字标 + 汉堡（方案 A）—— */
.m-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.m-logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  color: var(--brand-mark);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: var(--touch-min);
  line-height: 1;
}

.m-logo-sub {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

/* 签名微动效：汉堡三线 → 关闭态指示 */
.m-menu {
  width: var(--touch-min);
  height: var(--touch-min);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.m-menu-bars {
  display: block;
  width: 20px;
  height: 14px;
  position: relative;
}

.m-menu-bars span {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.2s ease,
    top 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.m-menu-bars span:nth-child(1) {
  top: 0;
}
.m-menu-bars span:nth-child(2) {
  top: 6px;
}
.m-menu-bars span:nth-child(3) {
  top: 12px;
}

body.drawer-open .m-menu-bars span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}
body.drawer-open .m-menu-bars span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.4);
}
body.drawer-open .m-menu-bars span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

/* —— 抽屉 —— */
.m-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: row-reverse;
}

.m-drawer[hidden] {
  display: none;
}

.m-drawer-backdrop {
  flex: 1;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(20, 18, 16, 0.28);
  cursor: pointer;
  animation: m-fade-in 0.25s ease both;
}

.m-drawer-panel {
  width: min(78vw, 300px);
  background: var(--paper-elevated);
  border-left: 1px solid var(--rule);
  padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + var(--space-5))
    var(--space-5) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  animation: m-drawer-slide 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes m-drawer-slide {
  from {
    transform: translateX(12px);
    opacity: 0.85;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes m-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.m-drawer-mark {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  color: var(--ink);
}

.m-drawer-mark span {
  margin-left: 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.m-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.m-drawer-nav a {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: var(--space-2) 0;
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule);
}

.m-drawer-nav a.is-active {
  color: var(--boil-ink);
  font-weight: var(--fw-semibold);
  box-shadow: inset 3px 0 0 var(--boil);
  padding-left: var(--space-3);
}

.m-drawer-nav a:active {
  color: var(--ink);
}

.m-drawer-sibling {
  color: var(--ink) !important;
}

.m-drawer-sibling::after {
  content: " →";
  color: var(--ink-faint);
  font-weight: var(--fw-regular);
}

.m-drawer-note {
  margin: var(--space-4) 0 0;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
  line-height: var(--lh-body);
}

/* —— 单列目录 —— */
.m-essay-index {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-3) var(--gutter) var(--space-6);
  position: relative;
}

.m-essay-index::before {
  content: "";
  position: absolute;
  right: var(--gutter);
  top: var(--space-2);
  width: 36px;
  height: 36px;
  background: url("/assets/ui-accents/svg/home-motif-essay.svg") no-repeat center / contain;
  pointer-events: none;
  opacity: 0.85;
}

.masthead-dek {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-regular);
  line-height: var(--lh-snug);
  color: var(--ink-muted);
}

.masthead-rule {
  height: 8px;
  margin-bottom: var(--space-3);
  background: url("/assets/ui-accents/svg/divider-rule-tip.svg") no-repeat left center / 100% 8px;
}

/* 签名：spotlight 主标题短 fade + translateY（一次） */
.is-spotlight .m-essay-title a {
  display: inline-block;
  animation: m-essay-title-in 0.45s ease-out both;
}

@keyframes m-essay-title-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.m-essay-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.m-essay-row {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--rule);
}

.m-essay-row.is-spotlight {
  border-top: 3px solid var(--boil); /* P0 focus-bar-h */
  padding-top: var(--space-3);
}


.m-essay-row:first-child {
  padding-top: 0;
}

.m-essay-hero {
  width: 100%;
  aspect-ratio: 5 / 3;
  max-height: 220px;
  margin-bottom: var(--space-3);
  background:
    linear-gradient(160deg, rgba(20, 18, 16, 0.04) 0%, rgba(20, 18, 16, 0.09) 100%),
    var(--paper-elevated);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.m-essay-hero-label {
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.m-essay-hero-spec {
  font-size: var(--fs-label);
  color: var(--ink-faint);
}

.m-essay-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-h1); /* 26px via .is-mobile */
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

.is-spotlight .m-essay-title {
  font-size: var(--fs-display-sm); /* 28px */
}

.m-essay-title a {
  display: block;
  min-height: var(--touch-min);
  padding: 4px 0;
  color: inherit;
}

.m-essay-title a:active {
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--rule-strong);
}

.m-essay-dek {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m-meta {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* —— 脚注单列 —— */
.m-footer {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-6) var(--gutter)
    calc(var(--space-10) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
}

.m-footer a {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule);
}

.m-footer a:active {
  color: var(--ink);
}

.m-footer-copy {
  margin-top: var(--space-4);
}

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  .m-menu-bars span,
  .m-drawer-panel,
  .m-drawer-backdrop,
  .is-spotlight .m-essay-title a {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  body.drawer-open .m-menu-bars span:nth-child(1),
  body.drawer-open .m-menu-bars span:nth-child(3) {
    transform: none;
  }

  body.drawer-open .m-menu-bars span:nth-child(2) {
    opacity: 0;
  }
}

/* 真实 Hero 图 */
.m-essay-hero {
  padding: 0;
  overflow: hidden;
}
.m-essay-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.m-essay-hero-label,
.m-essay-hero-spec {
  display: none;
}
