:root {
    /* =========================================================
       THEME
       Alterado pelo theme.js
       ========================================================= */

    --background: #000000;
    --box-background: #000000;

    --phosphor-heavy: #FFD900;
    --phosphor-medium: #D98200;
    --phosphor-light: #8A4B08;

    --site-font: "Courier New", monospace;
    --site-font-weight: 400;


    /* =========================================================
       LAYOUT
       Configuração estrutural do site
       ========================================================= */

    --site-scale: 1;

    --base-page-gutter: 42px;
    --page-gutter: 42px;

    --frame-gutter: 4px;
    --frame-gap: 4px;

    --site-shadow-size: 12px;
    --scaled-shadow-space: 12px;

    --site-box-width: 672px;


    /* =========================================================
       FIXED
       Valores que não pertencem ao sistema de temas
       ========================================================= */

    --preto: #000000;
}


/* =============================================================
   PAGE
   ============================================================= */

body {
    font-size: 16px;

    margin: 0;
    min-height: 100vh;
    padding: var(--page-gutter);

    background-color: var(--background);

    font-family: var(--site-font);
    font-weight: var(--site-font-weight);

    box-sizing: border-box;
}


/* =============================================================
   SITE FRAME
   ============================================================= */

.site-frame {
    --header-track: minmax(96px, 9fr);
    --left-track: 232px;
    --right-track: minmax(0, 1fr);
    width: calc(100vw - (var(--frame-gutter) * 2));
    height: calc(100vh - (var(--frame-gutter) * 2));
    height: calc(100dvh - (var(--frame-gutter) * 2));

    margin: calc(var(--frame-gutter) - var(--page-gutter));

    min-height: 0;

    display: grid;
    gap: var(--frame-gap);

    grid-template-columns:
        var(--left-track)
        minmax(0, 5fr)
        var(--right-track);

    grid-template-rows:
        var(--header-track)
        minmax(0, 49fr)
        auto;
}


/* =============================================================
   SHARED PANELS
   ============================================================= */

.frame-panel {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: var(--box-background);
    border: 1px solid var(--phosphor-light);
    box-sizing: border-box;
}


/* =============================================================
   HEADER
   ============================================================= */

.site-frame > [data-site-header] {
    grid-column: 1 / -1;
    grid-row: 1;

    min-width: 0;
    min-height: 0;
}

.site-frame > [data-site-header] > .frame-header {
    height: 100%;
}

.frame-header {
    padding-inline: 32px 40px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    height: 100%;
    gap: 16px;
}

.frame-header h1 {
    margin: 0;
}

.header-account {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    overflow-wrap: anywhere;
}

.header-account a {
    color: var(--phosphor-heavy);

    text-decoration: none;

    text-shadow:
        1px 1px 0 var(--phosphor-light);
}

.header-account a:hover {
    text-decoration: underline;
}


/* =============================================================
   SITE PAGES
   ============================================================= */

.site-frame > [data-site-pages] {
    grid-column: 1;
    grid-row: 2;

    min-width: 0;
    min-height: 0;
}

.site-frame > [data-site-pages] > .frame-side-left {
    height: 100%;
}

.frame-side {
    grid-row: 2;
}

.frame-side-left {
    grid-column: 1;

    align-self: stretch;
    justify-self: stretch;
    overflow: auto;
    padding-top: 30px;
}

.page-directory {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    justify-items: center;

    align-content: start;
    gap: 16px 8px;
    padding: 16px 8px;
}

.page-directory h2 {
    grid-column: 1 / -1;
    margin: 0;

    color: var(--phosphor-heavy);

    font-size: 1em;
}

.page-directory-item {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 4px;

    max-width: 100%;
    width: fit-content;

    color: var(--phosphor-heavy);

    font-weight: bold;
    font-size: 12px;
    text-align: center;
    text-decoration: none;

    text-shadow:
        1px 1px 0 var(--phosphor-light);
}

.page-directory-item img {
    display: block;

    width: 64px;
    height: 64px;
    object-fit: contain;

    image-rendering: pixelated;
}

.page-directory-item:hover span,
.page-directory-item[aria-current="page"] span {
    text-decoration: underline;
}

.frame-side-right {
    grid-column: 3;
    overflow: auto;
    overflow-wrap: anywhere;
}

.side-panel-content {
    padding: 46px 16px 16px;
}

.side-panel-content a {
    color: var(--phosphor-heavy);
}


/* =============================================================
   MAIN SITE BOX
   ============================================================= */

.site-frame > .site-box {
    grid-column: 2;
    grid-row: 2;

    align-self: center;
    justify-self: center;

    width: calc(100% / var(--site-scale));
    height: calc(100% / var(--site-scale));
}

.site-box {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overflow-wrap: anywhere;
    width: var(--site-box-width);

    display: flex;
    flex-direction: column;

    padding: 32px;

    border: 1px solid var(--phosphor-light);

    background: var(--box-background);

    text-align: left;

    transform: scale(var(--site-scale));
    transform-origin: center;

    box-sizing: border-box;
}

.site-box > * {
    flex-shrink: 0;
    min-width: 0;
}

.site-box p {
    margin: 0;
    line-height: 1.5;
}

.site-box a {
    color: var(--phosphor-heavy);

    text-decoration: none;

    text-shadow:
        1px 1px 0 var(--phosphor-light);
}

.site-box a:hover {
    text-decoration: underline;
}


/* =============================================================
   TERMINAL
   ============================================================= */

.terminal-line-input::before {
    content: "guest@weslin:~$ ";

    color: var(--phosphor-light);
}

.terminal-header {
    margin-bottom: 1em;

    color: var(--phosphor-heavy);

    font-weight: bold;
}

.terminal-divider-under,
.terminal-divider-above {
    display: flex;
    align-items: center;

    width: 100%;

    gap: 0.75em;

    font-family: "Courier New", monospace;
    color: var(--phosphor-medium);
}

.terminal-divider-under {
    margin-top: auto;
}

.terminal-divider-above {
    margin-bottom: 0;
}

.terminal-divider-under::after,
.terminal-divider-above::after {
    content:
        "----------------------------------------------------------------------------------------------------------------------------------------------";

    flex: 1;

    min-width: 0;

    overflow: hidden;

    white-space: nowrap;

    line-height: inherit;

    padding-block: 0.1em;
}


/* =============================================================
   SITE TITLE
   ============================================================= */

.site-title {
    font-size: 3em;
    flex-shrink: 0;
    color: var(--phosphor-heavy);

    text-decoration: none;

    text-shadow:
        1px 1px 0 var(--phosphor-light);
}

.site-title:hover {
    text-decoration: underline;
}


/* =============================================================
   GENERIC HEADINGS
   ============================================================= */

h1,
p,
h2 {
    color: var(--phosphor-medium);
}


/* =============================================================
   FOOTER
   ============================================================= */

.site-frame > [data-site-footer] {
    grid-column: 1 / -1;
    grid-row: 3;
    min-width: 0;
    min-height: 0;
}

.frame-footer {
    padding-top: 28px;
}

.panel-content[hidden] {
    display: none;
}

.site-frame.header-collapsed {
    --header-track: 30px;
}

.site-frame.left-collapsed {
    --left-track: 30px;
}

.site-frame.right-collapsed {
    --right-track: 30px;
}

.frame-panel.is-collapsed {
    padding: 0;
    overflow: hidden;
    min-height: 30px;
}

:where(a, button, summary):focus-visible {
    outline: 2px solid var(--phosphor-heavy);
    outline-offset: -2px;
}

.button-box {
    display: grid;

    grid-template-columns:
        28px
        minmax(0, 1fr)
        28px;

    align-items: center;

    gap: 8px;

    padding-inline: 4px;
    padding-block: 8px 20px;
}

.gif-button-grid {
    --gif-button-row-height: 31px;
    --gif-button-gap: 6px;

    display: flex;
    flex-wrap: nowrap;

    justify-content: center;

    gap: var(--gif-button-gap);

    justify-self: center;

    width: 100%;
    min-width: 0;

    min-height: var(--gif-button-row-height);
    max-height: var(--gif-button-row-height);

    overflow: hidden;
}

.button-box a {
    display: block;
    flex-shrink: 0;

    width: 88px;
    height: 31px;
}

.button-box img {
    display: block;

    width: 88px;
    height: 31px;

    image-rendering: pixelated;
}


/* =============================================================
   FOOTER NAVIGATION BUTTONS
   ============================================================= */

.button-box-page,
.panel-toggle,
.layout-fullscreen-toggle {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    box-sizing: border-box;

    padding: 0;

    background: var(--box-background);

    border: 1px solid var(--phosphor-medium);
    border-radius: 0;

    color: var(--phosphor-medium);

    cursor: pointer;

    font: 18px "Courier New", monospace;
    line-height: 1;
}

.button-box-page span {
    display: block;
}

.button-box-page:hover,
.panel-toggle:hover,
.layout-fullscreen-toggle:hover {
    background: var(--phosphor-light);
}

.button-box-page:disabled {
    cursor: default;

    opacity: 0.45;
}

.button-box-page:disabled:hover {
    background: var(--phosphor-medium);
}

.panel-toggle {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
}

.layout-fullscreen-toggle {
    position: sticky;
    top: 0;
    z-index: 2;
    align-self: flex-end;
    margin: -24px -24px 0 0;
}

.fullscreen-icon {
    width: 12px;
    height: 12px;
    background:
        linear-gradient(currentColor, currentColor) top left / 5px 1px,
        linear-gradient(currentColor, currentColor) top left / 1px 5px,
        linear-gradient(currentColor, currentColor) top right / 5px 1px,
        linear-gradient(currentColor, currentColor) top right / 1px 5px,
        linear-gradient(currentColor, currentColor) bottom left / 5px 1px,
        linear-gradient(currentColor, currentColor) bottom left / 1px 5px,
        linear-gradient(currentColor, currentColor) bottom right / 5px 1px,
        linear-gradient(currentColor, currentColor) bottom right / 1px 5px;
    background-repeat: no-repeat;
}

.layout-fullscreen-toggle[aria-pressed="true"] .fullscreen-icon {
    width: 8px;
    height: 8px;
    border: 1px solid currentColor;
    background: none;
}

.mobile-menu-toggle,
.header-mobile-label,
.mobile-menu {
    display: none;
}

/* Mobile keeps the main box visible and moves both side panels into a menu. */
@media (max-width: 800px) {
    body {
        min-height: 0;
        height: 100vh;
        height: 100dvh;
        padding: var(--frame-gutter);
        overflow: hidden;
    }

    .site-frame {
        --header-track: 46px;
        width: 100%;
        height: 100%;
        margin: 0;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: var(--header-track) minmax(0, 1fr);
    }

    .frame-header {
        padding: 0 36px 0 0;
    }

    .header-content {
        gap: 8px;
    }

    .site-title {
        font-size: 20px;
        margin-right: auto;
    }

    .header-account {
        font-size: 12px;
        flex-wrap: nowrap;
    }

    .header-account a {
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    .header-account .header-register,
    .header-desktop-label,
    .site-frame > [data-site-pages],
    .site-frame > .frame-side-right,
    .site-frame > [data-site-footer],
    .page-directory-item img {
        display: none;
    }

    .header-mobile-label {
        display: inline;
    }

    .mobile-menu-toggle,
    .mobile-menu-close {
        display: block;
        min-width: 30px;
        min-height: 30px;
        padding: 4px;
        background: var(--box-background);
        border: 0;
        color: var(--phosphor-heavy);
        font: inherit;
        cursor: pointer;
    }

    .mobile-menu-toggle {
        font-size: 22px;
    }

    .site-frame > .site-box {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        height: 100%;
        min-height: 0;
        padding: 16px;
        transform: none;
        overscroll-behavior: contain;
    }

    .layout-fullscreen-toggle {
        margin: -8px -8px 4px 0;
    }

    .mobile-menu {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: var(--frame-gutter);
        border: 0;
        box-sizing: border-box;
        overflow: hidden;
        background: var(--background);
        color: var(--phosphor-heavy);
        font: inherit;
    }

    .mobile-menu[open] {
        display: grid;
        grid-template-rows: 46px minmax(0, 1fr);
        gap: var(--frame-gap);
    }

    .mobile-menu::backdrop {
        background: var(--background);
    }

    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-left: 12px;
        border: 1px solid var(--phosphor-light);
    }

    .mobile-menu-panels {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: minmax(0, 1fr);
        gap: var(--frame-gap);
        min-width: 0;
        min-height: 0;
    }

    .mobile-menu-panels > [data-site-pages] {
        min-width: 0;
        min-height: 0;
    }

    .mobile-menu-panels:has(.frame-side-left.is-collapsed) {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .mobile-menu-panels:has(.frame-side-right.is-collapsed) {
        grid-template-columns: minmax(0, 1fr) 30px;
    }

    .mobile-menu-panels:has(.frame-side-left.is-collapsed):has(.frame-side-right.is-collapsed) {
        grid-template-columns: 30px 30px;
    }

    .mobile-menu-panels .frame-side {
        height: 100%;
        grid-column: auto;
        grid-row: auto;
        overscroll-behavior: contain;
    }

    .page-directory {
        grid-template-columns: minmax(0, 1fr);
        justify-items: stretch;
        gap: 8px;
        padding: 12px 8px;
    }

    .page-directory h2 {
        text-align: left;
        margin-bottom: 8px;
    }

    .page-directory-item {
        width: 100%;
        min-height: 44px;
        align-items: flex-start;
        justify-content: center;
        text-align: left;
        overflow-wrap: anywhere;
    }

    .side-panel-content {
        padding: 42px 8px 12px;
    }

    .side-panel-content h2 {
        font-size: 1em;
        margin-top: 0;
    }
}
