/* ============================================================
   Hyun Dev Blog — style.css
   ============================================================ */

/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Noto+Sans+KR:wght@400;500;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --color-bg:        #f8fafc;
  --color-surface:   #ffffff;
  --color-primary:   #2563eb;
  --color-primary-h: #1d4ed8;
  --color-text:      #1e293b;
  --color-text-sub:  #64748b;
  --color-border:    #e2e8f0;
  --color-tag-bg:    #eff6ff;
  --color-tag-text:  #2563eb;
  --color-code-bg:   #0f172a;
  --color-code-text: #e2e8f0;

  --font-body: 'Inter', 'Noto Sans KR', -apple-system, sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;

  --radius: 8px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 6px 24px rgba(0, 0, 0, 0.10);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  font-size: 16px;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-primary-h); }

img { max-width: 100%; height: auto; display: block; }

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

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}
.site-logo span { color: var(--color-primary); }
.site-logo:hover { color: var(--color-text); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav a {
  color: var(--color-text-sub);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--color-primary);
  background: var(--color-tag-bg);
}

/* Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--color-text);
  font-size: 22px;
  line-height: 1;
}

/* ===== Layout ===== */
.layout {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: 1100px;
  margin: 36px auto;
  padding: 0 20px;
  gap: 36px;
  align-items: flex-start;
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  min-width: 0;
}

/* ===== Post Card (Home) ===== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}
.post-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--color-text-sub);
}

.post-card-category {
  background: var(--color-tag-bg);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.post-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.4;
  margin-bottom: 10px;
  display: block;
}
.post-card-title:hover { color: var(--color-primary); }

.post-card-excerpt {
  color: var(--color-text-sub);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== Tags ===== */
.tag {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  transition: background var(--transition);
}
.tag:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ===== Search Bar ===== */
.search-box {
  position: relative;
  margin-bottom: 24px;
}
.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition);
}
.search-box input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.search-box::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

/* ===== Post Article ===== */
.post-article {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 40px 48px;
  box-shadow: var(--shadow);
}

.post-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.post-header .category-label {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-primary);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.post-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--color-text);
  margin-bottom: 14px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--color-text-sub);
}

.post-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

/* ===== Post Content (Typography) ===== */
.post-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
}

.post-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 40px 0 16px;
  color: var(--color-text);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.post-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--color-text);
}

.post-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 10px;
  color: var(--color-text);
}

.post-content p { margin-bottom: 20px; }

.post-content ul,
.post-content ol {
  margin: 0 0 20px 24px;
}
.post-content li { margin-bottom: 6px; }

.post-content blockquote {
  border-left: 4px solid var(--color-primary);
  background: var(--color-tag-bg);
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--color-text-sub);
  font-style: italic;
}

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

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}
.post-content th,
.post-content td {
  border: 1px solid var(--color-border);
  padding: 10px 14px;
  text-align: left;
}
.post-content th {
  background: var(--color-bg);
  font-weight: 600;
}
.post-content tr:hover td {
  background: #f8fafc;
}

/* ===== Inline Code ===== */
.post-content code {
  font-family: var(--font-code);
  font-size: 13px;
  background: #f1f5f9;
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

/* ===== Code Blocks (Rouge) ===== */
.post-content div.highlight,
.post-content figure.highlight {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #1e293b;
}

.post-content pre.highlight,
.post-content .highlight pre {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  font-family: var(--font-code);
  font-size: 13.5px;
  line-height: 1.65;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 0;
}

/* Rouge 라인 넘버 */
.post-content .highlight .lineno {
  color: #475569;
  user-select: none;
  padding-right: 16px;
  border-right: 1px solid #1e3a5f;
  margin-right: 16px;
}

/* Rouge 색상 테마 (Dracula-inspired) */
.highlight .k,  .highlight .kd, .highlight .kn,
.highlight .kp, .highlight .kr, .highlight .kt { color: #ff79c6; }  /* keyword */
.highlight .s,  .highlight .s1, .highlight .s2,
.highlight .sb, .highlight .sc, .highlight .sd,
.highlight .se, .highlight .sh, .highlight .si,
.highlight .sx, .highlight .sr, .highlight .ss { color: #f1fa8c; }  /* string */
.highlight .c,  .highlight .c1, .highlight .cm,
.highlight .cs, .highlight .cp              { color: #6272a4; font-style: italic; } /* comment */
.highlight .nf, .highlight .fm              { color: #50fa7b; }  /* function */
.highlight .nb, .highlight .bp             { color: #8be9fd; }  /* built-in */
.highlight .mi, .highlight .mf, .highlight .mh,
.highlight .mo, .highlight .il             { color: #bd93f9; }  /* number */
.highlight .o,  .highlight .ow             { color: #ff79c6; }  /* operator */
.highlight .na                             { color: #50fa7b; }  /* attr */
.highlight .nc, .highlight .nn             { color: #8be9fd; }  /* class */
.highlight .kc                             { color: #bd93f9; }  /* true/false/null */
.highlight .p                              { color: var(--color-code-text); } /* punctuation */
.highlight .nv, .highlight .vi, .highlight .vc { color: #f8f8f2; }  /* variable */
.highlight .err { background: #ff5555; color: #fff; }

/* ===== Post Nav (prev/next) ===== */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 36px;
}

.post-nav-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.post-nav-item:hover { box-shadow: var(--shadow-hover); }
.post-nav-item.prev { text-align: left; }
.post-nav-item.next { text-align: right; }

.post-nav-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.post-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
}
.post-nav-item:hover .post-nav-title { color: var(--color-primary); }

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

.sidebar-widget {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.sidebar-widget h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-text-sub);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

/* Author card */
.author-card {
  text-align: center;
}
.author-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.author-bio {
  font-size: 13px;
  color: var(--color-text-sub);
  margin-bottom: 12px;
}
.author-links {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.author-links a {
  font-size: 12px;
  font-weight: 600;
  background: var(--color-tag-bg);
  color: var(--color-primary);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #bfdbfe;
}
.author-links a:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Category list */
.category-list {
  list-style: none;
}
.category-list li {
  margin-bottom: 8px;
}
.category-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text);
  font-size: 14px;
  padding: 4px 0;
  transition: color var(--transition);
}
.category-list a:hover { color: var(--color-primary); }
.category-list .count {
  background: var(--color-bg);
  color: var(--color-text-sub);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--color-border);
}

/* Recent posts */
.recent-posts {
  list-style: none;
}
.recent-posts li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.recent-posts li:last-child { border-bottom: none; }
.recent-posts a {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.4;
  display: block;
  margin-bottom: 2px;
}
.recent-posts a:hover { color: var(--color-primary); }
.recent-posts .date {
  font-size: 11px;
  color: var(--color-text-sub);
}

/* Tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 28px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-sub);
  margin-top: auto;
}
.site-footer a {
  color: var(--color-text-sub);
  font-weight: 500;
}
.site-footer a:hover { color: var(--color-primary); }
.site-footer .footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ===== Page: Categories / Tags ===== */
.page-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}
.page-header p {
  color: var(--color-text-sub);
  font-size: 14px;
  margin-top: 4px;
}

.category-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.category-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}
.category-section h2 a { color: var(--color-text); }
.category-section h2 a:hover { color: var(--color-primary); }

.category-post-list {
  list-style: none;
}
.category-post-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.category-post-list li:last-child { border-bottom: none; }
.category-post-list .post-date {
  font-size: 12px;
  color: var(--color-text-sub);
  flex-shrink: 0;
  margin-left: 12px;
}

/* ===== About Page ===== */
.about-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 40px 48px;
  box-shadow: var(--shadow);
}
.about-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}
.about-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 12px;
  color: var(--color-text);
}
.about-content p { margin-bottom: 16px; color: var(--color-text-sub); }
.about-content ul {
  margin: 0 0 16px 20px;
  color: var(--color-text-sub);
}
.about-content li { margin-bottom: 6px; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .layout {
    flex-direction: column;
    margin: 24px auto;
  }

  .sidebar {
    width: 100%;
    position: static;
  }

  .post-article {
    padding: 24px 20px;
  }

  .post-title { font-size: 22px; }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .about-content {
    padding: 24px 20px;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 20px;
    gap: 4px;
    box-shadow: var(--shadow);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 10px 12px; }

  .nav-toggle { display: block; }

  .header-inner { position: relative; }
}

@media (max-width: 480px) {
  .post-card { padding: 20px; }
  .post-card-title { font-size: 17px; }
  .page-header { padding: 20px; }
}
