/* ==========================================================================
   Beat sheet tool: what PHP renders on the hub and template pages (cards, drafts,
   comparison table, written-out beats). The editor's own styles are in beat-sheet.css.
   ========================================================================== */

.beat-page .tool-hero h1 {
    text-wrap: balance;
}

.beat-section-title {
    font-family: var(--font-ui);
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--text-primary);
    margin: 0 0 14px;
}

/* Cards --------------------------------------------------------------------- */
.beat-card {
    display: flex;
    flex-direction: column;
}

.beat-timeline {
    display: block;
    max-width: 100%;
    height: auto;
    flex: none;
    color: var(--accent);
    margin-bottom: 14px;
}

.tool-card p.beat-card-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--tool-muted);
}

.beat-card-tag {
    padding: 2px 8px;
    background: var(--accent-light);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.beat-hub-import {
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.beat-hub-error {
    margin: 0 0 16px;
    padding: 10px 14px;
    background: var(--accent-light);
    border-radius: 6px;
    font-family: var(--font-ui);
    font-size: 14.5px;
    color: var(--text-primary);
}

.beat-start-hint {
    margin: 0 0 16px;
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* The fixed site header would cover the heading this link jumps to */
#beat-compare {
    scroll-margin-top: 96px;
}

/* Twelve full cards in one column are a very long scroll */
@media (max-width: 560px) {
    .beat-cards {
        gap: 10px;
    }

    .beat-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: baseline;
        column-gap: 12px;
        padding: 14px 16px;
    }

    .beat-card .beat-timeline {
        display: none;
    }

    .tool-card.beat-card h3 {
        font-size: 1.1875rem;
        margin: 0 0 4px;
    }

    .tool-card.beat-card p {
        grid-column: 1 / -1;
        grid-row: 2;
        font-size: 14px;
        line-height: 1.45;
    }

    .tool-card.beat-card p.beat-card-count {
        grid-column: 2;
        grid-row: 1;
        flex-direction: row-reverse;
        padding-top: 0;
    }
}

/* The other structures, under a template's own text ------------------------- */
.beat-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
    gap: 10px;
    max-width: 1080px;
    list-style: none;
    margin: 0 auto;
    padding: 0;
}

.beat-links li {
    min-width: 0;
    margin: 0;
}

.beat-links a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    height: 100%;
    padding: 12px 16px;
    background: var(--tool-paper);
    border: 1px solid var(--tool-line);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.beat-links a:hover {
    border-color: #D6D3D1;
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.beat-links a:focus-visible {
    outline: none;
    box-shadow: var(--tool-focus);
}

.beat-link-name {
    min-width: 0;
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
}

.beat-link-count {
    flex: none;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--tool-muted);
}

/* Continue where you left off ------------------------------------------------ */
.beat-drafts {
    margin-bottom: 40px;
}

.beat-drafts-list {
    display: grid;
    /* Same tracks as .tool-grid, so drafts line up with the cards below them */
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.beat-drafts-list li {
    min-width: 0;
    margin: 0;
}

/* SHOWN in the hub's script */
.beat-drafts-list:not(.is-expanded) li:nth-child(n+5) {
    display: none;
}

.beat-drafts-more {
    display: block;
    margin: 12px 0 0;
    padding: 4px 0;
    background: none;
    border: 0;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
}

.beat-drafts-more[hidden] {
    display: none;
}

.beat-drafts-more:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.beat-drafts-more:focus-visible {
    outline: none;
    box-shadow: var(--tool-focus);
}

.beat-draft {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px 16px;
    background: var(--tool-paper);
    border: 1px solid var(--tool-line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.beat-draft:hover {
    border-color: #D6D3D1;
    border-left-color: var(--accent);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.beat-draft:focus-visible {
    outline: none;
    box-shadow: var(--tool-focus);
}

.beat-drafts-list li {
    position: relative;
}

.beat-draft-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 5px;
    font-family: var(--font-ui);
    font-size: 18px;
    line-height: 1;
    color: var(--tool-muted);
    cursor: pointer;
}

.beat-draft-delete:hover {
    background: var(--accent-light);
    color: var(--text-primary);
}

.beat-draft-delete:focus-visible {
    outline: 2px solid var(--accent);
}

.beat-draft-gone {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding: 14px 16px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--tool-muted);
    overflow-wrap: anywhere;
}

.beat-draft-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
}

.beat-draft-template {
    display: block;
    margin-top: 2px;
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.4;
    color: var(--tool-muted);
}

/* Two pieces with no separator between them: a wrap leaves nothing hanging */
.beat-draft-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 12px;
    margin: 4px 0 12px;
    font-family: var(--font-ui);
    font-size: 13px;
    line-height: 1.4;
    color: var(--tool-muted);
}

.beat-draft-meta span {
    white-space: nowrap;
}

.beat-draft-bar {
    display: block;
    flex: none;
    height: 4px;
    margin-top: auto;
    overflow: hidden;
    background: var(--surface);
    border-radius: 2px;
}

.beat-draft-bar span {
    display: block;
    height: 100%;
    background: var(--accent);
}

/* Comparison table ------------------------------------------------------------ */
.wpd-table.beat-compare {
    min-width: 0;
}

.beat-compare-length {
    white-space: nowrap;
}

@media (max-width: 560px) {
    .beat-compare thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .beat-compare tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
    }

    .wpd-table.beat-compare th,
    .wpd-table.beat-compare td {
        display: block;
        padding: 0;
        border: 0;
    }

    .beat-compare-length {
        color: var(--tool-muted);
    }

    .wpd-table.beat-compare .beat-compare-when {
        grid-column: 1 / -1;
        margin-top: 4px;
    }
}

/* Beats written out under the editor ------------------------------------------- */
.beat-outline-item {
    margin-bottom: 28px;
}

.beat-outline-item p {
    margin-bottom: 8px;
}

.beat-outline-item h3,
.beat-outline-item h4 {
    margin: 0 0 2px;
    font-family: var(--font-ui);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--text-primary);
}

.beat-outline-item .beat-outline-where {
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--tool-muted);
}
