/* ===== Google Fonts Import ===== */
@import url('https://fonts.googleapis.com/css2?family=PT+Serif+Caption:ital@0;1&display=swap');

/* ===== CSS Variables для лёгкой кастомизации ===== */
:root {
  /* Светлая тема */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --text-primary: #222222;
  --text-secondary: #666666;
  --text-link: #d23669;
  --text-link-hover: #ff5792;
  --border-color: #e0e0e0;
  --code-bg: #f5f5f5;
  --code-text: #1e1e1e;
  
  /* Типографика */
  --font-headings: 'PT Serif Caption', Georgia, serif;  /* ← заголовки */
  --font-body: Georgia, 'Times New Roman', serif;  /* ← основной текст */
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  --font-size-base: 18px;
  --line-height-base: 1.7;
  
  /* Spacing */
  --spacing-unit: 8px;
  --container-width: 680px;
}

/* Тёмная тема */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #252525;
    --text-primary: #eeeeee;
    --text-secondary: #aaaaaa;
    --text-link: #ff5792;
    --text-link-hover: #ff8ab8;
    --border-color: #333333;
    --code-bg: #2a2a2a;
    --code-text: #e6e6e6;
  }
}

/* ===== Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: var(--font-size-base);
}

body {
  font-family: var(--font-body);  /* ← Georgia для всего текста */
  line-height: var(--line-height-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Container ===== */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 calc(var(--spacing-unit) * 3);
}

/* ===== Header ===== */
.site-header {
  padding: calc(var(--spacing-unit) * 5) 0 calc(var(--spacing-unit) * 6);  /* уменьшил с 8 до 5 */
  border-bottom: 1px solid var(--border-color);
  margin-bottom: calc(var(--spacing-unit) * 6);
}

.site-title {
  font-family: var(--font-headings);  /* ← PT Serif Caption */
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: calc(var(--spacing-unit) * 1);
}

.site-title a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-title a:hover {
  color: var(--text-link-hover);
}

.site-description {
  font-family: var(--font-body);  /* ← Georgia */
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: calc(var(--spacing-unit) * 1);  /* добавил отступ - может и зря! */
}
 
.site-links {
  font-size: 1.1rem;  /* фонт как в description */
  margin-top: calc(var(--spacing-unit) * 1);
}
 
.site-links a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}
 
.site-links a:hover {
  color: var(--text-link-hover);
  border-bottom-color: var(--text-link-hover);
}

/* ===== Main Content ===== */
main {
  min-height: 60vh;
  padding-bottom: calc(var(--spacing-unit) * 8);
}

/* ===== Post Preview (Homepage) ===== */
.post-preview {
  margin-bottom: calc(var(--spacing-unit) * 7);
  padding-bottom: calc(var(--spacing-unit) * 5);
  border-bottom: 1px solid var(--border-color);
}

.post-preview:last-child {
  border-bottom: none;
}

.post-title {
  font-family: var(--font-headings);  /* ← PT Serif Caption */
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: calc(var(--spacing-unit) * 2);
  letter-spacing: -0.01em;
}

.post-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-title a:hover {
  color: var(--text-link);
}

.post-meta {
  font-family: var(--font-body);  /* ← Georgia */
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.reading-time {
  margin-left: calc(var(--spacing-unit) * 1);
}

.post-summary {
  font-family: var(--font-body);  /* ← Georgia */
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Single Post ===== */
.post-header {
  margin-bottom: calc(var(--spacing-unit) * 6);
}

.post-header h1 {
  font-family: var(--font-headings);  /* ← PT Serif Caption */
  font-size: 2.75rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: calc(var(--spacing-unit) * 2);
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.post-content {
  font-family: var(--font-body);  /* ← Georgia для текста */
  font-size: 1.1rem;
  line-height: 1.7;
}

.post-content h2 {
  font-family: var(--font-headings);  /* ← PT Serif Caption */
  font-size: 1.9rem;
  font-weight: 400;
  margin-top: calc(var(--spacing-unit) * 6);
  margin-bottom: calc(var(--spacing-unit) * 3);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-family: var(--font-headings);  /* ← PT Serif Caption */
  font-size: 1.45rem;
  font-weight: 400;
  margin-top: calc(var(--spacing-unit) * 5);
  margin-bottom: calc(var(--spacing-unit) * 2);
  letter-spacing: -0.005em;
}

.post-content h4,
.post-content h5,
.post-content h6 {
  font-family: var(--font-headings);  /* ← PT Serif Caption */
  font-weight: 400;
}

.post-content p {
  margin-bottom: calc(var(--spacing-unit) * 3);
}

.post-content a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid var(--text-link);
  transition: all 0.2s ease;
}

.post-content a:hover {
  color: var(--text-link-hover);
  border-bottom-color: var(--text-link-hover);
}

.post-content ul,
.post-content ol {
  margin-bottom: calc(var(--spacing-unit) * 3);
  padding-left: calc(var(--spacing-unit) * 5);
}

.post-content li {
  margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.post-content blockquote {
  margin: calc(var(--spacing-unit) * 4) 0;
  padding-left: calc(var(--spacing-unit) * 3);
  border-left: 3px solid var(--text-link);
  font-style: italic;
  color: var(--text-secondary);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--code-bg);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--code-text);
}

.post-content pre {
  background-color: var(--code-bg);
  padding: calc(var(--spacing-unit) * 3);
  border-radius: 6px;
  overflow-x: auto;
  margin: calc(var(--spacing-unit) * 4) 0;
  line-height: 1.5;
}

.post-content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 0.85rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: calc(var(--spacing-unit) * 4) 0;
}

/* ===== Post Footer ===== */
.post-footer {
  margin-top: calc(var(--spacing-unit) * 8);
  padding-top: calc(var(--spacing-unit) * 4);
  border-top: 1px solid var(--border-color);
}

.back-link {
  color: var(--text-link);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--text-link-hover);
}

/* ===== Page (статические страницы) ===== */
.page {
  max-width: var(--container-width);
  margin: 0 auto;
}

.page-header {
  margin-bottom: calc(var(--spacing-unit) * 6);
}

.page-header h1 {
  font-family: var(--font-headings);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: calc(var(--spacing-unit) * 2);
  letter-spacing: -0.015em;
}

.page-content {
  font-family: var(--font-body);
  font-size: 1.1rem;
  line-height: 1.7;
}

.page-content h2 {
  font-family: var(--font-headings);
  font-size: 1.9rem;
  font-weight: 700;
  margin-top: calc(var(--spacing-unit) * 6);
  margin-bottom: calc(var(--spacing-unit) * 3);
}

.page-content p {
  margin-bottom: calc(var(--spacing-unit) * 3);
}

.page-content a {
  color: var(--text-link);
  text-decoration: none;
  border-bottom: 1px solid var(--text-link);
  transition: all 0.2s ease;
}

.page-content a:hover {
  color: var(--text-link-hover);
  border-bottom-color: var(--text-link-hover);
}

/* ===== Footer ===== */
.site-footer {
  padding: calc(var(--spacing-unit) * 6) 0;
  border-top: 1px solid var(--border-color);
  margin-top: calc(var(--spacing-unit) * 8);
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .site-title {
    font-size: 2rem;
  }

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

  .post-title {
    font-size: 1.6rem;
  }

  .container {
    padding: 0 calc(var(--spacing-unit) * 2);
  }
}
