/* The post blogs/default-cube-shulker.html: its own parts (the panel, title and text come from post.css) */

/* Section headings ("Animation", "3D Scene"): 32px from the block above, 16px to their text */
.post > h2 {
    margin-top: 32px;
}

.post_meta + h2 {
    margin-top: 16px;
}

/* 3D view: the whole Blender scene, in the proportions of the video */
.post_model {
    position: relative;
    width: 100%;  /* stays full width when its height is rounded ("build: snap" below) */
    margin-top: 32px;
    aspect-ratio: 1920 / 1006;
    background-color: #3e3e3e;
}

.shulker_3d canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: pan-y;  /* scrolling the page still works on phones; turning is a one-finger drag sideways */
    cursor: grab;
}

/* Switch between the scene and the render camera's view; shown once the scene has loaded */
.shulker_view {
    position: absolute;
    top: 14px;    /* + the frame's 2px border: 16px from its outer edge */
    right: 14px;
    visibility: hidden;
}

.shulker_3d.ready .shulker_view {
    visibility: visible;
}

/* The video fills the frame edge to edge, in its own proportions */
.post_video video {
    display: block;
    width: 100%;
    object-fit: cover;
}

/* A short text right above the 3D view belongs to it: only 16px between them */
.post_body + .post_model {
    margin-top: 0;
}

/* The compositor's node tree, drawn after Blender's node editor (generated from the .blend file) */
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../../fonts/ibm-plex-sans-latin.woff2') format('woff2');
}

.node_frame {
    display: flex;
    align-items: center;  /* its height is rounded up to the grid ("build: snap" below) */
    padding: 16px;
    background-color: #1D1D1D;
}

/* Compositor: the nodes above can be changed (script/shulker-compositor.js), the picture below shows the result */
.node_frame {
    margin-bottom: 16px;  /* the picture belongs to the nodes */
}

.comp_picture {
    position: relative;
    width: 100%;
    margin: 0 0 32px;
    aspect-ratio: 2 / 1;  /* the height is rounded to the grid ("build: snap" below) */
}

/* Snapped to the 16px grid, in CSS, from the panel's width (100cqi): the video (inside the 2px border, 1920 x 1006,
   cropped by at most 15px), the 3D view and the compositor's picture rounded down, the node frame (2px border,
   16px padding, the drawing 1432 x 580) rounded up. 0.16px: a height a hair off a grid line counts as on it. */
@media screen {
    .post_video video {
        height: calc(round(down, (100cqi - 4px) * 1006 / 1920 + 4.16px, 16px) - 4px);
    }

    .post_model {
        height: round(down, 100cqi * 1006 / 1920 + 0.16px, 16px);
    }

    .comp_picture {
        height: round(down, 100cqi / 2 + 0.16px, 16px);
    }

    .node_frame {
        height: round(up, (100cqi - 36px) * 580 / 1432 + 36px - 0.16px, 16px);
    }
}

.comp_picture canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comp_picture figcaption {
    position: absolute;
    left: 6px;    /* + the 2px border: 8px from the frame's edge */
    bottom: 6px;
    padding: 0 8px;
    border-radius: 4px;
    background-color: rgb(15 17 23 / 0.8);
    color: #FFFFFF;
    font-size: var(--fs-small);
    line-height: 24px;
}

/* build: snap - generated by build_snap.py from blogs/default-cube-shulker.html: the sizes snapped to the 16px grid (see general.css, "Snapped to the grid"). Do not edit between these lines: run the script again after changing the page. */
@media screen {
    main > article:nth-child(2) > div:nth-child(1) > span:nth-child(1) { --snap-width: 80px; }
    main > article:nth-child(2) > div:nth-child(7) > button:nth-child(2) { --snap-width: 128px; }
}
/* /build: snap */
