/* =========================================================
   Yamagata1 Portal  第4版の追加分
   （会話画面・Language ボタン・空から見る山形・関連サイトのバナー）
   ========================================================= */

:root {
  --sky: #0F2638;
  --sky-2: #17384F;
  --sky-line: #2A4C66;
  --sky-text: #CFE0EC;
  --sky-accent: #7FD0E8;
}

/* ---------- Language ボタン ---------- */
.lang-switch { position: relative; }
.lang-switch__btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  border: 1px solid #8A90A0; border-radius: 6px; color: #fff; text-decoration: none; font-size: 14px; cursor: pointer;
}
.utility .lang-switch__btn { padding: 0 12px; }
.lang-switch__btn:hover { color: #fff; border-color: #fff; }
.lang-switch__btn[aria-expanded="true"] { background: #fff; color: var(--ink); }
.lang-switch__menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 230px; margin: 0; padding: 6px;
  list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.18);
}
.lang-switch__menu[hidden] { display: none; }
.lang-switch__menu a { display: block; padding: 10px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 15px; }
.utility .lang-switch__menu a { color: var(--ink); padding: 10px 12px; }
.lang-switch__menu a:hover, .lang-switch__menu a:focus { background: var(--ground); color: var(--indigo); }
.lang-switch__note { padding: 6px 12px 8px; font-size: 12px; line-height: 1.5; color: var(--ink-mute); border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.lang-switch--sp { display: none; }

/* ---------- 会話画面（共通） ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat__log { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.chat__msg { max-width: 92%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.75; overflow-wrap: anywhere; }
.chat__msg--ai { align-self: flex-start; background: #F3F0E9; color: var(--ink); border-radius: 4px 14px 14px 14px; }
.chat__msg--user { align-self: flex-end; background: var(--indigo); color: #fff; border-radius: 14px 14px 4px 14px; }
.chat__msg.is-waiting { color: var(--ink-mute); animation: y1-pulse 1.4s ease-in-out infinite; }
.chat__msg.is-error { background: #FBEAE6; color: #8A2A1B; }
@keyframes y1-pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .chat__msg.is-waiting { animation: none; } .chat__log { scroll-behavior: auto; } }
.chat__text p { margin: 0 0 .6em; }
.chat__text p:last-child { margin-bottom: 0; }
.chat__text a.cite { font-size: 12px; font-weight: 700; text-decoration: none; margin: 0 1px; vertical-align: super; }
.chat__src-label { margin: 10px 0 6px; font-size: 12px; font-weight: 700; color: var(--ink-mute); }
.chat__sources { display: grid; gap: 6px; }
.chat__source { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; color: var(--ink); }
.chat__source:hover { border-color: var(--indigo); color: var(--ink); }
.chat__thumb { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 6px; overflow: hidden; background: #E7E1D5; display: flex; align-items: center; justify-content: center; color: var(--ink-mute); }
.chat__thumb img { width: 100%; height: 100%; object-fit: cover; }
.chat__source-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.chat__source-body small { font-size: 11px; color: var(--accent); font-weight: 700; }
.chat__source-body strong { font-size: 14px; }
.chat__source-body span { font-size: 12px; color: var(--ink-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: 12px; }
.chat__rate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ink-sub); }
.chat__rate button { min-height: 30px; padding: 0 10px; border: 1px solid #C9C1B2; border-radius: 6px; background: #fff; font-size: 12px; cursor: pointer; }
.chat__rate button:hover { border-color: var(--indigo); }
.chat__more { font-weight: 700; }
.chat__chips { flex-wrap: wrap; }
.chat.is-talking .chat__chips { display: none; }
.chat__form { flex-wrap: nowrap; }
.chat__form input { flex: 1 1 auto; }
.chat__form button { flex: 0 0 auto; }
.chat__mic { min-height: 54px; width: 48px; padding: 0 !important; border: 1px solid #C9C1B2 !important; border-radius: 10px; background: #fff !important; color: var(--ink) !important; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat__mic.is-on { color: var(--accent) !important; border-color: var(--accent) !important; }
.chat__tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; font-size: 13px; color: var(--ink-sub); }
.chat__lang { min-height: 34px; padding: 0 8px; border: 1px solid #C9C1B2; border-radius: 6px; background: #fff; font-size: 13px; }
.chat__lang-label { font-size: 13px; }

/* トップの写真の上の会話 */
.chat--hero .chat__log { max-height: 300px; }
.chat--hero:not(.is-talking) .chat__log { max-height: none; }
.chat--hero .chat__msg { font-size: 15px; }

/* ---------- 右下の「AIに聞く」と会話パネル ---------- */
.y1-launcher {
  position: fixed; right: 24px; bottom: 24px; z-index: 40; display: inline-flex; align-items: center; gap: 12px;
  min-height: 68px; padding: 8px 26px 8px 10px; border-radius: 999px; background: var(--accent); color: #fff;
  text-decoration: none; box-shadow: 0 10px 28px rgba(0,0,0,.28), 0 0 0 4px rgba(255,255,255,.85);
}
.y1-launcher:hover { color: #fff; filter: brightness(.94); }
.y1-launcher__icon { flex: 0 0 auto; width: 50px; height: 50px; border-radius: 50%; background: #fff; color: var(--accent); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.y1-launcher__icon::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #fff; opacity: 0; animation: y1-ring 2.4s ease-out 1s 3; }
@keyframes y1-ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .y1-launcher__icon::after { animation: none; } }
.y1-launcher__text { display: flex; flex-direction: column; line-height: 1.3; }
.y1-launcher__text strong { font-size: 19px; letter-spacing: .04em; }
.y1-launcher__text small { font-size: 12px; opacity: .92; }
.y1-launcher[hidden] { display: none; }
.chat-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 50; width: min(420px, calc(100vw - 32px)); height: min(640px, calc(100vh - 44px));
  display: flex; flex-direction: column; gap: 10px; padding: 0 16px 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.28);
}
.chat-panel[hidden] { display: none; }
.chat-panel .chat__head { display: flex; align-items: center; gap: 10px; margin: 0 -16px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line-soft); }
.chat-panel .chat__name { display: flex; flex-direction: column; line-height: 1.35; flex: 1; min-width: 0; }
.chat-panel .chat__name small { font-size: 11px; color: var(--ink-mute); }
.chat-panel .ai-icon { flex: 0 0 auto; }
.chat__iconbtn { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.chat__iconbtn:hover { background: var(--ground); }
.chat-panel .chat__log { flex: 1 1 auto; min-height: 0; padding-top: 4px; }
.chat-panel .chat__chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.chat-panel .chat__chips button { flex: 0 0 auto; }
.chat-panel .ask-row input { min-height: 48px; padding: 0 12px; font-size: 15px; }
.chat-panel .ask-row button { min-height: 48px; padding: 0 14px; }
.chat-panel .chat__mic { min-height: 48px; width: 44px; }
.chat-panel .chat__tools { justify-content: space-between; }
.chat-panel .chat__privacy { line-height: 1.5; }

/* ---------- 空から見る山形 ---------- */
.sora { background: var(--sky); color: #fff; }
.sora .section-head h2 { color: #fff; }
.sora .eyebrow { color: var(--sky-accent); }
.sora .more { color: var(--sky-accent); }
.sora__lead { margin: 6px 0 0; max-width: 46em; color: var(--sky-text); font-size: 15px; }
.sora a { color: var(--sky-accent); }
.sora-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.sora-chips .chip { gap: 6px; }
.chip__n { font-size: 12px; opacity: .7; }
.sora .chip { background: transparent; color: #fff; border-color: var(--sky-line); }
.sora .chip.is-active { background: #fff; color: var(--sky); border-color: #fff; }
.sora__main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.sora__aside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.sora-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.sora-card:hover strong { text-decoration: underline; }
.sora-card__img { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--sky-2); }
.sora-card__img img { width: 100%; height: 100%; object-fit: cover; }
.sora-card__play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.35)); }
.sora-card__play svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.sora-card .video__badge { color: #fff; }
.sora-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sora-card small { font-size: 12px; font-weight: 700; color: var(--accent); }
.sora-card strong { font-size: 16px; line-height: 1.5; }
.sora-card__meta { font-size: 12px; color: var(--ink-mute); }
.sora-card__excerpt { font-size: 14px; line-height: 1.7; color: var(--ink-sub); }
.sora .sora-card { color: #fff; }
.sora .sora-card small { color: var(--sky-accent); }
.sora .sora-card__meta, .sora .sora-card__excerpt { color: var(--sky-text); }
.sora-card--large strong { font-family: var(--font-serif); font-size: 24px; }
.sora-card--large .sora-card__img { border-radius: 14px; }

.sora-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.sora-grid--archive { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-bottom: 24px; }
.sora-grid--related { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.sora__credit { margin: 22px 0 0; font-size: 12px; color: var(--sky-text); }

.sora-map { margin: 0; }
.sora-map__title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.sora-map__title span { font-size: 12px; font-weight: 400; opacity: .8; }
.sora-map .y1-map { height: 260px; }
.sora .sora-map .y1-map { border-color: var(--sky-line); background: var(--sky-2); }
.sora .map-loading { color: var(--sky-text); }
.archive .sora-map .y1-map, .post-type-archive-y1_sora .sora-map .y1-map { height: 460px; }

.sora-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; }
.sora-filter__title { font-size: 14px; font-weight: 700; margin-right: 4px; }
.sora-filter select { min-height: 44px; padding: 0 10px; border: 1px solid #C9C1B2; border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
.sora-filter .btn { min-height: 44px; }
.sora .sora-filter { flex-direction: column; align-items: stretch; margin: 0; padding: 14px; border: 1px solid var(--sky-line); border-radius: 12px; background: var(--sky-2); }
.sora .sora-filter .btn { background: #fff; color: var(--sky); }
.sora-cond { font-size: 14px; margin: -6px 0 18px; }

.sora-player { margin: 0 0 20px; aspect-ratio: 16 / 9; min-height: 0; background: #000; overflow: hidden; }
.sora-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sora-note { margin: 16px 0; }
.popup-img { display: block; width: 200px; max-width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }

/* ---------- 今月のふるさと映像（自動入れ替え） ---------- */
.video--embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 14px; }
.films .video--embed { aspect-ratio: 16 / 9; min-height: 0; overflow: hidden; }
a.films__title { color: #fff; text-decoration: none; font-size: 20px; }
a.films__title:hover { color: var(--gold); text-decoration: underline; }
.films__note { font-size: 14px; color: #E3D9CE; }

/* ---------- 関連サイトのバナー ---------- */
.banners-section { padding-top: 8px; }
.site-banners { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.site-banner {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 150px; padding: 18px 20px;
  border-radius: 12px; overflow: hidden; background: var(--banner, var(--indigo)); color: #fff; text-decoration: none; isolation: isolate;
}
.site-banner:hover { color: #fff; }
.site-banner__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform .3s; }
.site-banner::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, color-mix(in srgb, var(--banner, #22406B) 92%, transparent) 0%, color-mix(in srgb, var(--banner, #22406B) 55%, transparent) 70%, transparent 100%); }
.site-banner:hover .site-banner__bg { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .site-banner__bg { transition: none; } .site-banner:hover .site-banner__bg { transform: none; } }
.site-banner__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
.site-banner__en { font-size: 12px; letter-spacing: .08em; opacity: .85; }
.site-banner__name { font-family: var(--font-serif); font-size: 22px; font-weight: 700; line-height: 1.4; }
.site-banner__tag { font-size: 13px; line-height: 1.5; opacity: .92; }
.site-banner__go { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.7); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.site-banner--image { display: block; min-height: 0; padding: 0; background: none; }
.site-banner--image::before { display: none; }
.site-banner--image img { width: 100%; height: auto; border-radius: 12px; }

/* ---------- タブレット ---------- */
@media (max-width: 960px) {
  .sora__main { grid-template-columns: 1fr; }
  .sora__aside { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sora-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-banners { grid-template-columns: 1fr; }
  .site-banner { min-height: 120px; }
}

/* ---------- スマホ ---------- */
@media (max-width: 760px) {
  .lang-switch--sp { display: block; margin-left: auto; }
  .lang-switch--sp .lang-switch__btn { color: var(--ink); border-color: var(--line); min-height: 40px; padding: 0 10px; font-size: 13px; }
  .lang-switch--sp .lang-switch__btn[aria-expanded="true"] { background: var(--ground); }
  .lang-switch--sp .lang-switch__menu { position: fixed; top: 64px; right: 12px; left: auto; }
  /* スマホ：写真の上の会話欄は出さず、写真を見せる。AIへの入口は右下の大きなボタン */
  .hero { min-height: 0; height: 64svh; min-height: 380px; max-height: 620px; }
  .hero__inner { padding: 0; }
  .hero .concierge { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; background: none; box-shadow: none; }
  .hero .concierge > :not(h1) { display: none; }
  .hero__caption { display: block; left: 14px; right: auto; bottom: 14px; text-align: left; font-size: 14px; }
  .entries { margin-top: 16px; }
  .y1-launcher { right: 12px; bottom: 80px; min-height: 60px; padding: 6px 20px 6px 7px; gap: 10px; }
  .y1-launcher__icon { width: 46px; height: 46px; }
  .y1-launcher__text strong { font-size: 17px; }
  .y1-launcher__text small { font-size: 11px; }
  body { padding-bottom: 150px; }
  .chat-panel { right: 0; left: 0; bottom: 68px; width: auto; height: calc(100dvh - 68px - 56px); border-radius: 16px 16px 0 0; padding: 0 12px 10px; }
  .chat-panel .chat__head { margin: 0 -12px; }
  .is-chat-open body { overflow: hidden; }
  .chat__msg { max-width: 96%; font-size: 15px; }
  .chat--hero .chat__log { max-height: 240px; }
  .chat--hero .chat__tools { justify-content: flex-start; }
  .chat__mic { min-height: 48px; width: 44px; }
  .sora__aside { grid-template-columns: 1fr; }
  .sora-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .sora-card strong { font-size: 14px; }
  .sora-card--large strong { font-size: 19px; }
  .sora-card__excerpt { display: none; }
  .sora-filter select { flex: 1 1 140px; }
  .post-type-archive-y1_sora .sora-map .y1-map, .archive .sora-map .y1-map { height: 340px; }
  .site-banner__name { font-size: 19px; }
}

/* 質問の例が長いときは折り返す */
.chat__chips button { max-width: 100%; white-space: normal; line-height: 1.5; padding-top: 6px; padding-bottom: 6px; }
.chat-panel .chat__chips button { white-space: nowrap; }

/* ---------- 写真のない催しのサムネイル（自動） ---------- */
.auto-thumb {
  --c1: #22406B; --c2: #3A5F8F;
  position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px 12px; overflow: hidden; color: #fff; text-align: center;
  background:
    radial-gradient(circle at 85% 120%, rgba(255,255,255,.18) 0 38%, transparent 39%),
    radial-gradient(circle at 8% -20%, rgba(255,255,255,.12) 0 30%, transparent 31%),
    linear-gradient(135deg, var(--c1), var(--c2));
}
.auto-thumb--murayama { --c1: #2F5E4A; --c2: #4E8A6C; }
.auto-thumb--mogami   { --c1: #1F5F6E; --c2: #3C8C99; }
.auto-thumb--okitama  { --c1: #6B3A5A; --c2: #94607F; }
.auto-thumb--shonai   { --c1: #1F4C7A; --c2: #3F75A8; }
.auto-thumb__genre { position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 7px; border-radius: 999px; background: rgba(255,255,255,.92); color: var(--c1); font-size: 11px; font-weight: 700; line-height: 1.6; }
.auto-thumb__place { font-family: var(--font-serif); font-size: 30px; font-weight: 700; letter-spacing: .08em; line-height: 1.3; text-shadow: 0 1px 6px rgba(0,0,0,.2); }
.auto-thumb__region { font-size: 12px; letter-spacing: .1em; opacity: .9; }
.auto-thumb__source { position: absolute; left: 10px; right: 10px; bottom: 8px; font-size: 11px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .auto-thumb { padding: 6px; gap: 0; }
  .auto-thumb__genre { position: static; padding: 0; background: none; color: #fff; font-size: 10px; margin-bottom: 2px; }
  .auto-thumb__genre svg { display: none; }
  .auto-thumb__place { font-size: 17px; letter-spacing: .02em; }
  .auto-thumb__region, .auto-thumb__source { display: none; }
}
.card__thumb .auto-thumb { align-self: stretch; height: auto; min-height: 100%; }
