html,
body {
  padding: 0;
  margin: 0;
  font-family: Inter;
  background-color: var(--bg-gray-dark);
  scroll-behavior: smooth;
  scroll-padding-top: 114px;
  line-height: 1.6;
}

/* Add offset for nav menu */
main {
  margin-top: 114px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  /* font-family: "Georgia", "Times Nwe Roman", serif; */
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

p {
  margin-bottom: 1rem;
}

/* ---- Nav Menu ---- */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  background-color: var(--bg-gray);
  z-index: 1000;
}

.topnav {
  position: fixed;
  top: 0;
  width: 100%;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.logoholder {
  display: flex;
  align-items: center;
}

.logo {
  margin-left: 1em;
  width: 7em;
}

.logo-text {
  font-size: 2.5rem;
  margin: 0;
  color: var(--primary-color);
  text-decoration: none;
  font-family: "Georgia", "Times Nwe Roman", serif;
}

.logo-text-link {
  text-decoration: none;
}

.topnav ul, .mobilenav ul {
  list-style: none;
  list-style-image: none;
  margin: 0;
  padding: 0;
}

.topnav ul {
  margin-right: 1em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.navlink {
  display: inline-block;
  color: var(--text-secondary);
  padding: 14px 16px;
  text-decoration: none;
  font-size: 1.2em;
  transition: 0.2s;
}

.navlink:hover {
  color: var(--primary-light);
  transform: scale(1.02);
}

/* ---- Mobile Nav ---- */
.mobilenav {
  position: fixed;
  right: -300px;
  top: 114px;
  height: 100vh;
  width: fit-content;
  background-color: var(--bg-gray);
  transition: right 0.3s ease-in-out;
  text-align: center;
  flex-direction: column;
}

.mobilenav.active {
  right: 0;
  display: flex;
}

.topnav .icon {
  display: none;
  color: var(--text-secondary);
  font-size: 24px;
  padding: 14px 16px;
  /* cursor: pointer; */
}

/* ---- Buttons ---- */
/* Base button */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.3s, background-color 0.3s, border-color 0.3s;
}

/* Variants */
.btn-primary {
  background-color: var(--primary-color);
  color: var(--primary-bg);
  /* padding: 3px 0; */
  border: 3px solid var(--primary-color);
  /* border: none; */
}

.btn-outline {
  border: 3px solid currentColor;
  background-color: transparent;
  color: var(--bg-dark);
}

.btn-outline-light {
  border: 3px solid var(--text-light);
  color: var(--text-light);
}

.btn:hover {
  transform: scale(1.05);
}

/* Mobile-specific versions (optional) */
.btn-mobile {
  display: block;
  margin: 0 2em 10px;
  text-align: center;
}

/* ---- Footer ---- */

footer {
  width: 100%;
  background-color: var(--primary-hover);
  text-align: center;
  /* bottom: 0px; */
  padding: 2% 0;
  box-sizing: border-box;
  color: var(--text-light);
}

/* ---- Animations ---- */
.fade-in {
  animation: fadeIn 1s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Responsive Section ---- */
@media (max-width: 1347px) {
  .topnav ul { display: none; }
  .topnav .icon { display: block; }
}

@media (min-width: 1348px) {
  .mobilenav.active { display: none; }
}

@media (max-width: 360px) {
  .topnav h1 {
    display: none;
  }
}

@media (max-height: 540px) {
  .logo {
    margin-left: 1em;
    width: 4em;
  }

  html,
  body {
    scroll-padding-top: 86px;
  }

  main {
    margin-top: 86px;
  }

  .btn-mobile {
    margin: 0 1em;
    padding: 3px 10px;
  }

  .btn {
    /* height: 40px; */
  }

  /* Make mobilenav a horizontal bar on very short viewports */
  .mobilenav {
    /* span the full width and sit under the header */
    position: fixed;
    left: 0;
    right: 0;
    top: 86px;          /* match the adjusted top you already use in this breakpoint */
    height: 50px;       /* allow the bar to size to content */
    width: 100%;
    padding: 0.25rem 0;
    display: flex;
    justify-content: center;
    /* background-color: var(--bg-gray-dark); */
    box-sizing: border-box;
    /* hide by default by moving it up; menu open will add .active to slide it down */
    transform: translateY(-120%); 
    transition: transform 0.3s ease;
    z-index: 999;
  }

  /* When the menu is opened (your JS toggles .active), slide the bar into view */
  .mobilenav.active {
    transform: translateY(0);
    display: flex;
  }

  /* Make the UL a horizontal flex row that can scroll if needed */
  .mobilenav ul {
    display: flex;
    flex-direction: row;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 0.5rem;
    width: 100%;
    /* overflow-x: auto;
    -webkit-overflow-scrolling: touch;  */
    white-space: nowrap;                  /* keep each link on one line */
  }

  /* ensure list items don't float/overflow */
  .mobilenav ul li {
    float: none !important;
    display: inline-block;
  }

  /* keep links compact and prevent wrapping */
  .mobilenav ul li a {
    display: inline-block;
    /* padding: 10px 12px; */
    white-space: nowrap;
    box-sizing: border-box;
  }

  /* optional: hide logo or large elements when in this compact bar */
  .mobilenav .logoholder,
  .mobilenav .logo {
    display: none;
  }

}