/* ==========================================================================
   scSAID Design System - Editorial Scientific Aesthetic
   A warm, sophisticated design inspired by dermatological research
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
:root {
    /* Typography - Nunito (HumanBase) */
    --font-display: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Color Palette - HumanBase (clean scientific blue on white) */
    --color-primary: #337ab7;
    --color-primary-light: #4a90c7;
    --color-secondary: #337ab7;
    --color-secondary-dark: #23527c;
    --color-accent: #24a4d3;
    --color-accent-light: #b3d4fc;

    /* Status / Semantic colors (single home for previously-hardcoded states) */
    --color-danger: #c0392b;
    --color-danger-dark: #a93226;
    --color-success: #2e7d52;
    --color-info: #337ab7;
    --color-warning-bg: #fff3cd;
    --color-warning-border: #ffc107;
    --color-warning-text: #856404;

    /* Backgrounds */
    --bg-body: #ffffff;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-muted: #f5f5f5;
    --bg-dark: #333333;

    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #555555;
    --text-muted: #777777;
    --text-inverse: #ffffff;
    --text-link: #337ab7;

    /* Borders */
    --border-light: #dddddd;
    --border-medium: #cccccc;
    --border-dark: #adadad;

    /* Shadows - flattened neutral grey */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.12);

    /* Bootstrap-3 form + button fidelity (HumanBase) */
    --input-border: #ccc;
    --input-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    --focus-border: #66afe9;
    --focus-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
    --btn-primary-border: #2e6da4;
    --btn-primary-hover: #286090;
    --btn-primary-hover-border: #204d74;
    --btn-default-hover: #e6e6e6;
    --btn-default-hover-border: #adadad;
    --dropdown-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);

    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Border Radius - square-ish (HumanBase / Bootstrap) */
    --radius-sm: 4px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
    --radius-full: 9999px;
    --radius-control: 4px; /* compact analysis-tool controls (mirrors details.css) */

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --anim-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);

    /* Layout */
    --header-height: 50px;
    --sidebar-width: 240px;
    --container-max: 1400px;
    --z-tooltip: 1200;
}

/* --------------------------------------------------------------------------
   CSS Reset & Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.428;
    color: var(--text-primary);
    background-color: var(--bg-body);
    min-width: 0;
    overflow-wrap: break-word;
}

/* Preserve the site-wide typography hierarchy at its new regular baseline. */
strong, b, th, h1, h2, h3, h4, h5, h6, optgroup {
    font-weight: 400;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
}

main,
section,
article,
aside,
header,
footer,
div {
    min-width: 0;
}

/* The hidden attribute must always win, even over component display rules
   (e.g. .progress-box/.status-error set display:flex). Without this, elements
   toggled via the `hidden` attribute stay visible as empty bars. */
[hidden] {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Shared two-option segmented toggles
   Used by species selectors, CellPhoneDB mode/annotation selectors, and
   two-option home composition switches. Every option is an exact 50% half.
   -------------------------------------------------------------------------- */
.species-toggle,
.cpdb-mode-toggle,
.composition__toggle {
    --segmented-pad: 3px;
    --segmented-height: 38px;
    --segmented-max-width: 22rem;
    --segmented-indicator-scale-x: 0.9;
    --segmented-indicator-scale-y: 0.72;

    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, var(--segmented-max-width));
    min-width: 0;
    padding: var(--segmented-pad);
    gap: 0;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--input-shadow);
}

.species-toggle::before,
.cpdb-mode-toggle::before,
.composition__toggle::before {
    content: "";
    position: absolute;
    top: var(--segmented-pad);
    bottom: var(--segmented-pad);
    left: var(--segmented-pad);
    z-index: 0;
    width: calc((100% - (var(--segmented-pad) * 2)) / 2);
    background: color-mix(in srgb, var(--color-secondary) 12%, var(--bg-surface));
    border: 0;
    border-radius: calc(var(--radius-sm) - 1px);
    box-shadow: none;
    transform: translateX(0) scale(var(--segmented-indicator-scale-x), var(--segmented-indicator-scale-y));
    transition: transform var(--transition-base), background-color var(--transition-base);
}

.species-toggle:has(label:nth-of-type(2) input:checked)::before,
.cpdb-mode-toggle:has(label:nth-of-type(2) input:checked)::before,
.composition__toggle:has(.composition__toggle-btn:nth-child(2).composition__toggle-btn--active)::before {
    transform: translateX(100%) scale(var(--segmented-indicator-scale-x), var(--segmented-indicator-scale-y));
}

.species-toggle label,
.cpdb-mode-toggle .cpdb-radio {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    width: 100%;
}

.species-toggle input[type="radio"],
.cpdb-mode-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.species-toggle__option,
.cpdb-radio span,
.composition__toggle-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: calc(var(--segmented-height) - (var(--segmented-pad) * 2));
    padding: 0.35rem 0.65rem;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-radius: calc(var(--radius-sm) - 1px);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
    text-align: center;
    white-space: normal;
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-base);
}

.species-toggle__option:hover,
.cpdb-radio:hover span,
.composition__toggle-btn:hover {
    color: var(--text-primary);
}

.species-toggle input[type="radio"]:focus-visible + .species-toggle__option,
.cpdb-radio input[type="radio"]:focus-visible + span,
.composition__toggle-btn:focus-visible {
    outline: 2px solid var(--focus-border);
    outline-offset: -2px;
}

.species-toggle input[type="radio"]:checked + .species-toggle__option,
.cpdb-radio:has(input:checked) span,
.cpdb-radio.is-checked span,
.composition__toggle-btn--active {
    color: var(--color-secondary-dark);
}

@media (prefers-reduced-motion: reduce) {
    .species-toggle::before,
    .cpdb-mode-toggle::before,
    .composition__toggle::before,
    .species-toggle__option,
    .cpdb-radio span,
    .composition__toggle-btn {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Context help
   Expert-facing analysis pages expose method notes through a quiet, keyboard-
   accessible title link. The popover is portalled to <body> by
   JS/analysis-help.js so panel overflow cannot clip it.
   -------------------------------------------------------------------------- */
.title-with-help,
.label-with-help {
    display: inline-block;
    max-width: 100%;
    min-width: 0;
    color: var(--text-primary);
}

.analysis-help {
    appearance: none;
    position: static;
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-start;
    width: auto;
    height: auto;
    gap: 0.42em;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: inherit;
    line-height: inherit;
    text-align: left;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.analysis-help::after {
    content: "\2192";
    display: inline-block;
    font-size: 0.9rem;
    line-height: 1;
    transform: translateX(0);
    transition: transform 150ms var(--ease-out-quint);
}

.analysis-help:hover::after,
.analysis-help[aria-expanded="true"]::after {
    transform: translateX(3px);
}

.analysis-help:focus-visible {
    outline: 2px solid var(--focus-border);
    outline-offset: 3px;
}

/* Standalone method links (for example, GMT format) use the same vocabulary
   without stretching across a parent title. */
.analysis-help--inline {
    margin-left: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.2;
    vertical-align: baseline;
}

.analysis-help--inline::after {
    font-size: 0.82rem;
}

.feature-status {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    padding: 0.08rem 0.4rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.62rem;
    font-weight: 400;
    line-height: 1.35;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: 0.2em;
    white-space: nowrap;
}

.analysis-help-popover {
    position: fixed;
    z-index: var(--z-tooltip);
    width: min(24rem, calc(100vw - 1.5rem));
    max-height: min(60vh, 24rem);
    overflow: auto;
    padding: 0.72rem 0.85rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    transform-origin: top center;
    animation: scsaid-help-card-in 180ms var(--ease-out-quint);
}

@keyframes scsaid-help-card-in {
    from {
        opacity: 0;
        transform: translateY(-3px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 480px) {
    .analysis-help-popover {
        width: calc(100vw - 1.5rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .analysis-help::after { transition: none; }
    .analysis-help-popover { animation: none; }
}

@media print {
    .analysis-help,
    .analysis-help-popover { display: none !important; }
}

/* --------------------------------------------------------------------------
   Canonical loading state
   One centered circular indicator is used in every loading panel.
   -------------------------------------------------------------------------- */
.spinner,
.loading-circle {
    display: block;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 3px solid rgba(51, 122, 183, 0.2);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: scsaid-loader-spin 800ms linear infinite;
}

.panel-loader {
    position: relative;
    width: 100%;
    min-height: 8rem;
    padding: var(--space-xl);
}

.panel-loader::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(51, 122, 183, 0.2);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: scsaid-panel-loader-spin 800ms linear infinite;
}

@keyframes scsaid-loader-spin {
    to { transform: rotate(360deg); }
}

@keyframes scsaid-panel-loader-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .spinner,
    .loading-circle,
    .panel-loader::after { animation: none; }
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.2;
    color: var(--text-primary);
    text-wrap: balance;
    overflow-wrap: anywhere;
}

h1 { font-size: clamp(1.6rem, 3vw, 2rem); font-weight: 400; }
h2 { font-size: clamp(1.35rem, 2.2vw, 1.6rem); font-weight: 400; }
h3 { font-size: clamp(1.1rem, 1.6vw, 1.3rem); }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
    text-wrap: pretty;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

/* a:hover {
    color: var(--color-secondary-dark);
} */

/* --------------------------------------------------------------------------
   Layout Components
   -------------------------------------------------------------------------- */
.container {
    width: min(100%, var(--container-max));
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.section {
    padding: var(--space-4xl) 0;
}

.section--dark {
    background-color: var(--bg-dark);
    color: var(--text-inverse);
}

/* --------------------------------------------------------------------------
   Page hero — cream, editorial, centered. Shared primitive used across the
   functional pages (browse, download, compare, featureplot). Kept here so
   every page renders the same header without re-declaring it locally.
   -------------------------------------------------------------------------- */
.page-hero {
    background: transparent;
    padding: var(--space-3xl) clamp(var(--space-md), 4vw, var(--space-2xl)) var(--space-2xl);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}

.page-hero__inner {
    max-width: 760px;
    margin: 0 auto;
}

.page-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: var(--space-md);
}

.page-hero__eyebrow::before,
.page-hero__eyebrow::after {
    content: "";
    width: 28px;
    height: 1px;
    background: var(--color-accent);
}

.page-hero__title {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 3.25rem);
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.015em;
    margin: 0 0 var(--space-md);
}

/* Context-help titles are inline elsewhere, but hero headings must remain a
   separate row below the eyebrow at every viewport width. */
.page-hero__title.title-with-help {
    display: block;
}

.page-hero__description {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 62ch;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .page-hero { padding: var(--space-2xl) var(--space-md); }
}

/* --------------------------------------------------------------------------
   Card Component
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

/* .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
} */

.card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.card__content {
    padding: var(--space-lg);
}

.card__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.card__text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Button Component
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 6px 12px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.428;
    letter-spacing: 0;
    text-transform: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
}

.btn--primary {
    background-color: var(--color-secondary);
    color: var(--text-inverse);
    border-color: var(--btn-primary-border);
}

.btn--primary:hover {
    background-color: var(--btn-primary-hover);
    border-color: var(--btn-primary-hover-border);
    color: var(--text-inverse);
    text-decoration: none;
}

.btn--outline,
.btn--ghost {
    background-color: #fff;
    color: var(--text-primary);
    border-color: var(--input-border);
}

.btn--outline:hover,
.btn--ghost:hover {
    background-color: var(--btn-default-hover);
    border-color: var(--btn-default-hover-border);
    color: var(--text-primary);
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   Table Component
   -------------------------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table thead {
    background-color: var(--bg-muted);
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-medium);
}

.data-table th {
    padding: var(--space-sm) var(--space-lg);
    text-align: left;
    font-weight: 400;
    font-size: 0.8rem;
    text-transform: none;
    letter-spacing: 0;
}

.data-table td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

/* .data-table tbody tr:hover {
    background-color: var(--bg-muted);
} */

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table a {
    color: var(--color-secondary);
    font-weight: 400;
}

.data-table a:hover {
    text-decoration: underline;
}

/* Selected row state */
.data-table tbody tr.selected-row {
    background-color: rgba(51, 122, 183, 0.1);
    border-left: 3px solid var(--color-secondary);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
.form-input,
.form-select {
    width: 100%;
    padding: 6px 12px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.428;
    color: #555;
    background-color: var(--bg-surface);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--input-shadow);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--focus-border);
    box-shadow: var(--focus-shadow);
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
}

/* Custom Checkbox */
.checkbox-custom {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-custom input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: var(--space-sm);
    accent-color: var(--color-secondary);
    cursor: pointer;
}

/* Range Slider - HumanBase handle (white + grey border) on inset track */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #e6e6e6;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 1px solid #888;
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border: 1px solid #888;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.12);
}

/* --------------------------------------------------------------------------
   Pagination Component
   -------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
    padding: var(--space-md) 0;
}

.pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 0 var(--space-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast);
}

/* .pagination__btn:hover:not(.pagination__btn--disabled) {
    color: var(--color-secondary);
    border-color: var(--color-secondary);
} */

.pagination__btn--active {
    background: var(--color-secondary);
    color: var(--text-inverse);
    border-color: var(--color-secondary);
}

.pagination__btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination__input {
    width: 60px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Stat Badge Component
   -------------------------------------------------------------------------- */
.stat-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

/* .stat-badge:hover {
    border-color: var(--color-secondary);
    box-shadow: var(--shadow-md);
} */

.stat-badge__number {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--color-secondary);
    line-height: 1;
}

.stat-badge__label {
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* --------------------------------------------------------------------------
   Navigation Link Pills
   -------------------------------------------------------------------------- */
.nav-pills {
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.nav-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    text-decoration: none;
    min-height: 34px;
    transition: color var(--transition-base), border-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base);
    cursor: pointer;
}

/* .nav-pill:hover {
    color: var(--color-secondary);
    border-color: var(--color-secondary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.nav-pill:active {
    transform: translateY(-1px);
} */

/* --------------------------------------------------------------------------
   Section Header
   -------------------------------------------------------------------------- */
.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
}

.section-header__title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.section-header__subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

.section-header__accent {
    display: inline-block;
    width: 60px;
    height: 3px;
    background-color: var(--color-secondary);
    margin-top: var(--space-lg);
    border-radius: var(--radius-full);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--color-secondary); }

.bg-surface { background-color: var(--bg-surface); }
.bg-muted { background-color: var(--bg-muted); }
.bg-dark { background-color: var(--bg-dark); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* --------------------------------------------------------------------------
   Responsive Design
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    :root {
        --space-4xl: 4rem;
    }

    .container {
        padding: 0 var(--space-lg);
    }
}

@media (max-width: 768px) {
    :root {
        --space-3xl: 2.5rem;
        --space-4xl: 3rem;
    }

    .nav-pills {
        gap: var(--space-md);
    }

    .nav-pill {
        min-width: 120px;
        padding: var(--space-md) var(--space-lg);
        font-size: 1rem;
    }
}

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

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-md);
    }

    .btn {
        width: 100%;
    }
}

/* Plotly SVG labels use a normal (400) weight independently of body text. */
.js-plotly-plot .plotly text { font-weight: 500; }
.js-plotly-plot .plotly text tspan[style*="font-weight:bold"],
.js-plotly-plot .plotly text tspan[style*="font-weight: bold"] { font-weight: 800 !important; }
