/* ============================================
   arslnb blog
   Typography-first. Dark grey on white. Small.
   Dark mode support.
   ============================================ */

/* ---- Light theme (default) ---- */
:root,
[data-theme="light"] {
  --text: #3a3a3a;
  --text-light: #777;
  --text-faint: #aaa;
  --bg: #fff;
  --bg-code: #f6f6f6;
  --border: #e0e0e0;
  --accent: #3a3a3a;
  --ascii-base: #c8c8c8;
  --font-body: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --font-size: 16px;
  --line-height: 1.75;
  --max-width: 680px;

  /* syntax */
  --syn-comment: #998;
  --syn-keyword: #333;
  --syn-string: #b35e14;
  --syn-builtin: #555;
  --syn-func: #444;
  --syn-number: #164;
  --syn-attr: #666;
  --syn-tag: #333;
  --syn-op: #333;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
  --text: #c9c9c9;
  --text-light: #8a8a8a;
  --text-faint: #5a5a5a;
  --bg: #161616;
  --bg-code: #1e1e1e;
  --border: #2a2a2a;
  --accent: #c9c9c9;
  --ascii-base: #3a3a3a;

  /* syntax (dark) */
  --syn-comment: #6a6a6a;
  --syn-keyword: #c9a0dc;
  --syn-string: #ce9178;
  --syn-builtin: #8a8a8a;
  --syn-func: #dcdcaa;
  --syn-number: #b5cea8;
  --syn-attr: #9cdcfe;
  --syn-tag: #c9a0dc;
  --syn-op: #d4d4d4;
}

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

html {
  font-size: var(--font-size);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: var(--line-height);
  transition: background 0.25s ease, color 0.25s ease;
}

/* ---- ASCII Banner ---- */
.ascii-banner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 0;
  overflow: hidden;
}

#ascii-canvas {
  display: block;
  max-width: 100%;
  height: 80px;
}

/* ---- Header ---- */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.site-header nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  transition: border-color 0.25s ease;
}

.site-title {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-light);
  text-decoration: none;
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-twitter {
  font-size: 0.82rem !important;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.nav-twitter:hover {
  opacity: 1;
}

/* ---- Dark mode toggle ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

/* Show sun in dark mode, moon in light mode */
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---- Main Content ---- */
.content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ---- Post List (Index) ---- */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 0.6rem 0;
}

.post-list li + li {
  border-top: 1px solid var(--border);
}

.post-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  text-decoration: none;
  color: var(--text);
  gap: 1rem;
}

.post-list a:hover .post-list-title {
  color: var(--text-light);
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 3px;
}

.post-list-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.post-list-title {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 400;
  transition: color 0.15s;
}

.post-list-desc {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-list-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

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

.post-title {
  font-family: var(--font-body);
  font-size: 1.8rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}

.post-date {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ---- Post Content Typography ---- */
.post-content h2 {
  font-size: 1.35rem;
  font-weight: 500;
  margin: 2.5rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 1.15rem;
  font-weight: 500;
  margin: 2rem 0 0.5rem;
}

.post-content p {
  margin-bottom: 1.2rem;
}

.post-content a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

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

.post-content ul,
.post-content ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.3rem;
}

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 0 0.1rem 1.25rem;
  border-left: 2px solid var(--border);
  color: var(--text-light);
  font-style: italic;
}

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

/* ---- Tables ---- */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

.post-content th,
.post-content td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-content th {
  font-weight: 500;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-light);
}

/* ---- Code ---- */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  background: var(--bg-code);
  padding: 0.15em 0.35em;
  border-radius: 3px;
  transition: background 0.25s ease;
}

.post-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  transition: background 0.25s ease, border-color 0.25s ease;
}

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

/* ---- Rouge syntax highlighting ---- */
.highlight .c,
.highlight .cm,
.highlight .c1,
.highlight .cs { color: var(--syn-comment); font-style: italic; }
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr { color: var(--syn-keyword); font-weight: 500; }
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .sh,
.highlight .sx { color: var(--syn-string); }
.highlight .nb,
.highlight .bp { color: var(--syn-builtin); }
.highlight .nf,
.highlight .nx { color: var(--syn-func); }
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo { color: var(--syn-number); }
.highlight .na { color: var(--syn-attr); }
.highlight .nt { color: var(--syn-tag); }
.highlight .o,
.highlight .ow { color: var(--syn-op); }

/* ---- Images ---- */
.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.post-content figure {
  margin: 1.5rem 0;
}

.post-content figcaption {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-top: 0.4rem;
  text-align: center;
}

/* ---- Page ---- */
.page h1 {
  font-size: 1.6rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.page-content p {
  margin-bottom: 1.2rem;
}

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

/* ---- Footer ---- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  :root {
    --font-size: 15px;
  }

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

  .post-list a {
    flex-direction: column;
    gap: 0.15rem;
  }

  .post-list-date {
    order: -1;
  }

  .post-list-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  #ascii-canvas {
    height: 60px;
  }
}
