/* ==========================================================================
   Design System — Light Mode
   MartinLabuschin.com
   ========================================================================== */

/* Custom properties */
:root {
  /* Backgrounds */
  --color-bg: #fff;
  --color-bg-code: #f5f5f5;

  /* Text */
  --color-text: #444;
  --color-heading: #000;
  --color-meta: #767676;

  /* Links */
  --color-link: #1a6baa;
  --color-link-hover: #155a8a;

  /* Borders */
  --color-border: #ccc;
  --color-border-heavy: #bbb;

  /* Nav */
  --color-nav: #444;
  --color-nav-footer: #666;
  --color-site-name: #000;

  /* Misc */
  --color-empty-state: #666;
  --color-blockquote: #666;
}

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

/* Base */
html {
  font-size: 100%;
}

body {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
}

/* Container */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: Helvetica, Arial, sans-serif;
  color: var(--color-heading);
  line-height: 1.3;
}

h1 {
  font-size: 2.75rem;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.85rem;
  margin-bottom: 0.4rem;
}

h3 {
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}

h4 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

/* Links — always blue and underlined */
a {
  color: var(--color-link);
  text-decoration: underline;
}

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

a:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-link);
  color: var(--color-bg);
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 4px;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

/* Header */
.site-header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 130px;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.site-name {
  font-family: Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-site-name);
  text-decoration: none;
}

.site-name:hover {
  color: var(--color-site-name);
}

.header-nav {
  display: flex;
  list-style: none;
  gap: 1.25rem;
}

.header-nav-link {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--color-nav);
  text-decoration: none;
}

.header-nav-link:hover {
  color: var(--color-link);
}

/* Footer */
.site-footer {
  margin-top: 130px;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
}

.footer-nav {
  display: flex;
  list-style: none;
  gap: 1.25rem;
}

.footer-nav-link {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--color-nav-footer);
  text-decoration: none;
}

.footer-nav-link:hover {
  color: var(--color-link);
}

/* Metadata typography — used in list views and inside .post-footer */
.meta {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--color-meta);
  margin-bottom: 0.75rem;
}

.meta a {
  color: var(--color-meta);
  text-decoration: underline;
}

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

/* Section heading — extra space before listings on overview pages */
.section-heading {
  margin-bottom: 0.5rem;
}

/* Lead paragraph — bold intro below h1 on all pages */
.lead {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-meta);
  margin-top: 2rem;
  margin-bottom: 3rem;
  line-height: 1.6;
}

/* Post / page body content — capped width for readability */
.post-body,
.page-body {
  max-width: 680px;
}

.post-body p,
.page-body p {
  margin-bottom: 1rem;
}

.post-body h2,
.page-body h2 {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.post-body h3,
.page-body h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
}

.post-body h4,
.page-body h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

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

.post-body blockquote,
.page-body blockquote {
  border-left: 3px solid var(--color-border-heavy);
  padding-left: 1rem;
  color: var(--color-blockquote);
  margin-bottom: 1rem;
}

.post-body code, .page-body code {
  font-size: 0.9em;
  background: var(--color-bg-code);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-body pre, .page-body pre {
  background: var(--color-bg-code);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.post-body pre code, .page-body pre code {
  background: none;
  padding: 0;
}

.post-body table, .page-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

.post-body th, .post-body td,
.page-body th, .page-body td {
  padding: 0.5rem;
  border: 1px solid var(--color-border-heavy);
  text-align: left;
}

.post-body img, .page-body img {
  max-width: 100%;
  height: auto;
}

/* Homepage */
.homepage-post {
  margin-bottom: 2rem;
}

.homepage-post .excerpt {
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Page */
.page-content {
  margin-bottom: 2rem;
}

/* Post summary list */
.post-list {
  margin-bottom: 0;
}

.post-summary {
  margin-bottom: 2.5rem;
}

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

.post-summary h2 {
  margin-top: -0.4rem;
}

.post-summary .excerpt {
  margin-top: 0.25rem;
  font-family: Helvetica, Arial, sans-serif;
}

/* Archive sections */
.archive-section {
  margin-top: 4.5rem;
  padding-top: 3.5rem;
  border-top: 1px solid var(--color-border);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.archive-section h2 {
  font-size: 1.1rem;
  font-style: normal;
  margin-bottom: 0.75rem;
}

.archive-section h3 {
  font-size: 0.95rem;
  font-style: normal;
  margin-bottom: 0.5rem;
}

.archive-grid {
  display: flex;
  gap: 3rem;
}

.archive-list, .tag-list {
  list-style: none;
  padding: 0;
}

.archive-list li, .tag-list li {
  margin-bottom: 0.25rem;
}

.archive-list li.year-break {
  margin-top: 1.25rem;
}

/* About author */
.about-author {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.about-author h3 {
  font-size: 0.95rem;
  color: var(--color-meta);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

/* Post footer — structural wrapper; typography comes from .meta on the inner <p> */
.post-footer {
  margin-top: 3rem;
}

.post-footer .meta {
  max-width: 680px;
}


/* Empty state */
.empty-state {
  color: var(--color-empty-state);
  font-style: italic;
  padding: 2rem 0;
}

/* Error page */
.error-page p {
  margin-bottom: 1rem;
}

.error-section {
  margin-top: 1.5rem;
}

.error-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

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

.error-section li {
  margin-bottom: 0.35rem;
}

/* ==========================================================================
   Dark Mode (OLED — pure black)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #000;
    --color-bg-code: #1a1a1a;
    --color-text: #ccc;
    --color-heading: #eee;
    --color-meta: #767676;
    --color-link: #5ba3d9;
    --color-link-hover: #7dbde8;
    --color-border: #444;
    --color-border-heavy: #555;
    --color-nav: #999;
    --color-nav-footer: #888;
    --color-site-name: #eee;
    --color-empty-state: #888;
    --color-blockquote: #999;
  }

  .post-body pre, .page-body pre {
    background: #111;
  }

}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (width <= 480px) {
  body {
    font-size: 0.95rem;
  }

  .site-header {
    margin-bottom: 60px;
  }

  .site-footer {
    margin-top: 60px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.3rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .lead {
    font-size: 1rem;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .header-nav {
    gap: 0.75rem;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  body {
    color: #000;
    background: #fff;
  }

  .skip-link,
  .site-header nav,
  .site-footer {
    display: none;
  }

  .site-header {
    border-bottom: 1px solid #ccc;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #666;
  }

  .post-body pre, .page-body pre {
    border: 1px solid #ccc;
    background: #f9f9f9;
  }
}
