/**
 * RAMEXperts™️ - ニュース記事モーダル
 */

/* モーダル基本スタイル */
.news-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.news-modal.active {
  opacity: 1;
  visibility: visible;
}

/* オーバーレイ */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* モーダルコンテンツ */
.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.news-modal.active .modal-content {
  transform: translate(-50%, -50%) scale(1);
}

/* 閉じるボタン */
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: #0074D9;
  transform: rotate(90deg);
}

/* 記事コンテンツ */
.modal-article {
  max-height: 90vh;
  overflow-y: auto;
  padding: 50px 50px 80px 50px;
  scroll-behavior: smooth;
}

.modal-article::-webkit-scrollbar {
  width: 8px;
}

.modal-article::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.modal-article::-webkit-scrollbar-thumb {
  background: #0074D9;
  border-radius: 4px;
}

.modal-article::-webkit-scrollbar-thumb:hover {
  background: #005bb5;
}

/* ヘッダー */
.modal-header {
  border-bottom: 3px solid #0074D9;
  padding-bottom: 25px;
  margin-bottom: 35px;
}

.modal-category {
  display: inline-block;
  background: linear-gradient(135deg, #0074D9, #005bb5);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.modal-header h2 {
  font-size: 2rem;
  font-weight: 900;
  color: #0d0d0d;
  line-height: 1.3;
  margin-bottom: 20px;
}

.modal-meta {
  display: flex;
  gap: 25px;
  color: #666;
  font-size: 0.95rem;
}

.modal-meta span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-meta i {
  color: #0074D9;
}

/* 本文 */
.modal-body {
  line-height: 1.9;
  color: #2c3e50;
  font-size: 1.05rem;
}

.modal-body h2,
.modal-body h3 {
  color: #0d0d0d;
  margin-top: 35px;
  margin-bottom: 20px;
  font-weight: 700;
}

.modal-body h2 {
  font-size: 1.6rem;
  padding-bottom: 12px;
  border-bottom: 2px solid #e0e0e0;
}

.modal-body h3 {
  font-size: 1.3rem;
  color: #0074D9;
}

.modal-body p {
  margin-bottom: 18px;
}

.modal-body ul,
.modal-body ol {
  margin: 20px 0;
  padding-left: 30px;
}

.modal-body li {
  margin-bottom: 12px;
}

.modal-body blockquote {
  border-left: 4px solid #0074D9;
  background: #f8f9fa;
  padding: 20px 25px;
  margin: 25px 0;
  font-style: italic;
  color: #555;
}

.modal-body strong {
  color: #0074D9;
  font-weight: 700;
}

/* ソースリンク */
.modal-sources {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 30px;
  margin-top: 40px;
}

.modal-sources h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #0d0d0d;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-sources h4 i {
  color: #0074D9;
}

.modal-sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal-sources li {
  margin-bottom: 12px;
}

.modal-sources a {
  color: #0074D9;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-sources a:hover {
  color: #005bb5;
  gap: 12px;
}

.modal-sources a i {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* フッター */
.modal-footer {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #e0e0e0;
  text-align: center;
}

.modal-footer p {
  color: #999;
  font-size: 0.9rem;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.modal-footer i {
  color: #0074D9;
}

/* レスポンシブ */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .modal-article {
    padding: 30px 20px;
  }

  .modal-header h2 {
    font-size: 1.5rem;
  }

  .modal-body {
    font-size: 1rem;
  }

  .modal-body h2 {
    font-size: 1.4rem;
  }

  .modal-body h3 {
    font-size: 1.2rem;
  }

  .modal-sources {
    padding: 20px;
  }

  .modal-meta {
    flex-direction: column;
    gap: 10px;
  }

  .modal-close {
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* ニュースカードにカーソル効果追加 */
.news-card {
  cursor: pointer;
  user-select: none;
}

.news-card:active {
  transform: translateY(2px);
}

/* アニメーション */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ローディング状態 */
.news-grid.loading {
  position: relative;
  min-height: 400px;
}

.news-grid.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid #e0e0e0;
  border-top-color: #0074D9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* エラー表示 */
.news-error {
  text-align: center;
  padding: 60px 20px;
  color: #e74c3c;
}

.news-error i {
  font-size: 3rem;
  margin-bottom: 20px;
  display: block;
}

.news-error h3 {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.news-error p {
  color: #7f8c8d;
  font-size: 1rem;
}

/* =============================================
   さりげない相談チップ CTA (news consult)
   ============================================= */
.news-consult-cta {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  opacity: .95;
}

.news-consult-cta__chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.16);
  background: rgba(0,0,0,.02);
  color: inherit;
  text-decoration: none;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

.news-consult-cta__chip:hover,
.news-consult-cta__chip:focus-visible {
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.22);
  transform: translateY(-1px);
  text-decoration: none;
}

.news-consult-cta__icon {
  display: inline-flex;
  align-items: center;
  opacity: .9;
}

.news-consult-cta__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.news-consult-cta__main {
  font-weight: 650;
  letter-spacing: .01em;
}

.news-consult-cta__hint {
  font-size: .86rem;
  opacity: .75;
}

.news-consult-cta__arrow {
  opacity: .6;
  transition: transform .12s ease, opacity .12s ease;
}

.news-consult-cta__chip:hover .news-consult-cta__arrow,
.news-consult-cta__chip:focus-visible .news-consult-cta__arrow {
  transform: translateX(2px);
  opacity: .85;
}

.news-consult-cta__note {
  font-size: .9rem;
  opacity: .75;
}

/* 学習後（クリック経験あり）: noteとhintを消して静かに */
.news-consult-cta.is-learned .news-consult-cta__note {
  display: none;
}

.news-consult-cta.is-learned .news-consult-cta__hint {
  display: none;
}

@media (max-width: 480px) {
  .news-consult-cta { gap: 8px; }
}
