/* 頁腳時段天空背景（2026-11-22，8 語系共用）
 * 依訪客「本地時間」切換 data-sky：night / dawn / morning / noon / afternoon / sunset
 * 由下往上：深 → 淺。深色帶在下方約 40%（跑步小人、版權列、之後的地標剪影所在），上方文字區保持淺色；夜晚整體偏暗、文字改白。
 *
 * 圖層（由後到前）：
 *   .footer-sky            背景漸層（z-index 0）
 *   .footer-sky-stars      夜晚星點
 *   .footer-skyline        地標剪影預留層：放 SVG，fill 用 var(--sky-silhouette) 會跟著時段變色
 *   .footer > .container   文字與跑步小人（z-index 1）
 */

.footer.has-sky {
    position: relative;
    overflow: visible;
    background-color: transparent !important;
    padding-bottom: 1.25rem;
    /* 預設（白天）*/
    --sky-bottom: #1e66c2;
    --sky-mid: #8ec9f2;
    --sky-top: #f0f8ff;
    --sky-silhouette: #16305a;      /* 給之後的 SVG 剪影用 */
    --sky-ink: #212529;             /* 上方文字 */
    --sky-ink-muted: #5b6573;
    --sky-copy: rgba(255, 255, 255, .88);  /* 最下方版權列（壓在深色帶上）*/
    --sky-rule: rgba(255, 255, 255, .22);
}

.footer-sky {
    position: absolute;
    /* 往上延伸 120px（頁腳上方留白處），讓頂端漸層拉長；z-index -1 讓延伸部分墊在上方內容之下，不會蓋住內容 */
    inset: -120px 0 0 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: linear-gradient(to top, var(--sky-bottom) 0%, var(--sky-mid) 42%, var(--sky-top) 82%, var(--sky-top) 100%);
}

/* 頂端柔化：與頁面底色 #faf7fb 自然銜接，不出現硬邊 */
.footer-sky::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 200px;
    /* 緩和曲線（ease-out）淡出，避免一條明顯的色帶 */
    background: linear-gradient(to bottom,
        #faf7fb 0%,
        rgba(250, 247, 251, .86) 18%,
        rgba(250, 247, 251, .64) 36%,
        rgba(250, 247, 251, .40) 54%,
        rgba(250, 247, 251, .20) 72%,
        rgba(250, 247, 251, .07) 88%,
        rgba(250, 247, 251, 0) 100%);
}

.footer-sky-stars {
    position: absolute;
    inset: 120px 0 35% 0;
    opacity: 0;
    background-image:
        radial-gradient(1.6px 1.6px at 30px 40px, rgba(255, 255, 255, .85), transparent 60%),
        radial-gradient(1.2px 1.2px at 120px 90px, rgba(255, 255, 255, .7), transparent 60%),
        radial-gradient(1px 1px at 200px 30px, rgba(255, 255, 255, .6), transparent 60%),
        radial-gradient(1.4px 1.4px at 260px 120px, rgba(255, 255, 255, .75), transparent 60%);
    background-size: 290px 160px;
}

/* 地標剪影預留層：之後在這個元素裡放 <svg>，例如
 *   <svg viewBox="0 0 1600 160" preserveAspectRatio="xMidYMax slice"><path fill="currentColor" d="..."/></svg>
 * color 已設成剪影色，SVG 用 currentColor 即可隨時段變色。 */
.footer-skyline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 160px;
    color: var(--sky-silhouette);
}
/* 桌機：寬度 100%、高度依比例（1920:160），所有地標都看得到 */
.footer-skyline { height: auto; line-height: 0; }
.footer-skyline svg {
    display: block;
    width: 100%;
    height: auto;
}
/* 手機：固定高度，取中段（台北 101、雪梨歌劇院、港灣大橋）*/
@media (max-width: 768px) {
    .footer-skyline { height: 92px; }
    .footer-skyline svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; }
}

.footer.has-sky > .container {
    position: relative;
    z-index: 1;
}

/* ---------- 時段配色 ---------- */
.footer.has-sky[data-sky="night"] {      /* 21:00–05:00 */
    --sky-bottom: #050816;
    --sky-mid: #121a3a;
    --sky-top: #2a3566;
    --sky-silhouette: #02040d;
    --sky-ink: #e6ebf5;
    --sky-ink-muted: #aab4cc;
    --sky-copy: rgba(230, 235, 245, .8);
    --sky-rule: rgba(255, 255, 255, .14);
}
.footer.has-sky[data-sky="night"] .footer-sky-stars { opacity: .7; }

.footer.has-sky[data-sky="dawn"] {       /* 05:00–07:00 */
    --sky-bottom: #3a2f6b;
    --sky-mid: #e3a3a6;
    --sky-top: #fdf1e7;
    --sky-silhouette: #241b47;
}
.footer.has-sky[data-sky="morning"] {    /* 07:00–11:00 */
    --sky-bottom: #2f6fb0;
    --sky-mid: #a3d3f2;
    --sky-top: #f3f9fd;
    --sky-silhouette: #1b3f6b;
}
.footer.has-sky[data-sky="noon"] {       /* 11:00–15:00 */
    --sky-bottom: #1e66c2;
    --sky-mid: #8ec9f2;
    --sky-top: #f0f8ff;
    --sky-silhouette: #16305a;
}
.footer.has-sky[data-sky="afternoon"] {  /* 15:00–17:00 */
    --sky-bottom: #2d5f94;
    --sky-mid: #c4d9e8;
    --sky-top: #fbf7ef;
    --sky-silhouette: #1d3a5c;
}
.footer.has-sky[data-sky="sunset"] {     /* 17:00–19:00 */
    --sky-bottom: #5b2a6e;
    --sky-mid: #f08a5d;
    --sky-top: #fde9d9;
    --sky-silhouette: #2e1238;
}

/* ---------- 文字顏色（覆蓋 header.php 與行內的 #212529）---------- */
.footer.has-sky > .container > .row h5,
.footer.has-sky > .container > .row p,
.footer.has-sky > .container > .row strong,
.footer.has-sky > .container > .row span,
.footer.has-sky > .container > .row li,
.footer.has-sky > .container > .row ul {
    color: var(--sky-ink) !important;
}
.footer.has-sky > .container > .row small,
.footer.has-sky > .container > .row .text-muted {
    color: var(--sky-ink-muted) !important;
}
.footer.has-sky[data-sky="night"] #toggle-comments-btn {
    color: var(--sky-ink);
    border-color: rgba(255, 255, 255, .35);
}
.footer.has-sky > .container > hr {
    background-color: var(--sky-rule) !important;
    border-color: var(--sky-rule) !important;
    position: relative;
    z-index: 3;
}
.footer.has-sky > .container > .text-center p {
    color: var(--sky-copy) !important;
    position: relative;
    z-index: 3;
    margin-bottom: 0;
}

/* 一週年夜空活動期間沿用原本的設計 */
body.anniversary-night .footer-sky { display: none; }

/* ---------- 窗光（2026-11-22）：白天隱藏、黃昏亮一半、夜晚全亮，少數窗戶緩慢閃爍 ---------- */
.footer-skyline .sky-lights {
    opacity: 0;
    fill: var(--sky-lights, #ffd98a);
    transition: opacity 1.5s ease;
}
.footer.has-sky[data-sky="sunset"] .sky-lights { opacity: .5; }
.footer.has-sky[data-sky="night"] .sky-lights { opacity: 1; }
.footer.has-sky[data-sky="night"] .sky-lights .twk-a { animation: skyTwinkle 7s ease-in-out infinite; }
.footer.has-sky[data-sky="night"] .sky-lights .twk-b { animation: skyTwinkle 11s ease-in-out 3s infinite; }
@keyframes skyTwinkle {
    0%, 100% { opacity: 1; }
    45% { opacity: .25; }
    55% { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
    .footer.has-sky .sky-lights .twk-a,
    .footer.has-sky .sky-lights .twk-b { animation: none; }
}
