/* ═══════════════════════════════════════════════════════════════════════
   TLA Archives — หน้าเรื่องเล่าบนแผนที่ (/archives/storymap)

   หน้านี้เต็มจอ ไม่มีการเลื่อนหน้า — แถบบางบนสุด แล้วที่เหลือเป็นของ
   StoryMapJS ทั้งหมด (แผนที่ครึ่งบน เนื้อหาครึ่งล่าง เลื่อนทีละสไลด์)

   โหลดต่อจาก storymap.css ของ Knight Lab และ shell.css ของหน้าคลัง
   (ตัวแปรสีทั้งชุดมาจาก shell.css) ไฟล์นี้จึงมีแค่เปลือกของหน้า
   กับการเปลี่ยนสีของ StoryMapJS ให้เข้าชุดกระดาษสา
   ═══════════════════════════════════════════════════════════════════════ */

/* ── โครงหน้า — สูงเต็มจอพอดี ไม่มีแถบเลื่อนของหน้า ──────────── */
html, body.tla-sm-body {
    height: 100%;
    overflow: hidden;
}

body.tla-sm-body {
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--arc-ff);
}

/* ── แถบบนสุด ─────────────────────────────────────────────────── */
.tla-sm-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .55rem 1.1rem;
    background: rgba(251, 247, 239, .95);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 10px rgba(94, 68, 34, .07);
    z-index: 500;
}

.tla-sm-back {
    flex: none;
    padding: .35rem .9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: .88rem;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
}

.tla-sm-back:hover { border-color: var(--gold); color: var(--rust); }

.tla-sm-bar-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: 0 auto;
    font-size: .98rem;
}

.tla-sm-bar-title img { height: 30px; width: auto; display: block; }

.tla-sm-bar-count {
    flex: none;
    font-size: .82rem;
    color: var(--ink-mute);
    white-space: nowrap;
}

/* จอแคบ — เหลือแค่ปุ่มกลับกับชื่อ ตัวเลขไม่สำคัญพอจะเบียดที่ */
@media (max-width: 575.98px) {
    .tla-sm-bar-count { display: none; }
    .tla-sm-bar-title img { display: none; }
    .tla-sm-bar-title { font-size: .9rem; }
}

/* ── พื้นที่ของแผนที่ — กินที่ที่เหลือทั้งหมด ─────────────────── */
.tla-sm-stage {
    position: relative;
    flex: 1;
    min-height: 0;
}

/**
 * ⚠️ ต้องเป็น 100% ทั้งสองแกน ห้ามใช้ height:auto
 *    StoryMapJS วัดขนาดกล่องนี้ตอนสร้างแล้วคำนวณสัดส่วนแผนที่/เนื้อหาจากค่านั้น
 *    ถ้าตอนวัดสูง 0 แผนที่กับสไลด์จะซ้อนทับกันจนกดอะไรไม่ได้เลย
 */
.tla-sm-map {
    width: 100%;
    height: 100%;
}

/* ── ข้อความสถานะ — ลอยทับ ไม่ได้แทนที่กล่องแผนที่ ───────────── */
.tla-sm-state {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--paper);
    color: var(--ink-soft);
    text-align: center;
    z-index: 400;
}

.tla-sm-state.is-on { display: flex; }

.tla-sm-state span { max-width: 46ch; line-height: 1.8; }

.tla-sm-spin {
    width: 30px;
    height: 30px;
    border: 3px solid var(--gold-soft);
    border-top-color: var(--rust);
    border-radius: 50%;
    animation: tla-sm-turn .9s linear infinite;
}

@keyframes tla-sm-turn { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .tla-sm-spin { animation-duration: 3s; }
}

/* ── ปรับ StoryMapJS ให้เข้าชุดกระดาษสา ──────────────────────── */
.tla-sm-body .vco-storymap,
.tla-sm-body .vco-slide .vco-headline,
.tla-sm-body .vco-slide .vco-text-content {
    font-family: var(--arc-ff);
    color: var(--ink);
}

.tla-sm-body .vco-storyslider .vco-slider-container-mask,
.tla-sm-body .vco-slide { background: var(--paper); }

.tla-sm-body .vco-slide .vco-headline {
    font-weight: 600;
    line-height: 1.4;
}

/* วันที่/สถานที่เหนือหัวข้อ (สไลด์เปิดเรื่องไม่มี จึงว่างไว้) */
.tla-sm-body .vco-slide .vco-headline-date {
    font-family: var(--arc-ff-display);
    color: var(--rust);
}

/* บรรทัดกำกับใต้หัวข้อ (ประเภท · ปี · สถานที่) ประกอบจากฝั่งเซิร์ฟเวอร์ */
.tla-sm-body .tla-sm-meta {
    margin-bottom: .8rem;
    font-size: .84rem;
    letter-spacing: .01em;
    color: var(--rust);
}

.tla-sm-body .tla-sm-link {
    margin-top: 1.1rem;
    padding-top: .9rem;
    border-top: 1px dashed var(--line);
}

.tla-sm-body .tla-sm-link a { color: var(--rust); font-weight: 500; }
.tla-sm-body .tla-sm-link a:hover { color: var(--rust-deep); }

.tla-sm-body .vco-media .vco-caption,
.tla-sm-body .vco-media .vco-credit { color: var(--ink-mute); }

/* ปุ่มเลื่อนสไลด์ซ้าย/ขวา */
.tla-sm-body .vco-slidenav-previous .vco-slidenav-icon,
.tla-sm-body .vco-slidenav-next .vco-slidenav-icon { color: var(--rust); }

.tla-sm-body .vco-slidenav-previous .vco-slidenav-title,
.tla-sm-body .vco-slidenav-next .vco-slidenav-title,
.tla-sm-body .vco-slidenav-previous .vco-slidenav-description,
.tla-sm-body .vco-slidenav-next .vco-slidenav-description {
    color: var(--ink-soft);

    /* storymap.css ตั้ง line-clamp ไว้เหมือน timeline.css แต่ลืมใส่
       display:-webkit-box กับ overflow:hidden ที่ line-clamp ต้องมีถึงจะทำงาน
       ชื่อเอกสารภาษาไทยยาว ๆ เลยไหลเป็นแถบผอมสูงเต็มขอบจอ */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* แถบเมนูของ StoryMapJS (ปุ่มภาพรวม / กลับจุดเริ่มต้น) */
.tla-sm-body .vco-menubar {
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
}

.tla-sm-body .vco-menubar .vco-menubar-button { color: var(--ink-soft); }
.tla-sm-body .vco-menubar .vco-menubar-button:hover { color: var(--rust); }

/* กล่องข้อความชั่วคราว เช่น "ปัดเพื่อเลื่อนเรื่อง" ตอนเปิดครั้งแรกบนมือถือ */
.tla-sm-body .vco-message .vco-message-content { color: var(--ink-soft); }

.tla-sm-body .vco-message .vco-button {
    background: var(--rust);
    border-color: var(--rust);
    color: #fff;
}

/* เครดิต Knight Lab มุมล่าง — เก็บไว้ตามสัญญาอนุญาต แค่ลดความเด่นลง */
.tla-sm-body .vco-knightlab-brand { opacity: .75; }
.tla-sm-body .vco-knightlab-brand:hover { opacity: 1; }
