/* お知らせの弾窗（ui/news-popup.js が要るときだけ読む）。設計稿 1a「掲示板」
   （design/日本用户友好弹窗设计/更新お知らせ 弾窗）。PC は幅 430px 上限、手機（560px 以下）は画面幅から左右 16px。
   字の大きさ・線の太さ・角丸は設計稿の値。手機の釦は指で押せる高さ（44px 以上）にする（設計稿の手機版）*/

/* dialog は画面いっぱいの透明な器にして、その中でカードを真ん中へ置く。
   背の低い画面ではこの器ごと縦に流す（カードの上に飛び出した札と × を切らないため、カード側では流さない）*/
dialog.news {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 28px 16px; box-sizing: border-box;
  background: transparent; border: 0; overflow: auto; overscroll-behavior: contain;
  color: var(--ink); font-family: inherit;
}
dialog.news[open] { display: flex; }
dialog.news::backdrop { background: rgb(20 20 20 / .45); }
html:has(dialog.news[open]) { overflow: hidden; }

.news-card {
  position: relative; box-sizing: border-box; width: min(430px, 100%); margin: auto;
  padding: 30px 22px 18px;
  background: var(--surface); border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-card);
  box-shadow: 0 6px 0 var(--stroke); outline: none;
  animation: news-in .22s ease-out;
}
@keyframes news-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.news-flag {
  position: absolute; top: -14px; left: 18px;
  padding: 3px 16px; background: var(--gold); border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 900; line-height: 1.6; white-space: nowrap;
}
.news-x {
  position: absolute; top: -12px; right: -12px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0;
  background: var(--soft); color: var(--ink); border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-pill);
  box-shadow: 0 3px 0 var(--stroke); cursor: pointer; font: inherit;
}
.news-x:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stroke); }

.news-head { display: flex; align-items: center; gap: 12px; }
.news-pico { flex: none; width: 46px; height: 43px; }
.news-head > div { min-width: 0; }
.news-title { margin: 0; font-size: 18px; font-weight: 900; line-height: 1.4; }
.news-date { margin: 2px 0 0; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.news-date span { font-family: 'Share Tech Mono', ui-monospace, monospace; font-weight: 400; }

.news-items { display: flex; flex-direction: column; margin-top: 12px; }
.news-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 4px;
  border-top: var(--stroke-w) dashed var(--line); color: var(--ink); text-decoration: none;
}
.news-item:hover .news-text b { text-decoration: underline; text-underline-offset: 3px; }
.news-tag {
  flex: none; margin-top: 2px; padding: 1px 10px;
  background: var(--tone, var(--soft)); border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 900; white-space: nowrap;
}
.news-text { flex: 1; min-width: 0; }
/* 見出しは空白の所でだけ折る（keep-all）。字の途中で折ると、手機で「変えられ／る」と 1 字だけ次の行へ落ち、
   NEW も 1 行ひとりになった（2026-09-18）。NEW は文の続きとして流す（flex にすると必ず別の行へ落ちる）*/
.news-text b { display: block; font-size: 14.5px; font-weight: 800; line-height: 1.5; word-break: keep-all; overflow-wrap: anywhere; }
.news-text > span { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.7; color: var(--sub); text-wrap: pretty; }
.news-new {
  display: inline-block; margin-left: 6px; vertical-align: 2px; padding: 1px 5px; background: var(--gold); border: 1.5px solid var(--stroke); border-radius: var(--radius-pill);
  font-size: 9px; font-weight: 900; font-style: normal; letter-spacing: .04em; line-height: 1.2;
}
.news-chevron { flex: none; margin-top: 8px; color: var(--muted); }

.news-foot {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 6px; padding-top: 14px; border-top: var(--stroke-w) solid var(--stroke);
}
.news-cta {
  display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%;
  padding: 10px 24px; background: var(--cta); color: var(--surface);
  border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-pill); box-shadow: 0 4px 0 var(--stroke);
  font-size: 15px; font-weight: 900; letter-spacing: 1.5px; text-decoration: none;
}
.news-cta:hover { background: var(--cta-hover); }
.news-cta:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--stroke); }
.news-close {
  padding: 4px 8px; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px;
}
.news-off {
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 6px;
  font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.news-off input {
  appearance: none; flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin: 0;
  background: var(--surface); border: var(--stroke-w) solid var(--stroke); border-radius: 5px; cursor: pointer;
}
.news-off input:checked { background: var(--gold); }
.news-off input:checked::after {
  content: ''; width: 5px; height: 9px; margin-top: -2px;
  border: solid var(--stroke); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}

/* 手機：設計稿 1a の手機版 */
@media (max-width: 560px) {
  .news-card { width: 100%; padding: 30px 18px 16px; }
  .news-x { right: -8px; width: 34px; height: 34px; }
  .news-head { gap: 10px; }
  .news-pico { width: 42px; height: 39px; }
  .news-title { font-size: 17px; }
  .news-items { margin-top: 10px; }
  .news-item { gap: 10px; padding: 12px 2px; }
  .news-tag { padding: 1px 9px; font-size: 10.5px; }
  .news-text b { font-size: 14px; }
  .news-foot { margin-top: 4px; }
  .news-cta { min-height: 46px; }
  .news-close { min-height: 44px; padding: 4px 16px; font-size: 13px; }
}

/* まだ見ていないお知らせの印。メニューの釦（[data-menu-open]）と入口（[data-open-news]）の右肩に赤い点。
   :where で詳細度を 0 にして、釦がもともと持つ position（absolute など）を上書きしない */
:where(.has-news) { position: relative; }
.has-news::after {
  content: ''; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px;
  background: var(--brand-red); border: var(--stroke-w) solid var(--surface); border-radius: 50%;
  pointer-events: none;
}
/* 手機のメニューの引き出し（項目が全幅）とフッターの文字リンクでは、右肩ではなく文字の後ろに置く */
:is(.nav-drop-card, .site-footer) .has-news::after { position: static; display: inline-block; width: 8px; height: 8px; margin-left: 6px; border: 0; vertical-align: 2px; }

/* 弾窗の下の「これまでのお知らせ ›」→ /news/（站長 2026-11-23）*/
.news-all { min-height: 32px; display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 800; color: var(--sub); }
/* お知らせ一覧 /news/。紙と見出しは /about/ の .legal、項目は上の .news-item をそのまま使う */
.news-entry .updated { margin: 0; }
.news-entry .news-items { margin-top: 8px; }
/* .legal は中の a に下線と色を付ける。項目は弾窗と同じ見た目（下線は hover の題だけ）に戻す */
.legal .news-item { color: var(--ink); text-decoration: none; }
