/* W14.5 × 子比外壳 · 接缝层
 *
 * 只做两件事：
 *   1. 锚点跳转不被子比固定页头遮住（页头 fixed / z-index 999，实测桌面 68px、手机 52px）
 *   2. 让正文容器稳定处在页头与悬浮工具栏之下
 *
 * 注意：子比在 body 上已经为固定页头预留了内边距（实测 88px），
 * 这里**不能**再加 padding-top，否则 hero 会被推下一整个页头的高度。
 *
 * 视觉一律由 w14-scoped.css 负责，本文件不定义任何颜色与排版。
 */

.yj-w14-page {
  --yj-shell-h: 68px;
}

@media (max-width: 992px) {
  .yj-w14-page {
    --yj-shell-h: 52px;
  }
}

.yj-w14-page #yj-w14 {
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow-x: clip;
}

/* 锚点：正文里的 #courses / #system-course / #about / #faq */
.yj-w14-page #yj-w14 section[id] {
  scroll-margin-top: calc(var(--yj-shell-h) + 12px);
}

/* 五个锚点跳转距离不同，子比的「下滑隐藏」判定（上次位置 >100 且向下滚）
 * 与平滑滚动的 auto_scroll 标志存在竞态：实测桌面点「日语课程 / 认识我们」、
 * 手机点「日本文化 / 日语课程 / 认识我们」会进入 scroll-down，其余入口不进入，
 * 于是页头、悬浮工具栏、手机底栏时隐时现。
 *
 * W14 是单页锚点式落地页，导航是唯一的区块切换入口，统一让它们常驻：
 * 点完不该把方向盘收走，用户也不需要先上滑把页头唤回来。
 * 只覆盖 transform，不阻止子比给 body 加 scroll-down，避免动它的其它逻辑；
 * 弹窗 / 看图状态仍按子比原样隐藏悬浮工具栏。
 */
body.yj-w14-page.scroll-down .header.scroll-down-hide {
  transform: none;
}
body.yj-w14-page.scroll-down .scroll-down-hide.footer-tabbar {
  transform: none;
}
body.yj-w14-page.scroll-down:not(.modal-open):not(.imgbox-show):not(:has(.modal.in)) .scroll-down-hide.float-right {
  transform: none;
}

/* 锚点余量不再跟着 scroll-down 变化：页头现在始终占位，
 * 统一按「页头高度 + 12px」预留，避免区块标题被固定页头盖住。
 * 删掉原来 .scroll-down 时降到 12px 的覆盖即可，基础规则一直生效。
 */

/* 正文图片按自身比例，子比的 max-width 规则不参与缩放计算 */
.yj-w14-page #yj-w14 img {
  height: auto;
}

/* 正式首页隐藏《文化日》测试稿推荐位。
 * 测试稿本身保留在 /preview/w14-5/culture/culture-day-museums.html 与
 * /w14-test 对照页里，两个都不改。这里只让正式首页不露出这张头图卡片。
 *
 * 2026-11-10 修正：右栏接成动态后，头图卡已换成真实文章，
 * 原来「#culture .editorial-lead 全隐藏」会把新头图一起吞掉（宽度高度为 0）。
 * 改为只隐藏静态示例那张 —— 静态模板渲染出的 <article class="editorial-lead">
 * 没有 data-yj-source 属性，A1 动态渲染的都有（mapped / fallback）。
 * 这样右栏动态时正常显示头图，动态关掉回退静态示例时仍按原意隐藏测试稿。
 */
body.yj-w14-front #yj-w14 #culture .editorial-lead:not([data-yj-source]) {
  display: none;
}

/* A1 动态文章卡片的补充规则（只作用于 #yj-w14，不污染子比外壳）。
 * 放在手写的接缝层，而不是构建产物 w14-scoped.css，避免重跑构建时被覆盖。
 * 卡片主体样式（.editorial-lead / .editorial-row / .editorial-cover …）沿用
 * w14-scoped.css 的既有规则，这里只补动态渲染才需要的两种情况。
 */

/* 无特色图：头图卡沿用 .phrase-art 的渐变，补一条不依赖图片的对齐 */
.yj-w14-page #yj-w14 .editorial-cover.is-no-image {
  display: flex;
  align-items: center;
}
.yj-w14-page #yj-w14 .editorial-cover.is-no-image .cover-phrase {
  position: static;
  padding: 0 28px;
}
.yj-w14-page #yj-w14 .editorial-cover.is-no-image .cover-phrase strong {
  font-size: 27px;
  line-height: 1.4;
}

/* 无特色图：列表卡的缩略位用同系渐变 + 一个分类首字占位 */
.yj-w14-page #yj-w14 .editorial-thumb.is-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f7f7f7, #d3d3d3 65%, #eee);
  color: #171717;
}
.yj-w14-page #yj-w14 .editorial-thumb.is-no-image .no-image-glyph {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  opacity: .72;
}
/* 暗色下不要留一块亮灰：无图占位换成深灰渐变 + 亮色文字。
 * 只作用于 .is-no-image，静态样稿的 .phrase-art 装饰图（sakura/fuji/sensu）
 * 仍是原来的浅色底，正式首页视觉不变。
 *
 * 第二条 body.dark-theme.yj-w14-page 是复合选择器，不是后代选择器：
 * .yj-w14-page 就加在 body 上，写成 body.dark-theme .yj-w14-page 永远匹配不到。
 * 0.4.2 之前实际只有 html.dark 那条在起作用，子比若改成只在 body 上挂
 * dark-theme，占位会退回亮灰底。这里把两条来源都覆盖。 */
:is(html.dark, body.dark-theme) .yj-w14-page #yj-w14 .editorial-cover.is-no-image,
:is(html.dark, body.dark-theme) .yj-w14-page #yj-w14 .editorial-thumb.is-no-image,
body.dark-theme.yj-w14-page #yj-w14 .editorial-cover.is-no-image,
body.dark-theme.yj-w14-page #yj-w14 .editorial-thumb.is-no-image {
  background: linear-gradient(135deg, #202226, #2e3136 60%, #24262a);
  color: #f2f3f5;
}

/* 已启用 A1 但一篇正式文章都没有时的空态。
 * 不复用 .editorial-lead，避免看起来像一张真卡片；也不用整块灰底 ——
 * 这一栏左侧本来就是留白较多的排版，一条虚线提示就够说明状态。 */
.yj-w14-page #yj-w14 .editorial-empty {
  margin: 20px 0 0;
  padding: 24px 26px;
  border: 1px dashed rgba(0, 0, 0, .18);
  border-radius: 14px;
}
.yj-w14-page #yj-w14 .editorial-empty-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
}
.yj-w14-page #yj-w14 .editorial-empty-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  opacity: .64;
}
body.dark-theme.yj-w14-page #yj-w14 .editorial-empty,
:is(html.dark, body.dark-theme) .yj-w14-page #yj-w14 .editorial-empty {
  border-color: rgba(255, 255, 255, .22);
}

/* 封面图 / 缩略图：完整显示，不裁切（2026-11-10 用户要求）。
 *
 * 起因：头图卡固定 608×240（约 2.53:1），而文章封面是 16:9 / 3:2 一类比例，
 * object-fit:cover 会把上下各切掉一截 —— 「うまい」那张的顶部大字就被切了。
 * 用户要求封面在任何位置都必须信息完整。
 *
 * 结论（2026-11-10 用户选定，21:xx 修订）：头图卡与列表缩略图都让容器
 * 高度跟随封面自身比例，整图铺满、不裁不补。列表缩略图早期曾用「固定
 * 98×80 + contain + 同图模糊补底」，补底会把封面里的青线／黑底／文字
 * 糊成灰绿色条带（用户 23:xx 指出的异色），已彻底移除。
 *
 * 配套约定：封面统一按 1200×840 导出，两栏头图与缩略图高度自然一致；
 * 即使以后出现别的比例，容器也会跟着图片走，不会留白、不会裁切。
 *
 * 排除 .phrase-art：静态示例的装饰图用 contain + 绝对定位排版，
 * 若被这里覆盖会把样稿布局打乱。 */

/* 头图卡：左图右文（2026-11-10 用户选定「方案二」）。
 *
 * 起因：封面要么被裁（cover），要么一铺满就把首页头图顶到 426px 高。
 * 现在把封面缩到左列表格宽度、完整显示，标题/摘要/阅读全文排到右列，
 * 首页这一段从 634px 降到约 276px，且封面一个字都不切。
 *
 * 列宽用 clamp 自适应：栏宽 608 时封面约 280，栏宽缩到 540 时仍有 248，
 * 不会把右列文字挤成一条。760px 以下（主题已经单栏）回退成上下结构。
 */
.yj-w14-page #yj-w14 .editorial-column .editorial-lead {
  display: grid;
  grid-template-columns: clamp(220px, 46%, 300px) minmax(0, 1fr);
  column-gap: 32px;
  align-items: start;
}
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-cover {
  grid-column: 1;
  grid-row: 1 / span 4;
}
/* 高度随图、透明底只给「动态渲染」的头图卡（[data-yj-source] 是 PHP 加的标记）。
 * 静态样稿保持自己的固定高度与裁切 —— 它是装饰，不是文章封面：
 * 样稿图片声明的宽高（112×84 之类）是裁切框，不是图片真实尺寸，
 * 跟着真实比例走会先按声明排一次、图片到了再跳一次。 */
.yj-w14-page #yj-w14 .editorial-lead[data-yj-source] > .editorial-cover {
  height: auto;
}
/* 透明底只给真实照片封面。
 * 0.5.4 这条没加限定，把无图占位（.phrase-art）自己的中性渐变也一起抹成透明，
 * 浅色主题下头图卡于是露出一块纯白，看起来像加载失败。 */
.yj-w14-page #yj-w14 .editorial-lead[data-yj-source] > .editorial-cover:not(.phrase-art) {
  background: transparent;
}
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-cover img {
  width: 100%;
  height: auto;
  display: block;
}
/* 没特色图时封面是渐变卡（phrase-art），给个近似比例撑住，别塌成一条 */
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-cover.phrase-art {
  aspect-ratio: 10 / 7;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-meta,
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > h3,
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > p,
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-read {
  grid-column: 2;
}
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > h3 {
  margin: 4px 0 10px;
}
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > p {
  min-height: 0;
}
.yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-read {
  justify-self: start;
}
@media (max-width: 760px) {
  .yj-w14-page #yj-w14 .editorial-column .editorial-lead {
    display: block;
  }
  .yj-w14-page #yj-w14 .editorial-column .editorial-lead > .editorial-cover {
    margin-bottom: 16px;
  }
}

/* 归档网格等其它位置的封面：同样不裁切 */
.yj-w14-page #yj-w14 .archive-grid .editorial-cover:not(.phrase-art) {
  height: auto;
}
.yj-w14-page #yj-w14 .archive-grid .editorial-cover:not(.phrase-art) img {
  height: auto;
  object-fit: contain;
}

/* 列表缩略图：宽高都由图片比例推出来（0.6.0，用户 2026-11-11 定）。
 *
 * 三个条件没法同时满足：固定宽高的框、任意原图比例、无空隙且无裁切。
 * 取舍是「让框跟着图片变形」，代价是极端竖长图会变窄，收益是四角完整、没有补底。
 *
 *   width: min(98px, 112px × ratio)   常规封面撑满 98px；竖长图被限高在 112px
 *   height: auto                      高度由图片自己决定
 *
 * 10:7 封面（1200×840，ratio 1.4286）桌面算出 98×68.6、390px 视口 80×56；
 * 800×2400 的竖长图（ratio 0.3333）桌面 37.3×112、窄屏 30.7×92，都完整显示。
 * ratio 由 PHP 从附件 medium 尺寸算出写进行内 --yj-thumb-ratio，新文章自动生效。
 *
 * 同时去掉 base 里的 9px 圆角与 overflow:hidden —— 它们会把图片四角切掉，
 * 而「不裁切」正是这一轮要解决的问题。
 *
 * 只作用于 [data-yj-source] 的动态列表卡：
 *   - 无图占位（.phrase-art）继续用自己的 98×80 装饰样式；
 *   - 静态样稿也继续用自己的固定框 —— 样稿图片声明的宽高是裁切框不是真实尺寸，
 *     跟着真实比例走会在图片加载前后各排一次，肉眼看到行高跳一下。 */
.yj-w14-page #yj-w14 .editorial-row[data-yj-source] .editorial-thumb:not(.phrase-art) {
  --yj-thumb-width: 98px;
  --yj-thumb-max-height: 112px;
  width: min(var(--yj-thumb-width),
    calc(var(--yj-thumb-max-height) * var(--yj-thumb-ratio, 1.428571)));
  height: auto;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}
.yj-w14-page #yj-w14 .editorial-row[data-yj-source] .editorial-thumb:not(.phrase-art)::before {
  display: none;
}
.yj-w14-page #yj-w14 .editorial-row[data-yj-source] .editorial-thumb:not(.phrase-art) img {
  display: block;
  width: 100%;
  height: auto;
  position: static;
}
@media (max-width: 1100px) {
  .yj-w14-page #yj-w14 .editorial-row[data-yj-source] .editorial-thumb:not(.phrase-art) {
    --yj-thumb-width: 80px;
    --yj-thumb-max-height: 92px;
  }
}

/* 图片已经按原比例铺满，再放大就会被容器切掉边缘 */
.yj-w14-page #yj-w14 .editorial-cover:not(.phrase-art):hover img {
  transform: none;
}

/* 栏目标题可点进分类存档页（2026-11-10 用户要求）。
 * h2 里的文字被包成 <a class="column-title-link">，点号仍在链接外。
 *
 * 0.6.0 改配色（用户 2026-11-11 指定）：界面里只保留一个强调色 #00f5d0。
 * 原来悬停用的是「青绿的加深版」，属于同一个绿的第二种表达，已去掉：
 *   - 浅色：hover / 键盘聚焦 = #111111 字 + #00f5d0 底，始终不加下划线
 *   - 深色：#00f5d0 字，不加底色（深底上青底黑字会发灰）
 * 键盘焦点仍由全局 a:focus-visible 的 3px 青描边承担，不必在本条里重复画框。
 * 站点深色由 body.dark-theme 触发（html 无 dark class），所以两条覆盖都要给。 */
.yj-w14-page #yj-w14 .column-heading h2 .column-title-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  padding: 0 .1em;
  border-radius: 3px;
  transition: color .18s ease, background-color .18s ease;
}
.yj-w14-page #yj-w14 .column-heading h2 .column-title-link:hover,
.yj-w14-page #yj-w14 .column-heading h2 .column-title-link:focus-visible {
  color: #111111;
  background: #00f5d0;
  text-decoration: none;
}
html.dark .yj-w14-page #yj-w14 .column-heading h2 .column-title-link:hover,
html.dark .yj-w14-page #yj-w14 .column-heading h2 .column-title-link:focus-visible,
body.dark-theme #yj-w14 .column-heading h2 .column-title-link:hover,
body.dark-theme #yj-w14 .column-heading h2 .column-title-link:focus-visible {
  color: #00f5d0;
  background: transparent;
}
/* 点号是纯装饰，不承担对比度：hover 时统一亮青 */
.yj-w14-page #yj-w14 .column-heading h2:hover .column-dot {
  color: #00f5d0;
}


/* Codex 2026-11-13: A1 shared rows and homepage dates */
/* 仅正式首页及同样使用 yj-w14-front 的 A1 对照页。
 * 原图完整显示；完整标题优先；摘要让位；桌面共享行高。
 * W1应追加到手写w14-shell.css末尾，不改生成的w14-scoped.css。
 */
.yj-w14-front #yj-w14 .editorial-meta > small { display: none; }
.yj-w14-front #yj-w14 .editorial-column .editorial-lead {
  min-height: 0;
  margin: 0 0 24px;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(min-content, 1fr);
  column-gap: 24px;
  row-gap: 12px;
}
.yj-w14-front #yj-w14 .editorial-column .editorial-lead > .editorial-meta {
  margin: 0;
  align-self: start;
}
.yj-w14-front #yj-w14 .editorial-column .editorial-lead > h3 {
  margin: 0;
  font-size: clamp(19px, 1.46vw, 22px);
  line-height: 1.5;
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
  max-height: none;
  overflow: visible;
  overflow-wrap: anywhere;
}
.yj-w14-front #yj-w14 .editorial-column .editorial-lead > p {
  margin: 0;
  min-height: 0;
  align-self: start;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.75;
}
/* 0.7.4：首篇不再输出「阅读全文」，按钮样式一并撤掉（标题与封面可点进正文）。 */
.yj-w14-front #yj-w14 .editorial-row h3 {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
  max-height: none;
  overflow: visible;
  overflow-wrap: anywhere;
}
.yj-w14-front #yj-w14 .editorial-row p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
}
/* 窄屏/旧浏览器单栏；不为了等高给上下堆叠的卡片加大块空白。 */
.yj-w14-front #yj-w14 .editorial-columns { grid-template-columns: minmax(0, 1fr); }
.yj-w14-front #yj-w14 .editorial-column + .editorial-column {
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.yj-w14-front #yj-w14 .editorial-column + .editorial-column::before { display: none; }
@supports (grid-template-rows: subgrid) {
  @media (min-width: 1101px) {
    .yj-w14-front #yj-w14 .editorial-columns {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-rows: auto auto auto auto auto;
      column-gap: 64px;
      row-gap: 0;
      align-items: stretch;
    }
    .yj-w14-front #yj-w14 .editorial-column {
      display: grid;
      grid-template-rows: subgrid;
      grid-row: 1 / span 5;
      row-gap: 0;
    }
    .yj-w14-front #yj-w14 .editorial-column:first-child { grid-column: 1; }
    .yj-w14-front #yj-w14 .editorial-column:nth-child(2) { grid-column: 2; }
    .yj-w14-front #yj-w14 .editorial-column > .column-heading { grid-row: 1; }
    .yj-w14-front #yj-w14 .editorial-column > .column-description { grid-row: 2; }
    .yj-w14-front #yj-w14 .editorial-column > .editorial-lead { grid-row: 3; }
    .yj-w14-front #yj-w14 .editorial-column > .editorial-list {
      grid-row: 4 / span 2;
      display: grid;
      grid-template-rows: subgrid;
      row-gap: 0;
    }
    .yj-w14-front #yj-w14 .editorial-column > .editorial-empty { grid-row: 3 / span 3; }
    .yj-w14-front #yj-w14 .editorial-column + .editorial-column {
      border-top: 0;
      padding-top: 0;
    }
    .yj-w14-front #yj-w14 .editorial-column + .editorial-column::before { display: block; }
  }
}
@media (max-width: 760px) {
  .yj-w14-front #yj-w14 .editorial-column .editorial-lead {
    display: block;
  }
  .yj-w14-front #yj-w14 .editorial-column .editorial-lead > h3 {
    font-size: 21px;
    margin: 10px 0;
  }
}

/* W1 2026-11-13：板块间距收紧（0.7.4）
 * 原节奏 104 / 78 / 62 偏松，桌面相邻板块视觉空白最大到 240px 以上。
 * 收为 72 / 54 / 44，faq 的写死 padding-top、closing 的上下内边距、
 * courses 的 margin-top 同步下调，保持全站节奏一致。
 * 双写类名是为了压过后加载的 w14-scoped.css（同特异性时后加载者胜）；
 * 不改生成文件，若将来引入 .w14-home 包裹层需复核这里的特异性。
 */
#yj-w14 .section-space.section-space { padding-block: 72px; }
#yj-w14 .faq.section-space { padding-block-start: 56px; }
#yj-w14 .closing.closing { padding-top: 44px; padding-bottom: 44px; }
#yj-w14 .courses-section.courses-section { margin-top: 28px; }

@media (max-width: 1100px) {
  #yj-w14 .section-space.section-space { padding-block: 54px; }
  #yj-w14 .faq.section-space { padding-block-start: 42px; }
  #yj-w14 .closing.closing { padding-top: 37px; padding-bottom: 37px; }
  #yj-w14 .courses-section.courses-section { margin-top: 24px; }
}

@media (max-width: 760px) {
  #yj-w14 .section-space.section-space { padding-block: 44px; }
  #yj-w14 .faq.section-space { padding-block-start: 34px; }
  #yj-w14 .closing.closing { padding-top: 27px; padding-bottom: 27px; }
  #yj-w14 .courses-section.courses-section { margin-top: 16px; }
}
