/* Nord Theme Palette */
:root {
  /* Polar Night */
  --nord0: #2e3440;
  --nord1: #3b4252;
  --nord2: #434c5e;
  --nord3: #4c566a;

  /* Snow Storm */
  --nord4: #d8dee9;
  --nord5: #e5e9f0;
  --nord6: #eceff4;

  /* Frost */
  --nord7: #8fbcbb;
  --nord8: #88c0d0;
  --nord9: #81a1c1;
  --nord10: #5e81ac;

  /* Aurora */
  --nord11: #bf616a; /* Red */
  --nord12: #d08770; /* Orange */
  --nord13: #ebcb8b; /* Yellow */
  --nord14: #a3be8c; /* Green */
  --nord15: #b48ead; /* Purple */
}

/* Basic Reset & Defaults */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%; /* Ensure html takes full height */
  overflow-x: hidden; /* Prevent horizontal scroll at root level */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-weight: 400; /* Regular weight */
  background-color: var(--nord0);
  color: var(--nord4);
  line-height: 1.6;
  min-height: 100vh; /* Ensure body takes at least full viewport height */
  display: flex; /* Enable flexbox for sticky footer */
  flex-direction: column; /* Stack elements vertically */
  overflow-x: hidden; /* Prevent any horizontal overflow at the root level */
}

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

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif; /* Explicitly set Inter for headings */
  font-weight: 700; /* Bold weight */
  color: var(--nord6);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1rem;
}

/* Add more styles as needed */

/* Code blocks and inline code */
pre,
code {
  font-family: 'Fira Code', monospace;
  font-size: 0.9em; /* Slightly smaller than body text */
}

/* Style for block code */
pre {
  background-color: #3b4252; /* Light grey background */
  padding: 1em;
  border-radius: 4px;
  margin-bottom: 1rem;
  max-width: 100%; /* Prevent block from overflowing container */
  border: 1px solid var(--nord2); /* Subtle border */
}

/* Ensure code within pre doesn't inherit pre's padding/margin */
pre code {
  background-color: #3b4252; /* Apply background directly here */
  padding: 0;
  margin: 0;
  border-radius: 0;
  font-size: inherit; /* Inherit pre's font size */
  white-space: pre-wrap; /* Allow wrapping while preserving whitespace */
  word-break: break-word; /* More aggressive word breaking */
  overflow-wrap: anywhere; /* Break long unbreakable strings */
}

/* Style for inline code */
:not(pre) > code {
  background-color: var(--nord1);
  color: var(--nord5); /* Slightly lighter text for inline */
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

/* Ensure syntax highlighting works properly without line numbers */
.chroma .line {
  white-space: pre-wrap; /* Allow wrapping for code content */
  word-break: break-word; /* More aggressive word breaking */
  overflow-wrap: anywhere; /* Break very long strings */
}

/* Ensure all chroma elements respect container width */
.chroma {
  max-width: 100%;
  overflow-x: hidden;
}

/* Layout Styles */
.container {
  width: 100%; 
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  flex-grow: 1; 
}

.site-header {
  /* Add centering/width constraints */
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem; /* Increased padding, added horizontal */

  /* Keep flex styles */
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  /* border-bottom: 1px solid var(--nord3); */ /* Removed border */
}

.site-header h1 {
  margin-bottom: 0; /* Remove default heading margin */
  font-size: 1.8em; /* Slightly larger title */
  line-height: 1; /* Explicit line-height */
}

.site-header h1 a {
  /* color: var(--nord6); */ /* Let the gradient handle the color */
  text-decoration: none;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.01em; /* Optional: add slight spacing for uppercase */

  /* Subtle Frost Gradient */
  background: linear-gradient(to right, var(--nord9), var(--nord10));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent; /* Make the original text color transparent */
}

.site-header h1 a:hover {
  /* Optional: slightly change gradient or add effect on hover */
  background: linear-gradient(to right, var(--nord7), var(--nord8));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-header nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem; /* Spacing between nav items */
  margin: 0; /* Remove default UL margin */
}

.site-header nav ul li {
  margin-bottom: 0; /* Override general li margin */
}

.site-header nav a {
  color: var(--nord5); /* Slightly lighter nav links */
  font-weight: 700; /* Bold nav links */
  line-height: 1; /* Explicit line-height */
}

.site-header nav a:hover {
  color: var(--nord8); /* Frost accent on hover */
  text-decoration: none;
}

main {
  /* padding: 1rem 0; */ /* Remove old padding - keep removed */
  /* flex-grow: 1; */ /* Keep removed, container handles this */
  /* flex-shrink: 0; */ /* Keep this */
  flex-shrink: 0; 
  /* Container styles now apply effectively here via the parent .container div */
  /* width: 100%; */ /* Remove redundant width */
}

footer {
  /* Add centering/width constraints */
  width: 100%;
  max-width: 800px;
  margin: 0 auto; /* Center footer content */
  padding: 1.5rem 1rem; /* Match header horizontal padding, adjust vertical */

  /* Keep sticky footer styles */
  margin-top: auto;
  /* border-top: 1px solid var(--nord3); */ /* Removed border */
  text-align: center;
  font-size: 0.9em;
  color: var(--nord3); /* Dimmer footer text */
  /* padding-bottom: 1.5rem; */ /* Incorporated into padding above */
}

footer a {
  color: var(--nord9); /* Use a frost color for footer links */
}

footer a:hover {
  color: var(--nord8);
}

/* Table Styles */
table {
  width: 100%; /* Make tables full width */
  border-collapse: collapse; /* Collapse borders */
  margin-bottom: 1.5rem;
  border: 1px solid var(--nord3);
}

table th,
table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--nord3);
  word-wrap: break-word; /* Break long words */
  overflow-wrap: break-word; /* Break words to prevent overflow */
  max-width: 150px; /* Reduced maximum width for table cells */
  word-break: break-word; /* More aggressive word breaking */
}

table th {
  background-color: var(--nord1); /* Slightly darker background for header */
  color: var(--nord6);
  font-weight: 700; /* Bold header text */
  border-bottom-width: 2px; /* Thicker border below header */
}

/* Add striping for better readability */
table tbody tr:nth-child(even) {
  background-color: var(--nord1);
}

table tbody tr:hover {
  background-color: var(--nord2);
}

caption {
  caption-side: bottom;
  padding: 0.75rem 0;
  font-size: 0.9em;
  color: var(--nord3);
  text-align: center;
}

/* Responsive table improvements */
@media (max-width: 768px) {
  table {
    font-size: 0.9em; /* Slightly smaller text */
  }
  
  table th,
  table td {
    padding: 0.5rem 0.75rem; /* Reduced padding on mobile */
    max-width: 150px; /* Smaller max width on tablets */
  }
}

@media (max-width: 480px) {
  table {
    font-size: 0.85em;
  }
  
  table th,
  table td {
    padding: 0.4rem 0.5rem; /* Even smaller padding on mobile */
    max-width: 100px; /* Smaller max width on mobile */
  }
  
  /* Code block improvements for mobile */
  pre {
    font-size: 0.85em; /* Smaller text on mobile */
  }
  
  pre code {
    font-size: inherit;
  }
}

/* List Styles */
ul,
ol {
  margin-bottom: 1rem;
  padding-left: 1.8rem; /* Indentation for list items */
}

li {
  margin-bottom: 0.5rem; /* Spacing between list items */
}

ul li::marker {
  color: var(--nord8); /* Style default bullet */
}

ol li::marker {
  color: var(--nord8); /* Style default numbers */
}

/* Specifically style the post list */
.post-list {
  list-style: none; /* Remove default bullets */
  padding-left: 0; /* Remove default indentation */
}

.post-list li {
  display: flex;
  flex-wrap: wrap; /* Allow wrapping on small screens */
  align-items: baseline; /* Align date and title nicely */
  margin-bottom: 0.5rem; /* Reduced spacing */
  padding-bottom: 0.5rem; /* Reduced space before potential border */
  border-bottom: 1px dashed var(--nord2); /* Subtle separator */
}

.post-list li:last-child {
  border-bottom: none; /* No border on the last item */
}

.post-list .post-date {
  color: var(--nord3);
  font-size: 0.9em;
  margin-right: 1rem;
  flex-shrink: 0; /* Prevent date from shrinking */
  /* Optionally set a fixed width if needed: width: 120px; */
}

.post-list a {
  color: var(--nord5); /* Slightly less bright title link */
  font-weight: 700;
  text-decoration: none;
  flex-grow: 1; /* Allow title to take remaining space */
}

.post-list a:hover {
  color: var(--nord8);
  text-decoration: underline;
}

/* Pagination Links */
.pagination-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  margin: 0 0.5rem;
  color: var(--nord9);
  border: 1px solid var(--nord3);
  border-radius: 4px;
  text-decoration: none;
}

.pagination-link:hover {
  background-color: var(--nord2);
  color: var(--nord6);
  text-decoration: none;
}

/* Blockquote Styles */
blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--nord9);
  background-color: var(--nord1);
  color: var(--nord5); /* Slightly lighter text for quotes */
  font-style: italic;
  border-radius: 0 4px 4px 0; /* Rounded corners on the right */
}

blockquote p {
  margin-bottom: 0.5rem; /* Adjust paragraph spacing inside blockquotes */
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Image Styles */
img {
  max-width: 100%; /* Responsive images */
  height: auto; /* Maintain aspect ratio */
  display: block; /* Remove extra space below image */
  margin: 1.5rem auto; /* Center images with margin */
  border-radius: 4px; /* Optional: slightly rounded corners */
}

/* Single Post Header Styles */
.post-header {
  padding-bottom: 1rem; /* Space before the border */
  margin-bottom: 1.5rem; /* Space after the border */
  border-bottom: 1px solid var(--nord2); /* Subtle separator */
}

.post-header h1 {
  font-size: 2.8em; /* Larger title */
  font-weight: 800; /* Bolder title */
  color: var(--nord8); /* Frost accent color */
  margin-bottom: 0.5rem; /* Reduced space below title */
  line-height: 1.2; /* Adjust line height for larger font */
}

.post-meta {
  margin-top: 0.5rem; /* Space above meta info */
}

.post-meta time {
  font-size: 0.9em; /* Smaller date text */
  color: var(--nord3); /* Dimmer date text */
}

/* Optional: Adjust tag styling if needed */
.post-meta .tags {
  font-size: 0.9em; /* Match date size */
  color: var(--nord3); /* Match date color */
}

.post-meta .tags a {
  color: var(--nord9); /* Use a Frost color for tag links */
  text-decoration: none;
}

.post-meta .tags a:hover {
  color: var(--nord8);
  text-decoration: underline;
}
