/**
 * 沸点（长文）· 移动内页（about / business / posts）
 * 顶栏/抽屉/脚注节奏自 m/css/home.css 抽出；正文独立；禁止桌面 @media 冒充
 */
@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;
}

/* —— 顶栏：字标 + 汉堡 —— */
.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-6))
    var(--space-6) var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  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(--ink);
  font-weight: var(--fw-semibold);
}

.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-page {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-6) var(--gutter) var(--space-8);
}

.m-page-back {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  margin-bottom: var(--space-4);
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
  color: var(--ink-muted);
}

.m-page-back:active {
  color: var(--ink);
}

.m-page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-display-sm);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.m-page-dek {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink-muted);
}

.m-page-meta {
  margin: var(--space-4) 0 0;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.m-page-rule {
  height: 1px;
  background: var(--rule-strong);
  margin: var(--space-5) 0 var(--space-6);
}

.m-section-label {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-label);
  font-weight: var(--fw-medium);
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}

/* —— 正文 —— */
.m-prose h2 {
  margin: var(--space-8) 0 var(--space-3);
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  color: var(--ink);
}

.m-prose h2:first-child {
  margin-top: 0;
}

.m-prose p {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
}

.m-prose ul,
.m-prose ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.35em;
  color: var(--ink);
}

.m-prose li {
  margin-bottom: var(--space-2);
  line-height: var(--lh-body);
}

.m-prose a {
  color: var(--boil);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

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

.m-prose code,
.m-prose .email-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.m-prose .email-box {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
  background: var(--paper-elevated);
  min-height: var(--touch-min);
  line-height: calc(var(--touch-min) - var(--space-4));
}

.m-prose .no-price {
  color: var(--ink-muted);
}

.m-prose .footnote {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
  font-size: var(--fs-caption);
  color: var(--ink-muted);
}

.m-prose .footnote ol {
  padding-left: 1.2em;
}

.m-prose .sibling-note {
  margin-top: var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  font-size: var(--fs-caption);
  color: var(--ink-muted);
  background: var(--paper-elevated);
}

.m-page-back-row {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
}

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

.m-page-back-row a:active {
  color: var(--ink);
}

/* —— 脚注单列 —— */
.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 {
    transition: none !important;
    animation: none !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;
  }
}
