/* Cardart - Purple Theme (Kraken-ish)
   Loaded globally after core styles. Keep it variable-driven.
   Provide distinct light/dark palettes so the mode toggle remains meaningful. */

/* Light mode (default) */
html {
  /* Base surfaces */
  --background-reverse: #0b0620;
  --background: #fbf7ff;
  --background-translucent: rgba(251, 247, 255, 0.86);
  --sub-background: rgba(124, 58, 237, 0.06);
  --sib-background: rgba(255, 255, 255, 0.88);
  --glass-background: rgba(255, 255, 255, 0.72);

  /* Text */
  --main: #211638;
  --routine: #3c2f57;
  --title: #120a22;
  --minor: rgba(60, 47, 87, 0.70);
  --seat: rgba(60, 47, 87, 0.45);

  /* Neutral accents */
  --sib: rgba(124, 58, 237, 0.12);
  --classA: rgba(18, 10, 34, 0.18);
  --classB: rgba(18, 10, 34, 0.14);
  --classC: rgba(18, 10, 34, 0.10);
  --classD: rgba(18, 10, 34, 0.06);
  --classE: rgba(18, 10, 34, 0.22);
  --classF: #1b122f;
  --classG: rgba(18, 10, 34, 0.10);
  --classH: rgba(124, 58, 237, 0.10);
  --classJ: rgba(236, 72, 153, 0.12);
  --classL: rgba(0, 0, 0, 0.12);
  --classM: rgba(18, 10, 34, 0.86);

  /* Functional colors */
  --quote: #7c3aed;
  --code: #6d28d9;
  --code-background: rgba(124, 58, 237, 0.10);
  --overdue-border: rgba(251, 191, 36, 0.60);
  --overdue-background: rgba(251, 191, 36, 0.12);

  /* Shadows */
  --box-shadow: 0 12px 35px rgba(30, 16, 70, 0.14);
  --text-shadow: none;
  --shadow-code: rgba(30, 16, 70, 0.22);
  --block-shadow: 0 14px 45px rgba(30, 16, 70, 0.16);
  --box-shadow-journal: rgba(30, 16, 70, 0.14);
  --box-shadow-friend: rgba(30, 16, 70, 0.14);
  --box-shadow-toc: 0 10px 40px rgba(30, 16, 70, 0.18);
  --background-toc: rgba(251, 247, 255, 0.92);

  /* Tags / pager */
  --box-shadow-tags: 0 10px 28px rgba(30, 16, 70, 0.12);
  --background-tags: rgba(124, 58, 237, 0.10);
  --background-tag: rgba(255, 255, 255, 0.90);
  --box-shadow-pager: 0 10px 24px rgba(30, 16, 70, 0.14);

  /* Notice / blocks */
  --notice: #7c3aed;
  --background-notice: rgba(124, 58, 237, 0.12);
  --shadow-notice: inset 0 0 18px rgba(124, 58, 237, 0.18);
  --background-journal: rgba(255, 255, 255, 0.78);
  --background-journal-block: rgba(255, 255, 255, 0.80);
  --background-journal-gradient: linear-gradient(
    0deg,
    rgba(124, 58, 237, 0.10),
    transparent 75%
  );
  --background-friend: rgba(255, 255, 255, 0.78);
  --background-friend-block: rgba(255, 255, 255, 0.80);
}

/* Dark mode */
html[data-mode='dark'] {
  /* Base surfaces */
  --background-reverse: #ffffff;
  /* Slightly brighter than before for readability */
  --background: #1b1140;
  --background-translucent: rgba(27, 17, 64, 0.78);
  --sub-background: rgba(255, 255, 255, 0.06);
  --sib-background: rgba(255, 255, 255, 0.12);
  --glass-background: rgba(255, 255, 255, 0.06);

  /* Text */
  --main: rgba(255, 255, 255, 0.92);
  --routine: rgba(255, 255, 255, 0.82);
  --title: #ffffff;
  --minor: rgba(255, 255, 255, 0.68);
  --seat: rgba(255, 255, 255, 0.50);

  /* Neutral accents */
  --sib: rgba(168, 85, 247, 0.16);
  --classA: rgba(255, 255, 255, 0.16);
  --classB: rgba(255, 255, 255, 0.12);
  --classC: rgba(255, 255, 255, 0.10);
  --classD: rgba(255, 255, 255, 0.08);
  --classE: rgba(255, 255, 255, 0.22);
  --classF: rgba(255, 255, 255, 0.92);
  --classG: rgba(255, 255, 255, 0.10);
  --classH: rgba(168, 85, 247, 0.14);
  --classJ: rgba(236, 72, 153, 0.16);
  --classL: rgba(0, 0, 0, 0.55);
  --classM: rgba(255, 255, 255, 0.96);

  /* Functional colors */
  --quote: #a855f7;
  --code: #c084fc;
  --code-background: rgba(168, 85, 247, 0.18);
  --overdue-border: rgba(251, 191, 36, 0.58);
  --overdue-background: rgba(251, 191, 36, 0.12);

  /* Shadows */
  --box-shadow: 0 12px 35px rgba(0, 0, 0, 0.32);
  --text-shadow: none;
  --shadow-code: rgba(0, 0, 0, 0.55);
  --block-shadow: 0 14px 45px rgba(0, 0, 0, 0.38);
  --box-shadow-journal: rgba(0, 0, 0, 0.30);
  --box-shadow-friend: rgba(0, 0, 0, 0.30);
  --box-shadow-toc: 0 10px 40px rgba(0, 0, 0, 0.40);
  --background-toc: rgba(18, 10, 42, 0.92);

  /* Tags / pager */
  --box-shadow-tags: 0 10px 28px rgba(0, 0, 0, 0.32);
  --background-tags: rgba(168, 85, 247, 0.10);
  --background-tag: rgba(255, 255, 255, 0.06);
  --box-shadow-pager: 0 10px 24px rgba(0, 0, 0, 0.30);

  /* Notice / blocks */
  --notice: #c084fc;
  --background-notice: rgba(168, 85, 247, 0.12);
  --shadow-notice: inset 0 0 18px rgba(168, 85, 247, 0.22);
  --background-journal: rgba(255, 255, 255, 0.05);
  --background-journal-block: rgba(255, 255, 255, 0.05);
  --background-journal-gradient: linear-gradient(
    0deg,
    rgba(168, 85, 247, 0.10),
    transparent 75%
  );
  --background-friend: rgba(255, 255, 255, 0.05);
  --background-friend-block: rgba(255, 255, 255, 0.05);
}

/* Keep the theme color consistent across modes. */
html body,
html[data-mode='dark'] body {
  --theme: #7c3aed;
  --waline-theme-color: #7c3aed;
  --waline-active-color: #7c3aed;
  color: var(--main);
}

/* Page background */
body:after {
  background-color: #fbf7ff;
  background-image:
    radial-gradient(900px circle at 14% 5%, rgba(124, 58, 237, 0.16), transparent 55%),
    radial-gradient(900px circle at 86% 10%, rgba(99, 102, 241, 0.12), transparent 55%),
    radial-gradient(900px circle at 50% 100%, rgba(236, 72, 153, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(251, 247, 255, 1), rgba(243, 236, 255, 1));
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
}

/* Override the built-in dark-mode background reset. */
html[data-mode='dark'] body:after {
  background-color: #10082a;
  background-image:
    radial-gradient(900px circle at 14% 5%, rgba(168, 85, 247, 0.45), transparent 55%),
    radial-gradient(900px circle at 86% 10%, rgba(99, 102, 241, 0.30), transparent 55%),
    radial-gradient(1100px circle at 50% 110%, rgba(236, 72, 153, 0.22), transparent 60%),
    linear-gradient(180deg, rgba(27, 17, 64, 0.92), rgba(12, 7, 28, 0.97));
  z-index: -200;
}

/* Make "glass" headers work on both palettes. */
.joe_header__above.glass {
  backdrop-filter: blur(8px);
}

/* Move the theme mode toggle into the navbar (header) */
.joe_action .joe_action_item.mode {
  display: none;
}

.joe_header__above-nav {
  flex: 1 1 auto;
  min-width: 0;
}

.joe_header__above-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.joe_header__above-searchicon-link {
  display: none !important;
}

/* Header: WeChat group button */
.joe_header__wechat-group {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.18);
  background: var(--sib-background);
  color: var(--main);
  text-decoration: none;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease,
    color 0.2s ease;
}

.joe_header__wechat-group .fa {
  font-size: 18px;
  color: var(--theme);
}

.joe_header__wechat-group .text {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.joe_header__wechat-group:hover {
  background: var(--sub-background);
  border-color: rgba(168, 85, 247, 0.32);
  box-shadow: 0 10px 26px rgba(30, 16, 70, 0.14);
  color: var(--theme);
  transform: translateY(-1px);
}

.joe_header__home-quick-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 180px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.18);
  background: var(--sib-background);
  color: var(--main);
  text-decoration: none;
  transition:
    transform 0.12s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.joe_header__home-quick-button span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}

.joe_header__home-quick-button:hover {
  background: var(--sub-background);
  border-color: rgba(168, 85, 247, 0.32);
  box-shadow: 0 10px 26px rgba(30, 16, 70, 0.14);
  color: var(--theme);
  transform: translateY(-1px);
}

/* Header: login button (override global .nav_login styles) */
.joe_header__above-right .nav_login {
  height: 44px;
  margin-left: 0;
  display: flex;
  align-items: center;
}

.joe_header__above-right .nav_login a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 96px;
  padding: 0 14px;
  height: 44px;
  border-radius: 12px;
  background: var(--sib-background);
  border: 1px solid rgba(168, 85, 247, 0.18);
  color: var(--main);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
  transition:
    transform 0.12s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}

.joe_header__above-right .nav_login a i {
  font-size: 16px;
}

.joe_header__above-right .nav_login a:hover {
  background: var(--sub-background);
  border-color: rgba(168, 85, 247, 0.32);
  box-shadow: 0 10px 26px rgba(30, 16, 70, 0.14);
  color: var(--theme);
  transform: translateY(-1px);
}

.joe_header__above-right .nav_login .login_after {
  min-width: 88px;
}

/* Global search bar (below navbar) */
.joe_custom_search_bar {
  background: var(--background-translucent, rgba(255, 255, 255, 0.85));
  padding: 10px 0;
  border-bottom: 1px solid rgba(168, 85, 247, 0.18);
  position: sticky;
  top: 60px;
  z-index: 99;
  backdrop-filter: blur(8px);
}

.joe_custom_search_bar .joe_container {
  margin-bottom: 0 !important;
}

.joe_custom_search_bar__inner {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: rgba(168, 85, 247, 0.14);
  border-radius: 30px;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.22);
  transition: all 0.3s ease;
}

.joe_custom_search_bar__inner:focus-within {
  transform: scale(1.02);
  box-shadow: 0 16px 40px rgba(168, 85, 247, 0.18);
  border-color: var(--theme);
}

.joe_custom_search_bar__inner:hover {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
  background: rgba(168, 85, 247, 0.18);
}

.joe_custom_search_bar__icon {
  font-size: 18px;
  color: var(--minor, #9b8fe0);
  margin-right: 10px;
  flex-shrink: 0;
}

.joe_custom_search_bar__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--main, #333);
  line-height: 24px;
  padding: 6px 0;
}

.joe_custom_search_bar__input::placeholder {
  color: var(--minor, #aaa);
}

.joe_header__mode-toggle.joe_action_item {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  margin-bottom: 0;
  color: var(--main);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.joe_header__mode-toggle.joe_action_item:hover {
  background: var(--sub-background);
  border-color: rgba(168, 85, 247, 0.28);
  color: var(--theme);
}

.joe_header__mode-toggle.joe_action_item svg {
  fill: currentColor;
}

@media (max-width: 768px) {
  /* Keep logo centered even when right-side icons grow (search + mode). */
  html .joe_header .joe_header__above .joe_header_container {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
  }

  html .joe_header .joe_header__above .joe_header_container .joe_header__above-slideicon {
    justify-self: start;
  }

  html .joe_header .joe_header__above .joe_header_container .joe_header__above-logo {
    justify-self: center;
  }

  html .joe_header .joe_header__above .joe_header_container .joe_header__above-right {
    justify-self: end;
  }

  .joe_header__wechat-group {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .joe_header__wechat-group .text {
    display: none;
  }

  .joe_header__home-quick-button {
    max-width: 116px;
    padding: 0 10px;
  }

  .joe_custom_search_bar {
    top: 55px;
    padding: 8px 0;
  }

  .joe_custom_search_bar__inner {
    max-width: 100%;
  }
}
