/* ==========================================================================
   GHOSTWORLD.click — Global 3D Paranormal & Dark Heritage Research Platform
   Comprehensive Design System + Editorial Encyclopedia + 3D Simulator Styles
   ========================================================================== */

:root {
  --bg-main: #020617;
  --bg-card: #0f172a;
  --bg-elevated: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.88);
  --border-subtle: #1e293b;
  --border-accent: rgba(239, 68, 68, 0.45);
  --text-main: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --primary: #ef4444;
  --primary-hover: #dc2626;
  --primary-soft: rgba(239, 68, 68, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --cyan: #06b6d4;
  --purple: #a855f7;
  --shadow-lg: 0 20px 45px -15px rgba(0, 0, 0, 0.75);
  --radius-lg: 16px;
  --radius-md: 12px;
}

html[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.92);
  --border-subtle: #e2e8f0;
  --border-accent: rgba(220, 38, 38, 0.35);
  --text-main: #0f172a;
  --text-secondary: #1e293b;
  --text-muted: #475569;
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --primary-soft: rgba(220, 38, 38, 0.08);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --shadow-lg: 0 12px 32px -10px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

/* Global Top Navigation */
.top-global-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-accent);
}

.top-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  color: var(--primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.brand-subtitle {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.global-nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.global-nav-link {
  padding: 0.42rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

.global-nav-link:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.global-nav-link.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.nav-btn-depot {
  background: rgba(127, 29, 29, 0.55);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fca5a5;
}

html[data-theme="light"] .nav-btn-depot {
  background: #fef2f2;
  color: #b91c1c;
}

.badge-free {
  background: #10b981;
  color: #022c22;
  font-size: 0.65rem;
  font-weight: 900;
  padding: 0.1rem 0.38rem;
  border-radius: 999px;
}

.lang-select {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.38rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* Tool Suite Bar */
.tool-suite-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.6rem 1.25rem;
}

.tool-suite-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tool-suite-pill {
  white-space: nowrap;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.tool-suite-pill:hover,
.tool-suite-pill.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

/* Main Page Container */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.article-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Breadcrumbs */
.breadcrumb-nav {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

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

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  margin-bottom: 2rem;
  background: radial-gradient(circle at top, rgba(239, 68, 68, 0.14), transparent 70%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid var(--border-accent);
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
}

.hero-title {
  font-size: clamp(1.85rem, 4vw, 2.85rem);
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 0.9rem;
  letter-spacing: -0.02em;
}

.hero-title .accent {
  color: var(--primary);
}

.hero-desc {
  max-width: 820px;
  margin: 0 auto 1.25rem;
  color: var(--text-secondary);
  font-size: 1.02rem;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
}

.hero-pill {
  padding: 0.35rem 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* 3D Simulator Viewport & HUD */
.sim-wrapper {
  margin-bottom: 2.5rem;
}

.sim-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.sim-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 460px;
  background: #020617;
  border: 2px solid rgba(239, 68, 68, 0.55);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.sim-canvas-mount {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.sim-canvas-mount:active {
  cursor: grabbing;
}

.sim-quick-bar {
  margin-top: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.sim-select {
  flex: 1;
  min-width: 260px;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.68rem 1.25rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.68rem 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

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

/* Cards & Grids */
.section-block {
  margin-bottom: 3.25rem;
}

.section-eyebrow {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.section-title {
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 900;
  margin: 0 0 0.6rem;
  line-height: 1.3;
}

.section-desc {
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  max-width: 860px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.25rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-box:hover {
  border-color: var(--border-accent);
}

.card-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.8rem;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.level-5 { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.5); }
.level-4 { background: rgba(249, 115, 22, 0.18); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.5); }
.level-3 { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.5); }
.level-2 { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.5); }
.level-1 { background: rgba(6, 182, 212, 0.18); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.5); }

html[data-theme="light"] .level-5 { color: #b91c1c; }
html[data-theme="light"] .level-4 { color: #c2410c; }
html[data-theme="light"] .level-3 { color: #b45309; }
html[data-theme="light"] .level-2 { color: #047857; }
html[data-theme="light"] .level-1 { color: #0e7490; }

/* Editorial & Academic Article Components */
.editorial-article {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 3.5vw, 2.75rem);
  margin-bottom: 2rem;
}

.editorial-article h2 {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 2.25rem 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-accent);
  color: var(--text-main);
}

.editorial-article h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 1.6rem 0 0.6rem;
  color: var(--primary);
}

.editorial-article p {
  margin: 0 0 1.15rem;
  color: var(--text-secondary);
  font-size: 1.01rem;
  line-height: 1.82;
}

.editorial-article ul, .editorial-article ol {
  margin: 0 0 1.25rem;
  padding-left: 1.35rem;
  color: var(--text-secondary);
}

.editorial-article li {
  margin-bottom: 0.55rem;
  line-height: 1.75;
}

.toc-box {
  background: var(--bg-elevated);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0 2rem;
}

.toc-box h3 {
  margin: 0 0 0.65rem !important;
  font-size: 1rem !important;
  color: var(--text-main) !important;
}

.toc-list {
  margin: 0 !important;
  padding-left: 1.2rem !important;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.35rem 1.5rem;
}

.toc-list a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
}

.toc-list a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.mechanism-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  margin: 1.5rem 0;
}

.mechanism-box h4 {
  margin: 0 0 0.5rem;
  color: var(--cyan);
  font-size: 1.02rem;
  font-weight: 800;
}

.formula-highlight {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin: 0.65rem 0;
  font-size: 0.92rem;
  color: var(--amber);
  overflow-x: auto;
}

/* Clinical / Scientific Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.clinical-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--bg-card);
}

.clinical-table th {
  background: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 800;
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid var(--border-subtle);
}

.clinical-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top;
}

.clinical-table tr:last-child td {
  border-bottom: none;
}

/* Safety & Legal Box */
.safety-legal-box {
  background: rgba(245, 158, 11, 0.09);
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.safety-legal-box strong {
  color: var(--amber);
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.96rem;
}

/* Author & E-E-A-T Card */
.author-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  margin: 2rem 0;
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
}

.author-avatar {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.author-info h4 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.author-info p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* AdSense Slot Container (Clean, Non-Deceptive) */
.ad-slot-wrap {
  margin: 2rem auto;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}

.ad-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

/* Filter Pills & Search */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.filter-pill {
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
}

.filter-pill.active,
.filter-pill:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.search-input {
  flex: 1;
  min-width: 220px;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.48rem 0.85rem;
  font-size: 0.88rem;
}

/* Interactive Analyzer Sliders & Meters */
.lab-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.control-group {
  margin-bottom: 1.15rem;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.control-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Modals (Supply Depot, Tutorial, Journal) */
.gw-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gw-modal-backdrop.open {
  display: flex;
}

.gw-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

/* Global Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 1.25rem 2.5rem;
  margin-top: 4rem;
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 0.85rem;
}

.footer-col p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.68;
  margin: 0 0 0.85rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.48rem;
}

.footer-links a {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

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

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sim-stage {
    min-height: 360px;
    aspect-ratio: 4 / 3;
  }
  .author-card {
    flex-direction: column;
  }
}
