* {
  box-sizing: border-box;
}

:root {
    --nice-grey: #6A6A6A;
    --highlight: #599FA1;
    --color-3: #f9d977;
    --menu-w: 300px;
    --toggle-inset: 12px;
    --toggle-size: 44px;
    --toggle-clear: calc(var(--toggle-inset) * 2 + var(--toggle-size));
    --pan-duration: 0.3s;
    --fonts: 'Gill Sans', 'Gill Sans MT', Seravek, Optima,
             Candara, Corbel, Calibri, 'Trebuchet MS',
             'DejaVu Sans', sans-serif;
}

body{
    margin: 0;
}

#dotsBg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

.bg-icon {
    position: absolute;
    right: 5px;
    top: 10px;
    width: 25%;
    min-width: 250px;
}

.no-animate {
    transition: none !important;
}

#solidIcon {
    z-index: 1;
    mix-blend-mode: normal;
}

#overlayIcon {
    mix-blend-mode: soft-light;
    z-index: 3;
}

/* the hamburger and the tap-to-close scrim only exist in the mobile layout */
#menu-toggle,
#menu-scrim {
    display: none;
}

.layout {
    display: grid;
    grid-template-columns: var(--menu-w) 1fr;
    align-items: center;
    height: 100vh;
}

.menu {
    position: relative;
    grid-column: 1/2;
    width: var(--menu-w);
    height: 555px;
    overflow:visible;
    z-index: 99;
}

.box {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--menu-w);
    height: 100px;
    background-color: var(--nice-grey);
    transition: top 0.25s, left 0.25s;
    transition-timing-function: linear;
    transform: translateX(-45px);
    clip-path: polygon(0% 0%, 93% 0%, 100% 15%, 100% 85%, 93% 100%, 0% 100%, 0% 100%, 0% 0%);
}

.active {
    .menu-content {
        background-color: var(--highlight);
    }
}

.menu-content {
    width: 100%;
    height: 100%;
    background-color: var(--nice-grey);
    /* background: linear-gradient(90deg,rgba(249, 217, 119, 1) 10%, rgba(36, 36, 36, 1) 50%); */
    /* clip-path: polygon(0% 4%, 93% 4%, 98.5% 16%, 98.5% 84%, 93% 96%, 0% 96%, 0% 96%, 0% 4%);   */
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    .page-title {
        font-family: var(--fonts);
        font-weight: bold;
        font-size: 2rem;
        color: white;
        pointer-events: none;
    }
}

.content {
    background-color: var(--highlight);
    overflow: scroll;
    grid-column: 2/3;
    flex-grow: 2;
    height: 555px;
    width: 100%;
    clip-path: polygon(1% 0%, 100% 0%, 100% 30%, 100% 70%, 100% 100%, 1% 100%, 0% 98%, 0% 2%);
    color: white;
    font-family: var(--fonts);
    z-index: 2;
    padding-left: 15px;
    
    h1 {
        font-size: 2.5em;
        margin-top: 15px;
        margin-bottom: 10px;
    }

    h2 {
        font-size: 2em;
    }

    h3 {
        font-size: 1.5em;
    }

    p, li {
        font-size: 1.25em;
    }

    img, video, object, iframe {
        max-width: 100%;
    }

    /* YouTube's embed markup carries width="560" height="315"; capping the width
       above would otherwise letterbox, so let the height follow the 16:9 ratio
       instead of the attribute. */
    iframe {
        aspect-ratio: 16 / 9;
        height: auto;
    }

    .img-row {
        display: flex;
        align-items: flex-start;
        gap: 12px;
    }

    .img-row img {
        min-width: 0; /* flex items floor at their intrinsic width without this */
    }
}

/* MOBILE LAYOUT
   The grid gets wider than the screen (menu column + a full-viewport content column) and
   is translated left by the menu width, so the content fills the screen and the menu waits
   just off-frame. Adding .menu-open to the body pans back to 0, like a camera move.
   Breakpoint must stay in sync with the matchMedia call in index.jsx. */
@media (max-width: 768px) {
    /* set on both elements: body's overflow only propagates to the viewport while the
       root element is still `visible`. This is what kills the horizontal scroll. */
    html, body {
        overflow: hidden;
        position: relative;
    }

    .layout {
        position: relative; /* containing block for #menu-scrim */
        z-index: 2; /* the transform below makes .layout a stacking context, so it now
                       competes with the bg icons as a whole: this keeps the paint order
                       dots(0) -> #solidIcon(1) -> layout -> #overlayIcon(3) */
        width: calc(100vw + var(--menu-w));
        height: 100vh;
        height: 100dvh; /* dvh tracks iOS Safari's collapsing toolbar */
        transform: translateX(calc(-1 * var(--menu-w)));
        transition: transform var(--pan-duration) ease-in-out;
    }

    /* the icon is anchored to the right of the viewport, which is already where the
       content pane sits when closed, so it starts put and travels with the pan */
    .bg-icon {
        transition: transform var(--pan-duration) ease-in-out;
    }

    body.menu-open .layout {
        transform: translateX(0);
    }

    body.menu-open .bg-icon {
        transform: translateX(var(--menu-w));
    }

    .content {
        height:  calc(100vh - 125px);
        height: calc(100dvh - 125px);
        margin-left: 12px;
        overflow-x: hidden;
        overflow-y: auto;
        padding-right: 15px;
        padding-top: 25px;
        overflow-wrap: break-word;
        clip-path: polygon(5% 0%, 100% 0%, 100% 30%, 100% 70%, 100% 100%, 5% 100%, 0% 95%, 0% 5%);

        /* no room for a row at portrait widths */
        .img-row {
            flex-direction: column;
        }
    }

    /* this copy talks about the left-hand menu and the arrow keys */
    #desktopControls {
        display: none;
    }

    #menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 6px;
        position: fixed; /* stays put while the layout pans beneath it */
        top: var(--toggle-inset);
        left: var(--toggle-inset);
        z-index: 100;
        width: var(--toggle-size);
        height: var(--toggle-size);
        padding: 10px;
        border: none;
        background: var(--nice-grey);
        cursor: pointer;

        .bar {
            display: block;
            width: 100%;
            height: 3px;
            background-color: white;
            transition: transform var(--pan-duration) ease,
                        opacity var(--pan-duration) ease;
        }
    }

    /* the three bars collapse into an X while open */
    body.menu-open #menu-toggle {
        .bar:nth-child(1) {
            transform: translateY(9px) rotate(45deg);
        }

        .bar:nth-child(2) {
            opacity: 0;
        }

        .bar:nth-child(3) {
            transform: translateY(-9px) rotate(-45deg);
        }
    }

    /* covers the content column so tapping the visible sliver pans back instead of
       activating a link inside the content */
    #menu-scrim {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: var(--menu-w);
        z-index: 50; /* above .content (2), below .menu (99) */
        background: transparent;
    }

    body:not(.menu-open) #menu-scrim {
        display: none;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    html, body {
        overflow-x: hidden;
        overflow-y: scroll;
    }
    .layout {
        align-items: start;
    }

    .menu,
    .content {
        margin-top: var(--toggle-clear);
    }

    .menu {
        overflow: hidden;
    }

    #dotsBg {
        position: fixed;
    }

    .content {
        padding-top: 0;
        height: calc(100% - var(--toggle-clear) - var(--toggle-inset));
        height: calc(100% - var(--toggle-clear) - var(--toggle-inset));

        /* rotated back into landscape, there is width for the pair again */
        .img-row {
            flex-direction: row;
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .layout,
    .bg-icon,
    #menu-toggle .bar {
        transition: none;
    }
}