/* ============================================================
   BARREL Theme - Responsive CSS
   モバイルファースト・ブレークポイント定義
   ============================================================ */

/* ブレークポイント
   - sm:  640px  (スマートフォン横)
   - md:  768px  (タブレット)
   - lg:  1024px (デスクトップ)
   - xl:  1240px (大画面)
*/

/* ============================================================
   タブレット（〜1024px）
   ============================================================ */

@media (max-width: 1024px) {
  /* レイアウト */
  .container {
    padding-inline: var(--space-5);
  }

  /* ヘッダー */
  .primary-nav {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  /* カードグリッド：2カラム（等高維持） */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    align-items: stretch;
  }

  /* 記事詳細レイアウト：1カラム */
  .single-layout {
    grid-template-columns: 1fr;
    gap: var(--space-10);
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }

  /* フッター */
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  .footer-brand {
    grid-column: span 2;
  }

  /* プロフィールカード */
  .profile-card {
    grid-template-columns: 160px 1fr;
  }

  .profile-card__photo {
    width: 160px;
    height: 160px;
  }
}

/* ============================================================
   モバイル（〜768px）
   ============================================================ */

@media (max-width: 768px) {
  /* コンテナ */
  .container {
    padding-inline: var(--space-4);
  }

  /* ヒーロー */
  .hero {
    height: clamp(320px, 55vw, 500px);
  }

  .hero__title {
    font-size: clamp(1.5rem, 6vw, 2.25rem);
  }

  .hero__content {
    padding: var(--space-6) var(--space-4);
  }

  /* カードグリッド：1カラム（等高不要・高さauto） */
  .card-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .card-grid--2col {
    grid-template-columns: 1fr;
    align-items: start;
  }

  /* モバイルではタイトルの高さ固定を解除（1カラムのため不要） */
  .article-card__title {
    height: auto;
    -webkit-line-clamp: 3;
  }

  /* セクション */
  .section {
    padding-block: var(--space-10);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  /* 記事ヘッダー */
  .article-header__meta {
    gap: var(--space-3);
  }

  .article-header__title {
    font-size: var(--text-2xl);
  }

  /* 記事コンテンツ */
  .article-content {
    font-size: var(--text-base);
  }

  .article-content h2 {
    font-size: var(--text-lg);
  }

  .article-content h3 {
    font-size: var(--text-base);
  }

  /* サイドバー：1カラム */
  .sidebar {
    grid-template-columns: 1fr;
  }

  /* CTAブロック */
  .cta-block {
    padding: var(--space-6);
  }

  .cta-block__title {
    font-size: var(--text-lg);
  }

  /* カテゴリページヘッダー */
  .category-header {
    padding: var(--space-10) 0 var(--space-6);
  }

  .category-header__title {
    font-size: var(--text-2xl);
  }

  /* フッター */
  .footer-inner {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer-brand {
    grid-column: span 1;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }

  /* aboutページ */
  .about-hero__title {
    font-size: var(--text-3xl);
  }

  .profile-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .profile-card__photo {
    width: 140px;
    height: 140px;
    margin-inline: auto;
  }

  /* ページトップへ戻るボタン */
  .back-to-top {
    bottom: var(--space-5);
    right: var(--space-4);
    width: 44px;
    height: 44px;
  }

  /* 広告ユニット */
  .ad-rectangle {
    width: 100%;
    max-width: 300px;
  }

  .ad-halfpage {
    width: 100%;
    max-width: 300px;
    height: 250px;
  }
}

/* ============================================================
   小型スマートフォン（〜480px）
   ============================================================ */

@media (max-width: 480px) {
  :root {
    --header-height: 56px;
  }

  body {
    font-size: var(--text-base);
  }

  .hero {
    height: 280px;
  }

  .hero__title {
    font-size: 1.4rem;
  }

  .article-header__title {
    font-size: var(--text-xl);
  }

  .section-title {
    font-size: var(--text-lg);
  }

  .about-hero__title {
    font-size: var(--text-2xl);
  }

  .cta-block__title {
    font-size: var(--text-base);
  }

  /* ページネーション */
  .pagination__list {
    gap: var(--space-1);
  }

  .pagination__item a,
  .pagination__item span {
    min-width: 36px;
    height: 36px;
    font-size: var(--text-xs);
  }
}

/* ============================================================
   大画面（1240px〜）
   ============================================================ */

@media (min-width: 1240px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .single-layout {
    grid-template-columns: 1fr 300px;
  }

  .footer-inner {
    grid-template-columns: 220px 1fr 1fr 160px;
  }
}

/* ============================================================
   印刷スタイル
   ============================================================ */

@media print {
  .site-header,
  .site-footer,
  .sidebar,
  .cta-block,
  .ad-unit,
  .back-to-top,
  .scroll-progress,
  .mobile-menu {
    display: none !important;
  }

  body {
    font-size: 14pt;
    color: #000;
    background: white;
  }

  .single-layout {
    grid-template-columns: 1fr;
  }

  .article-content a {
    text-decoration: underline;
    color: #000;
  }

  .article-content a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 10pt;
    color: #666;
  }
}

/* ============================================================
   アクセシビリティ：動きを減らす設定
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
