/*
Theme Name: MA News
Description: Lightweight multilingual sports news theme. Green/black/white palette, RTL-ready, no page builders.
Version: 1.0.0
Text Domain: ma-news
*/

:root {
    --green: #16a34a;
    --green-dark: #0c7a37;
    --green-neon: #2fe06a;
    --ink: #0a0d0b;
    --bg: #0b0f0c;
    --panel: #121a15;
    --panel-2: #0f1711;
    --border: #1f2c24;
    --text: #e8f0ea;
    --muted: #9fb3a6;
    --white: #ffffff;
    --radius: 10px;
    --maxw: 1600px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--green-neon); text-decoration: none; }
a:hover { color: var(--white); }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- Top bar ---------- */
.topbar {
    background: var(--ink);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; min-height: 40px; gap: 12px; }
.topbar .date { letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.lang-switch { position: relative; }
.lang-flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; display: inline-block; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.lang-current {
    display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid var(--border); color: var(--muted);
    font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .3px;
    padding: 4px 10px; border-radius: 6px; cursor: pointer; line-height: 1.6;
}
.lang-current:hover { border-color: var(--green); color: var(--white); }
.lang-caret { font-size: 9px; transition: transform .15s; }
.lang-switch.open .lang-caret { transform: rotate(180deg); }
.lang-menu {
    position: absolute; top: calc(100% + 6px); inset-inline-end: 0;
    min-width: 170px; margin: 0; padding: 6px; list-style: none;
    background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 12px 34px rgba(0,0,0,.5); z-index: 100;
    opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.lang-switch.open .lang-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.lang-menu li { padding: 0; border: none; }
.lang-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 6px; color: var(--text); font-size: 13px; font-weight: 600;
}
.lang-menu a:hover { background: var(--panel-2); color: var(--green-neon); }
.lang-menu a.active { color: var(--green-neon); }
.lang-menu a.active::after { content: "\2713"; margin-inline-start: auto; color: var(--green); font-size: 12px; }
.lang-code { min-width: 26px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.lang-menu a:hover .lang-code, .lang-menu a.active .lang-code { color: inherit; }

/* ---------- Header ---------- */
.site-header { background: var(--panel-2); border-bottom: 2px solid var(--green); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 76px; gap: 16px; }
.site-brand { display: flex; flex-direction: column; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-right .date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.site-brand .name { font-size: 24px; font-weight: 800; color: var(--white); letter-spacing: -.5px; line-height: 1.05; }
.site-brand .name b { color: var(--green-neon); white-space: nowrap; }
.site-footer .about h4.footer-brand b { color: var(--green-neon); }
.site-brand .tagline { font-size: 12px; color: var(--muted); }

/* ---------- Nav ---------- */
.main-nav { background: var(--ink); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.main-nav .container { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 50px; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav li a {
    display: block;
    padding: 14px 16px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 3px solid transparent;
}
.main-nav li a:hover,
.main-nav li.current-menu-item a { color: var(--green-neon); border-bottom-color: var(--green); }
.nav-toggle { display: none; align-items: center; background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 5px 7px; cursor: pointer; line-height: 0; }
.nav-toggle:hover { color: var(--white); border-color: var(--green); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; padding: 28px 0 48px; }
.section-title {
    font-size: 15px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--white); margin: 0 0 18px; padding-inline-start: 12px;
    border-inline-start: 4px solid var(--green); line-height: 1.2;
}

/* ---------- Hero ---------- */
.hero { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 28px; background: var(--panel); border: 1px solid var(--border); }
.hero .thumb { aspect-ratio: 16/8; overflow: hidden; }
.hero .thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero .overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
    background: linear-gradient(to top, rgba(4,10,6,.92) 10%, rgba(4,10,6,.25) 60%, transparent);
    padding: 28px;
}
.hero .cat { align-self: flex-start; }
.hero h2 { margin: 12px 0 6px; font-size: 30px; line-height: 1.2; color: var(--white); }
.hero h2 a { color: var(--white); }
.hero h2 a:hover { color: var(--green-neon); }
.hero .meta { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Cards grid ---------- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); border-color: var(--green); }
.card .thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--panel-2); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.card h3 a { color: var(--white); }
.card h3 a:hover { color: var(--green-neon); }
.card .excerpt { color: var(--muted); font-size: 14px; margin: 0; }
.card .meta { margin-top: auto; color: var(--muted); font-size: 12px; display: flex; gap: 10px; }

.cat {
    display: inline-block; background: var(--green); color: #04240f; font-weight: 700;
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px; padding: 4px 10px; border-radius: 5px;
}
.cat-ico { display: inline-block; vertical-align: -0.28em; margin-inline-end: 6px; }
.cat-ico svg, .cat-ico img { width: 1.3em; height: 1.3em; display: block; object-fit: contain; }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 70px; align-self: start; }
.sidebar .widget { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; }
.widget-search { margin-bottom: 22px; }
.search-form .search-label { position: relative; display: block; }
.search-field { width: 100%; padding-block: 10px; padding-inline-start: 12px; padding-inline-end: 42px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font: inherit; font-size: 14px; }
.search-field:focus { outline: none; border-color: var(--green); }
.search-submit { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px; color: var(--muted); cursor: pointer; display: inline-flex; }
.search-submit:hover { color: var(--green-neon); }
.search-submit svg { width: 18px; height: 18px; display: block; fill: currentColor; }
.sidebar .widget-title { font-size: 14px; text-transform: uppercase; letter-spacing: .8px; color: var(--white); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.sidebar li:last-child { border-bottom: none; }
.sidebar a { color: var(--text); }
.sidebar a:hover { color: var(--green-neon); }
.mini-post { display: flex; gap: 12px; align-items: center; }
.mini-post .mp-thumb { flex: 0 0 64px; width: 64px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.mini-post .mp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini-post .mp-title { font-size: 14px; line-height: 1.3; }

/* ---------- Single / page ---------- */
.article { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.article .entry-title { font-size: 30px; line-height: 1.2; color: var(--white); margin: 10px 0 10px; }
.article .entry-meta { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.article .featured { border-radius: var(--radius); overflow: hidden; margin: 0 0 22px; border: 1px solid var(--border); }
.article .featured img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.article .entry-content { font-size: 17px; line-height: 1.8; }
.article .entry-content h2 { color: var(--white); font-size: 23px; margin-top: 32px; }
.article .entry-content h3 { color: var(--white); font-size: 19px; margin-top: 26px; }
.article .entry-content img { border-radius: var(--radius); margin: 18px 0; }
.article .entry-content blockquote { border-inline-start: 4px solid var(--green); margin: 20px 0; padding: 6px 18px; color: var(--muted); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.article .entry-content a { text-decoration: underline; }
.article .entry-content ul, .article .entry-content ol { margin: 14px 0; padding-inline-start: 24px; }
.article .entry-content li { margin: 6px 0; }
.article .entry-content h1 + p, .article .entry-content > p:first-child { color: var(--muted); }
.article .entry-content table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.article .entry-content th, .article .entry-content td { border: 1px solid var(--border); padding: 9px 14px; text-align: start; vertical-align: top; line-height: 1.5; }
.article .entry-content thead th { background: var(--panel-2); color: var(--white); font-weight: 700; }
.article .entry-content tbody tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.article .entry-content table a { color: var(--green-neon); }

/* ---------- Legal/content tables ---------- */
.article .entry-content .ml-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.article .entry-content .ml-table th,
.article .entry-content .ml-table td { border: 1px solid var(--line, #2a2f36); padding: 10px 14px; text-align: start; vertical-align: top; }
.article .entry-content .ml-table thead th { background: var(--green); color: #07130b; font-weight: 700; }
.article .entry-content .ml-table tbody tr:nth-child(even) { background: var(--panel-2); }

/* ---------- Footer contact ---------- */
.site-footer .footer-contact { margin-top: 10px; }
.site-footer .footer-contact a { color: var(--green); text-decoration: none; }
.site-footer .footer-contact a:hover { text-decoration: underline; }

/* ---------- Back link (single) ---------- */
.back-link {
    display: inline-flex; align-items: center; gap: 8px;
    margin-bottom: 16px; padding: 8px 14px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 13px; font-weight: 600;
}
.back-link::before { content: "\2190"; color: var(--green-neon); font-size: 16px; line-height: 1; }
.back-link:hover { border-color: var(--green); color: var(--green-neon); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 30px 0; }
.pagination .page-numbers { display: inline-block; padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-weight: 600; }
.pagination .page-numbers.current { background: var(--green); border-color: var(--green); color: #04240f; }
.pagination a.page-numbers:hover { border-color: var(--green); color: var(--white); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); border-top: 2px solid var(--green); margin-top: 40px; color: var(--muted); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; padding: 40px 0; }
.site-footer h4 { color: var(--white); font-size: 14px; text-transform: uppercase; letter-spacing: .8px; margin: 0 0 16px; }
.site-footer .about p { font-size: 14px; color: var(--muted); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { padding: 6px 0; }
.site-footer a { color: var(--muted); font-size: 14px; }
.site-footer a:hover { color: var(--green-neon); }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; font-size: 13px; text-align: center; }

/* ---------- News ticker ---------- */
.news-ticker { background: var(--panel-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.ticker-inner { display: flex; align-items: center; min-height: 44px; }
.ticker-label {
    flex: 0 0 auto; background: var(--green); color: #04240f;
    font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .6px;
    padding: 7px 14px; margin-inline-end: 16px; border-radius: 5px; position: relative; z-index: 2;
}
.ticker-viewport { position: relative; flex: 1 1 auto; overflow: hidden; }
.ticker-track { display: flex; width: max-content; will-change: transform; animation: manews-ticker var(--ticker-dur, 40s) linear infinite; }
.news-ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-group { display: flex; flex: 0 0 auto; }
.ticker-item { display: inline-flex; align-items: center; white-space: nowrap; color: var(--text); font-size: 14px; font-weight: 600; padding: 0 18px; }
.ticker-item:hover { color: var(--green-neon); }
.ticker-dot { color: var(--green); display: inline-flex; align-items: center; margin-inline-end: 5px; }
.ticker-dot svg { width: 17px; height: 17px; fill: currentColor; display: block; }
@keyframes manews-ticker { from { transform: translateX(0); } to { transform: translateX(calc(-1 * var(--ticker-distance, 50%))); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
    .layout { display: flex; flex-direction: column; }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
    .footer-grid .about { grid-column: 1 / -1; }
    .sidebar { position: static; order: -1; align-self: stretch; }  /* Search on top, full width */
    .sidebar .widget, .widget-search { margin-bottom: 0; }  /* avoid double spacing (flex gap already separates) */
    .widget-latest { display: none; }            /* Latest is already covered by the ticker */
}
@media (max-width: 680px) {
    .grid { grid-template-columns: 1fr; }
    /* Single column: the first (hero) post renders like a regular card */
    .hero .thumb { aspect-ratio: 16/9; }
    .hero .overlay { position: static; background: none; padding: 16px; gap: 8px; }
    .hero h2 { font-size: 17px; line-height: 1.35; margin: 0; }
    .nav-toggle { display: inline-flex; }
    .header-right .date { display: none; }
    .main-nav { display: none; position: static; }
    .main-nav.open { display: block; }
    .main-nav ul { display: flex; width: 100%; flex-direction: column; }
}
@media (max-width: 500px) {
    .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
    /* Language selector button: flag only (dropdown keeps full names) */
    .lang-switch .lang-current .lang-cur-name { display: none; }
}
