/*
 * Portal news pages + homepage news strip.
 * Everything is scoped under .tms-news so nothing leaks into the rest of the portal theme.
 * Colours come from the portal's own tokens (app.css) with fallbacks, so an event theme that
 * overrides --color-primary / --color-secondary re-skins the news pages too.
 */
.tms-news {
    --n-primary: var(--color-primary, #00b8c3);
    --n-navy: var(--color-secondary, #002e4a);
    --n-ink: var(--color-heading, #0f2233);
    --n-muted: #5b6d7a;
    --n-line: #dde6ea;
    --n-bg: #f4f7f8;
    --n-surface: #ffffff;
    --n-chip: #eef3f5;
    --n-soft: #e3f6f7;
    --n-teal-ink: #007c85;
    --n-live: #d9480f;
    --n-radius: 10px;
    --n-shadow: 0 1px 2px rgba(0, 46, 74, .06), 0 8px 24px rgba(0, 46, 74, .06);
    background: var(--n-bg);
    color: var(--n-ink);
    padding-block: 32px 64px;
    font-size: 15px;
    line-height: 1.75;
}
.tms-news * { box-sizing: border-box; }
.tms-news a { color: inherit; text-decoration: none; }
.tms-news h1, .tms-news h2, .tms-news h3, .tms-news h4 { color: var(--n-ink); line-height: 1.4; margin: 0; text-wrap: balance; }
.tms-news :focus-visible { outline: 2px solid var(--n-primary); outline-offset: 2px; border-radius: 4px; }
.tms-news .n-container { max-width: 1200px; margin-inline: auto; padding-inline: 16px; }

/* ---------- Banner ---------- */
.tms-news .n-banner { background: var(--n-navy); color: #fff; border-radius: var(--n-radius); padding: 28px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; position: relative; overflow: hidden; }
.tms-news .n-banner::after { content: ""; position: absolute; inset-inline-start: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; border: 28px solid rgba(0, 184, 195, .18); pointer-events: none; }
.tms-news .n-banner > * { position: relative; z-index: 1; min-width: 0; }
.tms-news .n-crumbs { display: flex; gap: 6px; flex-wrap: wrap; font-size: 13px; color: #a9c3d2; list-style: none; margin: 0; padding: 0; }
.tms-news .n-crumbs a:hover { color: #fff; }
.tms-news .n-banner h1 { color: #fff; font-size: clamp(24px, 3.6vw, 34px); margin-top: 4px; }
.tms-news .n-banner p { color: #a9c3d2; margin: 6px 0 0; max-width: 56ch; }
.tms-news .n-search { display: flex; flex-wrap: wrap; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; overflow: hidden; flex: 0 1 340px; min-width: 0; }
.tms-news .n-search input { background: transparent; border: 0; color: #fff; padding: 10px 12px; flex: 1; min-width: 0; font: inherit; outline: none; }
.tms-news .n-search input::placeholder { color: #a9c3d2; }
.tms-news .n-search button { background: var(--n-primary); border: 0; color: var(--n-navy); padding: 0 18px; font-weight: 700; cursor: pointer; }
.tms-news .n-search-warning { flex-basis: 100%; font-size: 12px; color: #ffd8a8; }

/* ---------- Category chips ---------- */
.tms-news .n-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-block: 20px; }
.tms-news .n-filters a { border: 1px solid var(--n-line); background: var(--n-surface); border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--n-muted); }
.tms-news .n-filters a:hover { color: var(--n-ink); }
.tms-news .n-filters a.is-active { background: var(--n-navy); border-color: var(--n-navy); color: #fff; }
.tms-news .n-filters .n-num { opacity: .7; margin-inline-start: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Main grid ---------- */
.tms-news .n-desk { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 991px) { .tms-news .n-desk { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Image frames (real photo or branded fallback) ---------- */
.tms-news .n-img { position: relative; background: var(--n-navy); overflow: hidden; display: block; }
.tms-news .n-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.tms-news .n-img.is-empty::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 80% 20%, rgba(0, 184, 195, .55), transparent 45%), radial-gradient(circle at 15% 90%, rgba(0, 184, 195, .25), transparent 50%), repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 14px); }

/* ---------- Lead story ---------- */
.tms-news .n-lead { display: grid; grid-template-columns: 1.25fr 1fr; background: var(--n-surface); border-radius: var(--n-radius); overflow: hidden; box-shadow: var(--n-shadow); margin-bottom: 28px; }
@media (max-width: 767px) { .tms-news .n-lead { grid-template-columns: 1fr; } }
.tms-news .n-lead .n-img { min-height: 280px; }
.tms-news .n-lead-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tms-news .n-lead h2 { font-size: 24px; }
.tms-news .n-lead p { color: var(--n-muted); margin: 0; }
.tms-news .n-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--n-live); }
.tms-news .n-flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tms-news .n-cat { font-size: 12px; font-weight: 700; color: var(--n-teal-ink); }
.tms-news .n-more { margin-top: auto; align-self: flex-start; color: var(--n-teal-ink); font-weight: 700; font-size: 14px; }

/* ---------- Meta row ---------- */
.tms-news .n-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--n-muted); font-variant-numeric: tabular-nums; margin: 0; padding: 0; list-style: none; }
.tms-news .n-meta li { display: inline-flex; gap: 5px; align-items: center; }
.tms-news .n-meta svg { width: 14px; height: 14px; flex: none; }

/* ---------- Card stream ---------- */
.tms-news .n-stream-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 12px; }
.tms-news .n-stream-head h3 { font-size: 18px; }
.tms-news .n-stream-head small { color: var(--n-muted); font-variant-numeric: tabular-nums; }
.tms-news .n-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tms-news .n-card { background: var(--n-surface); border-radius: var(--n-radius); overflow: hidden; border: 1px solid var(--n-line); display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.tms-news .n-card:hover { transform: translateY(-2px); box-shadow: var(--n-shadow); }
.tms-news .n-card:hover .n-img img { transform: scale(1.03); }
.tms-news .n-card .n-img { aspect-ratio: 16 / 9; max-width: 100%; }
.tms-news .n-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.tms-news .n-card h4 { font-size: 16px; }
.tms-news .n-card h4 a:hover { color: var(--n-teal-ink); }
.tms-news .n-card p { margin: 0; color: var(--n-muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tms-news .n-card .n-meta { margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--n-line); }
.tms-news .n-empty { grid-column: 1 / -1; text-align: center; color: var(--n-muted); padding: 40px 16px; background: var(--n-surface); border-radius: var(--n-radius); border: 1px dashed var(--n-line); }
.tms-news .n-empty a { color: var(--n-teal-ink); font-weight: 700; }

/* ---------- Pagination ---------- */
.tms-news .n-pager { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 28px; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.tms-news .n-pager a, .tms-news .n-pager span { min-width: 38px; height: 38px; padding-inline: 10px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--n-line); background: var(--n-surface); font-size: 14px; }
.tms-news .n-pager .is-active span { background: var(--n-navy); color: #fff; border-color: var(--n-navy); }
.tms-news .n-pager .is-disabled span { opacity: .45; }

/* ---------- Side rail ---------- */
.tms-news .n-rail { display: flex; flex-direction: column; gap: 18px; }
.tms-news .n-box { background: var(--n-surface); border: 1px solid var(--n-line); border-radius: var(--n-radius); padding: 18px; }
.tms-news .n-box h4 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tms-news .n-box h4::before { content: ""; width: 4px; height: 16px; background: var(--n-primary); border-radius: 2px; }
.tms-news .n-list { list-style: none; margin: 0; padding: 0; }
.tms-news .n-list li + li { border-top: 1px solid var(--n-line); }
.tms-news .n-list a { display: flex; justify-content: space-between; gap: 8px; padding-block: 8px; font-size: 14px; }
.tms-news .n-list a:hover, .tms-news .n-list a.is-active { color: var(--n-teal-ink); }
.tms-news .n-list .n-num { color: var(--n-muted); font-variant-numeric: tabular-nums; }
.tms-news .n-mini { display: flex; flex-direction: column; gap: 12px; }
.tms-news .n-mini a { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.tms-news .n-mini .n-img { width: 64px; height: 48px; border-radius: 6px; }
.tms-news .n-mini b { font-weight: 600; font-size: 13.5px; line-height: 1.5; display: block; }
.tms-news .n-mini a:hover b { color: var(--n-teal-ink); }
.tms-news .n-mini small { color: var(--n-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tms-news .n-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tms-news .n-tags a { background: var(--n-chip); padding: 4px 10px; border-radius: 6px; font-size: 12.5px; color: var(--n-muted); }
.tms-news .n-tags a:hover, .tms-news .n-tags a.is-active { color: var(--n-teal-ink); background: var(--n-soft); }

/* ---------- Article page ---------- */
.tms-news .n-paper { background: var(--n-surface); border-radius: var(--n-radius); border: 1px solid var(--n-line); overflow: hidden; }
.tms-news .n-paper-head { padding: 28px 28px 20px; display: flex; flex-direction: column; gap: 12px; }
.tms-news .n-paper-head .n-crumbs { color: var(--n-muted); }
.tms-news .n-paper-head .n-crumbs a:hover { color: var(--n-ink); }
.tms-news .n-paper-head h1 { font-size: clamp(24px, 3.4vw, 34px); }
.tms-news .n-dek { color: var(--n-muted); font-size: 17px; margin: 0; max-width: 64ch; }
.tms-news .n-byline { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--n-line); flex-wrap: wrap; }
.tms-news .n-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--n-soft); color: var(--n-teal-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.tms-news .n-byline .n-meta { margin-inline-start: auto; }
.tms-news .n-hero { aspect-ratio: 21 / 9; max-width: 100%; }
.tms-news .n-prose { padding: 24px 28px 8px; max-width: 74ch; overflow-wrap: anywhere; }
.tms-news .n-prose p { margin: 0 0 16px; }
.tms-news .n-prose h2, .tms-news .n-prose h3 { font-size: 19px; margin: 24px 0 10px; }
.tms-news .n-prose img { max-width: 100%; height: auto; border-radius: 8px; }
.tms-news .n-prose blockquote { margin: 20px 0; padding: 14px 18px; border-inline-start: 3px solid var(--n-primary); background: var(--n-soft); border-radius: 0 8px 8px 0; font-weight: 600; }
.tms-news .n-prose table { display: block; overflow-x: auto; max-width: 100%; }
.tms-news .n-prose a { color: var(--n-teal-ink); text-decoration: underline; }
.tms-news .n-section { padding: 8px 28px 20px; }
.tms-news .n-section h4 { font-size: 15px; margin-bottom: 10px; }
.tms-news .n-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 575px) { .tms-news .n-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tms-news .n-gallery .n-img { aspect-ratio: 4 / 3; border-radius: 8px; max-width: 100%; }
.tms-news .n-file { display: flex; align-items: center; gap: 12px; border: 1px solid var(--n-line); border-radius: 8px; padding: 10px 12px; }
.tms-news .n-file + .n-file { margin-top: 8px; }
.tms-news .n-ext { width: 40px; height: 44px; border-radius: 6px; background: var(--n-chip); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--n-live); text-transform: uppercase; flex: none; }
.tms-news .n-file div { flex: 1; min-width: 0; }
.tms-news .n-file b { font-weight: 600; display: block; overflow-wrap: anywhere; }
.tms-news .n-file small { color: var(--n-muted); font-variant-numeric: tabular-nums; }
.tms-news .n-file .n-dl { color: var(--n-teal-ink); font-weight: 700; font-size: 13px; }
.tms-news .n-paper-foot { padding: 16px 28px 24px; border-top: 1px solid var(--n-line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.tms-news .n-share { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--n-muted); flex-wrap: wrap; }
.tms-news .n-share a, .tms-news .n-share button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--n-line); background: var(--n-surface); display: grid; place-items: center; cursor: pointer; color: var(--n-ink); }
.tms-news .n-share a:hover, .tms-news .n-share button:hover { border-color: var(--n-primary); color: var(--n-teal-ink); }
.tms-news .n-share svg { width: 16px; height: 16px; }
.tms-news .n-copied { font-size: 12px; color: var(--n-teal-ink); }

/* ---------- Homepage strip ---------- */
.tms-news.n-home { background: transparent; padding-block: 48px; }
.tms-news .n-home-box { background: var(--n-surface); border: 1px solid var(--n-line); border-radius: var(--n-radius); padding: 24px; }
.tms-news .n-home-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.tms-news .n-home-head h2 { font-size: 26px; }
.tms-news .n-home-head p { margin: 4px 0 0; color: var(--n-muted); font-size: 14px; }
.tms-news .n-home-row { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 16px; }
.tms-news .n-home-row .n-card:first-child h4 { font-size: 18px; }
@media (max-width: 991px) { .tms-news .n-home-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .tms-news .n-home-row { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: reduce) {
    .tms-news .n-card, .tms-news .n-img img { transition: none; }
    .tms-news .n-card:hover { transform: none; }
    .tms-news .n-card:hover .n-img img { transform: none; }
}

/* =====================================================================
 * Portal news ticker (portal/news/partials/ticker.blade.php)
 * Scoped under .tms-ticker; sits right under the portal header on every portal page.
 * Arabic tickers travel left-to-right so each headline's beginning (its right edge) enters first;
 * the English layout travels the other way for the same reason.
 * ===================================================================== */
.tms-ticker {
    --tk-navy: var(--color-secondary, #002e4a);
    --tk-teal: var(--color-primary, #00b8c3);
    --tk-live: #ff6b3d;
    --tk-duration: 60s;
    display: flex;
    align-items: stretch;
    background: var(--tk-navy);
    color: #fff;
    min-height: 46px;
    font-size: 14.5px;
    position: relative;
    z-index: 5;
    box-shadow: 0 2px 10px rgba(0, 46, 74, .18);
}
.tms-ticker a { color: inherit; text-decoration: none; }
.tms-ticker .tk-label {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-inline: 18px;
    background: var(--tk-teal);
    color: var(--tk-navy);
    font-weight: 800;
    white-space: nowrap;
    position: relative;
}
/* Angled edge pointing into the stream. */
.tms-ticker .tk-label::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-end: -12px;
    width: 12px;
    background: var(--tk-teal);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.tms-ticker.is-rtl .tk-label::after { clip-path: polygon(100% 0, 0 50%, 100% 100%); }
.tms-ticker .tk-label:hover { filter: brightness(1.05); }
.tms-ticker .tk-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--tk-live); box-shadow: 0 0 0 0 rgba(255, 107, 61, .7); animation: tk-pulse 1.8s infinite; }
@keyframes tk-pulse { 70% { box-shadow: 0 0 0 8px rgba(255, 107, 61, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 107, 61, 0); } }

.tms-ticker .tk-viewport {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding-inline-start: 14px;
    /* Soft fade at both ends so headlines do not cut off hard. */
    -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
}
.tms-ticker .tk-track { display: flex; width: max-content; animation: tk-rtl var(--tk-duration) linear infinite; will-change: transform; }
.tms-ticker.is-ltr .tk-track { animation-name: tk-ltr; }
@keyframes tk-rtl { from { transform: translateX(0); } to { transform: translateX(50%); } }
@keyframes tk-ltr { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tms-ticker:hover .tk-track,
.tms-ticker:focus-within .tk-track,
.tms-ticker.is-paused .tk-track { animation-play-state: paused; }

.tms-ticker .tk-list { display: flex; list-style: none; margin: 0; padding: 0; }
.tms-ticker .tk-list li { display: flex; align-items: center; white-space: nowrap; }
.tms-ticker .tk-list li::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--tk-teal); opacity: .8; margin-inline: 22px; }
.tms-ticker .tk-list a { display: inline-flex; align-items: center; gap: 8px; padding-block: 10px; border-radius: 4px; }
.tms-ticker .tk-list a:hover .tk-title,
.tms-ticker .tk-list a:focus-visible .tk-title { color: var(--tk-teal); text-decoration: underline; text-underline-offset: 4px; }
.tms-ticker .tk-list a:focus-visible { outline: 2px solid var(--tk-teal); outline-offset: 2px; }
.tms-ticker .tk-title { font-weight: 600; transition: color .15s ease; }
.tms-ticker .tk-time { font-size: 12px; color: #a9c3d2; font-variant-numeric: tabular-nums; }
.tms-ticker .tk-badge { background: var(--tk-live); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }

.tms-ticker .tk-toggle {
    flex: none;
    width: 46px;
    border: 0;
    border-inline-start: 1px solid rgba(255, 255, 255, .12);
    background: transparent;
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}
.tms-ticker .tk-toggle:hover { background: rgba(255, 255, 255, .06); }
.tms-ticker .tk-toggle:focus-visible { outline: 2px solid var(--tk-teal); outline-offset: -3px; }
.tms-ticker .tk-toggle svg { width: 16px; height: 16px; }
.tms-ticker .tk-icon-play,
.tms-ticker.is-paused .tk-icon-pause { display: none; }
.tms-ticker.is-paused .tk-icon-play { display: block; }

@media (max-width: 575px) {
    .tms-ticker { font-size: 13.5px; min-height: 42px; }
    .tms-ticker .tk-label { padding-inline: 12px; font-size: 13px; }
    .tms-ticker .tk-time { display: none; }
}

/* No motion: a still, swipeable strip; the duplicate list and the play/pause control go away. */
@media (prefers-reduced-motion: reduce) {
    .tms-ticker .tk-track { animation: none; }
    .tms-ticker .tk-viewport { overflow-x: auto; -webkit-mask-image: none; mask-image: none; scrollbar-width: thin; }
    .tms-ticker .tk-list[aria-hidden="true"],
    .tms-ticker .tk-toggle { display: none; }
    .tms-ticker .tk-pulse { animation: none; }
}
