/* Shared mobile reading layer. Loaded after each page's local styles. */
@font-face {
  font-family: "Jianshang Serif";
  src: url("fonts/jianshang-serif-vf.woff2?v=20260824-4") format("woff2");
  font-style: normal;
  font-weight: 250 900;
  font-display: swap;
}

:root {
  --editorial-cn: "Jianshang Serif", "Songti SC", "STSong", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --ui-cn: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mobile-gutter: 18px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 124px;
}

body {
  overflow-wrap: break-word;
}

h1, h2, h3, h4,
.hero h1,
.section-head h2,
.category-intro h3,
.catalog-item h4,
.writing-card h3,
.statement h2,
.masthead h1,
.join-title {
  font-family: var(--editorial-cn);
  font-synthesis: none;
  text-wrap: pretty;
}

.topbar .brand {
  font-family: var(--editorial-cn);
  font-weight: 500;
  font-synthesis: none;
}

.masthead .free-note {
  display: block;
  margin-top: 9px;
  color: color-mix(in srgb, var(--muted, #81796f) 88%, var(--accent, #9f6658));
  font-family: var(--editorial-cn);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: .045em;
}

.masthead .subtitle a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 34%, transparent);
  text-underline-offset: .22em;
}

/* Reader-facing copy stays typographically continuous; navigation and controls remain UI sans. */
.feature h3,
.feature .dek,
.feature .read,
.catalog-item h4,
.catalog-item .catalog-copy p,
.category-intro h3,
.category-intro p,
.writing-card h3,
.writing-card p,
.writing-card-foot,
.statement h2,
.statement-copy,
.statement-copy p {
  font-family: var(--editorial-cn);
  font-synthesis: none;
}

.feature h3,
.catalog-item h4,
.writing-card h3,
.statement h2 {
  font-weight: 500;
}

.cover img,
.preview-media img,
.image-frame img,
.portrait-stack img {
  transition: transform .65s cubic-bezier(.22, .61, .36, 1),
              filter .65s cubic-bezier(.22, .61, .36, 1);
}

@media (hover: hover) and (pointer: fine) {
  .feature:hover .cover img,
  .catalog-item:hover .preview-media img {
    transform: scale(1.018);
    filter: saturate(1.025) contrast(1.012);
  }
}

img {
  max-width: 100%;
}

#latest,
#library,
#writings {
  scroll-margin-top: 124px;
}

@media (max-width: 760px) {
  :root {
    --mobile-gutter: 16px;
  }

  .shell {
    width: min(calc(100% - var(--mobile-gutter) - var(--mobile-gutter)), 1120px) !important;
  }

  /* Home: retain the complete navigation as a quiet, horizontally reachable second row. */
  .site-header .nav {
    position: relative;
    height: auto;
    min-height: 108px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 56px 52px;
    align-items: center;
  }

  .site-header .brand {
    grid-row: 1;
    min-width: 0;
    padding-right: 82px;
    font-family: var(--editorial-cn);
    font-size: 19px;
    font-weight: 500;
  }

  .site-header .brand img {
    width: 38px;
    height: 34px;
  }

  .site-header .nav-right {
    grid-row: 2;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 2px 0 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    border-top: 1px solid color-mix(in srgb, var(--line) 46%, transparent);
  }

  .site-header .nav-right::-webkit-scrollbar {
    display: none;
  }

  .site-header .nav-right a {
    display: flex !important;
    flex: 0 0 auto;
    min-height: 44px;
    align-items: center;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .025em;
    white-space: nowrap;
  }

  .site-header .theme {
    position: absolute;
    z-index: 2;
    top: 12px;
    right: 0;
    min-height: 36px;
    padding: 6px 12px;
  }

  #latest,
  #library,
  #writings {
    scroll-margin-top: 124px;
  }

  /* Home: a calmer editorial scale instead of shrinking the desktop page wholesale. */
  .hero {
    padding: 58px 0 62px;
  }

  .eyebrow {
    margin-bottom: 18px;
  }

  .hero h1 {
    font-size: clamp(39px, 11vw, 46px);
    font-weight: 400;
    line-height: 1.16;
    letter-spacing: .055em;
  }

  .intro {
    width: min(100%, 560px);
    margin-top: 25px;
    font-family: var(--editorial-cn);
    font-size: 16px;
    line-height: 1.95;
    text-align: left;
  }

  .hero-rule {
    margin-top: 29px;
  }

  .latest {
    padding: 16px 0 76px;
  }

  .section-head {
    gap: 7px;
    margin-bottom: 24px;
    padding-bottom: 16px;
  }

  .section-head h2 {
    font-size: 26px;
    font-weight: 500;
  }

  .feature {
    border-radius: 22px;
  }

  .cover {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .feature-copy {
    padding: 29px 24px 34px;
  }

  .feature h3 {
    font-size: clamp(27px, 8vw, 34px);
    font-weight: 500;
    line-height: 1.38;
  }

  .dek {
    margin-top: 18px;
    font-size: 15px;
    line-height: 1.9;
  }

  .read {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    margin-top: 22px;
  }

  .library {
    padding: 4px 0 82px;
  }

  .library-tools {
    gap: 12px;
    margin-bottom: 34px;
  }

  .category-switch {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 5px;
  }

  .category-switch::before {
    top: 5px;
    bottom: 5px;
    left: 5px;
    width: calc((100% - 19px) / 4);
    transform: translateX(calc(var(--tab-index) * (100% + 3px)));
  }

  .category-tab {
    min-width: 0;
    min-height: 44px;
    padding: 9px 2px;
    font-size: clamp(10px, 3vw, 12px);
    letter-spacing: 0;
  }

  .category-tab small {
    display: none;
  }

  .category-tab .new-mark {
    min-width: 19px;
    height: 18px;
    margin-left: 3px;
    padding: 0 4px;
  }

  .catalog-search {
    min-height: 44px;
  }

  .category-intro {
    margin-bottom: 23px;
  }

  .category-intro h3 {
    font-size: 25px;
    font-weight: 500;
  }

  .range-switch {
    gap: 5px;
    margin-bottom: 26px;
  }

  .range-tab {
    min-height: 44px;
    padding: 9px 14px;
  }

  .writings {
    padding: 66px 0 82px;
  }

  .writing-tab {
    min-height: 44px;
  }

  .writing-card h3 {
    font-size: 23px;
    line-height: 1.45;
  }

  .statement {
    padding: 66px 0;
  }

  .statement-copy {
    font-size: 16px;
    line-height: 2;
  }

  footer {
    padding-bottom: calc(52px + env(safe-area-inset-bottom));
  }

  /* Article pages: stable reading measure, gentler titles, and unmodified image ratios. */
  .topbar {
    min-height: 58px;
    height: auto;
    padding: 0 max(var(--mobile-gutter), env(safe-area-inset-left));
  }

  .topbar .brand {
    max-width: calc(100vw - 106px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar button {
    min-height: 36px;
  }

  main.article,
  .article {
    width: min(100% - calc(var(--mobile-gutter) * 2), 820px);
    padding-top: 54px;
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
    font-family: var(--editorial-cn);
    font-size: 17px;
    line-height: 1.95;
    letter-spacing: .012em;
  }

  .masthead {
    width: min(100vw - calc(var(--mobile-gutter) * 2), 820px);
    margin-bottom: 48px;
  }

  .masthead .eyebrow {
    margin-bottom: 16px;
    font-family: var(--ui-cn);
    font-size: 10px;
    letter-spacing: .16em;
  }

  .masthead h1 {
    font-size: clamp(29px, 8.1vw, 35px) !important;
    font-weight: 500 !important;
    line-height: 1.38 !important;
    letter-spacing: .015em;
  }

  .masthead .subtitle {
    max-width: 34em;
    margin-top: 19px;
    font-family: var(--ui-cn);
    font-size: 11px;
    line-height: 1.75;
    letter-spacing: .015em;
  }

  .masthead .free-note {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.75;
  }

  .masthead .rule {
    width: 38px;
    height: 1px;
    margin-top: 25px;
  }

  main.article > p,
  .article > p {
    font-family: var(--editorial-cn);
    font-size: 17px;
    line-height: 1.95;
    text-align: justify;
    text-justify: inter-ideograph;
  }

  .lead::first-letter {
    margin-top: .15em;
    font-size: 3.25em;
    font-weight: 500;
  }

  main.article figure,
  .article figure {
    max-width: 100%;
    margin-top: 42px;
    margin-bottom: 48px;
  }

  main.article .image-frame,
  .article .image-frame,
  main.article .image-frame img,
  .article .image-frame img,
  main.article .portrait-stack img,
  .article .portrait-stack img {
    max-width: 100%;
  }

  .image-frame img,
  .portrait-stack img {
    border-radius: 15px;
    box-shadow: 0 9px 28px rgba(36, 25, 16, .09);
  }

  .side-story,
  .editorial-pair {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 27px;
    margin: 54px 0 58px;
    transform: none;
  }

  .source-facts,
  .fact-grid,
  .note-grid,
  .editorial-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .join-card,
  .article > .join-card {
    width: 100%;
    max-width: 100%;
    margin: 76px 0 0;
    padding: 25px 22px;
    transform: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    text-align: center;
  }

  .join-title {
    font-size: 25px;
    font-weight: 500;
  }

  .qr-shell {
    width: min(100%, 300px);
    margin: auto;
  }

  /* About/contact: keep both destinations visible and use the same reading rhythm. */
  .top .nav {
    width: min(100% - calc(var(--mobile-gutter) * 2), 960px);
    min-height: 62px;
    height: auto;
    gap: 14px;
  }

  .top .brand {
    min-width: 0;
    font-family: var(--editorial-cn);
    font-size: 17px;
  }

  .top .brand img {
    width: 32px;
    height: 32px;
  }

  .top .nav-links {
    flex: 0 0 auto;
    gap: 4px;
  }

  .top .nav-links a,
  .top .back {
    display: flex !important;
    min-height: 44px;
    align-items: center;
    padding: 0 7px;
    font-size: 11px;
    white-space: nowrap;
  }

  body > main:not(.article) {
    width: min(calc(100% - var(--mobile-gutter) - var(--mobile-gutter)), 960px);
    margin-inline: auto;
    padding-top: 64px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  /* The homepage contains its own centered shells; its outer main must stay full width. */
  body > main.home-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  body > main:not(.article) h1 {
    font-size: clamp(38px, 11vw, 48px);
    font-weight: 500;
  }

  body > main:not(.article) h2 {
    font-weight: 500;
  }
}

/* Portrait tablets keep the desktop diagonal composition, but gain enough width per card. */
@media (min-width: 561px) and (max-width: 900px) {
  .catalog-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  /* Phone cards become image-first editorial cards. No text or badges share the image layer. */
  .catalog-item.preview-slice {
    min-height: 0;
    display: grid;
    grid-template-columns: 64px minmax(0,1fr);
    grid-template-rows: auto auto;
    gap: 0;
    padding: 0;
    border-radius: 20px;
  }

  .catalog-item.preview-slice .preview-media {
    position: relative;
    inset: auto;
    z-index: 1;
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    aspect-ratio: 16 / 9;
    clip-path: none;
    border-bottom: 1px solid color-mix(in srgb, var(--line) 62%, transparent);
  }

  .catalog-item.preview-slice .preview-media img {
    width: 100%;
    height: 100%;
    object-fit: var(--media-fit, cover);
    object-position: var(--media-x, 50%) var(--media-y, 46%);
    transform: scale(var(--media-scale, 1));
    transform-origin: center;
  }

  .catalog-item.preview-slice .catalog-number {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    margin: 21px 0 24px 19px;
  }

  .catalog-item.preview-slice .catalog-number strong {
    font-size: 27px;
  }

  .catalog-item.preview-slice .catalog-copy {
    grid-column: 2;
    grid-row: 2;
    max-width: none;
    min-width: 0;
    padding: 20px 18px 23px 10px;
    transform: none;
  }

  .catalog-item.preview-slice .catalog-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 7px 8px;
  }

  .catalog-item.preview-slice h4 {
    flex: 1 1 150px;
    min-width: 0;
    font-size: 21px;
    font-weight: 500;
    line-height: 1.38;
    overflow-wrap: anywhere;
  }

  .catalog-item.preview-slice .kind,
  .catalog-item.preview-slice .new-mark {
    flex: 0 0 auto;
  }

  .catalog-item.preview-slice .catalog-copy p {
    max-width: none;
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.78;
  }

  .catalog-item.preview-slice .foot {
    padding-top: 16px;
    font-size: 10px;
    line-height: 1.55;
  }

  .catalog-grid,
  .writing-grid {
    gap: 16px;
  }

  .footer-inner {
    gap: 12px;
  }
}

@media (max-width: 380px) {
  :root {
    --mobile-gutter: 14px;
  }

  .site-header .nav-right a {
    padding-inline: 8px;
    font-size: 11px;
  }

  .category-tab {
    font-size: 10px;
  }

  .catalog-item.preview-slice {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .catalog-item.preview-slice .catalog-number {
    margin-left: 16px;
  }

  .catalog-item.preview-slice .catalog-copy {
    padding-right: 15px;
  }

  .top .nav-links a,
  .top .back {
    padding-inline: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero .eyebrow,
  .hero h1,
  .hero .intro,
  .hero .hero-rule,
  .latest .section-head,
  .latest .feature,
  .masthead .eyebrow,
  .masthead h1,
  .masthead .subtitle,
  .masthead .rule {
    animation: quiet-rise .62s cubic-bezier(.22, .61, .36, 1) both;
  }

  .hero h1,
  .masthead h1 { animation-delay: 55ms; }
  .hero .intro,
  .masthead .subtitle { animation-delay: 110ms; }
  .hero .hero-rule,
  .masthead .rule { animation-delay: 165ms; }
  .latest .section-head { animation-delay: 130ms; }
  .latest .feature { animation-delay: 190ms; }

  .catalog-item:not([hidden]),
  .writing-card:not([hidden]) {
    animation: card-settle .48s cubic-bezier(.22, .61, .36, 1) both;
  }
}

@keyframes quiet-rise {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-settle {
  from { opacity: 0; transform: translateY(7px) scale(.997); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
