:root {
    --w: 0;
    --y: 0;
    --x: 0;
    --h: 0;
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
}

body {
    margin: 0;
}

.App {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 4fr 1fr;
    grid-template-rows: auto;
}

.Renderer {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #fff;
    display: block;
}

.Renderer-page {
    width: calc(100% - 4rem);
    height: calc(100% - 4rem);
    display: block;
    overflow-y: scroll;
    margin: 2rem;
}
body.--media .Renderer-page {
    display: none;
}

.Grid {
    background-color: #fff;
    width: 100%;
    min-height: 100%;
    height: var(--h);
    display: block;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.Grid-item {
    position: absolute;
    top: var(--y);
    left: var(--x);
    width: var(--w);
    height: auto;
    animation-name: fadeIn;
    animation-duration: 0.2s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

.Grid-figure {
    margin: 0;
}

.Renderer-page .Grid-figure:empty {
    background-color: #e6e6e6;
    aspect-ratio: 4 / 5;
}

.Grid-figure img {
    width: 100%;
    display: block;
}

.Grid-caption {
    margin: 0.75em 0;
    opacity: 0;
}

.Grid-figure:hover .Grid-caption {
    opacity: 1;
}

.Editor {
    width: 100%;
    height: 100%;
    display: flex;
    flex-flow: column;
    gap: 0.5rem;
    overflow-y: scroll;
    position: relative;
    padding: 1rem;
    background-color: #eeeeee;
    border-left: 1px solid #dddddd;
    font-family: system-ui, sans-serif;
}

.Editor-menu {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0;
    margin: 0 0 0.5rem;
}

.Editor-menuItem {
    
}

.Editor-menuItem a {
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid currentColor;
    background-color: rgba(255,255,255,0.25);
    font-size: 0.66em;
    line-height: 2em;
    padding: 0.5rem;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    letter-spacing: 0.025em;
    font-weight: bold;
    border-radius: 0.25rem;
    width: 100%;
}

.Editor-menuItem.--current a {
    background-color: #fff;
}

.Editor-button {
    display: block;
    border: 1px dashed rgba(0,0,0,0.33);
    font-size: 0.66em;
    line-height: 2em;
    padding: 0.5rem;
    text-transform: uppercase;
    background-color: transparent;
    text-align: center;
    cursor: pointer;
    letter-spacing: 0.025em;
    font-weight: bold;
    border-radius: 0.25rem;
    width: 100%;
}

.Editor-button:hover {
    background-color: #fff;
    border: 1px solid currentColor;
}

.Form {
    display: flex;
    flex-flow: column;
    gap: 0.5rem;
}

.Form-item {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 5fr;
    grid-template-rows: auto;
    border: 1px solid currentColor;
    border-radius: 0.25rem;
    background-color: #fff;
}

.Form-itemMedia {
    grid-column: 1 / 2;
    grid-row: 1;
    margin: 0.25rem;
    width: 2rem;
    height: 2rem;
    aspect-ratio: 1 / 1;
    background-color: #e6e6e6;
    border-radius: 0.25rem;
    border: 1px solid #999;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.Form-itemMedia img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.Form-itemLabel {
    grid-column: 2 / 7;
    padding: 0.5rem;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-flow: column;
    justify-content: center;
}

.Form-itemLabel:after {
    content: '≡';
    position: absolute;
    top: 0.66rem;
    right: 0.75rem;
    line-height: 0.66em;
    font-size: 1.5em;
    cursor: grab;
}

.Form-itemFields {
    grid-column: 1 / -1;
    padding: 0.5rem;
    display: flex;
    flex-flow: column;
    gap: 0.5rem;
    display: none;
}

.Form-item.--open .Form-itemFields {
    display: flex;
}

.Form-itemTitle {
    font-size: 0.66em;
    letter-spacing: 0.025em;
    font-weight: bold;
    text-transform: uppercase;
}

.Form-itemInput {
    width: 100%;
    padding: 0.25rem;
    margin: 0;
}

.Form-itemRange {
    width: 100%;
    padding: 0;
    margin: 0;
    accent-color: #999;
}

.Form-itemRangeDetails {
    width: 100%;
    position: relative;
    display: block;
}

.Form-itemRangeDetails:after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    z-index: 1;
    background: repeating-linear-gradient(
        90deg,
        #ffffff,
        #ffffff 1.5rem,
        #dddddd calc(1.5rem + 1px),
        #dddddd calc(50% - 0.75rem - 1px),
        #ffffff calc(50% - 0.75rem),
        #ffffff calc(50% + 0.75rem),
        #dddddd calc(50% + 0.75rem + 1px),
        #dddddd calc(100% - 1.5rem - 1px),
        #ffffff calc(100% - 1.5rem),
        #ffffff calc(100%)
    );
}

.Form-itemRangeDetails span {
    font-size: 0.66em;
    letter-spacing: 0.025em;
    color: #999;
    text-align: center;
    position: relative;
    width: 100%;
    display: block;
    z-index: 2;
}

.Form-itemRangeDetails span:before {
    position: absolute;
    left: 0;
    width: 1rem;
    text-align: center;
}

.Form-itemRangeDetails span:after {
    position: absolute;
    right: 0;
    width: 1rem;
    text-align: center;
}

.Form-itemRangeDetails.--width span:before {
    content: "2";    
}

.Form-itemRangeDetails.--width span:after {
    content: "12";    
}

.Form-itemRangeDetails.--offset span:before {
    content: "-12";    
}

.Form-itemRangeDetails.--offset span:after {
    content: "+12";    
}

.Form-itemRemove {
    width: calc(100% - 1rem);
    grid-column: 1 / -1;
    border: 1px dashed darkred;
    color: darkred;
    font-size: 0.66em;
    line-height: 2em;
    padding: 0.25rem;
    text-transform: uppercase;
    background-color: transparent;
    text-align: center;
    cursor: pointer;
    letter-spacing: 0.025em;
    font-weight: bold;
    border-radius: 0.25rem;
    margin: 0.5rem;
    display: none;
}

.Form-item.--open .Form-itemRemove {
    display: block;
}

.Form-itemRemove:after {
    content: 'Remove';
}

.Form input[type="file"] {
    width: 100%;
    background-color: #fff;
    padding: 0.75rem;
    border: 1px solid currentColor;
    font-family: inherit;
    border-radius: 0.25rem;
}

.Form input[type="submit"] {
    display: block;
    border: 1px solid currentColor;
    font-size: 0.66em;
    line-height: 2em;
    padding: 0.25rem 1.25rem;
    text-transform: uppercase;
    background-color: #fff;
    text-align: center;
    cursor: pointer;
    letter-spacing: 0.025em;
    font-weight: bold;
    border-radius: 0.25rem;
    width: auto;
    margin-right: auto;
}

.Renderer-media {
    width: calc(100% - 4rem);
    height: calc(100% - 4rem);
    display: none;
    overflow-y: scroll;
    margin: 2rem;
}
body.--media .Renderer-media {
    display: block;
}

.Media {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #ffffff;
    display: block;
}

.Media-gallery {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    padding: 2rem;
}

.Media-item {
    margin: 0;
    img {
        display: block;
        width: 100%;
        height: auto;
    }
}