/* ============================================================
   s14ke — custom Hexo theme  (dark)
   ============================================================ */

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

html, body {
  background: #0a0a0b;
  color: #e8e4de;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 17px;
  line-height: 1.65;
}

::selection { background: rgba(230, 0, 0, 0.92); color: #fbfaf8; }

a { color: inherit; text-decoration: none; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; border-radius: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* ---- HEADER ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid #252428;
}

.header-inner {
  padding: 0 36px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-family: 'Hack', 'Pretendard', ui-monospace, monospace;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: #e8e4de;
  text-decoration: none;
}

.logo-name { font-variant-ligatures: none; }

.logo-tilde { color: #ff2020; }

.logo-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  margin-left: 2px;
  background: #ff2020;
  transform: translateY(2px);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 14px;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
}

.nav-link {
  color: #636069;
  text-decoration: none;
  transition: color 0.15s;
}

.nav-link::after {
  content: '';
  display: block;
  height: 1.5px;
  background: #ff2020;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s;
  margin-top: 3px;
}

.nav-link:hover,
.nav-link.active { color: #e8e4de; }

.nav-link:hover::after,
.nav-link.active::after { transform: scaleX(1); }

/* ---- MAIN CONTAINER ---- */
.main-container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---- HERO ---- */
.hero {
  padding: 48px 0 36px;
  border-bottom: 1px solid #252428;
}

.hero-label {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: #ff2020;
  margin-bottom: 18px;
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.hero-bio {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
  color: #8a8590;
}

.hero-bio a {
  color: #ff3535;
  text-decoration: underline;
  text-decoration-color: rgba(255, 32, 32, 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.hero-bio a:hover { text-decoration-color: #ff3535; }

/* ---- WRITING SECTION (home) ---- */
.writing-section {
  padding: 40px 0 100px;
}

.writing-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-label {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #636069;
}

.post-count {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  color: #3e3c48;
}

.year-label {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  color: #3e3c48;
  letter-spacing: 0.05em;
  padding: 18px 0 6px;
}

/* ---- POST ROW ---- */
.post-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 14px;
  margin: 0 -14px;
  border-radius: 9px;
  border-bottom: 1px solid #1e1d22;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.post-row:hover { background: #111115; }
.post-row:hover .post-title-text { color: #ff3535; }

.post-date {
  flex: 0 0 auto;
  width: 62px;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  color: #3e3c48;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.post-title-text {
  flex: 1 1 auto;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: color 0.15s;
  min-width: 0;
}

.kr-badge {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  color: #ff2020;
  border: 1px solid #3d1818;
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 9px;
  vertical-align: 2px;
}

.post-tags-list {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
}

.post-tag {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 11.5px;
  color: #636069;
}

/* ---- ARCHIVE / TAG SECTION ---- */
.archive-section {
  padding: 0 0 100px;
}

.archive-header {
  padding: 48px 0 36px;
  border-bottom: 1px solid #252428;
  margin-bottom: 0;
}

/* ---- TAGS GRID ---- */
.tags-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 32px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: #a8a4a0;
  background: #111115;
  border: 1px solid #252428;
  border-radius: 20px;
  padding: 5px 13px;
  transition: all 0.15s;
  text-decoration: none;
}

.tag-item::before {
  content: '#';
  color: #ff2020;
}

.tag-item:hover {
  background: #1a0f0f;
  border-color: #3d1818;
  color: #ff3535;
}

.tag-item:hover::before { color: #ff3535; }

.tag-count {
  font-size: 11px;
  color: #636069;
  background: #1e1d22;
  border-radius: 10px;
  padding: 0 6px;
  margin-left: 2px;
}

/* ---- POST LAYOUT ---- */
.post-layout {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

/* ---- TOC SIDEBAR ---- */
.toc-sidebar {
  flex: 0 0 168px;
  position: sticky;
  top: 96px;
  padding-top: 72px;
  display: none;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2830 transparent;
}

.toc-sidebar::-webkit-scrollbar { width: 3px; }
.toc-sidebar::-webkit-scrollbar-track { background: transparent; }
.toc-sidebar::-webkit-scrollbar-thumb {
  background: #2a2830;
  border-radius: 4px;
  transition: background 0.15s;
}
.toc-sidebar::-webkit-scrollbar-thumb:hover { background: #ff2020; }

@media (min-width: 1080px) {
  .toc-sidebar { display: block; }
}

.toc-label {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3e3c48;
  margin-bottom: 14px;
}

.toc-sidebar ol,
.toc-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar .toc-link {
  display: block;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  padding: 5px 0 5px 12px;
  border-left: 2px solid #252428;
  color: #636069;
  transition: color 0.15s, border-color 0.15s;
}

.toc-sidebar .toc-link:hover,
.toc-sidebar .toc-link.active {
  color: #ff3535;
  border-left-color: #ff2020;
  font-weight: 500;
}

/* ---- POST ARTICLE ---- */
.post-article {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 720px;
  padding: 72px 0 60px;
}

.back-link {
  display: inline-block;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12.5px;
  color: #636069;
  text-decoration: none;
  transition: color 0.15s;
  margin-bottom: 26px;
}

.back-link:hover { color: #ff3535; }

.post-tags-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.post-tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #a8a4a0;
  background: #111115;
  border: 1px solid #252428;
  border-radius: 20px;
  padding: 4px 12px;
  transition: all 0.15s;
  text-decoration: none;
}

.post-tag-hash {
  color: #ff2020;
  margin-right: 1px;
}

.post-tag-badge:hover {
  background: #1a0f0f;
  border-color: #3d1818;
  color: #ff3535;
}

.post-heading {
  margin: 0 0 14px;
  font-size: clamp(28px, 4.5vw, 48px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.post-meta {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  color: #636069;
  padding-bottom: 26px;
  margin-bottom: 34px;
  border-bottom: 1px solid #252428;
}

/* ---- POST CONTENT ---- */
.post-content {
  color: #f0eeea;
  line-height: 1.8;
  overflow-wrap: break-word;
  word-break: break-word;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 48px;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #252428;
  color: #e8e4de;
}

.post-content h1 { font-size: 33px; }
.post-content h2 { font-size: 27px; }
.post-content h3 { font-size: 22px; border-bottom: none; }
.post-content h4 { font-size: 18px; border-bottom: none; }

.post-content p { margin: 20px 0; text-indent: 0.25em; }

.post-content a {
  color: #ff3535;
  text-decoration: underline;
  text-decoration-color: rgba(255, 32, 32, 0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

.post-content a:hover { text-decoration-color: #ff3535; }

.post-content code {
  font-family: 'Hack', 'Pretendard', ui-monospace, monospace;
  font-size: 0.88em;
  background: #17161c;
  color: #f07070;
  padding: 1.5px 5px;
  border-radius: 5px;
}

.post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 13px;
  border-radius: 0;
}

.post-content img {
  max-width: 90%;
  border-radius: 8px;
  border: 1px solid #252428;
  display: block;
  margin: 24px auto;
}

.post-content video {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #252428;
  display: block;
  margin: 24px auto;
}

.post-content blockquote {
  border-left: 3px solid #ff2020;
  padding: 4px 0 4px 20px;
  margin: 24px 0;
  color: #8a8590;
  font-style: italic;
}

.post-content ul,
.post-content ol {
  padding-left: 24px;
  margin: 16px 0;
}

.post-content li { margin: 6px 0; }

.post-content hr {
  border: none;
  border-top: 1px solid #252428;
  margin: 40px 0;
}

/* ---- TABLES (markdown) ---- */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 24px 0;
  border: 1px solid #252428;
  border-radius: 12px;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  margin: 0;
  border: none;
  border-radius: 0;
}

.post-content th {
  background: #111115;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  color: #636069;
  padding: 11px 16px;
  text-align: left;
  font-weight: 500;
}

.post-content td {
  padding: 11px 16px;
  border-top: 1px solid #1e1d22;
  color: #f0eeea;
}

.post-content tr:first-child td,
.post-content tr:first-child th { border-top: none; }

/* ---- CODE BLOCKS ---- */
.post-content .code-block {
  border-radius: 12px;
  overflow: hidden;
  margin: 24px 0;
  border: 1px solid #1c1c20;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.post-content .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d0d0f;
  padding: 9px 14px;
  border-bottom: 1px solid #1c1c20;
}

.post-content .code-filename {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 11.5px;
  color: #636069;
}

.post-content .code-copy {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 9px;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 11px;
  color: #636069;
  cursor: pointer;
  transition: all 0.15s;
}

.post-content .code-copy:hover {
  color: #e8e4de;
  border-color: rgba(255, 255, 255, 0.25);
}

.post-content pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: #111113;
  font-family: 'Hack', 'Pretendard', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #c8c4bc;
  border: none;
  border-radius: 0;
}

/* ---- HIGHLIGHT.JS TOKEN COLORS ---- */
/* comments */
.post-content .hljs-comment,
.post-content .hljs-quote { color: #5a5760; font-style: italic; }

/* keywords, control flow */
.post-content .hljs-keyword,
.post-content .hljs-selector-tag,
.post-content .hljs-built_in,
.post-content .hljs-meta,
.post-content .hljs-meta-keyword { color: #c57cf5; }

/* strings */
.post-content .hljs-string,
.post-content .hljs-template-literal { color: #5ecb85; }

/* attributes (JSON keys, HTML attrs) */
.post-content .hljs-attr { color: #4db8f0; }

/* numbers, booleans */
.post-content .hljs-number,
.post-content .hljs-literal { color: #e0a85a; }

/* function/class names */
.post-content .hljs-title,
.post-content .hljs-title.class_,
.post-content .hljs-title.function_ { color: #4db8f0; }

/* section headings (markdown, etc.) */
.post-content .hljs-section { color: #4db8f0; }

/* tag names (HTML/JSX) */
.post-content .hljs-name,
.post-content .hljs-tag { color: #c57cf5; }

/* types */
.post-content .hljs-type,
.post-content .hljs-class { color: #6b9fd4; }

/* variables */
.post-content .hljs-variable,
.post-content .hljs-variable.language_,
.post-content .hljs-template-variable { color: #f0a060; }

/* regex */
.post-content .hljs-regexp { color: #e0a85a; }

/* symbols, constants */
.post-content .hljs-symbol,
.post-content .hljs-bullet { color: #6b9fd4; }

/* CSS selectors */
.post-content .hljs-selector-class,
.post-content .hljs-selector-id,
.post-content .hljs-selector-attr,
.post-content .hljs-selector-pseudo { color: #5ecb85; }

/* operators */
.post-content .hljs-operator { color: #9a96b0; }

/* punctuation */
.post-content .hljs-punctuation { color: #7a7690; }

/* function params */
.post-content .hljs-params { color: #f0a060; }

/* string substitutions */
.post-content .hljs-subst { color: #c8c4bc; }

/* links */
.post-content .hljs-link { color: #5ecb85; text-decoration: underline; }

/* diff */
.post-content .hljs-deletion { color: #e8564a; background: rgba(232, 86, 74, 0.1); }
.post-content .hljs-addition { color: #4ec46a; background: rgba(78, 196, 106, 0.1); }

/* shell / bash: $ # prompt */
.post-content .hljs-meta .hljs-keyword { color: #ff2020; font-weight: 600; }

/* ---- FIGURE / CAPTIONS ---- */
.post-content figure { margin: 24px 0; }

.post-content figcaption {
  margin-top: 10px;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  color: #636069;
  text-align: center;
}

/* ---- LIGHTBOX ---- */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  transition: background 0.2s;
}

.lb-overlay.lb-open { background: rgba(0, 0, 0, 0.9); }

.lb-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s, transform 0.25s ease;
  cursor: zoom-in;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.lb-overlay.lb-open .lb-img { opacity: 1; transform: scale(1); }

/* ---- POST NAVIGATION ---- */
.post-nav {
  display: flex;
  gap: 14px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid #252428;
}

.post-nav-item {
  flex: 1;
  text-decoration: none;
  border: 1px solid #252428;
  border-radius: 11px;
  padding: 14px 16px;
  transition: all 0.15s;
  color: inherit;
  min-width: 0;
}

.post-nav-item:empty { border-color: transparent; }

.post-nav-item:not(:empty):hover { border-color: #ff2020; }
.post-nav-item:not(:empty):hover .post-nav-title { color: #ff3535; }

.post-nav-next { text-align: right; }

.post-nav-dir {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 11px;
  color: #3e3c48;
  margin-bottom: 5px;
}

.post-nav-title {
  font-size: 14px;
  font-weight: 500;
  color: #f0eeea;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- ABOUT PAGE ---- */
.about-content {
  max-width: 720px;
  padding: 20px 0 100px;
}

.about-content p { text-indent: 0; }

.about-content h1:first-child,
.about-content h2:first-child,
.about-content h3:first-child {
  margin-top: 0;
}

/* ---- FOOTER ---- */
.site-footer {
  border-top: 1px solid #252428;
  margin-top: 0;
}

.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  color: #3e3c48;
}

.footer-accent { color: #ff2020; }

/* ---- 404 ---- */
.not-found-container {
  min-height: calc(100vh - 64px - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.not-found-code {
  font-family: 'Pretendard', -apple-system, 'Segoe UI', system-ui, sans-serif;
  font-size: 120px;
  font-weight: 500;
  line-height: 1;
  color: #1e1d22;
  letter-spacing: -4px;
  user-select: none;
}

.not-found-msg {
  font-size: 16px;
  color: #636069;
}

.not-found-back {
  margin-top: 8px;
  font-size: 14px;
  color: #ff2020;
  transition: opacity 0.15s;
}

.not-found-back:hover { opacity: 0.7; }

/* ---- RESPONSIVE ---- */

/* large desktop (1400px+) */
@media (min-width: 1400px) {
  .main-container { max-width: 1240px; }
  .footer-inner { max-width: 1240px; }
  .post-article { max-width: 800px; }
  .toc-sidebar { flex: 0 0 200px; }
}

/* wide desktop (1800px+) */
@media (min-width: 1800px) {
  html, body { font-size: 18px; }
  .main-container { max-width: 1480px; }
  .footer-inner { max-width: 1480px; }
  .post-article { max-width: 940px; }
  .toc-sidebar { flex: 0 0 240px; }
}

/* tablet */
@media (max-width: 900px) {
  .header-inner { padding: 0 24px; }
  .main-container { padding: 0 20px; }
  .footer-inner { padding: 24px 20px; }
  .post-tags-list { display: none; }
}

/* large phone / small tablet */
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; height: 56px; }
  .footer-inner { padding: 20px 16px; }
  .logo { font-size: 14px; }
  .logo-cursor { width: 7px; height: 14px; }
  .site-nav { gap: 14px; font-size: 12px; }
  .main-container { padding: 0 16px; }

  .hero { padding: 36px 0 28px; }
  .hero-label { font-size: 11.5px; margin-bottom: 14px; }
  .hero-bio { font-size: 14px; }

  .archive-header { padding: 36px 0 28px; }

  .writing-section { padding: 28px 0 80px; }
  .post-row { padding: 13px 10px; margin: 0 -10px; gap: 12px; }
  .post-date { width: 52px; font-size: 11.5px; }
  .post-title-text { font-size: 15px; }

  .post-article { padding: 32px 0 48px; }
  .post-meta { font-size: 12px; padding-bottom: 20px; margin-bottom: 26px; }
  .back-link { font-size: 12px; margin-bottom: 20px; }

  .post-content { font-size: 15px; }
  .post-content h1 { font-size: 24px; }
  .post-content h2 { font-size: 20px; }
  .post-content h3 { font-size: 17px; }
  .post-content h4 { font-size: 15px; }
  .post-content img { max-width: 100%; }
  .post-content pre { font-size: 12px; padding: 14px 14px; }
  .post-content table { font-size: 12.5px; }
  .post-content th { font-size: 11px; padding: 8px 10px; }
  .post-content td { padding: 8px 10px; }

  .post-nav { flex-direction: column; gap: 10px; margin-top: 36px; }
  .post-nav-title { font-size: 13px; }

  .about-content { padding: 16px 0 60px; }

  .tags-grid { gap: 8px; padding-top: 24px; }

  .footer-inner { flex-direction: column; gap: 6px; text-align: center; padding: 20px 16px; }

  .not-found-code { font-size: 80px; letter-spacing: -2px; }
}

/* small phone */
@media (max-width: 400px) {
  .site-nav { gap: 10px; font-size: 11.5px; }
  .post-title-text { font-size: 14px; }
  .post-content pre { font-size: 11.5px; }
  .post-content table { font-size: 11.5px; }
  .post-content th { font-size: 10.5px; padding: 7px 8px; }
  .post-content td { padding: 7px 8px; }
  .not-found-code { font-size: 64px; }
}
