/* ───────────────────────────────────────────────────────────────
   dark-mode.css — filtered subset synced from annajah26.
   Keeps the site-wide (global) dark-mode rules + the page blocks for
   features present in this project: profile, tools (qrcode / today),
   mobile hamburger, articles list, pagination, newsletter promo,
   comments. Blocks for features NOT in this project (assessments,
   user-dashboard, plans, learning-paths, scenarios, coach, checkout,
   mockup-profile) were intentionally omitted.
   ─────────────────────────────────────────────────────────────── */

/* ═══════════════════════════════════════════════════════════════
   Site-wide CSS overrides
   Loads on every page using layouts/partials/main.blade.php.

   This file has two responsibilities — kept together because there
   is no other shared editable stylesheet on legacy pages
   (styles.min.css is compiled, homepage.css only loads on /):

     1. Global palette tokens (the :root block below).
        These apply in BOTH light and dark mode. The file name
        "dark-mode" understates its scope — it's also the
        site-wide token registry.

     2. Dark-mode overrides scoped to .dark on <html>
        (the header toggle adds/removes the class).
   ═══════════════════════════════════════════════════════════════ */

/* Global palette tokens — used in light AND dark mode. */
:root {
    --hp-navy: #1A1A2E;
    --hp-navy-light: #252540;
    --hp-cream: #FAF8F4;
    --hp-gold: #B8960C;
    --hp-gold-light: #D4AF37;
    --hp-surface: #FFFFFF;
}

/* ═══════════════════════════════════════════════════════════════
   Site theme — admin-customizable (light / default mode)

   Routes the public site's previously-hardcoded colors through
   semantic --site-* variables managed from the CMS
   (Site Settings → Appearance). The inline <style> in
   head.blade.php sets these variables per saved setting; the
   fallbacks below equal the site's CURRENT values, so with no
   settings the page looks identical.

   These rules are UNSCOPED (apply in light/default mode). Dark
   mode keeps its own ".dark ..." rules further down, which win by
   specificity, so customizing here never leaks into dark mode.
   !important is used only where the Bootstrap utility it overrides
   already uses !important.
   ═══════════════════════════════════════════════════════════════ */

body {
    background-color: var(--site-bg, #ffffff);
    color: var(--site-text, #212529);
}

/* Text that carries its OWN dark colour in light mode (so it ignores the
   body color): route it to the Text color setting too. This reaches the
   header navigation links and content titles (e.g. homepage article cards).
   Dark mode keeps its own readable colours via the more-specific .dark
   .text-dark / .dark .nav-link rules further down. */
.text-dark {
    color: var(--site-text, #212529) !important;
}

.navbar-light .navbar-nav .nav-link {
    color: var(--site-text, #212529);
}

/* Article body default text + homepage card descriptions follow the main
   Text color. Scoped to light mode (html:not(.dark)) so dark mode keeps its
   own colours. The article body rules carry NO !important on purpose, so any
   inline colour a writer set in the editor still wins over the theme. */
html:not(.dark) .article-body,
html:not(.dark) .article-body p,
html:not(.dark) .article-body h1,
html:not(.dark) .article-body h2,
html:not(.dark) .article-body h3,
html:not(.dark) .article-body h4,
html:not(.dark) .article-body h5,
html:not(.dark) .article-body h6,
html:not(.dark) .article-body li {
    color: var(--site-text, #212529);
}

html:not(.dark) section .text-info {
    color: var(--site-text, #212529) !important;
}

/* Secondary text color — homepage card meta (reading time, date, category).
   Light mode only; default matches the current muted grey. */
html:not(.dark) section .text-light {
    color: var(--site-text-secondary, #afafaf) !important;
}

/* Hero search heading (the "..today?" line over the hero search box) is white
   by default; follow the main Text color in light mode so it matches the other
   hero title. Dark mode keeps its own .dark .searchbox-title colour. */
html:not(.dark) .searchbox-title {
    color: var(--site-text, #212529) !important;
}

/* "Browse success fields" category links (الأمن السيبراني, etc.) carry an
   inline grey colour in the blade; override it to follow the Text color in
   light mode. Dark mode keeps its own readable .dark .nav-link colour. */
html:not(.dark) .maincategory-section .nav-link,
html:not(.dark) .maincategory-section .nav-link h2 {
    color: var(--site-text, #212529) !important;
}

/* "Browse Annajah domains" section background (تصفح مجالات النجاح). The section
   carries .hp-bg-surface (white via --hp-surface) by default; route it to the
   Appearance "Categories section background" colour in light mode. This selector
   out-specifies .hp-bg-surface so it wins; the default equals the current white
   so it looks identical until an admin changes it. Dark mode keeps its own
   .dark .hp-bg-surface (navy) background. */
html:not(.dark) .maincategory-section {
    background-color: var(--site-category-bg, #ffffff);
}

/* "Annajah video" section background (فيديو النجاح). A dark band by default
   (Bootstrap .bg-dark); route it to the Appearance "Videos section background"
   colour in light mode. This selector out-specifies .bg-dark and uses !important
   because .bg-dark is !important too. Default equals .bg-dark so it looks
   identical until an admin changes it. Dark mode keeps the default dark band. */
html:not(.dark) .videos-section {
    background-color: var(--site-video-bg, #343a40) !important;
}

/* Text inside the video section (heading, video titles, date) follows the global
   Text color, which the admin controls. NOTE: the band is dark by default, so the
   (dark) default Text color won't be legible here until the admin pairs it with a
   suitable Videos section background. */
html:not(.dark) .videos-section,
html:not(.dark) .videos-section .text-white {
    color: var(--site-text, #212529) !important;
}

/* Public page-title header band (Galleries, Videos, Latest articles, Tag
   articles, About, Terms). These use `.container-fluid.bg-extra-light` — the
   two-class combo targets ONLY the full-width page header, NOT the many inline
   `.bg-extra-light` content boxes (article TOC / summary / sources / share,
   writer info boxes), which must stay light. Route the header band to the
   Primary colour. The two-class selector out-specifies the base `.bg-extra-light`
   (#F6F6F6) so no !important is needed. Light mode only: dark mode keeps its
   `.dark .bg-extra-light` navy. */
html:not(.dark) .container-fluid.bg-extra-light {
    background-color: var(--site-primary, #ffaa4c);
}

/* The header title text follows the site Text color. The galleries/videos
   headers already get this via the `section .text-info` rule above; this also
   covers the `<header>` variants (latest, tag, About, Terms) so all six page
   titles stay consistent and legible on the Primary-coloured band. */
html:not(.dark) .container-fluid.bg-extra-light .text-info {
    color: var(--site-text, #212529) !important;
}

.navbar.bg-white {
    background-color: var(--site-header-bg, #ffffff) !important;
}

.card {
    background-color: var(--site-card-bg, #ffffff);
}

/* Article cards EVERYWHERE they appear (homepage grid, category sections, saved,
   the writer/category section templates, list & featured/hero layouts). These are
   layout columns / rows, NOT Bootstrap .card elements, so the "Cards background"
   setting never reached them. Two hooks feed the same rule:
     - subarticles-custom-heading-size : the EXISTING grid card class (kept as-is;
       it also controls heading size, so it is NOT added to new places).
     - article-card-surface : a background-ONLY marker class added to every other
       article item container.
   Both route to the --site-card-bg token WITHOUT adding card chrome (border /
   padding / shadow) — only the colour changes, the shape stays identical.
   background-clip keeps the column gutter transparent so cards stay separated.
   Light mode only: the token default is white, so an unscoped rule would paint
   white over the dark background and break dark mode (which keeps its transparent
   items). */
html:not(.dark) .subarticles-custom-heading-size,
html:not(.dark) .article-card-surface {
    background-color: var(--site-card-bg, #ffffff);
    background-clip: content-box;
    /* Round the card surface so it matches the rounded article image inside.
       The gutter gives horizontal padding only; add equal vertical padding so
       the content-box corners round evenly (radius = border-radius − padding). */
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-radius: 1.25rem;
}

/* Inset the card content horizontally so it never touches the rounded edges.
   Safe for every layout — vertical grid cards and horizontal featured/list rows. */
html:not(.dark) .subarticles-custom-heading-size > *,
html:not(.dark) .article-card-surface > * {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* Vertical cards only (skip .row / .d-flex used by the featured & list layouts):
   add a top gap above the first item and a bottom gap below the last. */
html:not(.dark) .subarticles-custom-heading-size:not(.row):not(.d-flex) > :first-child,
html:not(.dark) .article-card-surface:not(.row):not(.d-flex) > :first-child {
    padding-top: 0.75rem;
}

html:not(.dark) .subarticles-custom-heading-size:not(.row):not(.d-flex) > :last-child,
html:not(.dark) .article-card-surface:not(.row):not(.d-flex) > :last-child {
    padding-bottom: 0.75rem;
}

/* Round the cover image to match the card's visible corner (inner = outer);
   this also rounds the featured image, which ships without a .rounded class. */
html:not(.dark) .subarticles-custom-heading-size img.w-100,
html:not(.dark) .article-card-surface img.w-100,
html:not(.dark) .article-card-surface img.list-thumb {
    border-radius: 0.5rem;
}

a {
    color: var(--site-link, #ffaa4c);
}

a:hover {
    color: var(--site-link-hover, #ff8600);
}

.btn-primary {
    background-color: var(--site-primary, #ffaa4c);
    border-color: var(--site-primary, #ffaa4c);
    color: var(--site-text, #212529);
}

.btn-primary:hover {
    background-color: var(--site-link-hover, #ff8600);
    border-color: var(--site-link-hover, #ff8600);
    color: var(--site-text, #212529);
}

.btn-outline-primary {
    color: var(--site-primary, #ffaa4c);
    border-color: var(--site-primary, #ffaa4c);
}

.bg-primary {
    background-color: var(--site-primary, #ffaa4c) !important;
}

.text-primary {
    color: var(--site-primary, #ffaa4c) !important;
}

footer.bg-dark {
    background-color: var(--site-footer-bg, #313133) !important;
}

/* Footer text, links AND column headings (مواقعنا, etc.) use the dedicated Footer
   text color so it can be tuned independently of the main Text color (light mode
   only). The footer background is dark by default, so this defaults to a light value. */
html:not(.dark) footer .text-light,
html:not(.dark) footer .text-light a,
html:not(.dark) footer .text-primary {
    color: var(--site-footer-text, #f8f9fa) !important;
}

/* The BravoCore logo has a dark-navy wordmark designed for light backgrounds, so
   its dark half disappears on the dark footer. The footer is dark in BOTH light
   and dark mode, so render the footer logo as a solid white (monochrome) mark here:
   brightness(0) forces every pixel to black, invert(1) then flips it to white. */
.footer-site-logo {
    filter: brightness(0) invert(1);
}

/* ─── Helper classes (light + dark) ───────────────────────────── */

.hp-bg-surface {
    background-color: var(--hp-surface);
}

.dark .hp-bg-surface {
    background-color: var(--hp-navy) !important;
}

/* ─── hp-subnav* base rules (currently undefined) ─────────────── */

.hp-subnav {
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.hp-subnav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 24px;
}

.hp-subnav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: center;
}

.hp-subnav-list li {
    margin: 0;
}

.hp-subnav-list a {
    display: inline-block;
    padding: 6px 4px;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.hp-subnav-list a:hover {
    color: var(--hp-gold);
}

@media (max-width: 768px) {
    .hp-subnav-inner {
        padding: 8px 12px;
    }

    .hp-subnav-list {
        gap: 4px 14px;
    }

    .hp-subnav-list a {
        font-size: 0.8125rem;
    }
}

/* ─── DARK MODE ───────────────────────────────────────────────── */

.dark body {
    background: var(--hp-navy);
    color: var(--hp-cream);
}

.dark .hp-subnav {
    background: var(--hp-navy);
    border-bottom-color: rgba(255, 255, 255, 0.07);
}

.dark .hp-subnav-list a {
    color: rgba(255, 255, 255, 0.6);
}

.dark .hp-subnav-list a:hover {
    color: var(--hp-gold-light);
}

/* Bootstrap utility overrides (Bootstrap 5 ships these with !important
   so dark variants must too — scoped to .dark only) */

.dark .bg-primary {
    background-color: var(--hp-navy-light) !important;
}

/* The homepage banner used to carry .bg-primary; it now paints its CMS-managed
   background through an inline style, so the dark band has to be restated here.
   !important is required for the rule to out-rank that inline style. */
.dark .hero-section {
    background-color: var(--hp-navy-light) !important;
}

.dark .bg-light {
    background-color: var(--hp-navy-light) !important;
}

.dark .bg-dark {
    background-color: var(--hp-navy) !important;
}

/* Footer — was var(--hp-navy), identical to the body, so it blended in. Lift it onto
   the navy-light surface + add a gold top border so it reads as a distinct section,
   and brighten its links for legibility. */
.dark footer.bg-dark {
    background-color: var(--hp-navy-light) !important;
    border-top: 3px solid var(--hp-gold);
}

.dark footer.bg-dark .nav-link,
.dark footer.bg-dark .text-light {
    color: rgba(255, 255, 255, 0.82) !important;
}

/* Article share buttons (under the author): the icons carry inline
   background:white; color:gray, so they look like faded gray stamps on navy. Drop the
   white box, recolor the glyphs gold, and bump size for prominence.
   !important beats the inline style attribute. */
.dark .btn.text-gray .fab,
.dark .btn.text-gray-400 .fab {
    background-color: transparent !important;
    color: var(--hp-gold-light) !important;
    font-size: 1.15rem;
}

/* Mobile nav hamburger — Bootstrap's navbar-light renders dark strokes that vanish on
   the dark header. Swap in a light (cream) icon so it's visible in dark mode. */
.dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23FAF8F4' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Header logo — in light mode the header is white so the full-colour logo reads
   fine and stays untouched. In dark mode the header sits on --hp-navy, where the
   logo's dark wordmark vanishes, so render it white there too (same monochrome
   treatment as the footer logo). */
.dark .navbar-brand img {
    filter: brightness(0) invert(1);
}

.dark .bg-white {
    background-color: var(--hp-navy) !important;
}

.dark .text-dark {
    color: var(--hp-cream) !important;
}

.dark .text-light {
    color: rgba(255, 255, 255, 0.65) !important;
}

.dark .text-white {
    color: var(--hp-cream) !important;
}

.dark .text-muted {
    color: rgba(255, 255, 255, 0.45) !important;
}

.dark .text-primary {
    color: var(--hp-gold-light) !important;
}

.dark .text-secondary {
    color: rgba(255, 255, 255, 0.55) !important;
}

.dark a {
    color: var(--hp-gold-light);
}

.dark a:hover {
    color: var(--hp-gold);
}

.dark .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
}

.dark .nav-link:hover {
    color: var(--hp-cream) !important;
}

.dark hr {
    border-top-color: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.07);
}

.dark .border,
.dark .border-top,
.dark .border-bottom,
.dark .border-start,
.dark .border-end {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark .form-control {
    background-color: var(--hp-navy-light);
    color: var(--hp-cream);
    border-color: rgba(255, 255, 255, 0.18);
}

/* In dark mode the input border must be visible at all times,
   even when the markup uses Bootstrap's .border-0 utility. */
.dark .form-control,
.dark .form-control.border-0 {
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

.dark .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.dark .form-control:focus {
    background-color: var(--hp-navy-light);
    color: var(--hp-cream);
    border-color: var(--hp-gold);
    box-shadow: 0 0 0 0.2rem rgba(184, 150, 12, 0.25);
}

/* Read-only "plain text" inputs used in share boxes (article + writer pages)
   inherit their parent surface colour. */
.dark .form-control-plaintext {
    color: var(--hp-cream);
}

.dark .card {
    background-color: var(--hp-navy-light);
    border-color: rgba(255, 255, 255, 0.07);
}

.dark .card-body,
.dark .card-title,
.dark .card-text {
    color: var(--hp-cream);
}

.dark .btn-primary {
    background-color: var(--hp-gold);
    border-color: var(--hp-gold);
    color: var(--hp-navy);
}

.dark .btn-primary:hover {
    background-color: var(--hp-gold-light);
    border-color: var(--hp-gold-light);
    color: var(--hp-navy);
}

.dark .btn-outline-primary {
    color: var(--hp-gold-light);
    border-color: var(--hp-gold-light);
}

.dark .btn-outline-primary:hover {
    background-color: var(--hp-gold);
    border-color: var(--hp-gold);
    color: var(--hp-navy);
}

.dark .table {
    color: var(--hp-cream);
}

.dark .table-bordered,
.dark .table> :not(caption)>*>* {
    border-color: rgba(255, 255, 255, 0.07);
}

.dark .searchbox-title {
    color: var(--hp-gold-light) !important;
}

/* Custom utility used across writer / article share boxes and the
   article table-of-contents widget. Defined in styles.min.css as #F6F6F6. */
.dark .bg-extra-light {
    background-color: var(--hp-navy-light) !important;
    color: var(--hp-cream);
}

/* Article table-of-contents (فهرس) — make the panel clearly visible in
   dark mode at all times, not only when a child element is hovered. */
.dark #article-toc {
    background-color: var(--hp-navy-light) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 12px 16px;
}

.dark #article-toc .text-primary {
    color: var(--hp-gold-light) !important;
}

.dark #article-toc li a,
.dark #article-toc a.text-dark {
    color: rgba(255, 255, 255, 0.75) !important;
}

.dark #article-toc li a:hover {
    color: var(--hp-gold-light) !important;
}


/* ─── Article details hero (sections/article-hero.blade.php) ──
   The text utilities the hero reuses (.text-dark / .text-info /
   .text-light) are already themed further up, so only the hero's own
   chrome — the divider, the category link and the cover — needs
   re-colouring for dark mode. */
.dark .article-hero {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.dark .article-hero__category {
    color: var(--hp-gold-light) !important;
}

.dark .article-hero__image {
    border: 1px solid rgba(255, 255, 255, 0.08);
}


/* ─── Profile Page (pages/profile.blade.php) ──────────────────
   The .profile-page namespace uses light surfaces with dark text.
   In dark mode the data values (#1F2937) were invisible on navy,
   and the hover background (#F5F5F5) flipped to light-on-light
   which hid the .text-muted reading-time line.               */

/* Lift the main card so it stops blending into the body. */
.dark .profile-page .profile-card {
    background: var(--hp-navy-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.dark .profile-page .info-section,
.dark .profile-page .reading-history-card,
.dark .profile-page .newsletter-card {
    background: var(--hp-navy-light);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Make the data values readable without needing a hover. */
.dark .profile-page .data-value,
.dark .profile-page .name-value {
    color: var(--hp-cream);
}

.dark .profile-page .data-label {
    color: rgba(255, 255, 255, 0.6);
}

.dark .profile-page .section-title {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Replace light-gray hover backgrounds with a subtle dark tint so
   light text stays readable on hover (was bg-#F5F5F5 cancelling
   .text-muted = white in dark mode). */
.dark .profile-page .data-item:hover,
.dark .profile-page .location-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dark .profile-page .location-item {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Reading-history list item hover — same fix; keep the meta line
   (read-percentage + reading-time) visible after hover. */
.dark .profile-page .reading-history-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.dark .profile-page .reading-history-item h6 a {
    color: var(--hp-cream) !important;
}

.dark .profile-page .reading-history-item:hover h6 a {
    color: var(--hp-gold-light) !important;
}

/* Stat cards on the reading-history block — Bootstrap .card with
   inline white shadows. Lift onto navy-light. */
.dark .profile-page .reading-stat-card {
    background: var(--hp-navy-light) !important;
}

/* Section dividers + borders inside the profile. */
.dark .profile-page hr {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.dark .profile-page .border-start,
.dark .profile-page .border-end,
.dark .profile-page .border-top,
.dark .profile-page .border-bottom {
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Gender badge — light pastel pills don't read well on navy. */
.dark .profile-page .gender-male {
    background: rgba(37, 99, 235, 0.18);
    color: #93C5FD;
}

.dark .profile-page .gender-female {
    background: rgba(220, 38, 38, 0.18);
    color: #FCA5A5;
}

.dark .profile-page .experience-number {
    background: rgba(184, 150, 12, 0.18);
}

/* Profile edit page (pages/profile/edit.blade.php) — same treatment
   as the view page. The .form-section blocks were #F5F5F5 in light
   mode which kept light text invisible in dark mode. */
.dark .profile-page .profile-edit-card {
    background: var(--hp-navy-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.dark .profile-page .form-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dark .profile-page .form-label {
    color: var(--hp-cream);
}

/* Bootstrap .form-select needs its own dark variant — the global
   .form-control rule doesn't reach it (separate Bootstrap class with
   its own bg + arrow svg). The gender / country / city dropdowns
   were rendering as white pills on the dark form. */
.dark .form-select {
    background-color: var(--hp-navy-light);
    color: var(--hp-cream);
    border-color: rgba(255, 255, 255, 0.18);
}

.dark .form-select option {
    background-color: var(--hp-navy-light);
    color: var(--hp-cream);
}

.dark .form-select:focus {
    border-color: var(--hp-gold);
    box-shadow: 0 0 0 0.2rem rgba(184, 150, 12, 0.25);
}

/* Validation feedback + alerts that appear above the form. */
.dark .alert-success {
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.3);
    color: rgba(187, 247, 208, 0.9);
}

.dark .alert-danger {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.3);
    color: #FCA5A5;
}

.dark .alert-light {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--hp-cream);
}

/* QR / Barcode generator (tools/qrcode.blade.php) — qr.png and
   barcode.png are pure black icons that vanish on a navy bg.
   Invert them in dark mode so they render as light icons. */
.dark .generator-radio img {
    filter: invert(1) brightness(0.95);
}

/* Current-date tool (tools/datetoday.blade.php) — table rows use
   inline pastel backgrounds (#cdf4dd / #f0f0f0 / #e6e6e6) that read
   as bright stripes in dark mode. Override with !important since
   they're inline styles. The first row (today) keeps a green tint
   to preserve the "highlight" semantic. */
.dark .tools-datetoday tr {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--hp-cream);
}

.dark .tools-datetoday tr:first-child {
    background: rgba(22, 163, 74, 0.15) !important;
}

.dark .tools-datetoday td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dark .tools-datetoday .calculate-age {
    background-color: var(--hp-navy-light) !important;
    border-color: rgba(252, 165, 165, 0.5) !important;
    color: #FCA5A5 !important;
}

.dark .tools-datetoday .calculate-age:hover {
    background-color: rgba(252, 165, 165, 0.12) !important;
}

/* Mobile hamburger toggle in the header partial — defined inline as
   color: var(--hp-navy) which is invisible on the dark nav. The header
   partial only declares .dark variants for the menu drawer, not for
   the toggle SVG itself. */
.dark .hp-mobile-toggle {
    color: var(--hp-cream);
}

.dark .hp-mobile-toggle:hover {
    color: var(--hp-gold-light);
}


/* Articles latest-list page (resources/views/articles/latest.blade.php) —
   the title is an <a class="text-dark"> wrapping an <h2>. Without an
   explicit hover override, the global .dark a:hover rule shifts it to
   var(--hp-gold) (a darker gold) which reads as "going dark" on hover.
   Pin the link + the inner h2 to cream in all states. */
.dark a.text-dark,
.dark a.text-dark:hover,
.dark a.text-dark:focus,
.dark a.text-dark h2,
.dark a.text-dark:hover h2,
.dark a.text-dark:focus h2 {
    color: var(--hp-cream) !important;
}

/* Bootstrap pagination — used site-wide via vendor.pagination.bootstrap-5
   (saved articles, latest articles, search results, reading history,
   AND every section template: grid, list, category-feed, video, saved…).
   Light mode: Bootstrap bakes its own $primary (#ffaa4c) into the compiled
   styles.min.css, so pagination ignored the CMS theme colour. Re-point it to
   --site-primary (injected in <head> from Site Settings) so it stays dynamic.
   Scoped to html:not(.dark) and given .pagination specificity to win over
   the compiled Bootstrap rules; #ffaa4c is only the no-theme fallback. */

html:not(.dark) .pagination .page-link {
    color: var(--site-primary, #ffaa4c);
}

html:not(.dark) .pagination .page-link:hover {
    color: var(--site-primary, #ff8600);
}

html:not(.dark) .pagination .page-item.active .page-link {
    color: #fff;
    background-color: var(--site-primary, #ffaa4c);
    border-color: var(--site-primary, #ffaa4c);
}

/* Bootstrap pagination — dark mode. Default light styling is white bg + blue
   text + gray border, all of which clash with navy. Flip surfaces to
   navy-light + gold accents. */

.dark .pagination .page-link {
    background-color: var(--hp-navy-light);
    color: var(--hp-cream);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark .pagination .page-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--hp-gold-light);
    border-color: rgba(255, 255, 255, 0.18);
}

.dark .pagination .page-link:focus {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--hp-gold-light);
    box-shadow: 0 0 0 0.2rem rgba(184, 150, 12, 0.25);
}

.dark .pagination .page-item.active .page-link {
    background-color: var(--hp-gold);
    border-color: var(--hp-gold);
    color: var(--hp-navy);
}

.dark .pagination .page-item.disabled .page-link {
    background-color: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Pagination pill ends in RTL. Bootstrap 4 rounds them with PHYSICAL radii:
   :first-child takes the left corners, :last-child the right. Under dir="rtl"
   the row lays out right-to-left, so the DOM-first item sits on the RIGHT and
   those radii land on the INNER edges — the bar came out square on the outside
   with a half-disc bulge where each arrow met its neighbour. Swap the corners.
   Deliberately radius-only: the -1px border-collapse margins are left alone so
   this cannot disturb .comments-pagination, which shares these Bootstrap rules
   and has the same defect. Unscoped by theme — geometry, not colour. */
[dir="rtl"] .pagination .page-item:first-child .page-link {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 1.5rem;
    border-bottom-right-radius: 1.5rem;
}

[dir="rtl"] .pagination .page-item:last-child .page-link {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 1.5rem;
    border-bottom-left-radius: 1.5rem;
}


/* Newsletter promo strip (sections/newsletter-management.blade.php) —
   in light mode it's a peach #ffd384 panel with a gold gradient button.
   In dark mode swap them: gold panel + peach button. Text inside stays
   dark navy for contrast against both the gold section bg and the
   peach button bg. */

.dark .newsletter-promo {
    background-color: var(--hp-gold) !important;
}

.dark .newsletter-promo .text-dark {
    color: var(--hp-navy) !important;
}

.dark .newsletter-promo .btn-primary {
    background: #ffd384 !important;
    border-color: #ffd384 !important;
    color: var(--hp-navy) !important;
}

.dark .newsletter-promo .btn-primary:hover {
    background: #fbb964 !important;
    border-color: #fbb964 !important;
    color: var(--hp-navy) !important;
}

/* Article comments (sections/comments-list.blade.php +
   sections/comments-comment.blade.php). The list wrapper has inline
   background-color: #f8f9fa and each comment box has inline
   border: 1px solid #e9ecef — both invisible in light mode but
   stick out as a white frame around the dark cards in dark mode. */

.dark .comments-container {
    background-color: transparent !important;
}

.dark .comment-box {
    border-color: rgba(255, 255, 255, 0.08) !important;
}


/* Search page (search/index.blade.php). The Google Programmable Search
   element ships white surfaces, and the fallback form/link below it is
   plain Bootstrap — both need lifting onto the dark card colour. */

.dark .search-title {
    color: var(--hp-cream) !important;
}

.dark .search-page .gsc-control-cse,
.dark .search-page .gsc-webResult.gsc-result,
.dark .search-page .gsc-results,
.dark .search-page .gsc-above-wrapper-area {
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

.dark .search-page .gs-snippet,
.dark .search-page .gsc-result-info,
.dark .search-page .gs-visibleUrl {
    color: var(--hp-cream) !important;
}

.dark .search-page .gs-title,
.dark .search-page .gs-title * {
    color: var(--hp-gold-light) !important;
}

.dark .search-fallback .form-control {
    background-color: var(--hp-navy-light) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: var(--hp-cream) !important;
}

.dark .search-fallback .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.dark .search-fallback-link {
    background-color: var(--hp-gold) !important;
    color: var(--hp-navy) !important;
}

.dark .search-fallback-link:hover,
.dark .search-fallback-link:focus {
    background-color: var(--hp-gold-light) !important;
    color: var(--hp-navy) !important;
}

/* ── Featured + Top posts section (sections/templates/featured-top) ──────
 * Card surfaces lift onto --hp-navy-light with a hairline border so they
 * separate from the body instead of blending into it. The hero card keeps
 * its own gradient scrim, so only its chrome is themed here.
 */
.dark .featured-top-hero,
.dark .featured-top-list {
    background-color: var(--hp-navy-light);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
}

.dark .featured-top-list {
    padding: 1rem 1.25rem;
}

.dark .featured-top-heading,
.dark .featured-top-list-heading {
    color: var(--hp-cream);
}

.dark .featured-top-subheading {
    color: rgba(250, 248, 244, 0.65);
}

.dark .featured-top-row + .featured-top-row {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.dark .featured-top-row-title {
    color: var(--hp-cream);
}

.dark .featured-top-row-title:hover {
    color: var(--hp-gold-light);
}

.dark .featured-top-meta,
.dark .featured-top-author,
.dark .featured-top-reading {
    color: rgba(250, 248, 244, 0.65);
}

.dark .featured-top-author:hover {
    color: var(--hp-gold-light);
}

.dark .featured-top-avatar {
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.dark .featured-top-pill {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--hp-cream);
}

.dark .featured-top-pill:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--hp-gold-light);
}

.dark .featured-top-eyebrow,
.dark .featured-top-rank {
    background-color: var(--hp-gold);
    color: var(--hp-navy);
}

/* ── Article share buttons ─────────────────────────────────────────────
 * sections/social-share.blade.php. The brand colours (WhatsApp green,
 * Facebook blue, Telegram blue) are platform identity, so they carry over
 * into dark mode untouched — only the edge and the hover adapt, so the
 * circles keep a defined rim against the dark navy surface instead of
 * floating on it.
 */
.dark .article-share-link {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.dark .article-share-link:hover,
.dark .article-share-link:focus {
    filter: brightness(1.15);
}

/* Same bar, the half of the RTL defect #11 deliberately left alone: Bootstrap
   collapses the 1px borders of neighbouring links with a PHYSICAL
   margin-left:-1px. Under dir="rtl" the row runs right-to-left, so that margin
   lands on each item's OUTER edge instead of the seam — السابق/التالي meet with
   two stacked borders (a 2px line) and the whole bar sits 1px off centre.
   margin-inline-start follows the direction, so the collapse lands on the seam
   in both LTR and RTL. Geometry only, so it stays unscoped by theme. */
[dir="rtl"] .pagination .page-link {
    margin-left: 0;
    margin-inline-start: -1px;
}

[dir="rtl"] .pagination .page-item:first-child .page-link {
    margin-inline-start: 0;
}

/* .comments-pagination draws separated pills with its own 2px gaps rather than
   one collapsed bar, and it inherits the Bootstrap rules above by specificity —
   restore its spacing so the seam collapse never reaches it. */
[dir="rtl"] .comments-pagination .page-link {
    margin: 0 2px;
}
