/* Deliberately isolated from student portals, tasks, teacher pages and their rich-text content. */
.athar-news {
  --news-ink: #162b45;
  --news-muted: #53647a;
  --news-blue: #2148ad;
  --news-line: #dce4ed;
  --news-soft: #f3f6fa;
  color: var(--news-ink);
  font-family: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  text-align: start;
  overflow-wrap: anywhere;
  color-scheme: light;
}
.athar-news, .athar-news *, .athar-news *::before, .athar-news *::after { box-sizing: border-box; }
body.subject-home-page .athar-news.news-magazine {
  padding: clamp(18px, 3vw, 32px);
  background: #fff;
  border: 1px solid var(--news-line);
  border-radius: 26px;
  box-shadow: 0 12px 40px #14284008;
  overflow: visible;
}
.athar-news .news-magazine-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.athar-news .news-eyebrow { color: var(--news-blue); font-size: 13px; font-weight: 700; }
body .athar-news .news-magazine-head h2 { font-size: clamp(23px, 2.5vw, 32px); line-height: 1.5; color: var(--news-ink); margin: 5px 0 6px; }
.athar-news .news-magazine-head p { margin: 0; color: var(--news-muted); font-size: 15px; max-width: 65ch; }
.athar-news .news-count { flex-shrink: 0; padding: 6px 14px; border: 1px solid var(--news-line); border-radius: 30px; color: var(--news-muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.athar-news .news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 22px; align-items: stretch; }
.athar-news .news-grid--single { grid-template-columns: minmax(0, 1fr); }
.athar-news .news-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--news-line); border-radius: 20px; overflow: hidden; background: #fff; }
.athar-news .news-card--single:not(.news-card--text) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); }
.athar-news .news-media { margin: 0; min-width: 0; background: #edf2f7; display: grid; align-items: center; }
.athar-news .news-media img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: contain; margin: 0; }
.athar-news .news-card--single .news-media img { aspect-ratio: auto; max-height: 420px; }
.athar-news .news-card-copy { display: flex; flex: 1; flex-direction: column; align-items: start; gap: 15px; padding: clamp(20px, 2.3vw, 30px); min-width: 0; }
.athar-news .news-meta { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; font-size: 12px; line-height: 1.7; }
.athar-news .news-category, .athar-news .news-pinned { border-radius: 7px; padding: 3px 9px; font-weight: 600; color: #2148ad; background: #edf2ff; }
.athar-news .news-pinned { color: #126152; background: #e8f5ef; }
.athar-news .news-meta time { color: var(--news-muted); font-variant-numeric: tabular-nums; }
body .athar-news .news-card h3 { font-size: clamp(20px, 1.8vw, 26px); line-height: 1.6; color: var(--news-ink); margin: 0; font-weight: 700; letter-spacing: 0; }
body .athar-news .news-card--single h3 { font-size: clamp(23px, 2.15vw, 30px); }
.athar-news .news-excerpt { margin: 0; color: var(--news-muted); font-size: 15px; line-height: 1.95; }
.athar-news .news-read { display: inline-flex; align-items: center; justify-content: center; gap: 18px; min-height: 44px; margin-top: auto; padding: 9px 18px; border: 1px solid var(--news-blue); border-radius: 10px; background: var(--news-blue); color: #fff; font-size: 14px; font-weight: 700; text-decoration: none; transition: background .15s; }
.athar-news .news-read:hover { background: #163883; color: #fff; }
.athar-news .news-actions { display: flex; gap: 5px 12px; flex-wrap: wrap; align-items: center; width: 100%; }
.athar-news .news-card .news-actions { border-top: 1px solid var(--news-line); padding-top: 12px; margin-top: 2px; }
.athar-news .news-actions a, .athar-news .news-actions button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 7px 2px; margin: 0; color: var(--news-blue); font: inherit; font-size: 13px; font-weight: 600; background: transparent; border: 0; border-radius: 5px; box-shadow: none; text-decoration: none; cursor: pointer; }
.athar-news .news-actions a:hover, .athar-news .news-actions button:hover { text-decoration: underline; text-underline-offset: 4px; }
.athar-news :is(a, button, summary):focus-visible { outline: 3px solid #527bd8; outline-offset: 4px; }
.athar-news .news-empty { padding: 40px 20px; border: 1px dashed var(--news-line); background: var(--news-soft); border-radius: 18px; text-align: center; }
.athar-news .news-empty p { color: var(--news-muted); margin: 6px 0 0; }
.athar-news .news-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }

/* Native dialog handles focus trapping, Escape and the inert background. */
dialog.athar-news-reader { width: min(900px, calc(100% - 48px)); max-width: none; max-height: calc(100dvh - 48px); padding: 0; border: 1px solid #dce4ed; border-radius: 22px; background: #fff; margin: auto; overflow: auto; overscroll-behavior: contain; box-shadow: 0 30px 110px #0b1b3659; }
dialog.athar-news-reader:not([open]) { display: none; }
dialog.athar-news-reader::backdrop { background: #10213db3; }
.athar-news .news-reader-toolbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 18px; background: #fff; border-bottom: 1px solid var(--news-line); font-size: 12px; font-weight: 600; color: var(--news-muted); }
.athar-news .news-reader-toolbar > span > span { margin: 0 8px; color: #8795a7; }
.athar-news .news-close { flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--news-line); border-radius: 50%; background: #fff; color: var(--news-ink); font: inherit; font-size: 27px; cursor: pointer; box-shadow: none; }
.athar-news .news-close:hover { background: var(--news-soft); }
.athar-news .news-article > .news-media img { max-height: 400px; aspect-ratio: auto; }
.athar-news .news-reader-copy { max-width: 800px; padding: clamp(22px, 4vw, 44px); margin: auto; }
.athar-news .news-article-head { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--news-line); }
body .athar-news .news-article-title { font-size: clamp(25px, 2.6vw, 36px); line-height: 1.55; color: var(--news-ink); margin: 15px 0 0; letter-spacing: 0; }
.athar-news .news-byline { color: var(--news-muted); font-size: 13px; margin: 14px 0 0; }
.athar-news .news-article-footer { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--news-line); }
.athar-news .news-context { color: var(--news-muted); font-size: 13px; margin: 0 0 10px; }
.athar-news.news-standalone { max-width: 960px; margin: 20px auto; border: 1px solid var(--news-line); border-radius: 24px; background: #fff; overflow: hidden; }
.athar-news.news-standalone .news-reader-copy { max-width: 820px; }
.athar-news .news-related-heading { font-size: 24px; color: var(--news-ink); margin: 0 0 20px; }

/* Stored HTML is never rewritten. Override legacy *presentation* inside news only.
   Preserve heading levels, emphasis, list numbering, tables, media, links and text direction. */
.athar-news .athar-news-content { color: #24364f; background: #fff; font-size: 17px; line-height: 2; overflow-wrap: anywhere; }
.athar-news .athar-news-content * {
  color: inherit !important;
  background: transparent !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: none !important;
  opacity: 1 !important;
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  max-width: 100% !important;
}
.athar-news .athar-news-content :is(div, section, article, p, ul, ol, li, blockquote, figure, details) {
  width: auto !important; min-width: 0 !important; height: auto !important; float: none !important;
}
.athar-news .athar-news-content :is(div, section, article) { padding: 0 !important; margin-inline: 0 !important; }
.athar-news .athar-news-content p { margin: 0 0 1.15em; padding: 0 !important; }
.athar-news .athar-news-content :is(h1, h2, h3, h4, h5, h6) { color: #162b45 !important; line-height: 1.65 !important; margin: 1.5em 0 .6em; padding: 0 !important; font-weight: 700 !important; }
.athar-news .athar-news-content h1 { font-size: 1.8em !important; }
.athar-news .athar-news-content h2 { font-size: 1.55em !important; }
.athar-news .athar-news-content h3 { font-size: 1.3em !important; }
.athar-news .athar-news-content :is(h4, h5, h6) { font-size: 1.1em !important; }
.athar-news .athar-news-content :is(h1, h2, h3, h4, h5, h6) :is(span, strong, em) { font-size: inherit !important; }
.athar-news .athar-news-content > :first-child { margin-top: 0; }
.athar-news .athar-news-content :is(strong, b) { font-weight: 700 !important; }
.athar-news .athar-news-content :is(em, i) { font-style: italic !important; }
.athar-news .athar-news-content a { display: inline; color: #2148ad !important; text-decoration: underline !important; text-underline-offset: .2em; text-decoration-thickness: 1px; font-weight: 600; }
.athar-news .athar-news-content a:hover { color: #142f7c !important; }
.athar-news .athar-news-content :is(ul, ol) { display: block !important; padding: 0 1.5em 0 0 !important; padding-inline-start: 1.5em !important; padding-inline-end: 0 !important; margin: 1em 0; }
.athar-news .athar-news-content li { display: list-item !important; padding: 0 !important; margin: .55em 0; }
.athar-news .athar-news-content ul { list-style-type: disc; }
.athar-news .athar-news-content ol { list-style-type: decimal; }
.athar-news .athar-news-content ol[type="A"] { list-style-type: upper-alpha; }
.athar-news .athar-news-content ol[type="a"] { list-style-type: lower-alpha; }
.athar-news .athar-news-content ol[type="I"] { list-style-type: upper-roman; }
.athar-news .athar-news-content ol[type="i"] { list-style-type: lower-roman; }
.athar-news .athar-news-content :is(ul, ol) :is(ul, ol) { margin-block: .4em; }
.athar-news .athar-news-content blockquote { margin: 1.5em 0; padding: 14px 20px !important; border: 0; border-inline-start: 4px solid #6485cb; background: #f3f6fc !important; }
.athar-news .athar-news-content :is(pre, code) { font-family: ui-monospace, Consolas, monospace !important; background: #edf2f7 !important; font-size: .9em !important; }
.athar-news .athar-news-content pre { direction: ltr; text-align: left; white-space: pre; overflow-x: auto; padding: 16px !important; border-radius: 10px; }
.athar-news .athar-news-content code { padding: 2px 5px; }
.athar-news .athar-news-content pre code { padding: 0; }
.athar-news .athar-news-content :is(img, video, iframe) { display: block; max-width: 100% !important; height: auto !important; margin: 20px auto; border-radius: 12px; object-fit: contain; }
.athar-news .athar-news-content iframe { width: 100% !important; aspect-ratio: 16 / 9; border: 0; }
.athar-news .athar-news-content figure { margin: 1.5em 0; }
.athar-news .athar-news-content figcaption { color: #53647a !important; font-size: .85em !important; text-align: center; margin-top: 8px; }
.athar-news .athar-news-content table { display: block; width: 100% !important; min-width: 0 !important; overflow-x: auto; border-collapse: collapse; margin: 1.5em 0; border: 1px solid #dce4ed; }
.athar-news .athar-news-content :is(th, td) { padding: 10px 14px !important; min-width: 100px; border: 1px solid #dce4ed !important; vertical-align: top; }
.athar-news .athar-news-content th { background: #edf2f7 !important; font-weight: 700 !important; }
.athar-news .athar-news-content details { border: 1px solid #dce4ed; padding: 14px !important; margin-block: 1em; border-radius: 10px; }
.athar-news .athar-news-content summary { font-weight: 700; cursor: pointer; }
.athar-news .athar-news-content hr { border: 0; border-top: 1px solid #dce4ed; margin: 1.5em 0; }

@media (max-width: 760px) {
  .athar-news .news-card--single:not(.news-card--text) { display: flex; }
  .athar-news .news-card--single .news-media img { aspect-ratio: 16 / 10; max-height: none; }
  .athar-news .news-magazine-head { align-items: start; gap: 12px; margin-bottom: 20px; }
  .athar-news .news-count { font-size: 11px; padding: 5px 10px; margin-top: 5px; }
  .athar-news .news-card-copy { padding: 22px; gap: 13px; }
  body .athar-news .news-card h3, body .athar-news .news-card--single h3 { font-size: 23px; }
  .athar-news .news-grid { gap: 18px; }
}
@media (max-width: 480px) {
  body.subject-home-page .athar-news.news-magazine { padding: 16px; border-radius: 22px; }
  .athar-news .news-magazine-head { flex-wrap: wrap; }
  .athar-news .news-magazine-head > div { flex-basis: 100%; }
  .athar-news .news-count { margin-top: 0; }
  .athar-news .news-card-copy { padding: 20px; }
  .athar-news .news-actions { gap: 3px 12px; }
  dialog.athar-news-reader { width: 100%; max-height: 100dvh; height: 100dvh; border: 0; border-radius: 0; }
  .athar-news .news-reader-toolbar { padding-inline: 16px; }
  .athar-news .news-reader-copy { padding: 24px 20px; }
  .athar-news .news-article-head { margin-bottom: 24px; padding-bottom: 20px; }
  .athar-news .athar-news-content { font-size: 16px; line-height: 1.95; }
  .athar-news.news-standalone { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) { .athar-news * { scroll-behavior: auto !important; transition: none !important; } }
