:root {
  --chart-w: 1000px;
  --chart-h: 600px;
  --ground-h: 40px;
  --bg: #fbf6ee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
  background: var(--bg);
  background-image: url("../assets/chap4bg.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: #4a372c;
  margin: 0;
  padding: 20px 0 0 0; /* top padding for header */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto; /* allow scrolling if needed */       
}

.nav-toggle-button {
    position: fixed;
    top: 20px;
    right:-15px;
    z-index: 1000;
    background-color: transparent; 
    color: transparent; 
    font-size: 0;
    width: 100px;
    height: 50px;
    border: none;
    border-radius: 5px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.nav-toggle-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.nav-toggle-button:hover {
    transform: scale(1.05);
}

.nav-wrapper {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 300px;
    background-color: rgba(30, 30, 30, 0.5); 
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1); 
    z-index: 999;
    transform: translateX(300px); 
    transition: transform 0.4s ease-in-out;
    padding-top: 80px; /* Space for the top toggle button */
}

/* State to show the menu */
.nav-wrapper.open {
    transform: translateX(0); 
}

.bookmark {
    width: 100%;
    padding: 10px 15px; 
    border-radius: 4px;
    text-align: left;
    display: block; 
    text-decoration: none; 
    color: #ffcc70; 
    transition: background-color 0.2s ease, transform 0.2s ease;
}

/* Create the Bullet Point (using pseudo-element) */
.bookmark span::before {
    content: '•'; /* The bullet character */
    color: #ffcc70; /* Bullet color */
    font-size: 1.2em;
    margin-right: 15px; /* Space between bullet and text */
    display: inline-block;
    width: 15px; /* Give it a fixed width for alignment */
}

.bookmark:hover {
    background-color: rgba(255, 204, 112, 0.25);
    transform: scale(1.05);
}

.bookmark span {
    opacity: 1; 
    color: #f7e2b3;
    font-weight: normal;
    font-size: 13px;
    display: inline; 
}


.header-image {
  text-align: center;
  width: 100%;
  max-width: 600px;
  z-index: 10;
}

.header-image img {
  max-width: 100%;
  height: auto;
  max-height: 60px; /* adjust as needed */
}

.scroll-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #f7e2b3;
  font-size: 16px;
  opacity: 1;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.5s ease, transform 1s ease-in-out;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-8px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

.scroll-hint.active {
  opacity: 1;
  pointer-events: auto;
}

.page {
  display: flex;
  gap: 40px;
  align-items: flex-start; /* align to top, not center */
  justify-content: center;
  width: 100%;
  max-width: 1500px; /* adjust as needed */
  padding: 0 20px;
}

/* STORY PANEL */
.story {
  width: 380px;
  height: 700px;
  position: relative;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-item {
  opacity: 0;
  transition: opacity 0.8s ease;
  position: absolute;
  width: 200%;
  padding-right: 150px;
}

.story-item.active {
  opacity: 1;
  transform: translateY(0);
}

.story-text {
  width: 200%;
  max-width: 630px; /* same width as your story box */
  display: block;
  margin: 0 auto;
  object-fit: contain;
  padding-left: 150px;
}

/* CHART */
.chart-wrap { 
  width: var(--chart-w); 
  height: auto;
  position: relative; 
  padding-top: 100px;
}

#chart {
  position: relative;
  width: var(--chart-w);
  height: var(--chart-h);
  overflow: visible;
}

.y-axis { 
  position: absolute; 
  left: 12px; 
  top: 0; 
  bottom: var(--ground-h); 
  width: 40px; 
  z-index: 99;
  pointer-events: auto; 
}

.y-mark {
  position: absolute;
  right: 0;
  transform: translateY(50%);
  color: antiquewhite;
  font-size: 13px;
  font-style: italic;
  opacity: 0.9;
  z-index: 10px;
}

.y-axis-label {
  position: absolute;
  left: -30px; 
  top: 0%;
  transform: translateY(-50%) rotate(-90deg);
  color: antiquewhite;
  font-weight: bold;
  font-size: 14px;
  text-transform: uppercase;
}

/* Add this new block for the SVG container */
#grid-lines {
  position: absolute;
  left: 80px;
  right: 0;
  bottom: var(--ground-h);
  color: grey;
  top: 20px;
  overflow: visible;
  pointer-events: none;
}

/* Update y-axis to accommodate the label better */
.y-axis {
  left: 50px;
  top: 0;
  bottom: var(--ground-h);
  width: 40px;
  pointer-events: auto;
}

/* TREES container */
#trees {
  position: absolute;
  left: 80px;
  right: 80px;
  bottom: var(--ground-h);
  top: 20px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 10px;
  z-index: -5px;
}

.tree {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* BASE TREE IMAGE STYLE */
.tree-img {
  width: 150px;              /* base width */
  height: auto;              /* let it scale naturally */
  object-fit: contain;
  transform-origin: bottom center;
  transition: transform 0.8s ease;
  display: block;
}

/* MANUAL SIZES AND POSITIONS */
#tree-general .tree-img { width: 208px; }
#tree-marfan .tree-img { width: 150px; }
#tree-pws .tree-img { width: 115px; }
#tree-oi .tree-img { width: 150px; }

.tree-label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  color: antiquewhite;
  z-index: 10;
}

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ground-h);
  background: linear-gradient(#936a5b, #4d2d12);
  border-top: 3px solid rgba(120, 90, 60, 0.12);
  box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.03);
  z-index: 1;
}

.music-toggle {
  position: fixed;
  top: 20px;
  right: 100px; /* to the left of nav-toggle (which is at right: -15px) */
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  z-index: 1000;
  padding: 0;
  width: auto;
  height: auto;
  outline: none;
  -webkit-tap-highlight-color: transparent; /* removes tap highlight on mobile */
}

.next-button {
  position: fixed;
  bottom: 40px;
  right: -30px;
  width: 140px;
  height: 125px;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 1;
  visibility: visible;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s ease;
  z-index: 100;
  padding: 0;
  outline: none;
}

.next-button:hover {
  opacity: 0.9; /* or apply a filter if you prefer */
}

.next-btn-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.next-button:hover {
  /* Scale the button up by 10% (1.1) */
  transform: scale(1.2);
  /* Slightly increase the opacity for emphasis (optional, you already have one) */
  opacity: 1; 
}
.next-button {
  position: fixed;
  bottom: 40px;
  right: -30px;
  width: 140px;
  height: 125px;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0; /* Start hidden */
  visibility: visible;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s ease;
  z-index: 100;
  padding: 0;
  outline: none;
}

.next-button.show {
    opacity: 1;
    pointer-events: auto; /* Re-enables clicks */
}

.next-button:hover {
  opacity: 0.9; /* or apply a filter if you prefer */
}

.next-btn-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.next-button:hover {
  /* Scale the button up by 10% (1.1) */
  transform: scale(1.2);
  /* Slightly increase the opacity for emphasis (optional, you already have one) */
  opacity: 1; 
}
