/* مدال تی‌وی — one hand-written stylesheet, no build step, ~8 KB */

@font-face {
  font-family: "Estedad";
  src: url("../fonts/estedad.woff2") format("woff2-variations"), url("../fonts/estedad.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn.woff2") format("woff2-variations"), url("../fonts/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* light by default; the accent comes from SITE_ACCENT (set inline in the layout) */
  --bg: #FFFFFF;
  --surface: #F5F5F3;
  --surface-2: #ECEBE7;
  --line: #E4E2DD;
  --line-2: #D2D0CA;
  --text: #121212;
  --text-2: #2E2D2A;
  --body: #22211F;
  --muted: #64615B;
  --soft: #4B4945;
  --accent: var(--brand, #1D4ED8);
  --accent-hover: var(--brand, #1D4ED8);
  --on-accent: #FFFFFF;
  --radius: 4px;
  --wrap: 1100px;
  --font-display: "Estedad", "Vazirmatn", Tahoma, sans-serif;
  color-scheme: light dark;
}

/* dark: follows the phone unless the visitor picked a theme with the header button */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0E10;
    --surface: #17171A;
    --surface-2: #1E1E23;
    --line: #26262B;
    --line-2: #33333A;
    --text: #F2EFE8;
    --text-2: #D9D4CA;
    --body: #E6E2D9;
    --muted: #A8A39A;
    --soft: #B5B0A6;
    --accent: var(--brand-dark, #7EA2FF);
    --accent-hover: var(--brand-dark, #7EA2FF);
    --on-accent: #0E0E10;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0E10;
  --surface: #17171A;
  --surface-2: #1E1E23;
  --line: #26262B;
  --line-2: #33333A;
  --text: #F2EFE8;
  --text-2: #D9D4CA;
  --body: #E6E2D9;
  --muted: #A8A39A;
  --soft: #B5B0A6;
  --accent: var(--brand-dark, #7EA2FF);
  --accent-hover: var(--brand-dark, #7EA2FF);
  --on-accent: #0E0E10;
}
:root[data-theme="light"] { color-scheme: light; }


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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  direction: rtl;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
.logo, .section-title, .live { font-family: var(--font-display); }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; right: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; z-index: 10; }
.skip:focus { right: 8px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }

.logo { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 900; line-height: 1; }
.logo span { color: var(--accent); }
.logo-mark { flex: none; width: 10px; height: 26px; border-radius: 3px; background: var(--accent); }

.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 22px; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { color: var(--accent-hover); }
.icon-btn.ring { border: 1px solid var(--line-2); }
.top-actions { display: flex; gap: 2px; }
.theme-btn .moon { display: block; } .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
  :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
}

.sports-nav { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sports-nav .wrap { display: flex; overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
.sports-nav .wrap::-webkit-scrollbar { display: none; }
.sports-nav a {
  flex: none; display: flex; align-items: center; height: 48px; padding: 0 14px;
  border-bottom: 3px solid transparent; color: var(--text-2); font-size: 15px; font-weight: 500; white-space: nowrap;
}
.sports-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* ---------- shared pieces ---------- */

main { display: flex; flex-direction: column; gap: 40px; }
main.wrap { padding-top: 20px; padding-bottom: 56px; }

.media { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: var(--surface-2); }
.media-box { position: relative; }

.meta { font-size: 13px; color: var(--muted); }
.meta .cat { color: var(--accent); }
.meta .dot::before { content: " · "; }

.section-title { font-size: 24px; font-weight: 900; display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }

.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 900; color: var(--accent); }
.live::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

.dur {
  position: absolute; bottom: 0; right: 0; display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--bg); color: var(--text); font-size: 13px; font-weight: 700;
}
.dur svg { fill: var(--accent); }

/* lead story */
.lead { display: flex; flex-wrap: wrap; gap: 16px 28px; }
.lead .media-box { flex: 1 1 520px; min-width: 0; }
.lead .text { flex: 1 1 300px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.lead h1, .lead h2 { font-size: 30px; line-height: 1.5; font-weight: 900; }
.lead p { font-size: 16px; line-height: 1.9; color: var(--soft); }
.lead .meta { font-size: 14px; }

/* two-up cards */
.grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
@media (min-width: 640px) { .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .grid-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.card { display: flex; flex-direction: column; gap: 10px; }
.card h3 { font-size: 17px; line-height: 1.65; font-weight: 700; }

/* thumbnail rows */
.grid-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 32px; }
.row { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.row .media-box { flex: 0 0 46%; }
.row .text { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0; }
.row h3 { font-size: 16px; line-height: 1.65; font-weight: 700; }

/* ---------- article page ---------- */

.article { max-width: 720px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); padding: 0; margin: 0; list-style: none; }
.crumbs li + li::before { content: "‹"; margin-left: 8px; }
.crumbs a.cat { color: var(--accent); font-weight: 700; }
.article h1 { font-size: 32px; line-height: 1.55; font-weight: 900; }
.standfirst { font-size: 18px; line-height: 1.9; color: var(--soft); }

.byline {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px;
}
.byline strong { display: block; }
.share { display: flex; gap: 8px; }

figure { margin: 0; display: flex; flex-direction: column; gap: 10px; }
figcaption { font-size: 13px; color: var(--muted); line-height: 1.8; }

.prose { font-size: 18px; line-height: 2.1; color: var(--body); display: flex; flex-direction: column; gap: 20px; overflow-wrap: anywhere; }
.prose h2 { font-size: 22px; font-weight: 900; color: var(--text); margin-top: 12px; }
.prose h3 { font-size: 19px; font-weight: 700; color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.prose blockquote {
  margin: 8px 0; padding: 4px 20px 4px 0; border-right: 3px solid var(--accent);
  font-size: 21px; line-height: 1.9; font-weight: 700; color: var(--text);
}
.prose ul, .prose ol { margin: 0; padding-right: 22px; }
.prose img { border-radius: var(--radius); height: auto; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.tags a { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 14px; color: var(--text-2); }

.source { font-size: 13px; color: var(--muted); }
.source a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

.flags { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.badge-exclusive {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 3px;
  background: var(--accent); color: var(--on-accent); font-family: var(--font-display); font-size: 13px; font-weight: 900;
}

/* ---------- sport + search pages ---------- */

.page-head { display: flex; align-items: center; gap: 14px; }
.page-head h1 { font-size: 28px; font-weight: 900; }

.search-form { display: flex; gap: 8px; }
.search-form input {
  flex: 1 1 auto; min-width: 0; height: 48px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit;
}
.search-form button {
  height: 48px; padding: 0 22px; border: 0; border-radius: var(--radius); background: var(--accent);
  color: var(--on-accent); font: inherit; font-weight: 700; cursor: pointer;
}

.empty { color: var(--muted); padding: 24px 0; }

.pager { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; }
.pager a, .pager span {
  display: inline-flex; align-items: center; height: 44px; padding: 0 18px; border-radius: 22px;
  border: 1px solid var(--line-2); font-size: 15px;
}
.pager span { color: var(--muted); opacity: .6; }

/* ---------- footer ---------- */

.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer .wrap { padding-top: 32px; padding-bottom: 32px; display: flex; flex-direction: column; gap: 24px; }
.foot-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 18px 16px; font-size: 15px; font-weight: 700; }
.foot-note { border-top: 1px solid var(--line-2); padding-top: 18px; font-size: 13px; color: var(--muted); }

@media (max-width: 480px) {
  .lead h1, .lead h2 { font-size: 24px; }
  .article h1 { font-size: 26px; }
  .prose { font-size: 17px; }
  .row h3 { font-size: 15px; }
}

/* shown by JS only to logged-in editors, like WordPress's admin bar */
.editor-bar { background: #141416; color: #F2EFE8; font-size: 13px; }
.editor-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
.editor-bar a { color: #D9D4CA; }
.editor-bar a:hover { color: #FFFFFF; }
.editor-bar a.primary { color: #D4A84B; font-weight: 700; }

.preview-bar { background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: var(--radius); font-weight: 700; font-size: 14px; }
.preview-bar a { text-decoration: underline; }
