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

/* --- DESIGN SYSTEM TOKENS --- */
:root {
  /* Fonts */
  --font-base: 'Noto Sans KR', sans-serif;
  --font-title: 'Outfit', 'Noto Sans KR', sans-serif;

  /* HSL Color System - Light Mode (Default) */
  --hue: 245;
  --primary-color: hsl(var(--hue), 85%, 58%);
  --primary-hover: hsl(var(--hue), 85%, 48%);
  --accent-color: hsl(38, 95%, 52%); /* Warm Amber */
  --accent-glow: hsla(38, 95%, 52%, 0.15);
  
  --bg-main: hsl(var(--hue), 25%, 98%);
  --bg-surface: hsl(var(--hue), 20%, 100%);
  --bg-navbar: hsla(var(--hue), 20%, 100%, 0.8);
  --bg-ad: hsl(var(--hue), 10%, 94%);
  
  --text-main: hsl(var(--hue), 35%, 15%);
  --text-muted: hsl(var(--hue), 15%, 45%);
  --text-inverse: hsl(var(--hue), 10%, 98%);
  
  --border-light: hsl(var(--hue), 15%, 90%);
  --border-focus: hsl(var(--hue), 85%, 58%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(99, 102, 241, 0.06);
  --shadow-lg: 0 20px 40px rgba(99, 102, 241, 0.12);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

[data-theme="dark"] {
  /* HSL Color System - Dark Mode */
  --bg-main: hsl(var(--hue), 22%, 8%);
  --bg-surface: hsl(var(--hue), 18%, 12%);
  --bg-navbar: hsla(var(--hue), 18%, 12%, 0.85);
  --bg-ad: hsl(var(--hue), 12%, 16%);
  
  --text-main: hsl(var(--hue), 20%, 92%);
  --text-muted: hsl(var(--hue), 10%, 65%);
  --text-inverse: hsl(var(--hue), 30%, 8%);
  
  --border-light: hsl(var(--hue), 12%, 20%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.45);
}

/* --- RESET & BASIC STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-base);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-smooth);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-sm);
  display: block;
}

ul {
  list-style: none;
}

/* --- CUSTOM SCROLLBAR --- */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-color), hsl(290, 80%, 60%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- LAYOUT STRUCTURE --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- NAVBAR --- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-navbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-color), hsl(290, 80%, 60%));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 4px 10px hsla(var(--hue), 85%, 58%, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-item {
  font-weight: 500;
  font-size: 15px;
  position: relative;
}

.nav-item:hover {
  color: var(--primary-color);
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition-smooth);
}

.nav-item:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-light);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: rotate(15deg);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
}

.sun-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: none;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

/* --- HERO SECTION --- */
.hero {
  padding: 80px 0 60px 0;
  text-align: center;
  background: radial-gradient(circle at top, hsla(var(--hue), 85%, 58%, 0.05), transparent 60%);
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px auto;
}

/* --- SEARCH SECTION --- */
.search-container {
  max-width: 550px;
  margin: 0 auto 48px auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 16px 24px;
  padding-right: 56px;
  border-radius: 50px;
  border: 1.5px solid var(--border-light);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 16px;
  outline: none;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 10px 30px hsla(var(--hue), 85%, 58%, 0.15);
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--primary-color);
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
}

.search-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-50%) scale(1.05);
}

/* --- MAIN SECTION LAYOUT --- */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 40px;
  margin-bottom: 80px;
}

/* --- BLOG GRID --- */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.post-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.post-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: hsla(var(--hue), 85%, 58%, 0.2);
}

.post-card-thumb {
  height: 200px;
  background-position: center;
  background-size: cover;
  background-color: var(--bg-ad);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.post-card:hover .post-card-thumb {
  transform: scale(1.03);
}

.post-tag {
  position: absolute;
  top: 16px;
  left: 16px;
  background-color: var(--primary-color);
  color: white;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.post-card-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

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

.post-card-title {
  font-size: 20px;
  margin-bottom: 12px;
  font-weight: 700;
}

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

.post-card-desc {
  color: var(--text-muted);
  font-size: 14.5px;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.post-card-footer {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-more-btn {
  font-weight: 600;
  font-size: 14px;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-more-btn:hover {
  color: var(--primary-hover);
  gap: 8px;
}

/* --- SIDEBAR --- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.sidebar-widget {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.widget-title {
  font-size: 18px;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 8px;
}

.widget-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.categories-list li {
  margin-bottom: 12px;
}

.categories-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14.5px;
  font-weight: 500;
}

.categories-list li a:hover {
  color: var(--primary-color);
  padding-left: 4px;
}

.category-count {
  font-size: 12px;
  background-color: var(--bg-ad);
  padding: 2px 8px;
  border-radius: 20px;
  color: var(--text-muted);
}

.recent-posts {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recent-post-item {
  display: flex;
  gap: 12px;
  align-items: center;
}

.recent-post-img {
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius-sm);
  background-color: var(--bg-ad);
  background-position: center;
  background-size: cover;
  flex-shrink: 0;
}

.recent-post-info h4 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recent-post-info span {
  font-size: 12px;
  color: var(--text-muted);
}

/* --- ADSENSE PLACEHOLDERS --- */
.ad-slot {
  background-color: var(--bg-ad);
  border: 1.5px dashed var(--border-light);
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  color: var(--text-muted);
}

.ad-slot::before {
  content: 'ADVERTISEMENT';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  opacity: 0.6;
}

.ad-slot-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-main);
  opacity: 0.8;
}

.ad-slot-desc {
  font-size: 11px;
  opacity: 0.7;
}

/* Ad Placement Types */
.ad-header {
  margin: 32px auto;
  max-width: 970px;
  min-height: 120px;
}

.ad-sidebar {
  min-height: 250px;
}

.ad-content {
  margin: 32px 0;
  min-height: 200px;
}

.ad-footer {
  margin: 48px auto 0 auto;
  max-width: 728px;
  min-height: 90px;
}

/* --- FOOTER --- */
.footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  padding: 60px 0 30px 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-info-logo {
  margin-bottom: 16px;
}

.footer-info p {
  color: var(--text-muted);
  font-size: 14.5px;
  max-width: 320px;
}

.footer-links h4 {
  font-size: 16px;
  margin-bottom: 20px;
}

.footer-links ul li {
  margin-bottom: 12px;
}

.footer-links ul li a {
  font-size: 14.5px;
  color: var(--text-muted);
}

.footer-links ul li a:hover {
  color: var(--primary-color);
}

.footer-bottom {
  border-top: 1px solid var(--border-light);
  padding-top: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* --- POST VIEW PAGES (EXTRA DETAIL STYLING) --- */
.post-header {
  padding: 60px 0 40px 0;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.post-header-tag {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}

.post-header-title {
  font-size: 40px;
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

.post-header-meta {
  color: var(--text-muted);
  font-size: 14.5px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.post-article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  margin-bottom: 80px;
}

.post-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.post-content p {
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 1.8;
}

.post-content h2 {
  font-size: 24px;
  margin: 40px 0 20px 0;
  border-left: 4px solid var(--primary-color);
  padding-left: 16px;
}

.post-content h3 {
  font-size: 19px;
  margin: 30px 0 16px 0;
}

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

.post-content li {
  margin-bottom: 8px;
  font-size: 16px;
}

.post-content blockquote {
  border-left: 4px solid var(--accent-color);
  background-color: var(--bg-main);
  padding: 20px;
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
  margin-bottom: 24px;
  font-style: italic;
}

.post-content code {
  font-family: monospace;
  background-color: var(--bg-main);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14.5px;
  color: var(--primary-color);
}

/* --- AD PAGES (COMPLIANCE / LEGAL) --- */
.compliance-layout {
  max-width: 800px;
  margin: 60px auto 80px auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-md);
  padding: 48px;
  box-shadow: var(--shadow-sm);
}

.compliance-layout h1 {
  font-size: 32px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 16px;
}

.compliance-layout h2 {
  font-size: 20px;
  margin: 32px 0 16px 0;
}

.compliance-layout p, .compliance-layout li {
  font-size: 15px;
  color: var(--text-main);
  opacity: 0.9;
  line-height: 1.8;
  margin-bottom: 16px;
}

.compliance-layout ul {
  padding-left: 24px;
  margin-bottom: 16px;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 992px) {
  .main-layout, .post-article-layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
  
  .sidebar-widget:nth-child(3) {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 36px;
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    grid-template-columns: 1fr;
  }
  
  .sidebar-widget:nth-child(3) {
    grid-column: span 1;
  }
  
  .nav-links {
    display: none; /* simple toggle hidden on mobile for purity */
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .post-header-title {
    font-size: 30px;
  }
  
  .post-content {
    padding: 24px;
  }
  
  .compliance-layout {
    padding: 24px;
  }
}