/* =========================================================
   News Marquee — responsive ticker styles
   ========================================================= */

.nmq-marquee {
    --nmq-bg: #ffffff;
    --nmq-text: #1a1a1a;
    --nmq-label: #1a1a1a;
    --nmq-sep: #16a34a;
    --nmq-accent: #16a34a;    /* highlight / accent color — independent of separator dot */
    --nmq-border: #e5e7eb;
    --nmq-item-spacing: 22px; /* equal space on both sides of every separator */
    --nmq-height: 56px;
    --nmq-radius: 8px;
    --nmq-item-font-size: 14px;
    --nmq-item-font-family: Arial, Helvetica, sans-serif;
    --nmq-label-font-size: 21px;

    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: var(--nmq-height);
    background: var(--nmq-bg);
    color: var(--nmq-text);
    border: none;
    border-radius: var(--nmq-radius);
    overflow: hidden;
    font-family: Georgia, "Times New Roman", "Noto Serif", serif;
    box-sizing: border-box;
    position: relative;
}

.nmq-marquee *,
.nmq-marquee *::before,
.nmq-marquee *::after {
    box-sizing: border-box;
}

/* ---------- Label (Latest News) ---------- */
.nmq-marquee__label {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 0 24px 0 24px;
    color: var(--nmq-label);
    border-right: 1px solid var(--nmq-border);
    white-space: nowrap;
}

.nmq-marquee__label-text {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 600;
    font-size: var(--nmq-label-font-size, 21px);
    letter-spacing: 0.2px;
}

/* ---------- Viewport (the scrolling window) ---------- */
.nmq-marquee__viewport {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    /* fade edges so the seam looks clean */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
}

/* The track holds two copies of the list and slides as a whole */
.nmq-marquee__track {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: max-content;
    will-change: transform;
    animation: nmq-scroll var(--nmq-duration, 30s) linear infinite;
}

.nmq-marquee.is-paused .nmq-marquee__track,
.nmq-marquee.is-startup-delayed .nmq-marquee__track {
    animation-play-state: paused;
}

@keyframes nmq-scroll {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}

.nmq-marquee__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    /* Space between consecutive items (i.e. between a separator and the
       next item's title). Matches the in-item gap below, so the separator
       sits visually centered between the two titles it separates. */
    gap: var(--nmq-item-spacing, 22px);
}

.nmq-marquee__item {
    display: inline-flex;
    align-items: center;
    /* Space between an item's title and its trailing separator. */
    gap: var(--nmq-item-spacing, 22px);
    padding: 0;
    font-family: var(--nmq-item-font-family, Arial, Helvetica, sans-serif);
    font-size: var(--nmq-item-font-size, 14px);
    line-height: 1.4;
    white-space: nowrap;
}

.nmq-marquee__item .nmq-marquee__sep {
    color: var(--nmq-sep);
    font-size: 18px;
    line-height: 1;
    user-select: none;
}

.nmq-marquee__link {
    text-decoration: none;
    transition: color 0.18s ease, text-decoration-color 0.18s ease;
    text-underline-offset: 3px;
}

/* High-specificity selector chain: defeats almost any theme stylesheet
   without needing !important. Covers every link pseudo-state because many
   themes only style :link or :visited, not the bare element. */
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link:link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link:visited,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link:active {
    color: var(--nmq-text);
    text-decoration: none;
    text-decoration-color: transparent;
}

.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link:hover,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link:focus,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__link:focus-visible {
    color: var(--nmq-accent);
    text-decoration: underline;
    text-decoration-color: currentColor;
    outline: none;
}

/* Plain (non-linked) item text — also locked against theme inheritance */
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__text {
    color: var(--nmq-text);
}

.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-highlight .nmq-marquee__link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-highlight .nmq-marquee__link:link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-highlight .nmq-marquee__link:visited,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-highlight .nmq-marquee__text {
    color: var(--nmq-accent);  /* accent color — no bold */
}

/* Bold only — no color change */
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-bold .nmq-marquee__link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-bold .nmq-marquee__link:link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-bold .nmq-marquee__link:visited,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-bold .nmq-marquee__text {
    font-weight: 700;
}

/* Both bold + highlight → bold accent */
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-bold.is-highlight .nmq-marquee__link,
.nmq-marquee .nmq-marquee__viewport .nmq-marquee__item.is-bold.is-highlight .nmq-marquee__text {
    font-weight: 700;
    color: var(--nmq-accent);
}

/* ---------- Pause / Play button ---------- */
.nmq-marquee__toggle {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    align-self: center;
    margin: 0 12px 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--nmq-btn-bg, #000000);
    border: none;
    border-radius: 50%;
    color: var(--nmq-btn-color, #ffffff);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    position: relative;
    z-index: 2;
}

.nmq-marquee__toggle:hover {
    background-color: var(--nmq-btn-bg-hover, var(--nmq-sep));
    color: var(--nmq-btn-color, #ffffff);
    transform: scale(1.06);
}

.nmq-marquee__toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--nmq-bg, #ffffff), 0 0 0 4px var(--nmq-sep);
}

.nmq-marquee__toggle:active {
    transform: scale(0.94);
}

.nmq-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

.nmq-marquee .nmq-icon--play  { display: none; }
.nmq-marquee.is-paused .nmq-icon--pause { display: none; }
.nmq-marquee.is-paused .nmq-icon--play  { display: block; }

/* ---------- Responsive: tablets ---------- */
@media (max-width: 900px) {
    .nmq-marquee { --nmq-height: 52px; }
    .nmq-marquee__label       { padding: 0 18px; }
    .nmq-marquee__label-text  { font-size: 18px; }
    .nmq-marquee__item        { font-size: 13px; }
}

/* ---------- Responsive: mobile ---------- */
@media (max-width: 640px) {
    .nmq-marquee {
        --nmq-height: 48px;
        border-radius: 6px;
    }

    .nmq-marquee__label       { padding: 0 14px; }
    .nmq-marquee__label-text  { font-size: 16px; }

    .nmq-marquee__viewport {
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    }

    .nmq-marquee__item        { font-size: 13px; }
    .nmq-marquee__item .nmq-marquee__sep { font-size: 16px; }

    .nmq-marquee__toggle      { width: 36px; height: 36px; margin: 0 8px 0 4px; }
    .nmq-icon                 { width: 16px; height: 16px; }
}

/* ---------- Very small phones ---------- */
@media (max-width: 380px) {
    .nmq-marquee__label       { padding: 0 10px; }
    .nmq-marquee__label-text  { font-size: 15px; }
}

/* ---------- RTL ---------- */
.rtl .nmq-marquee__label,
[dir="rtl"] .nmq-marquee__label {
    border-right: none;
    border-left: 1px solid var(--nmq-border);
}

[dir="rtl"] .nmq-marquee__toggle {
    margin: 0 6px 0 12px;
}

[dir="rtl"] .nmq-marquee__track {
    animation-direction: reverse;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .nmq-marquee__track {
        animation-duration: calc(var(--nmq-duration, 30s) * 3);
    }
}

/* ---------- Print ---------- */
@media print {
    /* Stop the animation completely and reset transforms */
    .nmq-marquee,
    .nmq-marquee * {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }

    /* Hide interactive controls — buttons don't make sense on paper */
    .nmq-marquee__toggle { display: none !important; }

    /* The marquee uses two copies of the list for a seamless loop.
       The second copy carries aria-hidden="true" — skip it on print
       so items aren't duplicated on paper. */
    .nmq-marquee__list[aria-hidden="true"] { display: none !important; }

    /* Drop the viewport's edge-fade mask and unhide overflow so every item
       is visible on the printed page */
    .nmq-marquee__viewport {
        -webkit-mask-image: none !important;
                mask-image: none !important;
        overflow: visible !important;
        max-width: 100% !important;
    }

    /* Let the track and remaining list wrap onto multiple lines instead
       of running off the right edge of the page */
    .nmq-marquee,
    .nmq-marquee__track,
    .nmq-marquee__list {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex-wrap: wrap !important;
    }
    .nmq-marquee__track  { width: 100% !important; }
    .nmq-marquee__list   {
        list-style: disc inside !important;
        padding-left: 8px !important;
        margin: 4px 0 !important;
    }

    /* Each news item as a printable bullet line */
    .nmq-marquee__item {
        display: list-item !important;
        white-space: normal !important;
        page-break-inside: avoid;
        margin: 4px 0 !important;
        padding: 0 !important;
        gap: 0 !important;
    }

    /* The dot separator is decorative — hide it on print so each line
       reads as a clean bullet without a stray dot at the end */
    .nmq-marquee__item .nmq-marquee__sep { display: none !important; }

    /* Strip background colors and shadows so ink isn't wasted */
    .nmq-marquee,
    .nmq-marquee__label {
        background: transparent !important;
        box-shadow: none !important;
        border-color: #000 !important;
    }

    /* Make label sit above the items in a clear "section header" style */
    .nmq-marquee__label {
        display: block !important;
        width: 100% !important;
        border: none !important;
        border-bottom: 1px solid #000 !important;
        padding: 0 0 4px !important;
        margin: 0 0 8px !important;
    }
    .nmq-marquee__label-text {
        font-weight: 700 !important;
        font-size: 14pt !important;
    }

    /* Links: print URL after the link text so the print is self-describing */
    .nmq-marquee__link {
        color: #000 !important;
        text-decoration: underline !important;
    }
    .nmq-marquee__link[href]:not([href^="#"]):not([href^="javascript"])::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #555;
    }

    /* Hide our utility badges (new tab arrow, modal indicator) in print */
    .nmq-marquee__badges,
    .nmq-marquee__icon-newtab,
    .nmq-modal-newtab { display: none !important; }
}

/* ==========================================================
   NMQ Modal / Lightbox
   ========================================================== */

.nmq-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    box-sizing: border-box;
}
.nmq-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.nmq-modal-box {
    display: flex;
    flex-direction: column;
    width: 92vw;
    max-width: 1040px;
    height: 88vh;
    max-height: 860px;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    transform: scale(0.94) translateY(12px);
    transition: transform 0.22s ease;
}
.nmq-modal-overlay.is-open .nmq-modal-box {
    transform: scale(1) translateY(0);
}

/* ── Header bar ── */
.nmq-modal-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px 10px 18px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}
.nmq-modal-title {
    flex: 1 1 auto;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: Arial, Helvetica, sans-serif;
}
.nmq-modal-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Shared style for header buttons */
.nmq-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.nmq-modal-btn:hover { background: #e5e7eb; color: #111827; }
.nmq-modal-btn svg   { display: block; width: 16px; height: 16px; pointer-events: none; }

/* "Open in new tab" link inside header */
.nmq-modal-newtab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    font-family: Arial, Helvetica, sans-serif;
    color: #2563eb;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.nmq-modal-newtab:hover { background: #dbeafe; }
.nmq-modal-newtab svg   { width: 11px; height: 11px; }

/* ── iframe ── */
.nmq-modal-iframe {
    flex: 1 1 auto;
    width: 100%;
    border: none;
    display: block;
    background: #f3f4f6;
}

/* ── Loading spinner (shown while iframe loads) ── */
.nmq-modal-loading {
    position: absolute;
    inset: 54px 0 0 0; /* below header */
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.nmq-modal-loading.is-hidden { opacity: 0; }
.nmq-modal-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #d1d5db;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: nmq-spin 0.7s linear infinite;
}
@keyframes nmq-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .nmq-modal-box {
        width: 100%;
        height: 94vh;
        border-radius: 8px 8px 0 0;
        align-self: flex-end;
        margin-bottom: -16px;
    }
    .nmq-modal-newtab span { display: none; } /* hide label, keep icon */
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .nmq-modal-overlay,
    .nmq-modal-box { transition: none; }
    .nmq-modal-spinner { animation: none; border-top-color: #2563eb; }
}

/* ==========================================================
   Elementor editor canvas overrides
   Force the marquee to render as a flex row in the editor
   exactly as it appears on the live site.
   ========================================================== */

/* Elementor wraps widgets in .elementor-widget-container.
   Ensure no inherited block/list styles bleed in. */
.elementor-widget-nmq_news_marquee .nmq-marquee,
.elementor-widget-nmq_news_marquee .nmq-marquee * {
    box-sizing: border-box;
}

/* The editor canvas can inject list-style from Elementor's
   base stylesheet — explicitly neutralise it on our list. */
.elementor-widget-nmq_news_marquee .nmq-marquee__list,
.elementor-widget-nmq_news_marquee .nmq-marquee__list li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Keep the track static in the editor so items are visible
   without the JS-driven animation. The track already gets
   animation:none inline from content_template(), this is
   a CSS-level safety net. */
.elementor-edit-area .nmq-marquee__track {
    animation: none !important;
    transform: none !important;
    padding-left: 0 !important;
}

/* In editor canvas, disable the viewport mask so all preview
   items are fully visible (no fade-out at edges). */
.elementor-edit-area .nmq-marquee__viewport {
    -webkit-mask-image: none !important;
            mask-image: none !important;
    overflow: visible !important;
}

/* Make the marquee fill the full column width in editor too */
.elementor-widget-nmq_news_marquee {
    width: 100%;
}

/* ==========================================================
   File info badges  (type + size shown below item title)
   ========================================================== */

/* Wraps the link/text + the badges in a column */
.nmq-marquee__content {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    vertical-align: middle;
}

/* Row of badges */
.nmq-marquee__badges {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

/* Base badge */
.nmq-badge {
    display: inline-block;
    padding: 1px 7px 2px;
    border-radius: 20px;
    border: 1px solid currentColor;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .4px;
    white-space: nowrap;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
    user-select: none;
}

/* Size badge — neutral grey */
.nmq-badge--size {
    color: #6b7280;
    border-color: #d1d5db;
    background: #f9fafb;
    font-weight: 500;
    letter-spacing: 0;
}

/* File-type colour palette */
.nmq-badge--type  { color: #374151; border-color: #9ca3af; background: #f3f4f6; } /* default grey  */
.nmq-badge--pdf   { color: #dc2626; border-color: #fca5a5; background: #fff1f2; } /* red           */
.nmq-badge--word  { color: #2563eb; border-color: #93c5fd; background: #eff6ff; } /* blue          */
.nmq-badge--excel { color: #16a34a; border-color: #86efac; background: #f0fdf4; } /* green         */
.nmq-badge--ppt   { color: #ea580c; border-color: #fdba74; background: #fff7ed; } /* orange        */
.nmq-badge--archive { color: #7c3aed; border-color: #c4b5fd; background: #f5f3ff; } /* purple      */
.nmq-badge--image { color: #db2777; border-color: #f9a8d4; background: #fdf2f8; } /* pink          */
.nmq-badge--video { color: #0891b2; border-color: #67e8f9; background: #ecfeff; } /* teal          */

/* Responsive — slightly smaller badges on mobile */
@media (max-width: 640px) {
    .nmq-badge { font-size: 9px; padding: 1px 5px 1px; }
}

/* ==========================================================
   Mobile stacked layout  (.nmq-mobile-stack)
   Label moves to its own row above the ticker so the two
   never compete for horizontal space on narrow screens.
   ========================================================== */
@media (max-width: 640px) {

    .nmq-mobile-stack {
        flex-wrap: wrap;          /* allow label to break onto its own line */
        height: auto !important;
        min-height: unset;
        border-radius: var(--nmq-radius, 8px);
    }

    /* Label row — full width, sits above the ticker */
    .nmq-mobile-stack .nmq-marquee__label {
        flex: 0 0 100%;           /* full width */
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--nmq-border, #e5e7eb);
        justify-content: flex-start;
        padding: 7px 14px;
        min-height: 34px;
    }

    /* Ticker row — viewport + button share the row below the label */
    .nmq-mobile-stack .nmq-marquee__viewport {
        flex: 1 1 0;
        min-width: 0;
        min-height: 40px;
        /* Re-apply mask with smaller fade since the row is shorter */
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    }

    .nmq-mobile-stack .nmq-marquee__toggle {
        flex: 0 0 auto;
        align-self: center;
        margin: 0 8px 0 4px;
    }
}
