/* Theme tokens */
:root {
    color-scheme: light;
    font-family: "Inter", "Hiragino Sans", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #f5f5f7;
    --text: #111;
    --muted: #6b6b76;
    --card: #fff;
    --border: rgba(17, 17, 17, 0.08);
    --accent: #ff7a18;
    --slide-card-gutter: clamp(0.75rem, 4vw, 1.5rem);
}

@media (min-width: 960px) and (prefers-color-scheme: dark) {
    :root {
        color-scheme: light dark;
        --bg: #050505;
        --text: #fafafa;
        --muted: #9c9cac;
        --card: #141414;
        --border: rgba(250, 250, 250, 0.08);
    }
}

/* Base elements */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

h1 {
    font-size: 1.5rem;
}

h2,
h3 {
    font-size: 1.125rem;
}

@media (min-width: 960px) {
    h1 {
        font-size: 2rem;
    }

    h2,
    h3 {
        font-size: 1.5rem;
    }
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

code {
    font-size: 0.9rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.08);
}

.section-heading {
    width: 100%;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* Page layout */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 2.5rem clamp(1rem, 4vw, 4rem);
}

.site-header__emblem {
    width: clamp(40px, 8vw, 80px);
    flex-shrink: 0;
}

.site-header__emblem img {
    width: 100%;
}

.carousel-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(0.5rem, 2vw, 2rem) clamp(1rem, 2vw, 2rem);
}

.content-section {
    padding: clamp(0.5rem, 2vw, 1.5rem) 0 clamp(2rem, 3vw, 2.5rem);
}

.content-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto clamp(2rem, 4vw, 3rem);
    padding: 0 clamp(1rem, 4vw, 4rem);
}

.content-block p {
    margin: 0;
}

.content-block p + p {
    margin-top: 0.5rem;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.profile-links__row {
    display: grid;
    grid-template-columns: minmax(60px, 120px) 1fr;
    gap: 0.75rem;
    align-items: baseline;
}

.profile-links dt {
    margin: 0;
    font-weight: 600;
    color: var(--text);
}

.profile-links dd {
    margin: 0;
    color: var(--muted);
}

.publication-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
}

.content-section a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: color 200ms ease;
}

.content-section a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.publication-list span {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.footer-note {
    max-width: 1200px;
    margin: clamp(2rem, 4vw, 3rem) auto 0;
    padding: 0 clamp(1rem, 4vw, 4rem);
    font-size: 0.9rem;
    color: var(--muted);
}

/* Carousel */
.carousel-container {
    position: relative;
    padding: 0 0 1rem;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.carousel-page {
    display: flex;
    gap: 0;
    flex: 0 0 auto;
    padding: 0;
    scroll-snap-align: none;
}

.carousel-page .slide-card {
    flex: 0 0 calc(100vw - (2 * var(--slide-card-gutter)));
    margin: 0 var(--slide-card-gutter);
    padding: 0;
    box-sizing: border-box;
    scroll-snap-align: start;
}

@media (min-width: 960px) {
    .carousel-page {
        flex: 0 0 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 280px));
        gap: 1.5rem;
        justify-content: center;
        align-items: flex-start;
        padding: 0 clamp(1rem, 4vw, 4rem);
        scroll-snap-align: start;
    }

    .carousel-page .slide-card {
        flex: none;
        margin: 0;
        padding: 0;
        scroll-snap-align: none;
    }
}

.carousel-nav {
    position: absolute;
    top: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%);
    transition: background 150ms ease, transform 150ms ease;
}

.carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.carousel-nav:disabled {
    opacity: 0.15;
    pointer-events: none;
}

.carousel-nav--prev {
    left: 0.5rem;
}

.carousel-nav--next {
    right: 0.5rem;
}

@media (min-width: 960px) {
    .carousel-nav--prev {
        left: 1rem;
    }

    .carousel-nav--next {
        right: 1rem;
    }
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 0 0;
}

.carousel-dot {
    width: 0.5rem;
    height: 0.5rem;
    border: none;
    border-radius: 50%;
    padding: 0;
    background: var(--border);
    cursor: pointer;
    transition: background 200ms ease, transform 200ms ease;
}

.carousel-dot:hover {
    background: var(--muted);
    transform: scale(1.2);
}

.carousel-dot.is-active {
    background: var(--accent);
    transform: scale(1.3);
}

/* Slide cards */
.slide-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    background: var(--card);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    transition: translate 150ms ease, box-shadow 150ms ease;
}

.slide-card:hover {
    translate: 0 -4px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

.slide-card__cover {
    padding: 0.75rem;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.2));
}

.slide-card__cover img {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.slide-card__cover--16-9 img {
}

.slide-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
}

.slide-card__title {
    margin: 0;
}

.slide-card__link {
    display: inline-flex;
    color: inherit;
    text-decoration: none;
}

.slide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
    color: var(--muted);
    font-size: 0.9rem;
}

.breadcrumbs {
    margin: 0;
}

.breadcrumbs a {
    color: var(--muted);
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.4rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.button--ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

.button--icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
}

.button--icon svg {
    flex-shrink: 0;
}

/* Slide detail */
.slide-detail-header {
    padding: 1rem clamp(1rem, 4vw, 4rem) 0.5rem;
    text-align: center;
}

.slide-detail-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.deck-viewer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 clamp(1rem, 4vw, 4rem) 2rem;
}

.viewer-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50vh;
    margin: 0 auto;
}

.viewer-stage figure {
    display: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

.viewer-stage figure.is-active {
    display: block;
}

.viewer-stage img {
    width: 100%;
    height: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    background: #fff;
}

.viewer-stage figcaption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

.viewer-nav {
    position: absolute;
    top: 80%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: background 150ms ease, transform 150ms ease;
}

.viewer-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.viewer-nav__icon {
    pointer-events: none;
}

.viewer-nav[aria-disabled="true"] {
    opacity: 0.15;
    pointer-events: none;
}

.viewer-nav--prev {
    left: 0.5rem;
}

.viewer-nav--next {
    right: 0.5rem;
}

.viewer-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.viewer-progress__bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--border);
}

.viewer-progress__bar-fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 200ms ease;
}

.viewer-progress__label {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.slide-metadata {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.slide-metadata__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.slide-description {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.slide-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (min-width: 960px) {
    .slide-detail-header h1 {
        font-size: 1.75rem;
    }

    .deck-viewer {
        gap: 1.5rem;
        padding-bottom: 4rem;
    }

    .viewer-stage {
        min-height: min(80vh, 1200px);
        width: 70%;
    }

    .viewer-stage figure {
        padding: clamp(0.5rem, 2vw, 1.5rem);
    }

    .viewer-nav {
        top: 50%;
    }

    .viewer-nav--prev {
        left: -2rem;
    }

    .viewer-nav--next {
        right: -2rem;
    }

    .slide-metadata {
        gap: 1rem;
        margin-top: 2rem;
        padding-top: 2rem;
    }
}
