/* =====================================================================
   カレンダーの部品（トップページ index.html と calendar.html の両方で使う）
   色・文字・余白は site.css の :root 変数。部活の色は --club（既定は milk の緑）。
   印は3種: 集まり＝色つき（.chip）／空き＝○（.mk）／予約＝×（.mk--x）
   動きは assets/cal.js、データは assets/calendar.json と /api/events。
   ===================================================================== */
.cal-wrap { --r-s: 8px; }
.cal-wrap { display: grid; gap: clamp(1.25rem, 1rem + 1.5vw, 2rem); align-items: start; }
/* 並びはスマホ基準（表 → 選んだ日 → これからの集まり）。PCは左に表と一覧、右に選んだ日 */
@media (min-width: 1200px) {
  .cal-wrap { grid-template-columns: minmax(0, 1fr) 340px; }
  .cal-card, .upc { grid-column: 1; }
  .cal-detail { grid-column: 2; grid-row: 1 / span 2; }
}
.cal-card { background: var(--c-surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: clamp(1rem, .5rem + 2vw, 1.75rem); }

.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.cal-nav__ttl { font-size: var(--fs-h2); font-weight: 700; line-height: 1.2; }
.cal-nav__ttl span { display: block; font-size: var(--fs-small); color: var(--c-sub); }
.cal-nav__btns { display: flex; gap: .5rem; }
.cal-nav button { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-pill); border: 2px solid var(--c-accent); background: var(--c-surface); color: var(--c-accent); cursor: pointer; transition: background var(--dur-ui); }
.cal-nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cal-nav button:hover:not(:disabled) { background: var(--c-pale); }
.cal-nav button:disabled { border-color: var(--c-line); color: var(--c-line); cursor: default; }

/* マスの枠は作らず、週ごとの細い線だけ */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--c-sub); padding: 0 0 .5rem; border-bottom: 1px solid var(--c-line); }
.cal-day, .cal-blank { border: 0; border-bottom: 1px solid var(--c-line); min-height: 92px; }
.cal-day { appearance: none; font: inherit; color: inherit; text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 6px 10px; background: transparent; border-radius: 0; cursor: pointer; transition: background var(--dur-ui); }
.cal-day:hover { background: var(--c-pale); }
.cal-day__n { font-weight: 700; font-size: var(--fs-body); line-height: 1; width: 2em; height: 2em; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-pill); margin: -2px 0 0 -4px; }
.cal-day__m { display: contents; }
.cal-day.is-today .cal-day__n { background: var(--c-accent); color: #fff; }
.cal-day.is-sel { background: var(--c-pale); box-shadow: inset 0 0 0 2px var(--c-accent); border-radius: var(--r-s); border-bottom-color: transparent; }
.cal-day.is-past .cal-day__n { color: var(--c-sub); font-weight: 400; }

.chip { display: block; max-width: 100%; font-size: var(--fs-xs); line-height: 1.35; font-weight: 700; padding: 2px 8px; border-radius: var(--r-s); overflow: hidden; background: var(--club, var(--c-accent)); color: #fff; }
.chip--x { background: var(--c-line); color: var(--c-sub); }
.cal-day .chip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.mk { font-size: var(--fs-xs); line-height: 1.35; font-weight: 700; color: var(--c-accent); padding: 0 2px; white-space: nowrap; }
.mk--x { color: var(--c-sub); }
.chip .s, .mk .s { display: none; }

.cal-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: 1rem; font-size: var(--fs-small); color: var(--c-sub); }
.cal-legend li { display: inline-flex; align-items: center; gap: .45rem; }
.cal-note { margin-top: .6rem; font-size: var(--fs-small); color: var(--c-sub); }
.cal-note strong { color: var(--c-ink); }

/* これからの集まり */
.upc { margin-top: .5rem; }
.upc h3 { font-size: var(--fs-h3); font-weight: 700; }
.upc__list { margin-top: .5rem; }
.upc__row { display: grid; grid-template-columns: 3.6em 48px minmax(0, 1fr) auto; gap: 0 .9rem; align-items: center; padding: .8rem .25rem; border-bottom: 1px solid var(--c-line); color: var(--c-ink); }
.upc__row:hover { color: var(--c-accent-dark); background: var(--c-surface); }
.upc__row .stamp { width: 48px; height: 48px; font-size: var(--fs-body); outline-offset: -6px; box-shadow: none; }
.upc__date { text-align: center; font-weight: 700; line-height: 1.2; }
.upc__date b { display: block; font-size: var(--fs-body); }
.upc__date small { font-size: var(--fs-xs); color: var(--c-sub); }
.upc__ttl { font-weight: 700; line-height: 1.5; display: block; }
.upc__sub { display: block; font-size: var(--fs-small); color: var(--c-sub); line-height: 1.6; }
.upc__go { color: var(--c-accent); font-weight: 700; }
.upc__none { padding: .9rem 0; color: var(--c-sub); font-size: var(--fs-small); }

/* 選んだ日のくわしい中身 */
.cal-detail { background: var(--c-surface); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 1.4rem 1.4rem 1.5rem; }
@media (min-width: 1200px) { .cal-detail { position: sticky; top: calc(var(--header-h) + 16px); } }
.cal-detail h3 { font-size: var(--fs-h3); font-weight: 700; padding-bottom: .9rem; }
.dt-row { padding: 1rem 0; border-top: 1px solid var(--c-line); }
.dt-row__top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.dt-row__time { font-size: var(--fs-small); font-weight: 700; color: var(--c-sub); }
.st { font-size: var(--fs-xs); font-weight: 700; color: var(--c-accent); white-space: nowrap; }
.st--x { color: var(--c-sub); }
.dt-row__ttl { font-weight: 700; line-height: 1.5; margin-top: .15rem; }
.dt-row p { font-size: var(--fs-small); color: var(--c-sub); margin-top: .25rem; line-height: 1.7; }
.dt-row a.more { font-size: var(--fs-small); margin-top: .35rem; min-height: 44px; }
.cal-detail__foot { border-top: 1px solid var(--c-line); padding-top: .9rem; font-size: var(--fs-small); color: var(--c-sub); }

/* 判子: 部活ごとの丸い印。空いている曜日は点線 */
.stamp { width: 60px; height: 60px; border-radius: var(--r-pill); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-h3); line-height: 1; color: #fff; background: var(--club, var(--c-accent)); outline: 2px solid #fff; outline-offset: -7px; box-shadow: 0 0 0 4px var(--c-surface); }
.stamp--img { background: var(--c-surface); outline: 0; overflow: hidden; }
.stamp--img img { width: 100%; height: 100%; }

@media (max-width: 760px) {
  .cal-day, .cal-blank { min-height: 66px; }
  .cal-day { padding: 6px 0 8px; align-items: center; gap: 3px; }
  .cal-day__n { margin: 0; }
  .cal-day .chip { display: block; padding: 1px 0; width: calc(100% - 4px); text-align: center; white-space: nowrap; }
  .chip .l, .mk .l { display: none; }
  .chip .s, .mk .s { display: inline; }
  .upc__go { display: none; }
  .upc__row { grid-template-columns: 3.2em 48px minmax(0, 1fr); gap: 0 .7rem; }
}
