/* Define Custom Properties (CSS Variables) */
:root {
  --primary-text: #333;
  --secondary-text: #666;
  --background-color: aliceblue;
  --link-color: darkblue;
  --link-hover-color: rgba(80, 6, 122, 0.479);
  --card-bg: #fff;
  --button-bg-light: aliceblue;
  --button-bg-dark: #333;
  --button-text-light: #333;
  --button-text-dark: aliceblue;
  --post-card-bg-light: #fff;
  --post-card-bg-dark: #222;
  --post-card-shadow-light: rgba(0, 0, 0, 0.1);
  --post-card-shadow-dark: rgba(0, 0, 0, 0.3);
  --header-bg: #f4f4f4;
}

/* Dark Mode Overrides */
body.dark-mode {
  --primary-text: aliceblue;
  --secondary-text: #bbb;
  --background-color: #333;
  --link-color: lightblue;
  --link-hover-color: #ff0;
  --card-bg: #222;
  --button-bg-light: #333;
  --button-bg-dark: #222;
  --button-text-light: #333;
  --button-text-dark: aliceblue;
  --post-card-bg-light: #222;
  --post-card-bg-dark: #444;
  --post-card-shadow-light: rgba(0, 0, 0, 0.3);
  --post-card-shadow-dark: rgba(0, 0, 0, 0.5);
  --header-bg: #444;
}

/* === Typography Upgrade === */
/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Open+Sans:wght@400;600&display=swap');

/* Apply body font */
body {
  font-family: 'Open Sans', Arial, sans-serif;
  line-height: 1.65;
  font-weight: 400;
  color: var(--primary-text);
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6,
.post-header {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.5px;
  color: var(--primary-text);
}

/* Post content text */
.post-content {
  font-family: 'Open Sans', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--primary-text);
}

/* Links */
a,
.site-nav a,
.projects-list a,
.post-nav a {
  font-family: 'Open Sans', Arial, sans-serif;
  font-weight: 600;
  text-decoration: none;
}

/* Meta info, small text */
.post-meta,
.post-nav {
  font-family: 'Open Sans', Arial, sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--secondary-text);
}

/* General Layout and Body */
html {
  height: 100%;
}

body {
  margin: 0;
  padding-bottom: 6rem;
  color: var(--primary-text);
  background-color: var(--background-color);
  min-height: 100vh;
}

a {
  color: var(--link-color);
  transition: color 0.3s ease;
}

a:hover {
  color: var(--link-hover-color);
}

/* Circle Button Styles */
.circleButton {
  background-color: var(--button-bg-light);
  color: var(--button-text-light);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  align-self: center;
  text-align: center;
  border: 1px solid;
  transition: background-color 0.3s ease;
}

.circleButton:hover {
  background-color: lightgrey;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.circleButton:focus {
  outline: 2px solid #ff0;
}

body.dark-mode .circleButton {
  background-color: var(--button-bg-dark);
  color: var(--button-text-dark);
}

/* Post Card Styling */
body.light-mode .post-card {
  background-color: var(--post-card-bg-light);
  box-shadow: var(--post-card-shadow-light);
}

body.dark-mode .post-card {
  background-color: var(--post-card-bg-dark);
  box-shadow: var(--post-card-shadow-dark);
}

.post-card {
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  background-color: #f4f4f4;
}

/* Post Layout Styling */
.post {
  max-width: 85%;
  margin: 0 auto;
  padding: 2rem;
  background-color: var(--post-card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.post-header {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-text);
  background-color: var(--header-bg);
  border-radius: 1rem;
  display: flex;
  align-items: center;
  padding: 0.5rem;
}

.post-header h1 {
  font-size: 2rem;
}

/* Meta Data */
.post-meta {
  font-size: 1rem;
  color: var(--secondary-text);
  padding: 1rem;
}

.post-meta span {
  margin-right: 1rem;
}

.post-content {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--primary-text);
}

/* Header */
header {
  background-color: var(--header-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-left: 1rem;
  padding-right: 1rem;
  max-height: 3rem;
  border-radius: 1rem;
}

.kofi-logo {
  width: auto;
  height: 2.5em;
}

main {
  display: flex;
  flex-direction: column;
  min-height: calc(95vh - 6rem);
  flex-grow: 1;
  justify-self: center;
  margin: 0 auto;
  padding: 1rem 1rem 1rem 1rem;
  width: 75%;
}


.page-footer {
  position: fixed;
  /* instead of fixed */
  bottom: 0%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 14px;
  margin-top: 2rem;
  /* add spacing */
}

.kofi-logo {
  width: auto;
  height: 2.5em;
}

.pagination {
  margin-top: 2rem;
  text-align: center;
}

.pagination a {
  margin: 0 0.5rem;
  text-decoration: none;
  font-weight: bold;
  color: var(--link-color);
}

.pagination a.active {
  color: #ff0;
  text-decoration: underline;
}

.post-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 1rem;
  list-style: none;
}

.project-content {
  border: none;
  flex: 2;
}

@media (min-width: 600px) {
  .post-list {
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns on small screens */
  }
}

@media (min-width: 1024px) {
  .post-list {
    grid-template-columns: repeat(3, 1fr);
    /* 3 columns on large screens */
  }
}

/* Header base */
.site-header {
  background: var(--header-bg, #222);
  color: var(--primary-text, #fff);
  padding: 0.5rem 1rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
}

.site-title a {
  color: inherit;
  text-decoration: none;
  font-size: 2rem;
  font-weight: bold;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin: 1rem;
  padding: 1rem;
  font-size: 1.5rem;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
}

.site-nav a:hover {
  text-decoration: underline;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
}


.projects-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.projects-list li {
  background: var(--card-bg, #f4f4f4);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.projects-list a {
  font-weight: bold;
  text-decoration: none;
  color: var(--link-color, #007acc);
}

.projects-list a:hover {
  text-decoration: underline;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 3rem 0 2rem;
  padding: 1rem 0;

  font-size: 0.95rem;
  font-weight: 500;
}

.post-nav a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  background-color: var(--card-bg);
  border-radius: 5%;
  padding: .5rem;
}

.post-nav a:hover {
  color: var(--link-hover-color);
  transform: translateY(-1px);
}
.book {
  background-color: var(--card-bg);
  padding: 1.5rem;
  margin: 0.5rem 0.5rem;
  color: var(--primary-text);
}


.post-nav .prev {
  text-align: left;
  max-width: 48%;
}

.post-nav .next {
  text-align: right;
  max-width: 48%;
}


@media (max-width: 700px) {
  main {
    width: 95%;
    padding: 1rem;
  }

  header {
    flex-wrap: wrap;
    padding: 0.5rem;
    max-height: none;
  }
    .site-nav {
    display: none;
    position: absolute;
    top: 60px;
    right: 1rem;
    background: var(--header-bg, #222);
    padding: 0.5rem 1rem;
    border-radius: 8px;
  }

  .site-nav.open {
    display: block;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }

  .menu-toggle {
    display: block;
  }
}

@media (max-width: 600px) {

  body,
  .post-content {
    font-size: 1.125rem;
    /* ~18px */
    line-height: 1.7;
  }

  .post {
    padding: 1rem;
  }
}

.series-label {
  font-size: small;
}
.writing-content p {
  margin: 0;
  padding: 0;
}
.writing-content p + p {
  margin-top: 1rem;
}
.writing-content p:first-child {
  margin-top: 0;
}
.writing-content-wrapper {
  background-color: var(--card-bg);
  border-radius: 1rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  padding: 2rem 2rem;
 /* max-width: 680px;*/
  width: 50vw;
  margin: 3rem auto;
  text-align: left;
  line-height: 1.4;
}


.writing-content {
  white-space: pre-line;
  font-size: 1.05rem;
  font-family: "Georgia", serif;
  color: var(--primary-text);
  /*display: block;
 /* max-width: 520px;     */ 
  margin: 0 auto;  
  padding: 2rem auto;          
  text-align: left;
}

.writing-content-wrapper h3 {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  color: var(--secondary-text);
}
