/* ============================================================
   holiday-calendar — 営業日カレンダー
   正本: ~/.claude/skills/holiday-calendar/assets/holiday-calendar.css

   設置例:
     <link rel="stylesheet" href="assets/holiday-calendar.css">
     <div class="hcal" data-source="data/holidays.json"></div>
     <script src="assets/holiday-calendar.js" defer></script>

   テーマカスタマイズ:
     設置先サイトの head 内で .hcal の CSS 変数を上書きする。
     例（grecia 茶系・金系）:
       <style>
         .hcal {
           --cal-border: rgba(128, 108, 42, 0.2);
           --cal-text: #1c1410;
           --cal-closed-bg: rgba(128, 108, 42, 0.12);
           --cal-closed-text: #806c2a;
           --cal-today-ring: #c8a960;
         }
       </style>

   レイアウト方針:
     ブラウザ拡大時の崩壊回避のため container query (cqi) は使わず、
     2 段階の固定値（〜499px / 500px+）で統一する。
     - 小: 外枠 350px / フォント・スペーシング小
     - 大: 外枠 400px / フォント・スペーシング大
   ============================================================ */

.hcal {
  /* テーマトークン（設置先で上書き可、既定値はニュートラル） */
  --cal-font: 'Noto Serif JP', serif;
  --cal-bg: #fff;
  --cal-border: rgba(0, 0, 0, 0.12);
  --cal-text: inherit;
  --cal-color-sun: #c44;
  --cal-color-sat: #448;
  --cal-closed-bg: rgba(200, 90, 90, 0.12);
  --cal-closed-text: #c85a5a;
  --cal-today-ring: #efc461;
  --cal-holiday-dot: #c85a5a;
  --cal-radius: 6px;

  /* 小サイズ既定（〜499px） */
  width: min(350px, 100%);
  padding: 30px 25px 20px;
  background: var(--cal-bg);
  border: 1px solid var(--cal-border);
  border-radius: var(--cal-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  font-family: var(--cal-font);
  color: var(--cal-text);
  box-sizing: border-box;
}
.hcal *,
.hcal *::before,
.hcal *::after {
  box-sizing: border-box;
}

/* ヘッダー（前月 / 年月 / 次月） */
.hcal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.hcal__title {
  font-size: 14px;
  letter-spacing: 0.1em;
  font-weight: bold;
}
.hcal__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--cal-closed-text);
  opacity: 0.6;
  padding: 0;
  transition: opacity 0.2s;
}
.hcal__nav:hover {
  opacity: 1;
}
.hcal__nav-icon {
  width: 18px;
  height: 18px;
}

/* 月別備考（monthNotes） */
.hcal__month-note {
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  padding: 6px 10px;
  margin-bottom: 10px;
  background: var(--cal-closed-bg);
  color: var(--cal-closed-text);
  border-radius: calc(var(--cal-radius) / 2);
  text-align: center;
}

/* グリッド */
.hcal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}
.hcal__weekdays {
  font-size: 11px;
  letter-spacing: 0.05em;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--cal-border);
  margin-bottom: 5px;
  opacity: 0.7;
}
.hcal__sun { color: var(--cal-color-sun); }
.hcal__sat { color: var(--cal-color-sat); }

.hcal__days {
  font-size: 14px;
  gap: 3px;
}

/* 各セル */
.hcal__cell {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.hcal__day-sun { color: var(--cal-color-sun); }
.hcal__day-sat { color: var(--cal-color-sat); }
.hcal__day-holiday { color: var(--cal-color-sun); }

/* 休業日（規則 or override） — 休業色は日/土/祝より優先 */
.hcal__closed {
  background: var(--cal-closed-bg);
  color: var(--cal-closed-text);
}
.hcal__closed.hcal__day-sun,
.hcal__closed.hcal__day-sat,
.hcal__closed.hcal__day-holiday {
  color: var(--cal-closed-text);
}

/* 本日 — リング枠 */
.hcal__today {
  box-shadow: inset 0 0 0 1.5px var(--cal-today-ring);
  font-weight: bold;
}

/* 祝日マーク（右上ドット、塗りには影響しない） */
.hcal__dot {
  position: absolute;
  top: 6%;
  right: 12%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cal-holiday-dot);
}

/* 凡例 */
.hcal__legend {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.05em;
  opacity: 0.75;
}
.hcal__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hcal__legend-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.hcal__legend-swatch--closed {
  background: var(--cal-closed-bg);
  border: 1px solid var(--cal-closed-text);
  opacity: 0.6;
}
.hcal__legend-swatch--today {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--cal-today-ring);
}
.hcal__legend-swatch--holiday {
  background: var(--cal-holiday-dot);
}

/* 500px+ — 外枠 400px、ひと回り大きく */
@media (min-width: 500px) {
  .hcal {
    width: min(400px, 100%);
    padding: 35px 30px 25px;
  }
  .hcal__header {
    margin-bottom: 16px;
  }
  .hcal__title {
    font-size: 16px;
  }
  .hcal__nav {
    width: 32px;
    height: 32px;
  }
  .hcal__nav-icon {
    width: 20px;
    height: 20px;
  }
  .hcal__month-note {
    font-size: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
  }
  .hcal__weekdays {
    font-size: 12px;
    padding-bottom: 6px;
    margin-bottom: 6px;
  }
  .hcal__days {
    font-size: 16px;
    gap: 4px;
  }
  .hcal__dot {
    width: 6px;
    height: 6px;
  }
  .hcal__legend {
    gap: 12px;
    margin-top: 18px;
    font-size: 12px;
  }
  .hcal__legend-swatch {
    width: 10px;
    height: 10px;
  }
}
