*{
    box-sizing:border-box;
}

body{
    margin:0;
    color:#211a14;
    background:#f7f4ef;
    font-family:"Pretendard","Noto Sans KR",Arial,sans-serif;
}

button,
input{
    font:inherit;
}

button{
    cursor:pointer;
}

.site-header{
    background:#fff;
    border-bottom:1px solid #e5ded5;
}
.header-inner{
    width:min(1500px,calc(100% - 48px));
    min-height:92px;
    margin:0 auto;

    display:grid;
    grid-template-columns:300px 1fr 360px;
    align-items:center;
    gap:24px;
}

.logo{
    margin:0;
    font-size:30px;
    letter-spacing:-1.5px;
}

/* 연표 / 미디어 버튼 영역 */
.top-tabs{
    display:flex;
    justify-content:center;
    align-items:center;
    gap:12px;

    width:340px;
    margin:0 auto;
}

/* 공통 버튼 */
.home-button,
.top-tab{
    padding:12px 18px;
    border-radius:9px;
    text-align:center;
    text-decoration:none;
    font-weight:700;
}

/* 메인 버튼 */
.home-button{
    min-width:90px;
    color:#6a4b2c;
    background:#f7efe5;
    border:1px solid #e2d1bd;
}

/* 연표 / 미디어 버튼 */
.top-tab{
    width:160px;
    min-width:160px;
    flex:0 0 160px;

    color:#67584c;
    background:#fff;
    border:1px solid #d9d1c9;
}

/* 선택된 연표 / 미디어 버튼 */
.top-tab.active{
    color:#fff;
    background:#6f3e0c;
    border-color:#6f3e0c;
}

.search-box{
    position:relative;
}

.search-box input{
    width:100%;
    padding:13px 44px 13px 15px;
    border:1px solid #d7cfc7;
    border-radius:10px;
    background:#fff;
}

.search-icon{
    position:absolute;
    right:15px;
    top:50%;
    transform:translateY(-50%);
    color:#85684d;
    font-size:20px;
}

.tab-view{
    display:none;
}

.tab-view.active{
    display:block;
}

/* 기존 연표 화면 */
.page-layout{
    width:min(1450px,calc(100% - 48px));
    margin:34px auto 0;
    display:grid;
    grid-template-columns:420px minmax(0,1fr);
    gap:28px;
}

.timeline-panel,
.detail-panel{
    background:#fff;
    border:1px solid #e0d9d1;
    border-radius:14px;
}

.timeline-panel{
    padding:22px;
}

.panel-heading{
    margin:0 0 18px;
    font-size:25px;
}

.timeline-list{
    display:grid;
    gap:10px;
}

.timeline-item{
    position:relative;
    display:grid;
    grid-template-columns:18px 105px minmax(0,1fr) auto;
    align-items:center;
    gap:11px;
    width:100%;
    padding:14px;
    color:#33271e;
    background:#faf8f5;
    border:1px solid #e4ddd5;
    border-radius:10px;
    text-align:left;
}

.timeline-item.active{
    color:#fff;
    background:#163d2c;
    border-color:#163d2c;
}

.timeline-dot{
    width:10px;
    height:10px;
    border-radius:50%;
    background:#b27b3f;
}

.timeline-item.active .timeline-dot{
    background:#fff;
}

.timeline-year{
    font-weight:800;
}

.timeline-title{
    font-weight:700;
}

.country-badge{
    padding:5px 8px;
    border-radius:999px;
    background:rgba(255,255,255,.2);
    font-size:12px;
}

.detail-panel{
    min-height:680px;
    padding:30px;
}

.detail-hero{
    display:grid;
    grid-template-columns:minmax(0,1fr) 280px;
    gap:28px;
}

.detail-hero img{
    width:100%;
    height:250px;
    object-fit:cover;
    border-radius:12px;
    background:#ddd;
}

.detail-country{
    display:inline-block;
    margin-bottom:10px;
    padding:7px 11px;
    color:#fff;
    background:#6f3e0c;
    border-radius:999px;
    font-size:13px;
    font-weight:700;
}

.detail-panel h2,
.media-detail-panel h2{
    margin:0 0 10px;
    font-size:31px;
}

.detail-panel h3,
.media-detail-panel h3{
    margin:22px 0 10px;
}

.detail-panel p,
.media-detail-panel p{
    margin:0 0 10px;
    color:#6b5e53;
    line-height:1.75;
}

.people-list{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.person-chip{
    display:inline-block;
    padding:7px 11px;
    color:#5d3d20;
    background:#f4e8d9;
    border:1px solid #dec5aa;
    border-radius:999px;
    font-size:13px;
    font-weight:700;
}

/* 미디어 탭 */
.media-page-layout{
    width:min(1580px,calc(100% - 48px));
    margin:34px auto 0;
    display:grid;
    grid-template-columns:minmax(0,3fr) minmax(450px,1fr);
    gap:26px;
    align-items:start;
}

.media-timeline-panel{
    min-width:0;
}

.media-view-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    margin-bottom:20px;
}

.media-view-header span{
    display:block;
    margin-bottom:8px;
    color:#8d551c;
    font-size:13px;
    font-weight:800;
    letter-spacing:2px;
}

.media-view-header h2{
    margin:0;
    font-size:34px;
}

.media-view-header p{
    margin:10px 0 0;
    color:#70645a;
    line-height:1.7;
}

.country-filter{
    display:flex;
    gap:10px;
    margin-bottom:18px;
}

.country-filter-button{
    min-width:130px;
    padding:11px 18px;
    color:#5c5147;
    background:#fff;
    border:1px solid #d9d1c9;
    border-radius:9px;
    font-weight:700;
}

.country-filter-button.active[data-country="고구려"]{
    color:#fff;
    background:#2c7a50;
    border-color:#2c7a50;
}

.country-filter-button.active[data-country="백제"]{
    color:#fff;
    background:#7650a6;
    border-color:#7650a6;
}

.country-filter-button.active[data-country="신라"]{
    color:#fff;
    background:#b56c1e;
    border-color:#b56c1e;
}

.media-compare-table{
    overflow:hidden;
    background:#fff;
    border:1px solid #dcd4cc;
    border-radius:14px;
}

.media-table-header,
.media-table-row{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr)) 145px;
}

.media-table-header{
    position:sticky;
    top:0;
    z-index:3;
}

.media-table-header > *{
    min-height:62px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:14px;
    border:0;
    border-right:1px solid #d9d1c9;
    border-bottom:1px solid #cfc6bd;
    font-weight:800;
    text-align:center;
}

.media-table-header > *:last-child{
    border-right:0;
}

.country-heading{
    font:inherit;
}

.goguryeo-column{
    background:#edf7ed;
}

.baekje-column{
    background:#f2ecfa;
}

.silla-column{
    background:#fff2df;
}

.table-year{
    background:#f2f0ed;
}

.media-table-row{
    min-height:118px;
    border-bottom:1px solid #ddd6ce;
    transition:opacity .2s ease;
}

.media-table-row:last-child{
    border-bottom:0;
}

.media-event-cell{
    padding:11px;
    border-right:1px solid #ddd6ce;
}

.media-event-button{
    width:100%;
    height:100%;
    min-height:94px;
    padding:14px;
    color:#2b221b;
    background:rgba(255,255,255,.82);
    border:1px solid rgba(94,77,61,.18);
    border-radius:9px;
    text-align:left;
}

.media-event-button strong,
.media-event-button span{
    display:block;
}

.media-event-button strong{
    font-size:16px;
}

.media-event-button span{
    margin-top:7px;
    color:#74675d;
    font-size:13px;
    line-height:1.55;
}

.media-event-button.active{
    color:#fff;
    background:#246b43;
    border-color:#246b43;
}

.media-event-button.active span{
    color:#eef8f1;
}

.media-year-button{
    border:0;
    background:#f5f3f0;
    border-left:1px solid #ddd6ce;
    font-size:16px;
    font-weight:800;
}

.media-year-button.active{
    color:#fff;
    background:#6f3e0c;
}

.media-table-row.is-muted{
    opacity:.22;
}

.media-table-row.is-selected{
    box-shadow:inset 0 0 0 3px rgba(111,62,12,.25);
}

.media-detail-panel{
    position:sticky;
    top:20px;
    min-height:450px;
    padding:24px;
    background:#fff;
    border:1px solid #ddd5cd;
    border-radius:14px;
    margin-top:190px;
}

.media-detail-main-image{
    width:100%;
    height:230px;
    margin:15px 0 8px;
    object-fit:cover;
    border-radius:12px;
    background:#ddd;
}

.detail-media-list{
    display:grid;
    gap:12px;
}
.detail-media-card{
    display:grid;
    grid-template-columns:180px minmax(0,1fr);
    gap:18px;
    overflow:hidden;
    border:1px solid #dfd7cf;
    border-radius:10px;
    background:#faf9f7;
}

.detail-media-card img{
    width:180px;
    height:240px;
    min-height:240px;
    object-fit:contain;
    background:#ddd;
}

.detail-media-content{
    padding:12px 12px 12px 0;
}

.detail-media-content span{
    display:inline-block;
    margin-bottom:6px;
    padding:4px 7px;
    color:#fff;
    background:#8b5722;
    border-radius:999px;
    font-size:11px;
    font-weight:700;
}

.detail-media-content h4{
    margin:0 0 5px;
    font-size:17px;
}

.detail-media-content small{
    color:#8a7a6b;
}

.detail-media-content p{
    margin-top:8px;
    font-size:13px;
    line-height:1.55;
}

.footer-message{
    width:min(1500px,calc(100% - 48px));
    margin:22px auto 40px;
    color:#7b6c60;
    text-align:center;
}

.is-search-hidden{
    display:none !important;
}

@media(max-width:1150px){
    .header-inner{
        grid-template-columns:1fr;
        padding:18px 0;
    }

    .top-tabs{
        justify-content:flex-start;
    }

    .page-layout,
    .media-page-layout{
        grid-template-columns:1fr;
    }

    .media-detail-panel{
        position:static;
    }
}

@media(max-width:780px){
    .header-inner,
    .page-layout,
    .media-page-layout,
    .footer-message{
        width:min(100% - 24px,1500px);
    }

    .page-layout{
        margin-top:20px;
    }

    .detail-hero{
        grid-template-columns:1fr;
    }

    .country-filter{
        flex-wrap:wrap;
    }

    .media-compare-table{
        overflow-x:auto;
    }

    .media-table-header,
    .media-table-row{
        min-width:900px;
    }

    .timeline-item{
        grid-template-columns:18px 95px minmax(0,1fr);
    }

    .country-badge{
        display:none;
    }
}

.media-only-title{
    margin:0 0 20px;
    font-size:26px;
}

.empty-media{
    padding:30px 0;
    color:#7b6c60;
    text-align:center;
}
.page-title-with-favorite {
    display: flex;
    align-items: center;
    gap: 18px;
}

.favorite-button {
    padding: 8px 14px;
    border: 1px solid #b67a32;
    border-radius: 20px;
    background: #ffffff;
    color: #8b4b0c;
    font-weight: 700;
    cursor: pointer;
}
    /* 연표 목록 내부 스크롤 */
.timeline-list {
    max-height: 550px;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-right: 8px;

}

.timeline-title {
    word-break: keep-all;
    white-space: normal;
    line-height: 1.4;
}

.timeline-year {
    white-space: nowrap;
}

.country-badge {
    white-space: nowrap;
}
.media-table-body {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}
/* 시대 이동 메뉴 */
.era-navigation {
    width: min(1500px, calc(100% - 40px));
    margin: 18px auto 20px;

    display: flex;
    align-items: center;
    gap: 10px;
}

/* 메인 버튼 뒤만 조금 띄우기 */
.era-home-button {
    margin-right: 30px;
}

.era-nav-button {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 120px;
    height: 48px;
    padding: 0 18px;

    background: #ffffff;
    border: 1px solid #ddd5cd;
    border-radius: 8px;

    color: #33271e;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
}

.era-nav-button:hover {
    background: #f7f1e9;
}
