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

/* ==========================================================================
   Minimalist Black & White Theme with Persistent Theme Toggle
   ========================================================================== */

/* 1. Default Light Theme */
:root {
  --bg: #ffffff;
  --text-main: #111111;
  --text-sub: #555555;
  --text-muted: #888888;
  --link-color: #2563eb;
  --link-hover: #1d4ed8;
  --border: #e0e0e0;
  --border-hover: #111111;
  --max-width: 800px;
}

/* 2. System Dark Mode Default (OS 설정 자동 감지) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text-main: #f5f5f5;
    --text-sub: #aaaaaa;
    --text-muted: #666666;
    --link-color: #60a5fa;
    --link-hover: #93c5fd;
    --border: #2a2a2a;
    --border-hover: #ffffff;
  }
}

/* 3. Explicit Data Theme Overrides (localStorage 연동) */
[data-theme="dark"] {
  --bg: #121212 !important;
  --text-main: #f5f5f5 !important;
  --text-sub: #aaaaaa !important;
  --text-muted: #666666 !important;
  --link-color: #60a5fa !important;
  --link-hover: #93c5fd !important;
  --border: #2a2a2a !important;
  --border-hover: #ffffff !important;
}

[data-theme="light"] {
  --bg: #ffffff !important;
  --text-main: #111111 !important;
  --text-sub: #555555 !important;
  --text-muted: #888888 !important;
  --link-color: #2563eb !important;
  --link-hover: #1d4ed8 !important;
  --border: #e0e0e0 !important;
  --border-hover: #111111 !important;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Noto Sans KR', 'Noto Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.7;
  padding: 0 1.5rem;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Header & Nav */
.header {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Logo with Image */
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links {
  display: flex;
  gap: 1.2rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-sub);
  transition: color 0.2s ease;
}

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

/* Persistent Theme Toggle Button */
.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  background-color: var(--bg);
  color: var(--text-main);
  user-select: none;
  transition: border-color 0.2s ease;
}

.theme-btn:hover {
  border-color: var(--border-hover);
}

/* Hero */
.hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-sub);
  word-break: keep-all;
}

/* Section Common */
.section {
  padding: 3rem 0;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.3px;
}

/* Recent Pages Section */
.page-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.page-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.8rem 0;
  border-bottom: 1px dashed var(--border);
}

.page-item:last-child {
  border-bottom: none;
}

.page-link {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  transition: color 0.2s ease;
}

.page-link:hover {
  text-decoration: underline;
}

.page-desc {
  font-size: 0.9rem;
  color: var(--text-sub);
  margin-top: 0.2rem;
}

.page-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: monospace;
  white-space: nowrap;
}

/* Project List */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-item {
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.project-item:hover {
  border-color: var(--border-hover);
}

.project-item h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.project-item p {
  font-size: 0.95rem;
  color: var(--text-sub);
  margin-bottom: 0.8rem;
}

.project-link {
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-block;
  border-bottom: 1px solid var(--text-main);
  padding-bottom: 2px;
}

/* Contact */
.contact-info {
  color: var(--text-sub);
  font-size: 1rem;
}

.contact-info a {
  color: var(--text-main);
  font-weight: 600;
  border-bottom: 1px solid var(--text-main);
}

/* Post Detail Markdown Styles */
.post-container {
  padding: 3rem 0;
}

.post-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.post-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.post-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: monospace;
}

.post-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.5rem 0 0.8rem;
}

.post-content p {
  margin-bottom: 1.2rem;
  color: var(--text-main);
}

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

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

.post-content ul, .post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: var(--text-sub);
}

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

.post-content pre {
  background-color: var(--border);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.post-content code {
  font-family: monospace;
  background-color: var(--border);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Post Content Image Styling */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 1.5rem 0;
  display: block;
}

/* Side-by-Side Image Grid Support for Markdown */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.img-grid img {
  width: 100%;
  margin: 0;
}

/* Footer */
.footer {
  padding: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}
