/* A quiet research directory. Loaded only by Home and Mathematics. */
:root {
    --research-ink: #CDD5DF;
    --research-muted: #98A3B0;
    --research-link: #B2CAE4;
    --research-line: rgba(139, 148, 158, 0.25);
    --research-serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
}

.math-overview .module-title--math {
    color: var(--research-ink);
    font-family: var(--research-serif);
    font-size: 1.9rem;
    font-weight: 400;
    letter-spacing: -0.025em;
}
.math-overview .research-section__heading { margin-bottom: 0.75rem; }
.math-overview .research-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    color: var(--research-muted);
    font-size: 0.6875rem;
}
.math-overview .research-more:hover { color: var(--research-link); }
.math-overview .research-section__intro {
    max-width: 60ch;
    margin-bottom: 1.5rem;
    color: var(--research-muted);
    font-size: 0.875rem;
}
.math-index__caption,
.research-directory__caption {
    margin-bottom: 0.75rem;
    color: var(--research-muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    line-height: 1.65;
}

/* Home: six cards, with the remaining questions disclosed on demand. */
.math-index {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}
.math-index__row {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 7rem;
    border: 1px solid var(--research-line);
    border-radius: 3px;
    color: var(--research-ink);
    background: transparent;
    scroll-margin-top: 2rem;
    transition: border-color 150ms ease, background-color 150ms ease;
}
.math-index__main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1rem;
    grid-template-rows: auto 1fr;
    gap: 0.8rem 0.5rem;
    min-width: 0;
    min-height: 7rem;
    flex: 1;
    padding: 1rem 1.1rem 0.75rem;
    color: inherit;
}
.math-index__main::after,
.research-credit::after,
.math-index-gallery::after { display: none; }
.math-index__main:hover { color: var(--research-link); }
.math-index__year {
    grid-column: 1;
    grid-row: 1;
    color: var(--research-muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    line-height: 1.5;
}
.math-index__topic {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    color: inherit;
    font-family: var(--research-serif);
    font-size: 1.125rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.math-index__arrow {
    grid-column: 2;
    grid-row: 1;
    color: var(--research-muted);
    font-size: 0.875rem;
    line-height: 1.25;
    text-align: right;
}
.math-index__row:hover,
.math-index__row:target {
    border-color: rgba(178, 202, 228, 0.55);
    color: var(--research-link);
    background-color: rgba(178, 202, 228, 0.035);
}
.math-index__credits {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
    padding: 0 1.1rem 1rem;
}
.research-credit {
    color: var(--research-muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
a.research-credit {
    text-decoration: underline;
    text-decoration-color: rgba(178, 202, 228, 0.35);
    text-underline-offset: 0.2em;
}
.research-credit--formal { color: #D6C092; }
.research-credit--context {
    flex-basis: 100%;
    color: #A8BDD2;
}
a.research-credit:hover { color: var(--research-link); }
.math-index-more { margin-top: 0.75rem; }
.math-index-more > summary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 3rem;
    padding: 0.65rem 0;
    color: var(--research-muted);
    font-size: 0.8125rem;
}
.math-index-more__count {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}
.math-index-more__icon { margin-left: auto; }
.math-index-more > .math-index { margin-top: 0.4rem; }
.math-index-gallery {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 1rem;
    align-items: center;
    gap: 0.65rem;
    min-height: 3.5rem;
    margin-top: 0.75rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--research-line);
    color: var(--research-muted);
    font-size: 0.8125rem;
    line-height: 1.5;
}
.math-index-gallery > span:nth-child(2) {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    white-space: nowrap;
}
.math-index-gallery:hover { color: var(--research-link); }

/* Mathematics shows the questions immediately, under quiet area headings. */
.research-directory > .blog-hero { padding-bottom: 2rem; margin-bottom: 0.6rem; }
.research-directory .blog-kicker {
    margin-bottom: 0.75rem;
    color: var(--research-muted);
    font-size: 0.6875rem;
}
.research-directory .blog-title {
    font-family: var(--research-serif);
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 400;
    letter-spacing: -0.025em;
}
.research-directory .blog-intro {
    color: var(--research-muted);
    font-size: 0.9375rem;
}
.research-directory__caption { margin: 0.75rem 0 0; max-width: 65ch; }
.research-group {
    min-width: 0;
    border-bottom: 1px solid var(--research-line);
    scroll-margin-top: 1.5rem;
}
.research-group__header { padding: 1.5rem 0 1rem; }
.research-group__heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.5rem 1rem;
    margin: 0;
    color: var(--research-ink);
    font-family: var(--research-serif);
    font-size: clamp(1.125rem, 2vw, 1.3rem);
    font-weight: 400;
    line-height: 1.4;
}
.research-group__heading > span:first-child { grid-column: 1; grid-row: 1; }
.research-group__heading > .research-group__count { grid-column: 2; grid-row: 1; }
.research-group__heading > span:first-child,
.research-gallery__heading > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.research-group__count {
    color: var(--research-muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
}
.research-group__body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.75rem;
    padding: 0 0 1.5rem;
}
#algebraic-topology > .research-group__body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.research-group__body > .research-paper,
.research-group__body > .research-paper + .research-paper {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--research-line);
    border-radius: 3px;
    scroll-margin-top: 1.5rem;
}
.research-entry > summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1rem;
    grid-template-rows: auto auto 1fr;
    gap: 0.65rem 0.5rem;
    min-height: 10.25rem;
    padding: 1rem 1.1rem;
}
.research-entry__year {
    grid-column: 1;
    grid-row: 1;
    color: var(--research-muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    line-height: 1.5;
}
.research-entry__topic {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    color: var(--research-ink);
    font-family: var(--research-serif);
    font-size: 1.125rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.research-entry__icon { grid-column: 2; grid-row: 1; }
.research-entry__meaning {
    grid-column: 1 / -1;
    grid-row: 3;
    min-width: 0;
    color: var(--research-muted);
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.research-entry:not([open]) > summary,
.research-gallery:not([open]) > summary { height: 100%; }
.research-group__body > .research-entry:only-child,
.research-group__body > .research-entry[open],
.research-gallery[open] {
    grid-column: 1 / -1;
}
.research-group__body > .research-entry[open],
.research-gallery[open] {
    background-color: rgba(178, 202, 228, 0.025);
}
.research-group__body > .research-entry:only-child > summary { min-height: auto; }
.research-entry[open] > summary,
.research-gallery[open] > summary {
    min-height: auto;
    border-bottom: 1px solid var(--research-line);
}
.research-entry__body {
    max-width: 84ch;
    padding: 1.2rem 1.35rem 1.6rem;
    font-size: 0.9375rem;
}
.research-entry__body .research-paper__meta {
    color: var(--research-muted);
    font-size: 0.6875rem;
    line-height: 1.65;
}
.research-entry__body .publication__title { font-size: 1.0625rem; font-weight: 500; }
.research-entry__body .research-paper__hook {
    color: var(--research-ink);
    font-family: var(--research-serif);
    font-size: 1.125rem;
    font-weight: 400;
}
.research-entry__body .research-paper__result strong { font-weight: 500; }

/* The note gallery shares the same card language. */
.research-directory .research-gallery {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 1px solid var(--research-line);
    border-radius: 3px;
}
.research-gallery > summary { min-height: 10.25rem; padding: 1rem 1.1rem; }
.research-gallery__heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1rem;
    grid-template-rows: auto auto 1fr;
    gap: 0.65rem 0.5rem;
    margin: 0;
    font-family: var(--research-serif);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.45;
}
.research-gallery__heading > span:first-child {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--research-ink);
}
.research-gallery__heading > .research-group__count { grid-column: 1; grid-row: 1; }
.research-gallery__heading > .research-group__icon { grid-column: 2; grid-row: 1; }
.research-gallery__meaning {
    grid-column: 1 / -1;
    grid-row: 3;
    min-width: 0;
    color: var(--research-muted);
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.research-gallery__body { padding: 1.2rem 1.1rem; }
.research-gallery .complex-gallery__notes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.65rem;
}
.research-gallery .complex-gallery__notes > li { min-width: 0; }
.research-gallery .complex-gallery__note {
    height: 100%;
    padding: 0.9rem;
    border-color: var(--research-line);
    background: transparent;
    grid-template-columns: 1.25rem minmax(0, 1fr);
    align-items: start;
    gap: 0.4rem 0.6rem;
}
.research-gallery .complex-gallery__file { grid-column: 2; }
.research-gallery .complex-gallery__concept {
    min-width: 0;
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}
.research-gallery .complex-gallery__concept strong { color: var(--research-link); font-weight: 500; }

/* Native disclosure semantics, with quiet hover and keyboard states. */
.math-index-more > summary,
.research-entry > summary,
.research-gallery > summary { list-style: none; cursor: pointer; }
.math-index-more > summary::-webkit-details-marker,
.research-entry > summary::-webkit-details-marker,
.research-gallery > summary::-webkit-details-marker { display: none; }
.math-index-more > summary::marker,
.research-entry > summary::marker,
.research-gallery > summary::marker { content: ''; }
.math-index-more__icon,
.research-group__icon,
.research-entry__icon {
    color: var(--research-muted);
    font-size: 0;
    font-weight: 400;
    line-height: 1;
    text-align: right;
}
.math-index-more__icon::before,
.research-group__icon::before,
.research-entry__icon::before {
    content: '+';
    font-family: var(--font-sans);
    font-size: 1.1rem;
}
.math-index-more[open] > summary .math-index-more__icon::before,
.research-entry[open] > summary .research-entry__icon::before,
.research-gallery[open] > summary .research-group__icon::before { content: '−'; }
.research-entry > summary:hover .research-entry__topic,
.research-gallery > summary:hover .research-gallery__heading > span:first-child,
.math-index-more > summary:hover { color: var(--research-link); }
.research-entry:hover,
.research-gallery:hover { border-color: rgba(178, 202, 228, 0.5); }
.math-overview a:focus-visible,
.math-index-more > summary:focus-visible,
.research-directory a:focus-visible,
.research-directory summary:focus-visible {
    outline: 2px solid var(--research-link);
    outline-offset: 4px;
    border-radius: 2px;
}

@media (max-width: 850px) {
    .math-index,
    .research-group__body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .math-index,
    .research-group__body { gap: 0.6rem; }
    .math-index__main {
        min-height: 7.25rem;
        padding: 0.85rem 0.75rem;
        gap: 0.65rem 0.35rem;
    }
    .math-index__credits { padding: 0 0.75rem 0.85rem; gap: 0.35rem 0.65rem; }
    .research-entry > summary,
    .research-gallery > summary {
        min-height: auto;
        padding: 0.85rem 0.75rem;
        gap: 0.55rem 0.35rem;
    }
    .research-group__body,
    #algebraic-topology > .research-group__body { grid-template-columns: minmax(0, 1fr); }
    .math-index__topic,
    .research-entry__topic,
    .research-gallery__heading { font-size: 1rem; }
    .math-index__year,
    .research-entry__year { font-size: 0.625rem; }
    .research-group__heading { grid-template-columns: minmax(0, 1fr); font-size: 1.125rem; gap: 0.35rem; }
    .research-group__heading > .research-group__count { grid-column: 1; grid-row: 2; }
    .research-group__heading > .research-group__count { font-size: 0.625rem; }
    .research-entry__body,
    .research-gallery__body { padding: 1rem 0.85rem 1.25rem; }
    .research-gallery .complex-gallery__notes { grid-template-columns: minmax(0, 1fr); }
    .math-index-gallery { font-size: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) {
    html.research-view { scroll-behavior: auto; }
    html.research-view body { transition: none !important; }
    .math-index__row,
    .math-overview a,
    .research-directory a { transition: none; }
}
