/* 既存のbase.css・contents.cssの後に読み込む。ページの寸法・配色は変更しない。 */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* boxcenter.jsの置き換え。元の267×200枠と画像の高さ制限を維持。 */
.contentsBox .imgBox li div img {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: 0;
    width: auto;
    height: auto;
    max-height: 200px;
    transform: translate(-50%, -50%);
}
.contentsBox .imgBox a:focus-visible img { outline: 3px solid #0097ca; outline-offset: -3px; }

/* 画像拡大：ブラウザー標準dialog。ページ本体のスタイルと分離する。 */
.mh-lightbox {
    box-sizing: border-box;
    position: fixed;
    inset: 0;
    margin: auto;
    padding: 15px;
    border: 0;
    border-radius: 4px;
    width: max-content;
    max-width: calc(100vw - 60px);
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);
    overflow: auto;
    background: #fff;
    color: #444;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .5);
    font: 13px/1.5 Arial, "メイリオ", sans-serif;
}
.mh-lightbox:not([open]) { display: none; }
.mh-lightbox::backdrop { background: rgba(0, 0, 0, .5); }
.mh-lightbox[open], .mh-lightbox[open]::backdrop {
    animation: mh-lightbox-fade-in 220ms ease-out both;
}
.mh-lightbox[open].mh-lightbox-closing,
.mh-lightbox[open].mh-lightbox-closing::backdrop {
    animation: mh-lightbox-fade-out 220ms ease-in both;
}
@keyframes mh-lightbox-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes mh-lightbox-fade-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .mh-lightbox[open], .mh-lightbox[open]::backdrop { animation: none; }
}
.mh-lightbox * { box-sizing: border-box; }
.mh-lightbox figure { margin: 0; }
.mh-lightbox img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(1200px, calc(100vw - 90px));
    max-height: calc(100vh - 160px);
    max-height: calc(100dvh - 160px);
    margin: auto;
    object-fit: contain;
}
.mh-lightbox figcaption { padding-top: 10px; text-align: center; white-space: pre-wrap; }
.mh-lightbox figcaption:empty { display: none; }
.mh-lightbox button {
    border: 0;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    background: #222;
    color: #fff;
    cursor: pointer;
    font: bold 22px/30px Arial, sans-serif;
    text-align: center;
}
.mh-lightbox button:focus-visible { outline: 3px solid #0097ca; outline-offset: 3px; }
.mh-lightbox-close { display: block; margin: 0 0 10px auto !important; }
.mh-lightbox-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; }
.mh-lightbox button:disabled { opacity: .25; cursor: default; }
.mh-lightbox [hidden] { display: none; }
.mh-lightbox-status { font-size: 12px; }
