/* ==========================================================================
   Base page styles
   ========================================================================== */

html,
body {
    height: 100vh;
    width: 100vw;
    margin: 0;
    color: #0a0a0a;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        "Open Sans",
        "Helvetica Neue",
        sans-serif;
}


/* ==========================================================================
   Layout helpers
   ========================================================================== */

.flex-row {
    display: flex;
    flex-direction: row;
}

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

.space {
    flex: 1 1 auto;
}


/* ==========================================================================
   Main app layout
   ========================================================================== */

#container {
    height: 100vh;
    background: #d8d8d8;
}

#side-panel {
    flex: 1 1 auto;
    min-width: 0;
}

#bottom-panel {
    flex: 1 1 auto;
    min-height: 0;
}

#bottom-panel > .group {
    min-height: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}


/* ==========================================================================
   Canvas
   ========================================================================== */

.canvas-area {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    min-width: 0;
}

#canvas {
    background-color: #000080;
    aspect-ratio: 1 / 1;
    max-height: 65vh;
    max-width: 65vh;
    width: min(65vh, 60vw);
    height: auto;
    flex: 0 0 auto;
}


/* ==========================================================================
   Panels stuff
   ========================================================================== */

.panel {
    gap: 0.5rem;
    flex: 1 1 auto;
}

.group {
    position: relative;
    border: 2px solid #fefefe;
    padding: 16px;
    margin-top: 8px;
    font-size: 1rem;
    box-shadow:
        -1px -1px 0 1px #848584,
        inset -1px -1px 0 1px #848584;
}

.legend {
    display: flex;
    position: absolute;
    top: 0;
    left: 8px;
    transform: translateY(calc(-150% - 2px));
    padding: 0 8px;
    background: #d8d8d8;
    font-size: 1rem;
    font-weight: bold;
}

.divider {
    border-top: 2px solid #848584;
    border-bottom: 2px solid #fefefe;
    margin: 0.25rem 0 0.25rem 0;
    justify-self: center;
    width: 100%;
}


/* ==========================================================================
   Border stuff
   ========================================================================== */

.outset {
    border-style: solid;
    border-width: 2px;
    border-color: #fefefe #848584 #848584 #fefefe !important;
}

.inset {
    border-style: solid;
    border-width: 2px;
    border-color: #848584 #fefefe #fefefe #848584 !important;
}

#properties {
    overflow-y: auto;
}


/* ==========================================================================
   Object tree
   ========================================================================== */

ul,
#tree {
    list-style-type: none;
}

#tree {
    margin: 0;
    padding: 0;
}

#tree ul {
    margin: 0;
    padding-left: 1rem;
    position: relative;
}

#tree ul.active::before {
    content: "";
    border-left: 2px dashed #848584;
    position: absolute;
    top: 0.25rem;
    bottom: 0.25rem;
    left: 0.5rem;
    width: 2px;
}

#tree ul.active > li::before {
    content: "";
    position: absolute;
    top: 0.75rem;
    left: -0.5rem;
    width: 0.5rem;
    border-top: 2px dashed #848584;
}

#tree ul.active > li {
    position: relative;
}

#tree ul.active > li:last-child::after {
    content: "";
    position: absolute;
    top: 14px;
    left: -15px;
    bottom: 0;
    width: 10px;
    background: #d8d8d8;
}

.tree-and-actions {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.name {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    border-style: solid;
    border-width: 2px;
    border-color: transparent;
    box-sizing: border-box;
    padding-left: 0.1rem;
    padding-right: 0.1rem;
    margin-bottom: 2px;
}

.name:hover {
    border-color: #fefefe #848584 #848584 #fefefe;
}

.name:active {
    border-color: #848584 #fefefe #fefefe #848584;
}

.caret::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 6px;
}

.caret-down::before {
    transform: rotate(90deg);
}

.nested {
    display: none;
}

.active {
    display: block;
}


/* ==========================================================================
    misc
   ========================================================================== */

button {
    font-size: 0.9rem;
    background: unset;
    color: #0a0a0a;
    padding-top: 2px;
    padding-bottom: 2px;

    border-style: solid;
    border-width: 2px;
    border-color: #fefefe #848584 #848584 #fefefe;
}

button:active {
    border-color: #848584 #fefefe #fefefe #848584;
}
