/* ===== Color Palette ===== */
:root {
  --dust-grey:    #dad7cd;
  --dry-sage:     #a3b18a;
  --fern:         #588157;
  --hunter-green: #3a5a40;
  --pine-teal:    #344e41;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1e293b;
  background: #ffffff;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== Layout ===== */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--pine-teal);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-inner {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 100%;
}

/* ===== Sidebar Brand ===== */
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--hunter-green);
}

.headshot {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--dry-sage);
  display: block;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.sidebar-bio {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  line-height: 1.3;
}

.site-title:hover {
  color: var(--dust-grey);
  text-decoration: none;
}

.site-tagline {
  font-size: 0.78rem;
  color: var(--dry-sage);
  line-height: 1.5;
  margin-top: 0.1rem;
}

.sidebar-social {
  display: flex;
  gap: 0.875rem;
  margin-top: 0.5rem;
}

.sidebar-social a {
  color: var(--dry-sage);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.sidebar-social a:hover {
  color: #ffffff;
  text-decoration: none;
}

/* ===== Sidebar Nav ===== */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-nav a {
  color: var(--dry-sage);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.55rem 0.875rem;
  border-radius: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--hunter-green);
  color: #ffffff;
  text-decoration: none;
  border-left-color: var(--dry-sage);
}

/* ===== Site Content ===== */
.site-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
  padding: 3rem 2.5rem;
  width: 100%;
}

/* ===== Post Card (Homepage) ===== */
.post-card {
  border: 1px solid #d4d0c6;
  border-radius: 0.75rem;
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.post-card:last-child {
  margin-bottom: 0;
}

.post-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-card h2 a {
  color: #1e293b;
  text-decoration: none;
}

.post-card h2 a:hover {
  color: var(--fern);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: #64748b;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--dust-grey);
  color: var(--hunter-green);
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

.tag:hover {
  background: #c5c2b7;
  text-decoration: none;
}

.post-excerpt {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.read-more {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fern);
}

.read-more:hover {
  text-decoration: underline;
}

/* ===== Post Header ===== */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #d4d0c6;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--pine-teal);
}

/* ===== Post & Page Content ===== */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6,
.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  color: var(--pine-teal);
  font-weight: 700;
}

.post-content h1, .page-content h1 { font-size: 1.75rem; }
.post-content h2, .page-content h2 { font-size: 1.4rem; }
.post-content h3, .page-content h3 { font-size: 1.2rem; }

.post-content p,
.page-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li,
.page-content li {
  margin-bottom: 0.35rem;
}

.post-content a,
.page-content a {
  color: var(--fern);
}

.post-content blockquote,
.page-content blockquote {
  border-left: 4px solid var(--fern);
  padding: 0.5rem 1.25rem;
  margin: 1.5rem 0;
  color: #475569;
  background: #f5f3ef;
  border-radius: 0 0.375rem 0.375rem 0;
}

.post-content hr,
.page-content hr {
  border: none;
  border-top: 1px solid #d4d0c6;
  margin: 2rem 0;
}

/* ===== Code ===== */
code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  font-size: 0.875em;
  background: #f0ede8;
  padding: 0.15em 0.35em;
  border-radius: 0.25rem;
  color: var(--hunter-green);
}

pre {
  background: #1c2e22;
  color: #e2e8f0;
  padding: 1.25rem 1.5rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.highlight {
  background: #1c2e22;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.highlight pre {
  margin: 0;
  border-radius: 0.5rem;
}

/* Rouge syntax highlighting */
.highlight .hll { background-color: #2a4030 }
.highlight .c  { color: #6272a4 } /* Comment */
.highlight .err { color: #f8f8f2 } /* Error */
.highlight .k  { color: #ff79c6 } /* Keyword */
.highlight .l  { color: #f1fa8c } /* Literal */
.highlight .n  { color: #f8f8f2 } /* Name */
.highlight .o  { color: #ff79c6 } /* Operator */
.highlight .p  { color: #f8f8f2 } /* Punctuation */
.highlight .cm { color: #6272a4 } /* Comment.Multiline */
.highlight .cp { color: #ff79c6 } /* Comment.Preproc */
.highlight .c1 { color: #6272a4 } /* Comment.Single */
.highlight .cs { color: #6272a4 } /* Comment.Special */
.highlight .gd { color: #ff5555 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gi { color: #50fa7b } /* Generic.Inserted */
.highlight .gt { color: #8be9fd } /* Generic.Traceback */
.highlight .kc { color: #ff79c6 } /* Keyword.Constant */
.highlight .kd { color: #8be9fd; font-style: italic } /* Keyword.Declaration */
.highlight .kn { color: #ff79c6 } /* Keyword.Namespace */
.highlight .kp { color: #ff79c6 } /* Keyword.Pseudo */
.highlight .kr { color: #ff79c6 } /* Keyword.Reserved */
.highlight .kt { color: #8be9fd } /* Keyword.Type */
.highlight .m  { color: #bd93f9 } /* Literal.Number */
.highlight .s  { color: #f1fa8c } /* Literal.String */
.highlight .na { color: #50fa7b } /* Name.Attribute */
.highlight .nb { color: #8be9fd; font-style: italic } /* Name.Builtin */
.highlight .nc { color: #50fa7b } /* Name.Class */
.highlight .no { color: #bd93f9 } /* Name.Constant */
.highlight .nd { color: #50fa7b } /* Name.Decorator */
.highlight .nf { color: #50fa7b } /* Name.Function */
.highlight .nl { color: #8be9fd; font-style: italic } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #50fa7b } /* Name.Other */
.highlight .nt { color: #ff79c6 } /* Name.Tag */
.highlight .nv { color: #8be9fd; font-style: italic } /* Name.Variable */
.highlight .ow { color: #ff79c6 } /* Operator.Word */
.highlight .w  { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mf { color: #bd93f9 } /* Literal.Number.Float */
.highlight .mh { color: #bd93f9 } /* Literal.Number.Hex */
.highlight .mi { color: #bd93f9 } /* Literal.Number.Integer */
.highlight .mo { color: #bd93f9 } /* Literal.Number.Oct */
.highlight .s2 { color: #f1fa8c } /* Literal.String.Double */
.highlight .se { color: #bd93f9 } /* Literal.String.Escape */
.highlight .sh { color: #f1fa8c } /* Literal.String.Heredoc */
.highlight .si { color: #f1fa8c } /* Literal.String.Interpol */
.highlight .s1 { color: #f1fa8c } /* Literal.String.Single */
.highlight .ss { color: #f1fa8c } /* Literal.String.Symbol */
.highlight .il { color: #bd93f9 } /* Literal.Number.Integer.Long */

/* ===== Page Header ===== */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #d4d0c6;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--pine-teal);
}

/* ===== Tags Page ===== */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.tag-pill {
  background: var(--dust-grey);
  color: var(--hunter-green);
  padding: 0.35rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}

.tag-pill:hover {
  background: #c5c2b7;
  text-decoration: none;
}

.tag-pill span {
  color: #64748b;
  margin-left: 0.25rem;
  font-weight: 400;
}

.tag-section {
  margin-bottom: 2.5rem;
}

.tag-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--pine-teal);
  margin-bottom: 0.75rem;
  text-transform: capitalize;
}

.tag-section ul {
  list-style: none;
  padding: 0;
}

.tag-section li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eae7e0;
  gap: 1rem;
}

.tag-section li:last-child {
  border-bottom: none;
}

.tag-section li a {
  color: #1e293b;
  font-weight: 500;
}

.tag-section li a:hover {
  color: var(--fern);
}

.tag-section li time {
  font-size: 0.8rem;
  color: #94a3b8;
  white-space: nowrap;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--dust-grey);
  border-top: 1px solid #c5c2b7;
  padding: 1.25rem 2.5rem;
}

.site-footer p {
  color: var(--hunter-green);
  font-size: 0.875rem;
  text-align: center;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    position: static;
    height: auto;
  }

  .sidebar-inner {
    padding: 1rem 1.25rem;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
  }

  .sidebar-brand {
    flex-direction: row;
    text-align: left;
    align-items: center;
    border-bottom: none;
    padding-bottom: 0;
    gap: 0.875rem;
    flex: 1;
    min-width: 0;
  }

  .headshot {
    width: 60px;
    height: 60px;
    margin-bottom: 0;
  }

  .sidebar-bio {
    align-items: flex-start;
  }

  .site-tagline {
    display: none;
  }

  .sidebar-social {
    margin-top: 0.25rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
    width: 100%;
    border-top: 1px solid var(--hunter-green);
    padding-top: 0.75rem;
  }

  .sidebar-nav a {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }

  .site-main {
    padding: 2rem 1.25rem;
  }

  .site-footer {
    padding: 1.25rem;
  }

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

  .post-card h2 {
    font-size: 1.2rem;
  }

  .tag-section li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}
