/* ═══════════════════════════════════════════════════════════════
   NotionGit Jekyll Blog — Main Stylesheet
   Minimalist · Modern · Fast · Dark-mode ready
   ═══════════════════════════════════════════════════════════════ */

/* ─── Design tokens ──────────────────────────────────────────── */
:root {
  /* Colors — light */
  --bg:              #fafaf9;
  --surface:         #ffffff;
  --text:            #18181b;
  --text-secondary:  #52525b;
  --text-muted:      #a1a1aa;
  --border:          #e4e4e7;
  --accent:          #2563eb;
  --accent-hover:    #1d4ed8;
  --code-bg:         #f4f4f5;
  --code-text:       #18181b;
  --tag-bg:          #f4f4f5;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas,
               "Liberation Mono", "Courier New", monospace;

  /* Layout */
  --container:   720px;
  --radius:      6px;
  --radius-lg:   12px;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-6: 1.5rem;
  --s-8: 2rem;
  --s-12: 3rem;
  --s-16: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:             #09090b;
    --surface:        #18181b;
    --text:           #fafafa;
    --text-secondary: #d4d4d8;
    --text-muted:     #71717a;
    --border:         #27272a;
    --accent:         #60a5fa;
    --accent-hover:   #93c5fd;
    --code-bg:        #27272a;
    --code-text:      #e4e4e7;
    --tag-bg:         #27272a;
  }
}

/* ─── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* ─── Container ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-6);
}

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
}

.site-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
  transition: color 0.15s ease;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-6);
}

.site-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* ─── Main ───────────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: var(--s-16) 0;
}

/* ─── Home page ──────────────────────────────────────────────── */
.home-header {
  margin-bottom: var(--s-12);
}

.home-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ─── Posts list ─────────────────────────────────────────────── */
.posts-list {
  display: flex;
  flex-direction: column;
}

/* ─── Post card ──────────────────────────────────────────────── */
.post-card {
  display: block;
  padding: var(--s-8) 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: none;
}

.post-card:first-child {
  padding-top: 0;
}

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

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-bottom: var(--s-2);
}

.post-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 9px;
  background: var(--tag-bg);
  color: var(--text-secondary);
  border-radius: 99px;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease;
}

.tag:hover {
  background: var(--border);
  color: var(--text);
}

.post-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: var(--s-2);
  transition: color 0.15s ease;
}

.post-card:hover .post-card-title {
  color: var(--accent);
}

.post-excerpt {
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Post layout ────────────────────────────────────────────── */
.post-header {
  margin-bottom: var(--s-8);
}

.post-title {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: var(--s-4);
  color: var(--text);
}

.post-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-4);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.post-info time {
  font-variant-numeric: tabular-nums;
}

.post-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: var(--s-8);
}

/* ─── Post body ──────────────────────────────────────────────── */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.post-content > * + * {
  margin-top: 1.25em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.post-content h1 { font-size: 1.7rem; }
.post-content h2 { font-size: 1.35rem; }
.post-content h3 { font-size: 1.1rem; }
.post-content h4 { font-size: 1rem; }

.post-content p {
  margin: 0 0 1.25em;
}

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

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

.post-content ul,
.post-content ol {
  padding-left: 1.6em;
  margin: 0 0 1.25em;
}

.post-content li {
  margin-bottom: 0.35em;
}

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

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5em 0;
  display: block;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
}

.post-content blockquote {
  margin: 1.5em 0;
  padding: 0.8em 1.25em;
  border-left: 3px solid var(--accent);
  background: var(--code-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

.post-content blockquote p {
  margin: 0;
}

.post-content details {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-4);
  margin: 1.25em 0;
}

.post-content details summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ─── Code ───────────────────────────────────────────────────── */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25em;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.875em;
  line-height: 1.65;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 1em;
  color: inherit;
}

/* ─── Post footer ────────────────────────────────────────────── */
.post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-top: var(--s-16);
  padding-top: var(--s-8);
  border-top: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* ─── Page layout ────────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--s-8);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.page-content > * + * {
  margin-top: 1.25em;
}

.page-content h2,
.page-content h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.page-content h2 { font-size: 1.35rem; }
.page-content h3 { font-size: 1.1rem; }

.page-content p {
  margin: 0 0 1.25em;
}

.page-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-content ul,
.page-content ol {
  padding-left: 1.6em;
  margin: 0 0 1.25em;
}

/* ─── Tags page ──────────────────────────────────────────────── */
.tags-header {
  margin-bottom: var(--s-12);
}

.tags-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.tag-group {
  margin-bottom: var(--s-12);
}

.tag-group-name {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
}

.tag-count {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
}

.tag-posts {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.tag-post-link {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

.tag-post-link:hover {
  color: var(--accent);
}

.tag-post-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 95px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ─── Empty state ────────────────────────────────────────────── */
.empty-state {
  padding: var(--s-16) 0;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.05rem;
}

/* ─── Site footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--s-6) 0;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.footer-inner a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-inner a:hover {
  color: var(--text);
}

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

  .main {
    padding: var(--s-12) 0;
  }

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

  .tag-post-date {
    display: none;
  }

  .post-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Syntax Highlighting — GitHub-inspired (Rouge)
   ═══════════════════════════════════════════════════════════════ */

/* Light mode */
.highlight .c,
.highlight .cm,
.highlight .cp,
.highlight .c1,
.highlight .cs  { color: #6a737d; font-style: italic; }  /* Comments */

.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kr  { color: #d73a49; font-weight: bold; }    /* Keywords */
.highlight .kc  { color: #0086b3; }                        /* Keyword.Constant */
.highlight .kt  { color: #d73a49; }                        /* Keyword.Type */

.highlight .s,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .s2,
.highlight .s1,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .ss,
.highlight .sx,
.highlight .sr  { color: #032f62; }                        /* Strings */

.highlight .n   { color: #24292e; }                        /* Name */
.highlight .na  { color: #6f42c1; }                        /* Name.Attribute */
.highlight .nb  { color: #0086b3; }                        /* Name.Builtin */
.highlight .nc,
.highlight .nd,
.highlight .ne,
.highlight .nf,
.highlight .nl,
.highlight .nn  { color: #6f42c1; }                        /* Name.Class/Function */
.highlight .ni  { color: #005cc5; }                        /* Name.Entity */

.highlight .m,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo  { color: #005cc5; }                        /* Numbers */

.highlight .o,
.highlight .ow  { color: #d73a49; }                        /* Operators */
.highlight .p   { color: #24292e; }                        /* Punctuation */

.highlight .err { color: #cb2431; background: #ffeef0; }   /* Error */

/* Dark mode syntax highlighting */
@media (prefers-color-scheme: dark) {
  .highlight .c,
  .highlight .cm,
  .highlight .cp,
  .highlight .c1,
  .highlight .cs  { color: #8b949e; }

  .highlight .k,
  .highlight .kd,
  .highlight .kn,
  .highlight .kr  { color: #ff7b72; }
  .highlight .kc  { color: #79c0ff; }
  .highlight .kt  { color: #ff7b72; }

  .highlight .s,
  .highlight .sb,
  .highlight .sc,
  .highlight .sd,
  .highlight .s2,
  .highlight .s1,
  .highlight .se,
  .highlight .sh,
  .highlight .si,
  .highlight .ss,
  .highlight .sx,
  .highlight .sr  { color: #a5d6ff; }

  .highlight .n   { color: #c9d1d9; }
  .highlight .na  { color: #d2a8ff; }
  .highlight .nb  { color: #79c0ff; }
  .highlight .nc,
  .highlight .nd,
  .highlight .ne,
  .highlight .nf,
  .highlight .nl,
  .highlight .nn  { color: #d2a8ff; }
  .highlight .ni  { color: #79c0ff; }

  .highlight .m,
  .highlight .mf,
  .highlight .mh,
  .highlight .mi,
  .highlight .mo  { color: #79c0ff; }

  .highlight .o,
  .highlight .ow  { color: #ff7b72; }
  .highlight .p   { color: #c9d1d9; }

  .highlight .err { color: #ff7b72; background: #3d1f1f; }
}
