/* Article page (application/views/pages/single.php), light and dark mode.
   Colours are variables so dark mode only swaps the values. --c / --cbg = the topic's icon colours. */
body.light {
  --bg: #f6f7f9; --paper: #fff; --ink: #1f2328; --text: #374151; --muted: #6b7280;
  --line: #e6e8eb; --soft: #f3f4f6; --link: #2e6b34; --dot: #c8a57c;
}
body.dark {
  --bg: #081126; --paper: #0f1a33; --ink: #eef1f6; --text: #c9d1df; --muted: #8b97ad;
  --line: #22304f; --soft: #14213f; --link: #9fd28a; --dot: #c8a57c;
}
body.light, body.dark { background: var(--bg) !important; color: var(--text) !important; }

.ar-wrap { max-width: 780px; margin: 0 auto; padding: 22px 16px 10px; }

/* Top: breadcrumb and title */
.ar-crumb { margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.ar-crumb a { color: var(--link) !important; font-weight: 600; text-decoration: none; }
.ar-head h1 { margin: 0; font-size: 36px; line-height: 1.22; font-weight: 800; letter-spacing: -.015em; color: var(--ink) !important; }

/* Article text. Many articles carry pasted inline styles (justify, fixed colours, fonts): the page look wins. */
.ar-body { padding-top: 16px; font-size: 17px; line-height: 1.78; color: var(--text); overflow-wrap: break-word; }
.ar-body p { margin: 0 0 1.15em; font-size: 17px !important; }
.ar-body [style]:not(iframe):not(#afscontainer2) { text-align: left !important; font-family: inherit !important; font-size: inherit !important; line-height: inherit !important; color: inherit !important; margin-left: 0 !important; margin-right: 0 !important; }
.ar-body h1, .ar-body h2 { margin: 1.6em 0 .55em; font-size: 25px; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; color: var(--ink) !important; }
.ar-body h3 { margin: 1.4em 0 .5em; font-size: 20px; font-weight: 700; line-height: 1.35; color: var(--ink) !important; }
.ar-body h4 { margin: 1.3em 0 .4em; font-size: 17.5px; font-weight: 700; color: var(--ink) !important; }
.ar-body strong { color: var(--ink) !important; }
.ar-body a { color: var(--link) !important; text-decoration: underline; text-underline-offset: 3px; }
.ar-body ul, .ar-body ol { margin: 0 0 1.2em; padding-left: 0; }
.ar-body ul { list-style: none; }
.ar-body ol { padding-left: 1.4em; }
.ar-body ul > li { position: relative; padding-left: 26px; }
.ar-body li { margin: 0 0 .5em; }
.ar-body li p { margin: 0; }
.ar-body ul > li::before { content: ""; position: absolute; left: 6px; top: .68em; width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.ar-body ol > li::marker { color: var(--link); font-weight: 700; }
.ar-body hr { border-color: var(--line); opacity: 1; }

/* Tables (the page adds Bootstrap's table classes) */
.ar-body table { margin: 0 0 1.4em; }
.ar-body table.table {
  --bs-table-bg: var(--paper); --bs-table-striped-bg: var(--soft); --bs-table-color: var(--text);
  --bs-table-striped-color: var(--text); --bs-table-border-color: var(--line);
  border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 15px;
}
.ar-body table.table > :not(caption) > * > * { padding: 11px 14px; border-width: 0 0 1px; }
.ar-body table.table tr:last-child > * { border-bottom-width: 0; }
.ar-body table.table th, .ar-body table.table thead td { background: var(--soft); color: var(--ink); font-weight: 700; }
@media (max-width: 767px) { .ar-body table.table { display: block; overflow-x: auto; } }

/* Google related-search block: code untouched, only space around it */
.ar-body #afscontainer2 { margin: 6px 0 26px !important; }
.ar-body #afscontainer2:empty { display: none; }

/* Related articles */
.ar-rel { margin: 34px 0 10px; }
.ar-rel h2 { margin: 0 0 14px; font-size: 21px; font-weight: 800; color: var(--ink) !important; }
.ar-rel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ar-rel a { display: flex; align-items: center; gap: 12px; height: 100%; padding: 13px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; color: var(--ink) !important; font-size: 15px; font-weight: 600; line-height: 1.35; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.ar-rel a:hover { box-shadow: 0 8px 20px rgba(16,24,40,.08); transform: translateY(-1px); }
.ar-rel i { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--cbg); color: var(--c); }
body.dark .ar-rel i { background: #13284a; }
.ar-rel i svg { width: 18px; height: 18px; }
.ar-rel b { margin-left: auto; padding-left: 6px; color: var(--link); font-size: 18px; }

/* Loading screen */
#preloader { background: var(--bg) !important; }
.ar-spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--link); animation: ar-spin .8s linear infinite; }
@keyframes ar-spin { to { transform: rotate(360deg); } }

@media (max-width: 767px) {
  .ar-wrap { padding-top: 16px; }
  .ar-head h1 { font-size: 27px; }
  .ar-body, .ar-body p { font-size: 16.5px !important; }
  .ar-body h1, .ar-body h2 { font-size: 22px; }
  .ar-body h3 { font-size: 19px; }
  .ar-rel-grid { grid-template-columns: 1fr; }
}
