@import url(//fonts.googleapis.com/earlyaccess/cwtexfangsong.css);
@import url('https://fonts.googleapis.com/css?family=Noto+Serif+TC');

body {
    overflow-x: hidden;
    font-family: 'Noto Serif TC', serif;
    /* background-color: white; */
    /* background-color: antiquewhite; */
    /* background: #eaebec; */
    background-color: #FAFAF3;
}

* {
    box-sizing: border-box;
}

#header {

    top: 0;
    left: 0;
    z-index: 510;
    color: #c6bcb7;
    letter-spacing: 5px;
    height: 70px;
    width: 100%;
    border-bottom: 3px solid rgba(109, 94, 87, 1);
    outline: 5px solid #b0a494;
    box-shadow: 0 0 0 10px hsl(0, 0%, 80%), 0 0 0 15px hsl(0, 0%, 90%);
    background: rgb(109, 94, 87);
    background: -moz-linear-gradient(top, rgba(109, 94, 87, 1) 0%, rgba(138, 121, 112, 1) 50%, rgba(147, 128, 118, 1) 100%);
    background: -webkit-linear-gradient(top, rgba(109, 94, 87, 1) 0%, rgba(138, 121, 112, 1) 50%, rgba(147, 128, 118, 1) 100%);
    background: linear-gradient(to bottom, rgba(109, 94, 87, 1) 0%, rgba(138, 121, 112, 1) 50%, rgba(147, 128, 118, 1) 100%);
    margin-bottom: 15px;
}

#header .navi {
    position: absolute;
}

#header .navi .logo {
    display: block;
    float: left;
    margin: 0 30px;
}

#header .navi .web-title {
    display: block;
    float: left;
    margin: 11px 30px 0 30px;
    font-size: 30px;
    color: white;
    box-sizing: border-box;
    height: 50px;
    text-shadow: 2px 4px 5px #5d2c2c;
}

.mapbox-mask {
    /* background-color: antiquewhite; */
    position: fixed;
    z-index: 51;
    top: 70px;
    left: 0;
    width: 60%;
    height: inherit;

    padding: 40px;
    overflow-x: hidden;
    /* For Opera */

    box-shadow:
        inset #19d4ff 0 0 0 15px,
        inset #18cdf7 0 0 0 11px,
        inset #53dfff 0 0 0 20px,
        inset #50d8f7 0 0 0 21px,
        inset #8ce9ff 0 0 0 26px,
        inset #88e2f7 0 0 0 27px,
        inset #c5f4ff 0 0 0 32px,
        inset #bfecf7 0 0 0 33px;
}

#map-in-the-box {
    max-width: 100%;
    margin: 0 auto;
}

/* 不要裁整個 image-map-pro 
#image-map-pro{
    width: 100%;
    overflow: visible;
}*/

/* 只裁畫布視窗，不裁 object list
#image-map-pro .imp-canvas-wrap{
    max-height: calc(100vh - 70px - 60px - 70px - 24px);
    overflow: hidden;
}*/

.mapbox {
    position: fixed;
    z-index: 50;
    top: 70px;
    left: 0;
    width: 60%;
}

.map {
    width: 100%;
    position: absolute;
    top: 0;
    /* bottom: 0; */
    /* left: 0; */
    /* margin: auto; */
    /* background-color: darkgrey; */
}

.compass {
    width: 170px;
    right: 0;
}


.frame {
    border: 4px solid #d0adad;
    box-shadow: -moz-box-shadow: inset 0 0 10px #000000;
    -webkit-box-shadow: inset 0 0 10px #000000;
    box-shadow: inset 0 0 10px #000000;
}

.info-box {
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
}

.jump {
    position: fixed;
    z-index: 100;
    background-color: burlywood;
    width: auto;
    float: left;
    right: 0;
    padding: 15px;
    box-sizing: border-box;
}

.link {
    display: block;
    background-color: #edcdcd;
    width: 60px;
    text-align: center;
    padding: 5px;
    margin: 5px;
}

.before-keys {
    position: fixed;
    z-index: 500;
    top: 70px;
    right: 0;
    background-color: #eaebec;
    width: 40%;
    box-sizing: border-box;
    height: 120px;
}

.keys {
    position: fixed;
    z-index: 500;
    /* padding: 15px 15px 18px 15px; */
    top: 90px;
    right: 25px;
    background-color: #b0a494;
    width: calc(40% - 50px);
    box-sizing: border-box;
    box-shadow: 0px 0px 20px #bdbdbd;
    /* border: 3px solid #5d2c2c; */
    height: 90px;
}

.keys .info {
    position: absolute;
    padding: 4px 10px;
    /* background-color: burlywood; */
    background-color: #b0a494;
    width: 100%;
    border: 3px solid #5d2c2c;
    box-sizing: border-box;
}

.keys .info .year {
    font-size: 24px;
    color: #444;
}

.keys .info .unit {
    display: inline;
    font-size: 24px;
    margin: 0px 0 0 10px;
    color: #444;
}

.keys .info .school {
    font-size: 25px;
    margin-left: 20px;
    margin-bottom: 5px;
    display: none;
}

.keys .info .building {
    font-size: 30px;
    margin-bottom: 5px;
    white-space: nowrap;
}

.widget {
    position: absolute;
    padding: 0 25px 15px 25px;
    top: 190px;
    background: #eaebec;
    z-index: 400;
    width: 100%;
}

.widget .info {
    background-color: white;
    position: relative;
    margin: 10px 0 10vh 0;
    text-align: center;
    box-shadow: 0px 0px 20px #bdbdbd;
    padding: 10px 30px;
    min-height: 60vh;
}

.widget .info .year {
    font-size: 30px;
}

.widget .info .unit {
    display: inline;
    background-color: white;
    font-size: 20px;
    margin: 0px 0 0 20px;
}

.widget .info .building {
    font-size: 30px;
    margin-bottom: 5px;
}

.widget .info .main-pic {
    margin-top: 10px;
    max-width: 100%;
    max-height: 100%;
    border: 1px solid rgba(128, 128, 128, 0.33);
    box-shadow: 0px 0px 11px 0px grey;
}

.widget .info .img-title {
    font-size: 24px;
    margin-top: 8px;
    margin-bottom: 30px;
    letter-spacing: 0.2em;
}

.widget .info p {
    font-size: 24px;
    line-height: 36px;
    padding-right: 0px;
    /* max-width: 600px; */
    text-align: justify;
    margin-bottom: 1em;
}

.widget .info p.red {
    color: red;
}

.widget .info a {
    color: maroon;
}

.widget .info .blank {
    width: 24px;
}


.out {
    display: none;
}

.map img {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 140px);
}

.bottom-gradient {
    border-bottom-right-radius: 200px;
}

.gradient-after {
    background-image: linear-gradient(to right, #ff8a00, #da1b60);
}

.count {
    width: 0px;
    height: 0px;
    margin: 50px auto;
    /* padding-top: 800px; */
    margin-top: 1000px;
    background: #ccc;
    text-align: center;
    color: #FFF;
    font-size: 3em;
    opacity: 0;
}

/*iPhone 6, 7, & 8 Plus in portrait*/

@media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation: portrait) {
    .mapbox {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
    }

    .map {
        width: 100%;
        /* position: absolute; */
        top: 0;
        left: 0;
    }

    .info-box {
        /* position: absolute; */
        top: 40%;
        right: 0;
        width: 100%;
    }

    .widget .info .year {
        font-size: 20px;
    }

    .widget .info .unit {
        font-size: 16px;
    }

    .widget .info .building {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .widget .info .main-pic {
        max-width: 60%;
        border: 1px solid rgba(128, 128, 128, 0.33);
        box-shadow: 3px 3px 3px 0px grey;
    }

    .widget .info .img-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .widget .info p {
        max-width: 94%;
    }
}

@media only screen and (min-device-width: 1280px) and (max-device-width: 1679px) {
    .keys {
        height: 72px;
    }

    .keys .info .year {
        font-size: 20px;
        color: #444;
    }

    .keys .info .unit {
        display: inline;
        font-size: 20px;
        margin: 0px 0 0 10px;
        color: #444;
    }

    .keys .info .building {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .widget .info p {
        font-size: 20px;
        line-height: 30px;
    }
}

@media only screen and (min-device-width: 768px) and (max-device-width: 1279px) {
    .keys {
        height: 72px;
    }

    .keys .info .year {
        font-size: 20px;
        color: #444;
    }

    .keys .info .unit {
        display: inline;
        font-size: 20px;
        margin: 0px 0 0 10px;
        color: #444;
    }

    .keys .info .building {
        font-size: 20px;
        margin-bottom: 5px;
    }
}

@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
    #header {

        width: 100%;
        height: 50px;
    }

    #header .navi .web-title {

        margin: 5px 10px 0 10px;
        font-size: 22px;
        /*         letter-spacing: 0; */
        text-align: center;

    }

    .mapbox {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 500;
    }

    .map {
        width: 100%;
        /* position: absolute; */
        top: 0;
        left: 0;
    }

    .compass {
        display: none;
    }

    .widget .info p {
        font-size: 20px;
    }

    .before-keys {
        display: none
    }

    .keys {
        width: 100%;
        top: calc(50% + 40px);
        right: 0;
        height: 73px;
    }

    .keys .info .year,
    .keys .info .unit,
    .keys .info .building {
        font-size: 20px;
    }

    .widget {
        top: 215px;
    }

    .info-box {
        /*  position: absolute; */
        top: 40%;
        right: 0;
        width: 100%;
    }

    .widget .info .year {
        font-size: 20px;
    }

    .widget .info .unit {
        font-size: 16px;
    }

    .widget .info .building {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .widget .info .main-pic {
        max-width: 60%;
        border: 1px solid rgba(128, 128, 128, 0.33);
        box-shadow: 3px 3px 3px 0px grey;
    }

    .widget .info .img-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .widget .info p {
        max-width: 94%;
    }
}

/*iPhone 6, 7, & 8 in portrait*/

@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation: portrait) {
    #header {

        width: 100%;
        height: 50px;
    }

    #header .navi .web-title {

        margin: 5px 10px 0 10px;
        font-size: 22px;
        letter-spacing: 0;
        text-align: center;

    }

    .mapbox {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 500;
    }

    .map {
        width: 100%;
        /* position: absolute; */
        top: 0;
        left: 0;
    }

    .compass {
        display: none;
    }

    .widget .info p {
        font-size: 20px;
    }

    .before-keys {
        display: none
    }

    .keys {
        width: 100%;
        top: 40%;
        right: 0;
        height: 73px;
    }

    .keys .info .year,
    .keys .info .unit,
    .keys .info .building {
        font-size: 20px;
    }

    .widget {
        top: 73px;
    }

    .info-box {
        /*  position: absolute; */
        top: 40%;
        right: 0;
        width: 100%;
    }

    .widget .info .year {
        font-size: 20px;
    }

    .widget .info .unit {
        font-size: 16px;
    }

    .widget .info .building {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .widget .info .main-pic {
        max-width: 60%;
        border: 1px solid rgba(128, 128, 128, 0.33);
        box-shadow: 3px 3px 3px 0px grey;
    }

    .widget .info .img-title {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .widget .info p {
        max-width: 94%;
    }
}

/*iPhone X,XS in portrait*/
@media only screen and (min-device-width : 375px) and (max-device-width : 812px) and (-webkit-device-pixel-ratio : 3) and (orientation : portrait) {
    #header {

        width: 100%;
        height: 50px;
    }

    #header .navi .web-title {

        margin: 5px 10px 0 10px;
        font-size: 20px;
        letter-spacing: 0;
        text-align: center;

    }

    .mapbox {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 500;
    }

    .compass {
        display: none;
    }

    .info-box {

        top: 40%;

    }

    .widget {
        /* position: absolute; */
        padding: 0 15px 15px 15px;
        top: 15px;
        background: #eaebec;
    }

    .widget .info p {
        font-size: 20px;
    }

    .before-keys {
        display: none
    }

    .keys {
        width: 100%;
        top: 33%;
        right: 0;
        height: 73px;
    }

    .keys .info .year,
    .keys .info .unit,
    .keys .info .building {
        font-size: 20px;
    }

}

.footer {
    font-size: 16px;
    line-height: 51px;
    padding: 10px 30px;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    text-align: left;
    color: #c6bcb7;
    background: rgb(109, 94, 87);
    background: -moz-linear-gradient(top, rgba(109, 94, 87, 1) 0%, rgba(138, 121, 112, 1) 50%, rgba(147, 128, 118, 1) 100%);
    background: -webkit-linear-gradient(top, rgba(109, 94, 87, 1) 0%, rgba(138, 121, 112, 1) 50%, rgba(147, 128, 118, 1) 100%);
    background: linear-gradient(to bottom, rgba(109, 94, 87, 1) 0%, rgba(138, 121, 112, 1) 50%, rgba(147, 128, 118, 1) 100%);
}

/*底下是原始的*/

.item {
    width: 200px;
    height: 200px;
    margin: 50px auto;
    padding-top: 75px;
    background: #ccc;
    text-align: center;
    color: #FFF;
    font-size: 3em;
    opacity: 1;
}

.item span {
    display: block;
    font-size: 1rem;
}

.item--primary {
    width: 200px;
    height: 200px;
    margin: 50px auto;
    padding-top: 75px;
    background: #ccc;
    text-align: center;
    color: #FFF;
    font-size: 3em;
    position: fixed;
    top: 0;
    bottom: 0;
    margin: auto;
    right: 20px;
    background: green;
}

.item--secondary {
    width: 200px;
    height: 200px;
    margin: 50px auto;
    padding-top: 75px;
    background: #ccc;
    text-align: center;
    color: #FFF;
    font-size: 3em;
    position: fixed;
    top: 0;
    bottom: 0;
    margin: auto;
    left: 20px;
    background: red;
}

.scroll-down {
    position: relative;
    width: 60px;
    height: 60px;
    margin: -9vh auto 5vh auto;
}

.chevron {
    position: absolute;
    width: 36px;
    height: 8px;
    opacity: 0;
    transform: scale3d(0.5, 0.5, 0.5);
    animation: move 3s ease-out infinite;
}

.chevron:first-child {
    animation: move 3s ease-out 1s infinite;
}

.chevron:nth-child(2) {
    animation: move 3s ease-out 2s infinite;
}

.chevron:before,
.chevron:after {
    content: ' ';
    position: absolute;
    top: 0;
    height: 100%;
    width: 51%;
    background: #6d5e57;
}

.chevron:before {
    left: 0;
    transform: skew(0deg, 30deg);
}

.chevron:after {
    right: 0;
    width: 50%;
    transform: skew(0deg, -30deg);
}

@keyframes move {
    25% {
        opacity: 1;

    }

    33% {
        opacity: 1;
        transform: translateY(30px);
    }

    67% {
        opacity: 1;
        transform: translateY(40px);
    }

    100% {
        opacity: 0;
        transform: translateY(55px) scale3d(0.5, 0.5, 0.5);
    }
}

.text {
    display: inline-block;
    margin-top: 60px;
    margin-left: -30px;
    font-size: 24px;
    color: #000;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: .25;
    animation: pulse 2s linear alternate infinite;
}

@keyframes pulse {
    to {
        opacity: 1;
    }
}

/* =========================================================
   Final responsive refinements for NTU History 2026 map
   - Desktop map fitting by viewport width / height
   - Mobile / tablet header and footer fixes
   - Timeline touch-drag stability
   ========================================================= */

/* Base map container: Image Map Pro is scaled by width to preserve aspect ratio. */
#map-in-the-box {
    max-width: 100%;
    margin: 0 auto;
}

/* =========================================================
   Desktop / Laptop map size control
   目標：讓 header + timeline + map + footer 盡量一眼可見
   以不裁切、不改 imp-canvas 高度為原則，只用 max-width 等比例縮放
   ========================================================= */

#map-in-the-box {
    max-width: 100%;
    margin: 0 auto;
}

/* 超寬螢幕：例如 3440x1440，但瀏覽器實際可視高度偏低 */
@media (min-width: 3000px) and (max-height: 1150px) {
    #map-in-the-box {
        max-width: 45%;
    }
}

/* 2K / 27 吋級距：2560x1440、2560x1080、可視高度偏低 */
@media (min-width: 2400px) and (max-width: 2999px) and (max-height: 1150px) {
    #map-in-the-box {
        max-width: 52%;
    }
}

/* 1920～2399 桌機：常見 24～27 吋螢幕 */
@media (min-width: 1800px) and (max-width: 2399px) and (max-height: 1050px) {
    #map-in-the-box {
        max-width: 62%;
    }
}

/* 1440～1799 筆電 / 中尺寸桌機 */
@media (min-width: 1366px) and (max-width: 1799px) and (max-height: 950px) {
    #map-in-the-box {
        max-width: 72%;
    }
}

/* 13～14 吋筆電，高度更緊 */
@media (min-width: 1024px) and (max-width: 1365px) and (max-height: 850px) {
    #map-in-the-box {
        max-width: 68%;
    }
}

/* 桌機高度非常低的特殊情況，再縮一點 */
@media (min-width: 1024px) and (max-height: 760px) {
    #map-in-the-box {
        max-width: 64%;
    }
}

/* 手機與小平板不要套桌機縮圖邏輯 */
@media (max-width: 1023px) {
    #map-in-the-box {
        max-width: 100%;
    }
}

/* ---------------------------------------------------------
   Mobile header / footer refinement
   --------------------------------------------------------- */

@media (max-width: 767px) {
    #header {
        height: auto;
        min-height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px 14px;
        box-sizing: border-box;
    }

    #header .navi {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #header .navi .web-title {
        float: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: auto;
        min-height: 44px;
        margin: 0;
        padding: 0 4px;
        box-sizing: border-box;
        text-align: center;
        line-height: 1.25;
        font-size: 20px;
        letter-spacing: 0.05em;
    }

    .footer {
        height: auto;
        min-height: 82px;
        padding: 12px 14px 14px;
        box-sizing: border-box;
        line-height: 1.2em;
        font-size: 14px;
        white-space: normal;
        text-align: center;
    }
}

/* Tablet footer: avoid clipping caused by fixed footer height. */
@media (min-width: 768px) and (max-width: 1279px) {
    .footer {
        height: auto;
        min-height: 64px;
        padding: 12px 20px;
        box-sizing: border-box;
        line-height: 1.2em;
        white-space: normal;
    }
}

/* ---------------------------------------------------------
   Timeline touch-drag stability overrides
   這些樣式覆蓋 JS 注入樣式，避免手機拖曳被瀏覽器手勢中斷。
   --------------------------------------------------------- */

#imp-timeline-shell .imp-timeline-viewport {
    position: relative;
    width: 100%;
    height: 60px;
    overflow: hidden;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    border: 1px solid rgba(72, 48, 24, .35);
    border-radius: 14px;
    background:
        linear-gradient(to bottom, rgba(254, 248, 225, .98), rgba(234, 219, 187, .98)),
        repeating-linear-gradient(90deg,
        rgba(105, 78, 42, .05) 0px,
        rgba(105, 78, 42, .05) 1px,
        transparent 1px,
        transparent 24px);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, .14),
        inset 0 0 0 1px rgba(255, 255, 255, .45),
        inset 0 0 20px rgba(99, 71, 41, .12);
}

#imp-timeline-shell .imp-timeline-indicator,
#imp-timeline-shell .imp-timeline-indicator * {
    pointer-events: none !important;
}

/* =========================================================
   Timeline placement
   將時間軸固定放在 header 與 map 之間
   ========================================================= */

#imp-timeline-host {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 10px auto;
    position: relative;
    z-index: 99999;
}

/* 因為時間軸移到上方，shell 不需要再有太多上下外距 */
#imp-timeline-host #imp-timeline-shell {
    margin: 0;
}

/* 桌機版時間軸可以跟 map 使用同樣縮放寬度，視覺比較整齊 */
@media (min-width: 3000px) and (max-height: 1150px) {
    #imp-timeline-host {
        max-width: 45%;
    }
}

@media (min-width: 2400px) and (max-width: 2999px) and (max-height: 1150px) {
    #imp-timeline-host {
        max-width: 52%;
    }
}

@media (min-width: 1800px) and (max-width: 2399px) and (max-height: 1050px) {
    #imp-timeline-host {
        max-width: 62%;
    }
}

@media (min-width: 1366px) and (max-width: 1799px) and (max-height: 950px) {
    #imp-timeline-host {
        max-width: 72%;
    }
}

@media (min-width: 1024px) and (max-width: 1365px) and (max-height: 850px) {
    #imp-timeline-host {
        max-width: 68%;
    }
}

@media (min-width: 1024px) and (max-height: 760px) {
    #imp-timeline-host {
        max-width: 64%;
    }
}

@media (max-width: 1023px) {
    #imp-timeline-host {
        max-width: 100%;
        margin-bottom: 8px;
    }
}

/* =========================================================
   Timeline responsive placement
   桌機：時間軸在 map-in-the-box 上方
   手機：時間軸在 map-in-the-box 下方
   ========================================================= */

#map-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
}

#imp-timeline-host {
    width: 100%;
    max-width: 100%;
    margin: 0 auto 10px auto;
    position: relative;
    z-index: 99999;
    order: 1;
}

#map-in-the-box {
    order: 2;
}

/* 桌機版：時間軸與 map 使用同樣寬度比例 */
@media (min-width: 3000px) and (max-height: 1150px) {
    #imp-timeline-host,
    #map-in-the-box {
        max-width: 45%;
    }
}

@media (min-width: 2400px) and (max-width: 2999px) and (max-height: 1150px) {
    #imp-timeline-host,
    #map-in-the-box {
        max-width: 52%;
    }
}

@media (min-width: 1800px) and (max-width: 2399px) and (max-height: 1050px) {
    #imp-timeline-host,
    #map-in-the-box {
        max-width: 62%;
    }
}

@media (min-width: 1366px) and (max-width: 1799px) and (max-height: 950px) {
    #imp-timeline-host,
    #map-in-the-box {
        max-width: 72%;
    }
}

@media (min-width: 1024px) and (max-width: 1365px) and (max-height: 850px) {
    #imp-timeline-host,
    #map-in-the-box {
        max-width: 68%;
    }
}

@media (min-width: 1024px) and (max-height: 760px) {
    #imp-timeline-host,
    #map-in-the-box {
        max-width: 64%;
    }
}

/* 手機 / 小平板：map 在上，時間軸在下 */
/* =========================================================
   Map + Timeline placement
   所有裝置統一：
   Map 在上
   Timeline 在下
   ========================================================= */

#map-stage {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Map */
#map-in-the-box {
    order: 1;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Timeline */
#imp-timeline-host {
    order: 2;
    width: 100%;
    max-width: 100%;
    margin: 8px auto 10px auto;
    position: relative;
    z-index: 99999;
}

#imp-timeline-host #imp-timeline-shell {
    margin: 0;
}


/* =========================================================
   Map 與 Timeline 同寬縮放
   ========================================================= */

@media (min-width: 3000px) and (max-height: 1150px) {
    #map-in-the-box,
    #imp-timeline-host {
        max-width: 45%;
    }
}

@media (min-width: 2400px) and (max-width: 2999px) and (max-height: 1150px) {
    #map-in-the-box,
    #imp-timeline-host {
        max-width: 52%;
    }
}

@media (min-width: 1800px) and (max-width: 2399px) and (max-height: 1050px) {
    #map-in-the-box,
    #imp-timeline-host {
        max-width: 62%;
    }
}

@media (min-width: 1366px) and (max-width: 1799px) and (max-height: 950px) {
    #map-in-the-box,
    #imp-timeline-host {
        max-width: 72%;
    }
}

@media (min-width: 1024px) and (max-width: 1365px) and (max-height: 850px) {
    #map-in-the-box,
    #imp-timeline-host {
        max-width: 68%;
    }
}

@media (min-width: 1024px) and (max-height: 760px) {
    #map-in-the-box,
    #imp-timeline-host {
        max-width: 64%;
    }
}


/* 手機 / 小平板 */

@media (max-width: 1023px) {

    #map-in-the-box {
        max-width: 100%;
    }

    #imp-timeline-host {
        max-width: 100%;
        margin: 8px auto 8px auto;
    }

}

/* =========================================================
   Image Map Pro Tooltip Scroll
   Tooltip 內容過長時加入垂直捲軸
   ========================================================= */

.imp-tooltip-content {
    max-height: min(520px, 65dvh) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* Scrollbar */
.imp-tooltip-content::-webkit-scrollbar {
    width: 7px;
}

.imp-tooltip-content::-webkit-scrollbar-track {
    background: transparent;
}

.imp-tooltip-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.28);
    border-radius: 10px;
}

.imp-tooltip-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.45);
}

/* 手機版 */
@media (max-width: 767px) {
    .imp-tooltip-content {
        max-height: 55dvh !important;
    }
}

/* =========================================================
   V16 Timeline UI + responsive Artboard selector
   - 建築名稱置上、年代置下
   - Timeline 操作說明橫列
   - 小螢幕 / 大字體 Artboard 下拉選單不超出 viewport
   ========================================================= */

/* Timeline: increase vertical room for the two-line label. */
#imp-timeline-shell .imp-timeline-viewport {
    height: 78px !important;
}

#imp-timeline-shell .imp-step-label {
    left: 22px !important;
    right: 22px !important;
    top: 5px !important;
    bottom: 5px !important;
    padding: 0 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px;
    text-align: center !important;
    white-space: normal !important;
    overflow: hidden;
    line-height: 1.15 !important;
}

#imp-timeline-shell .imp-step-title {
    display: -webkit-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    word-break: normal;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

#imp-timeline-shell .imp-step-year {
    display: block;
    width: 100%;
    flex: 0 0 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: rgba(78, 49, 23, .72);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .02em;
    text-align: center;
}

#imp-timeline-shell .imp-step.is-active .imp-step-title,
#imp-timeline-shell .imp-step.is-active .imp-step-year {
    color: #7c1818;
}

/* Timeline usage guide. Kept inside the shell so fullscreen bridge moves it too. */
#imp-timeline-shell .imp-timeline-guide {
    width: 100%;
    margin-top: 7px;
    padding: 1px 6px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, .9fr) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: rgba(78, 49, 23, .82);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

#imp-timeline-shell .imp-timeline-guide-item {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

#imp-timeline-shell .imp-guide-newer {
    justify-content: flex-end;
    text-align: right;
}

#imp-timeline-shell .imp-guide-current {
    justify-content: center;
    text-align: center;
}

#imp-timeline-shell .imp-guide-older {
    justify-content: flex-start;
    text-align: left;
}

#imp-timeline-shell .imp-guide-arrow {
    flex: 0 0 auto;
    color: #8b2d2d;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
}

#imp-timeline-shell .imp-guide-diamond {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    transform: rotate(45deg);
    background: #d33b2f;
    border: 1px solid rgba(124, 24, 24, .45);
}

#imp-timeline-shell .imp-guide-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.15;
}

#imp-timeline-shell .imp-guide-copy strong {
    font-size: .82rem;
    font-weight: 700;
}

#imp-timeline-shell .imp-guide-copy small {
    font-size: .72rem;
    font-weight: 400;
    opacity: .78;
}

/* Image Map Pro Artboard selector: constrain the control to the visible viewport. */
#image-map-pro .imp-ui-layers-menu-wrap {
    width: min(420px, calc(100vw - 40px)) !important;
    max-width: calc(100vw - 40px) !important;
    min-width: 0 !important;
}

#image-map-pro .imp-ui-element.imp-ui-layers-select {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
}

/* Some browsers honor wrapping on native options, others show their OS picker. */
#image-map-pro .imp-ui-layers-select option {
    max-width: calc(100vw - 32px);
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Keep the native selector inside the same 20px viewport gutters used by IMP UI. */
@media (max-width: 767px) {
    #image-map-pro .imp-ui-top-right,
    #image-map-pro .imp-ui-top-left {
        max-width: calc(100vw - 40px);
    }

    #image-map-pro .imp-ui-layers-select {
        text-size-adjust: 100%;
        -webkit-text-size-adjust: 100%;
    }
}

@media (max-width: 767px) {
    #imp-timeline-shell .imp-timeline-viewport {
        height: 90px !important;
    }

    #imp-timeline-shell .imp-step-label {
        left: 24px !important;
        right: 24px !important;
        top: 7px !important;
        bottom: 7px !important;
        padding: 0 10px !important;
        gap: 5px;
    }

    #imp-timeline-shell .imp-step-title {
        font-size: 15px;
        line-height: 1.22;
    }

    #imp-timeline-shell .imp-step-year {
        font-size: 12px;
    }

    #imp-timeline-shell .imp-timeline-guide {
        grid-template-columns: minmax(0, 1fr) minmax(86px, .8fr) minmax(0, 1fr);
        gap: 5px;
        margin-top: 6px;
        padding-left: 2px;
        padding-right: 2px;
    }

    #imp-timeline-shell .imp-timeline-guide-item {
        gap: 5px;
    }

    #imp-timeline-shell .imp-guide-arrow {
        font-size: 21px;
    }

    #imp-timeline-shell .imp-guide-copy strong {
        font-size: .76rem;
    }

    #imp-timeline-shell .imp-guide-copy small {
        font-size: .66rem;
        line-height: 1.2;
    }

    #image-map-pro .imp-ui-layers-menu-wrap {
        width: min(360px, calc(100vw - 40px)) !important;
        max-width: calc(100vw - 40px) !important;
        min-width: 0 !important;
    }

    #image-map-pro .imp-ui-element.imp-ui-layers-select {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 44px !important;
        padding: 9px 38px 9px 12px !important;
        line-height: 1.3 !important;
        font-size: 1rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #image-map-pro .imp-ui-layers-menu-wrap .imp-icon {
        top: 50% !important;
        right: 12px !important;
        transform: translateY(-50%);
    }
}

@media (max-width: 420px) {
    #imp-timeline-shell .imp-timeline-guide {
        grid-template-columns: minmax(0, 1fr) minmax(72px, .72fr) minmax(0, 1fr);
        gap: 3px;
    }

    #imp-timeline-shell .imp-guide-arrow {
        font-size: 19px;
    }

    #imp-timeline-shell .imp-guide-copy strong {
        font-size: .72rem;
    }

    #imp-timeline-shell .imp-guide-copy small {
        font-size: .62rem;
    }

    #image-map-pro .imp-ui-layers-menu-wrap {
        width: calc(100vw - 40px) !important;
        max-width: calc(100vw - 40px) !important;
    }
}



/* =========================================================
   V16 revision: centered page chrome + corrected timeline guide
   ========================================================= */

/* Center the site title on every viewport size. */
#header {
    display: flex;
    align-items: center;
    justify-content: center;
}

#header .navi {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#header .navi .web-title {
    float: none;
    width: 100%;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Center the copyright / address line while preserving responsive wrapping. */
.footer {
    text-align: center;
}

/* Chronological direction: older on the left, newer on the right. */
#imp-timeline-shell .imp-guide-older {
    justify-content: flex-start;
    text-align: left;
}

#imp-timeline-shell .imp-guide-newer {
    justify-content: flex-end;
    text-align: right;
}

/* Desktop/tablet guide copy is the two-line explanatory version. */
#imp-timeline-shell .imp-guide-desktop-copy {
    display: flex;
}

#imp-timeline-shell .imp-guide-mobile-copy {
    display: none;
    min-width: 0;
    white-space: nowrap;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1;
    color: rgba(78, 49, 23, .88);
}

/* The old red guide diamond is no longer used next to “目前位置”. */
#imp-timeline-shell .imp-guide-current .imp-guide-diamond {
    display: none !important;
}

@media (max-width: 767px) {
    #imp-timeline-shell .imp-timeline-guide {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 5px;
        padding-left: 4px;
        padding-right: 4px;
    }

    #imp-timeline-shell .imp-guide-desktop-copy {
        display: none;
    }

    #imp-timeline-shell .imp-guide-mobile-copy {
        display: inline-block;
    }

    #imp-timeline-shell .imp-guide-current {
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 420px) {
    #imp-timeline-shell .imp-timeline-guide {
        gap: 3px;
        padding-left: 2px;
        padding-right: 2px;
    }

    #imp-timeline-shell .imp-guide-mobile-copy {
        font-size: .70rem;
    }
}
