/* Manrope: distinctive geometric sans, slightly off-kilter modern feel. */
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/manrope-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/manrope-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/manrope-latin-bold.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: dark light;

    /* Dark mode defaults */
    --bg: #16171a;
    --text: #e8e8eb;
    --text-muted: #9a9aa3;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --line: #e8e8eb;

    /* Type colors — dark mode */
    --connection: #06b6d4;
    --connection-hover: #22d3ee;
    --state: #84cc16;
    --state-hover: #a3e635;
    --time: #8b5cf6;
    --time-hover: #a78bfa;
    --change: #ec4899;
    --change-hover: #f472b6;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #fafafa;
        --text: #2a2a2e;
        --text-muted: #6b6b73;
        --accent: #ea580c;
        --accent-hover: #f97316;
        --line: #2a2a2e;

        --connection: #0891b2;
        --connection-hover: #06b6d4;
        --state: #65a30d;
        --state-hover: #84cc16;
        --time: #7c3aed;
        --time-hover: #8b5cf6;
        --change: #db2777;
        --change-hover: #ec4899;
    }
}

/* Explicit overrides from the in-app theme toggle. Higher specificity beats the @media rule. */
:root.theme-dark {
    color-scheme: dark;
    --bg: #16171a;
    --text: #e8e8eb;
    --text-muted: #9a9aa3;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --line: #e8e8eb;

    --connection: #06b6d4;
    --connection-hover: #22d3ee;
    --state: #84cc16;
    --state-hover: #a3e635;
    --time: #8b5cf6;
    --time-hover: #a78bfa;
    --change: #ec4899;
    --change-hover: #f472b6;
}

:root.theme-light {
    color-scheme: light;
    --bg: #fafafa;
    --text: #2a2a2e;
    --text-muted: #6b6b73;
    --accent: #0f766e;
    --accent-hover: #14b8a6;
    --line: #2a2a2e;

    --connection: #0891b2;
    --connection-hover: #06b6d4;
    --state: #65a30d;
    --state-hover: #84cc16;
    --time: #7c3aed;
    --time-hover: #8b5cf6;
    --change: #db2777;
    --change-hover: #ec4899;
}

.type-connection { color: var(--connection); }
.type-state { color: var(--state); }
.type-time { color: var(--time); }
.type-change { color: var(--change); }

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    color: var(--accent-hover);
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Manrope', system-ui, sans-serif;
    letter-spacing: 0.01em;
    margin: 0 auto;
    padding: 0 10% 2rem 10%;
}

.black {
    color: var(--line);
    fill: var(--line);
}

.accent {
    color: var(--accent);
    fill: var(--accent);
}

.comment {
    color: var(--text-muted);
}

div {
    padding-bottom: 1em;
}

h1 {
    margin-bottom: 0.1em;
}

h2 {
    margin: 1em 0 0.5em 0;
}

nav > ul {
    list-style-type: none;
    margin: 0.75em 0.25em 0 0;
    padding: 0 0 1em 0;
    display: flex;
    gap: 1em;
}

nav > ul > li {
    font-size: 1em;
    font-weight: bold;
}

nav > ul > li:last-child {
    margin-left: auto;
}

.theme-toggle {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    /* fixed box so cycling icons does not shift surrounding layout */
    display: inline-block;
    min-width: 1.5em;
    text-align: center;
    line-height: 1;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    color: var(--accent-hover);
}

nav a[aria-current="page"] {
    text-decoration: none;
    color: var(--accent);
    padding-bottom: 2px;
    border-bottom: 2px solid var(--accent);
}

.pre {
    white-space: pre-wrap;
}

ul {
    list-style-type: none;
    padding-left: 0;
}

@media screen and (max-width: 800px) {
    body {
        padding: 0 5%;
    }
}

.main-description {
    padding: 1em 0;
}

/* Card list: name (link), brief */
.card-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 2em;
    list-style: none;
    padding: 0;
}

@media screen and (max-width: 800px) {
    .card-list {
        grid-template-columns: minmax(0, 7em) 1fr;
        gap: 1em 1em;
    }
}

.card-list > li {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: baseline;
    padding: 0.2em 0;
}

.card-name {
    font-weight: bold;
    text-decoration: none;
}

a.card-name.type-connection:hover,
a.card-name.type-connection:focus-visible { color: var(--connection-hover); }

a.card-name.type-state:hover,
a.card-name.type-state:focus-visible { color: var(--state-hover); }

a.card-name.type-time:hover,
a.card-name.type-time:focus-visible { color: var(--time-hover); }

a.card-name.type-change:hover,
a.card-name.type-change:focus-visible { color: var(--change-hover); }

.card-brief-card {
    margin-bottom: 3rem;
}

.type-name {
    text-transform: capitalize;
}

.type-description {
    color: var(--text-muted);
}

/* Muted secondary content on card and reading pages */
.card-examples,
.card-tech,
.card-reflection {
    color: var(--text-muted);
    font-size: 0.95em;
}

/* Reading page */
.reading-actions {
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid var(--text-muted);
}
