/* SMOOTHER SCROLL */
html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;

  /* PADDING FOR FOOTER */
  padding: 0 0 70px; 
  line-height: 1.6;
  background-color: #f4f8f8;
  color: #0b0b0b; 
  overflow-x: hidden;

/* PAGE FADE */
main {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

*:focus {
  outline: 3px solid #0a8178;
  outline-offset: 2px;
}

a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #0a8178;
  outline-offset: 2px;
}

/* SIDEBAR*/
.sidebar-overlay {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 998;
}

.menu-toggle:checked ~ .sidebar-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* DIF BACKGROUND FOR HOMEPAGE + QUIZ ONLY */
.pale-bg {
  background-color: #f2fcfc; 
}

/* HEADER */
header {
  background-color: #06403b; 
  color: #ffffff;
  padding: 0.5em 1em;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 997;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* TOP BAR MENU */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/*REMOVED HOME LOGO BUT SAVING FOR REFERENCE
.home-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  background-color: #ffffff;
  color: #06403b;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.home-logo:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
*/

/* HIDE MENU CHECKBOX */
.menu-toggle {
  display: none;
}

/* MENU ICON*/
.menu-icon {
  font-size: 1.6rem;
  cursor: pointer;
  user-select: none;
  padding: 4px 10px;
  border-radius: 6px;
  border: 2px solid #ffffff;
  color: #ffffff;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.menu-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/*HEADER FORMATS`*/
h1 {
  margin: 0;
  font-size: 1.2rem;
  color: #ffffff;
  flex: 1;
  text-align: center;
}

h2,
h3 {
  color: #02201d; 
}

/* NAVBAR - SIDEBAR MENU */
nav#main-nav {
  background-color: #06403b; 
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  padding: 20px 0;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

/* SIDEBAR*/
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 10px;
}

.sidebar-title {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0;
}

.sidebar-close {
  background: none;
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* NAV */
nav#main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav#main-nav ul li a {
  display: block;
  padding: 15px 25px;
  text-decoration: none;
  color: #ffffff; 
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 1rem;
  transition: background-color 0.2s ease, padding-left 0.2s ease;
}


nav#main-nav ul li a.active {
  font-weight: bold;
  background-color: #075c55;
  border-left: 4px solid #0a8178;
  padding-left: 30px;
}

/* HOVER NAV LINKS */
nav#main-nav ul li a:hover {
  background-color: #075c55;
  padding-left: 30px;
}

nav#main-nav ul li a.active:hover {
  background-color: #0a8178;
}

header .menu-toggle:checked ~ #main-nav {
  transform: translateX(0);
}

/* BACK TO TOP BUTTON */
.back-to-top {
  position: fixed;
  bottom: 90px;
  right: 20px;
  background-color: #06403b;
  color: #ffffff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  z-index: 996;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: #0a8178;
  transform: translateY(-5px);
}

.back-to-top:active {
  transform: translateY(-2px);
}

/* MAIN CONTENT LAYOUT */
main {
  padding: 80px 16px 40px;
  margin-top: 20px;
}

/* SECTIONS */
section {
  padding: 16px 0;
  max-width: 800px;
  margin: 0 auto;
}

main a {
  color: #06403b;
}

main a:hover {
  text-decoration: underline;
}

/* MAY NOT BE IN FINAL PROJ, IDK SAVING FOR REFERENCE*/
.hero-image {
  margin: 16px 0;
  text-align: center;
}

.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}


.content-image {
  margin: 16px 0;
  text-align: center;
}

.content-image img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* IMAGE CAPTIONS */
figure figcaption {
  font-size: 0.9rem;
  color: #222222;
  margin-top: 4px;
}

/* CODE EXAMPLES*/
pre {
  background-color: #e7f2f2;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.9rem;
  border-left: 4px solid #0a8178;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  line-height: 1.5;
}

code {
  font-family: 'Courier New', Courier, monospace;
  background-color: #e7f2f2;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
}

pre code {
  background-color: transparent;
  padding: 0;
}


dl {
  margin: 0;
}

dt {
  font-weight: bold;
  margin-top: 10px;
}

dd {
  margin: 0 0 8px 0;
}

/* FORMS & QUIZ */
form {
  max-width: 800px;
  margin: 0 auto 2rem;
}

fieldset {
  border: 1px solid #5f9e99;
  border-radius: 4px;
  padding: 12px 16px 16px;
  margin-bottom: 16px;
}

legend {
  font-weight: bold;
  padding: 0 4px;
}

label {
  display: inline-block;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  max-width: 100%;
  padding: 8px;
  margin-top: 4px;
  margin-bottom: 8px;
  border: 1px solid #5f9e99;
  border-radius: 4px;
  box-sizing: border-box;
}

input[type="radio"],
input[type="checkbox"] {
  margin-right: 6px;
}

/* BUTTONS */
button,
input[type="submit"],
input[type="reset"] {
  background-color: #06403b;
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* BUTTON HOVER */
button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background-color: #0a8178;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* QUIZ STYLES */
.quiz-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.question-feedback {
  margin-top: 6px;
  font-weight: bold;
}

.question-feedback.correct {
  color: #0e7a2a;
}

.question-feedback.incorrect {
  color: #b02020;
}

#overall-result,
#total-score {
  font-weight: bold;
  margin-top: 4px;
}

/* FOOTER */
footer {
  background-color: #0a8178;
  color: white;
  text-align: center;
  padding: 10px;
  position: fixed;
  width: 100%;
  bottom: 0;
  left: 0;
}

footer a {
  color: #ffffff;
  text-decoration: underline;
}

/* EXTRA FOOTER SPACE ON SMALL SCREENS */
@media (max-width: 600px) {
  body {
    padding-bottom: 90px;
  }

  h1 {
    font-size: 1rem;
  }

  .back-to-top {
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    bottom: 80px;
    right: 15px;
  }
}

/* TABLET OPTIMIZATION */
@media (min-width: 601px) and (max-width: 1024px) {
  nav#main-nav {
    width: 320px;
  }

  main {
    padding: 90px 24px 40px;
  }
}

/* LARGE SCREEN OPTIMIZATION */
@media (min-width: 1025px) {
  section {
    max-width: 900px;
  }

  main {
    padding: 90px 32px 40px;
  }
}

/* PRINT STYLES */
@media print {
  header,
  footer,
  .back-to-top,
  .sidebar-overlay,
  nav#main-nav,
  .skip-link {
    display: none !important;
  }

  body {
    padding: 0;
    background: white;
    color: black;
  }

  main {
    padding: 0;
    margin: 0;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
    color: black;
  }

  section {
    page-break-inside: avoid;
  }
}

/* smooth scrolling */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* justify text */
main,
main p,
main li,
section,
section p,
article,
article p,
figure figcaption,
dd,
dt {
  text-align: justify;
  text-justify: inter-word;
}

/* navigation left-aligned */
header,
nav,#main-nav,
footer,
.menu-icon,
.home-logo,
nav#main-nav ul li a,
.back-to-top {
  text-align: left;
}

.references-list {
  max-width: 800px;
  line-height: 1.5;
  padding-left: 1.5rem;

  text-align: left !important;
  text-justify: auto !important;
}

.references-list li {
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;

  text-align: left !important;
}