/*
 * Colour themes. Loaded last on every page.
 *
 * A theme is a block of colour values under html[data-theme="name"]. The
 * names are the theme colours defined at the top of shared.css; every page
 * uses only those, so changing them recolours the whole site. A theme only
 * needs the "main colours" list; everything else follows from it.
 *
 * hijri.js sets data-theme by date (see themeFor in hijri.js):
 *   azaseason  Muharram, Safar and Fatimiyyah: near-black with dark red.
 * Preview any theme with ?theme=NAME, e.g. /?theme=azaseason, or the theme
 * for a Hijri date with ?hijri-preview=MONTH-DAY, e.g. /?hijri-preview=1-10.
 *
 * To add a theme: copy the azaseason colour block, rename it, change the
 * values, and return its name from themeFor in hijri.js for the dates it
 * should run. Extra rules (like the azaseason background below) are optional.
 */

/* ---------- Every theme ----------
   The fine accent shades used in a few places follow the theme's main
   accent colours, so a theme doesn't have to list them. */
html[data-theme]{
  --color-accent-bright:var(--color-accent);
  --color-accent-warm:var(--color-accent-strong);
  --color-accent-dark:var(--color-accent-deep);
  --color-accent-muted:var(--color-accent-deep);
}

/* ---------- azaseason: black and dark red ---------- */
html[data-theme="azaseason"]{
  /* Main colours */
  --color-bg:#040303;
  --color-bg-deep:#020202;
  --color-bg-darkest:#040303;
  --color-surface-1:#0a0506;
  --color-surface-2:#120708;
  --color-surface-3:#18090b;
  --color-surface-4:#230b0f;
  --color-surface-5:#2d0a0e;
  --color-text:#e9e6e5;
  --color-text-muted:#bdb5b3;
  /* accent, -soft and -strong are used for text on the near-black
     background, so they are bright enough to read (at least 4.5:1). */
  --color-accent-soft:#f06a6e;
  --color-accent:#ec5f63;
  --color-accent-strong:#e5484d;
  --color-accent-deep:#7d0b11;
  --color-accent-glow:#7d0b11;
  --color-on-accent:#fff;

  /* Optional extras */
  --color-line:color-mix(in srgb,var(--color-accent-strong) 24%,transparent);
  --color-line-strong:color-mix(in srgb,var(--color-accent-strong) 45%,transparent);
  --color-decor-light:#e5484d;  /* every multicoloured icon, pill and pin; bright enough for text */
  --color-decor:#9b1118;
  --color-decor-dark:#7d0b11;
  --color-article-accent:#9b1118; /* one accent for every article category */
  --photo-filter:grayscale(1) sepia(.6) hue-rotate(-32deg) saturate(2.4) brightness(.42);
}

/* Filled buttons normally use accent-strong, which is too bright here for
   white text, so they use the deep red instead. */
html[data-theme="azaseason"] .category-filter.active,
html[data-theme="azaseason"] .engage-link,
html[data-theme="azaseason"] .ig-arrow:hover:not(:disabled),
html[data-theme="azaseason"] .quiz-next,
html[data-theme="azaseason"] .quiz-retry{
  background:var(--color-accent-deep);border-color:var(--color-accent-deep);
}
html[data-theme="azaseason"] ::selection{background:var(--color-accent-deep)}
html[data-theme="azaseason"] .btn-primary:hover{background:#a3121a}

/* A plain dark background instead of each page's tinted glows. */
html[data-theme="azaseason"] .aura{
  background:
    radial-gradient(1100px 650px at 15% -5%,rgba(90,8,12,.30),transparent 62%),
    radial-gradient(900px 700px at 50% 110%,rgba(70,6,10,.24),transparent 62%),
    linear-gradient(180deg,#050303 0%,#040303 48%,#020202 100%);
}
html[data-theme="azaseason"] .page-hero::before{
  background:linear-gradient(180deg,rgba(4,3,3,.4),rgba(4,3,3,.82) 70%,#040303);
}
html[data-theme="azaseason"] .grain{opacity:.04}
/* The main logos are swapped for red-and-white versions by hijri.js; the
   Quran & Hadith mark is tinted. */
html[data-theme="azaseason"] .brand-qh-mark img{
  filter:grayscale(1) sepia(1) hue-rotate(-40deg) saturate(3.2) brightness(.72);
}
/* On the near-black background the ribbon keeps its black band but gets
   solid red edges and a faint red glow so it still reads as a ribbon. */
html[data-theme="azaseason"] .mourning-ribbon-band{
  border-top:2px solid #b3141c;border-bottom:2px solid #b3141c;
  box-shadow:0 0 18px rgba(179,20,28,.45),0 3px 14px rgba(0,0,0,.6);
}

/* ---------- Mourning ribbon ---------- */
/* Black ribbon across the top-left corner on every date with a sad occasion
   and every day of Muharram, Safar and Fatimiyyah (html[data-ribbon]). */
.mourning-ribbon{
  position:fixed;top:0;left:0;z-index:60;
  width:110px;height:110px;overflow:hidden;
  pointer-events:none;
}
.mourning-ribbon-band{
  position:absolute;top:28px;left:-46px;
  width:170px;padding:7px 0;
  transform:rotate(-45deg);
  background:#030303;
  border-top:1px solid rgba(255,255,255,.14);border-bottom:1px solid rgba(255,255,255,.14);
  box-shadow:0 3px 14px rgba(0,0,0,.6);
  /* The band carries no visible text; "In remembrance: …" shows on hover
     or focus in .mourning-ribbon-label. The text stays for screen readers. */
  font-size:0;color:transparent;
  pointer-events:auto;cursor:default;outline-offset:-3px;
}
.mourning-ribbon-band::after{content:"";display:block;height:9px}
.mourning-ribbon-label{
  position:fixed;top:84px;left:14px;
  max-width:min(360px,calc(100vw - 28px));
  padding:9px 12px;border-radius:6px;
  background:#050505;color:#f1ecea;border:1px solid rgba(255,255,255,.14);
  font:500 13px/1.45 var(--sans);
  box-shadow:0 14px 34px rgba(0,0,0,.45);
  opacity:0;transform:translateY(-4px);pointer-events:none;
  transition:opacity .2s ease,transform .2s ease;
}
.mourning-ribbon:hover .mourning-ribbon-label,
.mourning-ribbon:focus-within .mourning-ribbon-label{opacity:1;transform:none}
/* Keep the logo clear of the ribbon. */
html[data-ribbon] .nav{padding-left:64px}
@media(max-width:900px){
  .mourning-ribbon{width:70px;height:70px}
  .mourning-ribbon-band{top:12px;left:-36px;width:130px;padding:6px 0}
  .mourning-ribbon-band::after{height:5px}
  .mourning-ribbon-label{top:64px}
  html[data-ribbon] .nav{padding-left:46px}
}
@media print{.mourning-ribbon{display:none}}
