/** Mobile layout */

@media only screen and (max-width: 720px) {
    body > article {
        width: calc(100% - var(--column-gap));
    }

    article aside {
        margin-top: 8px;
        margin-bottom: 16px;
        padding: var(--padding); /* Override the padding-right: 0; assignment */
    }
}

/** article.css overrides */
code span {
    font-style: normal;
}

.wide {
    /* Just because it's wide doesn't mean it should break the box. */
    max-width: 100%;
}

/** Peritext-specific */

code {
    hyphens: none;
}

:root {
    --alice-color: #e08b8b;
    --bob-color: #00c2ff;
}

blockquote > p {
    margin: 0;
}

.actors {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (min-width: 720px) {
    .actors {
        flex-direction: row;
    }

    .actors > div:first-child {
        margin-right: 15px;
        margin-bottom: 0;
    }

    .alice,
    .bob {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

.alice > p,
.bob > p {
    padding-left: 5px;
    margin-bottom: 0.1em;
}

.alice > blockquote,
.bob > blockquote {
    border: solid thin #ddd;
    border-radius: 5px;
    padding: var(--padding); /* Otherwise too small on mobile. */
}

.alice > blockquote {
    border-left: solid 3px var(--alice-color);
}

.bob > blockquote {
    border-left: solid 3px var(--bob-color);
}

/* Style shamelessly copied from Notion */
.comment {
    background: rgba(255, 212, 0, 0.14);
    border-bottom: 2px solid rgb(255, 212, 0);
    padding-bottom: 2px;
    position: relative;
}

.overlap {
    background: rgba(255, 212, 0, 0.56);
}

.comment .popup {
    font-size: 80%;
    position: absolute;
    background: rgba(255, 212, 0, 0.14);
    top: 2rem;
    left: 2rem;
    white-space: nowrap;
    padding: 2px 6px;
}

.comment .line {
    position: absolute;
    top: 1.4rem;
    width: 2rem;
    height: 2rem;
    border-left: 2px solid rgb(255, 212, 0);
    border-bottom: 2px solid rgb(255, 212, 0);
}

/* Live demo ------------- */

.peritext-demo {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 5px 0;
    position: relative;
}

.peritext-demo .editor-container {
    background-color: #ddd;
    flex: 1 0 0;
    min-width: 300px;
    height: 250px;
    background: #f2f2f2;
    border: 1px solid #c4c4c4;
    box-sizing: border-box;
    border-radius: 5px;
    padding: 20px 10px;
    margin: 20px 5px;
}

.peritext-demo .editor {
    border: solid thin #000;
    border-radius: 5px;
    height: 76px;
    background: #fff;
    padding: 5px;
}

.peritext-demo .buttons {
    height: 30px;
    margin-bottom: 5px;
    display: flex;
}

.peritext-demo .button {
    width: 20px;
    margin: 5px;
    padding-right: 5px;
    border-right: solid thin #bbb;
    user-select: none;
}

.peritext-demo .button:last-child {
    border-right: none;
}

.peritext-demo .button.link {
    margin-top: 1px;
}

.peritext-demo #alice {
    border-top: solid 5px var(--alice-color);
}

.peritext-demo #bob {
    border-top: solid 5px var(--bob-color);
}

.peritext-demo .changes {
    display: flex;
    flex-wrap: wrap;
    height: 64px;
    overflow: hidden;
    margin-top: 10px;
    position: relative;
    left: 0px;
}

@keyframes slideLeft {
    from {
        left: 0px;
        opacity: 100%;
    }

    to {
        left: 450px;
        opacity: 30%;
    }
}

@keyframes slideRight {
    from {
        left: 0px;
        opacity: 100%;
    }

    to {
        left: -450px;
        opacity: 30%;
    }
}

.peritext-demo #alice .syncing {
    animation-duration: 1s;
    animation-name: slideLeft;
}

.peritext-demo #bob .syncing {
    animation-duration: 1s;
    animation-name: slideRight;
}

.peritext-demo .changes .op {
    height: 20px;
    padding: 0 5px 5px 5px;
    border-radius: 5px;
    line-height: 1.5em;
    min-width: 0.6em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
        "Helvetica Neue", sans-serif;
    font-weight: 500;
    margin: 2px;
    background: white;
    animation: fadeIn 200ms;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.peritext-demo #alice .changes .op {
    border-bottom: solid 2px var(--alice-color);
}
.peritext-demo #bob .changes .op {
    border-bottom: solid 2px var(--bob-color);
}

span[data-mark="comment"] {
    background: rgba(255, 227, 86, 0.3);
    border-bottom: solid 2px rgba(255, 212, 0, 0.5);
}

span.highlight-flash {
    background: rgb(255, 250, 185);
}

@keyframes unhighlightGradual {
    0% {
        background: rgba(255, 250, 185, 1);
    }
    100% {
        background: rgba(255, 250, 185, 0);
    }
}

span.unhighlight {
    animation: unhighlightGradual 1000ms ease-out;
}

.peritext-demo .play-pause {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #000;
    color: white;
    font-size: 10em;
    text-align: center;
    transition: opacity 200ms ease-out;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.peritext-demo .play-pause.paused {
    opacity: 0.2;
}

.peritext-demo .play-pause:not(.paused) {
  opacity: 0.0;
}

/* On devices with actual hover support, show a hover state
   https://stackoverflow.com/a/28058919 */
@media (hover: hover) {
  .peritext-demo .play-pause:hover {
    opacity: 0.1;
  }
}

