/* The feedback app's page (feedback-app.html): its own parts (the panel, title and text come from post.css) */

/* The post's title is the page title: size and spacing from the type scale in general.css */
.post h1 {
    margin-top: 0;  /* no date line above it: the title starts at the panel's inner edge */
    overflow-wrap: anywhere;
}

/* Phone screenshots side by side, in the black "screen" frame of the pictures */
.post_body .shots {
    --n: 3;  /* pictures in the row */
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 0 0 32px;
    padding: 14px;  /* with the 2px border: 16px around the pictures, the row stays on the grid */
}

.post_body .shots:has(> img:nth-child(4)) {
    --n: 4;
}

.post_body .shots img {
    flex: 0 1 256px;
    min-width: 0;
    object-fit: contain;
    margin: 0;
    border: 0;
    border-radius: 6px;
}

/* ---------- The app itself, running in a phone frame (apps/feedback-app, script/feedback-sim.js) ---------- */
.fb_sim {
    display: grid;
    grid-template-columns: 384px 1fr;
    gap: 32px;
    align-items: start;
    margin: 16px 0 32px;
}

.fb_phone {
    box-sizing: border-box;
    width: 384px;
    height: 752px;
    padding: 10px;
    border: 2px solid var(--color-line);
    border-radius: 32px;
    background-color: var(--color-screen);
}

.fb_phone iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 22px;
    background-color: #FFF7FE;  /* the app's own background, while it starts */
}

/* Before the start: the app icon and the button */
.fb_start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    height: 100%;
    text-align: center;
}

.fb_start img {
    width: 128px;
    height: 128px;
    border-radius: 28px;
    background-color: #FFFFFF;
}

.fb_start p {
    margin: 0;
    color: var(--color-secondary);
    font-size: var(--fs-small);
    line-height: var(--lh-small);
}

.fb_button {
    display: inline-block;
    border-color: var(--color-border);
    background: none;
    color: var(--color-border);
    text-decoration: none;
}

.fb_button.primary {
    background-color: var(--color-border);
    color: #FFFFFF;
}

.fb_side h2 {
    margin-top: 0;
}

.fb_side ul {
    margin: 0 0 16px;
    padding-left: 32px;
    font-size: var(--fs-small);
    line-height: 32px;  /* every line a 32px row, so the buttons below stay on the grid */
}

.fb_side b {
    font-weight: normal;
    color: var(--color-primary);
}

.fb_actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.fb_actions [hidden] {
    display: none;
}

.fb_sim button:focus-visible,
.fb_sim a:focus-visible {
    outline: 2px solid var(--color-border);
    outline-offset: 2px;
}

/* Narrow screens: the notes under the phone */
@media screen and (max-width: 860px) {
    .fb_sim {
        grid-template-columns: 1fr;
    }

    .fb_phone {
        width: 100%;
        max-width: 384px;
        margin: 0 auto;
    }
}

/* ---------- The class diagram (drawn from the app's code, english branch) ---------- */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
}

.class_frame {
    --w: max(960px, 100cqi - 36px);  /* the drawing's width: the frame's inside (2px border, 16px padding), or more */
    --r: 384 / 1088;                 /* its proportions */
    box-sizing: border-box;
    margin: 0 0 32px;
    padding: 16px;
    overflow-x: auto;  /* phones: the diagram keeps its size and scrolls sideways */
    scrollbar-width: none;  /* no scrollbar: its height (only with desktop scrollbars) would push the frame off the grid */
}

/* The class diagram: at most its own width, centred; on phones narrower than the backend drawing */
.class_diagram:not(.backend_diagram) {
    max-width: 1088px;
    min-width: 640px;
    margin: 0 auto;
}

.class_frame:has(> .class_diagram:not(.backend_diagram)) {
    --w: clamp(640px, 100cqi - 36px, 1088px);  /* min-/max-width on the class diagram */
    --r: 648 / 1088;
}

/* Snapped to the 16px grid, in CSS, from the panel's width (100cqi): the screenshots' height rounded down (each is
   as wide as its share of the row, at most 256px; 16px around and between them), the diagrams' frames rounded up.
   0.16px: a height a hair off a grid line counts as on it. Screen only. */
@media screen {
    .post_body .shots img {
        height: round(down, min(256px, (100cqi - 32px - (var(--n) - 1) * 16px) / var(--n)) * 1169 / 540 + 0.16px, 16px);
    }

    .class_frame {
        height: round(up, var(--w) * var(--r) + 36px - 0.16px, 16px);
    }
}

.class_diagram {
    display: block;
    width: 100%;
    min-width: 960px;
    height: auto;
    font-family: 'JetBrains Mono', monospace;
}

/* build: snap - generated by build_snap.py from feedback-app.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) > section:nth-child(2) > div:nth-child(1) > div:nth-child(1) > button:nth-child(2) { --snap-width: 160px; }
    main > article:nth-child(2) > section:nth-child(2) > div:nth-child(2) > div:nth-child(3) > a:nth-child(2) { --snap-width: 176px; }
}
/* /build: snap */
