/* Cocktail Journal – context-bound comments and mobile bottom sheet */

.journal-comments-sheet {
    margin-top: 0.55rem;
}

.journal-comments-sheet > summary {
    list-style: none;
}

.journal-comments-sheet > summary::-webkit-details-marker {
    display: none;
}

.journal-comment-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 2rem;
    border: 0;
    padding: 0.2rem 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 800;
}

.journal-comment-trigger .ui-icon {
    width: 0.9rem;
    height: 0.9rem;
}

.journal-comments-sheet[open]::before {
    content: "";
    position: fixed;
    z-index: 118;
    inset: 0;
    background: color-mix(in srgb, #000 48%, transparent);
    backdrop-filter: blur(2px);
}

.journal-comment-sheet-panel {
    position: fixed;
    z-index: 119;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: min(44rem, 100%);
    max-height: min(78dvh, 46rem);
    margin-inline: auto;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 1.15rem 1.15rem 0 0;
    background: var(--surface);
    box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.24);
    overflow: hidden;
}

.journal-comment-sheet-panel::before {
    content: "";
    width: 2.7rem;
    height: 0.24rem;
    margin: 0.55rem auto 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text-muted) 42%, transparent);
}

.journal-comment-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem 0.8rem;
    border-bottom: 1px solid var(--border);
}

.journal-comment-sheet-header > div {
    display: grid;
    gap: 0.1rem;
}

.journal-comment-sheet-header .eyebrow {
    margin: 0;
}

.journal-comment-sheet-header strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
}

.journal-comment-sheet-close {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--text);
    text-decoration: none;
    font-size: 1.4rem;
    line-height: 1;
}

.journal-comment-context {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.15rem 0.55rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}

.journal-comment-context strong {
    font-size: 0.78rem;
}

.journal-comment-context span {
    align-self: center;
    color: var(--text-muted);
    font-size: 0.66rem;
    text-align: right;
}

.journal-comment-context p {
    grid-column: 1 / -1;
    margin: 0.2rem 0 0;
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.45;
    white-space: pre-line;
}

.journal-comment-list {
    min-height: 7rem;
    padding: 0.85rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.journal-comment {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.65rem 0;
}

.journal-comment + .journal-comment {
    border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.journal-comment-avatar {
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid color-mix(in srgb, var(--accent-gold) 45%, var(--border));
    border-radius: 50%;
    background: var(--surface-raised);
    color: var(--text);
    font-size: 0.65rem;
    font-weight: 850;
}

.journal-comment > div {
    min-width: 0;
}

.journal-comment header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.journal-comment header strong {
    font-size: 0.76rem;
}

.journal-comment header time {
    color: var(--text-muted);
    font-size: 0.62rem;
    white-space: nowrap;
}

.journal-comment p {
    margin: 0.22rem 0 0;
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-line;
}

.journal-comments-empty {
    margin: 1.2rem auto;
    max-width: 25rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: center;
}

.journal-comment-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
    padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.journal-comment-form textarea {
    min-height: 3rem;
    max-height: 8rem;
    resize: vertical;
}

.journal-comment-form .button-primary {
    min-height: 3rem;
    margin: 0;
    white-space: nowrap;
}

@media (max-width: 520px) {
    .journal-comment-sheet-panel {
        max-height: 84dvh;
    }

    .journal-comment-form {
        grid-template-columns: 1fr;
    }

    .journal-comment-form .button-primary {
        width: 100%;
        min-height: 2.7rem;
    }
}
