/* ===========================================================
   SexyRepo Release Calendar
   既存 style.css の :root 変数 (--accent / --gradient 等) を活用しつつ、
   カレンダー専用のヒートマップ用スケールを追加。
   =========================================================== */

:root {
  --cal-lv0: #f4f4f9;       /* 0 件 */
  --cal-lv1: #fce7f3;       /* 1-2 件 */
  --cal-lv2: #fbcfe8;       /* 3-7 件 */
  --cal-lv3: #f0abfc;       /* 8-15 件 */
  --cal-lv4: #c084fc;       /* 16+ 件 */
  --cal-lv4-strong: #8b5cf6; /* 30+ 件 (最濃) */
  --cal-cell-radius: 12px;
  --cal-cell-gap: 6px;
}

/* ── Section (sale/list と同じ作法に揃える) ── */
.cal-section {
  /* .section の 200px マージンを抑えて、 calendar 専用のコンパクトな間隔に */
  margin-top: 80px !important;
  margin-bottom: 60px !important;
}
.cal-section .section-lead {
  margin: 0 0 18px; font-size: 13px; color: var(--fg-dim);
  position: relative; z-index: 1; line-height: 1.65;
}
.cal-summary {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin: 0; position: relative; z-index: 1;
}
.cal-summary > div {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px; color: var(--fg-dim);
  display: inline-flex; align-items: baseline; gap: 6px;
  box-shadow: var(--shadow-card);
}
.cal-summary strong {
  font-size: 18px; font-weight: 900;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ── Controls (month nav + filters) ── */
.cal-controls {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.cal-month-nav {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
}
.cal-arrow {
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 22px; font-weight: 700; line-height: 1;
  color: var(--fg-dim); cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  display: flex; align-items: center; justify-content: center;
}
.cal-arrow:hover {
  background: var(--gradient);
  color: #fff; border-color: transparent;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.3);
}
.cal-arrow:active { transform: translateY(0) scale(0.98); }

.cal-month-display {
  display: flex; align-items: baseline; gap: 18px;
  flex: 1; justify-content: center;
  /* italic 文字が右にはみ出すので、 overflow を許容 */
  overflow: visible;
}
.cal-month-num {
  font-size: clamp(40px, 8vw, 64px); font-weight: 900;
  letter-spacing: 0.02em;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  line-height: 1;
  font-family: "Cormorant Garamond", "Hiragino Mincho ProN", serif;
  font-style: italic;
  /* italic のディセンダー/ アセンダーが右にはみ出すため、 padding-right で間隔確保 */
  padding-right: 0.2em;
  display: inline-block;
}
.cal-month-year {
  font-size: clamp(18px, 3vw, 26px); font-weight: 700;
  color: var(--fg-mute); letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.cal-today {
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--fg-dim); cursor: pointer;
  transition: all .2s;
}
.cal-today:hover {
  background: var(--gradient-soft);
  color: var(--accent-hover);
}

.cal-filter-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
}
.cal-filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-filter-divider {
  width: 1px; height: 24px; background: var(--border);
  margin: 0 4px;
}
@media (max-width: 700px) { .cal-filter-divider { display: none; width: 100%; height: 1px; margin: 4px 0; } }

.cal-chip {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12px; font-weight: 600;
  color: var(--fg-dim); cursor: pointer;
  transition: all .22s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
}
.cal-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.cal-chip.active {
  background: var(--gradient);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.3);
}
.cal-chip .count {
  display: inline-block; margin-left: 4px;
  font-size: 10px; opacity: 0.7; font-weight: 500;
}

/* ── Calendar grid ── */
.cal-grid-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: var(--cal-cell-gap);
  margin-bottom: 8px;
}
.cal-weekdays > div {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--fg-mute); letter-spacing: 0.16em;
  padding: 6px 0;
}
.cal-weekdays > div:first-child { color: #ef4444; }
.cal-weekdays > div.cal-sat { color: #3b82f6; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: var(--cal-cell-gap);
}
.cal-cell {
  min-height: 64px;
  border-radius: var(--cal-cell-radius);
  background: var(--cal-lv0);
  border: 1px solid transparent;
  padding: 6px 10px 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
  cursor: pointer;
  transition:
    transform .25s cubic-bezier(.34,1.56,.64,1),
    box-shadow .25s,
    border-color .2s,
    background-color .35s;
  animation: cal-cell-in .45s cubic-bezier(.2,.85,.2,1) both;
  animation-delay: calc(var(--cell-index, 0) * 10ms);
}
@keyframes cal-cell-in {
  from { opacity: 0; transform: translateY(8px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cal-cell.empty {
  background: transparent;
  cursor: default;
  pointer-events: none;
}
.cal-cell.outside {
  opacity: 0.35;
}
.cal-cell.lv1 { background: var(--cal-lv1); }
.cal-cell.lv2 { background: var(--cal-lv2); }
.cal-cell.lv3 { background: var(--cal-lv3); color: #fff; }
.cal-cell.lv4 { background: var(--cal-lv4); color: #fff; }
.cal-cell.lv5 { background: var(--cal-lv4-strong); color: #fff; }
.cal-cell:not(.empty):hover {
  transform: translateY(-6px) scale(1.12);
  box-shadow:
    0 18px 38px rgba(139, 92, 246, 0.32),
    0 0 0 3px var(--accent);
  border-color: transparent;
  z-index: 4;
}
.cal-cell:not(.empty):hover .cal-day-count {
  transform: scale(1.15);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15));
}
.cal-cell:not(.empty)::after {
  content: "→";
  position: absolute;
  bottom: 4px; left: 6px;
  font-size: 14px; font-weight: 900;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .25s, transform .25s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
.cal-cell:not(.empty):hover::after {
  opacity: 1;
  transform: translateX(0);
}
.cal-cell.lv3:not(.empty):hover::after,
.cal-cell.lv4:not(.empty):hover::after,
.cal-cell.lv5:not(.empty):hover::after { color: #fff; }
.cal-cell .cal-day-count {
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), filter .25s;
}
.cal-cell.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cal-cell.today::before {
  content: "TODAY";
  position: absolute;
  top: 2px; right: 4px;
  font-size: 7px; font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.1em;
  opacity: 0.85;
}
.cal-cell.selected {
  transform: translateY(-3px) scale(1.10);
  box-shadow: 0 16px 40px rgba(236, 72, 153, 0.45);
  border-color: var(--accent);
  background: var(--gradient) !important;
  color: #fff;
  z-index: 5;
}
.cal-cell.selected .cal-day-num,
.cal-cell.selected .cal-day-count { color: #fff; }
.cal-cell.selected::after { color: #fff !important; opacity: 1; transform: translateX(0); }
.cal-day-num {
  font-size: 12px; font-weight: 700; color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  opacity: 0.85;
}
.cal-cell.lv3 .cal-day-num,
.cal-cell.lv4 .cal-day-num,
.cal-cell.lv5 .cal-day-num { color: #fff; opacity: 0.95; }
.cal-day-count {
  font-size: 28px; font-weight: 900; align-self: flex-end;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  font-family: "Cormorant Garamond", "Hiragino Mincho ProN", serif;
}
.cal-cell.lv3 .cal-day-count,
.cal-cell.lv4 .cal-day-count,
.cal-cell.lv5 .cal-day-count { color: #fff; }

@media (max-width: 720px) {
  .cal-grid-wrap { padding: 16px 12px 14px; border-radius: 16px; }
  .cal-cell { min-height: 50px; padding: 4px 6px 5px; border-radius: 9px; }
  .cal-day-num { font-size: 10px; }
  .cal-day-count { font-size: 20px; }
  :root { --cal-cell-gap: 4px; }
}

/* ── Legend ── */
.cal-legend {
  display: flex; align-items: center; gap: 6px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--fg-mute); letter-spacing: 0.08em;
}
.cal-legend-cell {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1px solid var(--border);
}
.cal-legend-cell.lv0 { background: var(--cal-lv0); }
.cal-legend-cell.lv1 { background: var(--cal-lv1); }
.cal-legend-cell.lv2 { background: var(--cal-lv2); }
.cal-legend-cell.lv3 { background: var(--cal-lv3); }
.cal-legend-cell.lv4 { background: var(--cal-lv4); }
.cal-legend-meta { margin-left: auto; font-weight: 600; color: var(--fg-dim); }

/* ── Detail (day works list) ── */
.cal-detail {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 24px 28px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  scroll-margin-top: 80px;
}
.cal-detail-head h2 {
  margin: 0 0 6px; font-size: 22px; font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cal-detail-head p {
  margin: 0 0 18px; color: var(--fg-mute); font-size: 12px;
}
.cal-detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px;
}
.cal-work {
  display: block; text-decoration: none; color: inherit;
  border-radius: 14px; overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
  animation: cal-work-in .4s cubic-bezier(.2,.85,.2,1) both;
}
@keyframes cal-work-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cal-work:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(20, 20, 50, 0.12);
  border-color: var(--accent);
}
.cal-work-thumb {
  aspect-ratio: 3 / 4;
  background: var(--bg-elev);
  position: relative; overflow: hidden;
}
.cal-work-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: right center;
  display: block;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.cal-work:hover .cal-work-thumb img { transform: scale(1.06); }
.cal-work-badges {
  position: absolute; top: 8px; left: 8px;
  display: flex; flex-direction: column; gap: 4px;
  z-index: 2;
}
.cal-badge {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.cal-badge.src-fanza { background: rgba(239, 68, 68, 0.92); color: #fff; }
.cal-badge.src-mgs { background: rgba(59, 130, 246, 0.92); color: #fff; }
.cal-badge.src-hnext { background: rgba(168, 85, 247, 0.92); color: #fff; }
.cal-badge.src-release { background: rgba(100, 116, 139, 0.92); color: #fff; }
.cal-badge.debut { background: rgba(250, 204, 21, 0.95); color: #1a1a2e; }
.cal-badge.sale { background: rgba(236, 72, 153, 0.95); color: #fff; }
.cal-badge.single { background: rgba(99, 102, 241, 0.85); color: #fff; }
.cal-work-body { padding: 10px 12px 14px; }
.cal-work-maker {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--accent-hover);
  margin: 0 0 4px;
  text-transform: uppercase;
}
.cal-work-title {
  font-size: 12px; font-weight: 600;
  margin: 0 0 6px; line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--fg);
}
.cal-work-actresses {
  font-size: 11px; color: var(--fg-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-work-sku {
  font-size: 10px; color: var(--fg-mute);
  font-family: "JetBrains Mono", monospace;
  margin-top: 4px;
}

.cal-detail-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 36px 16px;
  color: var(--fg-mute);
  background: var(--bg-soft);
  border-radius: 14px;
  border: 1px dashed var(--border);
}

/* ── Year bar ── */
.cal-yearbar {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
}
.cal-yearbar h3 {
  margin: 0 0 16px; font-size: 14px; font-weight: 700;
  color: var(--fg-dim); letter-spacing: 0.04em;
}
.cal-yearbar-list { display: flex; flex-direction: column; gap: 14px; }
.cal-year-row { display: flex; align-items: center; gap: 14px; }
.cal-year-label {
  font-family: "Cormorant Garamond", serif; font-style: italic;
  font-size: 22px; font-weight: 700;
  min-width: 64px; color: var(--accent-hover);
}
.cal-year-bars { flex: 1; display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 36px; }
.cal-year-bar {
  background: var(--bg-soft);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: flex-end;
  overflow: hidden;
}
.cal-year-bar:hover {
  transform: scaleY(1.08);
}
.cal-year-bar-fill {
  width: 100%;
  background: var(--gradient);
  border-radius: 4px 4px 0 0;
  transition: height .6s cubic-bezier(.34,1.56,.64,1);
}
.cal-year-bar-num {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 9px; font-weight: 700; color: var(--fg-dim);
  pointer-events: none;
}
.cal-year-bar.active .cal-year-bar-num { color: #fff; }
.cal-year-bar.has-data .cal-year-bar-num { color: var(--fg); }
.cal-year-months {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px;
  font-size: 9px; color: var(--fg-mute); text-align: center;
  margin-left: 78px; margin-top: 2px;
}

@media (max-width: 600px) {
  .cal-year-row { gap: 8px; }
  .cal-year-label { font-size: 16px; min-width: 48px; }
  .cal-year-bars { height: 28px; }
  .cal-year-months { margin-left: 56px; }
}

/* ── Loading ── */
.cal-loading {
  text-align: center; padding: 60px 20px;
  color: var(--fg-mute);
}
.cal-loading::after {
  content: "▓"; display: inline-block; margin-left: 6px;
  animation: cal-loading-blink 1s ease infinite;
}
@keyframes cal-loading-blink {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
