/*
Theme Name: IraqNext
Description: Editorial theme for IraqNext.com. Arabic (right-to-left) and English from one stylesheet, light and dark modes, no web fonts and no build step.
Version: 0.1.4
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: iraqnext
*/

/* ── tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --ink: #0B1020;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #111827;
  --muted: #5B6472;
  --line: #E2E8F0;
  --accent: #7A2BE9;
  --accent-soft: #F3ECFF;
  --grad: linear-gradient(90deg, #7A2BE9, #E2457A 55%, #FF7A2D);
  --radius: 10px;
  --wrap: 1180px;
  --font: "IBM Plex Sans Arabic", "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", "Noto Sans", Tahoma, Arial, sans-serif;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --bg: #0B1020; --surface: #121A2E; --text: #E7EAF0; --muted: #9AA4B5; --line: #223049;
  --accent: #B48CFF; --accent-soft: #1D1A3A;
  --grad: linear-gradient(90deg, #9A55FF, #F05A8A 55%, #FF8A3D);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --bg: #0B1020; --surface: #121A2E; --text: #E7EAF0; --muted: #9AA4B5; --line: #223049;
    --accent: #B48CFF; --accent-soft: #1D1A3A;
    --grad: linear-gradient(90deg, #9A55FF, #F05A8A 55%, #FF8A3D);
    color-scheme: dark;
  }
}

/* ── base ───────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-family: var(--font); font-size: 17px; line-height: 1.65; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html[dir="rtl"] { line-height: 1.9; }
body { margin: 0; background: var(--bg); color: var(--text); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 6px; z-index: 20; }
.skip:focus { top: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ── header ─────────────────────────────────────────────────────────────────── */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; }
.site-header::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 3px; background: var(--grad); }
.site-header__bar { display: flex; align-items: center; gap: 18px; padding-block: 14px; }
.brand img { height: 52px; width: auto; }
.brand__dark { display: none; }
:root[data-mode="dark"] .brand__light { display: none; }
:root[data-mode="dark"] .brand__dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .brand__light { display: none; }
  :root:not([data-mode="light"]) .brand__dark { display: block; }
}
.site-header__slogan { color: var(--muted); font-size: .92rem; margin-inline-end: auto; padding-inline-start: 18px; border-inline-start: 1px solid var(--line); }
.site-header__tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.langs { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-size: .85rem; }
.langs a { padding: 5px 12px; }
.langs a[aria-current] { background: var(--ink); color: #fff; }
:root[data-mode="dark"] .langs a[aria-current] { background: var(--accent); color: var(--ink); }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 999px; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-btn { display: none; }

.site-nav { border-top: 1px solid var(--line); }
.site-nav__inner { display: flex; align-items: center; gap: 16px; }
.site-nav ul { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.site-nav ul::-webkit-scrollbar { display: none; }
.site-nav li a { display: block; padding: 11px 12px; font-size: .95rem; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.site-nav li a[aria-current] { border-bottom-color: var(--accent); color: var(--accent); }
.search { display: flex; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.search input { border: 0; background: none; padding: 6px 14px; width: 180px; outline-offset: -2px; border-radius: 999px; }
.search button { border: 0; background: none; padding-inline: 10px; cursor: pointer; display: grid; place-items: center; color: var(--muted); }

/* ── ticker ─────────────────────────────────────────────────────────────────── */
.ticker { background: var(--ink); color: #fff; font-size: .92rem; }
.ticker__inner { display: flex; align-items: center; gap: 14px; overflow: hidden; }
.ticker__label { background: var(--grad); padding: 3px 12px; border-radius: 4px; font-size: .8rem; flex: none; margin-block: 8px; }
.ticker ul { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; white-space: nowrap; padding-block: 9px; }
.ticker ul::-webkit-scrollbar { display: none; }
.ticker a { color: #E7EAF0; }
.ticker a:hover { color: #fff; text-decoration: underline; }
.ticker li + li::before { content: "•"; margin-inline-end: 28px; color: #6B7690; }

/* ── sections and cards ─────────────────────────────────────────────────────── */
.site-main { padding-bottom: 56px; }
.section { margin-top: 44px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); position: relative; }
.section__head::after { content: ""; position: absolute; inset-inline-start: 0; bottom: -1px; width: 56px; height: 3px; background: var(--grad); }
.section__head h2 { font-size: 1.3rem; }
.section__head a { font-size: .88rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kicker { display: inline-block; color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .02em; margin-bottom: 6px; }
html[dir="ltr"] .kicker { text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; }
.meta { color: var(--muted); font-size: .84rem; margin-top: 10px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
/* Category artwork, shown when a story has no photo */
.card__art { display: block; line-height: 0; }
.card__art svg { width: 100%; aspect-ratio: 16 / 9; display: block; }
.card--lead .card__art { position: absolute; inset: 0; pointer-events: none; }
.card--lead .card__art svg { height: 100%; aspect-ratio: auto; }
html[dir="rtl"] .card--lead .card__art { transform: scaleX(-1); }
.card--lead .card__body { position: relative; max-width: 68%; }
.card__body { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.card__title { font-size: 1.08rem; line-height: 1.45; }
html[dir="rtl"] .card__title { line-height: 1.7; }
.card__dek { color: var(--muted); font-size: .93rem; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { margin-top: auto; padding-top: 12px; }

.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 26px; margin-top: 30px; }
.card--lead { border: 0; background: var(--ink); color: #fff; position: relative; }
.card--lead:hover { transform: none; }
.card--lead::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 4px; background: var(--grad); }
.card--lead .card__body { padding: 34px; justify-content: center; min-height: 260px; }
.card--lead .card__title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); line-height: 1.3; }
html[dir="rtl"] .card--lead .card__title { line-height: 1.55; }
.card--lead .card__title a:hover { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.card--lead .card__dek { color: #C7CDDA; font-size: 1.02rem; margin-top: 14px; }
.card--lead .kicker { color: #FFB27A; }
.card--lead .meta { color: #9AA4B5; }
.hero__side { display: flex; flex-direction: column; }
.hero__label { font-size: .95rem; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.card--row { background: none; border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.card--row:hover { transform: none; }
.card--row .card__body { padding: 16px 0; }
.card--row:last-child { border-bottom: 0; }
/* A row whose story has a photo shows it small beside the headline. */
.card--thumb { flex-direction: row; align-items: center; gap: 14px; }
.card--thumb .card__media { flex: 0 0 116px; border-radius: 8px; overflow: hidden; }
.card--thumb .card__media img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.card--thumb .card__body { flex: 1; min-width: 0; }

.empty { text-align: center; padding-block: 72px; color: var(--muted); }
.empty h1 { color: var(--text); margin-bottom: 12px; }
.button { display: inline-block; margin-top: 18px; background: var(--accent); color: #fff; padding: 10px 22px; border-radius: 999px; font-weight: 600; }
.button:hover { color: #fff; filter: brightness(1.1); }
:root[data-mode="dark"] .button { color: var(--ink); }

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); line-height: 1.3; }
.page-head__desc { color: var(--muted); margin-top: 8px; }
.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pagination .page-numbers { border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; background: var(--surface); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── article ────────────────────────────────────────────────────────────────── */
.article { max-width: 760px; margin-top: 40px; }
.article__head h1 { font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem); line-height: 1.25; }
html[dir="rtl"] .article__head h1 { line-height: 1.5; }
.article__dek { font-size: 1.18rem; color: var(--muted); margin-top: 14px; }
.article__head .meta { margin-top: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.article__media { margin-top: 24px; }
.article__media img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; border-radius: var(--radius); }
.article__media figcaption { margin-top: 8px; font-size: .8125rem; color: var(--muted); }
.article__art { margin-top: 24px; border-radius: var(--radius); overflow: hidden; line-height: 0; }
.article__art svg { width: 100%; aspect-ratio: 24 / 9; display: block; }
.article__body { margin-top: 26px; font-size: 1.1rem; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: 1.35rem; margin-top: 1.8em; line-height: 1.4; }
.prose h3 { font-size: 1.15rem; margin-top: 1.5em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: .4em; }
.prose blockquote { border-inline-start: 3px solid var(--accent); padding-inline-start: 18px; color: var(--muted); margin-inline: 0; }

.iqn-why { background: var(--accent-soft); border-radius: var(--radius); padding: 20px 24px; margin-top: 2em; position: relative; }
.iqn-why::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; border-radius: 4px; background: var(--grad); }
.iqn-why h2 { font-size: 1.05rem; margin: 0 0 6px; color: var(--accent); }
.iqn-sources { margin-top: 2em; padding-top: 18px; border-top: 1px solid var(--line); font-size: .95rem; }
.iqn-sources h2 { font-size: .95rem; margin: 0 0 8px; color: var(--muted); }
.iqn-sources ul { padding-inline-start: 1.2em; }
.iqn-disclosure, .iqn-ai-disclosure { font-size: .88rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; }
.iqn-ai-disclosure a { color: var(--accent); }
.iqn-correction { background: #FFF7E6; color: #5C3D00; border: 1px solid #F2D08A; border-radius: 8px; padding: 12px 16px; font-size: .97rem; }
:root[data-mode="dark"] .iqn-correction { background: #33270B; color: #F6DFA6; border-color: #6B5215; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.tags a { border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: .86rem; background: var(--surface); }

/* ── footer ─────────────────────────────────────────────────────────────────── */
.site-footer { background: var(--ink); color: #C7CDDA; margin-top: 40px; position: relative; }
.site-footer::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--grad); }
.site-footer__grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; padding-block: 44px 28px; }
.site-footer__brand img { height: 64px; width: auto; margin-bottom: 14px; }
.site-footer__brand p { font-size: .93rem; max-width: 34ch; }
.site-footer h2 { font-size: .9rem; color: #fff; margin-bottom: 10px; }
.site-footer li + li { margin-top: 6px; }
.site-footer a { font-size: .93rem; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer__legal { border-top: 1px solid #223049; padding-block: 18px 28px; font-size: .84rem; color: #9AA4B5; display: grid; gap: 4px; }

/* ── smaller screens ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-header__slogan { display: none; }
}
@media (max-width: 680px) {
  html { font-size: 16px; }
  .grid, .grid--4 { grid-template-columns: 1fr; gap: 16px; }
  .brand img { height: 42px; }
  .menu-btn { display: grid; }
  .site-nav { display: none; }
  .site-nav.is-open { display: block; }
  .site-nav__inner { flex-direction: column; align-items: stretch; gap: 0; padding-block: 8px 14px; }
  .site-nav ul { flex-direction: column; overflow: visible; }
  .site-nav li a { border-bottom: 1px solid var(--line); padding-inline: 4px; }
  .site-nav li a[aria-current] { border-bottom-color: var(--line); }
  .search { margin-top: 12px; }
  .search input { flex: 1; width: auto; }
  .card--lead .card__body { padding: 24px; min-height: 240px; max-width: none; }
  .card--lead .card__art { opacity: .45; }
  .section { margin-top: 34px; }
  .site-footer__grid { grid-template-columns: 1fr; gap: 24px; }
  .article { margin-top: 26px; }
}

@media print {
  .site-header, .site-footer, .ticker, .tags, .section { display: none; }
  body { background: #fff; color: #000; }
}
