﻿@charset "UTF-8";
:root {
  --calendar-primary: #1890ff;
  --calendar-bg: #ffffff;
  --calendar-border: #e5e5e5;
  --calendar-text: #333333;
  --calendar-muted: #666666;
  --calendar-bg-alt: #f5f7fb;
  /* minute-based layout tokens (can be overridden inline) */
  --hour-height: clamp(144px, 16vh, 240px);
  --minute-height: calc(var(--hour-height) / 60);
  --time-label-width: 64px; /* 左の時刻ラベル幅 */
  --timeline-mainline: 2px; /* 主線の太さ */
}

[data-theme=dark] {
  --calendar-primary: #69b1ff;
  --calendar-bg: #121212;
  --calendar-bg-alt: #1a1a1a;
  --calendar-border: #2a2a2a;
  --calendar-text: #eaeaea;
  --calendar-muted: #b0b0b0;
}

.calendar-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  background-color: var(--calendar-bg-alt);
  min-height: 100vh;
  color: var(--calendar-text);
}

.view-toggle {
  display: inline-flex;
  align-self: center;
  background-color: var(--calendar-bg);
  border-radius: 999px;
  padding: 0.25rem 0.25rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.view-toggle__button {
  min-width: 5.5rem;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--calendar-muted);
  font-size: 0.95rem;
  line-height: 1.25rem;
  font-weight: 600;
  transition: all 0.2s ease;
}
.view-toggle__button.is-active {
  background: var(--calendar-primary);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(24, 144, 255, 0.3);
}

.nav-button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  background-color: var(--calendar-bg);
  color: var(--calendar-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nav-button:active {
  transform: scale(0.98);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.secondary-button {
  border-radius: 20px;
  border: 1px solid var(--calendar-border);
  background-color: #fff;
  color: var(--calendar-muted);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.secondary-button:hover, .secondary-button:focus {
  border-color: var(--calendar-primary);
  color: var(--calendar-primary);
}

.daily-calendar {
  border-radius: clamp(16px, 5vw, 24px);
  box-shadow: 0 18px 45px rgba(10, 20, 50, 0.12);
  background-color: var(--calendar-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}
.daily-calendar__header, .daily-calendar__secondary-actions, .daily-calendar__footer {
  padding: clamp(0.75rem, 3vw, 1.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.daily-calendar__secondary-actions, .daily-calendar__footer {
  background-color: var(--calendar-bg-alt);
  gap: 0.75rem;
}
.daily-calendar__timeline {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: 0 clamp(0.75rem, 3vw, 1.25rem);
  background: linear-gradient(180deg, rgba(24, 144, 255, 0.08) 0%, rgba(24, 144, 255, 0) 8%);
  touch-action: pan-y;
}
.daily-calendar__state {
  padding: 2.5rem 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--calendar-muted);
}
.daily-calendar__state--error {
  color: #d64545;
}

.date-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: center;
}
.date-label__day {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--calendar-primary);
}
.date-label__full {
  font-size: clamp(0.85rem, 3vw, 1rem);
  color: var(--calendar-muted);
}

.timeline-content {
  position: relative;
}

.timeline-grid {
  display: grid;
  grid-template-columns: var(--time-label-width) 1fr;
  column-gap: 0;
  font-size: clamp(1rem, 3.5vw, 1.15rem);
  color: var(--calendar-muted);
}

.timeline-labels {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 0;
  margin: 0;
}

.timeline-label {
  min-height: var(--hour-height);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 0.5rem;
  transform: translateY(-5px);
  line-height: 1;
}

.timeline-slots {
  position: relative;
  padding-right: clamp(0.5rem, 3vw, 1rem);
}

.timeline-slot {
  position: relative;
  height: var(--hour-height);
  border-top: var(--timeline-mainline) solid rgba(0, 0, 0, 0.12);
}

/* 30分の補助線を薄く表示 */
.timeline-slot::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

/* イベントレイヤの原点はタイムライン上端。上下に余白を入れない */
.event-layer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

/* イベントカード本体 */
.event-card {
  position: absolute;
  left: 0;
  right: 0;
  /* 文字を小さめに、詰め気味に */
  padding: clamp(0.55rem, 2.8vw, 0.9rem);
  border-radius: clamp(12px, 4vw, 16px);
  background-color: rgba(230, 247, 255, 0.9);
  border: 1px solid rgba(18, 33, 48, 0.08);
  color: var(--calendar-text);
  display: flex;
  flex-direction: column;
  gap: clamp(0.3rem, 1.8vw, 0.5rem);
  box-shadow: 0 20px 38px rgba(10, 30, 60, 0.24);
  overflow-x: hidden;
  overflow-y: auto;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
  padding: 8px 12px;           /* 内側余白を拡大 */
  line-height: 1.4;            /* 行間を十分に確保 */
  overflow: visible;           /* 上下のグリフが切れないように */
  white-space: normal;
  word-break: break-word;
}

/* タイトル/時刻/メタのフォントサイズを小さく */
.event-card__title {
  font-size: clamp(0.8rem, 2.4vw, 0.9rem);
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
  line-height: inherit;        /* タイトル等も同じ行間 */
  margin-block: 2px;           /* 上下にわずかな余白 */
}

.event-card__time {
  font-size: clamp(0.7rem, 2.1vw, 0.85rem);
  color: var(--calendar-muted);
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
  line-height: inherit;        /* タイトル等も同じ行間 */
  margin-block: 2px;           /* 上下にわずかな余白 */
}

.event-card__meta {
  font-size: clamp(0.7rem, 2.1vw, 0.85rem);
  color: var(--calendar-muted);
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
  line-height: inherit;        /* タイトル等も同じ行間 */
  margin-block: 2px;           /* 上下にわずかな余白 */
}

/* 任意: モバイル幅（md）では event-layer の left を CSS変数に揃える */
@media (max-width: 600px) {
  .event-layer {
    position: relative;
    top: 0;
    bottom: 0;
    width: 90%;
    left: var(--time-label-width); /* 130px から変数に統一 */
    right: clamp(0.6rem, 3vw, 1rem);
  }
}
@media (max-width: 1200px) {
  .week-calendar__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .week-calendar__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .week-calendar__grid {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
  .calendar-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .calendar-controls__main {
    width: 100%;
    justify-content: space-between;
  }
  .calendar-controls__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
  .event-layer {
    position: relative;
    top: 0;
    bottom: 0;
    width: 90%;
    left: 130px;
    right: clamp(0.6rem, 3vw, 1rem);
  }
}
