/* EM Changelog — front-end styles, scoped under .em-cl.
   Colours come from the expeditionMeister theme's colors.css design tokens
   (loaded site-wide in the theme header). Hex fallbacks keep things sane if a
   token is ever missing, and let the plugin look right outside the theme too. */

.em-cl {
    /* Brand palette pulled from the theme tokens. */
    --em-cl-yellow:        var(--yellow-strong, #ffca0d);
    --em-cl-yellow-hover:  var(--yellow-hover, #ffb700);
    --em-cl-yellow-mid:    var(--yellow-mid, #efb203);
    --em-cl-yellow-soft:   var(--yellow-soft-light, #fff7d9);
    --em-cl-green:         var(--green-deep, #0b5f55);
    --em-cl-green-strong:  var(--green-strong, #005249);
    --em-cl-mint:          var(--save-badge-mint, #00bc7d);
    --em-cl-blue:          var(--blue-brand, #1356b3);
    --em-cl-blue-soft:     var(--blue-extra-light, #e9eff8);
    --em-cl-ink:           var(--black-base, #131313);
    --em-cl-dark:          var(--gray-deep-dark, #292927);
    --em-cl-text:          var(--gray-base, #656565);
    --em-cl-muted:         var(--gray-text, #6b6b6b);
    --em-cl-border:        var(--gray-border-soft, #eaeaea);
    --em-cl-border-2:      var(--gray-light, #d5d5d5);
    --em-cl-surface:       var(--gray-ultra-soft, #f5f5f5);
    --em-cl-surface-2:     var(--gray-ultra-extra-soft, #f9f9f9);
    --em-cl-red:           var(--red-error, #ef4444);

    --em-cl-radius:        16px;
    --em-cl-radius-sm:     12px;
    --em-cl-shadow:        0 8px 30px rgba(41, 41, 39, .07);
    --em-cl-shadow-sm:     0 2px 10px rgba(41, 41, 39, .05);

    font-family: Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--em-cl-ink);
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 16px;
    line-height: 1.5;
    box-sizing: border-box;
}

.em-cl *,
.em-cl *::before,
.em-cl *::after { box-sizing: border-box; }

/* ───────────── Cross-board nav ───────────── */

.em-cl-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 26px;
}
.em-cl-nav__tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--em-cl-text);
    background: var(--em-cl-surface);
    border: 1px solid var(--em-cl-border);
    text-decoration: none;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.em-cl-nav__tab:hover {
    color: var(--em-cl-dark);
    background: var(--em-cl-yellow-soft);
    border-color: var(--em-cl-yellow-mid);
}
.em-cl-nav__tab.is-active {
    color: var(--em-cl-ink);
    background: var(--em-cl-yellow);
    border-color: var(--em-cl-yellow);
    cursor: default;
}
.em-cl-nav__icon { font-size: 16px; }

@media (max-width: 480px) {
    .em-cl-nav__tab { padding: 8px 14px; font-size: 14px; }
}

/* ───────────── Header ───────────── */

.em-cl-header { margin-bottom: 28px; }
.em-cl-header__title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 6px;
    color: var(--em-cl-dark);
}
.em-cl-header__sub {
    font-size: 16px;
    color: var(--em-cl-text);
    margin: 0;
}

/* ───────────── Card primitive ───────────── */

.em-cl-card {
    background: #fff;
    border: 1px solid var(--em-cl-border);
    border-radius: var(--em-cl-radius);
    box-shadow: var(--em-cl-shadow-sm);
}

.em-cl-prose { color: var(--em-cl-text); font-size: 15px; line-height: 1.65; }
.em-cl-prose p { margin: 0 0 10px; }
.em-cl-prose p:last-child { margin-bottom: 0; }
.em-cl-prose ul, .em-cl-prose ol { margin: 0 0 10px 18px; }
.em-cl-prose li { list-style: disc; margin: 2px 0; }
.em-cl-prose a { color: var(--em-cl-green); text-decoration: underline; }

/* ───────────── Badges & pills ───────────── */

.em-cl-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2px;
    line-height: 1.4;
}
.em-cl-badge--new      { background: #d8f0e0; color: var(--em-cl-green); }
.em-cl-badge--improved { background: var(--em-cl-yellow-soft); color: #8a6d00; }
.em-cl-badge--fixed    { background: var(--em-cl-blue-soft); color: var(--em-cl-blue); }

.em-cl-version-tag,
.em-cl-entry__version {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: var(--em-cl-muted);
    background: var(--em-cl-surface);
    border: 1px solid var(--em-cl-border);
    border-radius: 999px;
    padding: 2px 10px;
}

.em-cl-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}
.em-cl-pill--request     { background: var(--em-cl-surface); color: var(--em-cl-text); }
.em-cl-pill--planned     { background: var(--em-cl-yellow-soft); color: #8a6d00; }
.em-cl-pill--in_progress { background: #d8f0e0; color: var(--em-cl-green); }
.em-cl-pill--done        { background: #d8f5e8; color: var(--em-cl-green-strong); }

/* ───────────── Vote control ───────────── */

.em-cl-vote {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 52px;
    padding: 8px 6px;
    border: 1px solid var(--em-cl-border-2);
    border-radius: var(--em-cl-radius-sm);
    background: #fff;
    color: var(--em-cl-dark);
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease, transform .1s ease;
    line-height: 1;
}
.em-cl-vote:hover { border-color: var(--em-cl-yellow); background: var(--em-cl-yellow-soft); }
.em-cl-vote:active { transform: scale(.96); }
.em-cl-vote.is-voted {
    border-color: var(--em-cl-yellow);
    background: var(--em-cl-yellow);
    color: var(--em-cl-ink);
}
.em-cl-vote.is-disabled,
.em-cl-vote:disabled { opacity: .5; cursor: not-allowed; }
.em-cl-vote.is-disabled:hover,
.em-cl-vote:disabled:hover { border-color: var(--em-cl-border-2); background: #fff; }
.em-cl-vote__arrow { font-size: 12px; }
.em-cl-vote__count { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.em-cl-vote.is-busy { opacity: .6; pointer-events: none; }
.em-cl-vote-msg {
    font-size: 11px;
    line-height: 1.3;
    color: var(--em-cl-red);
    margin-top: 6px;
    max-width: 120px;
    text-align: center;
}
.em-cl-roadmap-card__foot .em-cl-vote-msg { max-width: none; text-align: left; }

/* ───────────── Buttons & inputs (mirror the theme's .web-button) ───────────── */

.em-cl-btn {
    appearance: none;
    border: none;
    background: var(--em-cl-yellow);
    color: var(--em-cl-ink);
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    padding: 0 1.25rem;
    height: 2.75rem;
    border-radius: var(--em-cl-radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, color .2s ease, transform .1s ease, opacity .2s ease;
}
.em-cl-btn:hover { background: var(--em-cl-yellow-hover); color: var(--em-cl-ink); }
.em-cl-btn:active { transform: scale(.98); }
.em-cl-btn:disabled { opacity: .55; cursor: default; }
.em-cl-btn--sm { height: 2.25rem; font-size: 14px; padding: 0 .9rem; }

.em-cl-input,
.em-cl-textarea {
    width: 100%;
    border: 1px solid var(--em-cl-border-2);
    border-radius: var(--em-cl-radius-sm);
    padding: 11px 14px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: var(--em-cl-ink);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.em-cl-textarea { resize: vertical; min-height: 44px; }
.em-cl-input:focus,
.em-cl-textarea:focus {
    outline: none;
    border-color: var(--em-cl-yellow-mid);
    box-shadow: 0 0 0 3px var(--yellow-mid-transparent-10, rgba(239, 178, 3, .15));
}
.em-cl-input::placeholder,
.em-cl-textarea::placeholder { color: var(--gray-medium, #b3b3b3); }

.em-cl-form-status { font-size: 13px; color: var(--em-cl-text); }
.em-cl-form-status.is-ok { color: var(--em-cl-green); }
.em-cl-form-status.is-error { color: var(--em-cl-red); }

/* ───────────── Empty state ───────────── */

.em-cl-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--em-cl-text);
    background: var(--em-cl-surface-2);
    border: 1px dashed var(--em-cl-border-2);
    border-radius: var(--em-cl-radius);
}
.em-cl-empty__icon { font-size: 40px; margin-bottom: 10px; }
.em-cl-empty p { margin: 0; font-size: 15px; }

/* ───────────── Changelog timeline ───────────── */

.em-cl-timeline { list-style: none; margin: 0; padding: 0; }
.em-cl-entry {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 24px;
    position: relative;
    padding-bottom: 28px;
}
.em-cl-entry__aside { padding-top: 18px; }
.em-cl-entry__date {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--em-cl-dark);
}
.em-cl-entry__version {
    margin-top: 8px;
}
/* Connecting line + node */
.em-cl-entry__main { position: relative; padding-left: 28px; }
.em-cl-entry__main::before {
    content: "";
    position: absolute;
    left: 0;
    top: 26px;
    bottom: -28px;
    width: 2px;
    background: var(--em-cl-border);
}
.em-cl-entry:last-child .em-cl-entry__main::before { display: none; }
.em-cl-entry__main::after {
    content: "";
    position: absolute;
    left: -5px;
    top: 22px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--em-cl-yellow);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--em-cl-yellow-soft);
}
.em-cl-entry__card { padding: 22px 24px; }
.em-cl-entry__badges { margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.em-cl-entry__badges:empty { display: none; }
.em-cl-entry__title {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--em-cl-dark);
    line-height: 1.3;
}

/* ───────────── Roadmap board ───────────── */

.em-cl-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    align-items: start;
}
.em-cl-col {
    background: var(--em-cl-surface-2);
    border: 1px solid var(--em-cl-border);
    border-radius: var(--em-cl-radius);
    padding: 14px;
}
.em-cl-col__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 14px;
}
.em-cl-col__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--em-cl-text); flex: 0 0 auto; }
.em-cl-col--planned     .em-cl-col__dot { background: var(--em-cl-yellow-mid); }
.em-cl-col--in_progress .em-cl-col__dot { background: var(--em-cl-green); }
.em-cl-col--done        .em-cl-col__dot { background: var(--em-cl-mint); }
.em-cl-col--request     .em-cl-col__dot { background: var(--em-cl-text); }
.em-cl-col__title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--em-cl-dark);
    margin: 0;
    flex: 1;
}
.em-cl-col__count {
    font-size: 12px;
    font-weight: 700;
    color: var(--em-cl-text);
    background: #fff;
    border: 1px solid var(--em-cl-border);
    border-radius: 999px;
    padding: 1px 9px;
}
.em-cl-col__body { display: flex; flex-direction: column; gap: 12px; }
.em-cl-col__empty { font-size: 13px; color: var(--gray-medium, #b3b3b3); text-align: center; padding: 16px 0; margin: 0; }

.em-cl-roadmap-card { padding: 14px 16px; }
.em-cl-roadmap-card__badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.em-cl-roadmap-card__title { font-size: 15px; font-weight: 700; margin: 0 0 6px; color: var(--em-cl-dark); line-height: 1.35; }
.em-cl-roadmap-card__excerpt { font-size: 13px; color: var(--em-cl-text); margin: 0 0 12px; line-height: 1.55; }
.em-cl-roadmap-card__foot { display: flex; align-items: center; gap: 12px; }
.em-cl-roadmap-card__foot .em-cl-vote { flex-direction: row; min-width: 0; padding: 5px 12px; gap: 6px; }
.em-cl-roadmap-card__foot .em-cl-vote__count { font-size: 14px; }
.em-cl-roadmap-card__comments { font-size: 13px; color: var(--em-cl-muted); }

/* ───────────── Feature-request board ───────────── */

.em-cl-board-wrap { max-width: 760px; }

.em-cl-submit { padding: 22px 24px; margin-bottom: 22px; }
.em-cl-submit__title { font-size: 18px; font-weight: 700; margin: 0 0 14px; color: var(--em-cl-dark); }
.em-cl-submit__form { display: flex; flex-direction: column; gap: 12px; }
.em-cl-submit__row { display: flex; gap: 12px; }
.em-cl-submit__row .em-cl-input { flex: 1; }
.em-cl-submit__actions { display: flex; align-items: center; gap: 14px; }
.em-cl-submit__locked { font-size: 15px; color: var(--em-cl-text); margin: 0; }
.em-cl-submit__locked a { color: var(--em-cl-green); text-decoration: underline; }

/* File upload field */
.em-cl-upload { display: flex; flex-direction: column; gap: 10px; }
.em-cl-upload__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 9px 16px;
    border: 1px dashed var(--em-cl-border-2);
    border-radius: var(--em-cl-radius-sm);
    background: var(--em-cl-surface-2);
    color: var(--em-cl-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.em-cl-upload__btn:hover { border-color: var(--em-cl-yellow-mid); background: var(--em-cl-yellow-soft); color: var(--em-cl-dark); }
.em-cl-upload__icon { font-size: 16px; }
.em-cl-upload__list { display: flex; flex-wrap: wrap; gap: 8px; }
.em-cl-upload__list:empty { display: none; }

.em-cl-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 220px;
    padding: 5px 8px 5px 5px;
    background: #fff;
    border: 1px solid var(--em-cl-border);
    border-radius: 10px;
    box-shadow: var(--em-cl-shadow-sm);
}
.em-cl-file-chip__thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.em-cl-file-chip__icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; }
.em-cl-file-chip__name { font-size: 12px; color: var(--em-cl-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-cl-file-chip__remove {
    appearance: none; border: none; background: var(--em-cl-surface); color: var(--em-cl-text);
    width: 18px; height: 18px; border-radius: 50%; line-height: 1; font-size: 14px;
    cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.em-cl-file-chip__remove:hover { background: var(--em-cl-red); color: #fff; }

/* Attachments rendered on a request card */
.em-cl-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.em-cl-attachment--img {
    display: block; width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
    border: 1px solid var(--em-cl-border); background: var(--em-cl-surface);
}
.em-cl-attachment--img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.em-cl-attachment--img:hover img { transform: scale(1.05); }
.em-cl-attachment--file {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 12px; border: 1px solid var(--em-cl-border); border-radius: 10px;
    background: var(--em-cl-surface-2); color: var(--em-cl-text); font-size: 13px; font-weight: 600;
    max-width: 240px;
}
.em-cl-attachment--file:hover { border-color: var(--em-cl-yellow-mid); color: var(--em-cl-dark); }
.em-cl-attachment__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.em-cl-board-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}
.em-cl-board-toolbar__count { font-size: 14px; font-weight: 600; color: var(--em-cl-text); }
.em-cl-sort { display: inline-flex; background: var(--em-cl-surface); border: 1px solid var(--em-cl-border); border-radius: 999px; padding: 3px; }
.em-cl-sort__btn {
    appearance: none; border: none; background: none;
    font-family: inherit; font-size: 13px; font-weight: 600;
    color: var(--em-cl-text); padding: 6px 14px; border-radius: 999px; cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.em-cl-sort__btn.is-active { background: #fff; color: var(--em-cl-dark); box-shadow: var(--em-cl-shadow-sm); }

.em-cl-board-list { display: flex; flex-direction: column; gap: 14px; }

.em-cl-request { display: flex; gap: 16px; padding: 18px 20px; align-items: flex-start; }
.em-cl-request__vote { flex: 0 0 auto; }
.em-cl-request__body { flex: 1; min-width: 0; }
.em-cl-request__head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; }
.em-cl-request__title { font-size: 17px; font-weight: 700; margin: 0; color: var(--em-cl-dark); line-height: 1.35; }
.em-cl-request__content { font-size: 14px; color: var(--em-cl-text); margin: 8px 0 0; line-height: 1.6; }
.em-cl-request__content p { margin: 0 0 8px; }
.em-cl-request__content p:last-child { margin-bottom: 0; }
.em-cl-request__meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--em-cl-muted); flex-wrap: wrap; }
.em-cl-request__author { font-weight: 600; color: var(--em-cl-text); }
.em-cl-dot { color: var(--em-cl-border-2); }

.em-cl-comments-toggle {
    appearance: none; border: none; background: none; cursor: pointer;
    font-family: inherit; font-size: 13px; color: var(--em-cl-muted);
    display: inline-flex; align-items: center; gap: 5px; padding: 0;
    transition: color .15s ease;
}
.em-cl-comments-toggle:hover { color: var(--em-cl-green); }

/* ───────────── Comments panel ───────────── */

.em-cl-comments { margin-top: 16px; border-top: 1px solid var(--em-cl-border); padding-top: 14px; }
.em-cl-comments__list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.em-cl-comments__loading,
.em-cl-comments__empty { font-size: 13px; color: var(--gray-medium, #b3b3b3); margin: 0; }
.em-cl-comments__locked { font-size: 13px; color: var(--em-cl-muted); margin: 0; }

.em-cl-comment { display: flex; gap: 10px; }
.em-cl-comment__avatar {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
    background: var(--em-cl-green); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; text-transform: uppercase;
}
.em-cl-comment__body { flex: 1; min-width: 0; }
.em-cl-comment__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.em-cl-comment__name { font-size: 13px; font-weight: 700; color: var(--em-cl-dark); }
.em-cl-comment__time { font-size: 12px; color: var(--em-cl-muted); }
.em-cl-comment__text { font-size: 14px; color: var(--em-cl-text); line-height: 1.55; margin: 0; white-space: pre-wrap; word-wrap: break-word; }

.em-cl-comment-form { display: flex; flex-direction: column; gap: 8px; }
.em-cl-comment-form__actions { display: flex; align-items: center; gap: 12px; }

/* ───────────── Responsive ───────────── */

@media (max-width: 640px) {
    .em-cl { margin: 24px auto; }
    .em-cl-header__title { font-size: 24px; }
    .em-cl-entry { grid-template-columns: 1fr; gap: 6px; }
    .em-cl-entry__aside { padding-top: 0; display: flex; align-items: center; gap: 10px; }
    .em-cl-entry__main { padding-left: 0; }
    .em-cl-entry__main::before,
    .em-cl-entry__main::after { display: none; }
    .em-cl-submit__row { flex-direction: column; }
    .em-cl-request { padding: 16px; gap: 12px; }
}
