/*!
 * Unified Ads & Schedule Manager — フロント用CSS
 * テーマ(style.css)から抽出した広告用スタイル。色・サイズなどは
 * 管理画面の設定が CSS変数（--uam-*）として上書きします（未設定時は下記の既定値）。
 */

/* =====================================================
   Impact Ads（左右追従）
   ===================================================== */
@keyframes uam-fade-in {
  0%   { opacity: 0; transform: translateY(60px); }
  100% { opacity: 1; transform: translateY(0); }
}

.ads600x160 {
  width: 160px;
  height: 600px;
  opacity: 0; /* 初期状態では透明にする */
  animation: uam-fade-in 1.2s ease-in-out forwards;
}

#impr,
#impl {
  box-sizing: content-box;
  position: fixed;
  width: 160px;
  height: 600px;
  top: var(--uam-impact-top, 205px);
  z-index: auto;
  background: var(--uam-impact-bg, transparent);
  border: var(--uam-impact-border-width, 0) solid var(--uam-impact-border-color, transparent);
  border-radius: var(--uam-impact-radius, 0);
  /* 途中で画面上部へ「にゅっ」と動く */
  transition: top var(--uam-impact-follow-ms, 500ms) cubic-bezier(0.22, 1, 0.36, 1);
}

#impr {
  right: 50%;
  margin-right: var(--uam-impact-mr, -675px);
}

#impl {
  left: 50%;
  margin-left: var(--uam-impact-ml, -675px);
}

/* スクロールして追従中（JSが .uam-follow を付け外しします） */
#impr.uam-follow,
#impl.uam-follow {
  top: var(--uam-impact-follow-top, 0px);
}

#impr img,
#impl img {
  display: block;
  width: 160px;
  height: 600px;
}

/* =====================================================
   下部バナー（PC・468×60 横2枠）
   ===================================================== */
.uam-bottom {
  display: block;
  position: fixed;
  left: 0;
  right: 0;
  bottom: -1px;
  z-index: var(--uam-bottom-z-index, 1002);
  height: 70px;
  padding-bottom: 1px;
  overflow: hidden;
  background: var(--uam-bottom-bg, #fff);
  border-top: var(--uam-bottom-border-width, 1px) solid var(--uam-bottom-border-color, #999);
}

.uam-bottom[hidden] {
  display: none;
}

.uam-bottom__inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 1100px;
  max-width: 100%;
  margin: auto;
  height: 60px;
  padding: 5px 0;
  clear: both;
  text-align: center;
  background: var(--uam-bottom-bg, #fff);
}

.uam-bottom__slot {
  width: 468px;
  height: 60px;
  text-align: center;
  transition: opacity 0.5s ease-in-out;
}

.uam-bottom__slot--l { margin-right: auto; }
.uam-bottom__slot--r { margin-left: auto; }

.uam-bottom__slot a,
.uam-bottom__slot img {
  display: block;
  width: 468px;
  max-width: 100%;
  height: 60px;
}

/* 切り替え時のフェード */
.uam-bottom.is-fading .uam-bottom__slot {
  opacity: 0;
}

/* 固定バーの分だけフッターを持ち上げる */
body.uam-has-bottom .footer {
  padding-bottom: 70px;
}

/* =====================================================
   h2上下広告
   ===================================================== */
.uam-slot {
  margin: var(--uam-h2-margin, 20px) 0;
}

.uam-slot .uam-ad {
  background: var(--uam-h2-bg, transparent);
  border: var(--uam-h2-border-width, 0) solid var(--uam-h2-border-color, #e1e1e1);
  border-radius: var(--uam-h2-radius, 0);
  padding: var(--uam-h2-padding, 0);
  color: var(--uam-h2-color, inherit);
  font-size: var(--uam-h2-font-size, inherit);
}

.uam-slot .uam-ad--center { text-align: center; }
.uam-slot .uam-ad--left   { text-align: left; }

.uam-slot img {
  max-width: 100%;
  height: auto;
}

/* =====================================================
   自由広告枠（[uam_free] / uam_free()）
   並び・寄せ・隙間・余白・スクロール時の動きは、枠ごとの設定が
   CSS変数や追加ルールとして反映されます。
   ===================================================== */
.uam-free {
  margin: var(--uam-free-mt, 20px) 0 var(--uam-free-mb, 20px);
  background: var(--uam-free-bg, transparent);
  padding: var(--uam-free-padding, 0);
  border: var(--uam-free-border-width, 0) solid var(--uam-free-border-color, #e1e1e1);
  border-radius: var(--uam-free-radius, 0);
  box-sizing: border-box;
}

.uam-free__body {
  display: flex;
  flex-wrap: wrap;
  flex-direction: var(--uam-free-dir, row);
  justify-content: var(--uam-free-jc, center);
  align-items: var(--uam-free-ai, flex-start);
  gap: var(--uam-free-gap, 10px);
}

/* 読み込み前に場所を確保（レイアウトのズレ防止） */
.uam-free[data-uam-pending] .uam-free__body {
  min-height: var(--uam-free-minh, 0);
}

.uam-free__item {
  max-width: 100%;
}

.uam-free__item a {
  display: block;
}

.uam-free__item img {
  display: block;
  max-width: 100%;
  height: auto;
}

.uam-free__pr {
  text-align: right;
  font-size: var(--uam-free-pr-size, 11px);
  line-height: 14px;
  margin-top: 4px;
  color: var(--uam-free-pr-color, inherit);
}

/* =====================================================
   3段広告
   ===================================================== */
.three-tier-advertisement__container {
  max-width: var(--uam-tier-max-width, 672px);
  width: 100%;
  margin: var(--uam-tier-margin-top, 30px) auto 0;
  border-top: 1px solid var(--uam-tier-border-color, rgb(225, 225, 225));
  border-bottom: 1px solid var(--uam-tier-border-color, rgb(225, 225, 225));
  box-sizing: border-box;
}

/* JSで差し替え待ちの間は隠す（JSが動かない場合も3秒後に必ず表示） */
.uam-tier[data-uam-pending] {
  visibility: hidden;
  animation: uam-reveal 0s linear 3s forwards;
}

@keyframes uam-reveal {
  to { visibility: visible; }
}

/* 各項目（リンク全体がクリック可能） */
.three-tier-advertisement__link {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  padding: var(--uam-tier-padding, 10px);
  text-decoration: none;
  color: inherit;
  background-color: var(--uam-tier-bg, #fff);
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* 項目同士の境界線 */
.three-tier-advertisement__link + .three-tier-advertisement__link {
  border-top: 1px solid var(--uam-tier-border-color, rgb(225, 225, 225));
}

/* バナー画像 */
.three-tier-advertisement__banner {
  max-width: var(--uam-tier-banner-w, 110px);
  width: var(--uam-tier-banner-w, 100px);
  height: var(--uam-tier-banner-h, 110px);
  object-fit: contain;
  flex-shrink: 0;
  margin-right: 10px;
  border-radius: var(--uam-tier-banner-radius, 4px);
  display: block;
}

/* テキスト領域 */
.three-tier-advertisement__content {
  display: flex;
  flex-direction: column;
}

.three-tier-advertisement__title,
.three-tier-advertisement__description {
  margin: 0;
  color: var(--uam-tier-title-color, #0032cc);
  text-decoration: none;
  transition: color 0.25s ease, text-decoration-color 0.25s ease;
}

.three-tier-advertisement__title {
  font-size: var(--uam-tier-title-size, 16.8px);
  font-weight: 700;
  margin-bottom: 4px;
}

.three-tier-advertisement__content .three-tier-advertisement__description {
  font-size: var(--uam-tier-desc-size, 14px);
  line-height: 1.4;
  color: var(--uam-tier-desc-color, #333);
  margin-block-end: 0;
  margin-bottom: 0;
}

/* hover時（タイトル・説明文の文字色と下線） */
.three-tier-advertisement__link:hover .three-tier-advertisement__title {
  color: var(--uam-tier-hover-title, #cc3434);
  text-decoration: underline;
  text-decoration-color: var(--uam-tier-hover-title, #cc3434);
  text-underline-offset: 2px;
}

.three-tier-advertisement__link:hover .three-tier-advertisement__description {
  color: var(--uam-tier-hover-desc, #111);
  text-decoration: underline;
}

/* hover時（リンクエリアの背景色変更） */
.three-tier-advertisement__link:hover {
  background-color: var(--uam-tier-hover-bg, #f7f7f7);
}

/* フォーカス可視化 */
.three-tier-advertisement__link:focus-visible {
  outline: 2px solid rgba(0, 50, 204, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 1×1 のトラッキング画像 */
.uam-px {
  width: 1px;
  height: 1px;
  border: 0;
}

/* 右下のPR表記 */
.three-tier-advertisement__pr {
  text-align: right;
  font-size: var(--uam-tier-pr-size, 11px);
  line-height: 14px;
  margin-bottom: var(--uam-tier-pr-margin-bottom, 30px);
  max-width: var(--uam-tier-max-width, 672px);
  width: 100%;
  color: var(--uam-tier-pr-color, inherit);
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
  .three-tier-advertisement__link {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px;
  }

  .three-tier-advertisement__banner {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-right: 0;
    margin-bottom: 8px;
  }

  .three-tier-advertisement__title {
    font-size: calc(var(--uam-tier-title-size, 16.8px) * 0.95);
  }
}

/* =====================================================
   OHA（One Hour Ads）モーダル
   ===================================================== */

/* --- 旧クラス（互換のため維持） --- */
.one-hour-ads-modal {
  display: none; /* JSで表示 */
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  background-color: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px) brightness(0.5);
  backdrop-filter: blur(8px) brightness(0.5);
}

.one-hour-ads-content {
  position: relative;
  background: transparent;
  border-radius: 12px;
  padding: 0;
  max-width: 560px;
  width: calc(100% - 48px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  z-index: 100001;
}

.one-hour-ads-close {
  position: absolute;
  top: -28px;
  right: -38px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #222;
  color: #fff;
  font-size: 18px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  z-index: 100002;
}

.one-hour-ads-banner {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

/* モーダル表示中は body のスクロールをJSで固定する */
body.one-hour-ads-body-fixed {
  overflow: hidden !important;
}

/* --- モーダル基本設定 --- */
#one-hour-ads-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--uam-oha-bg, rgba(0, 0, 0, 0.85));
  justify-content: center;
  align-items: center;
  z-index: 2147483647 !important;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.oha-modal-wrapper {
  position: relative;
}

.oha-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  max-width: 90%;
  position: relative;
}

.oha-modal__flexbox {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.oha-modal__flexbox--text {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* --- バナーエリア --- */
.oha-banner-area > a {
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.3s;
}

.oha-banner-area > a:hover {
  opacity: 0.8;
}

.oha-banner-area img {
  width: 300px;
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- 見出し --- */
.oha-heading {
  color: var(--uam-oha-heading-color, #ffffff);
  font-size: var(--uam-oha-heading-size, 20px);
  font-weight: bold;
  text-align: center;
  margin: 1.2vw 0 0.5vw 0;
  line-height: 1.4;
}

/* --- 説明文 --- */
.oha-description {
  color: var(--uam-oha-desc-color, #ffffff);
  font-size: var(--uam-oha-desc-size, 13px);
  line-height: 1.45;
  text-align: center;
  margin: 0;
  max-width: 600px;
  font-weight: 500;
}

/* --- マイクロコピー --- */
.oha-micro-copy {
  color: var(--uam-oha-micro-color, #ffcc00);
  font-size: var(--uam-oha-micro-size, 13px);
  font-weight: bold;
  text-align: center;
  margin: 1.25vw 0 0.5vw 0;
  line-height: 1.4;
}

/* --- 詳細ボタン --- */
.oha-cta-btn {
  background-color: var(--uam-oha-btn-bg, #f1f1f1);
  color: var(--uam-oha-btn-color, #1f1f1f);
  padding: 12px 32px;
  text-decoration: none;
  font-weight: bold;
  border-radius: 30px;
  transition: all 0.3s ease;
  transform: scale(1);
  cursor: pointer;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  margin-inline: auto;
  margin-bottom: 0;
}

/* ボタン右側の矢印 */
.oha-cta-btn::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 10px;
  margin-bottom: 2px;
  transition: transform 0.3s ease;
}

/* ボタン活性化時（5秒後） */
.oha-cta-btn.is-active {
  animation: poyonOrange 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
  opacity: 1 !important;
  visibility: visible !important;
  background-color: var(--uam-oha-btn-active-bg, #f05500) !important;
  color: var(--uam-oha-btn-active-color, #ffffff) !important;
  transition: none !important;
}

.oha-cta-btn.is-active::after {
  border-color: var(--uam-oha-btn-active-color, #ffffff) !important;
}

.oha-cta-btn.is-active:hover::after {
  transform: rotate(45deg) translate(2px, -2px);
}

@keyframes poyonOrange {
  0%   { transform: scale(1);    background-color: var(--uam-oha-btn-bg, #f1f1f1);       color: var(--uam-oha-btn-color, #1f1f1f); }
  40%  { transform: scale(1.25); background-color: var(--uam-oha-btn-active-bg, #f05500); color: var(--uam-oha-btn-active-color, #ffffff); }
  60%  { transform: scale(0.95); background-color: var(--uam-oha-btn-active-bg, #f05500); color: var(--uam-oha-btn-active-color, #ffffff); }
  100% { transform: scale(1);    background-color: var(--uam-oha-btn-active-bg, #f05500); color: var(--uam-oha-btn-active-color, #ffffff); }
}

/* --- タイマー --- */
.oha-timer {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  margin-inline: auto;
}

#one-hour-ads-count-text {
  position: absolute;
  color: var(--uam-oha-timer-color, #ffffff);
  font-size: 14px;
  font-weight: bold;
  z-index: 2;
}

.oha-timer-svg {
  width: 40px;
  height: 40px;
  transform: rotate(-90deg);
}

.oha-timer-bg-ring,
.oha-timer-progress-ring {
  fill: none;
  stroke-width: 3;
}

.oha-timer-bg-ring {
  stroke: rgba(255, 255, 255, 0.2);
}

.oha-timer-progress-ring {
  stroke: var(--uam-oha-timer-color, #ffffff);
  stroke-dasharray: 113;
  stroke-dashoffset: 0;
}

.oha-timer.is-animating .oha-timer-progress-ring {
  animation: countdownCircle 5s linear forwards;
}

@keyframes countdownCircle {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: 113; }
}

/* --- 閉じるボタン --- */
.oha-close-btn {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  width: fit-content;
  margin-inline: auto;
  margin-block-start: 0.8vw;
  border: 1px solid var(--uam-oha-close-color, #ffffff);
  background-color: transparent;
  color: var(--uam-oha-close-color, #ffffff);
  line-height: 1;
}

.oha-close-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ads-text {
  display: block;
  position: fixed;
  right: 5rem;
  top: 5rem;
  color: var(--uam-oha-pr-color, #f1f1f1);
}

/* --- アニメーション --- */
@keyframes pulseBtn {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes ohaFadeInUp {
  0%   { opacity: 0; transform: translateY(15px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* アニメーション実行前の初期状態（JSでクラスが付与されるまで隠す） */
#one-hour-ads-modal.is-preparing .oha-banner-area,
#one-hour-ads-modal.is-preparing .oha-heading,
#one-hour-ads-modal.is-preparing .oha-description,
#one-hour-ads-modal.is-preparing .oha-micro-copy,
#one-hour-ads-modal.is-preparing .oha-cta-btn,
#one-hour-ads-modal.is-preparing .oha-timer {
  opacity: 0;
}

/* アニメーション実行クラス (.run-animation) が付与されたら発動 */
#one-hour-ads-modal.run-animation .oha-banner-area,
#one-hour-ads-modal.run-animation .oha-heading,
#one-hour-ads-modal.run-animation .oha-description,
#one-hour-ads-modal.run-animation .oha-micro-copy,
#one-hour-ads-modal.run-animation .oha-cta-btn {
  animation: ohaFadeInUp 0.5s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  opacity: 0;
}

#one-hour-ads-modal.run-animation .oha-banner-area  { animation-delay: 0.1s; }
#one-hour-ads-modal.run-animation .oha-heading      { animation-delay: 0.3s; }
#one-hour-ads-modal.run-animation .oha-description  { animation-delay: 0.45s; }
#one-hour-ads-modal.run-animation .oha-micro-copy   { animation-delay: 0.6s; }
#one-hour-ads-modal.run-animation .oha-cta-btn      { animation-delay: 0.75s; }

/* タイマーはアニメーション終了後、JSでふわっと表示させる */
.oha-timer {
  width: 40px;
  height: 40px;
  transition: opacity 0.5s ease;
  opacity: 0;
  position: absolute;
  bottom: 102%;
  left: 102%;
}

.oha-timer.is-visible {
  opacity: 1;
}

/* --- スマホ用レスポンシブ設定 --- */
@media screen and (max-width: 768px) {
  .oha-content {
    width: 92%;
    max-width: none;
    padding: 15px 12px;
    gap: 8px;
    flex-direction: column;
  }

  .oha-banner-area img {
    max-height: 30vh;
    width: auto;
    margin: 0 auto;
    object-fit: contain;
  }

  .oha-modal__flexbox--text {
    width: 100%;
    text-align: center;
  }

  .oha-heading {
    font-size: calc(var(--uam-oha-heading-size, 20px) * 0.88);
    margin: 4px 0;
  }

  .oha-description {
    font-size: calc(var(--uam-oha-desc-size, 13px) * 1.046);
    line-height: 1.4;
    margin: 4px 0;
  }

  .oha-micro-copy {
    font-size: calc(var(--uam-oha-micro-size, 13px) * 0.923);
    margin-top: 8px;
    margin-bottom: 2px;
  }

  .oha-cta-btn {
    font-size: 1rem;
    padding: 10px 0;
    width: 90%;
    margin-top: 5px;
  }

  .oha-timer {
    margin-top: 8px;
    transform: translateX(-50%) scale(0.8);
    bottom: 100%;
    left: 50%;
  }

  .oha-close-btn {
    margin-top: 10px;
    font-size: 10px;
    padding: 6px 14px;
  }
}

/* =====================================================
   アクセシビリティ：動きを減らす設定の訪問者向け
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  .ads600x160 { animation: none; opacity: 1; }
  #impr, #impl { transition: none; }
  .uam-bottom__slot { transition: none; }
}
