:root{
  --primary-color: #1d44b8;
  --accent-blue: #1d44b8;

  --nav-h: 48px;
  --footer-h: 54px;

  --scroll-top-gap: 20px;
  --scroll-bottom-gap: 10px;

  --fade-top: 120px;
  --fade-bottom: 120px;

  --start-fade: 80px; 
  --end-fade: 200px;

  --text-left: 10px;
  --text-right: 50px;
}

/* --------------------------------------------------
   Base transparency and background
-------------------------------------------------- */

html{
  background: #fff !important;
  /* scrollbar-gutter: stable;
  overflow-y: scroll; */
}

body,
main,
.contentDecree,
.decree{
  background: transparent !important;
}

/* --------------------------------------------------
   Full-width scroll image (back to how it was)
-------------------------------------------------- */

.contentDecree::before{
  content: "";
  position: absolute;
  inset: 0;
  background: url("/img/scroll-nobg.webp") no-repeat center top;
  background-size: 100% 100%;
  z-index: 0;
  pointer-events: none;
}

/* --------------------------------------------------
   Decree viewport - this controls both 
   image and text width. It is the outer container.
-------------------------------------------------- */

.contentDecree {
  position: fixed;
  isolation: isolate;
  left: 50%;
  transform: translateX(-50%);
  top: calc(var(--nav-h) + var(--scroll-top-gap));
  bottom: calc(var(--footer-h) + var(--scroll-bottom-gap));

  /* Change this to a max-width so it doesn't stretch infinitely */
  width: 95%;
  max-width: 1200px; 
  z-index: 2;
  overflow: hidden;
}

.contentDecree,
.contentDecree *{
  color: #000;
}

/* --------------------------------------------------
   Scrolling text - inner container inside of
   contentDecree
-------------------------------------------------- */

.decree {
  position: absolute; 
  z-index: 1;

  top: 0;         /* Keeps your top exactly where it is now */
  bottom: 67px;   /* Change this number to move the bottom text up/down. */ 
  height: auto; 

  left: 54%;
  transform: translateX(-50%);
  width: 65%; 
  max-width: 800px; 
  overflow-y: auto;

  padding-left: var(--text-left);
  padding-right: var(--text-right);

  padding-top: var(--fade-top);
  padding-bottom: var(--fade-bottom);
  scrollbar-width: none;
  -ms-overflow-style: none;

  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent var(--start-fade),
    black var(--end-fade), 
    black calc(100% - var(--fade-bottom)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent var(--start-fade),
    black var(--end-fade),
    black calc(100% - var(--fade-bottom)),
    transparent 100%
  );
}

.decree::-webkit-scrollbar{
  display: none;
}

.decree p {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: manual;
}

/* --------------------------------------------------
   Footer scroll controls
-------------------------------------------------- */

#scrollBar{
  position: fixed;
  inset: auto 0 0 0;
  height: var(--footer-h);
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
  padding-bottom: env(safe-area-inset-bottom);
  background: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  z-index: 1001;
}

/* --------------------------------------------------
   Controls
-------------------------------------------------- */

.slider-controls{
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-resizer label,
#speedValue{
  white-space: nowrap;
}

/* --------------------------------------------------
   SLIDERS
-------------------------------------------------- */

#scrollBar input[type="range"]{
  appearance: none;
  width: 120px;
  height: 8px;
  cursor: pointer;
  --fill: 0%;
  border-radius: 5px;

  background: linear-gradient(
    to right,
    var(--primary-color) 0%,
    var(--primary-color) var(--fill),
    #666 var(--fill),
    #666 100%
  );
}

#scrollBar input[type="range"]::-webkit-slider-runnable-track{
  height: 8px;
  background: transparent;
  border-radius: 5px;
}

#scrollBar input[type="range"]::-webkit-slider-thumb{
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border: 2px solid #fff;
  border-radius: 50%;
  margin-top: -5px;
}

#scrollBar input[type="range"]::-moz-range-track{
  height: 8px;
  background: #666;
  border-radius: 5px;
}

#scrollBar input[type="range"]::-moz-range-progress{
  height: 8px;
  background: var(--primary-color);
  border-radius: 5px;
}

#scrollBar input[type="range"]::-moz-range-thumb{
  width: 18px;
  height: 18px;
  background: var(--primary-color);
  border: 2px solid #fff;
  border-radius: 50%;
}

/* --------------------------------------------------
   BUTTONS
-------------------------------------------------- */

#incrementSpeed,
#decrementSpeed{
  width: 30px;
  height: 30px;
  background: #3f3f3f;
  border: 1px solid #666;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  padding: 0;
}

#incrementSpeed::before,
#decrementSpeed::before{
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
}

#incrementSpeed::before{
  border-bottom: 10px solid #fff;
}

#decrementSpeed::before{
  border-top: 10px solid #fff;
}

#scrollBar #incrementSpeed,
#scrollBar #decrementSpeed{
  width: 34px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid #666;
  border-radius: 3px;
  color: var(--primary-color);
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

#scrollBar #incrementSpeed:hover,
#scrollBar #decrementSpeed:hover{
  background: var(--primary-color);
  color: #fff;
}

#scrollToggle{
  height: 30px;
  padding: 0 12px;
  background: #3f3f3f;
  border: 1px solid #666;
  border-radius: 3px;
  color: #fff;
  cursor: pointer;
}

#scrollToggle:hover{
  background: var(--primary-color);
}

/* --------------------------------------------------
   RESPONSIVE
-------------------------------------------------- */

@media (max-width: 800px) {
  /* Stack the two control blocks (scroll speed, then font size) */
  #scrollBar {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    height: auto;
    padding: 10px 0;
  }

  /* Scroll Speed controls: label centered over the SLIDER, not the whole group */
  .slider-controls {
    display: grid;
    grid-template-columns: auto 140px auto auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      ". label . ."
      "dec slider inc start";
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
  }

  .slider-controls label {
    grid-area: label;
    justify-self: center;
    white-space: nowrap;
    font-size: 14px;
    text-align: center;
  }

  #decrementSpeed { grid-area: dec; }
  #scrollSpeed { grid-area: slider; width: 140px; }
  #incrementSpeed { grid-area: inc; }
  #scrollToggle { grid-area: start; }

  /* Keep font size block below */
  .font-resizer {
    display: flex;
    align-items: center;
    gap: 10px;
  }
}

/* Phones - keep text inside the scroll "paper" */
@media (max-width: 600px) {
  .decree {
    /* 1. Center the container perfectly */
    width: 90%; 
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;

    padding-left: 95px; 
    padding-right: 70px;
  }

  .decree p {
    font-size: inherit; 
    line-height: 1.4;
   }
}

@media (max-width: 420px) {
  /* ---- Layout + spacing tuned for real phones ---- */
  :root{
    --text-left: 65px;
    --text-right: 45px;

    --fade-top: 30px;
    --fade-bottom: 85px;

    /* move fade down */
    --start-fade: 80px;
    --end-fade: 160px;
  }

  /* ---- Decree scroll area ---- */
  .decree{
    width: 92%;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;

    padding-left: var(--text-left);
    padding-right: var(--text-right);

    /* Slightly more vertical room so fade feels natural */
    bottom: 58px;
  }

  /* ---- Text readability ---- */
  .decree p{
    line-height: 1.4;
  }

  /* ---- Footer controls stack cleanly ---- */
  #scrollBar{
    height: auto;
    padding: 10px 0;
  }
}


/* --------------------------------------------------
   Misc
-------------------------------------------------- */

.extraSpace{
  padding-top: 200px;
}

.colorChange a {
  text-decoration: none;
  color: #000 !important; /* Forces it to be black initially */
}

.colorChange a:hover {
  color: var(--primary-color) !important;
}
