@import url("syntax.css");

:root {
  --text: #1a1a1a;
  --text-secondary: #666;
  --background: #fff;
  --accent: #0066cc;
  --border: #e5e5e5;
  --code-bg: #f5f5f5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text);
  background: var(--background);
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 0.875rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

  & nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
  }
}

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 1.5rem;

  & a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;

    &:hover {
      color: var(--text);
    }
  }
}

/* Typography */
h1,
h2,
h3,
h4 {
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1.5rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;

  &:hover {
    text-decoration: none;
  }
}

/* Post list */
.post-list {
  list-style: none;
  padding-left: 0;

  & li {
    margin-bottom: 2rem;
  }

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

  & h2 {
    font-size: 1.25rem;
    margin: 0 0 0.25rem 0;

    &:hover {
      color: var(--accent);
    }
  }

  & time {
    color: var(--text-secondary);
    font-size: 0.9rem;
  }
}

/* Post */
.post-header {
  margin-bottom: 2.5rem;

  & h1 {
    margin: 0 0 0.5rem 0;
  }

  & time {
    color: var(--text-secondary);
    font-size: 0.95rem;
  }
}

.post-content {
  & h2:first-child,
  & h3:first-child {
    margin-top: 0;
  }
}

/* Code */
code {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 8px;
  margin-bottom: 1.5rem;

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

.highlighter-rouge {
  margin-bottom: 1.5rem;

  & .highlight {
    padding: 0.675rem 1.25rem;
    overflow-x: auto;
    border-radius: 8px;

    & pre {
      margin: 0;
      padding: 0;
      background: none;
      line-height: 1.25rem;
    }
  }
}

/* Lists */
ul,
ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Blockquote */
blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Collapsible section */
.collapsible {
  background: var(--code-bg);
  border-radius: 8px;
  margin: 2rem -1.25rem;

  &:not(.expanded):hover {
    background: color-mix(in srgb, var(--code-bg) 97.5%, black);
  }

  &.expanded .collapsible-header {
    cursor: default;
  }

  &.expanded .collapsible-title::after {
    content: none;
  }

  &.expanded .collapsible-content {
    display: block;
  }
}

.collapsible-header {
  padding: 1rem 1.25rem;
  user-select: none;
  cursor: pointer;
}

.collapsible-title {
  display: inline;
  font-weight: bold;
  margin: 0;

  &::after {
    content: " ▼";
  }
}

.collapsible-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0 0;
}

.collapsible-content {
  display: none;
  padding: 1.25rem;

  & > *:last-child {
    margin-bottom: 0;
  }
}

/* Contacts */
.contacts {
  display: flex;
  gap: 2rem;
  margin-top: 2rem;

  @media (max-width: 600px) {
    flex-direction: column;
    gap: 0.5rem;
  }
}

.about-blog {
  margin-top: 4rem;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

  h1 {
    font-size: 1.75rem;
  }
}
