/* ----------「 THEME 」---------- */

:root {
    --bs-info: #17a2b8;
    --bs-info-rgb: 23, 162, 184;
    --bs-primary: #17a2b8;
    --bs-primary-rgb: 23, 162, 184;
    --color-accent: #17a2b8;
    --color-link: #117a8b;
    --color-muted: #6c757d;
    --color-card-border: #ababab;
    --color-background: #f8f9fa;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: #212529;
    background-color: var(--color-background);
    font-family: var(--bs-font-sans-serif);
    font-size: 17px;
}

main {
    flex: 1;
}

.page-container {
    max-width: 1140px;
}

/* ----------「 NAVIGATION 」---------- */

.site-nav {
    min-height: 80px;
    padding: 0.9rem 0;
    background-color: var(--color-accent);
    font-weight: 700;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
}

.brand:hover,
.brand:focus {
    color: #fff;
}

.brand img {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 10px;
}

.site-nav .nav-link {
    padding: 0.5rem 0;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.site-nav .nav-link:hover,
.site-nav .nav-link:focus {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 5px;
}

.site-nav .nav-link.active {
    color: #555;
}

/* ----------「 HOME AND SEARCH 」---------- */

.home-banner {
    padding: 3rem 0 2rem;
}

.home-title-group {
    display: inline-block;
    margin-bottom: 1rem;
}

.home-title {
    margin: 0 0 0.15rem;
    color: var(--color-accent);
    font-size: 3.5rem;
    font-weight: 400;
    letter-spacing: 0.04em;
}

.home-version {
    margin: 0;
    color: var(--color-muted);
    font-size: 1rem;
    text-align: right;
}

.home-subtitle {
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.home-description {
    margin-bottom: 1.75rem;
    color: var(--color-muted);
    font-size: 1rem;
}

.home-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.home-content {
    padding: 0.5rem 0 2.5rem;
}

.home-card-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.home-content a {
    color: var(--color-link);
    text-underline-offset: 3px;
}

.home-features {
    margin-top: 1.5rem;
    text-align: center;
}

.home-feature-title {
    color: var(--color-link);
    font-weight: 600;
}

.home-feature-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 2rem;
}

.home-feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
    font-size: 0.9rem;
}

.home-feature-item svg {
    color: var(--color-link);
}

.home-highlights .carousel-item img {
    height: 270px;
    object-fit: contain;
    background: #fff;
}

.home-highlights figcaption {
    min-height: 7.5rem;
    padding: 0.75rem 2.25rem 2rem;
    text-align: center;
}

.home-highlights figcaption a {
    font-weight: 600;
}

.home-highlights figcaption span {
    display: block;
    margin-top: 0.35rem;
    color: var(--color-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.home-highlights .carousel-indicators {
    margin-bottom: 0.25rem;
}

.home-highlights .carousel-indicators button {
    background-color: var(--color-link);
}

.home-highlights .carousel-control-prev,
.home-highlights .carousel-control-next {
    top: 110px;
    bottom: auto;
    width: 2rem;
    height: 2.5rem;
    border-radius: 4px;
    background: var(--color-link);
    opacity: 0.9;
}

.home-figure-note {
    margin: 0.5rem 0 0;
    color: var(--color-muted);
    font-size: 0.8rem;
    text-align: center;
}

.home-info {
    margin-top: 1.5rem;
    padding: 1rem;
    line-height: 1.6;
}

.analyses-title {
    font-size: 2.5rem;
}

.home-search {
    max-width: 720px;
    margin: 0 auto;
    text-align: left;
}

.search-label {
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 1rem;
}

.search-box {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.search-box .form-control {
    min-width: 0;
    font-size: 1rem;
}

.search-box .btn {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-info-rgb), 0.2);
}

.home-search-hint {
    margin: 0.5rem 0 0;
    color: var(--color-muted);
    font-size: 0.95rem;
    text-align: center;
}

.recommendation-example {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-link);
    font: inherit;
    text-align: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    cursor: pointer;
}

.recommendation-example:hover {
    color: var(--color-accent);
}

.btn-primary {
    --bs-btn-bg: #17a2b8;
    --bs-btn-border-color: #17a2b8;
    --bs-btn-hover-bg: #138496;
    --bs-btn-hover-border-color: #117a8b;
    --bs-btn-active-bg: #117a8b;
    --bs-btn-active-border-color: #10707f;
    --bs-btn-focus-shadow-rgb: 23, 162, 184;
}

.data-source-heading {
    position: relative;
}

.data-source-help {
    display: inline-flex;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.data-source-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: transparent;
    color: var(--color-link);
    font-family: Georgia, serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: help;
}

.data-source-info:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 3px;
}

.data-source-tooltip {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    width: min(32rem, calc(100vw - 4rem));
    padding: 1rem;
    border: 1px solid var(--color-card-border);
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
    color: #212529;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.6;
    visibility: hidden;
}

.data-source-tooltip > span {
    display: block;
}

.data-source-tooltip > span + span {
    margin-top: 0.75rem;
}

.data-source-help:hover .data-source-tooltip,
.data-source-help:focus-within .data-source-tooltip {
    visibility: visible;
}

/* ----------「 TOOL RECOMMENDATIONS 」---------- */

.recommendation-status {
    margin: 0.75rem 0 0;
    color: var(--color-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.recommendation-status:empty {
    display: none;
}

.recommendation-results {
    max-width: 720px;
    margin: 1.5rem auto 0;
    text-align: left;
}

.recommendation-results h2 {
    margin-bottom: 1rem;
    color: var(--color-link);
    font-size: 1.3rem;
}

.recommendation-list {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.recommendation-card {
    padding: 1rem;
}

.recommendation-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.recommendation-card a,
.tool-back {
    color: var(--color-link);
    text-underline-offset: 3px;
}

.recommendation-card p {
    margin: 0;
    color: #495057;
    font-size: 1rem;
    line-height: 1.6;
}

.tool-section {
    padding: 2.5rem 0;
}

.tool-detail {
    max-width: 800px;
    margin: 1.5rem auto 0;
}

.tool-detail h1 {
    font-size: 1.75rem;
}

.tool-detail h2 {
    margin-top: 2rem;
    font-size: 1.2rem;
}

/* ----------「 ANALYSIS WORKSPACE 」---------- */

.tool-detail.tool-workspace {
    max-width: none;
    border: 0;
    background: transparent;
}

.tool-workspace > .card-section-header {
    border-radius: 10px;
}

.tool-workspace > .card-section-body {
    padding: 1.5rem 0 0;
}

#analysis-workspace {
    font-size: 1rem;
    line-height: 1.6;
}

#analysis-workspace :where(:not(h1, h2, h3, h4, h5, h6)) {
    font-weight: 400;
}

.workspace-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    align-items: start;
    gap: 1.75rem;
}

.workspace-sidebar {
    position: sticky;
    top: 104px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.workspace-navigation {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
}

.workspace-navigation > summary {
    padding: 0.85rem 1rem;
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
}

.workspace-steps {
    margin: 0;
    padding: 0 0.5rem 0.75rem;
    list-style: none;
}

.workspace-steps ul {
    margin: 0 0 0.5rem 0.8rem;
    padding: 0 0 0 0.5rem;
    border-left: 1px solid #dee2e6;
    list-style: none;
}

.workspace-navigation a {
    display: block;
    padding: 0.55rem 0.65rem;
    border-radius: 5px;
    color: #495057;
    font-size: 0.9rem;
    text-decoration: none;
}

.workspace-navigation ul a {
    font-size: 0.85rem;
}

.workspace-navigation a[href]:hover,
.workspace-navigation a[aria-current="location"] {
    background: #e7f4f6;
    color: #0c6472;
}

.workspace-navigation a[aria-current="location"] {
    box-shadow: inset 3px 0 0 var(--color-link);
}

.workspace-navigation a[aria-disabled="true"] {
    color: #6c757d;
}

.nav-state {
    display: block;
    color: #6c757d;
    font-size: 0.75rem;
}

.workspace-content {
    min-width: 0;
}

.workspace-panel {
    min-width: 0;
    margin-bottom: 1.75rem;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #fff;
}

.workspace-panel,
.result-section,
#results-heading {
    scroll-margin-top: 10px;
}

.workspace-panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #dee2e6;
    border-radius: 10px 10px 0 0;
    background: #f4f8f9;
}

.workspace-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #dceef1;
    color: #0c6472;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

#analysis-workspace h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
}

#analysis-workspace h3 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
}

#analysis-workspace h4 {
    margin: 0 0 0.65rem;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.5;
}

.workspace-panel-body {
    min-width: 0;
    padding: 1.25rem;
}

.workspace-empty {
    margin: 0;
    padding: 1rem;
    border: 1px dashed #cbd3da;
    border-radius: 6px;
    color: #59636d;
    background: #fafbfc;
}

.workspace-status {
    padding: 0 0.25rem;
    overflow-wrap: anywhere;
}

.workspace-status:has(#analysis-status:empty) {
    display: none;
}

.workspace-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e9ecef;
}

#dataset-preview {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e9ecef;
}

#example-guide {
    padding: 0.85rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fafbfc;
}

#example-guide summary,
.result-detail summary {
    color: var(--color-link);
    cursor: pointer;
}

.result-section + .result-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

.result-method-name {
    color: #495057;
}

.result-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 0;
}

.result-facts > div {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: #f4f7f8;
    overflow-wrap: anywhere;
}

.result-facts dt {
    color: #59636d;
    font-size: 0.875rem;
}

.result-facts dd {
    margin: 0.25rem 0 0;
    color: #212529;
    font-size: 1.0625rem;
    font-variant-numeric: tabular-nums;
}

.result-section.result-warnings {
    padding: 1rem 1.25rem;
    border: 1px solid #e8ce80;
    border-radius: 6px;
    background: #fff8e5;
    color: #694f10;
}

.result-warnings ul,
.result-interpretation ul {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.result-warnings li + li,
.result-interpretation li + li {
    margin-top: 0.6rem;
}

.result-interpretation {
    color: #495057;
    overflow-wrap: anywhere;
}

.result-table-block + .result-table-block {
    margin-top: 1.5rem;
}

#analysis-workspace .result-table {
    margin-bottom: 0;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

#analysis-workspace .result-table th,
#analysis-workspace .result-table td {
    padding: 0.65rem 0.75rem;
    border-color: #e9ecef;
    vertical-align: top;
    overflow-wrap: anywhere;
}

#analysis-workspace .result-table th {
    background: #f1f5f7;
    color: #495057;
}

#analysis-workspace .result-table .numeric-cell {
    text-align: right;
    white-space: nowrap;
}

.result-detail {
    padding: 0.85rem 1rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.result-figure {
    margin: 1.5rem 0;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.result-figure img {
    display: block;
    margin: 0 auto;
}

.result-caption,
.result-figure figcaption {
    display: block;
    margin-top: 0.3rem;
    color: #59636d;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.result-files {
    margin: 0;
    padding: 0;
    border-top: 1px solid #dee2e6;
    list-style: none;
}

.result-files > li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid #e9ecef;
}

.result-file-label {
    display: block;
    overflow-wrap: anywhere;
}

.result-file-format {
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: #f1f5f7;
    color: #59636d;
    font-size: 0.75rem;
}

@media (max-width: 991.98px) {
    .workspace-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .workspace-sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 575.98px) {
    .workspace-panel-header,
    .workspace-panel-body {
        padding: 1rem;
    }

    #analysis-workspace h2 {
        font-size: 1.3rem;
    }

    .result-files > li {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.5rem;
    }

    .result-files > li > div {
        grid-column: 1 / -1;
    }

    .result-file-format {
        justify-self: start;
    }

    .result-facts {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ----------「 HELP 」---------- */

.help-guide {
    max-width: 960px;
    margin: 0 auto;
    line-height: 1.7;
}

.help-contents {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 1.75rem;
    padding: 1rem 0;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9rem;
}

.help-contents a {
    color: var(--color-link);
    text-underline-offset: 3px;
}

.help-step {
    margin-top: 2rem;
    scroll-margin-top: 6rem;
}

.help-step h2 {
    margin-bottom: 0.75rem;
    color: var(--color-accent);
    font-size: 1.25rem;
}

.help-csv {
    padding: 1rem;
    border-radius: 6px;
    background: var(--color-background);
}

.help-parameters th,
.help-parameters td {
    min-width: 10rem;
    padding: 0.65rem;
    vertical-align: top;
}

.help-question {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-card-border);
    border-radius: 6px;
}

.help-question summary {
    color: var(--color-link);
    font-weight: 600;
    cursor: pointer;
}

.help-question p {
    margin: 0.75rem 0 0;
}

/* ----------「 CONTENT CARDS 」---------- */

.card-section {
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    background: #fff;
}

.card-section-header {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: 9px 9px 0 0;
    background-color: var(--color-accent);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.5;
}

.card-section-body {
    padding: 1rem;
}

.introduction p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.availability-note {
    display: flex;
    align-items: baseline;
    gap: 8px;
    color: var(--color-muted);
    font-size: 0.95rem;
}

.status-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-accent);
}

/* ----------「 ANALYSIS CATALOG 」---------- */

.analyses-section {
    padding: 2.5rem 0;
}

.section-heading {
    margin-bottom: 3rem;
    text-align: center;
}

.section-heading p {
    margin: 0;
    color: var(--color-muted);
    font-size: 1rem;
    line-height: 1.6;
}

.category-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
}

.analysis-card .category-heading {
    min-height: 78px;
    padding: 1rem 1rem 0.5rem;
    background: transparent;
    color: #212529;
}

.category-heading h2 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    overflow-wrap: anywhere;
}

.analysis-card .category-heading h2 {
    flex: 1 1 0;
    min-width: 0;
    font-size: 1.05rem;
    line-height: 1.4;
}

.tool-badge {
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 400;
}

.analysis-card .tool-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: #eaf6f8;
    color: var(--color-link);
    white-space: nowrap;
}

.analysis-card .card-section-body {
    padding-top: 0.25rem;
}

.category-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 96px;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #f2fafb, #f8fafb);
}

.category-illustration svg {
    display: block;
    width: 100%;
    height: 100%;
}

.module-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 0;
    border: 0;
    border-top: 1px solid #dee2e6;
    background: transparent;
    color: #495057;
    font-size: 1rem;
    line-height: 1.5;
    text-align: left;
}

.module-button:hover {
    background-color: var(--color-background);
    color: var(--color-link);
}

.module-arrow {
    flex-shrink: 0;
    color: var(--color-link);
}

.module-button:disabled {
    opacity: 0.6;
}

/* ----------「 FOOTER 」---------- */

.site-footer {
    padding: 0.8rem 0;
    background-color: var(--color-accent);
    color: #fff;
    text-align: center;
}

/* ----------「 MODAL AND ACCESSIBILITY 」---------- */

.modal-content {
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
}

.modal-header {
    border-radius: 9px 9px 0 0;
    background-color: var(--color-accent);
    color: #fff;
}

.modal-header .btn-close {
    --bs-btn-close-white-filter: invert(1) grayscale(100%) brightness(200%);
    filter: var(--bs-btn-close-white-filter);
}

.eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.modal-body h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.selected-module {
    color: var(--color-link);
    font-weight: 700;
}

.modal-body p:last-child {
    color: var(--color-muted);
    line-height: 1.7;
}

.skip-link {
    position: fixed;
    top: -80px;
    left: 12px;
    z-index: 1100;
    padding: 10px;
    background: #fff;
    color: #212529;
}

.skip-link:focus {
    top: 10px;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 3px;
}

.site-nav a:focus-visible,
.site-nav button:focus-visible {
    outline-color: #fff;
}

[hidden] {
    display: none !important;
}

/* ----------「 RESPONSIVE LAYOUT 」---------- */

@media (max-width: 991.98px) {
    .site-nav .navbar-collapse {
        padding-top: 1rem;
    }
}

@media (max-width: 575.98px) {
    .page-container {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .home-banner {
        padding: 2rem 0 1.5rem;
    }

    .home-title {
        font-size: 2.75rem;
    }

    .home-subtitle {
        font-size: 1.2rem;
    }

    .analyses-title {
        font-size: 2rem;
    }

    .home-highlights .carousel-item img {
        height: 210px;
    }

    .home-highlights .carousel-control-prev,
    .home-highlights .carousel-control-next {
        top: 80px;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box .btn {
        justify-content: center;
    }

}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
