/* =========================================================
   HEARTBEAT VERVE
   ========================================================= */

:root {
  --page-bg: #120c12;

  /* 50% opaque = 50% transparent */
  --container-bg: rgba(20, 14, 22, 0.50);
  --container-border: rgba(255, 218, 185, 0.20);

  --text: #ffdab9;
  --muted: #c9a99b;
  --link: #dc143c;
  --link-hover: #ff5c75;

  --heading: #ffdab9;
  --accent: #dc143c;

  --button-bg: rgba(20, 14, 22, 0.78);
  --button-border: rgba(255, 218, 185, 0.25);

  --shadow:
    0 25px 80px rgba(0, 0, 0, 0.55),
    0 0 35px rgba(220, 20, 60, 0.08);

  --radius: 22px;
}

/* =========================================================
   THEMES
   ========================================================= */

html[data-theme="light"] {
  --page-bg: #f5f5f5;
  --container-bg: rgba(255, 255, 255, 0.50);
  --container-border: rgba(0, 0, 0, 0.16);
  --text: #222222;
  --muted: #666666;
  --link: #0066cc;
  --link-hover: #004499;
  --heading: #222222;
  --accent: #0066cc;
  --button-bg: rgba(255, 255, 255, 0.80);
  --button-border: rgba(0, 0, 0, 0.16);
  --shadow: 0 25px 70px rgba(0, 0, 0, 0.15);
}

html[data-theme="dracula"] {
  --page-bg: #282a36;
  --container-bg: rgba(40, 42, 54, 0.50);
  --container-border: rgba(189, 147, 249, 0.22);
  --text: #f8f8f2;
  --muted: #b8b8c2;
  --link: #ff79c6;
  --link-hover: #ffb3df;
  --heading: #bd93f9;
  --accent: #ff79c6;
  --button-bg: rgba(40, 42, 54, 0.85);
  --button-border: rgba(189, 147, 249, 0.25);
  --shadow: 0 25px 80px rgba(0, 0, 0, 0.55);
}

html[data-theme="nord"] {
  --page-bg: #2e3440;
  --container-bg: rgba(46, 52, 64, 0.50);
  --container-border: rgba(136, 192, 208, 0.22);
  --text: #eceff4;
  --muted: #d8dee9;
  --link: #88c0d0;
  --link-hover: #8fbcbb;
  --heading: #81a1c1;
  --accent: #88c0d0;
  --button-bg: rgba(46, 52, 64, 0.85);
  --button-border: rgba(136, 192, 208, 0.25);
}

html[data-theme="laserwave"] {
  --page-bg: #1b1026;
  --container-bg: rgba(27, 16, 38, 0.50);
  --container-border: rgba(255, 113, 206, 0.25);
  --text: #f7eaff;
  --muted: #c9a9d9;
  --link: #ff71ce;
  --link-hover: #8be9fd;
  --heading: #8be9fd;
  --accent: #ff71ce;
  --button-bg: rgba(27, 16, 38, 0.86);
  --button-border: rgba(255, 113, 206, 0.28);
}

html[data-theme="violet"] {
  --page-bg: #171021;
  --container-bg: rgba(32, 19, 50, 0.50);
  --container-border: rgba(170, 120, 255, 0.25);
  --text: #eee5ff;
  --muted: #bdaed2;
  --link: #b88cff;
  --link-hover: #d4b8ff;
  --heading: #c9a7ff;
  --accent: #a970ff;
  --button-bg: rgba(32, 19, 50, 0.86);
  --button-border: rgba(170, 120, 255, 0.28);
}

html[data-theme="gold"] {
  --page-bg: #171209;
  --container-bg: rgba(35, 27, 12, 0.50);
  --container-border: rgba(255, 215, 0, 0.24);
  --text: #f9eac1;
  --muted: #cbbd9a;
  --link: #ffd700;
  --link-hover: #fff1a3;
  --heading: #ffe28a;
  --accent: #d9a900;
  --button-bg: rgba(35, 27, 12, 0.86);
  --button-border: rgba(255, 215, 0, 0.28);
}

html[data-theme="rosebox"] {
  --page-bg: #190f15;
  --container-bg: rgba(48, 22, 37, 0.50);
  --container-border: rgba(219, 112, 147, 0.25);
  --text: #ffeaf0;
  --muted: #d0abb7;
  --link: #db7093;
  --link-hover: #ffabc4;
  --heading: #ffb6c9;
  --accent: #db7093;
  --button-bg: rgba(48, 22, 37, 0.86);
  --button-border: rgba(219, 112, 147, 0.28);
}

html[data-theme="gruvboxdark"] {
  --page-bg: #282828;
  --container-bg: rgba(40, 40, 40, 0.50);
  --container-border: rgba(235, 219, 178, 0.20);
  --text: #ebdbb2;
  --muted: #bdae93;
  --link: #83a598;
  --link-hover: #8ec07c;
  --heading: #fabd2f;
  --accent: #b8bb26;
  --button-bg: rgba(40, 40, 40, 0.88);
  --button-border: rgba(235, 219, 178, 0.24);
}

html[data-theme="gruvboxlight"] {
  --page-bg: #fbf1c7;
  --container-bg: rgba(251, 241, 199, 0.50);
  --container-border: rgba(60, 56, 54, 0.18);
  --text: #3c3836;
  --muted: #665c54;
  --link: #076678;
  --link-hover: #427b58;
  --heading: #9d0006;
  --accent: #b57614;
  --button-bg: rgba(251, 241, 199, 0.88);
  --button-border: rgba(60, 56, 54, 0.20);
  --shadow: 0 25px 70px rgba(60, 56, 54, 0.16);
}

html[data-theme="tokyoNight"] {
  --page-bg: #16161e;
  --container-bg: rgba(26, 27, 38, 0.50);
  --container-border: rgba(122, 162, 247, 0.22);
  --text: #c0caf5;
  --muted: #9299b5;
  --link: #7aa2f7;
  --link-hover: #bb9af7;
  --heading: #bb9af7;
  --accent: #7dcfff;
  --button-bg: rgba(26, 27, 38, 0.88);
  --button-border: rgba(122, 162, 247, 0.25);
}

html[data-theme="icebergDark"] {
  --page-bg: #161d2b;
  --container-bg: rgba(22, 27, 37, 0.50);
  --container-border: rgba(132, 151, 174, 0.22);
  --text: #c6c8d1;
  --muted: #8993a7;
  --link: #84a0c6;
  --link-hover: #a0c4df;
  --heading: #9fb3c9;
  --accent: #84a0c6;
  --button-bg: rgba(22, 27, 37, 0.88);
  --button-border: rgba(132, 151, 174, 0.25);
}

html[data-theme="doomone"] {
  --page-bg: #282c34;
  --container-bg: rgba(40, 44, 52, 0.50);
  --container-border: rgba(224, 108, 117, 0.22);
  --text: #abb2bf;
  --muted: #828997;
  --link: #e06c75;
  --link-hover: #e5c07b;
  --heading: #61afef;
  --accent: #c678dd;
  --button-bg: rgba(40, 44, 52, 0.88);
  --button-border: rgba(224, 108, 117, 0.25);
}

html[data-theme="midnightPurple"] {
  --page-bg: #090611;
  --container-bg: rgba(20, 11, 33, 0.50);
  --container-border: rgba(155, 89, 255, 0.24);
  --text: #eadfff;
  --muted: #ad9fc2;
  --link: #c084fc;
  --link-hover: #e0b3ff;
  --heading: #d8b4fe;
  --accent: #9333ea;
  --button-bg: rgba(20, 11, 33, 0.88);
  --button-border: rgba(155, 89, 255, 0.27);
}

/* =========================================================
   PAGE
   ========================================================= */

* {
  box-sizing: border-box;
}

/* =========================================================
   PAGE
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  margin: 0;

  color: var(--text);
  font-family: "Macondo Swash Caps", cursive;
  font-size: 22px;
  line-height: 1.65;

  /*
   * IMPORTANT:
   * Do NOT put the GIF on body.
   * The dedicated fixed pseudo-element below is now the
   * background layer.
   */
  background: var(--page-bg);

  overflow-x: hidden;
  position: relative;
}


/* =========================================================
   FULL-PAGE GIF BACKGROUND
   ========================================================= */

/*
 * The GIF is deliberately separated from the body/content.
 *
 * position: fixed
 *     = attached to the viewport rather than document flow
 *
 * inset: 0
 *     = fills every edge of the viewport
 *
 * pointer-events: none
 *     = can never interfere with links/buttons
 *
 * z-index: 0
 *     = behind the actual page
 *
 * This fixes the little rectangular/background gaps that
 * can occur when the background is painted by <body>.
 */

body::before {
  content: "";

  position: fixed;
  inset: 0;

  width: 100vw;
  height: 100vh;

  background-color: var(--page-bg);

  background-image:
    url("https://cdn.imgchest.com/files/fa61adf05238.gif");

  background-repeat: repeat;

  background-position: 0 0;

  /*
   * Keep the original tile size.
   */
  background-size: 180px 180px;

  pointer-events: none;

  z-index: 0;
}


/*
 * Everything that belongs to the actual website sits above
 * the GIF.
 */

.page-shell {
  position: relative;
  z-index: 1;
}

.theme-control {
  position: fixed;
  z-index: 1000;
}





/* =========================================================
   CONTAINER
   ========================================================= */

.page-shell {
  position: relative;
  z-index: 1;

  width: min(1100px, calc(100% - 32px));
  margin: 40px auto 70px;
  padding: 42px 48px;

  /* 33% transparent = 67% opaque */
  background: rgba(20, 14, 22, 0.67);

  border: 1px solid rgba(255, 218, 185, 0.20);
  border-radius: 22px;

  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.55),
    0 0 35px rgba(220, 20, 60, 0.08);

  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}


/* =========================================================
   MARKDOWN
   ========================================================= */

.markdown-content {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.markdown-content p {
  margin: 0.75em auto;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  color: var(--heading);
  margin: 1.35em auto 0.55em;
  line-height: 1.25;
}

.markdown-content h3 {
  font-size: 1.25em;
}

.markdown-content strong {
  color: inherit;
}

.markdown-content a {
  color: var(--link);
  text-decoration: none;

  transition:
    color 0.18s ease,
    text-shadow 0.18s ease;
}

.markdown-content a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-shadow: 0 0 10px var(--link-hover);
}

.markdown-content a:visited {
  color: var(--link);
}

.markdown-content img {
  display: block;

  width: auto;
  max-width: min(100%, 760px);

  height: auto;

  margin: 22px auto;

  border-radius: 12px;
}

/* =========================================================
   FIRST TWO GIFS
   ========================================================= */

/*
   The JavaScript adds .first-two-gifs to exactly the
   first two GIFs.

   450px is 3× the original 150px size.
*/

.markdown-content img.first-two-gifs {
  display: block;

  width: 450px !important;
  max-width: 100% !important;

  height: auto !important;

  margin: 16px auto;
}

/* =========================================================
   THEME CONTROL
   ========================================================= */

.theme-control {
  position: fixed;
  top: 16px;
  right: 16px;

  z-index: 1000;
}

.theme-button {
  appearance: none;

  border: 1px solid var(--button-border);
  border-radius: 999px;

  padding: 8px 13px;

  color: var(--text);
  background: var(--button-bg);

  font-family: inherit;
  font-size: 15px;

  cursor: pointer;

  opacity: 0.72;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.theme-button:hover,
.theme-button[aria-expanded="true"] {
  opacity: 1;
  transform: translateY(-1px);
}

.theme-menu {
  position: absolute;

  top: calc(100% + 8px);
  right: 0;

  width: 185px;
  max-height: min(70vh, 500px);

  overflow-y: auto;

  padding: 7px;

  border: 1px solid var(--button-border);
  border-radius: 14px;

  background: var(--button-bg);

  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.32);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.theme-menu[hidden] {
  display: none;
}

.theme-menu button {
  display: block;

  width: 100%;

  border: 0;
  border-radius: 9px;

  padding: 8px 10px;

  color: var(--text);
  background: transparent;

  font-family: inherit;
  font-size: 16px;
  text-align: left;

  cursor: pointer;

  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.theme-menu button:hover,
.theme-menu button.active {
  color: var(--link);

  background: color-mix(
    in srgb,
    var(--accent) 14%,
    transparent
  );
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {

  body {
    font-size: 19px;
    background-size: 140px 140px;
  }

  .page-shell {
    width: calc(100% - 18px);

    margin: 25px auto 45px;

    padding: 28px 18px;

    border-radius: 16px;
  }

  .markdown-content img {
    max-width: 100%;
  }

  /*
    Still 3× the 125px mobile base size.
  */
  .markdown-content img.first-two-gifs {
    width: 375px !important;
    max-width: 100% !important;
  }

  .theme-control {
    top: 10px;
    right: 10px;
  }

  .theme-button {
    font-size: 14px;
    padding: 7px 11px;
  }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}