/* --- Base Layout --- */
body {
  max-width: min(90%, 1200px);
  margin: 0 auto;
  padding: 5vw;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  font-family: Arial, sans-serif;
  line-height: 2.5;
  background-color: #ffffee;
}

/* --- Headings --- */
h1 {
  text-align: center;
  color: blue;
  font-size: clamp(2rem, 3vw, 3rem);
}

h2, h3, h4 {
  color: red;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

/* --- Images --- */
img {
  display: block;
  margin: 1rem auto;
  max-width: 100%;
  height: auto;
}

/* --- Math Spans --- */
span.math, span.mymath {
  font-family: "Times New Roman", Times, serif;
  font-size: 110%;
  font-style: italic;
}




/* --- KaTeX Responsive --- */
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

.katex-display > .katex {
  white-space: nowrap;
}

/* Mobile fix for KaTeX */
@media (max-width: 768px) {
  .katex-display {
    font-size: 0.95em;
  }
}



/* --- Colors --- */
.red, span.red {
  color: #ff0000;
}

span.redbig {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: #ff0000;
  text-decoration: underline;
}


span.blue{
color: #0000ff;
font-size: 130%;

}

/* --- Centering --- */
.center {
  text-align: center;
}

/* --- Figure Caption --- */
figcaption {
  text-align: center;
  color: blue;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
}

/* --- Boxed Section --- */
.boxed {
  border: 2px solid green;
  background-color: gold;
  color: red;
  padding: 1rem;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  line-height: 1.6;
  margin: 1.5rem 0;
}

/* --- Rotate Message --- */
#rotateMessage {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.95);
  color: #000;
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: bold;
  text-align: center;
  padding-top: 40vh;
  z-index: 10000;
}

#rotateMessage.show-rotate {
  display: block;
}

/* --- Small Screens --- */
@media (max-width: 600px) {
  body {
    padding: 4vw;
  }
}