/*******************************************************************************
CUSTOM STYLES

Add your custom CSS styles here to override or extend the default styles.
*******************************************************************************/


/*******************************************************************************
FULL-WIDTH OVERRIDES
*******************************************************************************/

article {
    --tufted-text-width: 55%;
    --tufted-wide-width: 90%;
    --tufted-margin-gap: 5.5%;
    --tufted-margin-width: 27.5%;
    --tufted-margin-right: 12%;
    --tufted-frame-radius: 10px;
}

article.wide {
    --tufted-text-width: 67%;
    --tufted-wide-width: 90%;
    --tufted-margin-gap: 4%;
    --tufted-margin-width: 25%;
    --tufted-margin-right: 4%;
}

/* Tufte CSS constrains p/ul/ol to 55% — override inside full-width sections */
.fullwidth p,
.fullwidth ul,
.fullwidth ol,
.fullwidth dl {
    width: 100%;
}

/* h1 breathing room on intro pages */
h1 {
    margin-bottom: 2rem;
}

.draft-banner {
    width: var(--tufted-text-width);
    box-sizing: border-box;
    margin: 0 0 1.3rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--theme-paper-border, #d8c9a8);
    border-radius: 6px;
    background-color: color-mix(in srgb, var(--theme-paper-bg, #f8f5ee) 82%, #f0b429 18%);
    color: var(--theme-paper-text, #1f1b16);
    font-family: monospace;
    font-size: 0.95rem;
    line-height: 1.35;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

article.centered .draft-banner {
    width: 100%;
}

.home-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0 1.4rem;
}

.pronunciation-link,
.pronunciation-link:link,
.pronunciation-link:visited,
.pronunciation-link:hover,
.pronunciation-link:focus-visible {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: -0.08em;
    text-decoration: none !important;
    background-image: none !important;
    text-shadow: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

/* h4 as editorial category label (Reinforcement Learning, Computer Vision, etc.)
   Project card h4s are reset below via .project-entry h4 */
.fullwidth h4 {
    font-size: 1.1rem;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(0, 0, 0, 0.45);
    border-top: 1px solid rgba(128, 128, 128, 0.15);
    margin-top: 2.5rem;
    margin-bottom: 1.4rem;
    padding-top: 1rem;
}

/* Keep section dividers aligned with the text column in normal article pages. */
article h3 {
    width: var(--tufted-text-width);
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    left: 0;
}

/* Bibliography citations and backlinks should read like scholarly markers, not normal links. */
a[role="doc-biblioref"],
a[role="doc-biblioref"]:link,
a[role="doc-biblioref"]:visited,
a[role="doc-backlink"],
a[role="doc-backlink"]:link,
a[role="doc-backlink"]:visited,
section[role="doc-bibliography"] .prefix a,
section[role="doc-bibliography"] .prefix a:link,
section[role="doc-bibliography"] .prefix a:visited {
    display: inline-block;
    color: rgba(90, 90, 90, 0.95);
    background-image: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

a[role="doc-biblioref"]:hover,
a[role="doc-biblioref"]:focus-visible,
a[role="doc-backlink"]:hover,
a[role="doc-backlink"]:focus-visible,
section[role="doc-bibliography"] .prefix a:hover,
section[role="doc-bibliography"] .prefix a:focus-visible {
    color: rgba(55, 55, 55, 0.98);
    background-image: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}


/*******************************************************************************
PROJECT PAGES
*******************************************************************************/

/* Project entry card */
.project-entry {
    margin: 0 0 2rem;
    padding: 1.5rem 1.8rem;
    border: 1px solid var(--theme-pre-border);
    border-radius: 6px;
    background-color: var(--theme-pre-bg);
}

.project-entry.draft-entry {
    border-style: dashed;
}

.project-entry > *:first-child {
    margin-top: 0;
}

.project-entry > *:last-child {
    margin-bottom: 0;
}

/* Override Tufte 55% width for text inside cards */
.project-entry p,
.project-entry ul,
.project-entry ol {
    width: 100%;
}

/* Side-by-side layout: text left, video right.
   The media width is computed from the video's intrinsic ratio and capped
   so it stays inside the card even when the text column is tall. */
.project-entry-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.project-entry-text {
    flex: 1 1 0;
    min-width: 0;
}

.project-entry-media {
    flex: 0 0 var(--project-entry-media-width, min(42%, 32rem));
    width: var(--project-entry-media-width, min(42%, 32rem));
    max-width: min(42%, 32rem);
    align-self: center;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid var(--theme-pre-border);
    background-color: var(--theme-pre-bg);
    background-image: var(--project-entry-poster, none);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.project-entry-media video {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0;
    transition: opacity 220ms ease;
}

.project-entry-media.is-ready video {
    opacity: 1;
}

@media (max-width: 760px) {
    .project-entry-layout {
        flex-direction: column-reverse;
    }

    .project-entry-media {
        flex-basis: auto;
        width: 100%;
        max-width: none;
    }

    .project-entry-text {
        min-width: 100%;
    }

    .project-entry-media video {
        width: 100%;
        height: auto;
    }
}

.project-entry h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    padding-top: 0;
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: none;
    letter-spacing: normal;
    color: #111;
    opacity: 1;
    border-top: none;
}

/* Venue / year badge row */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.4rem 0 1rem;
}

.tag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    font-size: 1.1rem;
    line-height: 1.6;
    font-family: monospace;
    font-weight: normal;
    border: 1px solid var(--theme-pre-border);
    border-radius: 3px;
}

.tag.draft-tag {
    border-color: color-mix(in srgb, var(--theme-link) 55%, var(--theme-pre-border));
    color: var(--theme-link);
}

/* Icon-based links row inside a project card */
.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    margin-top: 1rem;
    align-items: center;
    width: 100%;
}

.project-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-size: 1.3rem;
    text-decoration: none !important;
    background-image: none !important;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.project-links a:hover {
    opacity: 0.7;
}

/* SVG icon via CSS mask — inherits currentColor automatically */
.proj-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    background-color: currentColor;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    vertical-align: -0.1em;
    flex-shrink: 0;
}

.icon-project {
    -webkit-mask-image: url('/assets/icons/project-page.svg');
    mask-image: url('/assets/icons/project-page.svg');
}

.icon-paper {
    -webkit-mask-image: url('/assets/icons/paper.svg');
    mask-image: url('/assets/icons/paper.svg');
}

.icon-arxiv {
    -webkit-mask-image: url('/assets/icons/arxiv.svg');
    mask-image: url('/assets/icons/arxiv.svg');
}

.icon-video {
    -webkit-mask-image: url('/assets/icons/video.svg');
    mask-image: url('/assets/icons/video.svg');
}

.icon-arrow-up-right {
    -webkit-mask-image: url('/assets/icons/arrow-up-right.svg');
    mask-image: url('/assets/icons/arrow-up-right.svg');
}

/* Back navigation for project detail pages */
.back-link {
    display: block;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    opacity: 0.65;
    transition: opacity 0.15s ease;
}

.back-link:hover {
    opacity: 1;
}

.back-link a {
    text-decoration: none !important;
    background-image: none !important;
}

/*******************************************************************************
NEWS ENTRIES
*******************************************************************************/

.news-entry {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: 1rem;
    align-items: baseline;
    margin-bottom: 1.2rem;
    line-height: 1.8;
}

.news-date {
    font-size: 1.1rem;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Mono', monospace;
    opacity: 0.5;
    white-space: nowrap;
}

.news-text {
    font-size: 1.4rem;
}

@media (max-width: 760px) {
    .news-entry {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }
}


/*******************************************************************************
PUBLICATION ENTRIES
*******************************************************************************/

/* One publication entry: title / authors / venue on separate lines */
.pub-entry {
    margin-bottom: 1.5rem;
    width: 100%;
    position: relative;
}

.pub-entry > *:last-child {
    margin-bottom: 0;
}

.pub-entry:has(.pub-star)::before {
    content: '';
    position: absolute;
    left: -1.4em;
    top: 0.15em;
    bottom: 0.15em;
    width: 2px;
    background: rgba(180, 130, 0, 0.35);
    border-radius: 1px;
}

.pub-title {
    font-size: 1.4rem;
    line-height: 1.5;
}

.pub-title a,
.pub-title a:link,
.pub-title a:visited {
    background-image: none !important;
    text-shadow: none !important;
    border-bottom: none;
    text-decoration: none !important;
}

.pub-title a:hover {
    text-decoration: underline !important;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.pub-star {
    display: none;
}

.pub-project-link,
.pub-project-link:link,
.pub-project-link:visited {
    display: inline-block;
    margin-left: 0.05em;
    vertical-align: 0.05em;
    color: rgba(0, 0, 0, 0.28) !important;
    background-image: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    line-height: 1;
    transition: color 0.15s ease;
}

.pub-project-link:hover {
    color: rgba(0, 0, 0, 0.8) !important;
}

.pub-project-link .proj-icon {
    width: 1.6em;
    height: 1.6em;
    vertical-align: -0.55em;
}

.pub-authors {
    font-size: 1.2rem;
    margin-top: 0.2rem;
    opacity: 0.7;
}

.pub-venue {
    font-size: 1.2rem;
    font-style: italic;
    margin-top: 0.1rem;
    opacity: 0.7;
}

.venue-spotlight {
    color: #008091;
    font-style: normal;
    font-weight: 600;
}


/*******************************************************************************
CV PAGE
*******************************************************************************/

.cv-page {
    --cv-meta-rail: 18rem;
    --cv-rail-gap: 1.5rem;
    --cv-size-page-title: clamp(2.65rem, 3.6vw, 3.35rem);
    --cv-size-name: clamp(2.25rem, 2.9vw, 2.55rem);
    --cv-size-section: 2rem;
    --cv-size-kicker: 1rem;
    --cv-size-role: 1.26rem;
    --cv-size-contact: 1.08rem;
    --cv-size-summary: 1.22rem;
    --cv-size-note: 1.06rem;
    --cv-size-action: 1.05rem;
    --cv-size-entry-title: 1.36rem;
    --cv-size-entry-subtitle: 1.18rem;
    --cv-size-meta: 1.08rem;
    --cv-size-body: 1.14rem;
    --cv-size-skill: 1.08rem;
    --cv-size-pub-title: 1.36rem;
    --cv-size-pub-meta: 1.1rem;
    width: min(100%, 86rem);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cv-meta-rail);
    column-gap: var(--cv-rail-gap);
    align-items: start;
}

.cv-page p,
.cv-page ul,
.cv-page ol,
.cv-page dl {
    width: 100%;
}

.cv-hero {
    margin-bottom: 1.75rem;
}

.cv-page > h2,
.cv-page > .cv-actions {
    grid-column: 1;
}

.cv-page > .cv-hero {
    grid-column: 1 / -1;
}

.cv-page > .cv-section {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cv-meta-rail);
    column-gap: var(--cv-rail-gap);
    align-items: start;
}

.cv-page > .cv-section + .cv-section {
    margin-top: 3rem;
}

.cv-section-title {
    grid-column: 1 / -1;
    margin: 0 0 1.35rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(128, 128, 128, 0.24);
    font-size: var(--cv-size-section);
    font-weight: 600;
    font-style: italic;
    line-height: 1.15;
    letter-spacing: normal;
}

.cv-section > .cv-entry {
    grid-column: 1 / -1;
}

.cv-section > .cv-publication-list,
.cv-section > .cv-skills {
    grid-column: 1;
}

.cv-page h2,
.cv-page h4 {
    width: 100% !important;
    font-style: normal !important;
    letter-spacing: normal;
}

.cv-page h2 {
    margin-top: 0.4rem;
    margin-bottom: 1.25rem;
    font-size: var(--cv-size-page-title);
    line-height: 1.08;
}

.cv-page h4 {
    margin-top: 1.9rem;
    margin-bottom: 1rem;
    padding-top: 0;
    font-size: var(--cv-size-kicker);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(0, 0, 0, 0.55);
    border-top: none;
}

.cv-name {
    font-size: var(--cv-size-name);
    font-weight: bold;
    line-height: 1.12;
}

.cv-role {
    margin-top: 0.25rem;
    font-size: var(--cv-size-role);
    line-height: 1.35;
    opacity: 0.75;
}

.cv-contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    margin: 1rem 0 1.15rem;
    font-size: var(--cv-size-contact);
    line-height: 1.45;
    opacity: 0.8;
}

.cv-page .cv-contact-row a,
.cv-page .cv-contact-row a:link,
.cv-page .cv-contact-row a:visited,
.cv-page .cv-action,
.cv-page .cv-action:link,
.cv-page .cv-action:visited {
    background-image: none !important;
    text-shadow: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

.cv-page .cv-contact-row span::after {
    content: "•";
    margin-left: 1rem;
    opacity: 0.35;
}

.cv-page .cv-contact-row span:last-child::after {
    content: "";
    margin-left: 0;
}

.cv-summary {
    width: min(100%, 56rem);
    max-width: 56rem;
    margin: 0.9rem 0 0;
    font-size: var(--cv-size-summary);
    line-height: 1.62;
    color: rgba(0, 0, 0, 0.82);
}

.cv-note {
    font-size: var(--cv-size-note);
    line-height: 1.58;
    opacity: 0.7;
}

.cv-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.35rem 0 1.65rem;
}

.cv-page .cv-action,
.cv-page .cv-action:link,
.cv-page .cv-action:visited {
    display: inline-block;
    padding: 0.66rem 1.08rem;
    border: 1px solid rgba(128, 128, 128, 0.35);
    border-radius: 999px;
    background-color: var(--theme-pre-bg);
    font-size: var(--cv-size-action);
    line-height: 1.2;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.cv-action-label {
    display: inline-block;
    font-size: 1em;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.cv-page .cv-action:hover {
    opacity: 0.82;
    transform: translateY(-1px);
    border-color: rgba(128, 128, 128, 0.5);
}

.cv-page .cv-action-secondary,
.cv-page .cv-action-secondary:link,
.cv-page .cv-action-secondary:visited {
    background-color: transparent;
}

.cv-entry {
    padding: 1.1rem 0 1.3rem;
    border-top: none;
}

.cv-section > .cv-entry:first-of-type {
    padding-top: 0.15rem;
}

.cv-entry + .cv-entry {
    margin-top: 0.65rem;
    padding-top: 1.3rem;
    border-top: 1px solid rgba(128, 128, 128, 0.18);
}

.cv-entry-header {
    display: grid;
    gap: 0.28rem;
}

.cv-entry-heading-row,
.cv-entry-subhead-row,
.cv-degree-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cv-meta-rail);
    gap: var(--cv-rail-gap);
    align-items: baseline;
}

.cv-entry-title {
    font-size: var(--cv-size-entry-title);
    font-weight: bold;
    line-height: 1.32;
}

.cv-entry-organization {
    font-size: var(--cv-size-entry-subtitle);
    font-style: italic;
    line-height: 1.4;
    opacity: 0.78;
}

.cv-entry-meta {
    justify-self: stretch;
    text-align: right;
    font-size: var(--cv-size-meta);
    line-height: 1.4;
    opacity: 0.72;
}

.cv-entry-body {
    margin-top: 0.85rem;
}

.cv-body-copy {
    font-size: var(--cv-size-body);
    line-height: 1.58;
}

.cv-entry-list {
    margin: 0;
    padding-left: 1.25rem;
}

.cv-entry-list li + li {
    margin-top: 0.42rem;
}

.cv-degree-row {
    gap: 1.5rem;
}

.cv-degree-row + .cv-degree-row {
    margin-top: 0.34rem;
}

.cv-degree-title {
    font-style: normal;
    font-weight: 500;
}

.cv-degree-dates {
    justify-self: stretch;
    text-align: right;
    white-space: nowrap;
    font-size: 1em;
    opacity: 0.68;
}

.cv-skills {
    display: grid;
    gap: 0.9rem;
    margin-top: 0.55rem;
}

.cv-skill-row {
    display: grid;
    grid-template-columns: minmax(14rem, 18rem) 1fr;
    gap: 1rem;
    padding: 0.95rem 0;
    border-top: none;
}

.cv-skill-row + .cv-skill-row {
    border-top: 1px solid rgba(128, 128, 128, 0.18);
}

.cv-skill-label {
    font-weight: bold;
    font-size: var(--cv-size-skill);
    line-height: 1.4;
}

.cv-skill-value {
    font-size: var(--cv-size-skill);
    line-height: 1.58;
    color: rgba(0, 0, 0, 0.82);
}

.cv-publication-list .pub-entry {
    width: 100%;
    margin-bottom: 1.8rem;
}

.cv-publication-list h4 {
    width: 100% !important;
    max-width: none;
}

.cv-publication-list > h4:first-child {
    margin-top: 0.15rem;
}

.cv-page .pub-title {
    font-size: var(--cv-size-pub-title);
    line-height: 1.42;
}

.cv-page .pub-authors,
.cv-page .pub-venue {
    font-size: var(--cv-size-pub-meta);
    line-height: 1.5;
}

@media (max-width: 760px) {
    .cv-page {
        grid-template-columns: 1fr;
        column-gap: 0;
        --cv-size-page-title: 2.3rem;
        --cv-size-name: 1.95rem;
        --cv-size-section: 1.75rem;
        --cv-size-kicker: 0.9rem;
        --cv-size-role: 1.12rem;
        --cv-size-contact: 1rem;
        --cv-size-summary: 1.08rem;
        --cv-size-note: 1rem;
        --cv-size-action: 1rem;
        --cv-size-entry-title: 1.18rem;
        --cv-size-entry-subtitle: 1.04rem;
        --cv-size-meta: 1rem;
        --cv-size-body: 1.04rem;
        --cv-size-skill: 1.02rem;
        --cv-size-pub-title: 1.16rem;
        --cv-size-pub-meta: 1rem;
    }

    .home-quick-links,
    .cv-actions {
        gap: 0.6rem;
    }

    .cv-entry-heading-row,
    .cv-entry-subhead-row,
    .cv-degree-row,
    .cv-skill-row {
        grid-template-columns: 1fr;
    }

    .cv-entry-meta {
        text-align: left;
    }

    .cv-page .cv-contact-row span::after {
        content: "";
        margin-left: 0;
    }

    .cv-degree-dates {
        text-align: left;
        white-space: normal;
    }
}


/*******************************************************************************
VIDEO EMBED
*******************************************************************************/

/* Responsive 16:9 video embed.
   Uses aspect-ratio (not the padding-bottom hack) because padding-bottom
   percentages are relative to the *containing block* width, not the
   element's own width — so combining width:55% with padding-bottom:56.25%
   produces a ~1:1 box, not 16:9. aspect-ratio avoids this entirely. */
.video-embed {
    position: relative;
    width: var(--tufted-text-width);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    margin: 1.5rem 0;
    border-radius: 4px;
    border: 1px solid var(--theme-pre-border);
    background-color: var(--theme-pre-bg);
}

.video-embed iframe,
.video-embed video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}


/*******************************************************************************
FIGURES
*******************************************************************************/

.content-figure {
    width: var(--tufted-text-width);
    margin: 1.5rem 0;
    box-sizing: border-box;
}

.content-figure > p {
    width: 100%;
    margin: 0;
}

.content-figure > .figure-frame,
.tufted-frame {
    padding: 1rem 1.1rem;
    border: 1px solid var(--theme-paper-border, #d8c9a8);
    border-radius: var(--tufted-frame-radius);
    background-color: var(--theme-paper-bg, #f8f5ee);
    color: var(--theme-paper-text, #1f1b16);
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.content-figure > .figure-frame > *,
.tufted-frame > * {
    display: block;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.content-figure > .figure-frame > p,
.tufted-frame > p {
    width: 100%;
    margin: 0;
}

.content-figure > .figure-frame > img,
.content-figure > .figure-frame > svg,
.tufted-frame > img,
.tufted-frame > svg {
    height: auto;
}

.content-figure > .figure-frame > table,
.content-figure > .figure-frame > pre,
.tufted-frame > table,
.tufted-frame > pre {
    width: 100%;
    left: 0;
    transform: none;
    margin: 0;
}

.content-figure > .figure-frame > table,
.tufted-frame > table {
    display: table;
}

.content-figure > .figure-frame table,
.tufted-frame table {
    color: var(--theme-paper-text, #1f1b16) !important;
    background-color: transparent !important;
}

.content-figure > .figure-frame table tr,
.tufted-frame table tr {
    background-color: transparent !important;
}

.content-figure > .figure-frame table th,
.content-figure > .figure-frame table td,
.tufted-frame table th,
.tufted-frame table td {
    border-color: color-mix(in srgb, var(--theme-paper-border, #d8c9a8) 72%, var(--theme-paper-text, #1f1b16) 28%) !important;
    color: var(--theme-paper-text, #1f1b16) !important;
    background-color: transparent !important;
}

.content-figure > .figure-frame table tr:first-child td,
.content-figure > .figure-frame table th,
.content-figure > .figure-frame table thead td,
.tufted-frame table tr:first-child td,
.tufted-frame table th,
.tufted-frame table thead td {
    background-color: color-mix(in srgb, var(--theme-paper-bg, #f8f5ee) 86%, var(--theme-paper-text, #1f1b16) 14%) !important;
}

.content-figure > .figure-frame table tbody tr:nth-child(even),
.tufted-frame table tbody tr:nth-child(even) {
    background-color: color-mix(in srgb, var(--theme-paper-bg, #f8f5ee) 91%, var(--theme-paper-text, #1f1b16) 9%) !important;
}

.content-figure > .figure-frame table tbody tr:hover,
.tufted-frame table tbody tr:hover {
    background-color: color-mix(in srgb, var(--theme-paper-bg, #f8f5ee) 82%, var(--theme-paper-text, #1f1b16) 18%) !important;
}

.content-figure > .figure-frame > figure[role="math"],
.tufted-frame > figure[role="math"] {
    width: 100%;
    margin: 0;
    padding: 0.35rem 0;
    color: var(--theme-paper-text, #1f1b16);
}

.tufted-framed {
    width: var(--tufted-text-width);
    margin: 1.65rem 0 1.9rem;
    box-sizing: border-box;
}

.tufted-placement-medium {
    width: min(var(--tufted-text-width), 41rem);
}

.tufted-placement-wide {
    width: var(--tufted-wide-width);
}

.tufted-placement-note {
    float: right;
    clear: right;
    width: min(var(--tufted-margin-width), 20rem);
    margin: 0.25rem var(--tufted-margin-right) 1.25rem var(--tufted-margin-gap);
}

.tufted-framed img,
.tufted-framed svg {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    left: 0;
    transform: none;
}

.tufted-framed-table .tufted-frame {
    overflow-x: auto;
    overflow-y: hidden;
}

.tufted-framed-table table {
    width: 100%;
    min-width: 0;
    margin: 0 auto;
    font-size: 1.02rem;
    line-height: 1.25;
}

.tufted-framed-table table td {
    padding: 0.38em 0.48em;
    white-space: nowrap;
    text-align: center;
}

.tufted-framed-table table td:first-child {
    text-align: left;
}

.tufted-framed figcaption {
    display: block;
    float: none !important;
    clear: both !important;
    max-width: none !important;
    margin-top: 0.55rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100%;
    font-size: 1.05rem;
    line-height: 1.45;
    color: color-mix(in srgb, var(--theme-text) 68%, transparent);
}

.tufted-placement-note .tufted-frame {
    padding: 0.55rem;
    border-radius: 8px;
    box-shadow: none;
}

.tufted-placement-note figcaption {
    font-size: 0.9rem;
    line-height: 1.35;
}

@media (max-width: 760px) {
    article,
    article.wide {
        --tufted-text-width: 100%;
        --tufted-wide-width: 100%;
        --tufted-margin-gap: 0;
        --tufted-margin-width: 100%;
        --tufted-margin-right: 0;
    }

    .tufted-framed {
        float: none;
        clear: both;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .tufted-framed-table table {
        font-size: 0.98rem;
    }
}


/*******************************************************************************
THEOREM BOXES
*******************************************************************************/

.theorem-box {
    width: var(--tufted-text-width);
    margin: 1.5rem 0;
    padding: 0.95rem 1.1rem 1rem 1rem;
    border: 1px solid var(--theme-theorem-border, #d8c9bc);
    border-left: 0.45rem solid var(--theme-theorem-accent, #9b7a63);
    border-radius: 10px;
    background-color: var(--theme-theorem-bg, #f4eee7);
    color: var(--theme-theorem-text, #2b231d);
    box-sizing: border-box;
    box-shadow: 0 0.55rem 1.35rem rgba(43, 31, 16, 0.12);
}

.theorem-heading {
    width: 100%;
    margin: 0 0 0.6rem;
    font-size: 1.4rem;
    line-height: 2.2rem;
    font-weight: normal;
    color: var(--theme-theorem-heading, #6d5747);
}

.theorem-heading strong,
.theorem-heading b {
    font-size: 1.4rem;
    font-weight: 700;
}

.theorem-box p,
.theorem-box ul,
.theorem-box ol,
.theorem-box dl {
    width: 100%;
}

.theorem-box figure[role="math"] {
    width: 100%;
    margin: 0.5rem 0;
    padding: 0;
    font-size: 1em;
    line-height: 1.4;
    color: inherit;
}

.theorem-box > *:first-child {
    margin-top: 0;
}

.theorem-box > *:last-child {
    margin-bottom: 0;
}

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

    .content-figure {
        width: 100%;
    }

    .theorem-box {
        width: 100%;
    }
}


/*******************************************************************************
WIDE-COLUMN LAYOUT
Opt in with `wide: true` in the page template call.
Expands the main text column from Tufte's 55% to 67% while keeping the
nav in the standard Tufte position. Suitable for project pages and blog
posts that have no margin notes.
*******************************************************************************/

article.wide p,
article.wide ul,
article.wide ol,
article.wide dl {
    width: var(--tufted-text-width);
}

article.wide pre {
    width: var(--tufted-text-width);
}

article.wide div[style*="border-inline-start"] {
    width: var(--tufted-text-width) !important;
}

article.wide figure[role="math"] {
    width: var(--tufted-text-width);
}

/* left: half of column width, so transform: translateX(-50%) centers it */
article.wide h3 {
    width: var(--tufted-text-width);
    box-sizing: border-box;
    margin-left: 0;
    margin-right: 0;
    left: 0;
}

article.wide section > img,
article.wide section > svg {
    max-width: var(--tufted-text-width);
    left: calc(var(--tufted-text-width) / 2);
}

article.wide section > table {
    left: calc(var(--tufted-text-width) / 2);
}

article.wide .video-embed {
    width: var(--tufted-text-width);
}

article.wide .content-figure {
    width: var(--tufted-text-width);
}

article.wide .theorem-box {
    width: var(--tufted-text-width);
}

/* On mobile, all wide-mode widths collapse to 100% */
@media (max-width: 760px) {
    article.wide p,
    article.wide ul,
    article.wide ol,
    article.wide dl,
    article.wide pre,
    article.wide div[style*="border-inline-start"] {
        width: 100%;
    }

    article.wide .video-embed {
        width: 100%;
    }

    article.wide .content-figure {
        width: 100%;
    }

    article.wide h3 {
        width: 100%;
        box-sizing: border-box;
    }
}
