/*
 * 間 3D Gallery — gallery-3d.css  v1.2.0
 * Japanese-minimalist theme. All selectors scoped to .ma-gallery-3d-wrapper.
 */

/* ── Wrapper (the Elementor column element) ──────────────────────────── */
.ma-gallery-3d-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #edeae4;
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: #2a2520;
    user-select: none;
    -webkit-user-select: none;
}

/* Canvas fills wrapper */
.mag3d-canvas-container {
    width: 100%;
    height: 100%;
    display: block;
}
.mag3d-canvas-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    cursor: default;
}
.mag3d-canvas-container canvas:active {
    cursor: grabbing !important;
}

/* ── Crosshair ──────────────────────────────────────────────────────── */
.mag3d-crosshair {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(60, 50, 40, 0.35);
    pointer-events: none;
    z-index: 10;
    opacity: 0;                        /* hidden until locked */
    transition: transform 0.15s, background 0.15s, opacity 0.2s;
}
.mag3d-crosshair.hover {
    background: rgba(60, 50, 40, 0.75);
    transform: translate(-50%, -50%) scale(1.9);
}

/* ── Frame tooltip — follows cursor ────────────────────────────────── */
.mag3d-tooltip {
    position: absolute;
    top: 0; left: 0;           /* positioned via JS transform */
    transform: translate(-50%, -200%);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 300;
    color: #2a2520;
    background: rgba(245,242,237,0.92);
    border: 1px solid rgba(60,50,40,0.12);
    padding: 5px 12px 4px;
    border-radius: 1px;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
    transition: opacity 0.18s;
    backdrop-filter: blur(6px);
}
.mag3d-tooltip.visible { opacity: 1; }

/* ── Lock-mode indicator (bottom center) ────────────────────────────── */
.mag3d-lock-indicator {
    position: absolute;
    bottom: 18px; left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(60, 50, 40, 0.4);
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s;
}

/* ── Release badge (top-left, only while locked) ────────────────────── */
.mag3d-release-badge {
    position: absolute;
    top: 16px; left: 16px;
    background: rgba(245, 242, 237, 0.88);
    border: 1px solid rgba(60, 50, 40, 0.18);
    border-radius: 2px;
    padding: 6px 14px;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: rgba(60, 50, 40, 0.65);
    cursor: pointer;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.25s, background 0.15s;
    backdrop-filter: blur(8px);
    pointer-events: all;
}
.mag3d-release-badge:hover {
    background: rgba(245, 242, 237, 0.98);
    color: #2a2520;
}

/* ── Controls hint (bottom-right) ───────────────────────────────────── */
.mag3d-controls-hint {
    position: absolute;
    bottom: 18px; right: 18px;
    display: flex; gap: 14px;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(60, 50, 40, 0.38);
    pointer-events: none;
    z-index: 10;
}
.mag3d-controls-hint kbd {
    display: inline-block;
    background: rgba(60, 50, 40, 0.08);
    border: 1px solid rgba(60, 50, 40, 0.15);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 9px;
    margin-right: 3px;
}

/* ── Instructions overlay ───────────────────────────────────────────── */
.mag3d-instructions {
    position: absolute; inset: 0;
    background: rgba(245, 242, 237, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}
.mag3d-inst-card {
    max-width: 400px;
    width: 90%;
    padding: 0 4px;
}
.mag3d-title-jp {
    display: block;
    font-family: 'Noto Serif JP', 'Hiragino Mincho Pro', serif;
    font-weight: 200;
    font-size: 52px;
    color: #2a2520;
    letter-spacing: 0.14em;
    margin-bottom: 4px;
    line-height: 1;
}
.mag3d-title-en {
    display: block;
    font-size: 9px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(60, 50, 40, 0.38);
    margin-bottom: 36px;
}
.mag3d-inst-rule {
    width: 36px; height: 1px;
    background: rgba(60, 50, 40, 0.18);
    margin-bottom: 28px;
}
.mag3d-inst-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid rgba(60, 50, 40, 0.08);
    margin-bottom: 32px;
}
.mag3d-inst-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(60, 50, 40, 0.08);
}
.mag3d-inst-item:nth-child(odd) {
    padding-right: 20px;
    border-right: 1px solid rgba(60, 50, 40, 0.08);
}
.mag3d-inst-item:nth-child(even) { padding-left: 20px; }
.mag3d-inst-key {
    display: block;
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(60, 50, 40, 0.32);
    margin-bottom: 4px;
}
.mag3d-inst-desc {
    display: block;
    font-size: 13px;
    color: rgba(60, 50, 40, 0.72);
    line-height: 1.4;
    font-weight: 300;
}
.mag3d-start-btn {
    width: 100%;
    padding: 15px;
    background: #2a2520;
    color: #f5f2ed;
    border: none;
    cursor: pointer;
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    font-family: 'Cormorant Garamond', Georgia, serif;
    transition: background 0.2s;
}
.mag3d-start-btn:hover { background: #3e3530; }

/* ── Lightbox ───────────────────────────────────────────────────────── */
.mag3d-lightbox {
    position: absolute; inset: 0;
    background: rgba(245, 242, 237, 0.96);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 60;
    backdrop-filter: blur(4px);
}
.mag3d-lightbox.visible { display: flex; }

.mag3d-lightbox-inner {
    position: relative;
    max-width: 82%;
    max-height: 86%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.mag3d-lb-close {
    position: absolute;
    top: -42px; right: 0;
    width: 34px; height: 34px;
    line-height: 32px;
    text-align: center;
    font-size: 18px;
    background: transparent;
    border: 1px solid rgba(60, 50, 40, 0.2);
    color: rgba(60, 50, 40, 0.5);
    cursor: pointer;
    border-radius: 1px;
    font-family: serif;
    transition: all 0.15s;
}
.mag3d-lb-close:hover { border-color: rgba(60,50,40,0.55); color: #2a2520; }

.mag3d-lb-image {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    box-shadow: 0 12px 52px rgba(60, 50, 40, 0.1);
    display: block;
}
.mag3d-lb-meta {
    margin-top: 18px;
    text-align: center;
}
.mag3d-lb-title {
    font-size: 15px;
    letter-spacing: 0.12em;
    color: #2a2520;
    font-weight: 400;
}
.mag3d-lb-year {
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(60, 50, 40, 0.4);
    margin-top: 4px;
}
.mag3d-lb-desc {
    font-size: 12px;
    color: rgba(60, 50, 40, 0.6);
    margin-top: 8px;
    max-width: 480px;
    line-height: 1.6;
    font-style: italic;
}

/* ── Admin panel ─────────────────────────────────────────────────────── *
 *  Floats inside the wrapper, visible ONLY to admins (PHP wraps it in   *
 *  a capability check). Slide-in from the right.                        */
.mag3d-admin-panel {
    position: absolute;
    top: 0; right: 0;
    width: 280px;
    height: 100%;
    background: rgba(248, 245, 240, 0.97);
    border-left: 1px solid rgba(60, 50, 40, 0.1);
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(12px);
}
.mag3d-admin-panel.open { transform: translateX(0); }

.mag3d-admin-toggle {
    position: absolute;
    top: 16px; right: 16px;
    width: 38px; height: 38px;
    background: rgba(248, 245, 240, 0.9);
    border: 1px solid rgba(60, 50, 40, 0.16);
    border-radius: 2px;
    cursor: pointer;
    z-index: 45;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    transition: background 0.2s;
    backdrop-filter: blur(8px);
}
.mag3d-admin-toggle:hover { background: rgba(248, 245, 240, 1); }
.mag3d-admin-toggle span {
    display: block; width: 15px; height: 1px;
    background: rgba(60, 50, 40, 0.6);
}

.mag3d-panel-head {
    padding: 28px 20px 16px;
    border-bottom: 1px solid rgba(60, 50, 40, 0.07);
    flex-shrink: 0;
}
.mag3d-panel-head .ph-label {
    display: block;
    font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase;
    color: rgba(60, 50, 40, 0.38); margin-bottom: 4px;
}
.mag3d-panel-head .ph-title {
    font-size: 18px; color: #2a2520; font-weight: 400; letter-spacing: 0.04em;
}
.mag3d-panel-head .ph-note {
    display: block; margin-top: 6px;
    font-size: 10px; color: rgba(60, 50, 40, 0.38); line-height: 1.6;
    font-style: italic;
}

.mag3d-panel-slots {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px;
}
.mag3d-panel-slots::-webkit-scrollbar { width: 2px; }
.mag3d-panel-slots::-webkit-scrollbar-thumb { background: rgba(60,50,40,0.12); }

.mag3d-slot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 6px;
    border-bottom: 1px solid rgba(60, 50, 40, 0.06);
    border-radius: 2px;
    transition: background 0.12s;
}
.mag3d-slot:hover { background: rgba(60, 50, 40, 0.03); }

/* TOC number badge */
.mag3d-slot-num {
    font-size: 9px;
    letter-spacing: 0.12em;
    color: rgba(60, 50, 40, 0.28);
    font-family: 'Cormorant Garamond', Georgia, serif;
    min-width: 14px;
    flex-shrink: 0;
    text-align: right;
}

.mag3d-slot-thumb {
    width: 40px; height: 30px;
    border: 1px solid rgba(60, 50, 40, 0.12);
    border-radius: 1px;
    overflow: hidden;
    background: rgba(60, 50, 40, 0.02);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.mag3d-slot-thumb img { width: 100%; height: 100%; object-fit: cover; }

.mag3d-slot-info { flex: 1; min-width: 0; }
.mag3d-slot-label {
    font-size: 12px;
    letter-spacing: 0.06em;
    color: #2a2520;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mag3d-slot-status {
    font-size: 10px;
    color: rgba(60, 50, 40, 0.38);
    letter-spacing: 0.04em;
    display: block;
    margin-top: 1px;
}

.mag3d-panel-foot {
    padding: 12px 16px 20px;
    border-top: 1px solid rgba(60, 50, 40, 0.07);
    font-size: 10px;
    color: rgba(60, 50, 40, 0.3);
    line-height: 1.8;
    flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .mag3d-inst-card { max-width: 95%; }
    .mag3d-title-jp  { font-size: 38px; }
    .mag3d-lightbox-inner { max-width: 95%; }
    .mag3d-admin-panel { width: 90%; }
    .mag3d-controls-hint { display: none; }
}

/* ── Door / exit tooltip variant ───────────────────────────────────── */
/* When crosshair is on the door the tooltip says "Exit gallery" —
   we give it a subtle warm tint to distinguish it from frame labels  */
.mag3d-tooltip.exit-hint {
    color: #8a6040;
    letter-spacing: 0.30em;
}
.mag3d-tooltip.exit-hint::after {
    background: rgba(138, 96, 64, 0.3);
}

/* ── Cover logo ─────────────────────────────────────────────────────── */
.mag3d-cover-logo {
    display: block;
    max-height: 56px;
    max-width: 180px;
    object-fit: contain;
    margin-bottom: 20px;
    opacity: 0.88;
}
