/* ==========================================================================
   Ruyaa design system — Arabic-first, RTL-first, logical properties throughout.
   ========================================================================== */
:root {
  --brand: #10b3aa;          /* turquoise */
  --brand-strong: #0a7c76;   /* text/links on light surfaces (AA) */
  --brand-soft: rgba(16, 179, 170, .12);
  --brand-ink: #04211f;          /* text on --brand: 6.48:1 */
  --brand-strong-ink: #ffffff;   /* text on --brand-strong: 5.05:1 */
  --breaking: #ffcc0f;
  --breaking-ink: #121212;

  --bg: #f5f7f7;
  --surface: #ffffff;
  --surface-2: #eef2f2;
  --surface-3: #e3e9ea;
  --text: #0f1719;
  --text-2: #4a585c;
  --text-3: #5f6d71;             /* ≥4.5:1 on bg, surface and surface-2 */
  --border: #e1e7e8;
  --shadow: 0 1px 2px rgba(15, 23, 25, .05), 0 4px 16px rgba(15, 23, 25, .06);
  --shadow-lg: 0 10px 40px rgba(15, 23, 25, .14);
  --danger: #d33a3a;
  --success: #0f9d6b;
  --warning: #c77a00;
  --info: #2a7de1;

  --font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --container: 1240px;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2dd4c4; --brand-strong: #5eead9; --brand-soft: rgba(45, 212, 196, .14); --brand-ink: #04211f; --brand-strong-ink: #04211f;
    --bg: #0a0e10; --surface: #11171a; --surface-2: #182024; --surface-3: #212b30;
    --text: #e7eded; --text-2: #a3b1b4; --text-3: #7d8c90; --border: #222d31;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 14px 44px rgba(0,0,0,.5);
    --danger: #f06464; --success: #3ccf95; --warning: #f0b43c; --info: #6aa8f5;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #2dd4c4; --brand-strong: #5eead9; --brand-soft: rgba(45, 212, 196, .14); --brand-ink: #04211f; --brand-strong-ink: #04211f;
  --bg: #0a0e10; --surface: #11171a; --surface-2: #182024; --surface-3: #212b30;
  --text: #e7eded; --text-2: #a3b1b4; --text-3: #7d8c90; --border: #222d31;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 14px 44px rgba(0,0,0,.5);
  --danger: #f06464; --success: #3ccf95; --warning: #f0b43c; --info: #6aa8f5;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 60px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html[lang="en"] body { line-height: 1.55; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.35; margin: 0; font-weight: 600; letter-spacing: -.005em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; } /* components set display:grid/flex; hidden must still hide */
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--brand); color: var(--brand-ink); padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.icon { flex-shrink: 0; vertical-align: middle; }
[dir="rtl"] .icon-dir { transform: scaleX(-1); }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .container { padding-inline: 24px; } }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.xsmall { font-size: .78rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .1s;
  background: var(--surface-2); color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); color: var(--brand-strong-ink); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); background: var(--danger); color: #fff; }
.btn-sm { min-height: 34px; padding: .3rem .8rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px;
  background: transparent; border: 0; cursor: pointer; color: var(--text-2); position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.badge-dot { position: absolute; top: 6px; inset-inline-end: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }

.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
.field label, .label { font-weight: 600; font-size: .92rem; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: .6rem .9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 140px; resize: vertical; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; }
.hint { color: var(--text-3); font-size: .82rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin-top: .25rem; flex-shrink: 0; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); margin-bottom: 1rem; }
.alert-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.alert-success { border-color: color-mix(in srgb, var(--success) 40%, transparent); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.alert-info { border-color: color-mix(in srgb, var(--brand) 40%, transparent); background: var(--brand-soft); }

/* ---------------------------------------------------------------- header */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--border); }
.header-main { display: flex; align-items: center; gap: 1rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { object-fit: contain; flex-shrink: 0; }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; letter-spacing: -.01em; }
.brand-slogan { font-size: .72rem; color: var(--text-3); font-weight: 500; }
.header-search { flex: 1; max-width: 460px; margin-inline: auto; position: relative; }
.header-search .input { border-radius: 999px; padding-inline-start: 2.6rem; background: var(--surface-2); border-color: transparent; min-height: 42px; }
.header-search .input:focus { background: var(--surface); }
.header-search .icon { position: absolute; inset-inline-start: .9rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.header-actions { display: flex; align-items: center; gap: .25rem; margin-inline-start: auto; }
.lang-btn { font-weight: 700; font-size: .8rem; font-family: var(--font-display); }
.avatar { width: 34px; height: 34px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); display: grid; place-items: center; font-weight: 700; font-family: var(--font-display); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.cat-nav { border-top: 1px solid var(--border); }
.cat-nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: .45rem 0; overflow-x: auto; scrollbar-width: none; }
.cat-nav ul::-webkit-scrollbar { display: none; }
.cat-nav a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .85rem; border-radius: 999px; font-size: .92rem; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.cat-nav a:hover { background: var(--surface-2); color: var(--text); }
.cat-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }

.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 240px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: .4rem; display: none;
}
.dropdown[data-open="true"] .dropdown-panel { display: block; animation: pop .14s ease-out; }
.dropdown-panel a, .dropdown-panel button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: 8px; border: 0; background: none; cursor: pointer; text-align: start; font-size: .93rem; }
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--surface-2); color: var(--text); }
.dropdown-head { padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.notif-list { max-height: 360px; overflow-y: auto; min-width: 320px; }
.notif-item { display: block !important; }
.notif-item.unread { background: var(--brand-soft); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* mobile drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(86vw, 340px); background: var(--surface); z-index: 71; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
[dir="ltr"] .drawer { transform: translateX(-100%); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer nav a { display: flex; align-items: center; gap: .7rem; padding: .7rem .6rem; border-radius: 10px; font-weight: 500; }
.drawer nav a:hover { background: var(--surface-2); }
.drawer-title { font-size: .78rem; font-weight: 700; color: var(--text-3); padding: .9rem .6rem .3rem; text-transform: uppercase; letter-spacing: .03em; }

/* ---------------------------------------------------------------- breaking ticker */
.ticker { background: var(--breaking); color: var(--breaking-ink); position: relative; z-index: 30; }
.ticker[hidden] { display: none; }
.ticker-inner { display: flex; align-items: stretch; min-height: 44px; }
.ticker-label { display: inline-flex; align-items: center; gap: .45rem; padding-inline: 1rem; font-family: var(--font-display); font-weight: 700; background: #111; color: var(--breaking); flex-shrink: 0; font-size: .95rem; }
.ticker-label .pulse { width: 8px; height: 8px; border-radius: 99px; background: var(--breaking); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,204,15,.7); } 70% { box-shadow: 0 0 0 8px rgba(255,204,15,0); } 100% { box-shadow: 0 0 0 0 rgba(255,204,15,0); } }
.ticker-track { flex: 1; overflow: hidden; position: relative; mask-image: linear-gradient(to left, transparent, #000 4%, #000 96%, transparent); }
.ticker-items { display: inline-flex; gap: 2.5rem; align-items: center; height: 100%; white-space: nowrap; padding-inline: 1.5rem; animation: ticker-rtl var(--ticker-duration, 30s) linear infinite; }
[dir="ltr"] .ticker-items { animation-name: ticker-ltr; }
.ticker:hover .ticker-items, .ticker:focus-within .ticker-items { animation-play-state: paused; }
.ticker-items a { font-weight: 600; color: var(--breaking-ink); display: inline-flex; gap: .5rem; align-items: center; }
.ticker-items a:hover { text-decoration: underline; color: #000; }
.ticker-items .src { font-weight: 500; opacity: .7; font-size: .85rem; }
.ticker-items .sep { width: 6px; height: 6px; background: #111; border-radius: 99px; opacity: .5; }
@keyframes ticker-rtl { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes ticker-ltr { from { transform: translateX(100%); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker-items { animation: none; overflow-x: auto; max-width: 100%; }
  .ticker-track { mask-image: none; overflow-x: auto; }
}

/* ---------------------------------------------------------------- layout */
main { min-height: 60vh; }
.page { padding-block: 1.5rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title { font-size: clamp(1.5rem, 3.2vw, 2.1rem); font-weight: 700; }
.page-sub { color: var(--text-2); margin-top: .3rem; }
.section { margin-top: 2.25rem; }
.section-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.section-title { font-size: 1.25rem; font-weight: 700; display: inline-flex; align-items: center; gap: .55rem; }
.section-title::before { content: ""; width: 4px; height: 1.15em; background: var(--brand); border-radius: 4px; }
.section-link { margin-inline-start: auto; font-size: .9rem; color: var(--brand-strong); font-weight: 600; display: inline-flex; gap: .3rem; align-items: center; }
.layout-main { display: grid; gap: 2rem; }
@media (min-width: 1024px) { .layout-main { grid-template-columns: minmax(0, 1fr) 320px; } }
.sidebar { display: grid; gap: 1.5rem; align-content: start; }
@media (min-width: 1024px) { .sidebar-sticky { position: sticky; top: calc(var(--header-h) + 64px); } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.panel-title { font-size: 1rem; font-weight: 700; margin-bottom: .8rem; display: flex; align-items: center; gap: .5rem; }

/* ---------------------------------------------------------------- hero */
.hero { display: grid; gap: 1rem; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.5fr 1fr; } }
.hero-lead { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 340px; background: var(--surface-3); display: flex; align-items: flex-end; isolation: isolate; }
.hero-lead img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .6s ease; }
.hero-lead:hover img { transform: scale(1.03); }
.hero-lead::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(4,10,12,.92) 0%, rgba(4,10,12,.55) 45%, rgba(4,10,12,.05) 80%); }
.hero-lead .hero-body { padding: 1.5rem; color: #fff; }
.hero-lead h2 { font-size: clamp(1.35rem, 2.6vw, 2rem); font-weight: 700; margin: .6rem 0 .5rem; }
.hero-lead p { color: rgba(255,255,255,.82); margin: 0 0 .8rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-lead .meta, .hero-lead .meta a { color: rgba(255,255,255,.8); }
.hero-lead a:hover { color: #fff; }
.hero-side { display: grid; gap: .75rem; }
.hero-mini { display: grid; grid-template-columns: 112px 1fr; gap: .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem; align-items: center; }
.hero-mini .thumb { aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--surface-3); }
.hero-mini .thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-mini h3 { font-size: .98rem; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- cards */
.grid-cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .layout-main .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-cards.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s, border-color .2s; position: relative; }
.card:hover { box-shadow: var(--shadow); border-color: var(--surface-3); }
.card-media { aspect-ratio: 16/9; background: var(--surface-2); overflow: hidden; position: relative; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-media .placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); background: linear-gradient(135deg, var(--surface-2), var(--surface-3)); }
.card-body { padding: .95rem 1rem 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card-title { font-size: 1.07rem; font-weight: 600; line-height: 1.5; }
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-desc { color: var(--text-2); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.card .meta { margin-top: auto; }
.card .meta a, .card .card-actions { position: relative; z-index: 2; }
.card-top { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.card.compact { flex-direction: row; }
.card.compact .card-media { aspect-ratio: auto; width: 34%; min-width: 110px; }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--brand-soft); color: var(--brand-strong); line-height: 1.6; }
.chip-cat { background: color-mix(in srgb, var(--cat, var(--brand)) 14%, transparent); color: color-mix(in srgb, var(--cat, var(--brand)) 70%, var(--text)); }
.chip-breaking { background: var(--breaking); color: var(--breaking-ink); }
.chip-sources { background: var(--surface-2); color: var(--text-2); }
.chip-muted { background: var(--surface-2); color: var(--text-2); }
.chip-ai { background: color-mix(in srgb, #8b5cf6 14%, transparent); color: color-mix(in srgb, #8b5cf6 75%, var(--text)); }

.meta { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; color: var(--text-3); font-size: .82rem; }
.meta .dot { width: 3px; height: 3px; background: currentColor; border-radius: 99px; opacity: .6; }
.source-badge { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--text-2); }
.source-badge img, .source-badge .src-initial { width: 20px; height: 20px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.src-initial { display: inline-grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--brand-strong); background: var(--brand-soft) !important; }
.overlay-chip { position: absolute; top: .7rem; inset-inline-start: .7rem; z-index: 2; }

/* skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-card .card-media { border-radius: 0; }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-title { height: 18px; width: 85%; margin-bottom: 10px; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.load-more-wrap { display: grid; place-items: center; margin-top: 1.5rem; gap: .6rem; }
.load-more { min-width: 240px; min-height: 48px; }
.feed-end { color: var(--text-3); font-size: .9rem; }

/* ---------------------------------------------------------------- lists */
.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: rank; display: grid; gap: .1rem; }
.rank-list li { counter-increment: rank; display: grid; grid-template-columns: 34px 1fr; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before { content: counter(rank); font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--brand); line-height: 1.2; }
.rank-list a { font-weight: 600; font-size: .95rem; line-height: 1.5; }
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.link-list a { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.link-list a:hover { background: var(--surface-2); color: var(--text); }
.cat-dot { width: 10px; height: 10px; border-radius: 99px; background: var(--cat, var(--brand)); flex-shrink: 0; }

/* story strip */
.story-strip { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .story-strip { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .story-strip { grid-template-columns: repeat(3, 1fr); } }
.story-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .7rem; position: relative; }
.story-card:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.story-card h3 { font-size: 1.02rem; font-weight: 600; }
.story-card h3 a::after { content: ""; position: absolute; inset: 0; }
.source-stack { display: flex; align-items: center; }
.source-stack > * { margin-inline-end: -8px; border: 2px solid var(--surface); border-radius: 8px; }
.story-count { font-family: var(--font-display); font-weight: 700; color: var(--brand-strong); }

/* ---------------------------------------------------------------- article */
.article-wrap { display: grid; gap: 2rem; }
@media (min-width: 1024px) { .article-wrap { grid-template-columns: minmax(0, 1fr) 320px; } }
.article { max-width: 760px; }
.breadcrumb { display: flex; gap: .45rem; align-items: center; color: var(--text-3); font-size: .85rem; margin-bottom: .9rem; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--brand-strong); }
.article h1 { font-size: clamp(1.55rem, 3.4vw, 2.4rem); font-weight: 700; line-height: 1.35; margin: .7rem 0 .9rem; }
.article .lede { font-size: 1.15rem; color: var(--text-2); line-height: 1.8; }
.article-figure { margin: 1.3rem 0; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.article-figure img { width: 100%; max-height: 520px; object-fit: cover; }
.article-figure figcaption { padding: .6rem .9rem; font-size: .8rem; color: var(--text-3); }
.article-body { font-size: 1.08rem; line-height: 1.95; }
html[lang="en"] .article-body { line-height: 1.75; }
.article-body img { border-radius: 10px; margin: 1rem 0; height: auto; }
.article-body a { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }
.article-body blockquote { margin: 1.2rem 0; padding: .6rem 1rem; border-inline-start: 4px solid var(--brand); background: var(--surface-2); border-radius: 8px; }
.attribution { display: grid; gap: .8rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin: 1.3rem 0; }
.attribution-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.attribution .source-badge img, .attribution .src-initial { width: 36px; height: 36px; border-radius: 10px; }
.article-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .9rem 0; border-block: 1px solid var(--border); margin: 1.3rem 0; }
.share-btn { width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); }
.share-btn:hover { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.btn[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.coverage-list { display: grid; gap: .6rem; }
.coverage-item { display: grid; grid-template-columns: auto 1fr; gap: .8rem; padding: .85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); align-items: start; }
.coverage-item h4 { font-size: .98rem; font-weight: 600; margin-bottom: .3rem; font-family: var(--font-body); }
.notice { border-radius: var(--radius-sm); padding: .8rem 1rem; background: var(--surface-2); color: var(--text-2); font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }

/* timeline for stories */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 8px; inset-inline-start: 11px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-inline-start: 2.2rem; padding-bottom: 1.1rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 8px; width: 14px; height: 14px; border-radius: 99px; background: var(--surface); border: 3px solid var(--brand); }
.compare-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .compare-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------------- search */
.search-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.3rem; }
.search-big { position: relative; }
.search-big .input { min-height: 54px; font-size: 1.08rem; padding-inline-start: 3rem; border-radius: 999px; }
.search-big > .icon { position: absolute; inset-inline-start: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.filters { display: grid; gap: .8rem; margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg label { padding: .35rem .85rem; border-radius: 999px; font-size: .88rem; font-weight: 500; color: var(--text-2); cursor: pointer; }
.seg a[aria-current="true"], .seg input:checked + span { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span { padding: .35rem .85rem; border-radius: 999px; display: inline-block; }
.seg label { padding: 0; }
.result-item { display: grid; grid-template-columns: 1fr auto; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.result-item .thumb { width: 120px; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.result-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-item h3 { font-size: 1.08rem; font-weight: 600; margin-bottom: .3rem; }
mark { background: color-mix(in srgb, var(--breaking) 55%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 0 .6rem; font-weight: 600; }
.pagination [aria-current="page"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---------------------------------------------------------------- states */
.state { text-align: center; padding: 3rem 1rem; display: grid; justify-items: center; gap: .6rem; color: var(--text-2); }
.state-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); margin-bottom: .4rem; }
.state-error .state-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.state h2, .state h3 { color: var(--text); font-size: 1.2rem; }
.state p { margin: 0; max-width: 420px; }

/* ---------------------------------------------------------------- auth */
.auth-shell { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 2rem 16px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 2rem; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: .3rem; }
.divider { display: flex; align-items: center; gap: .8rem; color: var(--text-3); font-size: .85rem; margin: 1.2rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google { background: var(--surface); border: 1px solid var(--border); width: 100%; }
.interest-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.interest { position: relative; }
.interest input { position: absolute; opacity: 0; }
.interest span { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; border: 1.5px solid var(--border); border-radius: 14px; cursor: pointer; font-weight: 600; background: var(--surface); transition: all .15s; }
.interest span .icon { color: var(--cat, var(--brand)); }
.interest input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.interest input:focus-visible + span { outline: 2.5px solid var(--brand); outline-offset: 2px; }

/* settings */
.settings-layout { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .settings-layout { grid-template-columns: 220px 1fr; } }
.settings-nav { display: flex; gap: .3rem; overflow-x: auto; }
@media (min-width: 900px) { .settings-nav { flex-direction: column; position: sticky; top: calc(var(--header-h) + 64px); align-self: start; } }
.settings-nav a { padding: .55rem .8rem; border-radius: 10px; color: var(--text-2); font-weight: 500; white-space: nowrap; display: flex; gap: .55rem; align-items: center; }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1.2rem; scroll-margin-top: calc(var(--header-h) + 70px); }
.settings-section h2 { font-size: 1.15rem; margin-bottom: .3rem; }
.settings-section > p.muted { margin-bottom: 1.1rem; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-of-type { border-bottom: 0; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; background: #fff; border-radius: 99px; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--brand); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }
[dir="ltr"] .switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--brand); outline-offset: 2px; }
input[type="range"] { accent-color: var(--brand); width: 100%; }

/* verify */
.verdict { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.verdict-needs_check { background: var(--surface-2); color: var(--text-2); }
.verdict-in_progress { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.verdict-verified { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.verdict-inaccurate { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.verdict-misleading { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.verdict-unconfirmed { background: color-mix(in srgb, #8b5cf6 14%, transparent); color: #8b5cf6; }
.claim-box { font-family: var(--font-display); font-size: clamp(1.2rem, 2.4vw, 1.55rem); font-weight: 600; line-height: 1.6; padding: 1.3rem 1.4rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-inline-start: 5px solid var(--brand); }
.evidence { display: grid; gap: .7rem; }
.evidence-item { padding: .9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.evidence-supports { border-inline-start: 4px solid var(--success); }
.evidence-contradicts { border-inline-start: 4px solid var(--danger); }
.evidence-context { border-inline-start: 4px solid var(--text-3); }
.legend { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* map */
.map-wrap { display: grid; gap: 1.2rem; }
@media (min-width: 1000px) { .map-wrap { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
#iraq-map { height: 520px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); z-index: 1; }
.gov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.gov-grid a { display: flex; justify-content: space-between; align-items: center; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-weight: 500; }
.gov-grid a[aria-current="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.gov-grid .count { font-family: var(--font-display); font-weight: 700; color: var(--brand-strong); font-size: .9rem; }
.leaflet-container { font-family: var(--font-body) !important; }
.map-bubble { background: var(--brand); color: var(--brand-ink); border-radius: 999px; display: grid !important; place-items: center; font-weight: 700; font-family: var(--font-display); border: 3px solid rgba(255,255,255,.85); box-shadow: 0 2px 10px rgba(0,0,0,.25); }

/* why (personalization) */
.why { display: flex; gap: .35rem; flex-wrap: wrap; }
.why .chip { font-weight: 500; }

/* ---------------------------------------------------------------- footer & floating */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 2.5rem 0 6rem; margin-top: 3rem; }
@media (min-width: 768px) { .site-footer { padding-bottom: 2.5rem; } }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.5fr repeat(3, 1fr); } }
.footer-grid h4 { font-size: .95rem; margin-bottom: .8rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; color: var(--text-2); font-size: .92rem; }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 2rem; padding-top: 1.2rem; color: var(--text-3); font-size: .85rem; display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; }

.back-to-top {
  position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 45; width: 50px; height: 50px; border-radius: 999px;
  background: var(--brand); color: var(--brand-ink); border: 0; cursor: pointer; display: grid; place-items: center;
  box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(16px) scale(.9); pointer-events: none; transition: opacity .2s, transform .2s;
}
.back-to-top.visible { opacity: 1; transform: none; pointer-events: auto; }
.back-to-top:hover { background: var(--brand-strong); color: var(--brand-strong-ink); }

.toast-region { position: fixed; bottom: 90px; inset-inline-start: 50%; transform: translateX(50%); z-index: 90; display: grid; gap: .5rem; }
[dir="ltr"] .toast-region { transform: translateX(-50%); }
.toast { background: #111; color: #fff; padding: .7rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .92rem; display: flex; gap: .6rem; align-items: center; animation: pop .18s ease-out; }
.toast-error { background: var(--danger); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 18px; max-width: 480px; width: 100%; padding: 1.5rem; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 1.2rem; margin-bottom: .8rem; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.2rem; }

/* mobile bottom navigation */
.bottom-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 44; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { display: grid; justify-items: center; gap: 2px; padding: .5rem 0 .45rem; font-size: .7rem; font-weight: 600; color: var(--text-3); }
.bottom-nav a[aria-current="page"] { color: var(--brand-strong); }
@media (min-width: 768px) { .bottom-nav { display: none; } }
@media (max-width: 767px) {
  .back-to-top { bottom: calc(76px + env(safe-area-inset-bottom)); inset-inline-end: 16px; width: 46px; height: 46px; }
  .header-search, .hide-mobile { display: none !important; }
  .brand-slogan { display: none; }
  .hero-lead { min-height: 300px; }
  .page { padding-top: 1rem; }
  .result-item .thumb { width: 88px; }
  #iraq-map { height: 380px; }
}
@media (min-width: 768px) { .show-mobile { display: none !important; } }

/* prose (about / privacy) */
.prose { max-width: 760px; font-size: 1.05rem; line-height: 1.95; }
.prose h2 { font-size: 1.3rem; margin: 1.8rem 0 .7rem; }
.prose ul { padding-inline-start: 1.3rem; }
.prose li { margin-bottom: .4rem; }

/* Grid/flex children must be allowed to shrink below their content (wide tables, long URLs). */
.layout-main > *, .article-wrap > *, .map-wrap > *, .settings-layout > *, .hero > * { min-width: 0; }
