/* 公開カレンダー：整理版（元CSSの最終的な適用結果を維持） */
:root {
    font-family: system-ui, 'Noto Sans JP', sans-serif;
    color: #332b26;
    background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }

/* ページ全体・上下の画像 */
.public-wrap { max-width: 1120px; margin: auto; padding: 12px; }
.calendar-art { width: 100%; overflow: hidden; }
.calendar-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.calendar-header { aspect-ratio: 1600 / 350; }
.calendar-footer { aspect-ratio: 1600 / 350; }
.default-art {
    width: 100%; height: 100%; display: flex;
    align-items: center; justify-content: space-between;
    padding: 3% 6%; background: #fbf7e9; color: #5c4032;
}
.calendar-header .default-art { background: linear-gradient(110deg, #fbf7e9, #f1e6d5); }
.brand { font-size: clamp(18px, 3.5vw, 42px); font-weight: 700; }
.brand small { display: block; font-size: .35em; font-weight: 400; letter-spacing: .2em; }
.calendar-header strong { font-size: clamp(18px, 3.3vw, 42px); }
.footer-note { font-size: clamp(12px, 2vw, 24px); }
.month-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 2px; font-size: 17px;
}
.month-nav a { color: #6c4c3a; text-decoration: none; padding: 8px; }
.empty { text-align: center; padding: 50px 0; }

/* 曜日・日付・罫線・レイアウトは共通CSSで管理。 */

/* 2026-11-11: 旧イラストの視認性を目標に、公開用本文の基準を20%拡大。
   スタッフ用・曜日・日付は変更しない。収まる短文はこの基準を維持し、
   長い項目だけcalendar.jsが個別に調整する。基準幅900pxでの値。 */
.calendar.public-calendar {
  --sara-event-title-font-size: 20.4px; /* イベント名：17px × 1.2 */
  --sara-event-use-type-font-size: 20.4px; /* 貸切などの区分 */
  --sara-event-time-font-size: 19.8px; /* 2026-11-11: 時間の基準を18pxからさらに10%拡大 */
  --sara-event-extra-font-size: 17.16px; /* 2026-11-11: 講師・出演者・補足を15.6pxからさらに10%拡大 */
}

.calendar.public-calendar .event.is-short-rental {
  --sara-event-title-font-size: 16.32px;
  --sara-event-use-type-font-size: 16.32px;
  --sara-event-time-font-size: 15.84px;
  --sara-event-extra-font-size: 13.728px;
}

.calendar.public-calendar .event.is-short-rental .event-title {
  font-size: var(--sara-event-title-font-size);
}

/* イベント枠と内容 */
.calendar .event {
    display: block; position: relative; min-width: 0;
    padding: clamp(1px, .15vw, 2px) clamp(0px, .25vw, 3px);
    margin: clamp(0px, .1vw, 1px) 0;
    gap: 2px; align-items: flex-start;
    background: #f4f1eb; border-radius: 4px;
    text-align: center;
}
.calendar .event-content {
    display: block; width: 100%; min-width: 0;
    text-align: center;
}
.calendar .event-content::after { content: none; display: none; }
.calendar .event-title {
    display: block; flex: 1; min-width: 0;
    font-size: clamp(10px, 1.5vw, 20px);
    font-weight: 700; line-height: 1.15;
    margin: 0; padding: 0;
    overflow-wrap: normal;
    white-space: nowrap;
    word-break: keep-all;
    text-align: center;
    transform-origin: center center;
}
/* 自動調整の限界を超える長いタイトルだけ2行にする */
.calendar.public-calendar .event-title.title-two-lines {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    transform: none !important;
}
.calendar .event-use-type {
    display: block;
    font-size: clamp(10px, 1.5vw, 20px);
    font-weight: 700; line-height: 1.15;
    margin-top: clamp(0px, .08vw, 1px);
    text-align: center;
}
.calendar .event-time,
.calendar .event-extra {
    display: block;
    font-size: clamp(10px, 1.35vw, 18px);
    font-weight: 600; line-height: 1.25;
    margin-top: clamp(0px, .08vw, 1px);
    overflow-wrap: anywhere;
    white-space: pre-line;
    text-align: center;
}
.calendar .event-title + .event-time,
.calendar .event-title + .event-extra {
    margin-top: clamp(2px, 0.25vw, 4px);
}

/* イベント詳細への矢印（文字の折り返しには影響しない） */
.calendar .detail-arrow {
    position: absolute; top: 2px; right: 2px; z-index: 2;
    display: block; float: none;
    margin: 0; padding: 0 2px;
    color: #584739; font-size: 21px; line-height: 1;
    text-decoration: none; text-align: center;
}
.event-page { max-width: 760px; margin: 30px auto; padding: 20px; }
.event-page a { color: #654937; }

/* 狭い画面：最終指定で上書きされていなかった値のみ */
@media (max-width: 600px) {
    .public-wrap { padding: 4px; }
    .month-nav { font-size: 14px; }
    .calendar .detail-arrow { font-size: 17px; }
}

/* 印刷 */
@media print {
    @page { size: A4 landscape; margin: 5mm; }
    body { background: white; }
    .public-wrap { max-width: none; padding: 0; }
    .month-nav { display: none; }
    .calendar-header { max-height: 34mm; }
    .calendar-footer { max-height: 23mm; }
    .calendar .detail-arrow { display: none; }
}

/* 月ナビはカレンダー一体部分の外側 */
.calendar-sheet { width:100%; transform-origin:top center; }
.calendar-sheet .calendar-art { margin:0; }
/* A5縦：左右3mm、上下5mm */
@media print {
  @page { size:A5 portrait; margin:5mm 3mm; }
  .calendar-header,.calendar-footer { max-height:none; }
  .calendar-sheet { break-inside:avoid; }
}

/* ============================================================
   公開用：手書き風のイベント背景・配置
   スタッフ用には読み込まれません。
   ============================================================ */
/* 手塗り背景：5種類の不規則な輪郭をイベントごとに使い分ける。
   文字の位置・サイズは変更しない。 */
.calendar.public-calendar .event[class*="event-color-"] {
    position: relative;
    isolation: isolate;
    background-color: transparent;
    background-image: none;
    --paint-color: var(--event-color, #F7F5F0);
}

.calendar.public-calendar .event[class*="event-color-"]::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: var(--paint-color);
    background-image:
      radial-gradient(ellipse 60% 55% at 19% 26%, rgba(255,255,255,.18), transparent 90%),
      radial-gradient(ellipse 50% 65% at 76% 83%, rgba(255,255,255,.04), transparent 92%),
      repeating-linear-gradient(177deg, transparent 0 6px, rgba(255,255,255,.07) 7px 8px, transparent 9px 15px);
    clip-path: polygon(0% 8%, 12% 0.5%, 27% 2.5%, 42% 0%, 57% 2%, 72% 0.5%, 88% 2.5%, 100% 0%, 99% 23%, 100% 48%, 98.5% 73%, 100% 96%, 83% 100%, 66% 97.5%, 50% 100%, 31% 98%, 14% 100%, 0% 94%, 1% 70%, 0% 47%, 1% 24%);
}
/* 同じ日のイベント順と日付位置を組み合わせ、単調な繰り返しを防ぐ */
.calendar.public-calendar .day:nth-child(5n+2) .event:nth-of-type(2n)::before,
.calendar.public-calendar .day:nth-child(5n+3) .event:nth-of-type(2n+1)::before {
    clip-path: polygon(0% 0%, 18% 2%, 35% 0%, 53% 3%, 69% 0.5%, 84% 2.5%, 100% 3%, 99% 32%, 100% 64%, 96% 100%, 79% 97.5%, 59% 100%, 41% 98%, 22% 100%, 0% 97%, 1.5% 72%, 0% 39%);
    background-position: 13px 2px, -8px 0, 0 0;
}
.calendar.public-calendar .day:nth-child(5n+4) .event:nth-of-type(2n+1)::before,
.calendar.public-calendar .day:nth-child(5n+5) .event:nth-of-type(2n)::before {
    clip-path: polygon(0% 6%, 16% 0%, 30% 3%, 46% 0.5%, 61% 2.5%, 79% 0%, 100% 7%, 98.5% 30%, 100% 57%, 99.5% 93%, 86% 100%, 68% 97%, 54% 100%, 38% 97.5%, 19% 100%, 0.5% 94%, 0% 68%, 1.5% 43%);
    background-position: -11px 0, 6px 3px, 0 0;
}
.calendar.public-calendar .day:nth-child(5n+1) .event:nth-of-type(2n)::before {
    clip-path: polygon(1% 0%, 22% 2.5%, 40% 0.5%, 58% 2%, 76% 0%, 99.5% 6%, 100% 37%, 98.5% 66%, 100% 100%, 80% 98%, 63% 100%, 44% 97.5%, 25% 100%, 0% 95%, 1% 62%, 0% 28%);
    background-position: 8px -5px, 0 8px, 0 0;
}
.calendar.public-calendar .day:nth-child(5n+2) .event:nth-of-type(2n+1)::before,
.calendar.public-calendar .day:nth-child(5n+5) .event:nth-of-type(2n+1)::before {
    clip-path: polygon(0% 4%, 14% 0%, 33% 2%, 49% 0%, 70% 2.5%, 87% 0.5%, 100% 4%, 99% 28%, 100% 54%, 98.5% 83%, 99.5% 98%, 75% 100%, 55% 98%, 34% 100%, 16% 97.5%, 0% 100%, 1.5% 75%, 0% 49%, 1% 22%);
    background-position: -4px 7px, 10px -2px, 0 0;
}
@media print {
    .calendar.public-calendar .event[class*="event-color-"]::before {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* 2026-11-11: 付箋1枚として背景・文字・リンクを一体で移動・回転。
   傾き・位置ずれは従来の50%。輪郭も矩形からの凹凸量を50%に縮小。
   最大：傾き±0.95度、横±1.5px、縦±1px。スマホの移動量はさらに半分。
   個々の文字のscaleXは文字幅調整のみ。背景と文字に別々の位置ずれは付けない。 */
.calendar.public-calendar .event[class*="event-color-"] {
    --paint-x: 0;
    --paint-y: 0;
    --paint-tilt: 0deg;
    transform: translate(var(--paint-x), var(--paint-y)) rotate(var(--paint-tilt));
    transform-origin: 50% 50%;
}
/* 日付とイベント順で15種類の配置を使い分ける */
.calendar.public-calendar .day:nth-child(9n+1) .event:nth-of-type(3n+1) { --paint-x: 1px; --paint-y: -0.5px; --paint-tilt: 0.8deg; }
.calendar.public-calendar .day:nth-child(9n+2) .event:nth-of-type(3n+1) { --paint-x: -1px; --paint-y: 0.5px; --paint-tilt: -0.9deg; }
.calendar.public-calendar .day:nth-child(9n+3) .event:nth-of-type(3n+1) { --paint-x: 0.5px; --paint-y: 1px; --paint-tilt: -0.45deg; }
.calendar.public-calendar .day:nth-child(9n+4) .event:nth-of-type(3n+1) { --paint-x: -1.5px; --paint-y: -0.5px; --paint-tilt: 0.6deg; }
.calendar.public-calendar .day:nth-child(9n+5) .event:nth-of-type(3n+1) { --paint-x: 1.5px; --paint-y: 0.5px; --paint-tilt: -0.7deg; }
.calendar.public-calendar .day:nth-child(9n+6) .event:nth-of-type(3n+1) { --paint-x: -0.5px; --paint-y: -1px; --paint-tilt: 0.95deg; }
.calendar.public-calendar .day:nth-child(9n+7) .event:nth-of-type(3n+1) { --paint-x: 1px; --paint-y: 1px; --paint-tilt: -0.55deg; }
.calendar.public-calendar .day:nth-child(9n+8) .event:nth-of-type(3n+1) { --paint-x: -1px; --paint-y: 0px; --paint-tilt: 0.35deg; }
.calendar.public-calendar .day:nth-child(9n) .event:nth-of-type(3n+1) { --paint-x: 0.5px; --paint-y: -1px; --paint-tilt: -0.95deg; }
.calendar.public-calendar .day:nth-child(3n+1) .event:nth-of-type(3n+2) { --paint-x: -0.5px; --paint-y: 1px; --paint-tilt: 0.75deg; }
.calendar.public-calendar .day:nth-child(3n+2) .event:nth-of-type(3n+2) { --paint-x: 1.5px; --paint-y: -0.5px; --paint-tilt: -0.85deg; }
.calendar.public-calendar .day:nth-child(3n) .event:nth-of-type(3n+2) { --paint-x: -1.5px; --paint-y: 0.5px; --paint-tilt: 0.4deg; }
.calendar.public-calendar .day:nth-child(3n+1) .event:nth-of-type(3n) { --paint-x: 1px; --paint-y: 0px; --paint-tilt: -0.8deg; }
.calendar.public-calendar .day:nth-child(3n+2) .event:nth-of-type(3n) { --paint-x: -1px; --paint-y: -1px; --paint-tilt: 0.55deg; }
.calendar.public-calendar .day:nth-child(3n) .event:nth-of-type(3n) { --paint-x: 0.5px; --paint-y: 0.5px; --paint-tilt: -0.3deg; }
/* 狭い画面ではイベント枠全体の移動量を半分にする */
@media (max-width: 600px) {
  .calendar.public-calendar .event[class*="event-color-"] {
    transform: translate(calc(var(--paint-x) * .5), calc(var(--paint-y) * .5)) rotate(var(--paint-tilt));
  }
}


/* 2026-11-10: フッターは配布用印刷のみ。管理者の画像編集時は設定用に表示。 */
.calendar-footer{display:none}
body.calendar-art-editing .calendar-footer,
body.sara-print-preview .calendar-footer{display:block}
@media print{.calendar-footer{display:block}}

/* 2026-11-11: 公開用の各表示項目をそれぞれの基準サイズから個別調整。
   CSSは1行を基本とし、共通JSが下限でも収まらない項目だけ折り返す。
   設定値はcommon/calendar/calendar.jsのtitleFit。日付・曜日は対象外。 */
.calendar.public-calendar .event-title,
.calendar.public-calendar .event-time,
.calendar.public-calendar .event-use-type,
.calendar.public-calendar .event-extra {
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
  transform-origin: center center;
}
.calendar.public-calendar .event-title.title-two-lines,
.calendar.public-calendar .event-time.title-two-lines,
.calendar.public-calendar .event-use-type.title-two-lines,
.calendar.public-calendar .event-extra.title-two-lines {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  transform: none !important;
}

/* 2026-11-11: 公開カレンダーの文字領域をセル端近くまで広げる。
   左右各1px。文字幅調整の追加余裕はcalendar.jsのpublicWidthMargin（合計1px）。
   縦余白、基準文字サイズ、背景の傾きは維持する。 */
.calendar.public-calendar .day { padding-left: 1px; padding-right: 1px; }
.calendar.public-calendar .event { padding-left: 1px; padding-right: 1px; }

/* 2026-11-11: 公開用イベント内をコンパクトに。文字サイズは維持。
   line-heightは文字サイズに対する行高。項目間は1px、先頭項目は0。
   スタッフ用・日付・曜日の行間は変更しない。 */
.calendar.public-calendar.calendar-proportional .event-title,
.calendar.public-calendar.calendar-proportional .event-use-type,
.calendar.public-calendar.calendar-proportional .event-time,
.calendar.public-calendar.calendar-proportional .event-extra {
  line-height: 1.08;
  margin-top: 1px;
}
.calendar.public-calendar.calendar-proportional .event-content > :first-child { margin-top: 0; }

/* 2026-11-11: 横圧縮する文字自体を中央配置。行の箱は圧縮しない。
   貸切専用の .calendar .event.is-rental .event-title / .event-use-type より
   同等の詳細度を持ち、後から読み込まれるこの指定を優先する。
   .eventを省くと貸切だけdisplay:blockへ戻り、長文が片側へ偏る。
   非折返しの長文も中央基準とし、紙の片側だけへのはみ出しを防ぐ。 */
.calendar.public-calendar .event .event-title,
.calendar.public-calendar .event .event-time,
.calendar.public-calendar .event .event-use-type,
.calendar.public-calendar .event .event-extra {
  display: flex;
  justify-content: center;
}
.calendar .calendar-fit-text {
  display: inline-block;
  flex: 0 0 auto;
  min-width: 0;
  white-space: inherit;
  transform-origin: center center;
}
.calendar.public-calendar .title-two-lines > .calendar-fit-text {
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}


/* 公開用フッター：広告4枠＋全月共通の店舗情報。編集と印刷のみ。 */
.calendar-footer { aspect-ratio:auto; }
.calendar-ad-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; }
.calendar-ad { aspect-ratio:1; min-width:0; overflow:hidden; }
.calendar-store { aspect-ratio:1600 / 200; overflow:hidden; }
.calendar-footer img { width:100%; height:100%; object-fit:contain; }
.art-placeholder { width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:#f6f0e7;border:1px solid #d4c4b4;font:14px sans-serif; }

/* チラシリンク：イベント名だけ青字・下線。時刻・補足は通常色。 */
.calendar.public-calendar a.event.has-flyer,
.calendar.public-calendar a.event.has-flyer:visited {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.calendar.public-calendar a.event.has-flyer .event-title {
  color: #0000ee;
  text-decoration: underline;
}
.calendar.public-calendar .event:hover { filter: none; }
.calendar.public-calendar a.event.has-flyer:focus-visible {
  outline: 2px solid #0000ee;
  outline-offset: 2px;
}
.sara-print-preview .calendar.public-calendar a.event.has-flyer,
.sara-print-preview .calendar.public-calendar a.event.has-flyer .event-title {
  color: inherit !important;
  text-decoration: none !important;
}
@media print {
  .calendar.public-calendar a.event.has-flyer,
  .calendar.public-calendar a.event.has-flyer .event-title {
    color: inherit !important;
    text-decoration: none !important;
  }
}
