/* --------------------------------------------------
   BASIC SETUP
-------------------------------------------------- */

:root {
    --page-padding: 5vw;
    --text-offset: 80px;
    --text-width: 680px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #f8f8f5;
    color: #222;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.6;
    overflow-x: hidden;
}

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


/* --------------------------------------------------
   HEADER
-------------------------------------------------- */

.site-header {
    width: 100%;
    padding: 28px 5vw;

    display: flex;
    justify-content: space-between;
    align-items: baseline;

    border-bottom: 1px solid #d8d8d3;
}

.site-name {
    color: #222;
    text-decoration: none;

    font-size: 1.15rem;
    font-weight: normal;
}

nav {
    display: flex;
    gap: 28px;
}

nav a {
    color: #555;
    text-decoration: none;

    font-family: Arial, sans-serif;
    font-size: 0.8rem;
}

nav a:hover {
    color: #222;
}


/* --------------------------------------------------
   GENERAL LAYOUT
-------------------------------------------------- */

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 5vw 100px;
}


/* --------------------------------------------------
   EXPERIMENT HEADER
-------------------------------------------------- */

.experiment-header {
    max-width: 850px;
    padding: 150px 0 50px;
}

.eyebrow {
    margin: 0 0 18px;

    color: #6d7d78;

    font-family: Arial, sans-serif;
    font-size: 0.72rem;
    font-weight: normal;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.experiment-header h1 {
    margin: 0;

    font-size: clamp(3rem, 7vw, 6.5rem);
    font-weight: normal;
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.subtitle {
    max-width: 600px;
    margin-top: 45px;

    color: #555;
    font-size: 1.25rem;
    line-height: 1.6;
}

.experiment-meta {
    display: flex;
    gap: 24px;

    margin-top: 30px;

    color: #777;

    font-family: Arial, sans-serif;
    font-size: 0.72rem;
}


/* --------------------------------------------------
   ESSAY
-------------------------------------------------- */

.essay {
    max-width: var(--text-width);
    margin: 20px 0 0 var(--text-offset);
}

.essay p {
    margin: 0 0 28px;

    font-size: 1.1rem;
}

.essay .lead {
    margin-bottom: 42px;

    font-size: 1.35rem;
    line-height: 1.6;
}

.essay h2 {
    margin: 80px 0 25px;

    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: normal;
    line-height: 1;
    letter-spacing: -0.03em;
}


/* --------------------------------------------------
   VISUALISATION
-------------------------------------------------- */

/*
   The essay text is 680px wide and shifted 80px
   from the left.

   The visualisation expands beyond the essay so that
   the bookshelf has more horizontal space.
*/

.visualisation {
    width: calc(100% + 160px);

    margin-top: 50px;
    margin-right: 0;
    margin-bottom: 50px;
    margin-left: -80px;
}


/*
   Visualization frame
*/

.visualisation-frame {
    width: 100%;
    max-width: 100%;

}


/*
   Iframe

   The iframe needs enough height for the controls,
   bookshelf and spacing around it.
*/

.visualisation-frame iframe {
    display: block;

    width: 100%;
    height: 540px;

    border: 0;
}


/*
   Caption
*/

.visualisation figcaption {
    max-width: var(--text-width);

    margin: 18px 0 0 var(--text-offset);

    padding: 0;

    color: #777;

    font-family: Arial, sans-serif;
    font-size: 0.72rem;
    line-height: 1.5;
}


/* --------------------------------------------------
   TECHNICAL NOTES
-------------------------------------------------- */

.technical {
    max-width: var(--text-width);

    margin: 80px 0 0 var(--text-offset);

    padding-top: 45px;

    border-top: 1px solid #d8d8d3;
}

.technical h2,
.sources h2 {
    margin: 0 0 25px;

    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: normal;
    line-height: 1;
    letter-spacing: -0.03em;
}

.technical p:not(.eyebrow) {
    font-size: 1rem;
}

.technical-details {
    margin: 40px 0 0;
}

.technical-details div {
    display: grid;
    grid-template-columns: 140px 1fr;

    padding: 12px 0;

    border-top: 1px solid #deded9;
}

.technical-details div:last-child {
    border-bottom: 1px solid #deded9;
}

.technical-details dt {
    color: #777;

    font-family: Arial, sans-serif;
    font-size: 0.72rem;
}

.technical-details dd {
    margin: 0;

    font-family: Arial, sans-serif;
    font-size: 0.8rem;
}


/* --------------------------------------------------
   SOURCES
-------------------------------------------------- */

.sources {
    max-width: var(--text-width);

    margin: 80px 0 0 var(--text-offset);
}

.sources ul {
    margin: 0;
    padding-left: 20px;

    font-size: 1rem;
}

.sources li {
    margin-bottom: 10px;
}


/* --------------------------------------------------
   FOOTER
-------------------------------------------------- */

.site-footer {
    width: 100%;
    padding: 50px 5vw;

    color: #777;

    font-family: Arial, sans-serif;
    font-size: 0.7rem;

    border-top: 1px solid #d8d8d3;
}


/* --------------------------------------------------
   MOBILE
-------------------------------------------------- */

@media screen and (max-width: 700px) {

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    :root {
        --page-padding: 6vw;
        --text-offset: 0;
        --text-width: 100%;
    }

    main {

    width: 100%;

    max-width: 100%;

    }

    /* HEADER */

    .site-header {
        width: 100%;

        padding: 22px 6vw;

        display: flex;
        justify-content: space-between;
        align-items: baseline;

        gap: 20px;
    }

    .menu-toggle {
    display: flex;
    width: 28px;
    height: 20px;
    padding: 0;
    margin: 0;

    position: relative;
    z-index: 110;

    flex-direction: column;
    justify-content: space-between;

    background: none;
    border: none;
    cursor: pointer;
}

    .site-name {
        flex-shrink: 0;
        font-size: 1.05rem;
    }

.menu-toggle span {
    display: block;
    width: 100%;
    height: 1px;
    background: #555;

    transition:
        transform .25s ease,
        opacity .2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(9.5px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-9.5px) rotate(-45deg);
}

.site-nav {
    display: none;

    position: fixed;

    top: 73px;
    left: 0;
    right: 0;
    bottom: 0;

    width: 100%;
    height: calc(100vh - 73px);

    padding: 55px 6vw 50px;

    background: #f8f8f5;

    flex-direction: column;
    align-items: flex-start;
    gap: 0;

    z-index: 90;
}

.site-nav.open {
    display: flex;
}

.site-nav a {
    display: block;
    width: 100%;

    padding: 12px 0;

    color: #4f5f5b;
    text-decoration: none;

    font-family: Arial, sans-serif;
    font-size: 0.82rem;
    font-weight: normal;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.4;

    transition: color .15s ease;
}

.site-nav a:hover {
    color: #222;
}


    /* EXPERIMENT HEADER */

    .experiment-header {
        width: 100%;
        max-width: 100%;

        padding: 100px 0 50px;
    }

    .experiment-header h1 {
        font-size: clamp(3rem, 14vw, 5rem);
    }

    .subtitle {
        width: 100%;
        max-width: 100%;

        margin-top: 35px;

        font-size: 1.1rem;
    }

    .experiment-meta {
        flex-direction: column;
        gap: 6px;
    }


    /* ESSAY */

    .essay {
        width: 100%;
        max-width: 100%;

        margin: 0;
    }

    .essay p {
        font-size: 1.05rem;
    }

    .essay .lead {
        font-size: 1.25rem;
    }

    .essay h2 {
        margin-top: 60px;
    }


    /* VISUALISATION */

.visualisation {
    width: 100%;
    max-width: 100%;

    margin-top: 50px;
    margin-right: 0;
    margin-bottom: 50px;
    margin-left: 0;

    padding: 0;
}

.visualisation-frame {
    width: 100%;
    max-width: 100%;

    margin: 0;
    padding: 0;

    overflow: hidden;
}

.visualisation-frame iframe {
    display: block;

    width: 100%;
    max-width: 100%;
    min-width: 0;

    height: 600px;

    margin: 0;
    padding: 0;

    border: 0;
}

@media screen and (orientation: landscape) and (max-height: 700px) {

    .visualisation-frame iframe {

        height: 550px;

    }

}

    .visualisation figcaption {
        width: 100%;
        max-width: 100%;

        margin: 18px 0 0;
        padding: 0;
    }


    /* TECHNICAL NOTES */

    .technical {
        width: 100%;
        max-width: 100%;

        margin: 80px 0 0;
    }

    .technical-details div {
        grid-template-columns: 110px 1fr;
    }


    /* SOURCES */

    .sources {
        width: 100%;
        max-width: 100%;

        margin: 80px 0 0;
    }


    /* FOOTER */

    .site-footer {
        width: 100%;

        padding: 40px 6vw;
    }
}


.essay,

.essay p,

.essay h2,

.technical,

.sources {

    max-width: 100%;

    overflow-wrap: break-word;

    word-wrap: break-word;

}
/* --------------------------------------------------
   VERY NARROW PHONES
-------------------------------------------------- */

@media screen and (max-width: 380px) {

    .site-header {
        padding-left: 5vw;
        padding-right: 5vw;

        gap: 10px;
    }

    .site-name {
        font-size: 0.95rem;
    }

    nav {
        gap: 9px;
        flex-wrap: nowrap;
    }

    nav a {
        font-size: 0.6rem;
    }
}

/* --------------------------------------------------
   MOBILE FULLSCREEN ABOUT
-------------------------------------------------- */

@media
screen and (max-width: 700px),
screen and (orientation: landscape) and (max-height: 700px) {

    body.about-open {

        overflow: hidden;

    }


    .visualisation-frame iframe.about-fullscreen {

        position: fixed !important;

        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;

        width: 100vw !important;

        height: 100vh !important;
        height: 100dvh !important;

        max-width: none !important;
        max-height: none !important;

        margin: 0 !important;

        border: 0;

        z-index: 99999;

    }

}


/* --------------------------------------------------
   MOBILE LANDSCAPE
-------------------------------------------------- */

@media screen and (orientation: landscape) and (max-height: 700px) {

    .visualisation {

        width: 100%;
        max-width: 100%;

        margin-left: 0;
        margin-right: 0;

    }


    .visualisation-frame {

        width: 100%;
        max-width: 100%;

        margin: 0;
        padding: 0;

        overflow: hidden;

    }


    .visualisation-frame iframe {

        display: block;

        width: 100%;
        max-width: 100%;
        min-width: 0;

        /*
           Same visualization height as portrait
           mobile. The shelf itself is 510px.
        */

        height: 500px;

        margin: 0;
        padding: 0;

        border: 0;

    }

}