﻿/* A compact reading layout for the homepage. */
:root {
    color-scheme: light;
    --bg: #fafaf9;
    --bg-elevated: #ffffff;
    --panel: #f1f1ef;
    --panel-strong: #e8e8e5;
    --line: rgba(37, 37, 37, 0.14);
    --line-strong: rgba(37, 37, 37, 0.28);
    --media-border-width: 2px;
    --media-border-colour: #858580;
    --glass-border: rgba(37, 37, 37, 0.14);
    --text: #252525;
    --muted: #60605c;
    --muted-strong: #42423e;
    --accent: #295c83;
    --accent-secondary: #295c83;
    --accent-tertiary: #60605c;
    --accent-soft: rgba(41, 92, 131, 0.07);
    --accent-secondary-soft: rgba(41, 92, 131, 0.07);
    --accent-tertiary-soft: rgba(37, 37, 37, 0.05);
    --accent-tertiary-line: rgba(37, 37, 37, 0.22);
    --card-subtle: rgba(37, 37, 37, 0.025);
    --cool: rgba(41, 92, 131, 0.08);
    --shadow: 0 4px 16px rgba(37, 37, 37, 0.08);
    --max-width: 1080px;
    --font-body: "Segoe UI", Arial, sans-serif;
    --font-display: var(--font-body);
    --header-offset: 76px;
}
html { background: var(--bg); scroll-behavior: auto; }
body { line-height: 1.65; }
.site-header, .site-header.is-condensed {
    background: var(--bg);
    border-bottom-color: var(--line);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.site-header .site-header__inner,
.site-header.is-condensed .site-header__inner {
    padding: 18px 0;
    justify-content: center;
    transition: none;
}
.site-header .site-nav,
.site-header.is-condensed .site-nav { gap: 12px 24px; }
.site-header .site-nav a,
.site-header.is-condensed .site-nav a {
    font-size: 0.85rem;
    font-weight: 400;
}
.site-nav a.active, .site-nav a:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 5px;
}
.site-nav a::after { content: none; }
.section { padding-top: 52px; }
main > .section {
    margin-top: 56px;
    padding-top: 32px;
    box-shadow: inset 0 1px var(--line-strong);
}
.intro-layout + .section { margin-top: 0; }
.section-heading { margin-bottom: 22px; }
h2 { font-size: 1.6rem; line-height: 1.3; }
.intro-layout {
    min-height: 100vh;
    min-height: 100svh;
}
.hero {
    display: block;
    max-width: 480px;
    min-height: 0;
    margin-inline: auto;
    padding-top: 48px;
    padding-bottom: 8px;
}
.hero h1 {
    max-width: none;
    margin-bottom: 16px;
    font-size: clamp(2.2rem, 4vw, 3rem);
    line-height: 1.1;
}
.hero .hero-lede {
    max-width: 65ch;
    margin: 0;
    font-size: 1rem;
    line-height: 1.75;
}
.hero-render {
    width: min(100%, 480px);
    margin: 0 0 20px;
}
.hero .hero-availability { margin-top: 12px; }
.hero-render img {
    height: auto;
    background: transparent;
    box-shadow: none;
}
/* Allow preview borders through the legacy stylesheet's border reset. */
main .media-frame img, main .media-frame video,
.media-lightbox__image, .media-lightbox__video {
    border: var(--media-border-width) solid var(--media-border-colour) !important;
}
.hero-render figcaption {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.6;
}
.hero-render figcaption a, .trail-entry__copy p a {
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 3px;
}
.profile-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 18px;
    font-size: 0.88rem;
}
.profile-links a, .trail-entry h4 a,
.experience-entry a, .archive-list a strong {
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 4px;
}
a:hover { text-decoration-color: currentColor; }
.interests { position: relative; }
.anchor-alias { position: absolute; top: 0; }
.interest-trail {
    display: block;
    align-items: start;
    margin-top: 32px;
    padding-top: 28px;
    box-shadow: inset 0 1px var(--line);
}
.interest-trail__intro {
    margin-bottom: 32px;
}
.interest-trail__intro h3 {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.5;
}
.interest-trail__intro p {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.83rem;
    line-height: 1.75;
}
.interest-timeline, .experience-timeline {
    position: relative;
    min-width: 0;
    list-style: none;
}
.interest-timeline::before, .experience-timeline::before {
    content: "";
    position: absolute;
    top: 11px;
    bottom: 12px;
    left: 48px;
    width: 1px;
    background: var(--line-strong);
}
.interest-timeline__item, .experience-timeline__item {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 24px;
    padding-bottom: 32px;
}
.interest-timeline__item:last-child,
.experience-timeline__item:last-child { padding-bottom: 0; }
.interest-timeline__item::before, .experience-timeline__item::before {
    content: "";
    position: absolute;
    top: 9px;
    left: 45px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 0 5px var(--bg);
}
.interest-timeline__year, .experience-date {
    padding-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.trail-entry { min-width: 0; scroll-margin-top: calc(var(--header-offset) + 20px); }
.trail-entry--with-media {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 22px;
    align-items: start;
}
.trail-entry__copy { min-width: 0; }
.trail-entry__copy > p + p { margin-top: 10px; }
.trail-entry__heading { margin-bottom: 10px; }
.trail-entry h4, .experience-entry h3 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.trail-entry__language, .experience-languages {
    color: var(--muted);
    font-size: 0.78rem;
}
.trail-entry p, .experience-entry > p {
    color: var(--muted-strong);
    font-size: 0.9rem;
    line-height: 1.75;
}
.trail-entry__copy > .text-link { margin-top: 8px; font-size: 0.8rem; }
.trail-media { --media-max-height: 170px; margin: 0; }
.trail-media img, .trail-media video {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: var(--media-max-height);
    align-self: center;
    object-fit: contain;
    object-position: center top;
    background: transparent;
    box-shadow: none;
}
/* Reserve the poster's proportions before video metadata is available. */
.trail-media video {
    width: min(100%, calc((var(--media-max-height) - 2 * var(--media-border-width)) * var(--media-ratio) + 2 * var(--media-border-width)));
    aspect-ratio: auto var(--media-ratio);
}
.trail-gallery {
    display: grid;
    grid-template-columns: var(--gallery-columns, repeat(2, minmax(0, 1fr)));
    gap: 8px;
    align-items: start;
}
.trail-gallery__wide { grid-column: 1 / -1; }
.trail-gallery .trail-media { min-width: 0; }
.trail-gallery .trail-media img, .trail-gallery .trail-media video {
    width: 100%;
    height: auto;
    max-height: none;
    aspect-ratio: auto;
}
.interest-timeline__item--compact { padding-bottom: 20px; }
.trail-entry--compact .trail-entry__heading { margin-bottom: 4px; }
.trail-entry--compact p { font-size: 0.85rem; line-height: 1.65; }
.render-study {
    grid-column: 1 / -1;
    min-width: 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.render-study h5 { font-size: 0.95rem; font-weight: 600; }
.render-study > p { margin-top: 8px; }
.render-comparison { --comparison-split: 50%; margin-top: 14px; }
.render-comparison__images { position: relative; display: grid; gap: 16px; }
.render-comparison .media-frame { min-width: 0; margin: 0; }
.render-comparison img { background: transparent; box-shadow: none; }
.render-comparison figcaption { font-size: 0.8rem; font-weight: 400; }
.render-comparison.is-interactive .render-comparison__images { display: block; }
.render-comparison.is-interactive .render-comparison__before {
    position: absolute;
    inset: 0;
    z-index: 1;
    clip-path: inset(0 calc(100% - var(--comparison-split)) 0 0);
}
.render-comparison.is-interactive figcaption { display: none; }
.render-comparison.is-interactive .render-comparison__images::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--comparison-split);
    width: 2px;
    transform: translateX(-1px);
    background: #ffffff;
    box-shadow: 0 0 2px #252525;
    z-index: 2;
    pointer-events: none;
}
.render-comparison__labels {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.8rem;
}
.render-comparison input[type="range"] {
    display: block;
    width: 100%;
    height: 36px;
    margin: 0;
    accent-color: var(--muted-strong);
    cursor: ew-resize;
}
.render-comparison input:focus-visible { outline: 2px solid var(--muted-strong); outline-offset: 3px; }
.experience-timeline { max-width: 900px; }
.experience-timeline::before { left: 150px; }
.experience-timeline__item {
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 32px;
    padding-bottom: 28px;
}
.experience-timeline__item::before { left: 147px; }
.experience-entry { min-width: 0; }
.experience-entry .experience-company {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.85rem;
}
.experience-entry .experience-languages {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.78rem;
}
.interest-archive {
    margin-top: 28px;
    padding-top: 20px;
    box-shadow: inset 0 1px var(--line);
}
.interest-archive summary {
    width: fit-content;
    color: var(--muted-strong);
    font-size: 0.85rem;
    cursor: pointer;
}
.archive-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 28px;
    margin-top: 16px;
    list-style: none;
}
.archive-list li {
    padding: 12px 0;
    scroll-margin-top: calc(var(--header-offset) + 20px);
}
.archive-list a {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 0;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}
.archive-year, .archive-description { color: var(--muted); font-size: 0.78rem; }
.archive-description { display: block; margin-top: 3px; }
/* Supporting sections use the same type sizes and plain surfaces. */
.journey-card, .tech-stack-panel, .contact-shell,
.hero-summary-link, .contact-links a {
    padding: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: none;
}
.journey-card:hover, .tech-stack-panel:hover, .contact-shell:hover,
.hero-summary-link:hover, .contact-links a:hover { transform: none; }
.journey-card h3, .tech-stack-panel h3 {
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0 0 8px;
}
.journey-meta { text-transform: none; }
.journey-card p, .section-intro, .contact-shell p { font-size: 0.9rem; line-height: 1.75; }
#publications .journey-grid { max-width: 850px; }
#publications h4 { font-size: 1rem; font-weight: 500; line-height: 1.6; }
.journey-grid--publication .journey-card + .journey-card {
    padding-top: 24px;
    box-shadow: inset 0 1px var(--line);
}
.education-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px 24px;
    margin-bottom: 14px;
}
.education-heading h3, .education-heading .journey-meta { margin: 0; }
.journey-card--education > h4 {
    margin-bottom: 6px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}
.education-proofs {
    margin-top: 24px;
    padding-top: 20px;
    box-shadow: inset 0 1px var(--line);
}
.education-proofs h4 { margin-bottom: 8px; font-size: 1rem; font-weight: 600; }
.proof-list { margin-top: 20px; list-style: none; }
.proof-list > li { min-width: 0; padding: 16px 0; }
.proof-list li:first-child { padding-top: 0; }
.proof-list li:last-child { padding-bottom: 0; }
.proof-list li + li { box-shadow: inset 0 1px var(--line); }
.proof-heading {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 20px;
    padding-right: 28px;
    cursor: pointer;
    list-style: none;
}
.proof-heading::-webkit-details-marker { display: none; }
.proof-heading::after {
    content: "+";
    position: absolute;
    top: 0;
    right: 0;
    color: var(--muted);
}
.proof-details[open] > .proof-heading::after { content: "−"; }
.proof-heading h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}
.proof-meta { color: var(--muted); font-size: 0.78rem; }
.proof-body { max-width: 78ch; margin-top: 16px; font-size: 0.9rem; }
.proof-body p { margin-top: 12px; font-size: inherit; }
.proof-body > .proof-note { margin-top: 0; margin-bottom: 16px; color: var(--muted); }
.proof-body strong { color: var(--text); font-weight: 600; }
.education-proofs mjx-container svg { display: inline-block; max-width: none; }
.proof-equation { max-width: 100%; overflow-x: auto; color: var(--text); }
.proof-equation mjx-container[display="true"] { margin: 1em 0; }
.proof-inline-equation {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    vertical-align: middle;
}
.problem-code {
    max-width: 100%;
    margin: 16px 0;
    overflow-x: auto;
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.7;
}
.problem-results {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-top: 20px;
}
.problem-results .media-frame { margin: 0; }
.problem-results .media-frame img {
    width: 100%;
    height: auto;
    box-shadow: none;
    background: transparent;
}
.problem-results figcaption { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 600px) {
    .problem-results { grid-template-columns: 1fr; }
}
.hero-summary-link { min-height: 0; padding: 8px 0; }
.hero-summary-link > span:first-child {
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--line-strong);
}
.hero-summary-link small { font-size: 0.83rem; }
.skills-list {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 8px 20px;
    font-size: 0.9rem;
}
.skills-list dt { color: var(--text); }
.skills-list dd { color: var(--muted); }
.hobbies-grid, .hobbies-columns { gap: 32px; }
.hobby-card, .hobby-card__copy { gap: 10px; }
.hobby-card__footer { padding-top: 0; }
.hobby-media-grid img, .hobby-media-grid video {
    width: 100%;
    height: auto;
    object-fit: contain;
    box-shadow: none;
    background: transparent;
}
.text-link {
    font-size: 0.85rem;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--line-strong);
}
.media-lightbox { background: rgba(250, 250, 249, 0.96); }
.media-lightbox__image, .media-lightbox__video {
    background: transparent;
    box-shadow: none;
}
.media-lightbox__close {
    background: var(--bg);
    color: var(--text);
}
.contact-shell { grid-template-columns: 1fr; gap: 14px; }
.contact-shell h2 { margin-bottom: 12px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.contact-links a {
    min-height: 0;
    width: auto;
    font-size: 0.85rem;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 4px;
}
a:focus-visible, summary:focus-visible,
.media-frame .is-expandable-media:focus-visible {
    outline: 2px solid var(--muted-strong);
    outline-offset: 4px;
}
@media (min-width: 1000px) {
    .intro-layout {
        display: grid;
        width: min(100%, 1016px);
        margin-inline: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-areas: "intro experience";
        gap: 56px;
        align-items: start;
        align-content: center;
        padding: 48px 0;
    }
    .intro-layout > .section { min-width: 0; padding: 0; }
    .intro-layout > .hero { grid-area: intro; width: 100%; }
    .intro-layout > .experience { grid-area: experience; }
    .intro-layout .experience-timeline::before { left: 4px; }
    .intro-layout .experience-timeline__item {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        padding-left: 24px;
    }
    .intro-layout .experience-timeline__item::before { left: 1px; }
}
@media (max-width: 1120px) {
    .trail-entry--with-media { grid-template-columns: minmax(0, 1fr) 230px; gap: 20px; }
}
@media (max-width: 860px) {
    .site-header .site-header__inner,
    .site-header.is-condensed .site-header__inner {
        padding: 10px 0;
        justify-content: flex-end;
    }
    .site-header .menu-toggle,
    .site-header.is-condensed .menu-toggle {
        width: 48px;
        height: 48px;
        background: transparent;
    }
    .site-nav {
        background: var(--bg);
        box-shadow: var(--shadow);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .archive-list { grid-template-columns: 1fr; }
    .experience-timeline::before { left: 120px; }
    .experience-timeline__item { grid-template-columns: 120px minmax(0, 1fr); gap: 24px; }
    .experience-timeline__item::before { left: 117px; }
    html:not(.js-enabled) .site-header { position: static; }
    html:not(.js-enabled) .site-header__inner { flex-wrap: wrap; }
    html:not(.js-enabled) .menu-toggle { display: none; }
    html:not(.js-enabled) .site-nav {
        position: static;
        flex-direction: row;
        padding: 0;
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}
@media (max-width: 560px) {
    .hero { padding-top: 28px; }
    .section { padding-top: 40px; }
    main > .section { margin-top: 40px; padding-top: 24px; }
    .intro-layout + .section { margin-top: 0; }
    .interest-timeline::before, .experience-timeline::before { left: 4px; }
    .interest-timeline__item, .experience-timeline__item {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding-left: 24px;
    }
    .interest-timeline__item::before, .experience-timeline__item::before { left: 1px; }
    .trail-entry--with-media { grid-template-columns: 1fr; gap: 16px; }
    .trail-entry > .trail-media, .trail-entry > .trail-gallery { width: min(100%, 320px); }
    .trail-media { --media-max-height: 185px; }
    .trail-media img, .trail-media video { align-self: flex-start; object-position: left top; }
    .skills-list { grid-template-columns: 75px minmax(0, 1fr); gap: 10px 16px; }
    .hobby-media-grid--rendering, .hobby-media-grid--badminton { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
