@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    color-scheme: light;
    --atlas-ink: #222;
    --atlas-muted: #666;
    --atlas-line: #d9d9d9;
    --atlas-paper: #fff;
    --atlas-link: #294f6b;
    --metric-life: #174b73;
    --metric-work: #bf7138;
    --metric-leisure: #42735d;
    --metric-access: #78669b;
    --atlas-content-width: 1180px;
}

* {
    box-sizing: border-box;
}

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

body.digital-life-page {
    margin: 0;
    color: var(--atlas-ink);
    background: var(--atlas-paper);
    font-family: Inter, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

.digital-life-page a {
    color: var(--atlas-link);
}

.digital-life-page button,
.digital-life-page select {
    font: inherit;
}

.digital-life-page :focus-visible {
    outline: 2px solid #486a82;
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    z-index: 20;
    top: 10px;
    left: 12px;
    padding: 8px 12px;
    transform: translateY(-160%);
    color: #fff !important;
    background: #222;
    border-radius: 2px;
}

.skip-link:focus {
    transform: translateY(0);
}

.atlas-content,
.atlas-header-inner,
.atlas-footer > div {
    width: min(var(--atlas-content-width), calc(100% - 72px));
    margin-inline: auto;
}

.atlas-header {
    position: relative;
    z-index: 3;
    background: #fff;
    border-bottom: 1px solid var(--atlas-line);
}

.atlas-header-inner {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.atlas-brand {
    color: var(--atlas-ink) !important;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
}

.atlas-nav {
    display: flex;
    align-items: center;
    gap: 25px;
}

.atlas-nav a {
    padding-block: 5px;
    color: #444 !important;
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.atlas-nav a:hover {
    color: var(--atlas-link) !important;
    border-color: currentColor;
}

.major-section {
    scroll-margin-top: 20px;
}

.atlas-intro {
    padding-block: 42px 48px;
}

.atlas-intro h1 {
    margin: 0;
    color: var(--atlas-ink);
    font-size: clamp(36px, 3.2vw, 44px);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.intro-subtitle {
    margin: 8px 0 0;
    color: #383838;
    font-size: 26px;
    font-weight: 400;
    line-height: 1.4;
}

.intro-deck {
    max-width: 850px;
    margin: 17px 0 0;
    color: #444;
    font-size: 17px;
    line-height: 1.6;
}

.intro-about {
    max-width: 960px;
    margin-top: 20px;
}

.intro-about h2 {
    margin: 0;
    color: #555;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1.4;
}

.intro-about p {
    margin: 5px 0 4px;
    color: #444;
    font-size: 16px;
    line-height: 1.55;
}

.intro-about a {
    font-size: 14px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.intro-about a:hover {
    opacity: 0.78;
}

.intro-note {
    max-width: 960px;
    margin: 7px 0 0;
    color: var(--atlas-muted);
    font-size: 16px;
    line-height: 1.55;
}

.atlas-section {
    padding-block: 68px 74px;
    border-top: 1px solid var(--atlas-line);
}

#trends,
#map-section,
#state-profile,
#state-statistics {
    padding-block: 24px 40px;
}

#measure-definitions {
    padding-block-start: 24px;
}

.section-heading {
    max-width: 1000px;
    margin-bottom: 22px;
}

.section-heading h2,
.text-content h2 {
    margin: 0;
    color: #242424;
    font-size: clamp(24px, 2.1vw, 28px);
    font-weight: 600;
    letter-spacing: -0.012em;
    line-height: 1.3;
}

.figure-subtitle {
    margin: 8px 0 0;
    color: var(--atlas-muted);
    font-size: 16px;
    line-height: 1.55;
}

.atlas-figure {
    margin: 0;
}

.plot {
    width: 100%;
    min-width: 0;
}

.trend-plot {
    height: 472px;
}

.metric-legend {
    display: none;
    flex-wrap: wrap;
    gap: 9px 23px;
    margin: 2px 0 12px;
    padding: 0;
    list-style: none;
    color: #444;
    font-size: 15px;
    line-height: 1.45;
}

.metric-legend li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-swatch {
    width: 19px;
    height: 2px;
    display: inline-block;
    border-radius: 1px;
}

.legend-life { background: var(--metric-life); }
.legend-work { background: var(--metric-work); }
.legend-leisure { background: var(--metric-leisure); }
.legend-access { background: var(--metric-access); }

.figure-note {
    display: grid;
    gap: 5px;
    margin-top: 13px;
    color: #606060;
    font-size: 15px;
    line-height: 1.55;
}

.figure-note p {
    margin: 0;
}

.figure-note a,
.method-readme a {
    color: var(--atlas-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.figure-note a:hover,
.method-readme a:hover {
    opacity: 0.78;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px 18px;
    margin: 20px 0 13px;
}

.select-control {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
    color: #444;
    font-size: 14px;
    font-weight: 500;
}

.select-control select {
    min-height: 38px;
    padding: 5px 34px 5px 9px;
    color: #292929;
    background-color: #fff;
    border: 1px solid #c9c9c9;
    border-radius: 3px;
    cursor: pointer;
    font-size: 15px;
}

.map-plot {
    height: 570px;
}

.map-figure {
    overflow: visible;
}

.map-legend {
    width: min(480px, 100%);
    margin: 2px auto 18px;
    color: #4d4d4d;
    font-size: 14px;
    line-height: 1.45;
}

.map-legend-title {
    margin: 0 0 7px;
    font-weight: 500;
}

.map-legend-gradient {
    height: 9px;
    border-radius: 1px;
    background: linear-gradient(90deg, #edf1f1 0%, #c8d7dc 20%, #91b0bd 45%, #527f94 72%, #17465f 100%);
}

.map-legend-ticks {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.map-note {
    min-height: 24px;
    margin: 0;
    color: #444;
    font-size: 15px;
    font-weight: 500;
}

.map-state-selection {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    align-items: center;
    gap: 12px 22px;
    margin-top: 20px;
    padding-top: 17px;
    border-top: 1px solid var(--atlas-line);
}

.state-picker {
    min-width: 0;
    width: 100%;
}

.map-state-prompt {
    margin: 0;
    color: var(--atlas-muted);
    font-size: 15px;
    line-height: 1.5;
}

.profile-state-year {
    margin: 8px 0 2px;
    color: #333;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.4;
}

.profile-plot {
    height: 350px;
}

.statistics-plot {
    min-height: 1500px;
}

.statistics-figure .figure-note {
    margin-top: 8px;
}

.statistics-plot.plot-error {
    min-height: 180px;
}

.text-content {
    max-width: 920px;
}

.text-content > p {
    max-width: 850px;
    margin: 16px 0 0;
    color: #444;
    font-size: 17px;
    line-height: 1.6;
}

.text-content h2 {
    margin-bottom: 12px;
}

.dimension-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
    margin: 28px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--atlas-line);
}

.dimension-list div {
    min-width: 0;
}

.dimension-list dt {
    color: #303030;
    font-size: 16px;
    font-weight: 600;
}

.dimension-list dd {
    margin: 6px 0 0;
    color: #555;
    font-size: 16px;
    line-height: 1.6;
}

.method-content {
    max-width: 900px;
}

.method-content h2 {
    margin-bottom: 10px;
}

.method-intro {
    max-width: 850px;
    margin: 0;
    color: #444;
    font-size: 17px;
    line-height: 1.6;
}

.method-block {
    max-width: 820px;
    margin-top: 20px;
}

.method-block h3 {
    margin: 0;
    color: #303030;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
}

.method-block p {
    max-width: 800px;
    margin: 4px 0 0;
    color: #444;
    font-size: 17px;
    line-height: 1.6;
}

.method-content .method-readme {
    margin-top: 22px;
}

.method-readme a {
    overflow-wrap: anywhere;
}

.download-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 28px;
    margin-top: 22px;
    padding-top: 15px;
    border-top: 1px solid var(--atlas-line);
}

.download-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    color: var(--atlas-link) !important;
    font-size: 16px;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.download-link:hover {
    opacity: 0.78;
}

.atlas-footer {
    padding-block: 21px 28px;
    border-top: 1px solid var(--atlas-line);
}

.atlas-footer > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.atlas-footer p {
    margin: 0;
    color: #555;
    font-size: 15px;
}

.atlas-footer a {
    color: #444;
    font-size: 15px;
    text-decoration: none;
}

.atlas-footer a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.section-controls {
    position: fixed;
    z-index: 10;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 5px;
}

.section-controls button {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #444;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #cfcfcf;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.section-controls button:hover:not(:disabled) {
    background: #f5f5f5;
}

.section-controls button:disabled {
    color: #aaa;
    cursor: default;
}

@media (max-width: 900px) {
    .atlas-content,
    .atlas-header-inner,
    .atlas-footer > div {
        width: calc(100% - 48px);
    }

    .atlas-intro {
        padding-block: 36px 42px;
    }

    .intro-subtitle {
        font-size: 23px;
    }

    .atlas-section {
        padding-block: 58px 64px;
    }

    #trends,
    #map-section,
    #state-profile,
    #state-statistics {
        padding-block: 22px 36px;
    }

    #measure-definitions {
        padding-block-start: 22px;
    }

    .trend-plot {
        height: 440px;
    }

    .map-plot {
        height: 500px;
    }
}

@media (max-width: 760px) {
    .metric-legend {
        display: flex;
        gap: 7px 15px;
        margin-top: 4px;
        font-size: 13px;
    }
}

@media (max-width: 700px) {
    body.digital-life-page {
        font-size: 16.5px;
    }

    .atlas-content,
    .atlas-header-inner,
    .atlas-footer > div {
        width: calc(100% - 36px);
    }

    .atlas-header-inner {
        min-height: 60px;
        gap: 14px;
    }

    .atlas-brand {
        font-size: 16px;
    }

    .atlas-nav {
        gap: 15px;
    }

    .atlas-nav a {
        font-size: 14px;
    }

    .atlas-intro {
        padding-block: 32px 37px;
    }

    .atlas-intro h1 {
        font-size: clamp(34px, 8.5vw, 40px);
    }

    .intro-subtitle {
        font-size: 21px;
    }

    .intro-deck {
        margin-top: 14px;
        font-size: 16.5px;
    }

    .atlas-section {
        padding-block: 48px 54px;
    }

    #trends,
    #map-section,
    #state-profile,
    #state-statistics {
        padding-block: 20px 32px;
    }

    #measure-definitions {
        padding-block-start: 20px;
    }

    .section-heading {
        margin-bottom: 17px;
    }

    .section-heading h2,
    .text-content h2 {
        font-size: 24px;
    }

    .figure-subtitle {
        margin-top: 6px;
        font-size: 15.5px;
    }

    .trend-plot {
        height: 385px;
    }

    .map-plot {
        height: 400px;
    }

    .control-row {
        gap: 10px 12px;
        margin: 16px 0 10px;
    }

    .select-control {
        min-width: 145px;
        font-size: 14px;
    }

    .select-control select {
        min-height: 37px;
        font-size: 14px;
    }

    .map-state-selection {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
        margin-top: 15px;
        padding-top: 14px;
    }

    .state-picker {
        max-width: 260px;
    }

    .profile-state-year {
        font-size: 18px;
    }

    .profile-plot {
        height: 330px;
    }

    .text-content > p,
    .method-intro,
    .method-block p {
        font-size: 16.5px;
    }

    .dimension-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 19px;
        margin-top: 22px;
        padding-top: 16px;
    }

    .dimension-list dd {
        font-size: 16px;
    }

    .method-block {
        margin-top: 17px;
    }

    .method-block h3 {
        font-size: 15px;
    }

    .download-links {
        gap: 5px 21px;
        margin-top: 18px;
        padding-top: 12px;
    }

    .download-link {
        font-size: 15px;
    }

    .atlas-footer > div {
        align-items: flex-start;
    }

    .section-controls {
        right: 10px;
        bottom: 10px;
    }
}

@media (max-width: 390px) {
    .atlas-content,
    .atlas-header-inner,
    .atlas-footer > div {
        width: calc(100% - 30px);
    }

    .atlas-header-inner {
        gap: 10px;
    }

    .atlas-brand {
        font-size: 15px;
    }

    .atlas-nav {
        gap: 11px;
    }

    .atlas-nav a {
        font-size: 14px;
    }

    .atlas-intro h1 {
        font-size: 34px;
    }

    .control-row .select-control {
        min-width: 0;
        flex: 1 1 135px;
    }

    .control-row select {
        max-width: 100%;
    }

    .figure-note,
    .map-state-prompt {
        font-size: 14.5px;
    }
}

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