@font-face {
    font-family: 'Bookish';
    src: url('fonts/Bookish-Book-TRIAL.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
  }

  @font-face {
    font-family: 'Bookish';
    src: url('fonts/Bookish-Italic-TRIAL.otf') format('opentype');
    font-weight: normal;
    font-style: italic;
    font-display: swap;
  }

html, body {
    width: 100%;
    height: 100dvh;
    margin: 0 auto;
    background: #EFE5D5;
}

body {
    display: grid;
    grid-template-columns: 1fr 4rem 1fr;
    grid-template-rows: 1fr;
    overflow: hidden;
    font-family: 'Bookish', 'EB Garamond', 'Times', 'Times New Roman', serif;
    background: #EFE5D5;
    color: #48403D;
    overscroll-behavior: none;
}

#logo-desktop {
    top: 20px;
    left: 20px;
    position: fixed;
    z-index: 10;
    display: block;
    transition: transform 0.25s ease;
}

#logo-desktop img {
    width: 50px;
    height: auto;
}

#logo-desktop:hover {
    transform: rotate(12deg);
}

/* vessel section */

#vessel-table {
    position: relative;
    background: transparent;
    overflow: hidden;
}

.vessel {
    position: absolute;
    height: auto;
    cursor: pointer;
    transition: transform 0.25s ease;
}

.vessel-fill, .vessel-outline { /* inside .vessel */
    width: 100%;
}

.vessel-fill {
    position: absolute;
    z-index: 0;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.vessel-outline {
    position: relative;
    z-index: 1;
}

.vessel svg {
    display: block;
    width: 100%;
    height: auto;
}

.vessel-fill svg {
    width: 100%;
    height: 100%;
}

.vessel-outline svg path {
    fill: #48403D;
}

.vessel-fill svg path {
    fill: var(--vessel-color);
}

.vessel:hover:not(.active) {
    transform: rotate(var(--tilt));
}

.vessel:hover:not(.active) .vessel-fill, .vessel.active .vessel-fill {
    opacity: 1;
}

.vessel .label, .vessel .pauseLabel {
    position: absolute;
    top: 60%;
    left: calc(100% + 5px);
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    white-space: normal;
    width: 100px;
    font-family: 'Reenie Beanie', Arial, sans-serif;
    font-size: 1.5rem;
    color: #48403D;
    transition: opacity 0.2s ease;
}

.vessel .pauseLabel svg {
    width: 1.5rem;
    height: 1.5rem;
}

.vessel:hover:not(.active) .label {
    opacity: 1;
}

.vessel.active:hover .pauseLabel {
    opacity: 1;
}

#play-pause-button {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 1.5rem;
    font-style: italic;
    font-family: Bookish;
    position: absolute;
    left: 50%;
    bottom: 1.2rem;
    transform: translateX(-50%);
    color: inherit;
    z-index: 5;
  }

#play-pause-button:hover {
    cursor: pointer;
  }

/* spine */

#spine {
    background: transparent;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;

    font-size: 1.4em;
    font-style: italic;
    letter-spacing: 0px;
}

#logo-mobile {
    display: none;
}

/* table of contents */

#toc {
    /* commenting this out to experiment with fixing the transition on the editors' letter card */
    /* overflow: hidden; */
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-left: -0.25rem;
    width: calc(100% + 3.5rem);
    z-index: 1;
    background: transparent;
}

.toc-entry {
    position: relative;
    width: 100%;
    border: none;
    text-align: left;
    text-decoration: none;
    padding: 10px 12px 4rem 12px;
    margin-top: -57px;
    transform: rotate(var(--toc-tilt, 0deg)) translateX(var(--toc-translate, 0));
    transform-origin: left center;
    flex: 1 1 auto;

    font: inherit;
    font-size: 1.6rem;
    font-style: italic;
    min-height: min-content;
    white-space: normal;

    color: #48403D;

}

.toc-entry:first-child{
    margin-top: 0;
}

.toc-entry:first-of-type:hover, .toc-entry:first-of-type.highlighted,
.toc-entry:last-of-type:hover, .toc-entry:last-of-type.highlighted {
    transform: rotate(var(--toc-tilt, 0deg)) translateX(-20px);
}

.toc-entry:hover, .toc-entry.highlighted {
    width: calc(100% + 10px);
    transform: rotate(var(--toc-tilt, 0deg)) translateX(var(--toc-translate, 0)) translateY(-20px);
}

.vessel-icon {
    display: none;
}

/* text panels */

.panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 100px;
    padding-bottom: 100px;
    overflow-y: auto;
    box-sizing: border-box;
}

.text-panel {
    width: 1000px;
    max-width: 90vw;
    height: auto;
    margin-block: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding: 80px;
    box-sizing: border-box;
    position: relative;
    transform: rotate(var(--toc-tilt, 0deg));
    transform-origin: center center;
}

.text-body {
    overflow: visible;
}

.panel-overlay::-webkit-scrollbar {
    display: none;
}

.close-button {
    position: absolute;
    top: 60px;
    right: 60px;
    appearance: none;
    border: none;
    background: transparent;
}

.close-button img {
    width: 23px;
    height: 22px;
    display: block;
}

.close-button:hover{
    transform: translateY(-4px);
}

.panel-play-pause {
    font-size: 1.5rem;
    font-style: normal;
    font-family: Bookish;
    border: none;
    background: transparent;
    color: inherit;
}

.panel-play-pause:hover {
    cursor: pointer;
}

/* buy link */

#purchase {
    position: fixed;
    right: -10px;
    bottom: 20%;
    z-index: 8;
}

#purchase-desktop-inner {
    transition: transform 0.25s ease;
    transform: rotate(-15deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#purchase img {
    width: 120px;
    height: auto;
    text-decoration: none;
    border-bottom: none;
}

#purchase:hover img {
    cursor: pointer;
}

#purchase a, #purchase a:visited {
    color: #48403D;
    text-decoration: none;
}

#purchase a:hover #purchase-desktop-inner, #purchase a:active #purchase-desktop-inner {
    text-decoration: none;
    border-bottom: none;
    padding-bottom: 1px;
    transform: rotate(0deg) translateX(-60px);
}

#mobile-footer {
    display: none;
}


/* responsive stuff */
@media all and (max-width: 768px) {
    html, body {
        height: auto;
        min-height: 100dvh;
        background: #EFE5D5;
    }

    body {
        display: flex;
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: visible;
    }

    body.panel-open {
        overflow: hidden;
        touch-action: none;
    }

    body.panel-open #toc, body.panel-open #spine {
        pointer-events: none;
    }

    #spine {
        writing-mode: horizontal-tb;
        transform: none;
        width: 100%;
        box-sizing: border-box;
        padding: 10px;
        padding-bottom: 20px;
        align-items: flex-end;
    }

    #class-title {
        display: none;
    }

    #logo-desktop {
        display: none;
    }

    #logo-mobile {
        display: block;
    }

    #logo-mobile img {
        width: 80px;
        height: auto;
        transform: rotate(0deg);
    }

    #vessel-table {
        display: none;
    }

    #toc {
        width: 100dvw;
        margin-left: 0;
        height: auto;
        overflow: visible;
    }

    .toc-entry {
        flex: none;
        margin-top: -40px;
        margin-bottom: 0;
        padding-bottom: 4rem;
        width: 100%;
        box-sizing: border-box;
        transform: rotate(var(--toc-tilt, 0deg));
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    } 

    .toc-entry:hover,
    .toc-entry.highlighted,
    .toc-entry:first-of-type:hover,
    .toc-entry:last-of-type:hover {
        width: 100%;
        transform: rotate(var(--toc-tilt, 0deg));
}

    .vessel-icon {
        display: block;
        flex-shrink: 1;
    }

    .vessel-icon svg {
        display: block;
        width: 1.4em;
        height: auto;
    }

    .toc-entry[data-id="amy"] .vessel-icon svg {
        width: 0.75em;
    }

    .toc-entry[data-id="yoyo"] .vessel-icon svg {
        width: 1em;
        padding-right: 6px;
    }

    .toc-entry[data-id="leah"] .vessel-icon svg {
        width: 1em;
    }

    .vessel-icon svg path {
        fill: #48403D;
    }

    .entry-title {
        text-align: left;
    }

    .panel-overlay {
        padding-top: 0;
        padding-bottom: 0;
        align-items: flex-start;
        justify-content: flex-start;
    }
    
    .text-panel {
        width: 100%;
        max-width: none;
        min-height: 100dvh;
        margin: 0;
        padding: 20px;
        padding-top: 12px;
        transform: none;
    }

    .text-header {
        padding-top: 40px;
    }

    .close-button {
        top: 30px;
        right: 30px;
        position: fixed;
    }

    .bio {
        padding-bottom: 40px;
    }

    #purchase {
        display: none;
    }

    #mobile-footer {
        display: flex;
        padding: 20px;
        padding-top: 40px;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
        gap: 20px;
    }

    #footer-copy {
        padding-bottom: 0px;
        font-size: 0.9rem;
        line-height: 1.1rem;
    }

    #footer-copy a, #footer-copy a:visited {
        color: #48403D;
        text-decoration: none;
        border-bottom: 1px dashed #48403d;
    }
    
    #footer-copy a:active {
        opacity: 1;
        text-decoration: none;
        border-bottom: none;
        padding-bottom: 1px;
    }

    #purchase-mobile img {
        width: 100px;
        height: auto;
    }
}