*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;

    font-family: var(--font-main);
    font-size: 10pt;

    background-color: var(--color-bg);
    color: var(--color-text);

    overflow-x: hidden;
    overflow-y: auto;
}

/*
 * General links
 */

a:link,
a:visited {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover,
a:active {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/*
 * Navbar
 *
 * The original navbar dimensions and layout are retained.
 */

#navbar {
    position: sticky;
    top: 0;
    z-index: 1000;

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

    height: 52px;
    width: 100%;
    padding: 0 16px;

    background-color: var(--color-navbar);
    border-bottom: 1px solid var(--color-border);
}

#content-iframe {
    display: block;

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

    border: none;

    background-color: var(--color-bg);
    color: var(--color-text);
}

#title-link {
    color: var(--color-navbar-text);
    font-size: 16px;
    font-weight: 600;
}

#title-link:hover,
#title-link:active {
    color: var(--color-navbar-text);
}

#nav-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.navbar-button {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    height: 32px;
    width: 32px;

    border-radius: 50%;
    background-color: var(--color-navbar);

    transition: background-color 0.2s ease;
    cursor: pointer;
}

.navbar-button:hover {
    background-color: color-mix(
        in srgb,
        var(--color-navbar),
        white 15%
    );
}

.navbar-button-icon {
    display: block;

    width: 20px;
    height: 20px;

    background-color: var(--color-text);

    -webkit-mask-position: center;
    mask-position: center;

    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    -webkit-mask-size: contain;
    mask-size: contain;
}

#navbar-button-icon-about {
    -webkit-mask-image: url("../icons/help-info-solid.svg");
    mask-image: url("../icons/help-info-solid.svg");
}

#navbar-button-icon-connect {
    -webkit-mask-image: url("../icons/copy-to-clipboard-line.svg");
    mask-image: url("../icons/copy-to-clipboard-line.svg");
}

/*
 * Board
 */

#board {
    width: 100%;
    margin: 0;
    padding: 0 5px;
}

/*
 * Thread
 */

.thread {
    clear: both;

    width: 100%;
    margin: 0;
    padding: 9px 0 5px;

    overflow: hidden;
}

/*
 * Shared post layout
 */

.post,
.reply {
    display: flow-root;
    clear: both;

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

    margin: 0;
    padding: 0;

    color: var(--color-text);
    font-size: 10pt;
}

/*
 * Post icon
 *
 * The icon remains outside .post-header. Text initially wraps beside the
 * floated icon and then continues underneath it.
 */

.post-icon {
    float: left;

    width: 32px;
    height: 32px;

    /*
     * More space above the icon and little space beneath it.
     */
    margin: 6px 8px 2px 20px;

    object-fit: contain;
}

/*
 * Post header
 */

.post-header {
    display: block;

    min-width: 0;
    min-height: 16px;

    padding-top: 4px;

    line-height: 16px;

    overflow-wrap: anywhere;
    word-break: normal;
}

.post-header > span {
    display: inline;
    margin-right: 5px;
}

.post-title {
    color: var(--color-post-title);
    font-weight: bold;
}

.post-title a:link,
.post-title a:visited {
    color: inherit;
}

.post-title a:hover,
.post-title a:active {
    color: var(--color-link-hover);
}

.post-date {
    color: var(--color-text);
    white-space: nowrap;
}

.post-url {
    color: var(--color-post-author);
    font-size: inherit;
    font-weight: bold;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.post-url a:link,
.post-url a:visited,
.post-url a:hover,
.post-url a:active {
    color: inherit;
}

/*
 * Post body
 *
 * There is no fixed left indentation. The float controls the initial
 * wrapping, allowing longer descriptions to extend beneath the icon.
 */

.post-description {
    display: block;

    margin: 6px 20px 4px;
    padding: 0;

    color: var(--color-text);
    font-size: 10pt;
    line-height: 1.4;

    overflow-wrap: anywhere;
    word-break: normal;
}

/*
 * Replies
 */

.replies {
    clear: both;

    width: 100%;
    margin: 5px 0 0;
    padding: 0;
}

.replies:empty {
    display: none;
}

.replies > .post,
.replies > .reply,
.reply {
    display: flow-root;
    clear: both;

    width: calc(100% - 20px);
    max-width: calc(100% - 20px);

    margin: 3px 0 3px 20px;
    padding: 4px;

    background-color: var(--color-reply-bg);

    border: 1px solid var(--color-border);
    border-top: none;
    border-left: none;
}

/*
 * Reply icons use the same spacing as OP icons.
 */

.replies .post-icon,
.reply .post-icon {
    margin: 6px 8px 2px 18px;
}

.replies .post-header,
.reply .post-header {
    padding-top: 4px;
}

.replies .post-description,
.reply .post-description {
    margin: 6px 16px 4px;
}

/*
 * Generated thread separators
 */

hr {
    display: block;
    clear: both;

    width: 100%;
    height: 0;

    margin: 7px 0;

    border: none;
    border-top: 1px solid var(--color-border);
}

/*
 * Connect page
 */

#connect-board {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    padding: 18px 20px 28px;
}

.connect-section {
    margin-bottom: 16px;
    padding: 16px 18px;

    background-color: var(--color-reply-bg);
    border: 1px solid var(--color-border);
}

.connect-section:last-child {
    margin-bottom: 0;
}

.connect-section .post-title {
    margin-bottom: 6px;
    font-size: 11pt;
}

.connect-copy,
.connect-steps {
    line-height: 1.4;
}

.connect-steps {
    display: grid;
    gap: 4px;
    margin: 10px 0 14px 20px;
}

.connect-label {
    margin: 12px 0 5px;
    font-weight: bold;
}

.connect-textarea {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;

    resize: vertical;
    overflow: auto;

    color: var(--color-text);
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 2px;

    font-family: monospace;
    font-size: 10pt;
    line-height: 1.4;
}

.connect-url {
    min-height: 36px;
    field-sizing: content;
    resize: none;
    overflow-y: hidden;
}

.connect-snippet {
    min-height: 180px;
}

.connect-embed {
    min-height: 105px;
}

/*
 * Narrow layouts
 */

@media only screen and (max-width: 480px) {
    #board {
        padding: 0 3px;
    }

    #connect-board {
        padding: 10px 8px 18px;
    }

    .connect-section {
        padding: 12px;
    }

    .thread {
        padding-top: 5px;
    }

    .post-icon {
        margin-left: 8px;
    }

    .post-header {
        padding-top: 3px;
        line-height: 15px;
    }

    .post-header > span {
        margin-right: 3px;
    }

    .post-url {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .post-description {
        margin-right: 8px;
        margin-left: 8px;
    }

    .replies > .post,
    .replies > .reply,
    .reply {
        width: calc(100% - 8px);
        max-width: calc(100% - 8px);

        margin-left: 8px;
    }

    .replies .post-icon,
    .reply .post-icon {
        margin-left: 8px;
    }

    .replies .post-description,
    .reply .post-description {
        margin-right: 8px;
        margin-left: 8px;
    }

    hr {
        margin: 3px 0;
    }
}
