/* 案2「日めくり」（2026-10-17 ユーザー指示「この案２を test1 で実装」）
   config の ui_variant が 'himekuri' のサイト（test1）だけで読む。部品は app/templates/himekuri.php、動きは assets/js/himekuri.js。
   色は style.css の :root の値（テラコッタ・からし・空色・日曜の赤）をそのまま使う。角は 8px（枠）・6px（札）・4px（日めくり）まで */

:root { --hk-top: calc(var(--header-h) + 3px); } /* 帯を付ける高さ（ヘッダーの下）。himekuri.js がヘッダーの本当の高さに合わせる */

/* ---------- 日めくり（紙のカレンダーの1枚） ---------- */
.hk-card { --c: #5b4636; display: inline-flex; flex-direction: column; align-items: center; min-width: 104px; padding: 8px 18px 10px;
  background: var(--paper); border: 1px solid var(--line-strong); border-top: 10px solid var(--c); border-radius: 4px;
  box-shadow: 0 6px 18px rgba(110, 60, 30, .14); line-height: 1.2; font-size: .78rem; font-weight: 700; color: var(--text-soft); }
.hk-card.is-sat { --c: var(--c-sat); }
.hk-card.is-sun { --c: var(--c-sun); }
.hk-card b { margin: 2px 0; font-family: var(--serif); font-size: 3.6rem; line-height: 1; color: var(--c); }
.hk-card-w em { margin-left: 4px; font-style: normal; color: var(--c-forest); }
.hk-card-big { padding: 10px 28px 14px; font-size: .9rem; }
.hk-card-big b { font-size: 5rem; }

/* ---------- トップの見出し（水彩の壁を低くし、右に今日の日めくり） ---------- */
.hk .hero-wall { inset: -55% -12% -45%; gap: 18px; }
.hk .hero-inner { min-height: 270px; padding-top: 18px; padding-bottom: 54px; } /* 画面の幅いっぱいの見出し（2026-10-18 ユーザー指示「ヒーロー画像をしっかり長く」で 196px から） */
.hk .hero-title { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
.hk-hero-card { justify-self: end; align-self: center; animation: rise .9s var(--ease-out) .25s both; }

/* ---------- 日付の帯（14日分。ヘッダーの下に付いてくる） ---------- */
.hk-strip-wrap { position: sticky; top: var(--hk-top); z-index: 30; margin: 0 0 14px; }
.hk-strip-hero { margin-top: -40px; }
main.wrap .hk-strip-wrap > .wrap { max-width: none; padding: 0; } /* 本文が .wrap のページでは、二重に余白を取らない */
.hk-strip { display: flex; align-items: stretch; gap: 6px; padding: 10px 8px 8px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 6px 18px rgba(110, 60, 30, .10); }
.hk-days { flex: 1; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; min-width: 0; margin: 0; padding: 0; list-style: none; }
.hk-day { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 0 5px; border-radius: 6px; line-height: 1.15; color: var(--ink); text-decoration: none; transition: background .2s; }
.hk-day:hover { background: var(--hover-bg); color: var(--ink); }
.hk-day small { font-size: .7rem; font-weight: 700; color: var(--text-dim); }
.hk-day b { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; }
.hk-day i { font-style: normal; font-size: .68rem; font-weight: 800; color: var(--c-forest); }
.hk-day em { position: absolute; top: -9px; padding: 0 5px; border-radius: 3px; background: var(--c-forest); color: #fff; font-style: normal; font-size: .62rem; font-weight: 800; line-height: 1.5; }
.hk-day.is-sat b, .hk-day.is-sat small { color: var(--c-sat); }
.hk-day.is-sun b, .hk-day.is-sun small { color: var(--c-sun); }
.hk-day.is-zero b { opacity: .4; }
.hk-day.is-zero i { color: var(--text-dim); opacity: .7; }
.hk-day.is-on { background: var(--on-bg); box-shadow: inset 0 0 0 2px var(--on-line); }
.hk-all { flex: none; display: grid; place-items: center; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--text-soft); font-size: .84rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.hk-all:hover { background: var(--hover-bg); color: var(--ink); }
.hk-all.is-on { background: var(--on-bg); color: var(--on-text); border-color: var(--on-line); }
.hk-month { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 6px 0 12px; border-left: 1px solid var(--line); color: var(--c-forest); font-size: .76rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.hk-month .ico { width: 20px; height: 20px; }
.hk-month:hover { color: var(--c-forest-dark); }

/* ---------- 帯の下（お知らせ・さがし方） ---------- */
/* 日付の帯をトップから外したので、さがし方の帯が見出しの下端にかぶさる（ふつうの見た目と同じ。2026-10-18） */
.hk-notice { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; padding: 8px 12px; border-radius: 6px; background: var(--tint-rice); color: var(--on-text); font-size: .9rem; font-weight: 700; line-height: 1.7; }
.hk-notice .ico { flex: none; width: 18px; height: 18px; margin-top: 3px; }
.hk-notice a { flex: none; display: inline-flex; align-items: center; gap: 2px; margin-left: auto; color: var(--c-forest); font-weight: 800; text-decoration: none; white-space: nowrap; }
.hk-notice a .ico { width: 15px; height: 15px; margin: 0; }
.hk-board { padding-top: 22px; }

/* ---------- 同じ日の「庄原市の外」の区切り ---------- */
.hk-zone { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 2px 0; font-size: .78rem; font-weight: 800; color: var(--text-dim); list-style: none; }
.hk-zone::after { content: ""; flex: 1; border-top: 1.5px dashed var(--line-strong); }
.ev-rows .hk-zone { padding: 6px 0 2px; }

/* ---------- 右の欄（トップ: カレンダー・会期中の催し・申込の締切が近い／詳細: この日のほかのイベント） ---------- */
.hk-side-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 8px; padding-left: 8px; border-left: 3px solid var(--c-rice); font-family: var(--sans); font-size: .98rem; font-weight: 900; line-height: 1.4; }
.hk-side-h small { font-size: .74rem; font-weight: 700; color: var(--text-dim); }
.hk-side-sec + .hk-side-sec { margin-top: 22px; }
.hk-side .ev-rows { margin: 0; }
.hk-cal { padding: 10px 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.hk-cal-ym { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 6px; }
.hk-cal-ym b { font-size: 1rem; font-weight: 900; }
.hk-cal-ym a { display: inline-flex; align-items: center; gap: 2px; color: var(--c-forest); font-size: .78rem; font-weight: 800; text-decoration: none; }
.hk-cal-ym a .ico { width: 14px; height: 14px; }
@media (min-width: 1000px) {
  .hk-side { position: sticky; top: calc(var(--hk-top) + 104px); max-height: calc(100vh - var(--hk-top) - 120px); overflow-y: auto; padding: 0 6px 8px 0; scrollbar-width: thin; }
}
@media (max-width: 999px) {
  .hk-side { margin-top: 10px; padding-top: 22px; border-top: 1.5px dashed var(--line-strong); }
}

/* ---------- 一覧の見出しの「10/18（日）だけ ×」 ---------- */
.hk-date-chip { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; padding: 2px 10px; border-radius: 6px; background: var(--on-bg); color: var(--on-text); font-family: var(--sans); font-size: .8rem; font-weight: 800; text-decoration: none; vertical-align: middle; white-space: nowrap; }
a.hk-date-chip:hover { background: var(--c-rice); color: var(--ink); }
.hk-date-chip .ico { width: 14px; height: 14px; }
.hk-date-chip.is-all { background: var(--paper-2); color: var(--text-soft); border: 1px solid var(--line-strong); }

/* ---------- 日付でさがす: 3か月のカレンダーは左の列（2026-10-18 ユーザー指示「月が本文に出てかえって分かりにくい。左のサイドバーに」）
   広い画面は style.css の左の列のまま、日付の帯の下に付いてくる（背が足りないときは列の中だけスクロール）。
   カレンダーがいつも見えているので、帯の「月で見る」は出さない。左の列が取れない狭い画面（999px 以下）は一覧の下（帯の「月で見る」から） ---------- */
.hk .date-side { scroll-margin-top: calc(var(--hk-top) + 100px); }
@media (min-width: 1000px) {
  .hk .date-side { position: sticky; top: calc(var(--hk-top) + 104px); max-height: calc(100vh - var(--hk-top) - 120px); overflow-y: auto; padding-bottom: 4px; scrollbar-width: thin; }
  .hk:has(.date-side) .hk-month { display: none; }
}
@media (max-width: 999px) { .hk .date-side { order: 2; } }

/* ---------- イベント詳細: 見出しの左に日めくり・右に「この日のほかのイベント」 ---------- */
.hk .event-head { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 26px; }
.hk .event-head > * { grid-column: 2; }
.hk .event-head > .hk-ev-card { grid-column: 1; grid-row: 1 / span 8; align-self: start; }
.hk .event-head .hud-label { display: none; }
.hk-others { margin-top: 22px; padding: 14px 14px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.hk-others .ev-rows { margin: 0; }
.hk-others-empty { margin: 4px 0; color: var(--text-dim); font-size: .88rem; }
.hk-daynav { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .84rem; font-weight: 800; }
.hk-daynav a { display: inline-flex; align-items: center; gap: 4px; color: var(--c-forest); text-decoration: none; }
.hk-daynav a:hover { text-decoration: underline; }
.hk-daynav .ico { width: 15px; height: 15px; }
/* 「この日のほかのイベント」は右のサイドバーの「イベントを載せる」の下（2026-10-20 ユーザー指示「青の場所に移しましょう」）。
   以前は本文の右に自前の 300px の列を作っていたので、1400px 以上では右のサイドバーとの間で右の欄が二重になっていた */
@media (min-width: 1400px) {
  /* 右のサイドバーは幅が狭いので、1行の一覧は「申込の締切が近い」と同じように詰める */
  .site-rail-right .hk-others { margin-top: 18px; padding: 12px 10px 8px; }
  .site-rail-right .hk-others .ev-row > a { grid-template-columns: 3.4em minmax(0, 1fr) 36px; gap: 8px; padding: 8px 6px 8px 8px; }
  .site-rail-right .hk-others .ev-row-lead b { font-size: .92rem; }
  .site-rail-right .hk-others .ev-row-title { font-size: .9rem; }
  .site-rail-right .hk-others .ev-row-thumb { width: 36px; height: 48px; }
  .site-rail-right .hk-others .ev-row .badges { display: none; } /* 狭い欄なので、無料などの札は詳細で */
}
@media (max-width: 1399px) {
  /* 右のサイドバーが出ない幅では、この欄だけを本文の下に出す（ほかの部品は広い画面だけのもの） */
  .site-rail-right:has(> .rail-inner > .hk-others) { display: block; padding: 0 var(--gutter) 10px; }
  .site-rail-right:has(> .rail-inner > .hk-others) > .rail-inner > :not(.hk-others) { display: none; }
  .site-rail-right .hk-others { margin-top: 0; }
}
@media (min-width: 1200px) and (max-width: 1399px) {
  /* 左のサイドメニューがある幅では、本文と同じ列に入れる（左の列の下に回り込ませない） */
  .site-body > .site-rail-right:has(.hk-others) { grid-column: 2; }
}

/* ---------- フッターの紹介チラシ ---------- */
.hk-footer-flyer { display: inline-flex; flex-direction: column; gap: 6px; width: 170px; margin: 0 0 18px; color: var(--text-soft); font-size: .8rem; font-weight: 800; text-decoration: none; }
.hk-footer-flyer img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: var(--soft-shadow); }
.hk-footer-flyer span { display: inline-flex; align-items: center; gap: 4px; }
.hk-footer-flyer .ico { width: 15px; height: 15px; }

/* ---------- スマホ ---------- */
@media (max-width: 760px) {
  .hk .hero-inner { min-height: 0; padding-top: 12px; padding-bottom: 16px; }
  .hk .hero-lead { display: none; } /* 最初の画面にイベントを入れるため、見出しは題名だけ */
  .hk-hero-card { display: none; } /* 帯の「今日」で足りる。最初の画面にイベントを入れる */
  .hk-strip-hero { margin-top: 0; }
  .hk-strip-wrap > .wrap { padding: 0; }
  .hk-strip { gap: 4px; padding: 10px 6px 6px; border-radius: 0; border-width: 1px 0; overflow-x: auto; scrollbar-width: none; }
  .hk-strip::-webkit-scrollbar { display: none; }
  .hk-days { flex: 0 0 auto; display: flex; gap: 4px; } /* 中身の幅のまま横にスクロール（「月で見る」に重ねない） */
  .hk-day { flex: none; width: 46px; }
  .hk-day b { font-size: 1.2rem; }
  .hk-all { padding: 0 8px; font-size: .76rem; }
  .hk-month { padding: 0 4px 0 8px; }
  main.wrap .hk-strip-wrap { margin-inline: calc(-1 * var(--gutter, 16px)); }
  .hk .event-head { column-gap: 14px; }
  .hk-ev-card .hk-card { min-width: 72px; padding: 4px 10px 8px; border-top-width: 8px; font-size: .68rem; }
  .hk-ev-card .hk-card b { font-size: 2.3rem; }
  .hk-ev-card .hk-card-ym { display: none; }
}
@media (prefers-reduced-motion: reduce) { .hk-hero-card { animation: none; } }

/* ---------- 一覧と連動する2か月分の帯（トップ・日付でさがす。2026-10-17 ユーザー指示） ----------
   帯そのもの（.hk-days）が横にスクロールする。マウスはドラッグ（himekuri.js）、指はスワイプ、‹ › で1週間ずつ。
   いま一覧で見ている日は、テラコッタの枠（.is-current）。月の変わり目の日に「11月」の札 */
.hk-strip.is-long { padding-top: 0; }
.hk-strip.is-long .hk-days { display: flex; gap: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; cursor: grab;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.hk-strip.is-long .hk-days::-webkit-scrollbar { display: none; }
.hk-strip.is-long .hk-days > li { flex: none; width: 58px; padding: 10px 0 8px; }
.hk-strip.is-long .hk-days.is-dragging { cursor: grabbing; user-select: none; }
.hk-strip.is-long .hk-days.is-dragging .hk-day { pointer-events: none; }
.hk-day.is-current { box-shadow: inset 0 0 0 2px var(--c-forest); }
.hk-day.is-current.is-on { box-shadow: inset 0 0 0 2px var(--c-forest), inset 0 0 0 4px var(--on-line); }
.hk-day em.is-month { background: #5b4636; }
.hk-nav { flex: none; display: grid; place-items: center; width: 30px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--c-forest); cursor: pointer; }
.hk-nav:hover { background: var(--hover-bg); }
.hk-nav .ico { width: 18px; height: 18px; }
html:not(.js) .hk-nav { display: none; }
@media (max-width: 760px) {
  .hk-strip.is-long { overflow: visible; }
  .hk-strip.is-long .hk-days { flex: 1 1 auto; min-width: 0; }
  .hk-strip.is-long .hk-days > li { width: 46px; }
  .hk-nav { display: none; } /* スマホは指で横にすべらせる */
}

/* トップの会期中の催し（日付の一覧の上。2026-10-18 ユーザー指示「会期の長い情報も一緒に見られるページに」） */
.hk-long { margin: 0 0 22px; padding: 12px 16px 6px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--paper); }
.hk-long-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; font-family: var(--serif); font-size: 1.1rem; }
.hk-long-h small { font-family: var(--sans); font-size: .8rem; font-weight: 700; color: var(--text-soft); }

/* トップ = 日付でさがすの表示（2026-10-18 ユーザー指示「この表示をメインページで」。datebrowser.php） */
.hk-top-dates { padding-top: 22px; padding-bottom: 8px; }

/* トップの日付の帯（2026-10-18 ユーザー指示「日めくり部分を緑の枠の長さまで伸ばし、すべての日のボタンは不要、下へスクロールしても付いてこないように」）:
   render_header() の body_top で .site-body の上の段に出し、広い画面ではメインと右のサイドバーにまたがる幅。付いてこない（sticky にしない） */
/* 同日「やはり縦スクロールと一緒に日めくりカレンダー部分もおりてきて」で、帯の入れ物（.site-body-top）ごと付いてくるように戻した。
   右のサイドバーと日付の見出しは、帯の高さ（--hk-strip-h。himekuri.js が測る）の分だけ下で止まる */
.hk-strip-wrap.hk-strip-top { position: static; margin: 0; }
.site-body.has-top > .site-body-top { --bt-pad: 14px; position: sticky; top: calc(var(--hk-top) - var(--bt-pad)); z-index: 30; padding-top: var(--bt-pad); }
.site-body.has-top .day-head { top: calc(var(--hk-top) + var(--hk-strip-h, 90px)); }
.hk-top-dates { padding-top: 16px; }
@media (min-width: 1200px) {
  .home-tabs-top { display: none; }
  .site-body.has-top > .site-rail { grid-row: 1 / span 2; }
  .site-body.has-top > .site-body-top { --bt-pad: 22px; grid-column: 2 / -1; grid-row: 1; min-width: 0; }
  .site-body.has-top > main { grid-column: 2; grid-row: 2; }
  .site-body.has-top > .site-rail-right { grid-column: 3; grid-row: 2; }
  .site-body.has-top .hk-strip-top { margin: 0; }
  .site-body.has-top .hk-strip-top > .wrap { max-width: none; padding: 0 18px 0 var(--gutter); }
}
@media (min-width: 1400px) {
  .site-body.has-top > .site-rail-right { top: calc(var(--hk-top) + var(--hk-strip-h, 90px)); max-height: calc(100vh - var(--hk-top) - var(--hk-strip-h, 90px)); }
}
/* 近隣だけの日（その町は0件。近隣は小さく「近隣+数」。2026-10-23） */
.hk-day i .near-plus { margin-left: 1px; font-size: .9em; }
.hk-day.is-near-only b { opacity: .7; }
.hk-day.is-near-only i { font-size: .62rem; }
