:root {
  /* Colors extracted from the cover image gradient */
  --journal-blue: #1b4b9b;
  --journal-cyan: #3fb7c6;
  --journal-pink: #d8689c;
  --journal-orange: #ff8c42;
  --gradient-brand: linear-gradient(
    135deg,
    var(--journal-blue),
    var(--journal-cyan),
    var(--journal-pink),
    var(--journal-orange)
  );

  --text-main: #333333;
  --text-muted: #666666;
  --bg-light: #f8f9fa;
  --border-color: #eaeaea;

  --font-heading: "Lora", serif; /* Classic academic serif */
  --font-ui: "Inter", sans-serif; /* Clean sans-serif for UI elements */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-heading);
  color: var(--text-main);
  line-height: 1.6;
  background-color: #ffffff;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

a {
  color: var(--journal-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--journal-pink);
}

/* Header Styles */
.header-top {
  background-color: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 8px 0;
}

.header-top .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Removes the wrapper from the layout block so children can stick to the viewport */
.site-header {
  display: contents;
}

/* Apply sticky positioning ONLY to the main navigation bar */
.header-main {
  padding: 20px 0;
  background: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 999;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--journal-blue);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  margin-right: 20px;
}

/* FIX 1: Restrict flex layout ONLY to the main nav container, not the dropdown */
#nav-links {
  list-style: none;
  display: flex;
  gap: 25px;
  align-items: center;
  font-family: var(--font-ui);
  font-weight: 500;
}

.main-nav a {
  color: var(--text-main);
  white-space: nowrap;
}

.main-nav a:hover {
  color: var(--journal-blue);
}

.btn-submit {
  background: var(--journal-blue);
  color: white !important;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.btn-submit:hover {
  background: var(--journal-cyan);
  color: white !important;
}

.btn-primary {
  display: inline-block;
  background-color: var(--journal-blue);
  color: white !important;
  padding: 10px 24px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.btn-primary:hover {
  background-color: #123470; /* Slightly darker navy */
}

.btn-outline {
  display: inline-block;
  border: 2px solid var(--journal-blue);
  color: var(--journal-blue) !important;
  padding: 8px 24px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background-color: var(--journal-blue);
  color: white !important;
}

/* Footer Styles */
.site-footer {
  background-color: var(--bg-light);
  border-top: 1px solid var(--border-color);
  margin-top: 60px;
  padding-top: 40px;
  font-family: var(--font-ui);
}

.footer-container {
  display: grid;
  /* Strictly enforce 3 columns, giving the text column more breathing room */
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 50px;
  margin-bottom: 40px;
}

/* Ensure the columns stack neatly on top of each other on mobile devices */
@media (max-width: 900px) {
  .footer-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

.footer-section h4 {
  font-family: var(--font-heading);
  color: var(--journal-blue);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 8px;
}

.footer-bottom {
  background-color: var(--journal-blue);
  color: white;
  text-align: center;
  padding: 15px 0;
  font-size: 0.9rem;
}

/* --- Desktop Dropdown Styling --- */
.nav-dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 220px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  list-style: none;
  padding: 10px 0;
  z-index: 200;
}

/* Show dropdown on hover for desktop */
@media (min-width: 769px) {
  .nav-dropdown:hover .dropdown-menu {
    display: block;
  }
}

.dropdown-menu li {
  width: 100%;
}

.dropdown-menu li a {
  display: block;
  padding: 10px 20px;
  color: var(--text-main);
  text-transform: none;
}

.dropdown-menu li a:hover {
  background-color: var(--bg-light);
  color: var(--journal-blue);
}

/* --- Mobile Menu Toggle UI --- */
.mobile-menu-toggle {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  color: var(--journal-blue);
  font-family: var(--font-ui);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap; /* Allows the menu to drop below the logo */
  }

  .mobile-menu-toggle {
    display: block; /* Show the hamburger button */
  }

  .main-nav {
    width: 100%;
    order: 3; /* Forces the nav container below the top bar */
  }

  /* Hide the list by default on mobile */
  #nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    padding: 20px 0;
    align-items: flex-start;
  }

  /* CRITICAL: This responds to script.js toggling the .active class */
  #nav-links.active {
    display: flex;
  }

  /* FIX 2: Use ">" so padding and borders only apply to the main level links, protecting the dropdown */
  #nav-links > li {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
  }

  .btn-submit {
    display: inline-block;
    margin-top: 15px;
  }

  /* FIX 3: Force static positioning so the expanded dropdown smoothly pushes the "Submit" button down */
  .dropdown-menu {
    position: static !important;
    box-shadow: none;
    border: none;
    background: var(--bg-light);
    width: 100%;
    padding-left: 20px;
    margin-top: 10px;
  }
}

/* --- SHARED PAGE LAYOUT (Grid & Sidebar) --- */
.grid-layout {
  display: grid;
  grid-template-columns: 7fr 3fr; /* Gives the main text plenty of reading room */
  gap: 50px;
}

.content-left {
  min-width: 0; /* Prevents wide text from blowing out the grid */
}

/* Ensure it stacks perfectly on mobile */
@media (max-width: 900px) {
  .grid-layout {
    display: flex;
    flex-direction: column;
  }
}
