/*
 * A person's page, the people pages and the feed. A profile is its head, then its
 * entries in a panel with the composer at the top for its owner, and a side column
 * beside them; the feed is laid out the same. A post's markdown keeps to the site's
 * type rather than a document's.
 */


/* --- who ------------------------------------------------------------------- */

main.person {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* The avatar, who they are and their counts, and the owner's or viewer's buttons at
   the far end; on a phone the buttons drop under the rest. */
.person-head {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;

    .avatar.large {
        width: 72px;
        height: 72px;
        font-size: 1.8rem;
        object-fit: cover;
    }

    .identity {
        flex: 1;
        min-width: 14rem;
        display: flex;
        flex-direction: column;
        gap: .35rem;
    }

    h1 {
        margin: 0;
        font-size: 1.6rem;
    }

    .lede {
        margin: 0;
    }

    .about {
        max-width: var(--measure);
        margin: .25rem 0 0;
        white-space: pre-line;
    }

    .counts {
        display: flex;
        gap: 1.25rem;
        margin: .25rem 0 0;
        font-size: .9rem;

        a {
            color: var(--muted);
            text-decoration: none;

            &:hover {
                color: var(--text);
            }
        }

        strong {
            color: var(--text);
        }
    }

    .actions {
        display: flex;
        gap: .5rem;

        form {
            margin: 0;
        }
    }
}


/* --- the composer ---------------------------------------------------------- */

.composer {
    display: flex;
    flex-direction: column;
    gap: .75rem;

    textarea {
        width: 100%;
        box-sizing: border-box;
        padding: .6rem .75rem;
        font: inherit;
        color: var(--text);
        background: var(--inset);
        border: 1px solid var(--edge);
        border-radius: var(--radius);
        resize: vertical;

        &:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 1px;
        }
    }

    .audience {
        display: flex;
        align-items: center;
        gap: .5rem;
    }

    .attachments {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
        gap: .5rem;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .attachment {
        display: flex;
        flex-direction: column;
        gap: .35rem;
        padding: .4rem;
        background: var(--inset);
        border: 1px solid var(--edge);
        border-radius: var(--radius);

        img {
            display: block;
            width: 100%;
            aspect-ratio: 1;
            object-fit: cover;
            border-radius: var(--radius);
        }

        button {
            align-self: flex-start;
        }
    }
}


/* --- entries --------------------------------------------------------------- */

.entries {
    display: flex;
    flex-direction: column;
}

/* Rows in the panel, divided by its rule rather than boxed each. */
article.entry {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--edge);

    > header {
        display: flex;
        align-items: center;
        gap: .5rem;
        min-height: 32px;

        time {
            color: var(--muted);
            font-size: .85rem;
        }
    }
}

/* Written words keep to the measure, however wide the page around them. */
.markdown {
    max-width: var(--measure);
    overflow-wrap: anywhere;

    > :first-child {
        margin-top: 0;
    }

    > :last-child {
        margin-bottom: 0;
    }

    p,
    ul,
    ol,
    pre,
    blockquote {
        margin: 0 0 .75rem;
    }

    blockquote {
        padding-left: .8rem;
        color: var(--muted);
        border-left: 3px solid var(--edge);
    }

    code {
        font-family: var(--mono);
        font-size: .9em;
    }

    pre {
        padding: .6rem .75rem;
        overflow-x: auto;
        background: var(--inset);
        border-radius: var(--radius);
    }

    hr {
        border: 0;
        border-top: 1px solid var(--edge);
    }
}

.entry .routine {
    display: flex;
    flex-direction: column;
    gap: .5rem;

    .strip {
        display: block;
        width: 100%;
        height: 56px;
        object-fit: fill;
        background: var(--inset);
        border-radius: var(--radius);

        &.stereo {
            height: 96px;
        }
    }

    .title {
        display: flex;
        align-items: center;
        gap: .75rem;
        flex-wrap: wrap;
    }

    .name {
        font-weight: 600;
    }
}

.entries .more {
    display: flex;
    justify-content: center;
    padding-top: 1.25rem;
}


/* --- reporting and moderation ---------------------------------------------- */

.account-actions {
    gap: .6rem;

    details form {
        display: flex;
        flex-direction: column;
        gap: .5rem;
        margin-top: .5rem;
    }
}

details.report,
details.moderate {
    font-size: .85rem;

    > summary {
        color: var(--muted);
        cursor: pointer;
    }

    form {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
        margin-top: .5rem;
        min-width: min(24rem, 80vw);
    }

    textarea,
    input[type=text] {
        width: 100%;
        box-sizing: border-box;
        padding: .5rem .65rem;
        font: inherit;
        color: var(--text);
        background: var(--inset);
        border: 1px solid var(--edge);
        border-radius: var(--radius);
    }

    label {
        display: flex;
        align-items: center;
        gap: .5rem;
    }
}

details.moderate > summary {
    color: var(--accent);
}

article.entry > footer {
    gap: 1rem;
    align-items: flex-start;
}

.notices {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin: 1rem 0;

    p {
        margin: .25rem 0 0;
    }
}

.moderation {
    .reported {
        padding: .75rem;
        background: var(--inset);
        border-radius: var(--radius);
    }

    .history {
        display: flex;
        flex-direction: column;
        gap: .75rem;
        padding: 0;
        list-style: none;

        p {
            margin: .25rem 0 0;
        }
    }

    .history-filter {
        margin: 1rem 0;
    }

    article.entry {
        margin-top: .75rem;
    }
}

.terms .versions {
    padding-left: 1.2rem;
}


/* --- following ------------------------------------------------------------- */

article.entry .author {
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;

    .avatar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        font-size: .75rem;
        font-weight: 700;
        color: #ffffff;
        background: var(--colour, var(--track));
    }
}


/* --- calendar --------------------------------------------------------------- */

.entry .marks {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .75rem;
    margin: 0;

    .emoji {
        font-size: 1.4rem;
    }
}

.entry .event {
    h3 {
        margin: .25rem 0 .5rem;
    }

    .when {
        display: flex;
        align-items: center;
        gap: .5rem;
        margin: 0;
        color: var(--muted);
    }

    form {
        margin-top: .5rem;
    }
}

.calendar .month {
    display: flex;
    align-items: center;
    gap: 1rem;

    h2 {
        margin: 0;
        min-width: 12rem;
        text-align: center;
    }
}

.calendar .grid {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;

    th {
        padding: .25rem;
        font-size: .75rem;
        font-weight: 500;
        color: var(--muted);
    }

    td {
        height: 5rem;
        padding: .3rem;
        vertical-align: top;
        overflow: hidden;
        border: 1px solid var(--edge);
        background: var(--bg);

        &.outside {
            background: transparent;

            .number {
                color: var(--faint);
            }
        }

        &.today .number {
            color: var(--accent);
            font-weight: 700;
        }
    }

    .number {
        display: block;
        font-size: .75rem;
        color: var(--muted);
    }

    .mark {
        font-size: 1.1rem;
    }

    .event {
        display: block;
        overflow: hidden;
        font-size: .7rem;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: 0 .25rem;
        border-radius: var(--radius);
        background: var(--accent-soft);
    }
}

/* The owner's two forms side by side under the month, each boxed on the panel. */
.calendar-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1rem;

    .composer {
        padding: 1rem;
        background: var(--bg);
        border: 1px solid var(--edge);
        border-radius: var(--radius);
    }

    h2 {
        margin: 0;
    }

    input[type=text],
    input[type=date],
    input[type=datetime-local] {
        height: 40px;
        padding: 0 .65rem;
        font: inherit;
        color: var(--text);
        background: var(--inset);
        border: 1px solid var(--edge);
        border-radius: var(--radius);
        color-scheme: dark;
    }

    .emoji {
        width: 4.5rem;
        text-align: center;
    }

    label {
        display: flex;
        align-items: center;
        gap: .5rem;
    }
}


/* --- people ----------------------------------------------------------------- */

main.people-page,
main.feed {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

#results > .hint {
    margin: 0;
}

.person-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Avatars in a card, a side box and a list row: the colour behind the initial, or
   the picture. */
.person-card .avatar,
.side .avatar,
.blocked-list .avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    font-size: .85rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--colour, var(--track));
}

.person-card {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-width: 0;
    padding: 1rem;
    background: var(--bg);
    border: 1px solid var(--edge);
    border-radius: var(--radius);

    .who {
        gap: .75rem;

        > div {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        a {
            font-weight: 600;
            text-decoration: none;
        }

        .hint {
            font-size: .85rem;
        }
    }

    .avatar {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }

    /* Two lines of the about at most: the cards in a row keep one height. */
    .about {
        display: -webkit-box;
        margin: 0;
        overflow: hidden;
        font-size: .9rem;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .controls {
        margin-top: auto;
        font-size: .8rem;
    }

    form {
        margin: 0;
    }
}

.blocked h2 {
    margin-top: 0;
}

.blocked-list {
    margin: 0;
    padding: 0;
    list-style: none;

    li {
        display: flex;
        align-items: center;
        gap: .75rem;
        min-height: 52px;
        border-top: 1px solid var(--edge);
    }
}


/* --- streams and side columns ----------------------------------------------- */

/* A stream beside a side column: the panel takes what the column leaves, and once
   the column would be narrower than its basis, it wraps under the panel. */
.columns {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;

    > .panel {
        flex: 999 1 36rem;
        min-width: 0;
        gap: 0;
    }
}

/* The composer is the panel's first row. */
.stream {
    > .composer {
        padding: 1.25rem 0;
        border-bottom: 1px solid var(--edge);
    }

    > .empty {
        margin: 1.25rem 0 0;
    }
}

.side {
    flex: 1 1 18rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;

    .box {
        display: flex;
        flex-direction: column;
        padding: 1rem 1.25rem;
        background: var(--card);
        border: 1px solid var(--edge);
        border-radius: var(--radius);
    }

    h2 {
        margin: 0 0 .25rem;
        font-size: .7rem;
        font-weight: 600;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--muted);
    }

    .you {
        gap: .75rem;

        .avatar {
            width: 48px;
            height: 48px;
            font-size: 1.1rem;
        }

        .who {
            gap: .75rem;

            > div {
                display: flex;
                flex-direction: column;
            }

            a {
                font-weight: 600;
                text-decoration: none;
            }
        }
    }

    .counts {
        display: flex;
        gap: 1.25rem;
        margin: 0;
        font-size: .85rem;

        a {
            color: var(--muted);
            text-decoration: none;
        }

        strong {
            color: var(--text);
        }
    }

    .all {
        margin-top: .5rem;
        font-size: .85rem;
        color: var(--muted);
    }
}

.side-list {
    margin: 0;
    padding: 0;
    list-style: none;

    li {
        display: flex;
        flex-direction: column;
        padding: .6rem 0;
        border-top: 1px solid var(--edge);

        &:first-child {
            border-top: 0;
        }

        > a {
            font-weight: 600;
            text-decoration: none;
        }

        .hint {
            font-size: .8rem;
        }
    }

    li.person {
        flex-direction: row;
        align-items: center;
        gap: .6rem;

        > a {
            flex: 1;
            min-width: 0;
            font-weight: 500;
        }

        form {
            margin: 0;
        }
    }
}


/* --- media ------------------------------------------------------------------ */

.entry .media {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: .5rem;

    img,
    video {
        display: block;
        width: 100%;
        height: 100%;
        max-height: 24rem;
        object-fit: cover;
        background: var(--inset);
        border-radius: var(--radius);
    }

    &.single {
        grid-template-columns: 1fr;

        img,
        video {
            object-fit: contain;
        }
    }
}

.moderation .media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 1rem;
    padding: 0;
    list-style: none;

    li {
        display: flex;
        flex-direction: column;
        gap: .4rem;
        padding: .5rem;
        background: var(--card);
        border: 1px solid var(--edge);
        border-radius: var(--radius);

        &.new {
            border-color: var(--accent);
        }
    }

    img {
        display: block;
        width: 100%;
        aspect-ratio: 1;
        object-fit: cover;
        background: var(--inset);
        border-radius: var(--radius);
    }
}
