/* Shapes tool (/shapes-vectors): the stage (one canvas with the shapes), the shape library and the few controls of its own.
   Buttons, sliders, palettes and colours come from the app kit and the shared landing controls (docs/app-kit.md).
   Loaded only on this app's page (StylePaths in SeoFilterDemoCatalog.ShapesTool.cs). */

.shapes-tool-landing-app {
    display: grid;
    gap: 1rem;
    align-items: start;
}

.filter-landing-stage.shapes-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
    box-shadow: none;
    background: #eef1f5;
}

.dark .filter-landing-stage.shapes-stage {
    background: #161a22;
}

.shapes-canvas {
    display: block;
    width: 100%;
    height: auto;
    max-height: 78vh;
    object-fit: contain;
    /* Shapes are moved, resized and turned on the canvas, so it handles touch itself. */
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: crosshair;
    outline: none;
}

.shapes-canvas:focus-visible {
    box-shadow: 0 0 0 3px var(--ak-accent, #2563eb);
}

.shapes-canvas.is-dragging {
    cursor: move;
}

body.filter-app-mode .shapes-tool-landing-app > .filter-landing-stage.shapes-stage {
    height: 100%;
    max-height: 100%;
    min-height: 0;
}

body.filter-app-mode .shapes-canvas {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.shapes-file-input {
    display: none;
}

.shapes-status {
    margin: 0;
    min-height: 1.4em;
    font-size: 0.875rem;
    color: var(--ak-muted, #64748b);
    font-variant-numeric: tabular-nums;
}

/* Hidden palettes (no fill, no gradient). */
.shapes-controls [hidden] {
    display: none;
}

/* CJK labels never wrap before a prolonged sound mark or small kana (コピ / ー). */
.shapes-controls {
    line-break: strict;
}

/* The shape library: category chips, a search field and a grid of thumbnails. */
.shapes-library {
    display: grid;
    gap: 0.5rem;
}

.shapes-search {
    width: 100%;
}

.shapes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 4px;
    max-height: 212px;
    overflow-y: auto;
    padding: 2px;
}

.shapes-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    padding: 0;
    border: 1px solid var(--ak-border, #e2e8f0);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.shapes-thumb:hover,
.shapes-thumb:focus-visible {
    border-color: var(--ak-accent, #2563eb);
    box-shadow: 0 0 0 2px var(--ak-accent, #2563eb) inset;
    outline: none;
}

.shapes-thumb canvas {
    width: 44px;
    height: 44px;
}

.shapes-empty {
    grid-column: 1 / -1;
    margin: 0.25rem 0;
    color: var(--ak-muted, #64748b);
    font-size: 0.875rem;
}

.shapes-more {
    justify-self: start;
}
