/* Light & Dark Mode Variables */
:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --timeline-line-color: #e0e0e0;
  --timeline-item-bg: #f9f9f9;
  --card-bg: #f1f1f1;
  --link-color: #007bff;
  --text-color-muted: #6c757d;
  --header-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  --content-overlay-bg: rgba(255, 255, 255, 0.85);
  --theme-gh-size: 40px
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --timeline-line-color: #444444;
  --timeline-item-bg: #2a2a2a;
  --card-bg: #333;
  --link-color: #61dafb;
  --text-color-muted: #adb5bd;
  --header-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  --content-overlay-bg: rgba(26, 26, 26, 0.85);
}

/* Theme Switcher Button */
.theme-switcher {
  /* Position, top, right, and z-index are GONE */
  width: var(--theme-gh-size);
  height: var(--theme-gh-size);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--timeline-line-color);
  border-radius: 8px;
  cursor: pointer;
}

/* General Body Styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

html {
  scroll-padding-top: 120px; /* Adjust this value to match your header's height */
  scroll-behavior: smooth; /* Optional: Adds a nice smooth scroll effect */
}

main {
  padding: 2em;
}


/* Campaign List on Homepage */
/* Update campaign card to use Flexbox */
.campaign-card {
  display: flex;
  align-items: center; /* Vertically centers the icon and text */
  gap: 1.5em; /* Creates space between the icon and text */
  background-color: var(--card-bg);
  border: 1px solid var(--timeline-line-color);
  padding: 1.5em;
  margin-bottom: 1em;
  border-radius: 8px;
}

/* Style for the campaign icon */
.campaign-icon {
  width: 120px;
  height: 120px;
  flex-shrink: 0; /* Prevents the icon from shrinking if text is long */
  border-radius: 5px; /* Optional: rounds the corners of the icon */
}
.campaign-card h2 a {
    color: var(--link-color);
    text-decoration: none;
}

/* Add a subtle grow effect when hovering over the linked icon */
.campaign-card a .campaign-icon {
  transition: transform 0.2s ease-in-out;
}

.campaign-card a:hover .campaign-icon {
  transform: scale(1.15); /* Makes the icon slightly larger on hover */
}

/* Styling for GM groups on the homepage */
.gm-group {
  margin-bottom: 2.5em;
}

.gm-group h3 {
  display: flex;
  align-items: baseline; /* Aligns the text nicely */
  gap: 0.6em; /* Creates space between the label and the name */
  font-size: 1.8em;
  font-weight: 400; /* A neutral weight for the name */
  border-bottom: 1px solid var(--timeline-line-color);
  padding-bottom: 0.5em;
  margin-bottom: 1.5em;
}

/* Style the "Gamemaster:" label */
.gm-label {
  font-size: 0.6em; /* Makes the label smaller */
  font-weight: 700; /* Makes the label bolder */
  text-transform: uppercase; /* Makes it all caps */
  color: var(--text-color-muted);
}

/* Style for the GM search box on the homepage */
#homeSearch {
  width: 100%;
  padding: 12px;
  margin: 1em 0;
  box-sizing: border-box; /* Important for width calculation */
  font-size: 1rem;
  border: 1px solid var(--timeline-line-color);
  border-radius: 8px;
  background-color: var(--card-bg);
  color: var(--text-color);
}

/* -- New, Simplified Vertical Timeline Style -- */
.timeline {
  position: relative;
  max-width: 750px;
  margin: 0 auto;
  padding: 2em 0;
}

/* The central line on the left side */
.timeline::after {
  content: '';
  position: absolute;
  width: 4px;
  background-color: var(--timeline-line-color);
  top: 0;
  bottom: 0;
  left: 30px;
  margin-left: -2px;
}

/* Each timeline item container */
.timeline-item {
  padding: 10px 0 20px 70px; /* Creates space to the left of the line */
  position: relative;
}

/* The circle on the timeline */
.timeline-item::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 30px; /* Aligns the circle with the line */
  background-color: var(--bg-color);
  border: 4px solid var(--timeline-line-color);
  top: 25px;
  border-radius: 50%;
  z-index: 1;
  margin-left: -10px; /* Centers the circle on the line */
}


/* Adjust the timeline header to make space for the button and be sticky */
.timeline-header {
  /* Sticky Positioning */
  position: -webkit-sticky; /* For Safari */
  position: sticky;
  top: 0;
  z-index: 50;

  /* Appearance */
  background-color: var(--bg-color);
  box-shadow: var(--header-shadow);

  /* Layout & Spacing (Updated) */
  padding: 20px 50px; /* Vertical padding to clear theme button */
  text-align: center;
  margin-bottom: 2em; 
  /* margin-top has been removed */
}

/* The content card */
.timeline-content {
  padding: 20px 30px;
  background-color: var(--timeline-item-bg);
  position: relative;
  border-radius: 6px;
  border: 1px solid var(--timeline-line-color);
}

.timeline-header h1 {
  margin: 0;
  font-size: 2.5em; /* Make the font larger */
}

/* Header for each entry in the timeline */
.timeline-entry-header {
  text-align: center;
  margin-bottom: 1em;
}

.timeline-entry-header h2 {
  margin: 0;
  font-size: 2.5em; /* A nice size for the entry title */
  line-height: 1.2;
}

.timeline-entry-header .timeline-date {
  display: block; /* Puts the date on its own line below the title */
  margin-left: 0; /* Removes the old spacing that broke centering */
  font-size: 0.9em;
  color: var(--text-color-muted);
  font-style: italic;
}

/* Reposition the back button to the left */
.back-button {
  position: absolute;
  left: 15px;    /* Give it some space from the edge */
  top: 15px;     /* Align it with the other top buttons */
  
  display: inline-block;
  padding: 8px 12px;
  background-color: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--timeline-line-color);
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.2s;
}


.back-button:hover {
  background-color: var(--timeline-item-bg);
}

/* Styling for pages with a background image */
body.page-with-background {
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
}

/* Creates a semi-transparent overlay for the main content */
.page-with-background main {
  background-color: var(--content-overlay-bg);
  border-radius: 8px;
  padding: 1em 2em;
  margin: 0 auto;
  max-width: 900px; /* Or another width you prefer */
}

/* Container for top navigation buttons */
.top-nav {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 100;
  display: flex;
  gap: 10px;
}

/* Set color for the link AND its visited state to override browser purple */
.github-link,
.github-link:visited {
  color: var(--text-color);
}

/* Style the button container */
.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--theme-gh-size);
  height: var(--theme-gh-size);

  background-color: var(--card-bg);
  border: 1px solid var(--timeline-line-color);
  border-radius: 8px;
  transition: background-color 0.2s;
}

.github-link:hover {
  background-color: var(--timeline-item-bg);
}

/* Set the icon size directly */
.github-link svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

/* -- Table of Contents -- */
.toc {
  position: fixed;
  left: 20px;
  top: 150px;
  width: 220px;
  font-size: 0.9em;

  /* New styles for the background */
  background-color: var(--content-overlay-bg);
  padding: 1em;
  border-radius: 8px;
}

.toc ul {
  list-style: none;
  padding-left: 10px;
  border-left: 2px solid var(--timeline-line-color);
}

.toc li {
  margin-bottom: 0.5em;
}

.toc a {
  color: var(--text-color-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.toc a:hover {
  color: var(--text-color);
}

/* Style for the currently active link */
.toc a.active {
  color: var(--link-color);
  font-weight: bold;
  transform: translateX(5px);
}
