:root {
  --guide-primary: #005da8;
  --guide-info: #3b82f6;
  --guide-warning: #f59e0b;
  --guide-tip: #10b981;
  --guide-bg-info: #eff6ff;
  --guide-bg-warning: #fffbeb;
  --guide-bg-tip: #ecfdf5;
  --guide-border: #e5e7eb;
  --guide-text: #1f2937;
  --guide-muted: #6b7280;
  --guide-radius: 12px;
  --guide-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --sidebar-active-bg: #e0f2fe;
  --sidebar-active-text: #0369a1;
  --highlight-bg: #fde68a;
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: transparent;
  --hero-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Representative Hero Image */
.hero-image-container {
  margin: 1.5rem 0 3rem;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--hero-shadow);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  position: relative;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
  line-height: 0;
}

body[data-theme='dark'] .hero-image-container {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.hero-image-container:hover {
  transform: translateY(-8px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

.hero-image-container img,
.hero-image-auto {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.hero-image-container:hover img,
.hero-image-container:hover .hero-image-auto {
  transform: scale(1.03);
}

.hero-image-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
  border: 3px solid #fff;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Base Styles */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  /* Root scroll prevent */
}

/* Typography & Layout */
.guide-article {
  font-family: 'Pretendard', sans-serif;
  color: var(--guide-text);
  line-height: 1.8;
  font-size: 18px;
  max-width: 840px;
  margin: 0 auto;
}

.guide-article h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 2rem;
  letter-spacing: -0.03em;
  color: #1a1f27;
}

.guide-article h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 4rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--guide-border);
  padding-bottom: 0.75rem;
}

.guide-article h3 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 60px;
  margin-bottom: 1rem;
  color: #333d4b;
}

.guide-article p {
  color: #4e5968;
  margin-bottom: 1.5rem;
}

/* Quick Link Button */
.btn-direct {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--guide-primary);
  color: #ffffff !important;
  text-decoration: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  margin: 12px 0 32px; /* reduced from 20px 0 40px */
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-direct:hover {
  background-color: #004a87;
  transform: translateY(-2px);
}

.btn-direct::after {
  content: '↗';
  font-size: 18px;
}

/* Callout (강조 박스) */
.guide-callout {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--guide-radius);
  border-left: 4px solid;
  margin: 24px 0;
}

.guide-callout::before {
  font-size: 20px;
  flex-shrink: 0;
}

.guide-callout.info {
  background-color: var(--guide-bg-info);
  border-left-color: var(--guide-info);
  color: #1e40af;
}

.guide-callout.info::before {
  content: "ℹ️";
}

.guide-callout.warning {
  background-color: var(--guide-bg-warning);
  border-left-color: var(--guide-warning);
  color: #92400e;
}

.guide-callout.warning::before {
  content: "⚠️";
}

.guide-callout.tip {
  background-color: var(--guide-bg-tip);
  border-left-color: var(--guide-tip);
  color: #065f46;
}

.guide-callout.tip::before {
  content: "💡";
}

/* Step Card (절차 안내) */
.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.step-card {
  background: #fff;
  border: 1px solid var(--guide-border);
  border-radius: var(--guide-radius);
  padding: 20px;
  box-shadow: var(--guide-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: var(--guide-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  height: 32px;
  min-width: 32px;
  background-color: #e5e7eb;
  color: #4b5563;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.step-badge.primary {
  background-color: var(--guide-primary);
  color: #fff;
}

body[data-theme='dark'] .step-badge {
  background-color: #374151;
  color: #e5e7eb;
}

/* Utility Classes */
.w-full { width: 100%; }
.max-w-full { max-width: 100%; }
.h-auto { height: auto; }

/* Guide Table */
.guide-table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--guide-radius);
  border: 1px solid var(--guide-border);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.guide-table th {
  background-color: #f9fafb;
  padding: 12px 16px;
  font-weight: 700;
  border-bottom: 2px solid var(--guide-border);
  color: var(--guide-text);
}

.guide-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--guide-border);
}

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

/* Media Component */
.image-wrapper {
  margin: 32px 0 48px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  background: #f9fafb;
  text-align: center;
}

.image-wrapper img {
  max-width: 100%;
  display: block;
  cursor: zoom-in;
  margin: 0 auto;
}

.caption {
  padding: 10px 16px;
  background: #fff;
  border-top: 1px solid var(--guide-border);
  color: var(--guide-muted);
  font-size: 14px;
  font-style: italic;
}

/* Lightbox Styles */
#lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  backdrop-filter: blur(5px);
}

#lightbox.show {
  display: flex;
  animation: fadeIn 0.3s ease;
}

#lightbox img {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

#lightbox.show img {
  transform: scale(1);
}

#lightbox .close-btn {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Sidebar Active & Highlight */
.search-highlight {
  background-color: var(--highlight-bg);
  color: #1e2937;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 700;
}

.is-active {
  background-color: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  font-weight: 800 !important;
  border-left: 3px solid var(--sidebar-active-text);
}

.search-count {
  font-size: 12px;
  color: #fff;
  opacity: 0.8;
  margin-top: 8px;
  text-align: right;
}

/* Custom Scrollbar for Sidebar */
.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.nav::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

@media (max-width: 768px) {
  .step-grid {
    grid-template-columns: 1fr;
  }

  .guide-article {
    padding: 0 16px;
  }
}

/* Phase 3-6: iframe 임베드 최적화 전용 스타일 */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
}

.sidebar {
  height: 100%;
  display: flex !important;
  flex-direction: column;
  background-color: #fff;
  border-right: 1px solid var(--guide-border);
  overflow: hidden;
}

.content {
  height: 100%;
  display: flex !important;
  flex-direction: column;
  background-color: transparent;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--guide-border);
}

.page {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 부모 페이지와의 조화를 위해 iframe 내 배경을 투명하게 처리 가능 */
html,
body {
  background-color: transparent !important;
}

/* Phase 3-8: 시연용 홈 버튼 스타일 */
.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 5px;
  /* 클릭 영역 확보 */
  transition: opacity 0.2s;
}

.home-link:hover {
  opacity: 0.7;
  /* 호버 시 살짝 투명하게 피드백 */
}

.home-icon {
  width: 23px;
  height: 23px;
  display: block;
  object-fit: contain;
  /* 이미지 비율 유지 */
}