/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
  --color-bg:           #f9f7f4;
  --color-surface:      #ffffff;
  --color-border:       #e5e1d8;
  --color-text:         #2c2c2c;
  --color-text-muted:   #888880;
  --color-accent:       #4a7c9e;
  --color-accent-hover: #2d5f80;
  --color-header-bg:    #2c2c2c;
  --color-header-text:  #f9f7f4;
  --color-footer-bg:    #2c2c2c;
  --color-footer-text:  #c8c4bc;

  --font-body:    Georgia, "Times New Roman", Times, serif;
  --font-ui:      system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "Courier New", Courier, monospace;

  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.5rem;
  --font-size-2xl:  2rem;

  --line-height-body:    1.75;
  --line-height-heading: 1.25;

  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;

  --border-radius:      4px;
  --layout-max-width:   1100px;
  --sidebar-width:      280px;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100vw;
  overflow-x: hidden;
}

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

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

a:hover,
a:focus {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  line-height: var(--line-height-heading);
  color: var(--color-text);
}

p {
  margin-bottom: var(--space-md);
}

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

code, pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background-color: var(--color-border);
  border-radius: var(--border-radius);
}

code {
  padding: 0.1em 0.4em;
}

pre {
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

pre code {
  background: none;
  padding: 0;
}

blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-md);
  color: var(--color-text-muted);
  font-style: italic;
  margin-bottom: var(--space-md);
}

/* ==========================================================================
   Header
   ========================================================================== */
#header {
  background-color: var(--color-header-bg);
  color: var(--color-header-text);
  padding: var(--space-xl);
  text-align: center;
}

#header h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-header-text);
}

#header h1 a {
  color: inherit;
  text-decoration: none;
}

#header h1 a:hover {
  opacity: 0.85;
  text-decoration: none;
}

/* ==========================================================================
   Page Layout — two-column
   ========================================================================== */
#page-wrapper {
  display: flex;
  flex: 1;
  gap: var(--space-xl);
  max-width: var(--layout-max-width);
  margin: var(--space-2xl) auto;
  padding: 0 var(--space-xl);
  width: 100%;
  align-items: flex-start;
}

#main-content {
  flex: 1;
  min-width: 0; /* prevent flex overflow */
}

/* ==========================================================================
   Sidebar
   ========================================================================== */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
}

#sidebar h3 {
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.sidebar-list {
  list-style: none;
  margin-bottom: var(--space-md);
}

.sidebar-list li {
  border-bottom: 1px solid var(--color-border);
}

.sidebar-list li:last-child {
  border-bottom: none;
}

.sidebar-list a {
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  display: block;
  padding: var(--space-sm) 0;
  transition: color 0.15s ease;
}

.sidebar-list a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.more-entries {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-accent);
}

.more-entries:hover {
  color: var(--color-accent-hover);
  text-decoration: none;
}

/* ==========================================================================
   Navigation Row & Sidebar Alignment
   ========================================================================== */
.nav-row,
.post-nav-row {
  min-height: 2rem;
  margin-bottom: var(--space-lg);
}

#main-content + #sidebar {
  margin-top: calc(2rem + var(--space-lg));
}

/* ==========================================================================
   Footer
   ========================================================================== */
#footer {
  background-color: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: var(--space-lg) var(--space-xl);
  text-align: center;
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
}

.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.footer-nav a {
  color: var(--color-footer-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--font-size-sm);
  transition: color 0.15s ease;
  text-decoration: none;
}

.footer-nav a:hover {
  color: #ffffff;
  text-decoration: none;
}

.footer-copy {
  color: #666058;
  margin-top: var(--space-xs);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  #page-wrapper {
    flex-direction: column;
    margin: var(--space-xl) auto;
    padding: 0 var(--space-md);
  }

  #sidebar {
    width: 100%;
  }

  .nav-row,
  .post-nav-row {
    min-height: 0;
  }

  #main-content + #sidebar {
    margin-top: 0;
  }
}