/* --- Bear Blog Minimal Core Styles --- */
:root {
  --bg: #ffffff;
  --text: #222222;
  --link: #0066cc;
  --border: #ddd;
  --code-bg: #f4f4f5;
  --code-text: #1a1a1a;

  /* Accessible Syntax Highlighting Colors (WCAG AA Compliant >= 4.5:1) */
  --token-comment: #57606a;  /* Contrast ratio: 5.81:1 */
  --token-keyword: #cf222e;  /* Contrast ratio: 4.87:1 */
  --token-string: #032f62;   /* Contrast ratio: 12.04:1 */
  --token-function: #6f42c1; /* Contrast ratio: 5.92:1 */
  --token-number: #005cc5;   /* Contrast ratio: 5.73:1 */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #e0e0e0;
    --link: #64b5f6;
    --border: #333333;
    --code-bg: #1e1e1e;
    --code-text: #f0f0f0;

    /* Accessible Syntax Highlighting Colors (Dark Mode) */
    --token-comment: #8b949e;
    --token-keyword: #ff7b72;
    --token-string: #a5d6ff;
    --token-function: #d2a8ff;
    --token-number: #79c0ff;
  }
}

/* merriweather-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/merriweather-v33-latin-regular.woff2') format('woff2');
}

/* merriweather-italic - latin */
@font-face {
  font-display: swap;
  font-family: 'Merriweather';
  font-style: italic;
  font-weight: 400;
  src: url('../fonts/merriweather-v33-latin-italic.woff2') format('woff2');
}

/* merriweather-700 - latin */
@font-face {
  font-display: swap;
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/merriweather-v33-latin-700.woff2') format('woff2');
}

/* merriweather-700italic - latin */
@font-face {
  font-display: swap;
  font-family: 'Merriweather';
  font-style: italic;
  font-weight: 700;
  src: url('../fonts/merriweather-v33-latin-700italic.woff2') format('woff2');
}

body {
  font-family: "Merriweather", serif;
  font-optical-sizing: auto;
  font-style: normal;
  font-variation-settings: "wdth" 100;
  line-height: 1.6;
  max-width: 65ch;
  margin: 0 auto;
  padding: 1rem;
  background-color: var(--bg);
  color: var(--text);
}

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

header {
  margin-bottom: 2rem;
}

.site-header {
  margin-bottom: 2.5rem;
}

.site-title {
  margin: 0 0 1rem 0;
  font-size: 2.5em;
  font-weight: normal;
  line-height: 1.2;
}

.site-nav ul {
  display: flex;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
}

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

nav a {
  margin-right: 1rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* --- Accessible Code Block Styling --- */
pre[class*="language-"] {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  border: 1px solid var(--border);
}

/* Ensure focus outline on keyboard navigation for wide code blocks */
pre[class*="language-"]:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

:not(pre) > code {
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

/* Prism Token Highlighting Rules */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: var(--token-comment); font-style: italic; }
.token.keyword, .token.tag, .token.operator { color: var(--token-keyword); font-weight: bold; }
.token.string, .token.attr-value { color: var(--token-string); }
.token.function, .token.class-name { color: var(--token-function); }
.token.number, .token.boolean, .token.constant { color: var(--token-number); }

/* Post Metadata */
.post-meta {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.95em;
}

.post-meta dl {
  display: grid;
  grid-template-columns: 6em 1fr;
  gap: 0 1rem;
  margin: 0;
}

.post-meta dt {
  font-weight: bold;
  grid-column: 1;
}

.post-meta dd {
  grid-column: 2;
  margin: 0;
}

/* --- Latest Posts (Home) --- */
.latest-posts {
  margin: 0;
  list-style: none;
  padding: 0;
}

.latest-posts li {
  padding: 0.5rem 0;
}

.latest-posts a {
  text-decoration: none;
}

.latest-posts a:hover {
  text-decoration: underline;
}

/* --- Post Article Styles --- */
.post {
  display: flex;
  flex-direction: column;
}

.post-content {
  margin-bottom: 3rem;
}

.post-content h1 {
  margin-top: 0;
}

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

/* --- Accessibility --- */
.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  background-color: var(--link);
  color: var(--bg);
  text-decoration: none;
  display: inline-block;
}

/* --- Blog List Styles --- */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2.5rem;
}

.post-item {
  padding-bottom: 1rem;
}

.post-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.3em;
  line-height: 1.3;
}

.post-title a {
  text-decoration: none;
}

.post-title a:hover {
  text-decoration: underline;
}

.post-date {
  display: block;
  font-size: 0.95em;
  color: var(--text);
  opacity: 0.75;
}

/* --- Pagination Styles --- */
.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.pagination-prev,
.pagination-next {
  text-decoration: none;
  transition: color 0.2s ease;
}

.pagination-prev:hover,
.pagination-next:hover {
  color: var(--link);
}

.pagination-next {
  margin-left: auto;
}
