/* General Styles */
html {
    overflow-x: hidden; /* Prevent horizontal scrolling on html element */
}

body {
    font-family: sans-serif;
    margin: 0;
    background-color: #f8f9fa; /* Light beige/off-white background */
    color: #212529;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

a {
    color: #007bff;
    cursor: pointer;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a.wait {
    color: #ff4848;
    cursor: text;
    text-decoration: none;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

i {
    margin-right: 4px;
}

h1,
h2,
h3 {
    margin-top: 0;
}

.site-wrapper {
    background-color: #e9ecef;
}

/* Header Styles */
.site-header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #dee2e6;
    margin-left: auto; /* 화면 너비 초과 시 왼쪽 마진 자동 계산 */
    margin-right: auto; /* 화면 너비 초과 시 오른쪽 마진 자동 계산 */
}

@media (min-width: 1450px) {
    .site-header,
    .site-footer {
        width: 1450px; /* 최대 너비 설정 */
    }
}

.logo a {
    font-size: 1.5em;
    font-weight: bold;
    color: #343a40;
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    flex: 1; /* Takes up remaining space */
}

sup.lang {
    margin: 0 6px;
    color: #898989;
}

sub.lang {
    margin-left: 6px;
    color: #898989;
}

article ul {
    list-style: disc;
    padding: 0;
    margin: 0 0 10px 20px;
}

article li {
    list-style: disc;
    line-height: 30px;
}

.header-right input[type="search"] {
    padding: 5px 10px;
    margin-right: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    margin-left: 5px;
}

/* Main Container Layout */
.container {
    display: flex;
    flex: 1; /* Allows container to fill remaining vertical space */
    padding: 20px;
    max-width: 1450px; /* 최대 너비 설정 */
    margin-left: auto; /* 화면 너비 초과 시 왼쪽 마진 자동 계산 */
    margin-right: auto; /* 화면 너비 초과 시 오른쪽 마진 자동 계산 */
}

/* Left Sidebar Styles */
.left-sidebar {
    width: 200px; /* Fixed width for sidebar */
    padding-right: 20px;
    border-right: 1px solid #dee2e6;
    margin-right: 20px;
}

/* Style links within the sidebar */
.left-sidebar a {
    color: #555; /* Dark gray color for sidebar links */
}

/* Style for 'Other Language' links */
.left-sidebar .other-languages a {
    color: #999; /* Lighter gray for less emphasis */
}

/* Keep hover effect blue or change if needed */
/* .left-sidebar a:hover { */
/*    color: #0056b3; */
/* } */

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-section h2 {
    font-size: 1.1em;
    margin-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 5px;
}

.sidebar-section ul li {
    margin-bottom: 5px;
}

.sidebar-section ul ul {
    padding-left: 15px; /* Indent nested lists */
    margin-top: 5px;
}

.wiki-placeholder {
    display: block;
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 10px;
    text-align: right;
}

/* Main Content Area Styles */
.main-content {
    flex: 1; /* Takes up remaining space */
}

/* Elements directly within main-content, before the article/infobox split */
.meta-tags,
.main-content > h1,
.main-content > .intro,
.metadata-line,
.ad-box,
.disambiguation {
    width: 100%; /* Span full width of main content area */
    margin-bottom: 15px;
}

.meta-tags .tag {
    display: inline-block;
    background-color: #e2e3e5;
    color: #495057;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-right: 5px;
}

.main-content > h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.metadata-line {
    font-size: 0.9em;
    color: #6c757d;
    text-align: right;
}

.metadata-line span {
    margin-left: 15px;
}

.metadata-line i {
    margin-right: 5px; /* Space for icons if added */
}

.adsbygoogle {
    width: 728px;
    height: 90px;
}

@media (max-width: 768px) {
    .adsbygoogle {
        width: calc(100% + 40px);
        margin-left: -20px;
        margin-right: -20px;
    }
}

.ad-box {
    width: 728px;
    height: 90px;
    /* background-color: #cccccc;  */
    /* Gray placeholder color */
    /* border: 1px solid #bbbbbb;  */
    /* Slightly darker border */
    margin: 15px auto; /* Center the box horizontally if article width allows, add vertical margin */
    display: flex; /* Use flex to center text inside */
    justify-content: center;
    align-items: center;
    font-size: 0.9em;
    color: #555555;
    text-align: center;
}

.disambiguation {
    font-size: 0.9em;
    color: #6c757d;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 0;
}

/* Article and Infobox Layout Wrapper */
.article-infobox-wrapper {
    display: flex;
    align-items: flex-start; /* Align article and infobox to the top */
}

.article-infobox-wrapper figure.article-figure {
    width: 302px;
    border: 1px solid #d4d6ff;
    padding: 5px;
    background-color: #f4f4f4;
    margin: 5px;
}

.article-infobox-wrapper figure.article-figure figcaption {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 5px;
    padding: 0 5px;
}

.article-infobox-wrapper figure.article-figure.float-left {
    float: left;
    margin-right: 20px;
}

.article-infobox-wrapper figure.article-figure.float-right {
    float: right;
    margin-left: 20px;
}

.article-infobox-wrapper figure.article-figure.full-width {
    width: 92%;
    margin: 10px auto;
    float: none;
}

/* Article and Infobox Layout within Wrapper */
article {
    flex: 3; /* Article takes more space */
    padding-right: 20px; /* Space between article and infobox */
    max-width: 100%;
}

.infobox {
    flex: 0 0 300px; /* Set fixed width, disable grow/shrink */
    width: 300px; /* Explicit width */
    border: 1px solid #ccc;
    background-color: #f1f1f1;
    padding: 15px;
    font-size: 0.9em;
    align-self: flex-start; /* Keep align-self */
}

/* Infobox Sections and Subheaders */
.infobox-section {
    margin-bottom: 10px; /* Space between sections */
}

.infobox-subheader {
    background-color: #e2e3e5; /* Light gray background for subheaders */
    color: #495057;
    font-size: 0.9em;
    font-weight: bold;
    padding: 5px 10px;
    margin: 0 -15px 10px -15px; /* Extend to infobox padding edges, add bottom margin */
    text-align: center;
}

/* Adjustments for map/symbol figures */
.infobox-map,
.infobox-symbol {
    margin: 0 0 10px 0;
    text-align: center;
}

.infobox-map figcaption,
.infobox-symbol figcaption {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 3px;
}

.infobox-symbol-container {
    display: flex;
    justify-content: space-around; /* Space out flag and COA */
    align-items: flex-start;
}

.infobox-symbol img {
    width: auto;
    border: 1px solid #ccc;
}

.article-map {
    margin: 0 0 10px 0;
    border: 1px solid #cecece;
    background-color: #f5f5f5;
    padding: 5px;
    width: 300px;
}

.article-map figcaption {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 3px;
    text-align: center;
}

.article-map.float-left {
    float: left;
}

.article-map.float-right {
    float: right;
}

@media (max-width: 768px) {
    .article-map.float-left {
        float: none;
        margin: 0 auto;
    }

    .article-map.float-right {
        float: none;
        margin: 0 auto;
    }
}

article section {
    clear: both;
    margin-bottom: 20px;
}

article section p {
    line-height: 37px;
    /* TODO: 향후 이 부분을 지워야함 임시임!! 한글 글자 단위 줄 바꿈 추가 */
    word-break: break-all;
}

article section figure + p {
    clear: none; /* 기본값으로 clear 적용 */
}

article section figure + figure + p {
    clear: both; /* 연속된 figure 다음의 p에는 clear 해제 */
}

article h2,
article h3 {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

.infobox h2 {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.infobox figure {
    margin: 0 0 15px 0;
    text-align: center;
}

.infobox img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
}

.infobox figcaption {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 5px;
}

.infobox ul li {
    margin-bottom: 8px;
    display: flex;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 5px;
    /* Remove margin if sections handle spacing */
    /* margin: 0; */
}

.infobox ul li strong {
    width: 40%; /* Adjust as needed for label width */
    margin-right: 5px;
}

/* Footer Styles */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #e9ecef;
    border-top: 1px solid #dee2e6;
    margin-top: auto; /* Pushes footer to the bottom */
    font-size: 0.9em;
    margin-left: auto; /* 화면 너비 초과 시 왼쪽 마진 자동 계산 */
    margin-right: auto; /* 화면 너비 초과 시 오른쪽 마진 자동 계산 */
}

.footer-nav a {
    margin-left: 15px;
    color: #6c757d;
}

/* Responsive adjustments (basic example) */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .article-infobox-wrapper figure.article-figure.float-left {
        float: none;
        margin: 0 auto;
    }

    .article-infobox-wrapper figure.article-figure.float-right {
        float: none;
        margin: 0 auto;
    }

    .site-footer {
        /* Keep footer stacking/centering if desired */
        flex-direction: column;
        text-align: center;
    }

    .footer-nav {
        margin-top: 10px;
    }

    .footer-nav a {
        margin: 0 8px;
    }

    /* Adjust ad-box for smaller screens */
    .ad-box {
        /* width: 100%; */ /* Full width of parent */
        width: calc(100% + 40px); /* Full width + container padding */
        margin-left: -20px; /* Compensate for left container padding */
        margin-right: -20px; /* Compensate for right container padding */
        /* Optionally adjust height or add responsive ad styles here */
    }
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: none; /* Hidden by default */
    background: rgba(248, 249, 250, 0.8); /* Light background for visibility */
    border: 1px solid #dee2e6; /* Add border */
    border-radius: 4px; /* Rounded corners */
    font-size: 1.2em; /* Adjust size if needed */
    cursor: pointer;
    padding: 5px 8px; /* Adjust padding */
    /* margin-right: 10px; */ /* Removed margin, positioning handled by fixed */
    /* Added Fixed positioning styles */
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001; /* Above sidebar overlay and header content */
}

/* Responsive adjustments for sidebar toggle */
@media (max-width: 1400px) {
    .site-header {
        position: relative; /* Needed for absolute positioning of logo */
        justify-content: flex-start; /* Align toggle button to the left */
        /* Add padding to account for fixed toggle button */
        padding-left: 50px; /* Adjust as needed based on button size */
        min-height: 50px; /* Ensure minimum header height */
        /* Adjust top/bottom padding if needed to vertically center logo */
        padding-top: 10px;
        padding-bottom: 10px;
        /* 중요: 화면이 1400px 이하일 때도 max-width: 1450px와 margin: auto가 적용됩니다. */
        /* 만약 이 너비에서 전체 너비를 사용하고 싶다면 max-width와 margin을 재정의해야 합니다. */
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .logo {
        position: absolute; /* Position logo absolutely */
        left: 50%;
        transform: translateX(-50%); /* Center the logo */
        /* Ensure logo doesn't overlap button */
        max-width: calc(100% - 100px); /* Adjust 100px based on button size/margins */
    }

    .left-sidebar {
        position: fixed; /* Position fixed for overlay */
        left: -230px; /* Adjusted to match width with border-box */
        top: 0;
        height: 100%;
        width: 230px; /* Adjust width as needed */
        padding: 20px; /* Keep padding for internal content spacing */
        background-color: #f8f9fa; /* Match body background */
        border-right: 1px solid #dee2e6;
        transition: left 0.3s ease;
        z-index: 1000; /* Ensure sidebar is above other content, below button */
        overflow-y: auto; /* Allow scrolling within sidebar */
        margin-right: 0; /* Remove margin when fixed */
        box-sizing: border-box; /* Include padding and border in the element's total width */
    }

    .left-sidebar.open {
        left: 0; /* Slide in when open */
        /* Add padding-top to avoid overlap with fixed toggle button */
        padding-top: 50px; /* Adjust based on button height/position */
    }

    .sidebar-toggle {
        display: block; /* Show toggle button */
    }

    .container {
        /* Container padding might need adjustments if sidebar affects header height etc. */
        padding-left: 20px; /* Ensure there is still padding */
        padding-right: 20px;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    /* Adjust main content position when sidebar is open */
    .main-content {
        transition: margin-left 0.3s ease; /* Add transition for smooth shift */
        margin-left: 0; /* Default: no margin when sidebar is closed */
    }

    body.sidebar-open .main-content {
        margin-left: 230px; /* Shift main content by sidebar width (230px) */
    }

    /* Optional: Add an overlay to dim the main content when sidebar is open */
    body.sidebar-open::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999; /* Below sidebar, above content */
    }

    .site-footer {
        /* Keep footer stacking/centering if desired */
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }
}

/* Responsive adjustments for Infobox position */
@media (max-width: 1150px) {
    .article-infobox-wrapper {
        flex-direction: column;
    }

    article {
        order: 2;
        padding-right: 0;
    }

    .infobox {
        order: 1;
        flex-basis: auto;
        width: 300px;
        margin-left: auto;
        margin-right: auto;
        margin-top: 20px;
        margin-bottom: 20px;
    }
}

/* 테이블  */
table {
    border-collapse: collapse;
    border: 1px solid #eee;
    margin: 16px 0;
}

thead {
    display: table-header-group;
    vertical-align: middle;
    unicode-bidi: isolate;
    border-color: inherit;
}

tbody {
    display: table-row-group;
    vertical-align: middle;
    unicode-bidi: isolate;
    border-color: inherit;
}

th {
    border: 1px solid #e0e4e8;
    background-color: #f0f2f3;
    padding: 4px 16px;
    text-align: center;
    font-weight: 500;
    white-space: nowrap;
}

tr {
    display: table-row;
    vertical-align: inherit;
    unicode-bidi: isolate;
    border-color: inherit;
}

td {
    border: 1px solid #e0e4e8;
    background-color: #fafbfc;
    padding: 6px 16px;
    white-space: nowrap;
    font-weight: 400;
    word-break: keep-all;
}

.table {
    overflow-x: auto;
    clear: both;
}

@media (min-width: 1490px) {
    .main-content {
        width: 1209px;
    }

    article {
        width: 857px;
    }
}

@media (min-width: 1401px) and (max-width: 1490px) {
    .main-content {
        width: calc(100vw - 280px);
    }

    article {
        width: calc(100vw - 632px);
    }
}

@media (max-width: 1400px) {
    .main-content {
        width: calc(100vw - 40px);
    }

    article {
        width: calc(100vw - 479px);
    }
}

@media (max-width: 1150px) {
    article {
        width: 100%;
    }
}

.ad-box,
.adsbygoogle {
    min-height: 90px;
}
.infobox-map img {
    aspect-ratio: 1 / 1;
}
