/* S07 개봉 캘린더 — 페이지 전용. 데스크톱: 좌 월 그리드(360px) + 우 주 목록 */

/* ── 머리 ── */
.cal-head { display: grid; gap: var(--sp-1); }
.cal-head__row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.cal-head__row .page-title { margin-bottom: 0; flex: 1 1 auto; }
.cal-head__sub { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--c-text-muted); }
.cal-ics__n { font-variant-numeric: tabular-nums; color: var(--c-primary-text); }

/* ── 월 이동 ── */
.month-nav {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--sp-2);
  margin-top: var(--sp-4); padding: 2px; border-radius: var(--r-pill); background: var(--c-surface); border: 1px solid var(--c-line);
}
.month-nav__title { text-align: center; font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-black); font-variant-numeric: tabular-nums; }
.month-nav__btn {
  display: inline-flex; align-items: center; gap: 2px; min-height: var(--touch); padding: 0 var(--sp-3);
  border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--c-text-muted);
}
.month-nav__btn:hover { background: var(--c-surface-2); color: var(--c-text); }
.month-nav__btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.month-nav__btn[disabled]:hover { background: transparent; color: var(--c-text-muted); }

/* ── 필터 ── */
.cal-filters { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); }
.cal-filters .segmented { margin-inline: 0; padding-inline: 0; }
.cal-toggle { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: var(--touch); font-size: var(--fs-sm); font-weight: var(--fw-semibold); cursor: pointer; }
.cal-toggle input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-primary); }
.cal-viewseg { margin-top: var(--sp-2); }
.cal-viewseg .segmented { margin-inline: 0; padding-inline: 0; }

.cal-layout { margin-top: var(--sp-4); }

/* ── 주 목록 ── */
.cal-week + .cal-week { margin-top: var(--sp-5); }
.cal-week__head {
  position: sticky; top: calc(var(--topbar-h) + 3px); z-index: 2;
  display: flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 6px var(--sp-1);
  margin-inline: calc(var(--sp-1) * -1);
  background: color-mix(in srgb, var(--c-bg) 92%, transparent); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  font-size: var(--fs-body); line-height: var(--lh-body); font-weight: var(--fw-bold); border-bottom: 1px solid var(--c-line);
}
.cal-week__head small { font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--c-text-muted); }
.cal-week.is-current .cal-week__head { border-bottom-color: var(--c-primary); }
.cal-week__none { padding: var(--sp-3) var(--sp-1); font-size: var(--fs-sm); color: var(--c-text-faint); }
.cal-week__note { margin: var(--sp-2) 0; font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--c-text-muted); }
.cal-other { color: var(--c-primary-text); text-decoration: underline; text-underline-offset: 3px; font-weight: var(--fw-semibold); display: inline-flex; align-items: center; min-height: 32px; position: relative; }
.cal-other::after { content: ""; position: absolute; inset: -6px 0; } /* 터치 44px(사용자 지시 2026-10-07 출시 전 감사 A-5) */
.cal-rows { list-style: none; padding: 0; margin: var(--sp-2) 0 0; display: grid; gap: var(--sp-2); }
.cal-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2); border-radius: var(--r-md); background: var(--c-surface); border: 1px solid var(--c-line);
  scroll-margin-top: calc(var(--topbar-h) + 56px);
}
.cal-row.is-flash { animation: cal-flash 1.6s var(--ease-out); }
@keyframes cal-flash { 0%, 30% { box-shadow: 0 0 0 2px var(--c-gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
.cal-row__thumb { display: block; width: 120px; height: 68px; border-radius: var(--r-sm); overflow: hidden; background: #000; }
.cal-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cal-row__thumb--text { display: grid; place-items: center; padding: var(--sp-2); background: var(--c-surface-2); text-align: center; font-size: var(--fs-caption); font-weight: var(--fw-bold); color: var(--c-text-muted); }
.cal-row__body { min-width: 0; display: grid; gap: 2px; }
.cal-row__top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-caption); line-height: var(--lh-caption); }
.cal-row__date { color: var(--c-text-muted); }
.cal-row__old { color: var(--c-text-faint); }
.cal-row__title { font-size: var(--fs-body); line-height: 22px; font-weight: var(--fw-bold); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-row__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cal-row__meta { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--c-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-row__acts { display: flex; flex-direction: column; gap: 0; }
.cal-btn { color: var(--c-text-muted); }
.cal-btn[aria-pressed="true"] { color: var(--c-primary); }
.cal-btn[aria-pressed="true"] svg path { fill: currentColor; }

/* 지난 주(이번 달) 접기 */
.cal-past { margin-bottom: var(--sp-5); border-radius: var(--r-md); border: 1px dashed var(--c-line-strong); padding: 0 var(--sp-3); }
.cal-past[open] { padding-bottom: var(--sp-3); }
.cal-past__sum { min-height: var(--touch); display: flex; align-items: center; gap: var(--sp-1); cursor: pointer; font-size: var(--fs-sm); color: var(--c-text-muted); list-style: none; }
.cal-past__sum::-webkit-details-marker { display: none; }
.cal-past__sum::before { content: "▸"; margin-right: 4px; transition: transform var(--dur-1); }
.cal-past[open] > .cal-past__sum::before { transform: rotate(90deg); }
.cal-past__sum b { color: var(--c-text); }
.cal-past .cal-week__head { position: static; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }

.cal-undated { margin-top: var(--sp-8) !important; }

/* ── 월 그리드 ── */
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
  padding: var(--sp-3); border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-line);
}
.cal-dow { text-align: center; font-size: var(--fs-caption); font-weight: var(--fw-bold); color: var(--c-text-muted); padding-bottom: 4px; }
.cal-dow.is-sun { color: var(--c-up); }
.cal-dow.is-sat { color: var(--c-down); }
.cal-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  min-height: 48px; padding: 6px 0; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--c-text);
}
.cal-cell.is-past { color: var(--c-text-faint); }
/* 주말 날짜 글자: 칸 배경(surface·surface-2·hover surface-3) 모두 4.5:1 이상이 되게 전용 색(사용자 지시 2026-10-07 출시 전 감사 A-2).
   예전 --c-up/--c-down + 지난 날 opacity 0.7 은 다크 2.84~4.15:1 · 라이트 2.82~4.33:1 로 미달 → 지난 주말도 불투명 */
.cal-cell { --cal-sun: #FF6B5E; --cal-sat: #6FA3FF; }
:root[data-theme="light"] .cal-cell { --cal-sun: #B3221B; --cal-sat: #1F56C2; }
.cal-cell.is-sun .cal-cell__d { color: var(--cal-sun); }
.cal-cell.is-sat .cal-cell__d { color: var(--cal-sat); }
.cal-cell.has-movies { background: var(--c-surface-2); cursor: pointer; font-weight: var(--fw-bold); }
.cal-cell.has-movies:hover { background: var(--c-surface-3); }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--c-gold); }
.cal-cell.is-today .cal-cell__d { color: var(--c-gold-text); font-weight: var(--fw-black); }
.cal-cell--blank { min-height: 0; }
.cal-dots { display: inline-flex; align-items: center; gap: 3px; min-height: 6px; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c-primary); display: block; }
.cal-dots em { font-style: normal; font-size: 10px; line-height: 1; font-weight: var(--fw-bold); color: var(--c-primary-text); }
.cal-grid__foot { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-2); font-size: var(--fs-caption); color: var(--c-text-muted); }

@media (max-width: 380px) {
  .cal-row { grid-template-columns: 96px minmax(0, 1fr) auto; gap: var(--sp-2); }
  .cal-row__thumb { width: 96px; height: 54px; }
}
@media (min-width: 900px) {
  .cal-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
  .cal-grid-wrap { position: sticky; top: calc(var(--topbar-h) + var(--sp-4)); }
  .cal-cell { min-height: 52px; }
  .month-nav { max-width: 520px; }
  .cal-row__acts { flex-direction: row; }
}

/* 품질 감사(2026-10-04): 두 줄 제한(overflow:hidden) 제목 링크의 포커스 링이 잘리지 않게 안쪽으로 */
.cal-row__title a:focus-visible { outline-offset: -2px; }

/* ── PC 규격 통일(사용자 지시 2026-10-06: 캘린더·검색·마이를 홈·랭킹·예고편 분석과 같은 규격으로) ──
   머리 간격 = 랭킹(.rk-head) · 월 이동·국가·예고편 토글 = 한 줄 도구 막대(랭킹 PC 필터 바와 같은 표면 패널, .cal-toolbar) ·
   목록 행 = 썸네일 160×90(900~1179) / 192×108(1180~, 랭킹 표와 같음) + 랭킹 카드 글자 체계(components.css 끝 공용 블록) */
@media (min-width: 900px) {
  .cal-head { margin-bottom: var(--sp-3); }
  .cal-toolbar {
    display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3) var(--sp-6);
    padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); background: var(--c-surface); border: 1px solid var(--c-line);
  }
  .cal-toolbar .month-nav { margin-top: 0; flex: 0 1 440px; max-width: 440px; }
  .cal-toolbar .cal-filters { margin-top: 0; gap: var(--sp-4); }
  .cal-toolbar .cal-viewseg { margin-top: 0; }
  .cal-layout { margin-top: var(--sp-5); }
  .cal-week__head { font-size: var(--fs-h3); line-height: var(--lh-h3); min-height: 48px; }
  .cal-week + .cal-week { margin-top: var(--sp-6); }
  .cal-rows { gap: var(--sp-3); margin-top: var(--sp-3); }
  .cal-row { grid-template-columns: 160px minmax(0, 1fr) auto; gap: var(--sp-4); padding: var(--sp-3); border-radius: var(--r-lg); }
  .cal-row__thumb { width: 160px; height: 90px; }
  .cal-row__body { gap: 4px; }
}
@media (min-width: 1180px) {
  .cal-layout { grid-template-columns: 380px minmax(0, 1fr); gap: var(--sp-8); }
  .cal-row { grid-template-columns: 192px minmax(0, 1fr) auto; gap: var(--sp-5); }
  .cal-row__thumb { width: 192px; height: 108px; }
}
