/* ==========================================================================
   columns.css — the index (About, Projects, Blog, footer), the project
   column (every game, stacked) and the blog column (every post, stacked).
   Picking a game or a post slides its column in from the right; Back or
   Projects in the header slides back to the index.

   Every rule is scoped to .hasColumns, which js/columns.js adds to <html>.
   Without JS the columns are plain blocks and the page stacks as before.
   Loaded after scroll.css.
   ========================================================================== */

:root {
    --columnSlide: 450ms;
}

/* The columns scroll, not the page. */
.hasColumns,
.hasColumns body {
    height: 100%;
    overflow: hidden;
}

/* Fills the window under the fixed header (#header is z-index 2). */
.hasColumns .columns {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    /* clip, where supported, also stops the browser's jump-to-#anchor from
       scrolling this strip sideways to reach the off-screen column. */
    overflow: clip;
    z-index: 1;
}

/* Set in index.html when the URL has a #spot; cleared by columns.js. */
.columnsHold .columns {
    visibility: hidden;
}

/* Each column is its own vertical scroller, a full window wide. */
.hasColumns .column {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: none;    /* no bounce past the top or bottom */
    -webkit-overflow-scrolling: touch;
    transition: transform var(--columnSlide) cubic-bezier(0.4, 0, 0.2, 1);
}

/* The index sits in view; the side columns (projects, blog) wait off to
   the right and slide in over it. Going from one side column straight to
   the other, the old one slides out to the left (isLeaving), then jumps
   back to the right with no transition once it's out of sight.

   At rest the visible column has transform: none, not translateX(0).
   A transformed ancestor would trap the phone screenshot gallery
   (position: fixed) inside the column instead of the window. */
.hasColumns #indexColumn {
    transform: none;
}
.hasColumns .sideColumn {
    transform: translateX(100%);
}
.hasColumns .columns.showSide #indexColumn {
    transform: translateX(-100%);
}
.hasColumns .sideColumn.isActive {
    transform: none;
}
.hasColumns .sideColumn.isLeaving {
    transform: translateX(-100%);
}
.hasColumns .sideColumn.noTransition {
    transition: none;
}

/* Jumps that shouldn't animate (deep links on load), and the first paint
   (columnsLoading is set in index.html and cleared by columns.js). */
.hasColumns .columns.noSlide .column,
.columnsLoading .column {
    transition: none;
}

/* Room after the last game or post. */
.hasColumns .sideColumn {
    padding-bottom: 80px;
    box-sizing: border-box;
}

/* Focus lands on a section when it opens; no ring for that. */
.hasColumns .gameSection:focus,
.hasColumns .blogPost:focus {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .hasColumns .column {
        transition: none;
    }
}

@media print {
    .hasColumns,
    .hasColumns body {
        height: auto;
        overflow: visible;
    }
    .hasColumns .columns,
    .hasColumns .column {
        position: static;
        overflow: visible;
        transform: none;
        height: auto;
    }
}
