/* News module styles (scoped). Loaded after style.css only on news pages,
   the homepage news section and the staff news editor. style.css is unchanged. */

/* ---------- Thumbnails: show the whole image, no unwanted cropping ---------- */
.news-page .news-card-media,
.home-news .home-news-card-media {
    aspect-ratio: 16 / 9;
    background:
        radial-gradient(120% 120% at 50% 40%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 70%),
        linear-gradient(135deg, #eef3f8, #e2eaf2);
}

.news-page .news-card-media .news-card-image,
.home-news .home-news-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.news-detail-page .news-detail-media {
    margin: 0 0 18px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f6f9, #e8eef4);
}

.news-detail-page .news-detail-media .news-detail-image {
    width: 100%;
    height: auto;
    max-height: min(75vh, 640px);
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
    background: transparent;
    border-radius: 0;
}

.news-detail-page .news-related-media {
    min-height: 0;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #eef3f8, #e2eaf2);
}

.news-detail-page .news-related-media img {
    object-fit: contain;
}

/* ---------- Rich text body (new formatted news only) ---------- */
.news-rich-body {
    overflow-wrap: anywhere;
}

.news-rich-body > :first-child {
    margin-top: 0;
}

.news-rich-body p,
.news-rich-body ul,
.news-rich-body ol,
.news-rich-body blockquote,
.news-rich-body pre,
.news-rich-body figure,
.news-rich-body .news-table-wrap {
    margin: 0 0 1em;
}

.news-rich-body h2,
.news-rich-body h3,
.news-rich-body h4 {
    margin: 1.4em 0 0.5em;
    color: var(--navy-dark, #0d3557);
    line-height: 1.35;
}

.news-rich-body h2 { font-size: 1.3rem; }
.news-rich-body h3 { font-size: 1.14rem; }
.news-rich-body h4 { font-size: 1.02rem; }

.news-rich-body ul,
.news-rich-body ol {
    padding-left: 1.4em;
}

.news-rich-body li {
    margin: 0.25em 0;
}

.news-rich-body strong { font-weight: 800; }

.news-rich-body blockquote {
    padding: 10px 14px;
    border-left: 4px solid var(--navy, #124979);
    background: #f4f8fb;
    border-radius: 0 8px 8px 0;
}

.news-rich-body hr {
    border: 0;
    border-top: 1px solid rgba(18, 73, 121, 0.18);
    margin: 1.5em 0;
}

.news-rich-body code {
    padding: 1px 6px;
    border-radius: 4px;
    background: #eef3f8;
    font-size: 0.92em;
}

.news-rich-body pre {
    padding: 12px;
    overflow-x: auto;
    background: #f4f6f8;
    border-radius: 8px;
}

.news-rich-body a.news-link {
    color: #0b63b6;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.news-rich-body a.news-link:hover,
.news-rich-body a.news-link:focus-visible {
    color: #084c8c;
}

.news-rich-body a.news-link-ext::after {
    content: "\2197"; /* ↗ external link marker */
    display: inline-block;
    margin-left: 2px;
    font-size: 0.8em;
    text-decoration: none;
}

.news-rich-body figure {
    padding: 0;
    text-align: center;
}

.news-rich-body img,
.news-rich-body .news-rich-img {
    display: block;
    max-width: 100%;
    height: auto;
    max-height: min(80vh, 720px);
    margin: 0 auto;
    object-fit: contain;
    border-radius: 10px;
    background: #f3f6f9;
}

.news-rich-body figcaption {
    margin-top: 6px;
    color: var(--muted, #5b6b7b);
    font-size: 0.86rem;
}

.news-rich-body .news-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.news-rich-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.news-rich-body th,
.news-rich-body td {
    padding: 8px 10px;
    border: 1px solid rgba(18, 73, 121, 0.16);
    text-align: left;
    vertical-align: top;
}

.news-rich-body th {
    background: #eef3f8;
}

/* ---------- Staff: editor ---------- */
.staff-news-editor {
    border: 1px solid rgba(18, 73, 121, 0.22);
    border-radius: 10px;
    background: #fff;
}

.staff-news-editor .sne-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid rgba(18, 73, 121, 0.14);
    background: #f5f8fb;
    border-radius: 10px 10px 0 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.staff-news-editor .sne-toolbar button {
    min-width: 36px;
    min-height: 34px;
    padding: 4px 9px;
    border: 1px solid rgba(18, 73, 121, 0.18);
    border-radius: 6px;
    background: #fff;
    color: #124979;
    font: inherit;
    font-size: 0.86rem;
    cursor: pointer;
}

.staff-news-editor .sne-toolbar button:hover,
.staff-news-editor .sne-toolbar button:focus-visible {
    background: #e7f0f8;
}

.staff-news-editor .sne-area {
    min-height: 260px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 12px 14px;
    outline: none;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.staff-news-editor .sne-area:empty::before {
    content: attr(data-placeholder);
    color: #8a97a5;
}

.staff-news-editor .sne-area img {
    max-width: 100%;
    max-height: 360px;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 6px auto;
    border-radius: 8px;
}

.staff-news-editor .sne-area a {
    color: #0b63b6;
    text-decoration: underline;
}

.staff-news-editor .sne-area blockquote {
    margin: 0 0 1em;
    padding: 8px 12px;
    border-left: 4px solid #124979;
    background: #f4f8fb;
}

.staff-news-editor > .hint-text {
    padding: 6px 12px 10px;
    margin: 0;
}

.sn-status {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.sn-status-draft {
    background: #fff3cd;
    color: #7a5600;
}

.sn-likes-cell {
    min-width: 150px;
}

.sn-likes-form {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.sn-likes-form input[type="number"] {
    width: 84px;
}

.sn-likes-form input[type="text"] {
    width: 120px;
}

.news-preview-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 8px 14px;
    background: #fff3cd;
    color: #4d3800;
    font-size: 0.9rem;
    text-align: center;
}
