@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=Caveat&family=Press+Start+2P&display=swap');

/* Root variables and resets */
:root {
  /* Gameboy Advance inspired palette */
  --bg-color: #211d30;            /* dark backdrop */
  --primary-color: #5f4b8b;       /* purple for header and nav */
  --secondary-color: #7c6eb2;     /* lighter purple for hover states */
  --accent-color: #c697d8;        /* soft highlight */
  --text-color: #e5e5e5;          /* near-white text */
  --link-color: #bda6f3;          /* pastel purple links */
  --font-family: 'Inter', sans-serif;
  --heading-family: 'Press Start 2P', cursive;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--heading-family);
  color: var(--accent-color);
  margin-top: 0;
  text-transform: uppercase;
}

a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
.site-header {
  /* Use a solid background colour instead of the large swirl image to keep the header slim */
  background-color: var(--primary-color);
  background-size: cover;
  background-position: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  color: white;
}

/* The overlay darkens the canvas so text remains legible */
/* The overlay darkens the header background and contains the title and widgets.
 * Reduce the vertical padding for a slimmer header. */
/* Dark overlay on the header; reduced padding for a slimmer appearance */
.site-header .overlay {
  background-color: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 0;
  position: relative;
  z-index: 2;
}

/* Canvas for particle effects */
#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Smaller site title for a lower header height */
.site-header h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  color: #fff;
}

/* Smaller tagline */
.site-header .tagline {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: #eee;
}

/* Flex layout for header: place title on the left and widgets on the right */
.header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title {
  flex: 1 1 auto;
  min-width: 200px;
}

.header-widgets {
  display: flex;
  flex: 0 1 400px;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
}

/* Styling for header widgets (sunrise and tomtter). Use semi‑transparent backgrounds to stand out on the header. */
#header-sunrise-widget,
.tomtter-widget {
  background-color: rgba(95, 75, 139, 0.85);
  color: #fff;
  padding: 0.5rem;
  border-radius: 6px;
  width: 180px;
  max-width: 100%;
  font-size: 0.8rem;
}

#header-sunrise-widget h2,
.tomtter-widget h2 {
  margin: 0 0 0.25rem 0;
  font-size: 0.8rem;
  font-family: var(--heading-family);
  color: var(--accent-color);
  text-transform: uppercase;
}

#header-sunrise-widget p,
.tomtter-widget p {
  margin: 0;
  font-family: var(--font-family);
  font-size: 0.75rem;
  line-height: 1.4;
}

#header-sunrise-widget input[type="text"] {
  width: 3.5rem;
  padding: 0.25rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 0.75rem;
}

#header-sunrise-widget button {
  padding: 0.25rem 0.5rem;
  border: none;
  border-radius: 4px;
  background-color: var(--secondary-color);
  color: #fff;
  cursor: pointer;
  font-family: var(--heading-family);
  font-size: 0.6rem;
}

/* Ensure nav bar fits under the slimmer header without large top margin */
.main-nav {
  margin-top: 0;
}

/* Navigation */
/* Navigation bar */
.main-nav {
  background-color: var(--primary-color);
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav li {
  margin: 0;
}

 .main-nav a {
  display: block;
  padding: 0.5rem 1rem;
  color: #fff;
  font-weight: 600;
  font-family: var(--heading-family);
  font-size: 0.75rem;
}

.main-nav a:hover,
.main-nav a.active {
  background-color: var(--secondary-color);
}

/* Welcome section */
.welcome p {
  max-width: 80ch;
}

/* Latest posts */
.latest-posts .post-preview {
  border-bottom: 1px solid #ddd;
  padding: 1rem 0;
}

.post-preview:last-child {
  border-bottom: none;
}

.post-preview h3 {
  margin-bottom: 0.25rem;
}

.post-preview .post-meta {
  font-size: 0.9rem;
  color: #777;
  margin-top: 0.25rem;
}

/* Category grid */
.categories .category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.category-card {
  flex: 1 1 calc(50% - 1rem);
  background-color: #fff;
  border: 1px solid #e2d5c3;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.05);
}

.category-card h3 {
  margin-top: 0;
}

/* Micro posts */
.micro-post {
  border-left: 4px solid var(--secondary-color);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  background-color: #fff;
  border-radius: 4px;
}

/* Footer */
.site-footer {
  background-color: var(--primary-color);
  color: #fff;
  text-align: center;
  padding: 1rem 0;
}

.site-footer a {
  color: #ffd;
}

@media (max-width: 768px) {
  .main-nav ul {
    flex-direction: column;
  }
  .category-card {
    flex: 1 1 100%;
  }
  /* Adjust header and navigation styling for small screens */
  .site-header .overlay {
    padding: 0.5rem 0;
  }
  .site-header h1 {
    font-size: 1.5rem;
  }
  .site-header .tagline {
    font-size: 0.8rem;
  }
  .main-nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
  }
  /* Stack widgets vertically on small screens */
  .header-widgets {
    flex-direction: column;
    align-items: stretch;
  }
  #header-sunrise-widget,
  .tomtter-widget {
    width: 100%;
  }
}

/* Dancing pixel characters for the footer */
@keyframes dance {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.footer-characters {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 1rem;
  gap: 1rem;
}

.footer-characters img {
  width: 64px;
  height: auto;
  animation: dance 1.5s infinite ease-in-out;
}

/* Sunrise & Sunset widget styling */
.sunrise-sunset-widget {
  background-color: var(--primary-color);
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1.5rem;
  text-align: center;
}

.sunrise-sunset-widget h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-family: var(--heading-family);
  color: var(--accent-color);
}

.sunrise-sunset-widget input[type="text"] {
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  margin-right: 0.5rem;
  font-family: var(--font-family);
}

.sunrise-sunset-widget button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  background-color: var(--secondary-color);
  color: #fff;
  cursor: pointer;
  font-family: var(--heading-family);
  font-size: 0.8rem;
}

.sunrise-sunset-widget button:hover {
  background-color: var(--accent-color);
}

/* Characters in the header */
.header-characters {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 1rem;
  z-index: 3;
}

.header-characters img {
  width: 64px;
  height: auto;
  animation: dance 1.5s infinite ease-in-out;
}

/* The header no longer includes characters, so no extra bottom padding needed */
.site-header {
  /* preserve existing padding for layout */
}