* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --panel-width: 30vw;
    --gap: 30px;
    --radius: 12px;

    /* Calculated grid dimensions */
    --grid-width: calc(100vw - var(--panel-width) - var(--gap));
    --col-width: calc((var(--grid-width) - var(--gap)) / 2);

    /* Item heights from aspect ratios */
    --wide-height: calc(var(--grid-width) * 9 / 16);
    --tall-height: calc(var(--col-width) * 16 / 9);
    --stacked-height: calc((var(--tall-height) - var(--gap)) / 2);
}

body {
    font-family: "Stack Sans Text", sans-serif;
    -webkit-font-smoothing: antialiased;
    background: #fff;
    overflow: hidden;
    height: 100vh;
}

body.is-locked {
    overflow: hidden !important;
}

/* ─── Left panel ─── */

.panel {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--panel-width);
    height: 100vh;
    padding: var(--gap);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 10;
    background: #fff;
}

.panel__default {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel.is-hovering .panel__default {
    display: none;
}

.panel__title {
    font-size: clamp(28px, 2.5vw, 42px);
    font-family: "new-spirit", serif;
    font-weight: 700;
    font-style: normal;
    line-height: 1.1;
    color: #111;
}

.panel__intro {
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.5;
    color: #111;
}

/* Bio paragraph (hidden by default) */

.panel__bio {
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.5;
    color: #444;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.4s ease;
    margin-top: 0;
}

.panel__bio.is-open {
    max-height: 350px;
    opacity: 1;
    margin-top: 4px;
}

.panel__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn {
    font-family: "Stack Sans Text", sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid #ddd;
    background: #fff;
    color: #111;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn:hover {
    border-color: #999;
}

.btn--copy {
    background: #111;
    color: #fff;
    border-color: #111;
    min-width: var(--copy-btn-width, auto);
    justify-content: center;
}

.btn--copy:hover {
    background: #333;
    border-color: #333;
}

/* Info button icon swap */

.btn__icon {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.btn__icon--close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.btn--info {
    position: relative;
}

.btn--info.is-open .btn__icon--plus {
    opacity: 0;
    transform: rotate(90deg);
}

.btn--info.is-open .btn__icon--close {
    position: static;
    opacity: 1;
    transform: rotate(0deg);
}

.btn--info.is-open .btn__icon--plus {
    position: absolute;
}

/* ─── Hover panel (dark card) ─── */

.panel__hover {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #111;
    color: #fff;
    border-radius: var(--radius);
    padding: var(--gap);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    position: absolute;
    top: var(--gap);
    left: var(--gap);
    right: var(--gap);
    bottom: var(--gap);
}

.panel.is-hovering .panel__hover {
    opacity: 1;
    pointer-events: auto;
}

.panel__hover-body {
    display: flex;
    flex-direction: column;
}

.panel__desc {
    font-size: clamp(14px, 1.1vw, 16px);
    line-height: 1.6;
    opacity: 0.9;
    white-space: pre-line;
}

.panel__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.panel__tag {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

.panel__hover-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.panel__logo {
    display: block;
    height: clamp(60px, 5vw, 80px);
    width: auto;
}

.panel__year {
    font-size: 13px;
    opacity: 0.5;
}

/* ─── Scroll container ─── */

.scroll-container {
    margin-left: var(--panel-width);
    height: 100vh;
    overflow-y: scroll;
    scroll-behavior: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-container::-webkit-scrollbar {
    display: none;
}

/* ─── Grid ─── */

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: auto;
    gap: var(--gap);
    padding: var(--gap);
    padding-left: 0;
}

.grid + .grid {
    margin-top: calc(-1 * var(--gap));
}

/* ─── Grid item types ─── */

.grid__item {
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: opacity 0.25s ease;
    background: #fff;
}

.grid.is-dimmed .grid__item {
    opacity: 0;
}

.grid.is-dimmed .grid__item.is-highlighted {
    opacity: 1;
}

/* Wide: spans 2 columns, 16:9 */
.grid__item--wide {
    grid-column: 1 / -1;
    height: var(--wide-height);
}

/* Tall: spans 2 rows, 9:16 */
.grid__item--tall {
    grid-row: span 2;
    height: var(--tall-height);
}

/* Side-by-side: same height as stacked items */
.grid__item--side {
    height: var(--stacked-height);
}

/* Stacked: no explicit height, stretches to fill rows sized by tall items */

.grid__label {
    font-size: clamp(14px, 1.2vw, 18px);
    font-weight: 500;
    color: #111;
    pointer-events: none;
    user-select: none;
}

.grid__label--light {
    color: #fff;
}

/* ─── Plus button ─── */

.grid__plus {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.grid__plus:hover,
.grid__plus.is-active {
    background: rgba(0, 0, 0, 0.4);
}

.grid__plus-icon {
    transition: opacity 0.25s ease, transform 0.25s ease;
    position: absolute;
}

.grid__plus-icon--close {
    opacity: 0;
    transform: rotate(-90deg);
}

.grid__plus.is-active .grid__plus-icon--plus {
    opacity: 0;
    transform: rotate(90deg);
}

.grid__plus.is-active .grid__plus-icon--close {
    opacity: 1;
    transform: rotate(0deg);
}

/* ─── Responsive ─── */

@media (max-width: 1024px) {
    :root {
        --panel-width: 0px;
        --grid-width: calc(100vw - 2 * var(--gap));
    }

    body {
        overflow: auto;
        height: auto;
    }

    .panel {
        position: relative;
        width: 100%;
        height: auto;
        padding: var(--gap);
        padding-bottom: 0;
    }

    /* Override base absolute positioning for mobile overlay */
    .panel__hover {
        position: fixed;
        top: var(--gap);
        left: var(--gap);
        right: var(--gap);
        bottom: var(--gap);
        z-index: 100;
    }

    /* Keep default content visible when not hovering */
    .panel__default {
        position: relative;
        z-index: 1;
    }

    .scroll-container {
        margin-left: 0;
        height: auto;
        overflow: visible;
    }

    .grid {
        padding-left: var(--gap);
    }
}

@media (max-width: 600px) {
    :root {
        --gap: 24px;
        --radius: 16px;
        --grid-width: calc(100vw - 2 * var(--gap));
    }

    .grid__label {
        font-size: 12px;
    }
}

/* EXTRA */
.fullsize {
    position:absolute;
    right:0;
    bottom:0;
    width:100%;
    height:100%;
}
video {
    object-fit: cover;
}
