/* 思い出立体写真メーカー（2.5D 第2版）。テーマとぶつからないよう .m3s の中だけに効かせる。立体写真そのものを主役にする */
.m3s {
  --m3s-bg: #f8f5ee; --m3s-paper: #fffdf8; --m3s-ink: #26324a; --m3s-sub: #6d717a; --m3s-line: #e4ddcf;
  --m3s-gold: #a8874f; --m3s-gold-soft: #efe6d4; --m3s-err: #a3402f; --m3s-stage: #ebe5d8;
  color: var(--m3s-ink); font-size: 16px; line-height: 1.8; margin: 0 0 2em;
}
.m3s *, .m3s *::before, .m3s *::after { box-sizing: border-box; }
.m3s [hidden] { display: none !important; }
.m3s-app { background: var(--m3s-bg); border: 1px solid var(--m3s-line); border-radius: 4px; padding: 24px 22px 24px; }
.m3s-bar, .m3s-by { display: none; }
.m3s-hero { text-align: center; margin: 0 0 16px; }
.m3s-kicker { display: inline-block; font-size: 13px; letter-spacing: .14em; color: var(--m3s-gold); border-bottom: 1px solid var(--m3s-gold); padding: 0 2px 2px; margin: 0 0 8px; }
.m3s-title { font-family: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 27px; line-height: 1.5; font-weight: 600; letter-spacing: .04em; }
.m3s-admin { background: var(--m3s-gold-soft); color: #6b5530; font-size: 13px; padding: 6px 12px; border-radius: 2px; margin: 0 0 12px; text-align: center; }

.m3s-drop { position: relative; display: flex; align-items: center; justify-content: center; min-height: 280px; background: var(--m3s-paper); border: 1.5px dashed #cfc4ae; border-radius: 4px; cursor: pointer; overflow: hidden; outline: none; }
.m3s-drop:hover, .m3s-drop:focus-visible, .m3s-drop.m3s-over { border-color: var(--m3s-gold); background: #fffaf0; }
.m3s-drop.m3s-has { border-style: solid; background: var(--m3s-stage); }
.m3s-drop.m3s-has .m3s-drop-empty { display: none; }
.m3s-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.m3s-drop-empty { text-align: center; padding: 24px; }
.m3s-link { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.m3s-drop-sub { font-size: 13px; color: var(--m3s-sub); margin-top: 4px; }
.m3s .m3s-preview { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; margin: 0 auto; border: 6px solid #fff; box-shadow: 0 6px 18px rgba(38, 50, 74, .18); }
.m3s-fine { font-size: 13px; color: var(--m3s-sub); text-align: center; margin: 12px auto 0; max-width: 40em; }
/* 処理中：写真を見せたまま、下に控えめなメッセージ（実際の処理の段階と連動） */
.m3s-busy { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 18px 16px; background: linear-gradient(rgba(38, 50, 74, 0) 45%, rgba(38, 50, 74, .62)); color: #fff; pointer-events: none; text-align: center; }
.m3s-busy-t { font-family: "Shippori Mincho", "Yu Mincho", serif; font-size: 18px; letter-spacing: .05em; }
.m3s-busy-t::after { content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 10px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: m3s-spin .9s linear infinite; vertical-align: -1px; }
.m3s-busy-s { font-size: 13px; opacity: .9; margin-top: 2px; min-height: 1.4em; }
.m3s-working { cursor: default; }
.m3s-working .m3s-preview { animation: m3s-breath 2.6s ease-in-out infinite; }
@keyframes m3s-spin { to { transform: rotate(360deg); } }
@keyframes m3s-breath { 50% { filter: brightness(1.06) saturate(1.04); } }
.m3s-note { max-width: 42em; margin: 12px auto 0 !important; text-align: center; }
/* 開発用（管理者が ?m3d_debug=1 を付けたときだけ） */
.m3s-debug { margin: 20px 0 0; padding: 12px; border: 1px dashed #b9b2a3; background: #fff; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; font-size: 12px; color: #444; }
.m3s-debug-h { grid-column: 1 / -1; line-height: 1.7; word-break: break-all; }
.m3s .m3s-debug figure { margin: 0 !important; }
.m3s .m3s-debug canvas, .m3s .m3s-debug img { display: block; width: 100%; height: auto; border: 1px solid #e4ddcf; }
.m3s-error { color: var(--m3s-err); background: #f8ebe6; border-left: 3px solid var(--m3s-err); padding: 10px 14px; margin: 12px 0 0; font-size: 14px; }

.m3s-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 0; }
.m3s .m3s-btn { appearance: none; font: inherit; font-size: 15px; line-height: 1.4; border-radius: 3px; padding: 10px 18px; cursor: pointer; border: 1px solid var(--m3s-ink); background: transparent; color: var(--m3s-ink); margin: 0; box-shadow: none; }
.m3s .m3s-btn:hover { background: #eef0f4; }
.m3s .m3s-btn:focus-visible, .m3s-seg button:focus-visible { outline: 2px solid var(--m3s-gold); outline-offset: 2px; }
.m3s .m3s-btn-main { background: var(--m3s-ink); color: #fff; min-width: 240px; padding: 13px 28px; font-size: 16px; letter-spacing: .06em; }
.m3s .m3s-btn-main:hover { background: #1b2538; }
.m3s .m3s-btn-main:disabled { background: #b8bcc5; border-color: #b8bcc5; cursor: not-allowed; }
.m3s .m3s-btn-line { font-size: 14px; padding: 7px 14px; border-color: #b9b2a3; }
.m3s .m3s-btn-line.m3s-on, .m3s .m3s-btn-line[aria-pressed="true"] { background: var(--m3s-ink); border-color: var(--m3s-ink); color: #fff; }

.m3s-work-t { text-align: center; font-family: "Shippori Mincho", "Yu Mincho", serif; font-size: 21px; margin: 18px 0 16px; }
.m3s .m3s-steps { list-style: none !important; margin: 0 auto !important; padding: 0 !important; max-width: 420px; counter-reset: m3s; border: 0 !important; background: none !important; }
.m3s .m3s-steps li { counter-increment: m3s; position: relative; padding: 10px 0 10px 44px !important; margin: 0 !important; color: #a6a39b; border: 0 !important; border-bottom: 1px solid var(--m3s-line) !important; list-style: none !important; background: none !important; font-size: 15px; }
.m3s .m3s-steps li::before { content: counter(m3s); position: absolute; left: 4px; top: 10px; width: 26px; height: 26px; line-height: 24px; text-align: center; border: 1px solid #cfc9bc; border-radius: 50%; font-size: 13px; color: #a6a39b; background: none; }
.m3s .m3s-steps li.m3s-now { color: var(--m3s-ink); font-weight: 700; }
.m3s .m3s-steps li.m3s-now::before { border-color: var(--m3s-gold); color: var(--m3s-gold); animation: m3s-pulse 1.4s ease-in-out infinite; }
.m3s .m3s-steps li.m3s-done { color: var(--m3s-ink); }
.m3s .m3s-steps li.m3s-done::before { content: "\2713"; background: var(--m3s-ink); border-color: var(--m3s-ink); color: #fff; }
.m3s-step-sub { display: block; font-weight: 400; font-size: 13px; color: var(--m3s-sub); }
@keyframes m3s-pulse { 50% { box-shadow: 0 0 0 5px rgba(168, 135, 79, .18); } }
.m3s-fail { margin: 18px auto 0; max-width: 520px; }

/* 立体写真ビューア：大きく。元写真との比較は、同じ枠に元の写真を重ねる（表示の切り抜きに合わせて 108%） */
.m3s-stage { position: relative; margin: 0 auto; background: var(--m3s-stage); overflow: hidden; touch-action: none; max-width: 100%; box-shadow: 0 12px 32px rgba(38, 50, 74, .22); border: 8px solid #fff; transform-origin: 50% 50%; will-change: transform; }
/* 2.4.0：写真全体が手に持ったカードのように傾く（m3t-viewer.js が transform を書く）。傾いたときに上下が切れないよう少し余白 */
.m3s-screen[data-screen="view"] .m3s-stage { margin-top: 10px; margin-bottom: 10px; }
.m3s-canvas { display: block; width: 100% !important; height: 100% !important; cursor: grab; touch-action: none; }
.m3s-canvas:active { cursor: grabbing; }
.m3s .m3s-orig { position: absolute; left: -4%; top: -4%; width: 108% !important; height: 108% !important; max-width: none !important; object-fit: fill; opacity: 0; pointer-events: none; transition: opacity .35s; }
.m3s .m3s-orig.m3s-on { opacity: 1; }
.m3s-hint { text-align: center; font-size: 13px; color: var(--m3s-sub); margin: 10px 0 0; }
.m3s-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 14px; margin: 10px 0 0; }
.m3s-seg { display: inline-flex; border: 1px solid var(--m3s-ink); border-radius: 3px; overflow: hidden; }
.m3s .m3s-seg button { appearance: none; font: inherit; font-size: 14px; padding: 7px 16px; border: 0; margin: 0; background: transparent; color: var(--m3s-ink); cursor: pointer; border-radius: 0; box-shadow: none; }
.m3s .m3s-seg button + button { border-left: 1px solid var(--m3s-ink); }
.m3s .m3s-seg button[aria-pressed="true"] { background: var(--m3s-ink); color: #fff; }
.m3s-more { margin: 16px auto 0; max-width: 640px; border-top: 1px solid var(--m3s-line); padding-top: 6px; }
.m3s-more summary { cursor: pointer; font-size: 14px; color: var(--m3s-sub); text-align: center; list-style: none; }
.m3s-more summary::-webkit-details-marker { display: none; }
.m3s-more summary::after { content: " \25BE"; }
.m3s-more[open] summary::after { content: " \25B4"; }
.m3s .m3s-depthcv { display: block; max-width: 100%; height: auto !important; margin: 10px auto 0; border: 6px solid #fff; }
.m3s-small { font-size: 13px; color: var(--m3s-sub); line-height: 1.75; margin-top: 10px; }
.m3s-meta { text-align: center; }
.m3s-nogl { text-align: center; font-size: 14px; color: var(--m3s-sub); }
.m3s .m3s-nogl img { max-width: 100%; height: auto; border: 8px solid #fff; }

@media (max-width: 640px) {
  .m3s-app { padding: 18px 14px 20px; }
  .m3s-title { font-size: 21px; }
  .m3s .m3s-btn-main { width: 100%; min-width: 0; }
}
/* スマホ・タブレット（幅1023px以下）はサイトから独立したアプリの画面。Cocoon の部品を消し、写真を横いっぱいに */
@media (max-width: 1023px) {
  body:has(.m3s) #header-container, body:has(.m3s) .header-container, body:has(.m3s) #breadcrumb, body:has(.m3s) .breadcrumb,
  body:has(.m3s) #footer, body:has(.m3s) #go-to-top, body:has(.m3s) .go-to-top, body:has(.m3s) .mobile-footer-menu-buttons,
  body:has(.m3s) .mobile-header-menu-buttons, body:has(.m3s) .article-header, body:has(.m3s) .article-footer,
  body:has(.m3s) #sidebar, body:has(.m3s) .entry-title, body:has(.m3s) .date-tags, body:has(.m3s) .post-date,
  body:has(.m3s) .sns-share, body:has(.m3s) .sns-follow, body:has(.m3s) .author-info, body:has(.m3s) .under-entry-content,
  body:has(.m3s) .toc, body:has(.m3s) .entry-categories-tags, body:has(.m3s) #navi, body:has(.m3s) .navi { display: none !important; }
  body:has(.m3s), body:has(.m3s) #container { background: #f8f5ee !important; padding-bottom: 0 !important; }
  html:has(.m3s), body:has(.m3s) { overflow: visible !important; overflow-x: clip !important; }
  body:has(.m3s) #content, body:has(.m3s) #content-in, body:has(.m3s) #main, body:has(.m3s) #main .article,
  body:has(.m3s) .entry-content, body:has(.m3s) .wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; width: auto !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
  body:has(.m3s) .entry-content > p:empty { display: none; }
  body:has(.m3s) .entry-content > :not(.m3s) { margin-left: 16px !important; margin-right: 16px !important; }
  .m3s { margin: 0 !important; --m3s-sh: 62dvh; }
  .m3s-app { border: 0; border-radius: 0; padding: 0 0 22px; min-height: 100vh; min-height: 100dvh; }
  .m3s-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px; background: rgba(248, 245, 238, .96); border-bottom: 1px solid var(--m3s-line); }
  body.admin-bar .m3s-bar { top: 46px; }
  .m3s .m3s-bar-back { flex: 0 0 72px; color: var(--m3s-ink); text-decoration: none; font-size: 14px; }
  .m3s-bar-t { flex: 1 1 auto; text-align: center; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m3s-bar-sp { flex: 0 0 72px; }
  .m3s-kicker { display: none; }
  .m3s-hero { margin: 14px 16px 12px; }
  .m3s-title { font-size: 19px; }
  .m3s-screen { padding: 0 16px; }
  .m3s-screen[data-screen="view"] { padding: 0; }
  .m3s-drop { min-height: 36vh; }
  .m3s-dock { position: sticky; bottom: 0; z-index: 15; margin: 14px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(248, 245, 238, 0), #f8f5ee 30%); }
  .m3s-stage { border: 0; box-shadow: none; }
  .m3s-screen[data-screen="view"] .m3s-stage { max-width: calc(100% - 28px) !important; border: 5px solid #fff; box-shadow: 0 8px 22px rgba(38, 50, 74, .2); }
  .m3s-hint, .m3s-controls, [data-screen="view"] .m3s-error, [data-screen="view"] .m3s-more, [data-screen="view"] .m3s-actions, .m3s-nogl { margin-left: 16px !important; margin-right: 16px !important; }
  .m3s-seg { flex: 1 1 100%; }
  .m3s .m3s-seg button { flex: 1 1 50%; padding: 9px 0; }
  .m3s-controls .m3s-btn-line { flex: 1 1 40%; }
  .m3s-by { display: block; text-align: center; font-size: 12px; color: var(--m3s-sub); margin: 14px 16px 0; }
  .m3s .m3s-by a { color: var(--m3s-ink); }
}
@media (prefers-reduced-motion: reduce) { .m3s * { animation: none !important; transition: none !important; } }
