/* ==========================================================================
   assets/css/autonews.css — Automated league news feed (homepage, index.php)
   Page-scoped (.an-*). Loaded only when the feed has stories. Fonts and the
   royalblue accent follow theme.css (Oswald headings, Open Sans text, the
   site's royalblue buttons). Images carry explicit sizes + max-width: none
   because base.css sets img { max-width: 100% }.
   Stage 2: space below the feed, the wide last card (no orphan), the trade
   reserve, comments, Commissioner buttons, status messages, deadline tile.
   ========================================================================== */

.an-feed {
    container-type: inline-size;
    container-name: anfeed;
    margin: 30px 0 10px;
    padding-bottom: 30px;
    border-bottom: 1px solid #333333;
}

.an-feed__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 14px;
    margin: 0 0 16px;
}

.an-feed__title {
    font-family: 'Oswald', sans-serif;
    font-size: 22px;
    line-height: 1.1;
    text-transform: uppercase;
    margin: 0;
    padding: 0;
}

.an-feed__sub {
    margin: 0;
    font-size: 12px;
    color: #666;
}

/* The homepage gives every child of .main-content `padding: 0 20px` (0,2,0), which
   removed the feed's bottom padding; this selector restores it and adds the space
   before the manual LeagueNews posts. */
.left-sidebar-grid > .main-content > .an-feed {
    padding: 0 20px 36px;
    margin-bottom: 48px;
}

/* ── Story (shared) ─────────────────────────────────────────── */
.an-story {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    overflow: hidden;
    min-width: 0;
}

.an-story--pinned {
    border-color: royalblue;
}

.an-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px 14px;
    min-width: 0;
}

.an-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0;
    font-size: 11px;
    line-height: 1.2;
}

.an-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: royalblue;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.an-when {
    color: #666;
    font-weight: 600;
}

.an-headline {
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.an-headline a,
.an-headline a:visited {
    color: #222;
    text-decoration: none;
}

.an-headline a:hover,
.an-headline a:focus-visible {
    color: royalblue;
    text-decoration: underline;
}

.an-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #333;
    overflow-wrap: anywhere;
}

.an-more {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 700;
}

.an-more a,
.an-more a:visited {
    color: royalblue;
    text-decoration: none;
}

.an-more a:hover,
.an-more a:focus-visible {
    text-decoration: underline;
}

/* ── Media ──────────────────────────────────────────────────── */
.an-media {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 14px;
    background: linear-gradient(135deg, #f1f3f8 0%, #e2e6f0 100%);
    min-height: 110px;
}

.an-media a {
    display: block;
    position: relative;
    line-height: 0;
}

.an-media--person > a,
.an-media--person {
    position: relative;
}

.an-mug,
.an-badge,
.an-logo {
    display: block;
    flex: none;
}

.an-mug {
    width: 96px;
    height: 96px;
    max-width: none;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 3px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}

.an-badge {
    position: absolute;
    right: -6px;
    bottom: -4px;
    width: 34px;
    height: 34px;
    max-width: none;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.an-logo {
    width: 64px;
    height: 64px;
    max-width: none;
    object-fit: contain;
}

.an-logo--loser {
    opacity: .9;
}

.an-logo--solo {
    width: 80px;
    height: 80px;
}

.an-score,
.an-swap {
    font-family: 'Oswald', sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #222;
    white-space: nowrap;
}

.an-swap {
    color: royalblue;
}

/* Cards of the grid: one picture height, so a row of two lines up. */
.an-card .an-media {
    height: 124px;
    min-height: 0;
    box-sizing: border-box;
}

/* ── Lead story: picture beside the text when there is room ── */
.an-lead {
    margin-bottom: 16px;
}

.an-lead .an-headline {
    font-size: 24px;
}

.an-lead .an-text {
    font-size: 15px;
}

.an-lead .an-media {
    min-height: 150px;
}

.an-lead .an-mug {
    width: 128px;
    height: 128px;
}

.an-lead .an-badge {
    width: 42px;
    height: 42px;
}

.an-lead .an-logo {
    width: 84px;
    height: 84px;
}

@container anfeed (min-width: 560px) {
    .an-lead {
        flex-direction: row;
    }

    .an-lead .an-media {
        flex: 0 0 40%;
    }

    .an-lead .an-body {
        justify-content: center;
        padding: 18px 20px;
    }
}

/* ── Grid of the other stories: two columns, one on narrow widths ── */
.an-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@container anfeed (max-width: 520px) {
    .an-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .an-feed__title {
        font-size: 20px;
    }

    .an-lead .an-headline {
        font-size: 20px;
    }
}

/* Browsers without container queries: fall back on the viewport. */
@supports not (container-type: inline-size) {
    @media (max-width: 600px) {
        .an-grid {
            grid-template-columns: minmax(0, 1fr);
        }
    }
}

/* ── Wide card: an odd last card spans both columns ───────── */
.an-card--wide {
    grid-column: 1 / -1;
}

@container anfeed (min-width: 560px) {
    .an-card--wide {
        flex-direction: row;
    }

    .an-card--wide .an-media {
        flex: 0 0 40%;
        height: auto;
        min-height: 124px;
    }

    .an-card--wide .an-body {
        justify-content: center;
    }
}

/* ── Trade reserve ───────────────────────────────────────── */
.an-reserve {
    margin-top: 22px;
}

.an-reserve__title {
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    text-transform: uppercase;
    margin: 0 0 10px;
    padding: 0;
    color: #444;
}

/* ── Tags, status messages, empty state ──────────────────── */
.an-tag--pin {
    background: #1d2a4d;
}

.an-flash {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.an-flash--ok {
    background: #e6f4ea;
    color: #1e5631;
    border: 1px solid #b7dfc2;
}

.an-flash--err {
    background: #fde2e2;
    color: #8a1f1f;
    border: 1px solid #f3b9b9;
}

.an-empty {
    margin: 0 0 12px;
    color: #666;
    font-size: 14px;
}

.an-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ── Deadline tile ───────────────────────────────────────── */
.an-dl {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: royalblue;
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}

.an-dl__icon {
    font-size: 36px;
    line-height: 1;
}

.an-dl__txt {
    font-family: 'Oswald', sans-serif;
    font-size: 14px;
    letter-spacing: .06em;
}

.an-dl[hidden],
.an-dl-logo[hidden] {
    display: none;
}

.an-dl-logo {
    display: block;
    width: auto;
    max-width: 70%;   /* base.css img { max-width: 100% } is fine here; keep a margin */
    height: 96px;
    object-fit: contain;
}

/* ── Buttons ─────────────────────────────────────────────── */
.an-btn,
.an-admin__btn,
.an-c__del button {
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
}

.an-btn {
    padding: 7px 16px;
    border: 0;
    background: royalblue;
    color: #fff;
}

.an-btn:hover,
.an-btn:focus-visible {
    background: rgb(53, 84, 179);
}

.an-admin {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.an-admin form,
.an-c__del {
    margin: 0;
    display: inline;
}

.an-admin__btn {
    padding: 4px 10px;
    border: 1px solid #b9c3dc;
    background: #f3f5fa;
    color: #1d2a4d;
}

.an-admin__btn:hover,
.an-admin__btn:focus-visible {
    border-color: royalblue;
    color: royalblue;
}

.an-admin__btn--hide {
    border-color: #e3b3b3;
    color: #8a1f1f;
    background: #fdf3f3;
}

/* ── Comments ────────────────────────────────────────────── */
.an-comments {
    margin-top: 6px;
    border-top: 1px solid #ececec;
    padding-top: 6px;
    font-size: 13px;
}

.an-comments > summary {
    cursor: pointer;
    font-weight: 700;
    color: royalblue;
    padding: 4px 0;
}

.an-clist {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.an-c {
    background: #f6f7fa;
    border-radius: 6px;
    padding: 8px 10px;
}

.an-c__by {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 0 0 4px;
    font-size: 12px;
}

.an-c__logo {
    display: block;
    width: 20px;
    height: 20px;
    max-width: none;
    object-fit: contain;
}

.an-c__team {
    font-weight: 700;
    color: #222;
}

.an-c__time {
    color: #666;
}

.an-c__del {
    margin-left: auto;
}

.an-c__del button {
    padding: 2px 8px;
    border: 1px solid #e3b3b3;
    background: #fff;
    color: #8a1f1f;
    font-size: 11px;
}

.an-c__body {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #333;
    overflow-wrap: anywhere;
}

.an-cform {
    margin-top: 8px;
}

.an-cform textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 64px;
    padding: 8px;
    border: 1px solid #c9ced8;
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    resize: vertical;
}

.an-cform textarea:focus-visible {
    outline: 2px solid royalblue;
    outline-offset: 1px;
}

.an-cform__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
    margin-top: 6px;
}

.an-cform__hint {
    margin: 4px 0 0;
    font-size: 11px;
    color: #666;
}

/* ── Commissioner: hidden stories ────────────────────────── */
.an-hidden {
    margin-top: 18px;
    padding: 10px 12px;
    border: 1px dashed #c9ced8;
    border-radius: 8px;
    font-size: 13px;
}

.an-hidden > summary {
    cursor: pointer;
    font-weight: 700;
}

.an-hidden__list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.an-hidden__list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.an-hidden__list .an-admin {
    margin: 0 0 0 auto;
}

.an-hidden__h {
    font-weight: 600;
}
