/* =========================================================
   Latest News & Archive Tabs — frontend stylesheet
   Matches the reference design: active tab merges with the
   content area below via a shared blue border.
   ========================================================= */

.lna-tabs {
    /* Theming variables — overridden per-instance from PHP */
    --lna-border:        #1e3a8a;
    --lna-tab:           #1e3a8a;
    --lna-tab-inactive:  #1a1a1a;
    --lna-bg:            #ffffff;
    --lna-speed:         40px;   /* px per second */
    --lna-rows:          6;
    --lna-row-height:    44px;
    --lna-radius:        6px;

    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: #1a1a1a;
}

.lna-tabs *,
.lna-tabs *::before,
.lna-tabs *::after { box-sizing: border-box; }

/* ---------- Tab strip ---------- */
.lna-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
    padding: 0 16px;
    margin: 0 0 -1px 0;       /* overlap with the content's top border */
    position: relative;
    z-index: 2;
}

.lna-tabs__btn {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;        /* the magic line — the active tab "merges" into the content */
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 600;
    color: var(--lna-tab-inactive);
    cursor: pointer;
    border-top-left-radius:  var(--lna-radius);
    border-top-right-radius: var(--lna-radius);
    line-height: 1.3;
    margin: 0 2px;
    transition: color .15s ease;
}

.lna-tabs__btn:hover { color: var(--lna-tab); }
.lna-tabs__btn:focus-visible {
    outline: 2px solid var(--lna-tab);
    outline-offset: 2px;
}

.lna-tabs__btn[aria-selected="true"],
.lna-tabs__btn.is-active {
    background: var(--lna-bg);
    border-color: var(--lna-border);
    color: var(--lna-tab);
}

/* ---------- Content area ---------- */
.lna-tabs__content {
    background: var(--lna-bg);
    border: 1px solid var(--lna-border);
    border-radius: var(--lna-radius);
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-height: calc(var(--lna-rows) * var(--lna-row-height));
}

.lna-tabs__panel {
    display: none;
    padding: 0;
}
.lna-tabs__panel.is-active,
.lna-tabs__panel:not([hidden]) { display: block; }

/* ---------- Vertical marquee viewport ---------- */
.lna-marquee {
    height: calc(var(--lna-rows) * var(--lna-row-height));
    overflow: hidden;
    position: relative;
    /* fade top/bottom edges so the seam looks clean */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}

.lna-marquee__list {
    list-style: none;
    margin: 0;
    padding: 0;
    will-change: transform;
    animation: lna-vscroll var(--lna-duration, 30s) linear infinite;
}

.lna-marquee.is-paused .lna-marquee__list,
.lna-marquee.is-static  .lna-marquee__list {
    animation-play-state: paused;
}

.lna-marquee.is-static .lna-marquee__list {
    transform: none !important;
}

@keyframes lna-vscroll {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(0, -50%, 0); }   /* list is rendered twice; -50% jumps to the seam */
}

/* ---------- Individual rows ---------- */
.lna-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 18px;
    min-height: var(--lna-row-height);
    border-bottom: 1px solid #f1f5f9;
}
.lna-item:last-child { border-bottom: none; }

.lna-item__main {
    flex: 1 1 auto;
    min-width: 0;
}

.lna-item__title {
    display: inline-block;
    color: #111827;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
a.lna-item__title:hover,
a.lna-item__title:focus-visible {
    color: var(--lna-tab);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.lna-item__extras {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}
.lna-item__extra-label { font-weight: 600; color: #4b5563; margin-right: 2px; }

.lna-item__meta {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.lna-item__type {
    display: inline-block;
    padding: 2px 8px;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.lna-item__date { color: #374151; }
.lna-item__size { color: #9ca3af; font-variant-numeric: tabular-nums; }

/* ---------- Tab footer (View archive →) ---------- */
.lna-tabs__footer {
    border-top: 1px solid #f1f5f9;
    padding: 10px 18px;
    text-align: right;
}
.lna-tabs__archive-link {
    color: var(--lna-tab);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.lna-tabs__archive-link:hover { text-decoration: underline; }

/* =========================================================
   Archive page — [lna_archive]
   ========================================================= */
.lna-archive { width: 100%; box-sizing: border-box; font-family: inherit; }

.lna-archive__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 18px;
}

.lna-archive__filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    flex: 1 1 140px;
}
.lna-archive__filter label {
    font-size: 12px;
    font-weight: 600;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.lna-archive__filter input,
.lna-archive__filter select {
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}
.lna-archive__filter--btn {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}

.lna-btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 4px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}
.lna-btn--primary { background: #1e3a8a; color: #fff; }
.lna-btn--primary:hover { background: #1e40af; }
.lna-btn--ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.lna-btn--ghost:hover { background: #f3f4f6; }

.lna-archive__table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    font-size: 14px;
}
.lna-archive__table th,
.lna-archive__table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    vertical-align: top;
}
.lna-archive__table thead th {
    background: #f9fafb;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #4b5563;
    border-bottom: 1px solid #e5e7eb;
}
.lna-archive__table tbody tr:last-child td { border-bottom: none; }
.lna-archive__table tbody tr:hover { background: #fafbfc; }
.lna-archive__table a { color: #1e40af; text-decoration: none; font-weight: 500; }
.lna-archive__table a:hover { text-decoration: underline; }
.lna-archive__table code {
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.lna-archive__extras {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}
.lna-archive__extra em { font-style: normal; font-weight: 600; color: #4b5563; margin-right: 2px; }

.lna-archive__empty {
    padding: 32px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    text-align: center;
    color: #6b7280;
}

.lna-archive__pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.lna-archive__pagination .page-numbers {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    background: #fff;
}
.lna-archive__pagination .page-numbers:hover { background: #f9fafb; }
.lna-archive__pagination .page-numbers.current { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
.lna-archive__pagination .page-numbers.dots { border-color: transparent; }

/* ---------- Empty state for [lna_tabs] ---------- */
.lna-empty {
    padding: 24px;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 720px) {
    .lna-tabs__btn { padding: 10px 16px; font-size: 14px; }
    .lna-tabs__nav { padding: 0 8px; }

    .lna-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .lna-item__title { white-space: normal; }
    .lna-item__meta {
        gap: 8px;
        font-size: 11px;
    }

    .lna-archive__table thead { display: none; }
    .lna-archive__table,
    .lna-archive__table tbody,
    .lna-archive__table tr,
    .lna-archive__table td { display: block; width: 100%; }
    .lna-archive__table tr {
        border-bottom: 1px solid #e5e7eb;
        padding: 10px 0;
    }
    .lna-archive__table td {
        border: none;
        padding: 4px 14px;
    }
    .lna-archive__table td::before {
        content: attr(data-label);
        display: inline-block;
        font-weight: 600;
        color: #6b7280;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .4px;
        margin-right: 6px;
    }
}

@media (max-width: 420px) {
    .lna-tabs { --lna-row-height: 56px; }
    .lna-tabs__btn { padding: 9px 12px; font-size: 13px; margin: 0 1px; }
}

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

/* ---------- Print ---------- */
@media print {
    .lna-marquee { height: auto; -webkit-mask-image: none; mask-image: none; }
    .lna-marquee__list { animation: none; transform: none; }
    .lna-tabs__panel { display: block !important; }
}

/* ---------- RTL ---------- */
[dir="rtl"] .lna-archive__pagination,
[dir="rtl"] .lna-tabs__nav { direction: rtl; }
