/* แถบ "โลกจากอวกาศ" บนสุดของหน้าแรก (ใช้คู่กับ assets/js/space-earth.js) */
.space-earth-band {
    position: relative;
    height: calc(100vh - 170px); /* ค่าเริ่มต้นก่อนสคริปต์คำนวณความสูงจริงใต้เมนู */
    min-height: 360px;
    overflow: hidden;
    touch-action: pan-y;
    cursor: grab;
    background: radial-gradient(ellipse at 70% 20%, #0b2c6b 0%, #001f4d 30%, #000f2e 62%, #00040f 100%);
}
.space-earth-band:active { cursor: grabbing; }
/* ธีมมหาวิทยาลัยนครพนม: พื้นหลังระหว่างโหลด + แถบความคืบหน้าสไลด์สีทอง */
.npu-band { background: #001a33; cursor: default; }
.npu-band:active { cursor: default; }
.npu-band .space-earth-sky { opacity: 0; transition: opacity 1s ease; }
.npu-band.is-ready .space-earth-sky { opacity: 1; }
.npu-progress { position: absolute; z-index: 3; right: 18px; bottom: 14px; display: flex; gap: 6px; transition: bottom .3s ease; }
.npu-progress span { width: 26px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .28); overflow: hidden; }
.npu-progress span.done { background: rgba(255, 215, 0, .55); }
.npu-progress i { display: block; width: 100%; height: 100%; background: #FFD700; transform-origin: left center; transform: scaleX(0); }
@media (max-width: 768px) { .npu-progress { right: 50%; transform: translateX(50%); bottom: 10px; } .npu-progress span { width: 18px; } }
.space-earth-sky,
.space-earth-gl {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.space-earth-gl { opacity: 0; transition: opacity 1.2s ease; }
.space-earth-band.is-ready .space-earth-gl { opacity: 1; }

/* ตัวชี้ "เลื่อนลงเพื่อดูเนื้อหา" กลางล่างของแถบ */
.space-scroll-cue {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    cursor: pointer;
    font: 500 .95rem 'Prompt', sans-serif;
    transform: translateX(-50%);
    transition: opacity .4s ease, bottom .3s ease;
    animation: cueIn .9s ease 1.2s both;
}
.cue-mouse {
    position: relative;
    width: 26px;
    height: 42px;
    border: 2px solid rgba(255, 255, 255, .85);
    border-radius: 14px;
    box-shadow: 0 0 14px rgba(120, 170, 255, .55);
}
.cue-wheel {
    position: absolute;
    left: 50%;
    top: 7px;
    width: 4px;
    height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background: #FFD700;
    animation: cueWheel 1.6s ease-in-out infinite;
}
.cue-text {
    padding: 6px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 215, 0, .4);
    background: rgba(0, 15, 46, .55);
    backdrop-filter: blur(4px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
    transition: background .2s ease, color .2s ease;
}
.cue-arrow {
    color: #FFD700;
    font-size: 1.1rem;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, .7));
    animation: cueBounce 1.6s ease-in-out infinite;
}
.space-scroll-cue:hover .cue-text,
.space-scroll-cue:focus-visible .cue-text { background: #FFD700; color: #000f2e; text-shadow: none; }
.space-scroll-cue:focus-visible { outline: none; }
.space-scroll-cue:focus-visible .cue-text { box-shadow: 0 0 0 3px rgba(255, 255, 255, .8); }
.space-scroll-cue.is-hidden { opacity: 0; pointer-events: none; }

@keyframes cueIn {
    from { opacity: 0; transform: translate(-50%, 14px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes cueWheel {
    0%   { opacity: 0; transform: translateY(0); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(14px); }
}
@keyframes cueBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(7px); }
}

/* ===== Navbar บนหน้าแรกธีมโลก (html.space-top) =====
 * - ลอยทับแถบโลก (position: fixed) ให้อวกาศต่อขึ้นไปถึงขอบบนจอ
 * - อยู่บนสุด: โปร่งใส มีเงาไล่จางด้านบนช่วยให้อ่านเมนูออก
 * - เลื่อนลง (.scrolled จาก navbar.php): เป็นกระจกฝ้าน้ำเงินกึ่งโปร่ง
 * - ความสูงลดลงจาก ~170px เหลือ ~135px (เฉพาะธีมโลก หน้าอื่นเหมือนเดิม) */
html.space-top #mainNavbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}
/* style.css มี .navbar { background-color: rgba(255,255,255,.95) !important } ซึ่งเดิมถูกไล่เฉดน้ำเงินทึบบังไว้
   พอทำ navbar โปร่งใสจึงต้อง override ด้วย !important เฉพาะหน้าแรกธีมโลก */
html.space-top #mainNavbar:not(.scrolled) {
    background-color: transparent !important;
    background-image: linear-gradient(180deg, rgba(0, 8, 24, .6) 0%, rgba(0, 8, 24, .25) 60%, rgba(0, 8, 24, 0) 100%);
    box-shadow: none;
    border-bottom-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
html.space-top #mainNavbar.scrolled {
    background-color: rgba(0, 16, 40, .72) !important;
    background-image: none;
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
}
/* เปิดเมนูบนมือถือ: ใช้พื้นทึบให้อ่านรายการเมนูได้ชัด */
html.space-top #mainNavbar:has(.navbar-collapse.show),
html.space-top #mainNavbar:has(.navbar-collapse.collapsing) {
    background-color: #001a33 !important;
    background-image: none;
}
@media (min-width: 992px) {
    html.space-top #mainNavbar:not(.scrolled) .logo-circle { width: 96px; height: 96px; }
    html.space-top #mainNavbar:not(.scrolled) .navbar-logo-center { height: 128px; }
    html.space-top #mainNavbar:not(.scrolled) .brand-text-center { margin-top: 4px; }
    html.space-top #mainNavbar:not(.scrolled) .brand-title { font-size: 1.4rem; }
}
/* ตัวอักษรเมนูมีเงาเล็กน้อย อ่านง่ายเมื่ออยู่บนภาพโลก/ดาว */
html.space-top #mainNavbar:not(.scrolled) .nav-link { text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }

/* ===== โหมดพื้นหลังอวกาศทั้งหน้า (html.space-bg-mode, section data-mode="fixed") =====
 * ชั้นอวกาศ/โลกตรึงอยู่หลังสุด เนื้อหาแต่ละส่วนกลายเป็นแผงขาวลอยเหนืออวกาศ
 * ส่วนตัวเลขสถิติโปร่งใส (ตัวอักษรขาว/ทองอ่านบนอวกาศได้) */
.space-bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 70% 20%, #0b2c6b 0%, #001f4d 30%, #000f2e 62%, #00040f 100%);
}
.space-bg-layer.is-ready .space-earth-gl { opacity: 1; }
html.space-bg-mode body { background: #00040f; }
html.space-bg-mode .space-earth-band { background: transparent; }
html.space-bg-mode .space-earth-band,
html.space-bg-mode .hero-admission,
html.space-bg-mode body > .container,
html.space-bg-mode body > main > .container,
html.space-bg-mode .counter-section,
html.space-bg-mode .academic-calendar-section,
html.space-bg-mode #meeting-calendar-section,
html.space-bg-mode .news-section-wrapper,
html.space-bg-mode #documents-section,
html.space-bg-mode #activity-gallery-section,
html.space-bg-mode footer.footer-enhanced {
    position: relative;
    z-index: 1;
}
html.space-bg-mode .counter-section,
html.space-bg-mode .academic-calendar-section,
html.space-bg-mode #meeting-calendar-section,
html.space-bg-mode .news-section-wrapper,
html.space-bg-mode #documents-section,
html.space-bg-mode #activity-gallery-section {
    background: transparent !important;
}
html.space-bg-mode .academic-calendar-section > .container,
html.space-bg-mode #meeting-calendar-section > .container,
html.space-bg-mode .news-section-wrapper > .container,
html.space-bg-mode #documents-section > .container,
html.space-bg-mode #activity-gallery-section > .container {
    background: rgba(255, 255, 255, .94);
    border-radius: 24px;
    padding: 2rem 1.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 215, 0, .18);
}
html.space-bg-mode #documents-section { padding-top: 3rem; }
html.space-bg-mode #meeting-calendar-section > :not(.container) { display: none; } /* ซ่อนวงกลมตกแต่งเดิมที่ออกแบบไว้สำหรับพื้นขาว */
html.space-bg-mode .footer-wave { display: none; }

@media (max-width: 768px) {
    .space-earth-band { height: calc(100vh - 80px); }
    html.space-bg-mode .academic-calendar-section > .container,
    html.space-bg-mode #meeting-calendar-section > .container,
    html.space-bg-mode .news-section-wrapper > .container,
    html.space-bg-mode #documents-section > .container,
    html.space-bg-mode #activity-gallery-section > .container {
        border-radius: 16px;
        padding: 1.25rem .9rem;
        width: calc(100% - 16px);
    }
}
@media (pointer: coarse) {
    .cue-mouse { display: none; } /* จอสัมผัสไม่มีเมาส์ เหลือป้ายข้อความ + ลูกศร */
}
@media (prefers-reduced-motion: reduce) {
    .space-scroll-cue, .cue-wheel, .cue-arrow { animation: none; }
}

/* ===== ตรามหาวิทยาลัยลอยเหนือจุดนครพนม (วางตำแหน่งจาก space-earth.js placeEmblem) ===== */
.npu-emblem { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 2; pointer-events: none; will-change: transform, opacity; }
.npu-emblem-beam {
    position: absolute; left: -1px; bottom: 0; width: 2px; height: 74px;
    background: linear-gradient(to top, rgba(255, 213, 74, .95), rgba(255, 213, 74, 0));
    filter: drop-shadow(0 0 4px rgba(255, 196, 64, .9));
}
.npu-emblem-halo {
    position: absolute; left: -64px; bottom: 58px; width: 128px; height: 128px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 213, 74, .38) 0%, rgba(255, 171, 64, .12) 45%, rgba(255, 171, 64, 0) 68%);
    animation: npuEmblemFloat 4.5s ease-in-out infinite;
}
.npu-emblem img {
    position: absolute; left: -35px; bottom: 72px; width: 70px; height: auto;
    filter: drop-shadow(0 0 10px rgba(255, 196, 64, .7)) drop-shadow(0 6px 14px rgba(0, 0, 0, .55));
    animation: npuEmblemFloat 4.5s ease-in-out infinite;
}
@keyframes npuEmblemFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (max-width: 768px) {
    .npu-emblem-beam { height: 46px; }
    .npu-emblem-halo { left: -36px; bottom: 36px; width: 72px; height: 72px; }
    .npu-emblem img { left: -20px; bottom: 44px; width: 40px; }
}
@media (prefers-reduced-motion: reduce) { .npu-emblem-halo, .npu-emblem img { animation: none; } }

/* ป้ายวันทางจันทรคติเมื่อแตะดวงจันทร์ (assets/js/space-earth.js) */
html.moon-hover, html.moon-hover * { cursor: pointer !important; }
.moon-tip {
    position: fixed;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 180px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 215, 0, .45);
    border-radius: 14px;
    background: rgba(0, 15, 46, .82);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .45), 0 0 18px rgba(120, 170, 255, .25);
    color: #fff;
    font-family: 'Prompt', sans-serif;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) translateY(6px);
    transition: opacity .25s ease, transform .25s ease;
}
.moon-tip.is-on { opacity: 1; transform: translate(-50%, -100%); }
.moon-tip-title { font-weight: 600; font-size: 1rem; }
.moon-tip-fest { color: #FFD700; font-weight: 600; font-size: .9rem; }
.moon-tip-sub { font-size: .78rem; color: rgba(255, 255, 255, .78); }
@media (prefers-reduced-motion: reduce) { .moon-tip { transition: none; } }
