/* =====================================================
   Tech Report - Article Page Styles
   Minimal text layout, shared design tokens with hub
   ===================================================== */

/* CSS Custom Properties */
:root {
  --color-primary: #2563eb;
  --color-primary-light: #3b82f6;
  --color-primary-dark: #1d4ed8;
  --color-surface: #f8fafc;
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --font-sans: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition-fast: 150ms ease;
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: #ffffff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* =====================================================
   HEADER (mirrors hub)
   ===================================================== */
.report-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
}

.report-header__inner {
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-header__brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.report-header__nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.report-header__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.report-header__link--cta {
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.375rem 0.875rem;
  border-radius: 0.375rem;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.report-header__link--cta:hover {
  background: var(--color-primary);
  color: #ffffff;
}

.report-header__link:hover {
  color: var(--color-text);
}

/* =====================================================
   MAIN
   ===================================================== */
.report-main {
  max-width: 850px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* =====================================================
   ARTICLE HEADER
   ===================================================== */
.report-article__back {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-top: 2rem;
  margin-bottom: 2rem;
  transition: color var(--transition-fast);
}

.report-article__back:hover {
  color: var(--color-primary);
}

.report-article__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.report-article__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

.report-article__meta-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.report-article__github {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: #24292e;
  color: #fff;
  border-radius: 50%;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.report-article__github:hover {
  background: #161b22;
}

.report-article__tags {
  display: flex;
  gap: 0.375rem;
}

.report-article__tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
}

/* =====================================================
   PROSE CONTENT
   ===================================================== */
.report-content {
  line-height: 1.8;
  color: var(--color-text);
}

/* --- Headings --- */
.report-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.report-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}

.report-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

/* --- Prose typography (Korean) --- */
.report-content {
  word-break: keep-all;      /* 한국어 단어 단위 줄바꿈 */
  overflow-wrap: break-word;  /* 긴 영단어/URL 줄바꿈 */
}

/* --- Paragraph --- */
.report-content p {
  margin-bottom: 1.25rem;
}

/* --- Links --- */
.report-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

.report-content a:hover {
  color: var(--color-primary-dark);
}

/* --- Lists --- */
.report-content ul,
.report-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.report-content li {
  margin-bottom: 0.375rem;
}

.report-content li > ul,
.report-content li > ol {
  margin-top: 0.375rem;
  margin-bottom: 0;
}

/* --- Blockquote --- */
.report-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  background: var(--color-surface);
  border-radius: 0 0.375rem 0.375rem 0;
  color: var(--color-text-secondary);
}

.report-content blockquote p:last-child {
  margin-bottom: 0;
}

/* --- Inline code --- */
.report-content code:not([class*="language-"]) {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-surface);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  border: 1px solid var(--color-border);
}

/* --- Code blocks (Prism override) --- */
.report-content pre[class*="language-"] {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.report-content pre[class*="language-"] code {
  font-size: inherit;
  background: none;
  padding: 0;
  border: none;
  border-radius: 0;
}

/* --- Horizontal rule --- */
.report-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

/* --- Images & Figures --- */
.report-content img {
  border-radius: 0.5rem;
  margin: 1.5rem 0;
}

.report-content figure {
  margin: 2rem 0;
}

.report-content figure img {
  margin: 0;
}

.report-content figcaption {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* --- Tables --- */
.report-content .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

.report-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.report-content .table-wrap table {
  margin: 0; /* 래퍼가 마진 담당 */
}

.report-content thead th {
  text-align: left;
  font-weight: 600;
  padding: 0.625rem 0.75rem;
  border-bottom: 2px solid var(--color-border);
}

.report-content tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.report-content tbody tr:last-child td {
  border-bottom: none;
}

/* --- KaTeX overrides --- */
.report-content .katex-display {
  margin: 1.5rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5rem 0;
}

.report-content .katex {
  font-size: 1.05em;
}

/* --- Strong / Emphasis --- */
.report-content strong {
  font-weight: 600;
}

.report-content em {
  font-style: italic;
}

/* --- Semantic Value Colors (table cells) --- */
.value-positive {
  color: #16a34a;
}

.value-negative {
  color: #dc2626;
}

.value-warning {
  color: #d97706;
}

.value-neutral {
  color: #6b7280;
}

.value-negative--note {
  color: #dc2626;
  font-size: 0.875rem;
}

.value-positive--note {
  color: #16a34a;
  font-size: 0.875rem;
}

.report-content__caption {
  text-align: center;
  font-style: italic;
}

.report-content__callout {
  margin-top: 2rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* =====================================================
   LISTING PAGE (reports/index.html)
   ===================================================== */
.report-listing__title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  padding-top: 3rem;
  margin-bottom: 0.5rem;
}

.report-listing__desc {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
}

.report-listing__posts {
  display: flex;
  flex-direction: column;
}

.report-listing__post {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
  transition: color var(--transition-fast);
}

.report-listing__post:first-child {
  border-top: 1px solid var(--color-border);
}

.report-listing__post:hover {
  color: var(--color-primary);
}

.report-listing__post-title {
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.5;
}

.report-listing__post-date {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.report-listing__post:hover .report-listing__post-date {
  color: var(--color-primary-light);
}

.report-listing__post-tags {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

.report-listing__post-tag {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
}

.report-listing__post-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.report-listing__empty {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* =====================================================
   FOOTER
   ===================================================== */
.report-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 1.5rem;
  text-align: center;
}

.report-footer__copy {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* =====================================================
   TABLE OF CONTENTS (TOC) MINIMAP
   ===================================================== */
.report-toc {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  left: calc(50% + 425px + 24px); /* 콘텐츠(850px/2) + 간격 */
  width: 180px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 1rem 0;
  font-size: 0.75rem;
  z-index: 50;
}

.report-toc::-webkit-scrollbar {
  width: 2px;
}

.report-toc::-webkit-scrollbar-track {
  background: transparent;
}

.report-toc::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 1px;
}

.report-toc__title {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
}

.report-toc__list {
  list-style: none;
  border-left: 1px solid var(--color-border);
}

.report-toc__item {
  position: relative;
}

.report-toc__link {
  display: block;
  padding: 0.375rem 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  transition: color var(--transition-fast), background var(--transition-fast);
  border-left: 2px solid transparent;
  margin-left: -1px;
}

.report-toc__link:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.report-toc__link--active {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 500;
}

.report-toc__link--h3 {
  padding-left: 1.25rem;
  font-size: 0.7rem;
}

/* Hide TOC on smaller screens */
@media (max-width: 1200px) {
  .report-toc {
    display: none;
  }
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 480px) {
  .report-header__inner {
    padding: 0 1rem;
  }

  .report-header__nav {
    gap: 1rem;
  }

  .report-main {
    padding: 0 1rem 3rem;
  }

  .report-article__title {
    font-size: 1.5rem;
  }

  .report-article__meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .report-content pre[class*="language-"] {
    padding: 1rem;
    font-size: 0.8rem;
    border-radius: 0.375rem;
  }

  .report-content table {
    font-size: 0.825rem;
  }

  .report-content thead th,
  .report-content tbody td {
    padding: 0.375rem 0.5rem;
  }

  .report-listing__title {
    padding-top: 2rem;
    font-size: 1.5rem;
  }

  .report-listing__post {
    flex-direction: column;
    gap: 0.25rem;
  }

  .report-listing__post-title {
    font-size: 0.9rem;
  }

  .report-listing__post-date {
    font-size: 0.75rem;
  }
}
