/* =====================
   Variables
===================== */

:root {
  --day-header-height: 28px; /* day-number と同じ高さ */
}

/* =====================
   Page Base
===================== */

.calendar-page {
  background: #fff;
}

/* =====================
   Calendar Wrapper
===================== */

.kashima-calendar {
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 0;
}

.kashima-calendar h2 {
  font-size: 22px;
  letter-spacing: 0.08em;
}

/* =====================
   Calendar Hero
===================== */

.calendar-hero {
  text-align: center;
  padding: 80px 20px 40px;
}

.calendar-hero h1 {
  font-size: 64px;
  letter-spacing: 0.18em;
  font-weight: 400;
  margin: 0;
}

/* =====================
   Highlight Area
===================== */

.calendar-highlight {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 56px;
}

.highlight-block {
  border: 1px solid #ddd;
  padding: 28px;
  min-height: 140px;
  background: #fafafa;
}

.highlight-block h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

/* =====================
   Month Section
===================== */

.calendar-month {
  margin-bottom: 64px;
}

.calendar-month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 90%;
  margin: 0 auto 60px;
}

.month-title {
  font-size: 32px;
  letter-spacing: 0.12em;
  margin: 0;
  white-space: nowrap;
}

/* =====================
   Month Navigation
===================== */

.month-nav-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.month-nav {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  color: #111;
}

.month-nav:hover {
  opacity: 0.6;
}

/* =====================
   Weekdays
===================== */

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  color: #666;
}

/* =====================
   Calendar Grid
===================== */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(120px, auto);
  border-top: 1px solid #ddd;
  border-left: 1px solid #ddd;
}

.calendar-day {
  position: relative;
  height: 220px;
  min-height: 140px;
  padding: 0;
  background: #fff;

  /* flip */
  perspective: 1000px;
}


.calendar-day.is-outside {
  background: #fafafa;
  color: #aaa;
}

.calendar-day .event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8f373a;
  position: absolute;
  bottom: 6px;
  left: 6px;
}

/* =========================
   Day Number (Front)
========================= */

.day-number {
  display: block;
  width: 100%;
  height: var(--day-header-height);
  line-height: var(--day-header-height);

  text-align: center;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;

  background-color: #3f3f3f;
  color: #fff;

  text-shadow: 0 0 0.01px rgba(0, 0, 0, 0.4);
}

/* 月曜日 */
.calendar-day.is-monday .day-number {
  background-color: #378a3e;
}

/* 日曜日 */
.calendar-day.is-sunday .day-number {
  background-color: #378a3e;
}


/* =========================
   Day Flip Card
========================= */

.day-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.calendar-day.is-flipped .day-card {
  transform: rotateY(180deg);
}

.day-face {
  position: absolute;
  inset: 0;
  height: 100%;
  backface-visibility: hidden;
  pointer-events: auto;
}

.day-front {
  z-index: 2;
  background: #fff;
}

.day-back {
  z-index: 3;
  background: #fff;
  transform: rotateY(180deg);

  display: flex;
  flex-direction: column;
  height: 100%;

  padding: 0;
  cursor: pointer;
  overflow: hidden;

  position: relative; /* ::before 用 */
}

/* 裏面 上部の赤帯 */
.day-back::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--day-header-height);
  background: #8f373a;
  z-index: 1;
}

/* 裏面：日付番号（赤帯の上に表示） */
.back-day-number {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  height: var(--day-header-height);
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 14px;
  font-weight: 600;
  color: #fff;

  z-index: 2;
  pointer-events: none;
}

/* 裏面：中身スクロール（バー非表示） */
.day-back .back-content {
  height: 100%;
  box-sizing: border-box;
  padding: calc(var(--day-header-height) + 6px) 2px 16px;

  overflow-y: auto;
  -ms-overflow-style: none; /* IE / Edge */
  scrollbar-width: none;    /* Firefox */
}
.day-back .back-content::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* =========================
   Events (Front)
========================= */

.day-event {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  padding: 2px 4px;
  border-radius: 0;

  font-size: 14px;
  line-height: 1.40;

  overflow: hidden;

  cursor: pointer;
}

.day-event .event-time {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 12px;
}

.day-event .event-title {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  font-weight: 500;
  letter-spacing: 0.01em;
}

.event-time {
  font-size: 14px;
  opacity: 0.8;
  white-space: nowrap;
  font-weight: 400;
}
.event-title {
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* =========================
   Back Contents (Title/Datetime)
========================= */

.back-title {
  position: relative;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  padding: 4px 10px;
  padding-bottom: 8px;
}

/* タイトル下の線（途中で色変える） */
.back-title::after {
  content: "";
  display: block;
  width: 100%;
  max-width: 320px;
  height: 2px;
  margin-top: 6px;
  background: linear-gradient(
    to right,
    #B8193F 0%,
    #B8193F 30%,
    #e0e0e0 30%,
    #e0e0e0 100%
  );
}

.back-datetime {
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
}

/* =========================
   Back Blocks (場所/説明/URL)
========================= */

.back-block {
  margin-top: 14px;
}

.back-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-bar {
  width: 4px;
  height: 16px;
  background: #B8193F;
  flex-shrink: 0;
}

.back-block-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.back-block-body {
  margin-left: 12px;
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  color: #333;
}

.back-link-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
}

.back-link {
  color: #1a73e8;
  text-decoration: underline;
  font-size: 14px;
  line-height: 1.6;
  cursor: pointer;
  word-break: break-all;
}

.back-link:hover {
  opacity: 0.75;
}

/* =========================
   Type Colors
========================= */




/* =====================
   Day Detail
===================== */

.calendar-day-detail {
  border-top: 1px solid #ddd;
  padding-top: 32px;
}

.calendar-day-detail h2 {
  font-size: 26px;
  margin-bottom: 24px;
}

/* =====================
   Responsive
===================== */

@media (max-width: 768px) {
  .kashima-calendar {
    padding: 32px 0px 0px;
  }

  .calendar-hero {
    padding: 40px 0px 0px;
  }

  .calendar-hero h1 {
    font-size: 32px;
  }

  .calendar-highlight {
    grid-template-columns: 1fr;
  }

  .month-title {
    font-size: 26px;
  }

  .calendar-grid {
    grid-auto-rows: minmax(80px, auto);
  }

  .calendar-day {
    padding: 6px;
  }

  .calendar-day .day-number {
    font-size: 12px;
  }

  .calendar-day-detail h2 {
    font-size: 22px;
  }

  .kashima-calendar h2{
    font-size: 18px;

  }
}



.day-event {
  color: #111; 
}

.event-color-box {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--event-color);
  flex-shrink: 0;
}


.day-back::before {
  background: var(--event-color);
}


.back-bar {
  background: var(--event-color);
}


.back-title::after {
  background: linear-gradient(
    to right,
    var(--event-color) 30%,
    #e0e0e0 30%
  );
}



/* =========================
   Event title marquee（ホバーで全文表示）
========================= */

.day-event .event-title{
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden; 
  white-space: nowrap;
  text-overflow: clip; 
}

/* “動く中身” */
.day-event .event-title-text{
  display: inline-block;
  will-change: transform;
}


@keyframes eventTitlePingPong{
  /* すぐ動く */
  0%   { transform: translateX(0); }

  /* 右端まで行く */
  45%  { transform: translateX(calc(-1 * var(--marquee-distance))); }

  /* 右端で少し止まる */
  55%  { transform: translateX(calc(-1 * var(--marquee-distance))); }

  /* 戻る */
  100% { transform: translateX(0); }
}


.day-event .event-title-text{
  padding-right: 0; /* ここが 24px とかになってたら 0 に */
}

/* =====================
   Calendar: Mobile = 横スクロールで「日セルを広く」
   （7列は維持、1日ボックスを大きくして自由スクロール）
===================== */
@media (max-width: 768px) {

  :root { --cal-cell-w: 210px; }

  .calendar-month-header{
    max-width: 100%;
    margin: 0 auto 28px;
    padding: 0 16px;
  }
  .calendar-scroll{
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0px;
  }

  .calendar-month{
    margin-bottom: 0px;
  }

  .calendar-scroll .calendar-weekdays,
  .calendar-scroll .calendar-grid{
    width: calc(var(--cal-cell-w) * 7);
  }

  .calendar-weekdays{
    grid-template-columns: repeat(7, var(--cal-cell-w));
  }

  .calendar-grid{
    grid-template-columns: repeat(7, var(--cal-cell-w));
    grid-auto-rows: 220px; 
  }

  .calendar-day{
    height: 220px;        /* ← 中央寄せ */
    min-height: 220px;
    padding: 0;
  }
}


/* 例：タイトル内のテキストが横に流れる想定 */
.card-title .title-text {
  display: inline-block;
  white-space: nowrap;
}

/* PC：hover */
.card-title:hover .title-text {
  animation: marquee 6s linear infinite;
}

/* SP：1回目タップで付けるクラス */
.card-title.is-marquee .title-text {
  animation: marquee 6s linear infinite;
}

@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); } /* ここは実装に合わせて調整 */
}


@media (max-width: 768px){
  .calendar-hero{ position: sticky; top: var(--k0299-header-h); z-index:100; background:#fff; }
  .calendar-month-header{
    position: sticky;
    top: calc(var(--k0299-header-h) + var(--calendar-hero-h, 0px));
    z-index: 99;
    background:#fff;
  }
}


:root{
  --k0299-header-h: 84px;  
  --calendar-hero-h: 120px;
}

@media (max-width: 768px){

  .calendar-hero{
    position: sticky;
    top: var(--k0299-header-h);
    z-index: 100;
    background: #fff;
    padding: 26px 0 18px;          /* ← 中央寄せ */
  }

  .calendar-hero h1{
    margin: 0;
    line-height: 1.1;
  }

  .calendar-month-header{
    position: sticky;
    top: calc(var(--k0299-header-h) + var(--calendar-hero-h));
    z-index: 99;
    background: #fff;
    padding: 10px 0;
  }
}
