/**
 * ranking-post.css
 * 영화 순위 및 일일 박스오피스 분석 포스트 & 아카이브 달력 통합 스타일시트
 * - 단일 파일로 모든 포스트 및 대표 페이지의 디자인 중앙 관리
 * - 모바일 화면에서 달력 우측 잘림 및 레이아웃 깨짐 완전 방지 (반응형 최적화)
 */

:root {
  --bg: #0b0f19;
  --card-bg: #131b2e;
  --card-border: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --accent: #ec4899;
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #d97706;
  --up: #ef4444;
  --down: #3b82f6;
  --same: #64748b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

@media (max-width: 480px) {
  .container {
    padding: 14px 12px 40px;
  }
}

@media (max-width: 360px) {
  .container {
    padding: 12px 8px 30px;
  }
}

/* Header & Branding */
header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 20px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 24px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-img {
  height: 34px;
  width: auto;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(139, 92, 246, 0.14);
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(139, 92, 246, 0.3);
  transition: all 0.2s ease;
}

.home-badge:hover {
  background: rgba(139, 92, 246, 0.25);
  transform: translateY(-1px);
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumbs a:hover {
  color: var(--primary-light);
}

.breadcrumbs span.sep {
  color: #475569;
}

/* Main Title Section */
.hero-title-section {
  margin-bottom: 28px;
}

.date-pill {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-light);
  background: rgba(139, 92, 246, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

h1.main-title {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.35;
  color: #ffffff;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

@media (min-width: 640px) {
  h1.main-title {
    font-size: 2.1rem;
  }
}

.meta-subtitle {
  font-size: 0.94rem;
  color: var(--text-muted);
}

/* Key Summary Box */
.summary-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(19, 27, 46, 0.95));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 32px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.summary-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.summary-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.summary-text {
  font-size: 0.98rem;
  line-height: 1.7;
  color: #e2e8f0;
  word-break: keep-all;
}

/* Section Heading */
.section-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
}

/* Movie Cards */
.movie-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
}

.movie-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.rank-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  border-radius: 10px;
  font-size: 1.15rem;
  font-weight: 900;
  color: #ffffff;
  flex-shrink: 0;
}

.rank-1 { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35); }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #64748b); }
.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); }
.rank-other { background: #1e293b; color: #cbd5e1; border: 1px solid #334155; }

.title-wrap { flex: 1; min-width: 0; }
.movie-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.35;
  margin-bottom: 6px;
  word-break: keep-all;
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.badge-new { background: #ec4899; color: #ffffff; }
.badge-up { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-down { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-same { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }

.genre-tag, .nation-tag {
  font-size: 0.76rem;
  color: #94a3b8;
  background: #1e293b;
  padding: 3px 8px;
  border-radius: 6px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

@media (min-width: 540px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 380px) {
  .metrics-grid { gap: 6px; }
  .metric-box { padding: 8px 10px; }
}

.metric-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 10px 12px;
  border-radius: 8px;
}

.metric-box.highlight {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.25);
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.metric-value .unit {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.metric-value.small {
  font-size: 0.88rem;
  font-weight: 600;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actors-info {
  font-size: 0.84rem;
  color: #94a3b8;
  padding: 6px 10px;
  background: #0f172a;
  border-radius: 6px;
  margin-bottom: 14px;
}

.actors-info .info-label {
  color: #64748b;
  font-weight: 600;
  margin-right: 4px;
}

/* Legacy movie-info-details & ai-analysis-block compatibility */
.movie-info-details {
  font-size: 0.84rem;
  color: #94a3b8;
  padding: 8px 12px;
  background: #0f172a;
  border-radius: 6px;
  margin-bottom: 14px;
}
.movie-info-details .info-row {
  margin-bottom: 4px;
}
.movie-info-details .info-row:last-child {
  margin-bottom: 0;
}
.ai-analysis-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.analysis-item {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
}
.analysis-item:first-child {
  border-left: 3px solid #38bdf8;
}
.analysis-item:last-child {
  border-left: 3px solid #a855f7;
}
.analysis-item-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.analysis-item-title .icon {
  font-size: 0.95rem;
}

/* Analysis Section */
.analysis-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.analysis-block {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
}

.reaction-block { border-left: 3px solid #38bdf8; }
.reason-block { border-left: 3px solid #a855f7; }

.analysis-heading {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.analysis-heading .icon { font-size: 0.95rem; }

.analysis-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #cbd5e1;
  word-break: keep-all;
}

/* Navigation & Archive Bottom */
.bottom-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-buttons-row {
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 480px;
}

.btn-home {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

.btn-home:hover {
  opacity: 0.94;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.45);
}

/* Archive Card & Calendar UI (모바일 완벽 대응) */
.archive-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  margin-top: 20px;
  box-sizing: border-box;
  width: 100%;
}

@media (max-width: 480px) {
  .archive-card {
    padding: 14px 10px;
    border-radius: 12px;
  }
}

@media (max-width: 360px) {
  .archive-card {
    padding: 10px 6px;
  }
}

.archive-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.archive-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.archive-badge {
  font-size: 0.78rem;
  color: var(--primary-light);
  background: rgba(139, 92, 246, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.calendar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

@media (max-width: 480px) {
  .calendar-wrapper {
    gap: 10px;
  }
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 8px 12px;
  box-sizing: border-box;
  width: 100%;
}

@media (max-width: 480px) {
  .calendar-header {
    padding: 6px 8px;
  }
}

.cal-month-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
  text-align: center;
}

@media (max-width: 480px) {
  .cal-month-title {
    font-size: 0.95rem;
  }
}

.cal-nav-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

@media (max-width: 480px) {
  .cal-nav-btn {
    padding: 5px 8px;
    font-size: 0.76rem;
  }
}

.cal-nav-btn:hover {
  background: #334155;
  color: #ffffff;
}

/* Weekday header row */
.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .calendar-grid-header {
    gap: 4px;
  }
}

@media (max-width: 360px) {
  .calendar-grid-header {
    gap: 2px;
  }
}

.cal-weekday {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 0;
  text-align: center;
}

@media (max-width: 480px) {
  .cal-weekday {
    font-size: 0.74rem;
    padding: 2px 0;
  }
}

.cal-weekday.sun { color: #f87171; }
.cal-weekday.sat { color: #60a5fa; }

/* Calendar 7-column Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .calendar-grid {
    gap: 4px;
  }
}

@media (max-width: 360px) {
  .calendar-grid {
    gap: 2px;
  }
}

/* Single Calendar Cell - 고정 min-height를 제거하고 정사각형 aspect-ratio 유지 */
.cal-cell {
  aspect-ratio: 1 / 1;
  min-height: 0;
  min-width: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  text-decoration: none;
  transition: all 0.18s ease;
  user-select: none;
  box-sizing: border-box;
  padding: 0;
  overflow: hidden;
}

@media (max-width: 480px) {
  .cal-cell {
    border-radius: 6px;
  }
}

@media (max-width: 360px) {
  .cal-cell {
    border-radius: 4px;
  }
}

.cal-cell.empty {
  background: transparent;
  border: none;
  pointer-events: none;
}

.cal-cell.no-post {
  background: #0f172a;
  border: 1px solid #1e293b;
  color: #475569;
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.cal-cell.has-post {
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #f1f5f9;
  cursor: pointer;
}

.cal-cell.has-post:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #a78bfa;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.cal-cell.has-post.is-current {
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  border: 2px solid #a78bfa;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.5);
  color: #ffffff;
  font-weight: 800;
}

/* Day Number: 셀 중앙에 크고 명확하게 정렬 */
.cal-day-num {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

@media (max-width: 480px) {
  .cal-day-num {
    font-size: 0.85rem;
  }
}

@media (max-width: 360px) {
  .cal-day-num {
    font-size: 0.78rem;
  }
}

.cal-cell.sun .cal-day-num { color: #fca5a5; }
.cal-cell.sat .cal-day-num { color: #93c5fd; }
.cal-cell.has-post.is-current .cal-day-num { color: #ffffff; }
.cal-cell.no-post.sun .cal-day-num { color: #7f1d1d; }
.cal-cell.no-post.sat .cal-day-num { color: #1e3a8a; }

/* 텍스트 뱃지는 불필요하므로 완전히 제거/숨김 */
.cal-cell-badge {
  display: none !important;
}

/* Footer */
footer.page-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}
