/* Outline-board (board.js): acts, colour legend, logline and synopsis, card grip and footer,
   pointer dragging and the card menu. The card itself (paper, colour strip, title, text) is in
   styles.css section 04; this file only adds to it. */

/* The four card colours, as in styles.css (.post-it-card.color-*), for the legend and menu swatches */
.board-legend-item.color-yellow, .board-menu-swatch.color-yellow { --card-tint: #E9D78E; }
.board-legend-item.color-blue, .board-menu-swatch.color-blue { --card-tint: #B5C4DA; }
.board-legend-item.color-pink, .board-menu-swatch.color-pink { --card-tint: #E2BDC6; }
.board-legend-item.color-green, .board-menu-swatch.color-green { --card-tint: #B7CFB0; }

/* ---- Header controls ---- */
.board-controls .board-zoom {
    margin-left: 4px;
}
.board-controls .board-zoom #board-zoom-slider {
    margin: 0;
}

/* ---- Logline and synopsis ---- */
.board-story {
    margin: -8px 0 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
}
.board-story > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 14px;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    font-weight: 600;
}
.board-story > summary::-webkit-details-marker {
    display: none;
}
.board-story > summary::before {
    content: '▸';
    flex: none;
    width: 1em;
    color: var(--muted);
}
.board-story[open] > summary::before {
    content: '▾';
}
.board-story > summary:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: -2px;
}
.board-story-label {
    flex: none;
}
.board-story-preview {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    color: var(--muted);
}
.board-story[open] .board-story-preview {
    display: none;
}
.board-story-fields {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 14px 14px;
    border-top: 1px solid var(--line);
}
.board-story-fields label {
    margin-top: 8px;
    font-family: var(--font-editor);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.board-story-fields textarea {
    width: 100%;
    max-width: 72ch;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.45;
    resize: vertical;
}
.board-story-fields textarea:focus {
    outline: 2px solid var(--ink);
    outline-offset: 0;
    border-color: var(--ink);
}
.board-story-fields textarea[readonly] {
    color: var(--muted);
}
.board-story-hint {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* ---- Colour legend ---- */
.board-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    margin: 0 0 24px;
}
.board-legend-label {
    font-family: var(--font-editor);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.board-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}
.board-legend-swatch {
    flex: none;
    width: 16px;
    height: 16px;
    background: var(--card-tint);
    border: 1px solid var(--line-strong);
    border-radius: 2px;
}
.board-legend-input {
    width: 9.5em;
    min-height: 32px;
    padding: 2px 2px;
    background: transparent;
    border: 0;
    border-bottom: 1px dashed var(--line-strong);
    border-radius: 0;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 14px;
}
.board-legend-input::placeholder {
    color: var(--muted);
}
.board-legend-input:focus {
    outline: none;
    border-bottom: 1px solid var(--ink);
}

/* ---- Empty board ---- */
.board-empty {
    grid-column: 1 / -1;
    padding: 40px 24px;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: 4px;
}
.board-empty p {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.board-empty .board-empty-hint {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 400;
    color: var(--muted);
}

/* ---- Acts (lanes): one band per act, the cards in a grid inside it ---- */
.board-grid.has-lanes {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* .board-grid's align-items: start would shrink each act to its content */
    gap: 28px;
}
.board-lane {
    border-top: 1px solid var(--line-strong);
}
.board-lane-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 8px 0;
}
.board-lane-name {
    flex: 0 1 18em;
    min-width: 6em;
    min-height: 44px;
    padding: 0 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--ink);
    font-family: var(--font-title);
    font-size: 28px;
    line-height: 1;
}
.board-lane-name:hover:not([readonly]) {
    border-color: var(--line);
}
.board-lane-name:focus {
    outline: none;
    border-color: var(--ink);
    background: var(--surface);
}
.board-lane-count {
    margin-right: auto;
    font-family: var(--font-editor);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.board-lane-remove:hover {
    color: var(--red);
    background: var(--red-bg);
}
.board-lane-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width, 250px), 1fr));
    gap: 24px;
    align-items: start;
    min-height: 96px;
    padding: 8px 0 4px;
}
.board-lane-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 28px 16px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: 4px;
    color: var(--muted);
    font-size: 14px;
}
/* The hint only shows while the act has no cards (it stays last, so a card before it hides it) */
.board-lane-cards .post-it-card ~ .board-lane-empty {
    display: none;
}

/* ---- Card: grip, menu button and footer ---- */
.post-it-card .card-header {
    padding-left: 0;
}
/* The handle to drag by. touch-action: none lets a finger start the drag at once; the rest of
   the card scrolls the board as usual (a long press there drags too). */
.card-grip {
    position: relative;
    flex: none;
    align-self: stretch;
    width: 24px;
    min-height: 44px;
    cursor: grab;
    touch-action: none;
}
.card-grip::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 8px;
    width: 9px;
    height: 16px;
    background-image: radial-gradient(circle, var(--muted) 1.2px, transparent 1.5px);
    background-size: 4.5px 4px;
}
/* A finger needs a wider handle (44px tall already) */
@media (pointer: coarse) {
    .card-grip {
        width: 40px;
    }
    .card-grip::before {
        left: 14px;
    }
}
.card-grip:hover::before {
    background-image: radial-gradient(circle, var(--ink) 1.2px, transparent 1.5px);
}
.card-menu-btn {
    flex: none;
}
.card-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    padding: 0 4px 0 14px;
    border-top: 1px solid var(--line);
}
.card-meaning {
    padding: 8px 0;
    font-family: var(--font-editor);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
}
.card-scene {
    margin-left: auto;
}
button.card-scene {
    min-height: 44px;
    padding: 0 8px;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--ink);
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: .2em;
    white-space: nowrap;
}
button.card-scene:hover {
    background: var(--fill);
}
.card-scene-missing {
    padding: 12px 8px;
    color: var(--red);
    font-size: 13px;
}

/* ---- Dragging ---- */
.board-grid.is-dragging,
.board-grid.is-dragging * {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
}
.post-it-card.is-drag-source {
    opacity: .35;
    outline: 2px dashed var(--ink);
    outline-offset: 2px;
}
.board-drag-ghost {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: .95;
    box-shadow: 0 12px 28px rgba(30, 27, 22, .22);
}

/* ---- Menus (the toolbar menu's look) ---- */
.board-menu {
    max-height: calc(100vh - 16px);
    overflow-y: auto;
}
.board-menu-heading {
    padding: 8px 16px 2px;
    font-family: var(--font-editor);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.toolbar-more-menu.board-menu button {
    justify-content: flex-start;
}
.board-menu .board-menu-text {
    flex: 1 1 auto;
}
.board-menu-swatch {
    flex: none;
    width: 16px;
    height: 16px;
    background: var(--card-tint);
    border: 1px solid var(--line-strong);
    border-radius: 2px;
}
.board-menu button[role="menuitemradio"]::after {
    content: '';
    width: 1em;
    text-align: right;
}
.board-menu button[role="menuitemradio"][aria-checked="true"]::after {
    content: '✓';
}

/* ---- Dialog ---- */
.board-dialog .modal-body p {
    margin: 0 0 12px;
    line-height: 1.5;
}
.board-dialog select {
    width: 100%;
}
.board-dialog .modal-footer {
    flex-wrap: wrap;
}

/* ---- Read-only: changes are refused anyway; the grip shows it ---- */
.is-read-only .card-grip {
    cursor: default;
    opacity: .4;
}
.is-read-only .board-legend-input,
.is-read-only .board-lane-name {
    pointer-events: none;
}

/* ---- Phones ---- */
@media screen and (max-width: 850px) {
    .board-canvas-container {
        padding: 16px;
    }
    .board-header {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    .board-title-area h2 {
        font-size: 34px;
    }
    .board-controls {
        width: 100%;
        padding: 6px;
    }
    .board-story {
        margin-top: 0;
    }
    .board-lane-name {
        font-size: 24px;
    }
}
@media screen and (max-width: 600px) {
    .board-controls .btn {
        flex: 1 1 auto;
    }
    /* One column of cards anyway: the size slider has nothing to do */
    .board-controls .board-zoom {
        display: none;
    }
    .board-grid,
    .board-lane-cards {
        gap: 16px;
    }
    .board-legend-input {
        width: 7.5em;
    }
}
