/* ============================================================
   halloween.css  — Sahityika Halloween Theme: "The Witching Hour"

   A candlelit gothic reading room after midnight. Soot-black
   sky, a harvest moon, a graveyard on the horizon, lantern
   ember and witch-purple for accents, and a little ectoplasm
   green reserved for the things that should not be there.

   Scenery (moon, graveyard, webs, vignette) is static markup in
   themes/halloween/decorations.html. The restless things (bats,
   the spider, wisps, the ghost, guttering lights) are spawned by
   its script and all switch off under prefers-reduced-motion.

   Uses the same generic class names as the other themes so
   base.html never needs to know which one is active.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=IM+Fell+English+SC&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  /* ── Palette ─────────────────────────────────────────────── */
  --hw-void:        #07050b;   /* the sky past midnight            */
  --hw-night:       #0d0913;   /* page ground                      */
  --hw-crypt:       #140e1b;   /* panels and cards                 */
  --hw-crypt-2:     #1c1426;   /* raised surfaces                  */
  --hw-bone:        #ece2cf;   /* body ink                         */
  --hw-ash:         #a99eb4;   /* muted ink                        */
  --hw-ember:       #ff7518;   /* pumpkin / lantern                */
  --hw-ember-lift:  #ff8f3a;   /* ember that reads as text on soot */
  --hw-candle:      #ffb65c;   /* candle flame, links              */
  --hw-blood:       #9e0f28;
  --hw-blood-lift:  #e5566b;
  --hw-witch:       #7b45c9;
  --hw-witch-lift:  #b996f2;
  --hw-ecto:        #9df08a;   /* will-o'-the-wisp                 */
  --hw-ink:         #1a0802;   /* dark ink on ember fills          */

  --hw-void-rgb:        7, 5, 11;
  --hw-night-rgb:       13, 9, 19;
  --hw-crypt-rgb:       20, 14, 27;
  --hw-crypt-2-rgb:     28, 20, 38;
  --hw-bone-rgb:        236, 226, 207;
  --hw-ash-rgb:         169, 158, 180;
  --hw-ember-rgb:       255, 117, 24;
  --hw-ember-lift-rgb:  255, 143, 58;
  --hw-candle-rgb:      255, 182, 92;
  --hw-blood-rgb:       158, 15, 40;
  --hw-blood-lift-rgb:  229, 86, 107;
  --hw-witch-rgb:       123, 69, 201;
  --hw-witch-lift-rgb:  185, 150, 242;
  --hw-ecto-rgb:        157, 240, 138;

  --hw-heading: #f5c07a;       /* candlelit parchment              */

  /* ── Bootstrap mapping ───────────────────────────────────── */
  --bs-primary:        var(--hw-ember);
  --bs-primary-rgb:    var(--hw-ember-rgb);
  --bs-secondary:      var(--hw-witch);
  --bs-secondary-rgb:  var(--hw-witch-rgb);
  --bs-dark:           var(--hw-void);
  --bs-dark-rgb:       var(--hw-void-rgb);
  --bs-light:          var(--hw-crypt);
  --bs-light-rgb:      var(--hw-crypt-rgb);
  --bs-white:          var(--hw-bone);
  --bs-white-rgb:      var(--hw-bone-rgb);

  --bs-body-bg:          var(--hw-night);
  --bs-body-color:       var(--hw-bone);
  --bs-link-color:       var(--hw-candle);
  --bs-link-hover-color: #ffd49a;

  --bs-navbar-bg:     rgba(7, 5, 11, 0.9);
  --bs-card-bg:       var(--hw-crypt);
  --bs-modal-bg:      var(--hw-crypt);
  --bs-dropdown-bg:   var(--hw-crypt);
  --bs-dropdown-link-hover-bg:    rgba(255, 117, 24, 0.14);
  --bs-dropdown-link-hover-color: #fff4e2;

  --bs-border-color: rgba(255, 117, 24, 0.28);
  --bs-text-muted:   var(--hw-ash);

  /* Bootstrap 5.3 semantic colours. Left unset these keep Bootstrap's
     light-mode defaults (near-black), so .text-body-secondary and friends
     turn invisible on a dark page. There is deliberately no
     --bs-heading-color: it would force a colour onto headings that are
     meant to inherit white inside dark sections. */
  --bs-body-color-rgb:  236, 226, 207;
  --bs-body-bg-rgb:     13, 9, 19;
  --bs-secondary-color: var(--hw-ash);
  --bs-secondary-bg:    var(--hw-crypt-2);
  --bs-tertiary-color:  rgba(236, 226, 207, 0.55);
  --bs-tertiary-bg:     var(--hw-crypt);
  --bs-emphasis-color:  #fbf5ea;
  --bs-border-color-translucent: rgba(255, 117, 24, 0.18);
  --bs-link-color-rgb:  255, 182, 92;
  --bs-link-hover-color-rgb: 255, 212, 154;
  /* The -subtle / -emphasis utilities default to pale light-mode blues */
  --bs-primary-bg-subtle:       rgba(255, 117, 24, 0.12);
  --bs-primary-border-subtle:   rgba(255, 117, 24, 0.38);
  --bs-primary-text-emphasis:   #ffb67a;
  --bs-secondary-bg-subtle:     rgba(123, 69, 201, 0.16);
  --bs-secondary-border-subtle: rgba(185, 150, 242, 0.4);
  --bs-secondary-text-emphasis: #d4bdf7;

  --bs-body-font-family:    'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --bs-heading-font-family: 'IM Fell English', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --hw-smallcaps-font:      'IM Fell English SC', 'IM Fell English', Georgia, serif;

  --hw-radius:    14px;
  --hw-radius-sm: 9px;
  --hw-ease:      cubic-bezier(0.4, 0, 0.2, 1);
}


/* ── Animations ───────────────────────────────────────────────────────────── */

/* Candle flame: irregular, never a metronome. */
@keyframes hwCandle {
  0%, 100% { opacity: 1;    transform: scale(1)    rotate(0deg); }
  17%      { opacity: 0.86; transform: scale(0.96) rotate(-2deg); }
  23%      { opacity: 1;    transform: scale(1.03) rotate(1deg); }
  48%      { opacity: 0.9;  transform: scale(0.98) rotate(-1deg); }
  52%      { opacity: 1;    transform: scale(1.02) rotate(2deg); }
  81%      { opacity: 0.8;  transform: scale(0.97) rotate(-1deg); }
}

/* Candle-lit text: the glow breathes, the letters never vanish. */
@keyframes hwTextGlow {
  0%, 100% { text-shadow: 0 0 18px rgba(255, 117, 24, 0.55), 0 0 42px rgba(255, 117, 24, 0.22), 0 2px 3px rgba(0, 0, 0, 0.9); }
  31%      { text-shadow: 0 0 12px rgba(255, 117, 24, 0.40), 0 0 30px rgba(255, 117, 24, 0.14), 0 2px 3px rgba(0, 0, 0, 0.9); }
  34%      { text-shadow: 0 0 22px rgba(255, 140, 50, 0.65), 0 0 52px rgba(255, 117, 24, 0.28), 0 2px 3px rgba(0, 0, 0, 0.9); }
  70%      { text-shadow: 0 0 15px rgba(255, 117, 24, 0.48), 0 0 36px rgba(255, 117, 24, 0.18), 0 2px 3px rgba(0, 0, 0, 0.9); }
}

/* Bats: the wrapper crosses once; a nested layer swoops; wings flap. */
@keyframes hwBatCross {
  0%   { transform: translate3d(-12vw, 0, 0); opacity: 0; }
  6%   { opacity: var(--bat-opacity, 0.9); }
  92%  { opacity: var(--bat-opacity, 0.9); }
  100% { transform: translate3d(112vw, 0, 0); opacity: 0; }
}

@keyframes hwBatCrossReverse {
  0%   { transform: translate3d(112vw, 0, 0); opacity: 0; }
  6%   { opacity: var(--bat-opacity, 0.9); }
  92%  { opacity: var(--bat-opacity, 0.9); }
  100% { transform: translate3d(-12vw, 0, 0); opacity: 0; }
}

@keyframes hwBatSwoop {
  0%   { transform: translate3d(0, 0, 0) rotate(-4deg); }
  25%  { transform: translate3d(0, calc(var(--bat-swoop, 8vh) * 1), 0) rotate(6deg); }
  50%  { transform: translate3d(0, calc(var(--bat-swoop, 8vh) * -0.4), 0) rotate(-8deg); }
  75%  { transform: translate3d(0, calc(var(--bat-swoop, 8vh) * 0.7), 0) rotate(5deg); }
  100% { transform: translate3d(0, 0, 0) rotate(-3deg); }
}

@keyframes hwFlapLeft {
  from { transform: rotate(16deg) scaleY(1); }
  to   { transform: rotate(-30deg) scaleY(0.62); }
}

@keyframes hwFlapRight {
  from { transform: rotate(-16deg) scaleY(1); }
  to   { transform: rotate(30deg) scaleY(0.62); }
}

/* Spider: drops on its silk, hangs, sways, climbs back into the dark. */
@keyframes hwSpiderDrop {
  0%   { transform: translate3d(0, -60px, 0); }
  22%  { transform: translate3d(0, var(--spider-drop, 30vh), 0); animation-timing-function: ease-in-out; }
  25%  { transform: translate3d(0, calc(var(--spider-drop, 30vh) - 14px), 0); }
  28%  { transform: translate3d(0, calc(var(--spider-drop, 30vh) + 4px), 0); }
  31%  { transform: translate3d(0, var(--spider-drop, 30vh), 0); }
  72%  { transform: translate3d(0, var(--spider-drop, 30vh), 0); animation-timing-function: ease-in; }
  100% { transform: translate3d(0, -60px, 0); }
}

@keyframes hwSpiderSway {
  0%, 100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg); }
}

@keyframes hwSpiderLegs {
  0%, 100% { transform: scaleX(1); }
  50%      { transform: scaleX(0.9); }
}

/* Will-o'-the-wisps rising from the graveyard. */
@keyframes hwWispRise {
  0%   { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
  15%  { opacity: var(--wisp-opacity, 0.7); }
  50%  { transform: translate3d(var(--wisp-sway, 3vw), calc(var(--wisp-rise, 60vh) * -0.5), 0) scale(1); }
  85%  { opacity: var(--wisp-opacity, 0.7); }
  100% { transform: translate3d(calc(var(--wisp-sway, 3vw) * -0.6), calc(var(--wisp-rise, 60vh) * -1), 0) scale(0.5); opacity: 0; }
}

@keyframes hwWispPulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.45); }
}

/* The ghost: appears from nowhere, drifts, and is gone. */
@keyframes hwGhostDrift {
  0%   { transform: translate3d(0, 0, 0) scale(0.92); opacity: 0; }
  18%  { opacity: var(--ghost-opacity, 0.16); }
  50%  { transform: translate3d(calc(var(--ghost-travel, 40vw) * 0.5), -3vh, 0) scale(1); }
  78%  { opacity: var(--ghost-opacity, 0.16); }
  100% { transform: translate3d(var(--ghost-travel, 40vw), 1vh, 0) scale(0.96); opacity: 0; }
}

@keyframes hwGhostBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-14px) rotate(2deg); }
}

@keyframes hwGhostHem {
  0%, 100% { transform: skewX(0deg); }
  50%      { transform: skewX(-6deg); }
}

/* Ground fog, two layers moving against each other. */
@keyframes hwFogLeft {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

@keyframes hwFogRight {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* Clouds sliding across the moon. */
@keyframes hwCloudPass {
  from { transform: translate3d(-140%, 0, 0); }
  to   { transform: translate3d(160%, 0, 0); }
}

@keyframes hwMoonBreath {
  0%, 100% { box-shadow: 0 0 60px 8px rgba(255, 182, 92, 0.26), 0 0 170px 40px rgba(255, 117, 24, 0.12); }
  50%      { box-shadow: 0 0 70px 12px rgba(255, 182, 92, 0.32), 0 0 200px 50px rgba(255, 117, 24, 0.16); }
}

/* The lanterns gutter: at most three dips across 1.6s, all of them a
   darkening rather than a flash, so it stays within WCAG 2.3.1. */
@keyframes hwGutter {
  0%   { opacity: 0; }
  10%  { opacity: 0.55; }
  18%  { opacity: 0.12; }
  30%  { opacity: 0.7; }
  44%  { opacity: 0.2; }
  62%  { opacity: 0.5; }
  100% { opacity: 0; }
}

/* A wax drip that swells and lets go. */
@keyframes hwDrip {
  0%, 55% { transform: translate3d(0, 0, 0) scaleY(0.35); opacity: 0; }
  60%     { opacity: 1; }
  82%     { transform: translate3d(0, 4px, 0) scaleY(1); opacity: 1; }
  100%    { transform: translate3d(0, 42px, 0) scaleY(0.8); opacity: 0; }
}

@keyframes hwWebShimmer {
  0%, 100% { opacity: var(--web-opacity, 0.22); }
  50%      { opacity: calc(var(--web-opacity, 0.22) + 0.1); }
}

@keyframes hwPumpkin {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(255, 117, 24, 0.55)) drop-shadow(0 0 16px rgba(255, 117, 24, 0.25)); transform: rotate(-3deg); }
  40%      { filter: drop-shadow(0 0 3px rgba(255, 117, 24, 0.35)) drop-shadow(0 0 10px rgba(255, 117, 24, 0.15)); }
  45%      { filter: drop-shadow(0 0 9px rgba(255, 150, 60, 0.75)) drop-shadow(0 0 22px rgba(255, 117, 24, 0.35)); transform: rotate(3deg); }
}

@keyframes hwNavEmber {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}

@keyframes hwCalendarHover {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 117, 24, 0.28); }
  50%      { box-shadow: 0 0 20px rgba(255, 117, 24, 0.45); }
}

@keyframes hwNotifFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── Global ───────────────────────────────────────────────────────────────── */

body, html {
  height: 100%;
  margin: 0;
  /* Deep violet at the zenith, a bruised purple glow on the horizon and a
     hint of lantern fire low on the left, where the graveyard sits. */
  background:
    radial-gradient(ellipse 60% 45% at 82% 8%,   rgba(255, 170, 80, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 120% 38% at 50% 104%, rgba(123, 69, 201, 0.26) 0%, transparent 70%),
    radial-gradient(ellipse 50% 30% at 12% 100%,  rgba(255, 117, 24, 0.10) 0%, transparent 70%),
    linear-gradient(180deg, #06040a 0%, #0c0813 45%, #140c1e 100%);
  background-color: var(--hw-void);
  background-attachment: fixed;
  color: var(--bs-body-color);
  font-family: var(--bs-body-font-family);
  position: relative;
  overflow-x: hidden;
}

::selection {
  background-color: rgba(var(--hw-ember-rgb), 0.85);
  color: var(--hw-ink);
  text-shadow: none;
}

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

/* Native controls (date pickers, option lists) follow the dark page. Scoped
   to controls so third-party iframes such as Google Sign-In are untouched. */
input, select, textarea { color-scheme: dark; }

.wrapper {
  margin-top: 3rem;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.content { flex: 1; position: relative; z-index: 2; }


/* ── Scenery: the moon ────────────────────────────────────────────────────── */

.hw-moon {
  position: fixed;
  top: calc(var(--site-navbar-offset, 3.75rem) + 5vh);
  right: 7vw;
  width: clamp(84px, 10vw, 160px);
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 34%, rgba(160, 96, 40, 0.30) 0 7%, transparent 8%),
    radial-gradient(circle at 62% 26%, rgba(160, 96, 40, 0.22) 0 5%, transparent 6%),
    radial-gradient(circle at 56% 62%, rgba(160, 96, 40, 0.26) 0 10%, transparent 11%),
    radial-gradient(circle at 24% 70%, rgba(160, 96, 40, 0.18) 0 4%, transparent 5%),
    radial-gradient(circle at 76% 48%, rgba(160, 96, 40, 0.16) 0 3.5%, transparent 4.5%),
    radial-gradient(circle at 36% 32%, #fff1cf 0%, #f7d596 38%, #e8a95a 72%, #b86a2a 100%);
  box-shadow: 0 0 60px 8px rgba(255, 182, 92, 0.26), 0 0 170px 40px rgba(255, 117, 24, 0.12);
  animation: hwMoonBreath 9s ease-in-out infinite;
  opacity: 0.92;
}

/* Terminator shadow, so it reads as a sphere and not a sticker */
.hw-moon::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 78% 70%, rgba(40, 14, 4, 0.55) 0%, transparent 55%);
}

.hw-moon__cloud {
  position: absolute;
  top: var(--cloud-top, 40%);
  left: 0;
  width: 150%;
  height: var(--cloud-h, 26%);
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(20, 12, 28, 0.72) 0%, rgba(20, 12, 28, 0.4) 45%, transparent 72%);
  filter: blur(2px);
  animation: hwCloudPass var(--cloud-speed, 38s) linear infinite;
  animation-delay: var(--cloud-delay, 0s);
}


/* ── Scenery: graveyard on the horizon ────────────────────────────────────── */

.hw-graveyard {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: clamp(110px, 20vh, 210px);
  pointer-events: none;
  z-index: 1;
  color: #050308;              /* SVG uses currentColor */
  opacity: 0.96;
}

.hw-graveyard svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Someone is still awake in the chapel */
.hw-window,
.hw-window-glow {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: hwCandle 3.8s ease-in-out infinite;
}

.hw-window-glow { animation-duration: 5.2s; }

/* Lantern-lit rim along the ridge */
.hw-graveyard::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 30%;
  height: 40%;
  background: radial-gradient(ellipse 50% 100% at 18% 100%, rgba(255, 117, 24, 0.08), transparent 70%);
}


/* ── Scenery: ground fog ──────────────────────────────────────────────────── */

.hw-fog {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 32vh;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to top, #000 0%, #000 45%, transparent 100%);
          mask-image: linear-gradient(to top, #000 0%, #000 45%, transparent 100%);
}

.hw-fog__layer {
  position: absolute;
  left: 0; bottom: -4vh;
  width: 200%;
  height: 100%;
  background:
    radial-gradient(ellipse 18% 55% at 8% 80%,  rgba(210, 200, 225, 0.075) 0%, transparent 70%),
    radial-gradient(ellipse 22% 45% at 27% 90%, rgba(210, 200, 225, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 16% 60% at 44% 85%, rgba(210, 200, 225, 0.07) 0%, transparent 70%),
    radial-gradient(ellipse 18% 55% at 58% 80%, rgba(210, 200, 225, 0.075) 0%, transparent 70%),
    radial-gradient(ellipse 22% 45% at 77% 90%, rgba(210, 200, 225, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 16% 60% at 94% 85%, rgba(210, 200, 225, 0.07) 0%, transparent 70%);
  animation: hwFogLeft 70s linear infinite;
}

.hw-fog__layer--back {
  bottom: 2vh;
  opacity: 0.7;
  animation: hwFogRight 110s linear infinite;
}


/* ── Scenery: cobwebs and vignette ────────────────────────────────────────── */

.halloween-web {
  position: fixed;
  top: var(--site-navbar-offset, 3.75rem);
  width: clamp(110px, 13vw, 190px);
  aspect-ratio: 1;
  pointer-events: none;
  color: #d9d0e6;
  --web-opacity: 0.2;
  opacity: var(--web-opacity);
  animation: hwWebShimmer 11s ease-in-out infinite;
}

.halloween-web svg { display: block; width: 100%; height: 100%; }

/* The navbar lives inside .wrapper's stacking context, so a web at root
   level would draw across an open menu. Step aside while one is open. */
body:has(.navbar .dropdown-menu.show, .navbar-collapse.show, .navbar-collapse.collapsing) .halloween-web {
  visibility: hidden;
}
.halloween-web--left  { left: 0; }
.halloween-web--right { right: 0; transform: scaleX(-1); animation-delay: -5s; }

.hw-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1015;
  background: radial-gradient(ellipse 85% 80% at 50% 45%, transparent 62%, rgba(3, 1, 6, 0.42) 100%);
}

.hw-gloom {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1016;
  opacity: 0;
  background: radial-gradient(ellipse 75% 70% at 50% 45%, rgba(3, 1, 6, 0.3) 0%, rgba(3, 1, 6, 0.9) 85%);
}

.hw-gloom.is-guttering { animation: hwGutter 1.6s ease-in-out; }


/* ── Restless things: bats ────────────────────────────────────────────────── */

.halloween-bat {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  will-change: transform, opacity;
  animation: hwBatCross linear 1 both;
}

.halloween-bat--reverse { animation-name: hwBatCrossReverse; }

.hw-bat__swoop {
  animation: hwBatSwoop var(--bat-swoop-duration, 5s) ease-in-out infinite;
  will-change: transform;
}

.hw-bat__svg {
  display: block;
  width: var(--bat-size, 46px);
  height: auto;
  color: #030205;
  filter: drop-shadow(0 0 1px rgba(255, 182, 92, 0.35)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.8));
  overflow: visible;
}

/* Distant bats: smaller, fainter, a touch of haze */
.halloween-bat--far .hw-bat__svg { filter: blur(0.6px) drop-shadow(0 0 1px rgba(255, 182, 92, 0.2)); }

.hw-bat__wing {
  transform-box: fill-box;
  animation-duration: var(--bat-flap, 0.26s);
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.hw-bat__wing--l { transform-origin: 100% 30%; animation-name: hwFlapLeft; }
.hw-bat__wing--r { transform-origin: 0% 30%;   animation-name: hwFlapRight; }
.hw-bat__eye     { fill: var(--hw-ember); }


/* ── Restless things: the spider ──────────────────────────────────────────── */

.halloween-spider {
  position: fixed;
  top: var(--site-navbar-offset, 3.75rem);
  left: 0;
  width: 30px;
  pointer-events: none;
  will-change: transform;
  animation: hwSpiderDrop var(--spider-duration, 16s) ease-out 1 both;
}

/* Silk: runs up past the top edge and disappears behind the navbar */
.halloween-spider::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 70%;
  width: 1px;
  height: 110vh;
  transform: translateX(-50%);
  background: linear-gradient(to top, rgba(236, 226, 207, 0.55), rgba(236, 226, 207, 0.12) 60%, transparent);
}

.hw-spider__body {
  display: block;
  width: 30px;
  height: auto;
  transform-origin: 50% 0;
  animation: hwSpiderSway 3.4s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(255, 117, 24, 0.35));
  overflow: visible;
}

.hw-spider__legs {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: hwSpiderLegs 0.9s ease-in-out infinite;
}

.hw-spider__eye { fill: #ff2a3d; }


/* ── Restless things: wisps ───────────────────────────────────────────────── */

.hw-wisp {
  position: fixed;
  bottom: 4vh;
  width: var(--wisp-size, 6px);
  height: var(--wisp-size, 6px);
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(circle, #f2ffe9 0%, rgba(var(--hw-ecto-rgb), 0.9) 35%, rgba(var(--hw-ecto-rgb), 0) 70%);
  box-shadow: 0 0 10px 3px rgba(var(--hw-ecto-rgb), 0.35), 0 0 26px 8px rgba(var(--hw-ecto-rgb), 0.12);
  will-change: transform, opacity;
  animation:
    hwWispRise var(--wisp-duration, 18s) ease-in-out infinite,
    hwWispPulse 2.8s ease-in-out infinite;
}

.hw-wisp--ember {
  background: radial-gradient(circle, #fff3dc 0%, rgba(var(--hw-candle-rgb), 0.9) 35%, rgba(var(--hw-candle-rgb), 0) 70%);
  box-shadow: 0 0 10px 3px rgba(var(--hw-ember-rgb), 0.35), 0 0 26px 8px rgba(var(--hw-ember-rgb), 0.12);
}


/* ── Restless things: the ghost ───────────────────────────────────────────── */

.hw-ghost {
  position: fixed;
  left: 0;
  pointer-events: none;
  z-index: 1019;
  will-change: transform, opacity;
  animation: hwGhostDrift var(--ghost-duration, 24s) ease-in-out 1 both;
}

.hw-ghost__bob { animation: hwGhostBob 4.5s ease-in-out infinite; }

.hw-ghost__svg {
  display: block;
  width: var(--ghost-size, 90px);
  height: auto;
  color: #efe9f7;
  filter: blur(0.8px) drop-shadow(0 0 18px rgba(230, 220, 255, 0.55));
  overflow: visible;
}

.hw-ghost__hem {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: hwGhostHem 2.2s ease-in-out infinite;
}

.hw-ghost--reverse .hw-ghost__svg { transform: scaleX(-1); }


/* ── Theme Banner ─────────────────────────────────────────────────────────── */

.theme-banner {
  position: relative;
  background:
    radial-gradient(ellipse 40% 140% at 50% 0%, rgba(255, 117, 24, 0.16), transparent 70%),
    linear-gradient(180deg, #120610 0%, #22060f 100%);
  color: #f3dcc0;
  font-family: var(--bs-heading-font-family);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  border-top: 1px solid rgba(255, 117, 24, 0.25);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.theme-banner p { margin: 0; }

.theme-banner span {
  color: var(--hw-ember-lift);
  font-family: var(--hw-smallcaps-font);
  letter-spacing: 0.06em;
  animation: hwTextGlow 6s ease-in-out infinite;
}

.theme-banner .hw-candle {
  display: inline-block;
  margin-right: 0.35em;
  transform-origin: 50% 90%;
  filter: drop-shadow(0 0 6px rgba(255, 182, 92, 0.7));
  animation: hwCandle 3.2s ease-in-out infinite;
}

/* Wax drips hanging from the banner's lower edge */
.theme-banner::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  height: 16px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='16' viewBox='0 0 240 16'%3E%3Cpath fill='%2322060f' d='M0 0h240v3c-6 0-8 1-10 3s-3 7-6 7-3-6-5-8-6-2-12-2-9 0-11 4-2 8-4 8-2-6-4-9-8-3-16-3-14 1-16 2-3 4-5 4-3-3-6-4-10-1-18-1-10 2-12 5-2 7-4 7-2-5-4-8-7-4-15-4-12 0-15 2-3 4-5 4-2-2-4-3-6-1-12-1-12 1-15 3-3 6-6 6-3-8-5-11S6 3 0 3Z'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 240px 16px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.45));
}

/* One drip that swells and lets go, now and then */
.theme-banner::before {
  content: '';
  position: absolute;
  top: calc(100% + 10px);
  left: 18%;
  width: 5px;
  height: 8px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: #3a0914;
  box-shadow: inset 1px 1px 1px rgba(255, 120, 120, 0.25);
  pointer-events: none;
  opacity: 0;
  animation: hwDrip 11s ease-in 4s infinite;
}


/* ── Easter egg (the jack-o'-lantern) ─────────────────────────────────────── */

.theme-easter-egg span {
  display: inline-block;
  font-size: 1.35rem;
  transition: transform 0.4s var(--hw-ease);
  animation: hwPumpkin 4.5s ease-in-out infinite;
}

.theme-easter-egg:hover span { transform: scale(1.35) rotate(-6deg); }


/* ── Audio toggle ─────────────────────────────────────────────────────────── */

.theme-audio-btn {
  position: fixed;
  right: 1.5rem; bottom: 1.5rem;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 117, 24, 0.65);
  background: rgba(10, 6, 14, 0.94);
  color: var(--hw-ember-lift);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), 0 0 0 0 rgba(255, 117, 24, 0);
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.theme-audio-btn[hidden] { display: none; }

.theme-audio-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6), 0 0 18px rgba(255, 117, 24, 0.35);
}

.theme-audio-btn--on {
  background: linear-gradient(180deg, #ff9a3c, #e8620f);
  color: var(--hw-ink);
  box-shadow: 0 0 22px rgba(255, 117, 24, 0.55);
}


/* ── Utilities & typography ───────────────────────────────────────────────── */

.text-primary { color: var(--hw-ember-lift) !important; }
.bg-dark      { background-color: var(--hw-void)  !important; }
.bg-light     { background-color: var(--hw-crypt) !important; }

.bg-theme {
  background-color: rgba(var(--hw-crypt-rgb), 0.9) !important;
  border: 1px solid rgba(255, 117, 24, 0.16);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45) !important;
}

/* Body colour is inherited. It is not assigned to every descendant, which
   would paint over deliberate ink colours inside components. */
.text-muted { color: var(--bs-text-muted) !important; }

h1, h2, h3, h4, h5, h6 {
  color: var(--hw-heading);
  font-family: var(--bs-heading-font-family);
  font-weight: 400;
  letter-spacing: 0.01em;
}

h2.text-primary, .h3.text-primary, h3.text-primary {
  text-shadow: 0 0 18px rgba(255, 117, 24, 0.28);
}

a {
  color: var(--bs-link-color);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

a:hover {
  color: var(--bs-link-hover-color);
  text-shadow: 0 0 12px rgba(255, 182, 92, 0.35);
}

hr {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 117, 24, 0.75), transparent);
  opacity: 1;
}

blockquote .lead { font-family: var(--bs-heading-font-family); font-style: italic; font-size: 1.3rem; }


/* ── Hero (home page) ─────────────────────────────────────────────────────── */

/* Let the sky, moon and fog show through behind the headline. The inline
   overlay in index.html reads var(--bs-dark), so it is thinned here too. */
.hero {
  --bs-dark: rgba(7, 5, 11, 0.12);
  background-color: rgba(7, 5, 11, 0.12) !important;
  isolation: isolate;
}

/* index.html's py-7 is not a Bootstrap utility; give the headline room to
   clear the banner's wax drips on narrow screens. */
.hero > .container { padding-top: clamp(2.5rem, 6vw, 4rem); padding-bottom: clamp(2.5rem, 6vw, 4rem); }

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 80% at 50% 45%, transparent 40%, rgba(3, 1, 6, 0.6) 100%);
  z-index: 1;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  left: -10%; right: -10%; bottom: -2px;
  height: 40%;
  background:
    radial-gradient(ellipse 30% 60% at 20% 100%, rgba(220, 210, 235, 0.12), transparent 70%),
    radial-gradient(ellipse 35% 55% at 70% 100%, rgba(220, 210, 235, 0.1), transparent 70%),
    linear-gradient(to top, rgba(13, 9, 19, 0.95), transparent);
  z-index: 2;
  pointer-events: none;
}

.hero h1 {
  color: #ffd9a8;
  font-family: var(--bs-heading-font-family);
  font-weight: 400;
  letter-spacing: 0.01em;
  animation: hwTextGlow 7s ease-in-out infinite;
}

.hero .lead { color: #e6dccb; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
.hero .lead strong { color: var(--hw-candle); font-weight: 600; }
.hero .lead em { font-family: var(--bs-heading-font-family); font-size: 1.12em; color: #f3dcc0; }


/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn { transition: transform 0.2s var(--hw-ease), box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease; }

.btn-primary {
  --bs-btn-color: var(--hw-ink);
  --bs-btn-hover-color: var(--hw-ink);
  --bs-btn-active-color: var(--hw-ink);
  --bs-btn-disabled-color: rgba(26, 8, 2, 0.7);
  --bs-btn-disabled-bg: #9c5a2c;
  --bs-btn-disabled-border-color: #9c5a2c;
  background-image: linear-gradient(180deg, #ff9d42 0%, #f06a12 100%);
  background-color: var(--hw-ember);
  border: 1px solid #ff8f3a;
  color: var(--hw-ink);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(255, 117, 24, 0.22), inset 0 1px 0 rgba(255, 230, 190, 0.35);
}

.btn-primary:hover,
.btn-primary:focus-visible,
.btn-primary:active,
.btn-primary.active {
  background-image: linear-gradient(180deg, #ffb060 0%, #ff7a1f 100%);
  border-color: #ffb060;
  color: var(--hw-ink);
  box-shadow: 0 6px 22px rgba(255, 117, 24, 0.45), 0 0 0 1px rgba(255, 176, 96, 0.4);
  transform: translateY(-1px);
}

.btn-outline-primary {
  --bs-btn-color: var(--hw-ember-lift);
  --bs-btn-border-color: rgba(255, 143, 58, 0.7);
  --bs-btn-hover-color: var(--hw-ink);
  --bs-btn-hover-bg: var(--hw-ember);
  --bs-btn-hover-border-color: #ff8f3a;
  --bs-btn-active-color: var(--hw-ink);
  --bs-btn-active-bg: var(--hw-ember);
  --bs-btn-active-border-color: #ff8f3a;
  color: var(--hw-ember-lift);
  border: 1px solid rgba(255, 143, 58, 0.7);
  background-color: rgba(255, 117, 24, 0.04);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible,
.btn-outline-primary:active,
.btn-outline-primary.active {
  color: var(--hw-ink);
  background-image: linear-gradient(180deg, #ff9d42 0%, #f06a12 100%);
  border-color: #ff8f3a;
  box-shadow: 0 0 18px rgba(255, 117, 24, 0.4);
}

.btn-secondary {
  --bs-btn-color: #ffffff;
  --bs-btn-hover-color: #ffffff;
  background-image: linear-gradient(180deg, #8f58dc 0%, #6a36b6 100%);
  background-color: var(--hw-witch);
  border: 1px solid rgba(185, 150, 242, 0.6);
  color: #ffffff;
  font-weight: 600;
}

.btn-secondary:hover,
.btn-secondary:focus-visible,
.btn-secondary:active {
  background-image: linear-gradient(180deg, #9d69e6 0%, #7542c4 100%);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(123, 69, 201, 0.5);
}

.btn-outline-secondary {
  --bs-btn-color: var(--hw-witch-lift);
  --bs-btn-border-color: rgba(185, 150, 242, 0.6);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: var(--hw-witch);
  --bs-btn-hover-border-color: rgba(185, 150, 242, 0.8);
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-bg: var(--hw-witch);
  color: var(--hw-witch-lift);
  border: 1px solid rgba(185, 150, 242, 0.6);
  background-color: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible,
.btn-outline-secondary:active {
  color: #ffffff;
  background-image: linear-gradient(180deg, #8f58dc 0%, #6a36b6 100%);
  border-color: rgba(185, 150, 242, 0.8);
}

.btn-outline-light {
  --bs-btn-color: var(--hw-bone);
  --bs-btn-border-color: rgba(236, 226, 207, 0.45);
  --bs-btn-hover-color: #fff7ea;
  --bs-btn-hover-bg: rgba(236, 226, 207, 0.1);
  --bs-btn-hover-border-color: rgba(255, 182, 92, 0.75);
  --bs-btn-active-color: #fff7ea;
  --bs-btn-active-bg: rgba(236, 226, 207, 0.16);
  --bs-btn-active-border-color: rgba(255, 182, 92, 0.75);
  backdrop-filter: blur(2px);
}

.btn-outline-light:hover { box-shadow: 0 0 16px rgba(255, 182, 92, 0.22); }

.btn-outline-danger {
  --bs-btn-color: var(--hw-blood-lift);
  --bs-btn-border-color: rgba(229, 86, 107, 0.65);
  --bs-btn-hover-color: #ffffff;
  --bs-btn-hover-bg: #b3203a;
  --bs-btn-hover-border-color: #d0405a;
}

.btn-outline-info {
  --bs-btn-color: #9fd8ee;
  --bs-btn-border-color: rgba(159, 216, 238, 0.55);
  --bs-btn-hover-color: #06121a;
  --bs-btn-hover-bg: #9fd8ee;
  --bs-btn-hover-border-color: #9fd8ee;
}

.btn-outline-success {
  --bs-btn-color: var(--hw-ecto);
  --bs-btn-border-color: rgba(157, 240, 138, 0.55);
  --bs-btn-hover-color: #07140a;
  --bs-btn-hover-bg: var(--hw-ecto);
  --bs-btn-hover-border-color: var(--hw-ecto);
}

.btn-link { --bs-btn-color: var(--hw-candle); --bs-btn-hover-color: #ffd49a; }

.btn-close { filter: invert(1) sepia(0.4) brightness(1.2); opacity: 0.7; }
.btn-close:hover { opacity: 1; }
.btn-close.btn-close-white { filter: invert(1) sepia(0.4) brightness(1.2); }


/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  --bs-card-bg: var(--hw-crypt);
  --bs-card-color: #e3d9c6;
  --bs-card-cap-bg: rgba(255, 117, 24, 0.08);
  --bs-card-cap-color: var(--hw-heading);
  --bs-card-border-color: rgba(255, 117, 24, 0.2);
  background: linear-gradient(165deg, rgba(var(--hw-crypt-2-rgb), 0.98) 0%, rgba(var(--hw-crypt-rgb), 0.98) 55%, rgba(16, 9, 18, 0.98) 100%);
  border: 1px solid rgba(255, 117, 24, 0.2);
  border-radius: var(--hw-radius);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  color: var(--bs-card-color);
  overflow: hidden;
  transition: transform 0.3s var(--hw-ease), border-color 0.3s ease, box-shadow 0.3s ease;
}

/* A lantern held just below the card */
.card:hover {
  border-color: rgba(255, 143, 58, 0.5);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), inset 0 -60px 70px -60px rgba(255, 117, 24, 0.35);
}

.card-header {
  background: linear-gradient(90deg, rgba(158, 15, 40, 0.22), rgba(123, 69, 201, 0.16));
  border-bottom: 1px solid rgba(255, 117, 24, 0.22);
  color: var(--bs-card-cap-color);
  font-family: var(--bs-heading-font-family);
}

.card-body,
.card-footer { color: var(--bs-card-color); }
.card-footer { background: rgba(0, 0, 0, 0.2); border-top-color: rgba(255, 117, 24, 0.16); }
.card-title  { color: var(--hw-heading); }
.card a:not(.btn) { color: var(--hw-candle); }
.card a:not(.btn):hover { color: #ffd49a; }
.card .text-muted { color: var(--hw-ash) !important; }

/* Testimonials: lift with the lantern and let the quote mark catch the light */
.testimonials .card:hover { transform: translateY(-4px); }
.testimonials .card .fa-quote-left { filter: drop-shadow(0 0 8px rgba(255, 117, 24, 0.45)); }
.testimonials .card .card-text { font-style: italic; }


/* ── Modals ───────────────────────────────────────────────────────────────── */

.modal {
  --bs-modal-bg: var(--hw-crypt);
  --bs-modal-color: var(--hw-bone);
  --bs-modal-border-color: rgba(255, 117, 24, 0.35);
  --bs-modal-header-border-color: rgba(255, 117, 24, 0.22);
  --bs-modal-footer-border-color: rgba(255, 117, 24, 0.22);
  z-index: 5000 !important;
}

.modal-content {
  background: linear-gradient(170deg, var(--hw-crypt-2), var(--hw-crypt) 60%, #0e0812);
  border: 1px solid rgba(255, 117, 24, 0.35);
  border-radius: var(--hw-radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(255, 117, 24, 0.12);
  color: var(--bs-modal-color);
}

.modal-header {
  background: linear-gradient(90deg, rgba(158, 15, 40, 0.35), rgba(123, 69, 201, 0.22));
  border-bottom: 1px solid rgba(255, 117, 24, 0.25);
}

.modal-title { color: var(--hw-heading); font-family: var(--bs-heading-font-family); }
.modal-body a:not(.btn) { color: var(--hw-candle); }
.modal .text-muted { color: var(--hw-ash) !important; }
.modal-footer { border-top-color: rgba(255, 117, 24, 0.22); }
.modal-backdrop.show { background-color: #030106; opacity: 0.75; z-index: 4444 !important; }


/* ── Dropdowns ────────────────────────────────────────────────────────────── */

.dropdown-menu {
  --bs-dropdown-bg: var(--hw-crypt);
  --bs-dropdown-color: var(--hw-bone);
  --bs-dropdown-link-color: #e9dfcc;
  --bs-dropdown-link-hover-bg: rgba(255, 117, 24, 0.14);
  --bs-dropdown-link-hover-color: #fff4e2;
  --bs-dropdown-link-active-bg: rgba(255, 117, 24, 0.26);
  --bs-dropdown-link-active-color: #fff4e2;
  --bs-dropdown-header-color: var(--hw-ash);
  --bs-dropdown-divider-bg: rgba(255, 117, 24, 0.2);
  --bs-dropdown-border-color: rgba(255, 117, 24, 0.3);
  background: linear-gradient(170deg, rgba(28, 20, 38, 0.98), rgba(14, 9, 19, 0.99));
  color: var(--bs-dropdown-color);
  border: 1px solid rgba(255, 117, 24, 0.3);
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 0 24px rgba(255, 117, 24, 0.08);
  padding: 0.4rem;
  backdrop-filter: blur(10px);
}

.dropdown-header {
  color: var(--bs-dropdown-header-color);
  font-family: var(--hw-smallcaps-font);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.dropdown-item {
  color: var(--bs-dropdown-link-color);
  border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dropdown-item i { color: var(--hw-ember-lift); width: 1.2rem; }

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--bs-dropdown-link-hover-bg);
  color: var(--bs-dropdown-link-hover-color);
  text-shadow: none;
}

.dropdown-item:hover i,
.dropdown-item:focus i { color: var(--hw-candle); }

.dropdown-item.active,
.dropdown-item:active {
  background-color: var(--bs-dropdown-link-active-bg);
  color: var(--bs-dropdown-link-active-color);
}

.dropdown-menu .text-muted,
.dropdown-item.text-muted { color: var(--hw-ash) !important; }

.dropdown-divider {
  height: 0;
  margin: 0.4rem 0;
  border: 0;
  border-top: 1px solid rgba(255, 117, 24, 0.2);
  opacity: 1;
}


/* ── Lists & accordions ───────────────────────────────────────────────────── */

.list-group {
  --bs-list-group-bg: transparent;
  --bs-list-group-color: var(--hw-bone);
  --bs-list-group-border-color: rgba(255, 117, 24, 0.14);
  --bs-list-group-action-color: var(--hw-bone);
  --bs-list-group-action-hover-color: #fff4e2;
  --bs-list-group-action-hover-bg: rgba(255, 117, 24, 0.07);
  --bs-list-group-action-active-color: #fff4e2;
  --bs-list-group-action-active-bg: rgba(255, 117, 24, 0.12);
  --bs-list-group-active-bg: var(--hw-ember);
  --bs-list-group-active-border-color: var(--hw-ember);
  --bs-list-group-active-color: var(--hw-ink);
}

.list-group-item {
  background-color: transparent;
  border-color: rgba(255, 117, 24, 0.14);
  color: var(--bs-body-color);
  transition: background-color 0.2s ease, transform 0.2s var(--hw-ease), box-shadow 0.2s ease;
}

.list-group-item:hover { background-color: rgba(255, 117, 24, 0.06); }
.list-group-item-action:hover { transform: translateX(4px); box-shadow: inset 3px 0 0 rgba(255, 117, 24, 0.7); }

.accordion {
  --bs-accordion-bg: transparent;
  --bs-accordion-color: var(--hw-bone);
  --bs-accordion-border-color: rgba(255, 117, 24, 0.25);
  --bs-accordion-btn-color: var(--hw-bone);
  --bs-accordion-btn-bg: var(--hw-crypt);
  --bs-accordion-active-color: var(--hw-ink);
  --bs-accordion-active-bg: var(--hw-ember);
  --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(255, 117, 24, 0.3);
  /* Bootstrap's chevrons are drawn in near-black; restate them in bone and ink */
  --bs-accordion-btn-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23ece2cf' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5L8 11L14 5'/%3E%3C/svg%3E");
  --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231a0802' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5L8 11L14 5'/%3E%3C/svg%3E");
}

.accordion-item {
  background-color: transparent;
  border: 1px solid rgba(255, 117, 24, 0.25);
  border-radius: var(--hw-radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.accordion-item:hover { box-shadow: 0 0 20px rgba(255, 117, 24, 0.18); border-color: rgba(255, 143, 58, 0.45); }
.accordion-button { background-color: var(--hw-crypt); color: var(--hw-bone); font-weight: 600; }
.accordion-button:not(.collapsed) { background-image: linear-gradient(90deg, #ff9d42, #f06a12); color: var(--hw-ink); box-shadow: none; }
.accordion-button:focus { box-shadow: var(--bs-accordion-btn-focus-box-shadow); }
.accordion-body { background-color: #0f0a14; border-top: 1px solid rgba(255, 117, 24, 0.22); color: var(--hw-bone); }


/* ── Tables ───────────────────────────────────────────────────────────────── */

.table {
  --bs-table-bg: rgba(20, 14, 27, 0.9);
  --bs-table-color: var(--hw-bone);
  --bs-table-striped-bg: rgba(255, 117, 24, 0.04);
  --bs-table-striped-color: var(--hw-bone);
  --bs-table-hover-bg: rgba(255, 117, 24, 0.09);
  --bs-table-hover-color: #fff4e2;
  --bs-table-border-color: rgba(255, 117, 24, 0.18);
  border-collapse: separate;
  border-spacing: 0;
}

.table thead { background: linear-gradient(90deg, #3a0a18, #2a1446); }

.table thead th {
  background: transparent;
  color: var(--hw-heading);
  font-family: var(--hw-smallcaps-font);
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 117, 24, 0.45);
}

.table td { vertical-align: middle; color: var(--bs-table-color); }
.table-responsive { border-radius: var(--hw-radius-sm); overflow: hidden; border: 1px solid rgba(255, 117, 24, 0.25); }


/* ── Pagination ───────────────────────────────────────────────────────────── */

.pagination {
  --bs-pagination-color: var(--hw-candle);
  --bs-pagination-bg: var(--hw-crypt);
  --bs-pagination-border-color: rgba(255, 117, 24, 0.25);
  --bs-pagination-hover-color: #fff4e2;
  --bs-pagination-hover-bg: rgba(255, 117, 24, 0.14);
  --bs-pagination-hover-border-color: rgba(255, 143, 58, 0.55);
  --bs-pagination-focus-color: #fff4e2;
  --bs-pagination-focus-bg: rgba(255, 117, 24, 0.14);
  --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(255, 117, 24, 0.3);
  --bs-pagination-active-color: var(--hw-ink);
  --bs-pagination-active-bg: var(--hw-ember);
  --bs-pagination-active-border-color: var(--hw-ember);
  --bs-pagination-disabled-color: rgba(169, 158, 180, 0.55);
  --bs-pagination-disabled-bg: #0e0913;
  --bs-pagination-disabled-border-color: rgba(255, 117, 24, 0.12);
}


/* ── Navbar ───────────────────────────────────────────────────────────────── */

.navbar {
  --bs-navbar-color: rgba(236, 226, 207, 0.86);
  --bs-navbar-hover-color: #fff4e2;
  --bs-navbar-disabled-color: rgba(236, 226, 207, 0.4);
  --bs-navbar-active-color: var(--hw-candle);
  --bs-navbar-brand-color: #f8ead2;
  --bs-navbar-brand-hover-color: var(--hw-candle);
  --bs-navbar-toggler-border-color: rgba(255, 117, 24, 0.5);
  background-color: var(--bs-navbar-bg) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 117, 24, 0.28);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

/* A thin ember seam slowly smouldering along the bottom edge */
.navbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 117, 24, 0.0) 20%, rgba(255, 170, 80, 0.9) 35%, rgba(255, 117, 24, 0.0) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: hwNavEmber 14s linear infinite;
}

/* The expanded mobile menu sits over page content; make it solid there */
.navbar:has(.navbar-collapse.show),
.navbar:has(.navbar-collapse.collapsing) { background-color: #07050b !important; }

/* Room for the longest theme name beside its check mark */
.navbar .dropdown-menu { min-width: 12.5rem; }

.navbar .navbar-brand {
  color: var(--bs-navbar-brand-color);
  font-family: var(--bs-heading-font-family);
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  text-shadow: 0 0 14px rgba(255, 117, 24, 0.35);
}

.navbar .navbar-brand:hover,
.navbar .navbar-brand:focus { color: var(--bs-navbar-brand-hover-color); }
.navbar .nav-link { color: var(--bs-navbar-color); text-shadow: none; }
.navbar .nav-link:hover,
.navbar .nav-link:focus { color: var(--bs-navbar-hover-color); text-decoration: none; text-shadow: 0 0 10px rgba(255, 182, 92, 0.35); }
.navbar .nav-link.active,
.navbar .nav-link.show { color: var(--bs-navbar-active-color); }


/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-control,
.form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23ffb65c' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-color: #0e0913;
  border: 1px solid rgba(255, 117, 24, 0.35);
  color: var(--hw-bone);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  background-color: #120c18;
  border-color: var(--hw-ember);
  box-shadow: 0 0 0 0.2rem rgba(255, 117, 24, 0.25), 0 0 18px rgba(255, 117, 24, 0.18);
  color: #fff7ea;
}

.form-control::placeholder { color: #8a8094; opacity: 1; }
.form-select option { background-color: #140e1b; color: var(--hw-bone); }
.form-label { color: #e3d6bf; }
.form-floating > label,
.form-text { color: var(--hw-ash); }

.form-control:disabled,
.form-control[readonly],
.form-select:disabled { background-color: #17111d; color: #9c93a8; border-color: rgba(255, 117, 24, 0.18); }

.input-group-text { background-color: #1c1426; color: var(--hw-ash); border-color: rgba(255, 117, 24, 0.35); }

.form-check-input { background-color: #0e0913; border-color: rgba(255, 143, 58, 0.55); }
.form-check-input:checked { background-color: var(--hw-ember); border-color: var(--hw-ember); }
.form-check-input:focus { border-color: var(--hw-ember); box-shadow: 0 0 0 0.2rem rgba(255, 117, 24, 0.25); }

.form-control[type="file"]::file-selector-button {
  background: linear-gradient(180deg, #ff9d42, #f06a12);
  color: var(--hw-ink);
  border: none;
  padding: 0.4rem 0.8rem;
  margin-right: 0.75rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}


/* ── Alerts, badges, progress ─────────────────────────────────────────────── */

.alert {
  --bs-alert-bg: rgba(20, 14, 27, 0.96);
  --bs-alert-color: var(--hw-bone);
  --bs-alert-border-color: rgba(255, 117, 24, 0.4);
  --bs-alert-link-color: var(--hw-candle);
  border: 1px solid var(--bs-alert-border-color);
  border-left-width: 4px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.alert-success { --bs-alert-color: #d4f7c8; --bs-alert-bg: rgba(20, 30, 20, 0.96); --bs-alert-border-color: rgba(157, 240, 138, 0.55); --bs-alert-link-color: #e6ffdc; }
.alert-danger  { --bs-alert-color: #ffd3da; --bs-alert-bg: rgba(40, 8, 16, 0.96);  --bs-alert-border-color: rgba(229, 86, 107, 0.65); --bs-alert-link-color: #ffe6ea; }
.alert-warning { --bs-alert-color: #ffe4bf; --bs-alert-bg: rgba(38, 22, 6, 0.96);  --bs-alert-border-color: rgba(255, 182, 92, 0.6);  --bs-alert-link-color: #fff0da; }
.alert-info    { --bs-alert-color: #e5d8ff; --bs-alert-bg: rgba(26, 16, 44, 0.96); --bs-alert-border-color: rgba(185, 150, 242, 0.6); --bs-alert-link-color: #f1eaff; }

.badge { box-shadow: 0 0 10px rgba(255, 117, 24, 0.22); }
.badge.bg-primary, .badge.text-bg-primary { color: var(--hw-ink) !important; }
.progress { background-color: #0e0913; border: 1px solid rgba(255, 117, 24, 0.3); }
.progress-bar { background-image: linear-gradient(90deg, #9e0f28, #ff7518); box-shadow: 0 0 10px rgba(255, 117, 24, 0.5); }


/* ── Scrollbar ────────────────────────────────────────────────────────────── */

html { scrollbar-color: #6b2a1a #07050b; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #07050b; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #8a3a14, #5a1020); border-radius: 10px; border: 2px solid #07050b; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #c2561a, #7d1830); }
::-webkit-scrollbar-corner { background: transparent; }


/* ── Calendar ─────────────────────────────────────────────────────────────── */

.calendar {
  background: radial-gradient(circle at top, rgba(28, 20, 38, 0.97), rgba(10, 6, 14, 0.98));
  border-radius: 18px;
  border: 1px solid rgba(255, 117, 24, 0.25);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.calendar .table { background: transparent; }
.calendar thead tr { background: linear-gradient(90deg, #3a0a18, #2a1446); }
.calendar thead th { background: transparent; color: var(--hw-heading) !important; border-bottom: 1px solid rgba(255, 117, 24, 0.45); }
.calendar .calendar-cell { background: rgba(10, 6, 14, 0.96); color: var(--bs-body-color); border-color: rgba(255, 117, 24, 0.12); }
.calendar .calendar-cell:hover { background: radial-gradient(circle at bottom, rgba(255, 117, 24, 0.14), rgba(10, 6, 14, 1)); animation: hwCalendarHover 1.8s ease-in-out infinite; }
.calendar .calendar-cell .date.badge { background: linear-gradient(180deg, #ff9d42, #f06a12) !important; color: var(--hw-ink) !important; }
.calendar .item-preview { background: rgba(236, 226, 207, 0.06); border-color: rgba(255, 117, 24, 0.6) !important; color: var(--bs-body-color); }
.calendar .item-preview small,
.calendar .item-preview .text-muted { color: var(--hw-ash) !important; }
.calendar-cell { transition: background 0.2s ease-in-out, box-shadow 0.2s ease-in-out; border: 1px solid rgba(255, 117, 24, 0.14); }
.calendar-cell:hover { background-color: rgba(255, 117, 24, 0.12); }

.fact-preview {
  background-color: rgba(var(--hw-crypt-rgb), 0.92);
  border-left: 3px solid var(--hw-ember);
  color: var(--hw-bone);
  transition: background-color 0.2s ease, transform 0.2s var(--hw-ease), box-shadow 0.2s ease;
}

.fact-preview:hover { background-color: rgba(255, 117, 24, 0.1); transform: translateX(6px); box-shadow: 0 0 16px rgba(255, 117, 24, 0.22); }
.hover-shadow:hover { box-shadow: 0 0 20px rgba(255, 117, 24, 0.35); }


/* ── Footer ───────────────────────────────────────────────────────────────── */

footer.bg-dark {
  border-top: 1px solid rgba(255, 117, 24, 0.22);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.5);
  position: relative;
}


/* ── Navbar menus ───────────────────────────────────────────────────────────
   The navbar is data-bs-theme="dark", which restates Bootstrap's own menu
   variables inside it. Pin the account/theme and language menus to the crypt
   surface explicitly so they match the rest of the theme. */
body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu {
  --bs-dropdown-bg: rgba(20, 14, 27, 0.98);
  --bs-dropdown-color: #e9dfcc;
  --bs-dropdown-link-color: #e9dfcc;
  --bs-dropdown-link-hover-bg: rgba(255, 117, 24, 0.14);
  --bs-dropdown-link-hover-color: #fff4e2;
  --bs-dropdown-link-active-bg: rgba(255, 117, 24, 0.26);
  --bs-dropdown-link-active-color: #fff4e2;
  --bs-dropdown-header-color: var(--hw-ash);
  background: linear-gradient(170deg, rgba(28, 20, 38, 0.98), rgba(12, 8, 17, 0.99));
  color: var(--bs-dropdown-color);
  border: 1px solid rgba(255, 117, 24, 0.3);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
}

body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu .dropdown-item { color: var(--bs-dropdown-link-color); }

body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu .dropdown-item:hover,
body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu .dropdown-item:focus {
  color: var(--bs-dropdown-link-hover-color);
  background-color: var(--bs-dropdown-link-hover-bg);
  text-decoration: none;
}

body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu .dropdown-item.active,
body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu .dropdown-item:active {
  color: var(--bs-dropdown-link-active-color);
  background-color: var(--bs-dropdown-link-active-bg);
}

body[data-theme="halloween"] .navbar
:is(#languageDropdown, #userDropdown) + .dropdown-menu .dropdown-header { color: var(--bs-dropdown-header-color); }


/* ── Notification bell ──────────────────────────────────────────────────────
   nav.html moves the panel to <body>; fixed positioning is therefore required
   for the JS-supplied top/left coordinates to take effect. */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: 50%;
  color: rgba(236, 226, 207, 0.86);
  font-size: 17px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: color 0.22s ease, background-color 0.22s ease, transform 0.22s ease;
}

.notif-bell:hover {
  color: var(--hw-candle);
  background-color: rgba(255, 117, 24, 0.12);
  transform: translateY(-1px);
}

.notif-bell:focus-visible { outline: 2px solid var(--hw-candle); outline-offset: 3px; }

.notif-badge {
  position: absolute;
  top: -3px;
  right: -5px;
  min-width: 18px;
  background: #b3203a;
  color: #ffffff;
  border-radius: 999px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 0 0 2px #07050b, 0 0 10px rgba(229, 86, 107, 0.6);
}

.notif-dropdown {
  position: fixed;
  width: min(310px, calc(100vw - 16px));
  background: linear-gradient(170deg, rgba(28, 20, 38, 0.98), rgba(12, 8, 17, 0.995));
  color: #e9dfcc;
  border: 1px solid rgba(255, 117, 24, 0.3);
  border-radius: 14px;
  z-index: 9999;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  overflow: hidden;
  animation: hwNotifFadeIn 0.2s ease;
}

.notif-header {
  padding: 12px 16px 9px;
  color: var(--hw-candle);
  border-bottom: 1px solid rgba(255, 117, 24, 0.2);
  font-family: var(--hw-smallcaps-font);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.notif-dropdown ul {
  max-height: 280px;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  list-style: none;
}

.notif-dropdown ul li {
  padding: 12px 16px;
  color: #e3d9c6;
  border-bottom: 1px solid rgba(255, 117, 24, 0.08);
  font-family: var(--bs-body-font-family);
  font-size: 0.85rem;
  line-height: 1.55;
  transition: background-color 0.15s ease;
}

.notif-dropdown ul li:hover { background-color: rgba(255, 117, 24, 0.08); }
.notif-dropdown ul li:last-child { border-bottom: 0; }

#notifEmptyDesktop,
#notifEmptyMobile {
  display: none;
  margin: 0;
  padding: 18px;
  color: var(--hw-ash);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
}

.notif-dropdown ::-webkit-scrollbar { width: 5px; }
.notif-dropdown ::-webkit-scrollbar-thumb { background: #6b2a1a; border-radius: 4px; }
.notif-dropdown ::-webkit-scrollbar-track { background: transparent; }


/* ── Theme picker in nav ──────────────────────────────────────────────────── */

.theme-picker__menu   { min-width: 200px; }
.theme-picker__option { display: flex; align-items: center; gap: 8px; }
.theme-picker__icon   { font-size: 1rem; width: 1.4rem; text-align: center; }


/* ── Hindi ────────────────────────────────────────────────────────────────── */

/* Tracking pulls Devanagari conjuncts apart; set it naturally instead. */
html[lang="hi"] :is(
  .theme-banner, .theme-banner span, .dropdown-header, .table thead th,
  .notif-header, .navbar-brand, h1, h2, h3, h4, h5, h6
) { letter-spacing: normal; }


/* ── Small screens: lighter scenery ───────────────────────────────────────── */

@media (max-width: 640px) {
  /* On a phone the banner fills the top, so a small, dim moon rises low on
     the left instead, over the headstones and clear of the audio button. */
  .hw-moon { top: auto; bottom: clamp(64px, 11vh, 110px); right: auto; left: 7vw; width: 54px; opacity: 0.5; }
  .halloween-web { width: 92px; --web-opacity: 0.16; }
  .hw-fog { height: 24vh; }
  .theme-banner::before { display: none; }
}


/* ── Reduced motion: the night stays, nothing moves ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .halloween-bat,
  .halloween-spider,
  .hw-wisp,
  .hw-ghost,
  .hw-gloom,
  .theme-banner::before { display: none !important; }

  .hw-moon,
  .hw-moon__cloud,
  .hw-window,
  .hw-window-glow,
  .hw-fog__layer,
  .halloween-web,
  .navbar::after,
  .hero h1,
  .theme-banner span,
  .theme-banner .hw-candle,
  .theme-easter-egg span,
  .calendar .calendar-cell:hover { animation: none !important; }

  .card,
  .btn,
  .list-group-item,
  .fact-preview { transition: none !important; }

  .testimonials .card:hover,
  .list-group-item-action:hover,
  .fact-preview:hover,
  .btn:hover { transform: none !important; }
}


/* ── Print: paper, not the night ──────────────────────────────────────────── */

@media print {
  .hw-moon, .hw-graveyard, .hw-fog, .halloween-web, .hw-vignette, .hw-gloom,
  .halloween-bat, .halloween-spider, .hw-wisp, .hw-ghost, .theme-audio-btn { display: none !important; }
}
