/* =========================================================
   Article module — composer (editor, cover, tips), listing and
   the single-article vote control.
   Everything else is composed from Gtheme public classes; only
   the Quill editor, the cover dropzone, the sticky composer
   sidebar, the guideline list, the listing grid and the vote
   split action need module-level styling. Colours come from
   theme tokens only.
   ========================================================= */

/* ---------------------------------------------------------
   Composer layout
   --------------------------------------------------------- */
@media (min-width: 992px) {
    .article-composer__aside {
        position: sticky;
        top: 1rem;
    }
}

/* ---------------------------------------------------------
   Rich-text editor — the chrome, the typography and the states are the
   theme's: `gquill.css` skins the control and applies the same content
   scale the published article uses (`content.css` / `--rich-*`), driven by
   `GQuill.create()` in article_form.js. Never re-declare `.ql-*` rules here.
   The one module concern is the canvas: an article body is a long document,
   so it gets a taller editor than the theme's default. Linked after
   `gquill.css`, so this single declaration wins.
   --------------------------------------------------------- */
.article-editor .ql-editor {
    min-height: 22rem;
}

/* ---------------------------------------------------------
   Cover image dropzone
   --------------------------------------------------------- */
.article-cover {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-card-sm);
    background: var(--color-bg-surface-soft);
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.article-cover.is-dragover {
    border-color: var(--color-border-primary);
    background: var(--color-bg-primary-soft);
}

.article-cover__preview {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card-sm);
    background: var(--color-bg-surface);
}

.article-cover__preview img {
    display: block;
    width: 100%;
    max-height: 12rem;
    object-fit: cover;
}

.article-cover__placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 8rem;
    color: var(--color-text-soft);
    font-size: 0.85rem;
}

.article-cover__controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ---------------------------------------------------------
   Guideline list
   --------------------------------------------------------- */
.article-tips {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.article-tips li {
    margin-bottom: 0.15rem;
}

/* ---------------------------------------------------------
   Listing toolbar
   --------------------------------------------------------- */
.article-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.article-toolbar .ajus-form-inline {
    flex: 1 1 320px;
}

/* ---------------------------------------------------------
   Listing grid + card
   --------------------------------------------------------- */
.article-grid > [class*="col-"] {
    display: flex;
}

.article-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.article-card__media {
    display: block;
}

.article-card__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.article-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.article-card__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.article-card--draft {
    border-left: 3px solid var(--color-warning);
}

/* ---------------------------------------------------------
   Post vote control (up = left, down = right).
   The side the reader voted shows its solid icon in that vote's
   colour — green for an upvote, red for a downvote; hovering a
   side previews the colour of the vote its click would apply.
   Mirrors Modules/Qvote (Assets/css/qvote.css). The theme colours
   the spans of a postcard action, so the icon container is
   targeted directly.
   --------------------------------------------------------- */
[data-pc-action^="article-vote-"] .ajus-postcard-split__zone[data-pc-side="left"].is-active .ajus-postcard-action__icon,
[data-pc-action^="article-vote-"] .ajus-postcard-split__zone[data-pc-side="left"]:hover .ajus-postcard-action__icon {
    color: var(--color-success);
}

[data-pc-action^="article-vote-"] .ajus-postcard-split__zone[data-pc-side="right"].is-active .ajus-postcard-action__icon,
[data-pc-action^="article-vote-"] .ajus-postcard-split__zone[data-pc-side="right"]:hover .ajus-postcard-action__icon {
    color: var(--color-danger);
}

/*
 * The middle label holds the score, so it must stay visible at every value —
 * including 0 (the state of any article that has no votes yet).
 *
 * The shared postcard hides a split label whose value is falsy
 * (Global/Cards/postcard_action.twig: `{% if not action_text %} d-none{% endif %}`),
 * which treats the string "0" as empty. The theme's own client helper
 * PostCard.setText() hides a label only when it is truly empty, so the score
 * "0" is repainted (and shown) after a vote but is dropped on the first render.
 * A module never edits a Gtheme file, so the module re-shows it here — the
 * label of this action is always the score, never empty.
 */
[data-pc-action^="article-vote-"] .ajus-postcard-split__label.d-none {
    display: inline !important;
}
