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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background-color: #0d1117;
  color: #c9d1d9;
  line-height: 1.6;
}

a { color: #58a6ff; text-decoration: none; }

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #21262d;
  z-index: 100;
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8b949e;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-btn:hover {
  color: #e6edf3;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #58a6ff, #bc8cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== 본문 ===== */
.detail-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 100px 24px 80px;
}

/* ===== 상단 헤더 ===== */
.detail-header {
  margin-bottom: 48px;
}

.detail-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-block;
  margin-bottom: 16px;
}

.detail-title {
  font-size: 2.8rem;
  font-weight: 800;
  color: #e6edf3;
  letter-spacing: -1px;
  margin-bottom: 12px;
}

.detail-summary {
  font-size: 1.1rem;
  color: #8b949e;
  margin-bottom: 24px;
}

.detail-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.link-btn.primary {
  background: linear-gradient(135deg, #1f6feb, #388bfd);
  color: #fff;
  border: 1px solid #388bfd;
}

.link-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(31, 111, 235, 0.3);
}

.link-btn.outline {
  border: 1px solid #30363d;
  color: #c9d1d9;
}

.link-btn.outline:hover {
  border-color: #58a6ff;
  color: #58a6ff;
  transform: translateY(-2px);
}

/* ===== SonarCloud 이슈 테이블 ===== */
.sonar-issue-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 0.88rem;
}

.sonar-issue-table thead tr {
  background: #21262d;
}

.sonar-issue-table th {
  padding: 10px 14px;
  text-align: left;
  color: #8b949e;
  font-weight: 600;
  border-bottom: 1px solid #30363d;
}

.sonar-issue-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #21262d;
  color: #c9d1d9;
  vertical-align: top;
  line-height: 1.6;
}

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

.sonar-issue-table tr:hover td {
  background: #161b22;
}

.issue-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.issue-type-badge.accessibility {
  background: rgba(255,166,0,0.15);
  color: #ffa600;
}

.issue-type-badge.security {
  background: rgba(248,81,73,0.15);
  color: #f85149;
}

.issue-type-badge.codesmell {
  background: rgba(88,166,255,0.15);
  color: #58a6ff;
}

.issue-type-badge.duplication {
  background: rgba(188,140,255,0.15);
  color: #bc8cff;
}

/* ===== 리팩토링 섹션 ===== */
.refactor-intro {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(31,111,235,0.08), rgba(188,140,255,0.08));
  border: 1px solid #21262d;
  border-radius: 10px;
  font-size: 0.95rem;
  color: #8b949e;
}

.refactor-v-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.refactor-v-badge.v1 {
  background: rgba(248,81,73,0.15);
  color: #f85149;
  border: 1px solid rgba(248,81,73,0.3);
}

.refactor-v-badge.v2 {
  background: rgba(63,185,80,0.15);
  color: #3fb950;
  border: 1px solid rgba(63,185,80,0.3);
}

.refactor-arrow {
  color: #58a6ff;
  font-size: 1.1rem;
}

.refactor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.refactor-card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.2s;
}

.refactor-card:hover {
  border-color: #388bfd;
}

.refactor-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e6edf3;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.refactor-compare {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.refactor-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.refactor-label {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  margin-top: 2px;
}

.refactor-label.before {
  background: rgba(248,81,73,0.15);
  color: #f85149;
}

.refactor-label.after {
  background: rgba(63,185,80,0.15);
  color: #3fb950;
}

.refactor-row p {
  font-size: 0.88rem;
  color: #8b949e;
  line-height: 1.6;
  margin: 0;
}

.refactor-row p strong {
  color: #c9d1d9;
}

.refactor-pkg-wrap {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.refactor-pkg {
  flex: 1;
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.8rem;
  line-height: 1.8;
  color: #8b949e;
}

.refactor-pkg .pkg-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.refactor-pkg .pkg-title.before { color: #f85149; }
.refactor-pkg .pkg-title.after  { color: #3fb950; }

.refactor-pkg .pkg-removed { color: #f85149; }
.refactor-pkg .pkg-added   { color: #3fb950; }
.refactor-pkg .pkg-same    { color: #8b949e; }

/* ===== 문서 드롭다운 ===== */
.doc-dropdown {
  position: relative;
}

.doc-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #30363d;
  color: #c9d1d9;
  background: transparent;
  font-family: inherit;
  transition: all 0.2s;
  user-select: none;
}

.doc-dropdown-btn:hover {
  border-color: #58a6ff;
  color: #58a6ff;
}

.doc-dropdown-btn .chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.doc-dropdown.open .chevron {
  transform: rotate(180deg);
}

.doc-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  min-width: 180px;
  overflow: hidden;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.doc-dropdown.open .doc-dropdown-menu {
  display: block;
}

.doc-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
  color: #c9d1d9;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.doc-dropdown-menu a:hover {
  background: #21262d;
  color: #58a6ff;
}

/* ===== 썸네일 ===== */
.detail-thumbnail {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 48px;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
}

.thumbnail-placeholder {
  color: #30363d;
  font-size: 1rem;
  text-align: center;
  padding: 40px;
}

/* ===== 개요 카드 ===== */
.detail-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.overview-item {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 20px;
}

.overview-label {
  font-size: 0.72rem;
  color: #484f58;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}

.overview-value {
  font-size: 0.95rem;
  color: #e6edf3;
  font-weight: 500;
}

/* ===== 섹션 공통 ===== */
.detail-section {
  margin-bottom: 48px;
}

.detail-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e6edf3;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #21262d;
}

/* ===== 설명 ===== */
.detail-desc {
  color: #8b949e;
  font-size: 0.95rem;
  line-height: 1.9;
}

/* ===== 담당 기능 카테고리 ===== */
.feature-category {
  margin-bottom: 24px;
}

.feature-category-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #58a6ff;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #21262d;
}

/* ===== 주요 기능 ===== */
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: #8b949e;
  line-height: 1.7;
}

.feature-list li::before {
  content: '▸';
  color: #58a6ff;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ===== 기술적 도전 ===== */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.challenge-item {
  background: rgba(255, 166, 0, 0.04);
  border: 1px solid rgba(255, 166, 0, 0.15);
  border-left: 3px solid rgba(255, 166, 0, 0.5);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
}

.challenge-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d29922;
  margin-bottom: 6px;
}

.challenge-item p {
  font-size: 0.875rem;
  color: #8b949e;
  line-height: 1.8;
}

/* ===== 트러블슈팅 ===== */
.trouble-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.trouble-item {
  border: 1px solid #21262d;
  border-radius: 12px;
  overflow: hidden;
}

.trouble-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
}

.trouble-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e6edf3;
}

.trouble-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trouble-badge.problem {
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.trouble-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trouble-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.trouble-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #58a6ff;
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  padding: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
  margin-top: 2px;
}

.trouble-row p {
  font-size: 0.875rem;
  color: #8b949e;
  line-height: 1.7;
}

/* ===== 한계 / 개선점 ===== */
.improve-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.improve-item {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 18px 20px;
}

.improve-current,
.improve-next {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.improve-current p,
.improve-next p {
  font-size: 0.875rem;
  color: #8b949e;
  line-height: 1.7;
}

.improve-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  width: fit-content;
}

.improve-badge.current {
  background: rgba(210, 153, 34, 0.1);
  color: #d29922;
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.improve-badge.next {
  background: rgba(63, 185, 80, 0.1);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.improve-arrow {
  color: #30363d;
  font-size: 1.2rem;
  font-weight: 300;
}

@media (max-width: 768px) {
  .improve-item {
    grid-template-columns: 1fr;
  }
  .improve-arrow {
    transform: rotate(90deg);
    text-align: center;
  }
}

/* ===== 다이어그램 ===== */
.diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.diagram-item {
  border: 1px solid #21262d;
  border-radius: 10px;
  overflow: hidden;
}

.diagram-label {
  font-size: 0.8rem;
  color: #8b949e;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  font-weight: 500;
}

.diagram-item img {
  width: 100%;
  height: 260px;
  display: block;
  object-fit: contain;
  background: #0d1117;
  padding: 12px;
}

.diagram-placeholder {
  background: #0d1117;
  color: #30363d;
  font-size: 0.82rem;
  text-align: center;
  padding: 40px 20px;
  line-height: 1.8;
}

.diagram-placeholder span {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #484f58;
  margin-top: 6px;
}

.diagram-pdf-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #6e7681;
  padding: 12px 16px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
}

.diagram-pdf-link a {
  color: #58a6ff;
  font-weight: 500;
}

/* ===== 기술 스택 ===== */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tech-badge {
  background: rgba(88, 166, 255, 0.08);
  color: #7cb9ff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid rgba(88, 166, 255, 0.2);
  font-family: 'Courier New', monospace;
}

/* ===== 시연 영상 ===== */
.demo-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  margin-bottom: 24px;
}
.demo-video {
  width: 100%;
  height: 100%;
  border: none;
}

/* ===== 스크린샷 슬라이더 ===== */
.screenshot-slider {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid #30363d;
  background: #0d1117;
  margin-bottom: 40px;
}
.slider-track {
  display: flex;
  transition: transform 0.35s ease;
}
.slide {
  min-width: 100%;
}
.slide img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}
.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}
.slider-btn:hover { background: rgba(0,0,0,0.8); }
.slider-btn.prev { left: 12px; }
.slider-btn.next { right: 12px; }
.slider-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 0;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #30363d;
  cursor: pointer;
  transition: background 0.2s;
}
.dot.active { background: #58a6ff; }

/* ===== DevOps / 인프라 ===== */
.devops-block {
  margin-bottom: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid #21262d;
}
.devops-block:last-child { border-bottom: none; margin-bottom: 0; }

.devops-block-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e6edf3;
  margin-bottom: 10px;
}

.devops-block-desc {
  color: #8b949e;
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.7;
}

.devops-img-full {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid #30363d;
  display: block;
}

/* SonarCloud before/after */
.sonar-compare {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.sonar-side {
  flex: 1;
  text-align: center;
}

.sonar-label {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.sonar-label.before { color: #f85149; }
.sonar-label.after  { color: #3fb950; }

.devops-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid #30363d;
}

.sonar-stat {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #8b949e;
}
.sonar-stat strong { color: #e6edf3; }

.sonar-arrow {
  font-size: 2rem;
  color: #58a6ff;
  align-self: center;
  flex-shrink: 0;
}

/* ===== Lightbox ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.active {
  display: flex;
}
.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  .detail-title { font-size: 2rem; }
  .detail-thumbnail { min-height: 220px; }
  .detail-overview { grid-template-columns: 1fr 1fr; }
  .sonar-compare { flex-direction: column; }
  .sonar-arrow { transform: rotate(90deg); align-self: center; }
}
