/*******************************************************************************
CUSTOM STYLES FOR RAMITH.FYI
*******************************************************************************/

:root {
    --ramith-blue: #3f51ff;
    --ramith-blue-deep: #263bd7;
    --ramith-blue-soft: rgba(63, 81, 255, 0.1);
    --ramith-line: rgba(45, 50, 75, 0.16);
    --ramith-card: #fffff8;
}

/*******************************************************************************
PROFILE IMAGE
*******************************************************************************/

.profile-pic,
.marginnote .profile-pic {
    border-radius: 10%;
    max-width: 65%;
    display: block;
    margin: 0 auto 1.5rem auto;
    box-shadow: 2px 7px 28px 7px rgba(63, 81, 255, 0.16);
}

/*******************************************************************************
HOME PAGE
*******************************************************************************/

.molecule-bg {
    --protein-stage-size: clamp(17rem, calc(12.5vw + 9rem), 26rem);
    position: fixed;
    z-index: 0;
    top: 40%;
    left: -8rem;
    width: var(--protein-stage-size);
    height: var(--protein-stage-size);
    transform: translateY(-50%);
    pointer-events: none;
}

/* Let the molecule sit behind the page without multiplying into the ink. */
.molecule-bg ~ :not(script) {
    position: relative;
    z-index: 1;
}

.protein-viewer,
.protein-viewer-fallback {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.protein-viewer {
    opacity: 0;
    cursor: grab;
    filter: saturate(0.82) contrast(0.98);
    pointer-events: auto;
    transition: opacity 260ms ease;
}

.protein-viewer:active {
    cursor: grabbing;
}

.protein-viewer canvas {
    width: 100% !important;
    height: 100% !important;
    background: transparent !important;
}

.protein-viewer-fallback {
    object-fit: contain;
    opacity: 0.56;
    filter: saturate(0.82) contrast(0.98);
    transition: opacity 220ms ease;
}

.molecule-bg.is-ready .protein-viewer {
    opacity: 0.66;
}

.molecule-bg.is-ready .protein-viewer-fallback {
    opacity: 0;
}

.home-section-link {
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.cv-links {
    color: var(--ramith-blue) !important;
}

.home-featured {
    clear: both;
    box-sizing: border-box;
    width: 90% !important;
    margin: 4.5rem 0 4rem;
}

.home-section-heading {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--ramith-line);
}

.home-section-heading h3 {
    margin: 0 0 0.7rem;
}

.home-section-actions {
    display: flex;
    width: auto;
    gap: 1rem;
    align-items: center;
    margin: 0 0 0.55rem;
}

.home-section-actions > p,
.featured-carousel-controls > p {
    display: contents;
}

.home-section-link,
.home-section-link:link,
.home-section-link:visited {
    color: var(--ramith-blue);
    background-image: none;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    text-shadow: none;
}

.home-section-link:hover,
.home-section-link:focus-visible {
    color: var(--ramith-blue-deep);
}

.featured-grid {
    --featured-card-size: min(30%, 22rem);
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.15rem 0.2rem 0.85rem;
    scroll-behavior: smooth;
    scroll-padding-inline: 0.2rem;
    scroll-snap-type: inline mandatory;
    scrollbar-color: rgba(63, 81, 255, 0.4) transparent;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

/* Let the final card reach the same left-aligned reading position as the first. */
.featured-grid::after {
    flex: 0 0 calc(100% - var(--featured-card-size) - 0.4rem);
    content: "";
}

.featured-grid::-webkit-scrollbar {
    height: 0.3rem;
}

.featured-grid::-webkit-scrollbar-track {
    background: transparent;
}

.featured-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(63, 81, 255, 0.35);
}

.featured-grid:focus-visible {
    outline: 2px solid var(--ramith-blue);
    outline-offset: 0.25rem;
}

.featured-card,
.featured-card:link,
.featured-card:visited {
    position: relative;
    display: flex;
    flex: 0 0 var(--featured-card-size);
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(17, 17, 17, 0.18);
    border-radius: 0;
    background: var(--ramith-card);
    background-image: none;
    box-shadow: 2px 3px 0 rgba(17, 17, 17, 0.055);
    color: inherit;
    text-decoration: none;
    text-shadow: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.featured-card:hover,
.featured-card:focus-visible {
    border-color: rgba(63, 81, 255, 0.48);
    box-shadow: 3px 4px 0 rgba(63, 81, 255, 0.1);
    outline: none;
}

.featured-card__image {
    overflow: hidden;
    aspect-ratio: 16 / 9;
    margin: 0.5rem 0.5rem 0;
    border: 1px solid rgba(17, 17, 17, 0.13);
    background: #fff;
}

.featured-card__image img {
    width: 100%;
    height: 100%;
    max-height: none;
    filter: saturate(0.88) contrast(0.98);
    object-fit: cover;
    transition: filter 160ms ease;
}

.featured-card__image--paper {
    display: grid;
    box-sizing: border-box;
    padding: 0.8rem;
    background:
        linear-gradient(135deg, rgba(63, 81, 255, 0.09), transparent 44%),
        #f1f0e8;
}

.paper-cover {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    flex-direction: column;
    padding: 0.75rem 0.8rem;
    border: 1px solid rgba(17, 17, 17, 0.24);
    background: #fffff8;
    box-shadow: 2px 3px 0 rgba(17, 17, 17, 0.08);
    color: #111;
}

.paper-cover__kicker {
    color: var(--ramith-blue-deep);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.paper-cover__title {
    max-width: 18em;
    margin-top: 0.55rem;
    font-family: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 0.92rem;
    font-weight: 400;
    line-height: 1.12;
}

.paper-cover__authors,
.paper-cover__abstract {
    font-family: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 0.55rem;
    line-height: 1.25;
}

.paper-cover__authors {
    margin-top: 0.42rem;
    color: #555;
    font-style: italic;
}

.paper-cover__rule {
    width: 2.8rem;
    margin: auto 0 0.4rem;
    border-top: 2px solid var(--ramith-blue);
}

.paper-cover__abstract {
    width: 78%;
    color: #333;
}

.featured-card__body {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 0.7rem 1.9rem 0.95rem 0.7rem;
}

.featured-card:hover .featured-card__image img,
.featured-card:focus-visible .featured-card__image img {
    filter: saturate(1) contrast(1);
}

.featured-card__meta {
    color: #666;
    font-family: et-book, Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
    font-size: 0.7rem;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.featured-card h4 {
    margin: 0.3rem 0 0.3rem;
    font-size: 1.12rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.17;
}

.featured-card p {
    width: auto;
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.35;
}

.featured-card__arrow {
    position: absolute;
    right: 0.9rem;
    bottom: 0.85rem;
    color: var(--ramith-blue);
    font-size: 1.1rem;
}

.featured-carousel-controls {
    display: flex;
    width: auto;
    align-items: center;
    gap: 0.4rem;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.featured-carousel-button {
    display: grid;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(17, 17, 17, 0.24);
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    line-height: 1;
    transition: border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.featured-carousel-button:hover,
.featured-carousel-button:focus-visible {
    border-color: var(--ramith-blue);
    color: var(--ramith-blue);
    outline: none;
}

.featured-carousel-button:disabled {
    cursor: default;
    opacity: 0.28;
}

.featured-carousel-count {
    min-width: 3.25rem;
    color: #666;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    text-align: center;
}

.featured-carousel-progress {
    position: relative;
    display: block;
    width: 3.4rem;
    height: 1px;
    overflow: hidden;
    background: var(--ramith-line);
}

.featured-carousel-progress::after {
    position: absolute;
    inset: 0;
    background: var(--ramith-blue);
    content: "";
    transform: scaleX(var(--carousel-progress, 0.2));
    transform-origin: left center;
    transition: transform 220ms ease;
}

.experience-heading {
    margin-top: 3.5rem;
}

@media (max-width: 1180px) {
    .featured-grid {
        --featured-card-size: min(46%, 20rem);
    }
}

/* On phones, let the molecule peek in like a margin illustration. */
@media (max-width: 760px) {
    .molecule-bg {
        position: absolute;
        top: 9rem;
        left: -7rem;
        width: 17rem;
        height: 17rem;
        margin: 0;
        transform: none;
    }

    .molecule-bg.is-ready .protein-viewer {
        opacity: 0.45;
    }

    .protein-viewer-fallback {
        opacity: 0.39;
    }

    /* Long post titles wrap over the margin illustration on small screens. */
    article:has(#post-comments) .molecule-bg.is-ready .protein-viewer,
    article:has(#post-comments) .protein-viewer-fallback {
        opacity: 0.2;
    }

    .protein-viewer {
        touch-action: pan-y;
    }

    .home-featured {
        width: 100% !important;
    }

    .home-featured {
        margin: 3.5rem 0 3rem;
    }

    .featured-grid {
        --featured-card-size: 78%;
    }

    .featured-card__image {
        aspect-ratio: 16 / 8.75;
    }

    .home-section-heading {
        align-items: flex-end;
    }

    .home-section-actions {
        flex-direction: column;
        gap: 0.45rem;
        align-items: flex-end;
    }

    .featured-carousel-progress {
        display: none;
    }

}

@media (prefers-color-scheme: dark) {
    .protein-viewer {
        filter: invert(1) hue-rotate(180deg) saturate(0.78);
        mix-blend-mode: screen;
    }

}

/*******************************************************************************
SITE FOOTER
*******************************************************************************/

.site-footer {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    clear: both;
    width: 90%;
    margin: 5rem 0 0 -2rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--ramith-line);
    color: #777;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.7rem;
    line-height: 1.5;
}

/* Tufte adds 5rem below every article; keep a smaller ending on pages
   with our site footer, without changing article spacing elsewhere. */
article:has(.site-footer) {
    padding-bottom: 1.5rem;
}

section:has(> .site-footer) {
    padding-bottom: 0;
}

.site-footer p {
    width: auto;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited {
    color: var(--ramith-blue-deep);
    background-image: none;
    text-decoration: none;
    text-shadow: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    text-decoration: underline;
    outline: none;
}

@media (prefers-color-scheme: dark) {
    .site-footer {
        color: #aaa;
    }
}

@media (max-width: 760px) {
    .site-footer {
        flex-direction: column;
        width: 100%;
        margin-top: 3.5rem;
        margin-left: 0;
    }
}

/*******************************************************************************
TOC LAYOUT - Push content right on wide screens to make room for TOC
(commented out - TOC removed as it was distracting)
*******************************************************************************/

/*
@media (min-width: 1400px) {
    header, article {
        margin-left: 80px;
    }

    .marginnote,
    .sidenote {
        width: 34%;
        margin-right: -40%;
    }

    section > p,
    section > footer,
    section > table,
    section > ol,
    section > ul,
    section > h2,
    section > h3,
    section > div:not(.opening),
    section > figure:not(.kudo),
    section > blockquote {
        width: 62%;
    }
}
*/

/*******************************************************************************
MARGIN NOTE HIGHLIGHT - Yellow instead of gray
*******************************************************************************/

:root {
    --highlight-weak: rgba(255, 235, 59, 0.3);
    --highlight-strong: rgba(255, 235, 59, 0.5);
}

.footnote-ref + .marginnote {
    box-shadow: 0 0 0 8px var(--highlight);
}

@media (prefers-color-scheme: dark) {
    :root {
        --highlight-weak: rgba(255, 235, 59, 0.15);
        --highlight-strong: rgba(255, 235, 59, 0.3);
    }
}

/*******************************************************************************
BIBLIOGRAPHY ENTRY HIGHLIGHT ON CLICK
*******************************************************************************/

section[role="doc-bibliography"] li.bib-highlight {
    background-color: rgba(255, 235, 59, 0.4);
    box-shadow: 0 0 0 6px rgba(255, 235, 59, 0.4);
    border-radius: 0.2rem;
}

section[role="doc-bibliography"] li {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/*******************************************************************************
RESPONSIVE - MOBILE STYLES
*******************************************************************************/

@media (max-width: 760px) {
    /* Allow CV/social links to use full width on mobile */
    .cv-links {
        max-width: 100% !important;
    }

    /* Add more spacing before Experience heading on mobile */
    .experience-heading {
        margin-top: 2rem !important;
    }

    /* Center profile picture on mobile - compensate for margin note padding */
    .marginnote .profile-pic {
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 50% !important;
    }

    /* Remove left padding from margin note containing profile pic */
    .marginnote:has(.profile-pic) {
        padding-left: 0 !important;
    }

    /* Center name heading on mobile */
    section h2:first-of-type {
        text-align: center;
    }
}

/*******************************************************************************
MIGRATED POST SEMANTICS
*******************************************************************************/

/* Underline the title and section headings on individual blog pages. */
article:has(#post-comments) > section > :is(h2, h3, h4, h5, h6),
article:has(#post-comments) section[role="doc-bibliography"] > h2 {
    text-decoration-line: underline;
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
    text-decoration-thickness: 0.055em;
    text-underline-offset: 0.18em;
    text-decoration-skip-ink: auto;
}

/*
 * Typst nests the post title and section headings one level deeper in the
 * generated HTML. Tufte CSS defines h1-h3 but leaves h4 and h5 at the much
 * smaller browser defaults, so complete the type scale without changing the
 * document's semantic heading hierarchy.
 */
article section > h4 {
    margin-top: 1.9rem;
    margin-bottom: 0.8rem;
    font-size: 1.5rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.25;
}

article section > h5 {
    margin-top: 1.7rem;
    margin-bottom: 0.7rem;
    font-size: 1.4rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.3;
}

/* Preserve the author's distinction between bold importance and italics. */
article strong {
    font-style: normal;
    font-weight: 700;
}

/* ET Book has one bold weight; a small stroke makes its fine numerals and
 * emphasized body text more distinct without changing the typeface. */
article :is(p, li, td, th, blockquote) strong {
    -webkit-text-stroke: 0.02em currentColor;
}

/*******************************************************************************
RESEARCH PAPER WRAPPERS
*******************************************************************************/

/* Give article tables a readable grid while retaining the book typography. */
article section table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 1.1rem;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

article section table :is(th, td) {
    padding: 0.7rem 0.85rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

article section table th {
    background: color-mix(in srgb, currentColor 5%, transparent);
    border-bottom: 2px solid color-mix(in srgb, currentColor 25%, transparent);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

article section table code {
    font-size: 0.85em;
    white-space: normal;
    overflow-wrap: anywhere;
}

article section table th code {
    display: block;
    margin-top: 0.15rem;
}

article section table tbody tr:nth-child(even) {
    background: color-mix(in srgb, currentColor 2.5%, transparent);
}

@media (max-width: 760px) {
    article section table {
        font-size: 1rem;
    }

    article section table :is(th, td) {
        padding: 0.6rem 0.45rem;
    }
}

.research-paper-card {
    box-sizing: border-box;
    width: min(78%, 52rem);
    margin: 0 0 2.5rem;
    padding: 1.3rem 1.45rem 1.4rem;
    border: 1px solid rgba(17, 17, 17, 0.22);
    background:
        linear-gradient(135deg, var(--ramith-blue-soft), transparent 34%),
        var(--ramith-card);
    box-shadow: 3px 4px 0 rgba(17, 17, 17, 0.06);
}

.research-paper-card__eyebrow,
.research-paper-card__authors,
.research-paper-card__venue,
.research-paper-card__summary p {
    width: 100%;
}

.research-paper-card__eyebrow {
    margin: 0 0 0.55rem;
    color: var(--ramith-blue-deep);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.research-paper-card__title {
    margin: 0;
    font-size: 1.55rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.16;
}

.research-paper-card__authors {
    margin: 0.7rem 0 0;
    font-size: 1rem;
    font-style: italic;
    line-height: 1.35;
}

.research-paper-card__venue {
    margin: 0.3rem 0 0;
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
}

.research-paper-card__summary {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--ramith-line);
    font-size: 1rem;
    line-height: 1.45;
}

.research-paper-card__summary p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.45;
}

.research-paper-card__links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1.1rem;
}

.research-paper-card__links a,
.research-paper-card__links a:link,
.research-paper-card__links a:visited {
    padding: 0.38rem 0.62rem;
    border: 1px solid rgba(63, 81, 255, 0.42);
    background: rgba(63, 81, 255, 0.06);
    background-image: none;
    color: var(--ramith-blue-deep);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
    text-shadow: none;
}

.research-paper-card__links a:hover,
.research-paper-card__links a:focus-visible {
    border-color: var(--ramith-blue);
    background: var(--ramith-blue-soft);
    outline: none;
}

@media (prefers-color-scheme: dark) {
    .research-paper-card {
        border-color: rgba(255, 255, 255, 0.18);
        box-shadow: none;
    }

    .research-paper-card__venue {
        color: #aaa;
    }
}

@media (max-width: 760px) {
    .research-paper-card {
        width: 100%;
    }
}

.post-callout,
.post-embed,
.post-link-card {
    box-sizing: border-box;
    width: 55%;
    margin: 1.5rem 0;
}

.post-callout {
    /* Flex items contain floated margin notes, stretching the card to include
       notes that are rendered outside it. Normal flow keeps the card compact. */
    display: block;
    position: relative;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 0.25rem;
    background: rgba(127, 127, 127, 0.08);
}

.post-callout--highlight {
    border-color: rgba(52, 183, 67, 0.35);
    background: rgba(52, 183, 67, 0.1);
}

.post-callout--warning {
    border-color: rgba(209, 46, 46, 0.35);
    background: rgba(209, 46, 46, 0.09);
}

.post-callout__icon {
    position: absolute;
    inset-inline-start: 1.2rem;
    top: 1rem;
    font-size: 1.2rem;
    line-height: 1.65;
}

.post-callout__body {
    min-width: 0;
    font-size: 1.2rem;
    line-height: 1.65;
}

.post-callout__icon + .post-callout__body {
    margin-inline-start: 2rem;
}

.post-callout__body > ul,
.post-callout__body > ol {
    padding-inline-start: 1.25em;
}

.post-callout .marginnote {
    margin-bottom: 0.8rem;
}

.post-callout .marginnote + .footnote-ref::before {
    content: ", ";
}

.post-callout__body p,
.post-callout__body ol,
.post-callout__body ul {
    font-size: inherit;
    line-height: inherit;
}

.post-callout__body > :first-child,
.post-link-card__description:first-child {
    margin-top: 0;
}

.post-callout__body > :last-child,
.post-link-card__description:last-child {
    margin-bottom: 0;
}

.post-embed__frame {
    display: block;
    width: 100%;
    min-height: 22rem;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 0.25rem;
    background: rgba(127, 127, 127, 0.08);
}

.post-embed__fallback {
    width: 100%;
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
}

.post-link-card {
    padding: 1rem 1.2rem;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 0.25rem;
    background: rgba(127, 127, 127, 0.06);
}

.post-link-card__title {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

.post-link-card__description {
    width: 100%;
    margin: 0.4rem 0 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
    .post-link-card__description {
        color: #aaa;
    }
}

@media (max-width: 760px) {
    .post-callout,
    .post-embed,
    .post-link-card {
        width: 100%;
    }

    .post-callout .marginnote {
        box-sizing: border-box;
        width: 100%;
        margin: 0.65rem 0;
        padding-inline-start: 0.8rem;
    }

    .post-callout .marginnote + .footnote-ref::before {
        content: none;
    }
}

/*******************************************************************************
SCHOLARLY POST METADATA AND LICENSING
*******************************************************************************/

.scholarly-post-meta {
    margin: 0 0 1.5rem;
    color: #666;
    font-size: 1rem;
}

.scholarly-post-meta p {
    font-size: inherit;
    line-height: 1.45;
}

.scholarly-post-byline {
    margin: 0;
    font-style: italic;
}

.scholarly-post-doi {
    margin: 0.35rem 0 0;
}

.post-preview-notice {
    width: 55%;
    margin: 0 0 1.5rem;
    padding: 0.75rem 1rem;
    border-left: 4px solid #c78a00;
    background: rgba(255, 193, 7, 0.12);
    color: #6f5100;
}

.post-asset-figure {
    display: flow-root;
    margin: 2rem 0;
}

.post-image-link {
    position: relative;
    background-image: none !important;
    cursor: zoom-in;
    text-shadow: none;
}

.post-image-link--figure,
.post-image-link--preview {
    display: block;
}

.post-image-link--text {
    border-bottom: 1px dotted currentColor;
    font-weight: 600;
    text-decoration: none;
}

.post-image-link--text::after {
    content: "↗";
    margin-left: 0.2em;
    font-size: 0.7em;
    vertical-align: super;
}

.post-image-link:focus-visible {
    border-radius: 0.2rem;
    outline: 3px solid currentColor;
    outline-offset: 4px;
}

.post-asset-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    transition: filter 120ms ease;
}

.post-image-link:hover img {
    filter: brightness(0.92);
}

.post-image-preview {
    margin-top: 0.4rem;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.35;
}

.post-image-preview .post-image-link--preview {
    overflow: hidden;
    width: min(100%, 12rem);
    margin-bottom: 0.45rem;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 0.25rem;
    background: rgba(127, 127, 127, 0.08);
}

.post-image-preview .post-image-link--preview::after {
    content: "Open ↗";
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    padding: 0.15rem 0.35rem;
    border-radius: 0.2rem;
    background: rgba(17, 17, 17, 0.82);
    color: #fff;
    font-family: sans-serif;
    font-size: 0.7rem;
    line-height: 1.2;
}

.post-image-preview img {
    width: 100%;
}

.post-asset-figure figcaption {
    margin-top: 0.6rem;
    color: #666;
    font-size: 0.95rem;
}

.post-asset-figure.fullwidth figcaption {
    float: none;
    clear: both;
    position: static;
    width: min(100%, 72rem);
    max-width: none;
    margin: 0.75rem auto 0;
    line-height: 1.45;
    text-align: center;
}

.ghost-gallery {
    width: 90%;
    max-width: none;
    margin: 2rem 0 3rem;
}

.ghost-gallery__row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: flex-start;
}

.ghost-gallery__image {
    min-width: 0;
}

.ghost-gallery__image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
}

.ghost-gallery > figcaption {
    float: none;
    clear: both;
    width: 100%;
    max-width: none;
    margin: 0.75rem 0 0;
}

@media (max-width: 760px) {
    .ghost-gallery {
        width: 100%;
    }

    .ghost-gallery__row {
        flex-direction: column;
    }

    .ghost-gallery__image {
        flex: none !important;
        width: 100%;
    }
}

.post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.25rem;
    width: 90%;
    margin: 2rem 0 3rem;
}

.post-gallery .post-asset-figure {
    display: flex;
    flex-direction: column;
    width: auto;
    max-width: none;
    margin: 0;
}

.post-gallery .post-image-link {
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 0.25rem;
    background: rgba(127, 127, 127, 0.08);
}

.post-gallery .post-image-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.post-gallery .post-asset-figure figcaption {
    float: none;
    clear: none;
    position: static;
    width: auto;
    max-width: none;
    margin: 0.65rem 0 0;
    line-height: 1.4;
}

.post-image-lightbox {
    max-width: none;
    max-height: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
}

.post-image-lightbox::backdrop {
    background: rgba(0, 0, 0, 0.82);
}

.post-image-lightbox__panel {
    box-sizing: border-box;
    display: flex;
    position: relative;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 96vw;
    max-height: 96vh;
    padding: 1rem;
    border-radius: 0.3rem;
    background: #fffff8;
    color: #111;
}

.post-image-lightbox__image {
    display: block;
    width: auto;
    max-width: 92vw;
    height: auto;
    max-height: 86vh;
    object-fit: contain;
}

.post-image-lightbox__caption {
    width: auto;
    max-width: 70rem;
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    text-align: center;
}

.post-image-lightbox__close {
    position: absolute;
    z-index: 1;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid rgba(127, 127, 127, 0.5);
    border-radius: 50%;
    background: rgba(255, 255, 248, 0.92);
    color: #111;
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    .post-image-preview {
        color: #aaa;
    }

    .post-image-lightbox__panel {
        background: #151515;
        color: #ddd;
    }

    .post-image-lightbox__close {
        background: rgba(21, 21, 21, 0.92);
        color: #ddd;
    }
}

@media (max-width: 760px) {
    .post-image-preview {
        display: none;
    }

    .post-gallery {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .post-gallery .post-image-link {
        aspect-ratio: auto;
    }

    .post-gallery .post-image-link img {
        height: auto;
        object-fit: contain;
    }

    .post-image-lightbox__panel {
        max-width: 100vw;
        max-height: 100vh;
        padding: 0.5rem;
    }
}

/*******************************************************************************
SCHOLARLY ARTICLE INDEX
*******************************************************************************/

.scholarly-articles {
    width: 70%;
    margin: 2rem 0;
    padding: 0;
    list-style: none;
}

.scholarly-article {
    margin: 0;
    padding: 1.4rem 0;
    border-top: 1px solid rgba(127, 127, 127, 0.3);
}

.scholarly-article:last-child {
    border-bottom: 1px solid rgba(127, 127, 127, 0.3);
}

.scholarly-article h3 {
    margin: 0 0 0.35rem;
}

.scholarly-article-meta,
.scholarly-article-doi {
    margin: 0.25rem 0 0;
    color: #666;
    font-size: 0.95rem;
}

.scholarly-license {
    width: 55%;
    margin: 3rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(127, 127, 127, 0.35);
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (max-width: 760px) {
    .scholarly-license,
    .post-preview-notice,
    .scholarly-articles {
        width: 100%;
    }
}

/*******************************************************************************
POST ARCHIVE
*******************************************************************************/

article:has(.posts-index) {
    padding-top: 2.5rem;
}

.posts-index {
    box-sizing: border-box;
    width: min(76%, 62rem);
}

.posts-index > h2 {
    margin: 0 0 0.45rem;
}

.posts-index > p {
    width: min(100%, 42rem);
    margin-top: 0;
    color: #666;
    font-style: italic;
}

.posts-selected {
    box-sizing: border-box;
    width: 100%;
    margin: 2.15rem 0 2.5rem;
    padding: 0.85rem 0 1rem;
    border-top: 1px solid var(--ramith-line);
    border-bottom: 1px solid var(--ramith-line);
}

.posts-selected__heading,
.posts-archive-heading {
    border-top: 1px solid var(--ramith-line);
    color: var(--ramith-blue);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.posts-selected__heading {
    margin-bottom: 0.7rem;
    border: 0;
}

.posts-selected__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.posts-selected__list > p {
    display: contents;
}

.posts-selected__item,
.posts-selected__item:link,
.posts-selected__item:visited {
    position: relative;
    display: flex;
    min-height: 5.2rem;
    flex-direction: column;
    box-sizing: border-box;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.65rem 2rem 0.55rem 0.85rem;
    border-left: 1px solid var(--ramith-line);
    background-image: none;
    color: inherit;
    text-decoration: none;
    text-shadow: none;
}

.posts-selected__item:first-child {
    padding-left: 0;
    border-left: 0;
}

.posts-selected__item:hover,
.posts-selected__item:focus-visible {
    color: var(--ramith-blue-deep);
    outline: none;
}

.posts-selected__item strong {
    font-size: 1.18rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.2;
}

.posts-selected__item > span:last-child {
    position: absolute;
    right: 0.75rem;
    bottom: 0.5rem;
    color: var(--ramith-blue);
}

.posts-selected__kind {
    color: #777;
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.posts-archive-heading {
    margin-bottom: 0.35rem;
    padding-top: 0.7rem;
}

.post-year-group {
    display: grid;
    grid-template-columns: 5.25rem minmax(0, 1fr);
    gap: 1.35rem;
    align-items: start;
    margin-top: 1.9rem;
}

.post-year-group > h3,
.posts-index > h3 {
    margin: 0;
    padding: 0.1rem 0 0;
    color: var(--ramith-blue);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9rem;
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.post-year-count {
    display: block;
    margin-top: 0.28rem;
    color: #888;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.post-year-group > ul,
.posts-index > ul {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.post-year-group > ul > li,
.posts-index > ul > li {
    margin: 0;
    padding: 0;
}

.post-year-group > ul > li > a,
.post-year-group > ul > li > a:link,
.post-year-group > ul > li > a:visited,
.posts-index > ul > li > a,
.posts-index > ul > li > a:link,
.posts-index > ul > li > a:visited {
    display: grid;
    grid-template-columns: 4.2rem minmax(0, 1fr) 1rem;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.68rem 0;
    border-bottom: 1px solid var(--ramith-line);
    background-image: none;
    color: inherit;
    text-decoration: none;
    text-shadow: none;
    transition: color 120ms ease, padding-left 120ms ease;
}

.post-year-group > ul > li:first-child > a {
    padding-top: 0;
}

.post-year-group > ul > li > a:hover,
.post-year-group > ul > li > a:focus-visible,
.posts-index > ul > li > a:hover,
.posts-index > ul > li > a:focus-visible {
    color: var(--ramith-blue-deep);
    outline: none;
}

.post-row-date {
    color: var(--ramith-blue);
    font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.post-row-title {
    min-width: 0;
    font-size: 1.12rem;
    line-height: 1.27;
}

.post-row-arrow {
    color: var(--ramith-blue);
    opacity: 0;
    transition: opacity 120ms ease, transform 120ms ease;
}

.post-year-group > ul > li > a:hover .post-row-arrow,
.post-year-group > ul > li > a:focus-visible .post-row-arrow,
.posts-index > ul > li > a:hover .post-row-arrow,
.posts-index > ul > li > a:focus-visible .post-row-arrow {
    opacity: 1;
    transform: translateX(0.2rem);
}

@media (prefers-color-scheme: dark) {
    :root {
        --ramith-blue: #7d8cff;
        --ramith-blue-deep: #aab3ff;
        --ramith-blue-soft: rgba(125, 140, 255, 0.14);
        --ramith-line: rgba(230, 232, 255, 0.16);
        --ramith-card: rgba(28, 28, 31, 0.9);
    }

    .posts-index > p {
        color: #aaa;
    }

    .posts-selected__kind,
    .post-year-count {
        color: #aaa;
    }

    .featured-card__image {
        background: #111;
    }

    .featured-card,
    .featured-card:link,
    .featured-card:visited,
    .featured-card__image {
        border-color: rgba(255, 255, 255, 0.18);
        box-shadow: none;
    }

    .featured-card__meta {
        color: #aaa;
    }

    .featured-carousel-count {
        color: #aaa;
    }

    .featured-carousel-button {
        border-color: rgba(255, 255, 255, 0.28);
    }
}

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

@media (max-width: 760px) {
    .posts-index,
    .posts-index > p,
    .posts-index > h3,
    .posts-index > ul {
        width: 100%;
    }

    .posts-selected__list {
        grid-template-columns: 1fr;
    }

    .posts-selected__item,
    .posts-selected__item:first-child {
        min-height: 0;
        padding: 0.8rem 2rem 0.8rem 0;
        border-top: 1px solid var(--ramith-line);
        border-left: 0;
    }

    .post-year-group {
        grid-template-columns: 1fr;
        gap: 0.65rem;
        margin-top: 2.1rem;
    }

    .post-year-count {
        display: inline;
        margin-left: 0.55rem;
    }

    .post-year-group > ul > li > a,
    .post-year-group > ul > li > a:link,
    .post-year-group > ul > li > a:visited,
    .posts-index > ul > li > a,
    .posts-index > ul > li > a:link,
    .posts-index > ul > li > a:visited {
        grid-template-columns: 3.8rem minmax(0, 1fr);
        gap: 0.65rem;
    }

    .post-row-arrow {
        display: none;
    }
}

/* Compact linked references, with the same entries used by citation previews. */
.compact-references > ol {
    padding-left: 1.5rem;
}

.compact-references li {
    margin-bottom: 0.8rem;
    line-height: 1.45;
}

/* Reviewed attribution follows the existing figure description and remains
   readable in galleries and Tufted's marginal captions. */
.post-comments[hidden] {
    display: none;
}

.post-comments {
    clear: both;
    border-top: 1px solid #ddd;
    padding: 1.4rem 0 0;
    margin-top: 2rem;
    width: 65%;
}

.post-comments h2 {
    margin: 0 0 1rem;
}

.post-comments > p {
    width: 100%;
    font-size: 1rem;
    line-height: 1.5;
}

.post-comments .utterances {
    width: 100%;
    max-width: 100%;
}

.post-comments .utterances-frame {
    border: 0;
}

.post-comments-links {
    margin-bottom: 0;
}

@media (max-width: 760px) {
    .post-comments { width: 100%; }
}

@media (prefers-color-scheme: dark) {
    .post-comments { border-color: #444; }
}

.image-credit {
    display: block;
    margin-top: 0.45rem;
    line-height: 1.45;
    color: #666;
}
