/* ==========================================================
   OTH Events Calendar — oth-calendar.css
   カテゴリカラーはすべて PHP インラインスタイルで適用
   ========================================================== */

/* ── ラッパー ── */
.oth-cal {
  font-family: inherit;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,.07);
  transition: opacity .2s;
}
.oth-cal--loading {
  opacity: .45;
  pointer-events: none;
}

/* ── ツールバー ── */
.oth-cal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f4f7fb;
  border-bottom: 1px solid #e5eaf1;
}

.oth-cal-nav {
  flex-shrink: 0;
  background: none;
  border: 1px solid #c5cdd8;
  border-radius: 5px;
  width: 34px;
  height: 34px;
  font-size: 20px;
  cursor: pointer;
  color: #445;
  transition: background .15s, border-color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.oth-cal-nav:hover,
.oth-cal-nav:focus-visible {
  background: #e2e9f2;
  border-color: #aab4c3;
  outline: none;
}

.oth-cal-month-label {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a2030;
  letter-spacing: .06em;
}

/* ── グリッドヘッダー ── */
.oth-cal-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #edf1f8;
  border-bottom: 1px solid #e5eaf1;
}
.oth-cal-head-cell {
  padding: 8px 4px;
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  color: #556;
  letter-spacing: .1em;
}
.oth-cal-head-cell.is-sun { color: #c62828; }
.oth-cal-head-cell.is-sat { color: #1565C0; }

/* ── 日付グリッド ── */
.oth-cal-body {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(90px, auto); /* 内容に応じて縦方向に拡張する */
}

.oth-cal-cell {
  min-height: 90px;
  padding: 4px 3px 4px 4px;
  border-right: 1px solid #eff1f5;
  border-bottom: 1px solid #eff1f5;
  overflow: visible;
}
.oth-cal-cell:nth-child(7n) {
  border-right: none;
}
.oth-cal-cell--empty  { background: #fafbfc; }
.oth-cal-cell.is-sun  { background-color: #fff8f8; }
.oth-cal-cell.is-sat  { background-color: #f6f9ff; }
.oth-cal-cell.is-today { background: #fffde7 !important; }

/* ── 日付数字 ── */
.oth-cal-date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: .78rem;
  font-weight: 600;
  color: #334;
  border-radius: 50%;
  margin-bottom: 2px;
}
.oth-cal-cell.is-today  .oth-cal-date { background: #1565C0; color: #fff; }
.oth-cal-cell.is-sun    .oth-cal-date { color: #c62828; }
.oth-cal-cell.is-sat    .oth-cal-date { color: #1565C0; }
.oth-cal-cell.is-today.is-sun .oth-cal-date,
.oth-cal-cell.is-today.is-sat .oth-cal-date { color: #fff; }

/* ── イベントラベル（カラーはインラインスタイルで適用） ── */
.oth-cal-event {
  display: block;        /* inline-block にして時刻＋タイトルを一続きで折り返す */
  font-size: .67rem;
  line-height: 1.4;
  padding: 1px 5px 1px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  overflow: hidden;      /* セル高を超えた分はセル側で隠す */
  text-decoration: none;
  transition: opacity .15s, filter .15s;
  border-left: 3px solid transparent; /* 色はインラインで上書き */
}
.oth-cal-event:hover,
.oth-cal-event:focus-visible {
  opacity: .8;
  filter: brightness(.94);
  outline: none;
}
.oth-cal-event-time {
  display: inline;
  font-weight: 700;
  font-size: .62rem;
  opacity: .75;
  margin-right: 2px;
}
.oth-cal-event-title {
  display: inline;
  font-size: .8rem; /* 0.67rem × 1.5 */
  overflow-wrap: break-word; /* 長い単語も枠内で折り返す */
}

/* ── 凡例（カラーはインラインスタイルで適用） ── */
.oth-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 10px 14px;
  background: #f4f7fb;
  border-top: 1px solid #e5eaf1;
  font-size: .76rem;
  color: #556;
}
.oth-cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.oth-cal-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  border: 1px solid transparent; /* 色はインラインで上書き */
  flex-shrink: 0;
}

/* ── 月間グリッド レスポンシブ ── */
@media (max-width: 768px) {
  .oth-cal-body  { grid-auto-rows: 64px; }
  .oth-cal-cell  { min-height: 64px; padding: 2px; }
  .oth-cal-event { font-size: .6rem; padding: 1px 3px; border-left-width: 2px; }
  .oth-cal-event-time { display: none; }
  .oth-cal-date  { width: 19px; height: 19px; font-size: .72rem; }
}

/* ══════════════════════════════════════════
   週リストビュー（モバイル専用・JS で切替）
   ══════════════════════════════════════════ */
.oth-cal--week .oth-week-list {
  /* セルを縦積み */
}

.oth-week-day {
  display: flex;
  border-bottom: 1px solid #eff1f5;
  min-height: 48px;
}
.oth-week-day:last-child { border-bottom: none; }

/* 左：日付ヘッダー列 */
.oth-week-day-header {
  flex-shrink: 0;
  width: 52px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  background: #f8f9fc;
  border-right: 1px solid #eff1f5;
}
.oth-week-day.is-sun .oth-week-day-header { background: #fff5f5; }
.oth-week-day.is-sat .oth-week-day-header { background: #f5f8ff; }
.oth-week-day.is-today .oth-week-day-header { background: #fff9c4; }

.oth-week-day-num {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: #334;
}
.oth-week-day-ja {
  font-size: .65rem;
  font-weight: 600;
  color: #889;
  letter-spacing: .06em;
}
.oth-week-day.is-sun .oth-week-day-num,
.oth-week-day.is-sun .oth-week-day-ja { color: #c62828; }
.oth-week-day.is-sat .oth-week-day-num,
.oth-week-day.is-sat .oth-week-day-ja { color: #1565C0; }

.oth-week-today-badge {
  margin-top: 2px;
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: #1565C0;
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}

/* 右：イベントリスト列 */
.oth-week-events {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.oth-week-event {
  border-left: 3px solid;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
}
.oth-week-event a {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 6px;
  row-gap: 1px;
  padding: 5px 7px;
  text-decoration: none;
  transition: opacity .15s;
}
.oth-week-event a:hover { opacity: .8; }

.oth-week-event-time {
  grid-column: 1;
  grid-row: 1;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.oth-week-event-title {
  grid-column: 2;
  grid-row: 1;
  font-size: .82rem;
  font-weight: 600;
  color: #1a2030;
  line-height: 1.3;
}
.oth-week-event-venue {
  grid-column: 2;
  grid-row: 2;
  font-size: .68rem;
  color: #889;
  line-height: 1.2;
}

/* 会場なし／時刻なしのとき単列表示 */
.oth-week-event a:not(:has(.oth-week-event-time)) .oth-week-event-title {
  grid-column: 1 / -1;
}

.oth-week-no-events {
  flex: 1;
  margin: 0;
  padding: 0 8px;
  display: flex;
  align-items: center;
  color: #ccd;
  font-size: .78rem;
}
