/* ============================================
   RAGNAGATE.CO.KR — Design System
   ============================================ */

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

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

html,
body {
  touch-action: manipulation;
  max-width: 100%;
  /* overflow-x: hidden; position: sticky 오작동 원인으로 제거 */
  position: relative;
  /* 내부 요소들의 기준점 설정 */
}

:root {
  /* Color Palette */
  --primary: #4a90d9;
  --primary-dark: #3a7bc8;
  --primary-light: #6aa8e8;
  --accent: #e8a838;
  --accent-dark: #d4952e;
  --accent-light: #f0c060;
  --danger: #e04848;

  /* Dark Theme */
  --bg-body: #0f1117;
  --bg-surface: #181b24;
  --bg-surface-2: #1e222d;
  --bg-surface-3: #252a37;
  --bg-card: #1c2030;
  --bg-card-hover: #222740;
  --bg-utility: #0a0c12;

  /* Text */
  --text-primary: #e8eaf0;
  --text-secondary: #9ca3b8;
  --text-muted: #636b82;
  --text-accent: #e8a838;

  /* Borders */
  --border-color: #2a2f3e;
  --border-color-light: #353b50;

  /* Misc */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1140px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans KR', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

ul,
ol {
  list-style: none;
}

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

/* === Utility Bar === */
.utility-bar {
  background: var(--bg-utility);
  border-bottom: 1px solid var(--border-color);
  padding: 0 20px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.utility-bar a {
  color: var(--text-muted);
  margin-left: 16px;
  transition: color var(--transition);
}

.utility-bar a:hover {
  color: var(--accent);
}

.utility-bar .site-network {
  display: flex;
  align-items: center;
  gap: 6px;
}

.utility-bar .site-network .network-label {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 10px;
}

.utility-bar .user-actions {
  display: flex;
  align-items: center;
}

/* === Header === */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.site-logo .logo-main {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1;
}

.site-logo .logo-main span {
  color: var(--accent);
}

.site-logo .logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 500;
}

.header-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg-surface-2);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.header-clock svg {
  width: 16px;
  height: 16px;
  fill: var(--accent);
}

.header-clock .clock-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

/* === Navigation === */
.main-nav {
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(30, 34, 45, 0.92);
}

.main-nav .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.main-nav .nav-list {
  display: flex;
  align-items: center;
}

.main-nav .nav-list li {
  position: relative;
}

.main-nav .nav-list li::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: var(--border-color);
}

.main-nav .nav-list li:last-child::after {
  display: none;
}

.main-nav .nav-list a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
}

.main-nav .nav-list a::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
  border-radius: 1px;
}

.main-nav .nav-list a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.main-nav .nav-list a:hover::before {
  width: 60%;
}

.main-nav .nav-list a.active {
  color: var(--accent);
}

.main-nav .nav-list a.active::before {
  width: 60%;
}

.main-nav .nav-list a svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 10px;
  font-size: 24px;
}

/* === Hero Banner === */
.hero-banner {
  max-width: var(--max-width);
  margin: 30px auto 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.hero-banner img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(10, 12, 18, 0.85) 0%, rgba(10, 12, 18, 0.4) 50%, transparent 100%);
  display: flex;
  align-items: center;
  padding: 0 40px;
}

.hero-text {
  max-width: 480px;
}

.hero-text h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-text p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* === Main Content === */
.main-content {
  max-width: var(--max-width);
  margin: 30px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

/* === Section Card === */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.section-card:hover {
  border-color: var(--border-color-light);
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
}

.section-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h3 .section-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
}

.section-header .more-link {
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: all var(--transition);
  font-weight: 500;
}

.section-header .more-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(232, 168, 56, 0.05);
}

/* === Post List === */
.post-list {
  padding: 0;
}

.post-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(42, 47, 62, 0.5);
  transition: all var(--transition);
  cursor: pointer;
  gap: 12px;
}

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

.post-item:hover {
  background: var(--bg-card-hover);
}

.post-item .post-title {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 400;
  flex: 1;
  line-height: 1.5;
  transition: color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.post-item .post-link {
  transition: color var(--transition);
}

.post-item:hover .post-title {
  color: var(--accent);
}

.post-item .post-category {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  margin-right: 8px;
  font-weight: 600;
  vertical-align: middle;
}

.post-item .post-category.cat-notice {
  background: rgba(232, 72, 72, 0.15);
  color: var(--danger);
}

.post-item .post-category.cat-update {
  background: rgba(74, 144, 217, 0.15);
  color: var(--primary);
}

.post-item .post-category.cat-event {
  background: rgba(232, 168, 56, 0.15);
  color: var(--accent);
}

.post-item .post-category.cat-guide {
  background: rgba(72, 200, 120, 0.15);
  color: #48c878;
}

.post-item .post-category.cat-free {
  background: rgba(160, 140, 200, 0.15);
  color: #a08cc8;
}

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

.post-item .post-date {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.post-item .post-views {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* === Tags === */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  background: rgba(74, 144, 217, 0.12);
  color: var(--primary-light);
  margin-top: 4px;
  margin-right: 4px;
}

/* === Section Footer === */
.section-footer {
  text-align: center;
  padding: 14px;
  border-top: 1px solid var(--border-color);
}

.section-footer a {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition);
}

.section-footer a:hover {
  color: var(--accent);
}

/* === Feature Card (Tool Preview) === */
.feature-card {
  padding: 22px;
}

.feature-info {
  margin-bottom: 16px;
}

.feature-info p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}

.feature-info .btn-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
}

.feature-info .btn-go:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.feature-preview {
  background: var(--bg-surface-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.feature-preview img {
  width: 100%;
  display: block;
  opacity: 0.85;
  transition: opacity var(--transition);
}

.feature-preview:hover img {
  opacity: 1;
}

/* === Ad Banner === */
.ad-banner {
  max-width: var(--max-width);
  margin: 20px auto;
  padding: 0 20px;
}

.ad-banner .ad-slot {
  background: var(--bg-surface-2);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
}

/* === Footer === */
.site-footer {
  background: var(--bg-utility);
  border-top: 1px solid var(--border-color);
  padding: 30px 20px;
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-links a.privacy {
  font-weight: 700;
  color: var(--text-primary);
}

.footer-copyright {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* === Floating Button === */
.floating-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232, 168, 56, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: all var(--transition);
  z-index: 1000;
}

.floating-btn:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 24px rgba(232, 168, 56, 0.5);
}

/* === Animation === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out forwards;
}

.section-card:nth-child(1) {
  animation-delay: 0.1s;
}

.section-card:nth-child(2) {
  animation-delay: 0.2s;
}

.section-card:nth-child(3) {
  animation-delay: 0.3s;
}

.section-card:nth-child(4) {
  animation-delay: 0.4s;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 900px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .hero-banner img {
    height: 180px;
  }

  .hero-text h2 {
    font-size: 18px;
  }

  .hero-text p {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .main-nav .nav-list {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 34, 45, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
  }

  .main-nav .nav-list.open {
    display: flex;
  }

  .main-nav .nav-list li::after {
    display: none;
  }

  .main-nav .nav-list a {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-menu-toggle {
    display: block;
  }

  .main-nav .nav-inner {
    justify-content: flex-end;
    padding: 0 12px;
  }

  .header-inner {
    padding: 0;
  }

  .site-logo .logo-main {
    font-size: 22px;
  }

  .hero-banner {
    margin: 16px 12px 0;
    border-radius: var(--radius-md);
  }

  .hero-banner img {
    height: 140px;
  }

  .hero-overlay {
    padding: 0 20px;
  }

  .hero-text h2 {
    font-size: 16px;
  }

  .hero-text p {
    font-size: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
  }

  .main-content {
    margin: 16px auto;
    padding: 0 12px;
    gap: 16px;
  }

  .post-item {
    padding: 12px 16px;
    flex-direction: column;
    gap: 6px;
  }

  .post-item .post-title {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .post-item .post-meta {
    align-self: flex-end;
  }

  .section-header {
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  .utility-bar {
    font-size: 10px;
    padding: 0 12px;
  }

  .site-header {
    padding: 12px;
  }

  .site-logo .logo-sub {
    display: none;
  }
}