/* =========================================================
   FONT IMPORTS
   ========================================================= */

/* Import Fredoka font */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600&display=swap');


/* =========================================================
   CSS VARIABLES (THEME TOKENS)
   ========================================================= */

:root {
  --bg-color: #1e1e1e;
  --text-color: #ffffff;
  --link-color: #66ccff;
  --link-visited-color: #bbbbff;
  --header-bg: #2a2a2a;
  --section-padding: 2rem;
  --transition-speed: 0.3s;
}

/* Light mode overrides */
html.light-mode {
  --bg-color: #f4f4f4;
  --text-color: #111;
  --link-color: #0033cc;
  --link-visited-color: #0051ff;
  --header-bg: #e0e0e0;
}


/* =========================================================
   BASE / RESET STYLES
   ========================================================= */

body {
  margin: 0;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  line-height: 1.7;
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color var(--transition-speed),
              color var(--transition-speed);
}

h1,
h2,
h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}


/* =========================================================
   HEADER / NAVIGATION
   ========================================================= */

header {
  background-color: var(--header-bg);
  padding: 0.6rem 1rem;
  text-align: center;

  /* Sticky behavior */
  position: sticky;
  top: 0;
  z-index: 1000;

  /* Animation */
  transition: padding 0.3s ease, box-shadow 0.3s ease;
}

/* Tighten header title spacing */
header h1 {
  margin: 0.25rem 0 0.4rem;
}

/* Site title */
header h1 a {
  text-decoration: none;
  color: var(--text-color);
  margin: 0;
  transition: font-size 0.3s ease;
  -webkit-transition: font-size 0.3s ease;
  -moz-transition: font-size 0.3s ease;
  -ms-transition: font-size 0.3s ease;
  -o-transition: font-size 0.3s ease;
}

/* Mobile hamburger toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  position: absolute;
  right: 3.5rem;
  top: 1rem;
  z-index: 999;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  position: absolute;
  right: 1rem;
  top: 1rem;
  z-index: 999;
}

/* Navigation container */
.navbar-links {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background-color: var(--header-bg);
  transition: padding 0.3s ease;
}

/* Show menu (mobile JS toggle) */
.navbar-links.show {
  display: flex;
}

/* Navigation links */
.navbar-links a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-speed);
}

.navbar-links a:visited {
  color: var(--link-visited-color);
}

.navbar-links a:hover {
  color: #ffd966;
}


/* =========================================================
   HEADER SHRINK STATE (ON SCROLL)
   ========================================================= */

header.shrunk {
  padding: 0.4rem 1rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

header.shrunk h1 {
  font-size: 1.3rem;
  margin: 0.15rem 0 0.25rem;
}

header.shrunk .navbar-links {
  padding: 0.25rem 0;
}

/* Light mode shadow tweak */
html.light-mode header.shrunk {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}


/* =========================================================
   LAYOUT
   ========================================================= */

main {
  padding: var(--section-padding);
  max-width: 800px;
  margin: 0 auto;
}

footer {
  text-align: center;
  padding: 1rem;
  background-color: var(--header-bg);
  color: #aaa;
  font-size: 0.9rem;
}


/* =========================================================
   MARKDOWN CONTENT LINKS
   ========================================================= */

main a {
  color: var(--link-color);
  text-decoration: underline;
  transition: color var(--transition-speed);
}

main a:visited {
  color: var(--link-visited-color);
}

main a:hover {
  color: #ffd966;
}


/* =========================================================
   DESKTOP NAVIGATION (≥768px)
   ========================================================= */

@media (min-width: 768px) {
  /* Hide hamburger */
  .nav-toggle {
    display: none;
  }

  /* Horizontal nav layout */
  .navbar-links {
    display: flex !important;
    flex-direction: row;
    justify-content: center;
    padding: 0.5rem 0;
  }

  /* Nav link spacing */
  .navbar-links a {
    position: relative;
    padding: 0 0.75rem;
  }

  /* Vertical separators */
  .navbar-links a:not(:last-child)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1.2em;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.3);
  }

  html.light-mode
  .navbar-links a:not(:last-child)::after {
    background-color: rgba(0, 0, 0, 0.3);
  }

  /* Header bottom separator */
  header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
  }

  html.light-mode header {
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
  }

  /* Nav row alignment (nav + theme toggle) */
  .nav-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
  }

  /* Reset theme toggle positioning for desktop */
  .theme-toggle {
    position: static;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.5rem;
  }
}


/* =========================================================
   MOBILE ADJUSTMENTS (≤767px)
   ========================================================= */

@media (max-width: 767px) {
  header.shrunk {
    padding: 1rem;
  }

  header.shrunk h1 {
    font-size: 1.6rem;
  }
}