/* Shared title and navigation, based on the population dashboard. */
body.apt-tool-page {
    margin: 0;
    padding: 20px;
}

body.apt-tool-page > .container,
body.apt-tool-page > main {
    padding-top: 0;
}

.apt-site-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 0;
    padding: 0;
    text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.5;
}

.apt-site-nav .apt-home-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #294b61;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s ease;
}

.apt-site-nav .apt-home-link:hover {
    background: transparent;
    color: #173d55;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.apt-site-nav .apt-home-link:focus-visible {
    outline: 3px solid #51aaa1;
    outline-offset: 3px;
}

.apt-site-nav .apt-home-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

body h1 {
    text-align: center;
}

/* Equal side columns keep titles centered while the home link stays left. */
body .apt-title-bar {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(0, auto) minmax(150px, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 1400px;
    min-height: 60px;
    margin: 0 auto 10px;
    padding: 0;
    box-sizing: border-box;
}

body .apt-title-bar .apt-site-nav {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
}

body .apt-title-bar h1 {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    min-width: 0;
    padding: 0;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 40px;
    font-weight: 700;
    font-style: normal;
    line-height: 1.5;
    letter-spacing: normal;
    color: #5a6c7d;
    background: none;
    -webkit-text-fill-color: currentColor;
    text-shadow: none;
    text-transform: none;
}

/* Keep the subway title centered independently of the dataset badge. */
body .page-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

body .page-header > div:first-child {
    width: 100%;
}

body .page-header p {
    max-width: none;
}

body .page-header .dataset-tag {
    margin: 8px 0 0;
}

@media (max-width: 760px) {
    body .apt-title-bar {
        grid-template-columns: 100px minmax(0, 1fr) 100px;
        gap: 6px;
    }
    body .apt-title-bar h1 {
        font-size: clamp(15px, 3vw, 23px);
        line-height: 1.4;
        overflow-wrap: anywhere;
    }
    .apt-site-nav .apt-home-link {
        font-size: 10px;
        gap: 4px;
    }
    .apt-site-nav .apt-home-icon {
        width: 14px;
        height: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .apt-site-nav .apt-home-link { transition: none; }
}

@media print {
    .apt-site-nav { display: none; }
    body .apt-title-bar { display: block; }
}
