/**
 * TOP（pages#index）の多段グリッドのみ。試験一覧の余白は layouts/_cops_exams_index_viewport_style.html.erb（head 直埋め込み）。
 * 変更時はレイアウトの ?v= を更新。
 */

/* ============================================
   PCレイアウト幅 1440px 固定
   - html を 1440px 以上に固定することで zoom 前のコンテンツ幅を確保
   - 1440px超: 中央寄せ（左右均等余白）
   - 1440px未満: JS zoom でそのまま縮小（blank space なし）
   ============================================ */
html {
  min-width: 1440px;
  overflow-x: hidden;
  /* スクロールバーを左右対称に確保。JS zoom 計算も両側分 (2*sw) 引く */
  scrollbar-gutter: stable both-edges;
  background: #f5f5f5; /* ガター領域をページ背景色と統一 */
  /* スクロールバー色（Firefox） */
  scrollbar-color: #c0c0c0 #f5f5f5;
}
body {
  min-width: 1440px;
}

/* Webkit スクロールバースタイル */
html::-webkit-scrollbar {
  width: 10px;
}
html::-webkit-scrollbar-track {
  background: #f5f5f5;
}
html::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border-radius: 5px;
  border: 2px solid #f5f5f5;
}
.uk-container {
  width: 1440px !important;
  max-width: none !important;
  padding: 0 32px !important;
  box-sizing: border-box !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* ============================================
   zoom 縮小時の UIkit2 レスポンシブ非表示を無効化
   - zoom で縮小中も viewport px は小さいままなので uk-hidden-small 等が発火する
   - PCレイアウト（application.html.haml）では常にナビを表示する
   ============================================ */
.uk-navbar .uk-navbar-nav.uk-hidden-small,
.uk-navbar .uk-hidden-small {
  display: -webkit-flex !important;
  display: flex !important;
}

/* cops-pc-only: PCレイアウトでは常時表示（zoom 時にビューポートが狭くなっても非表示にしない） */
.cops-pc-only {
  display: list-item !important;
}

/* ============================================
   タブレット幅でのグリッド縦積み（スマホ/タブレット UA のみ）
   - body.cops-handheld-ua: application.html.haml でハンドヘルド UA かつ ?ui=pc でない時に付与
   - PC ユーザーは zoom 縮小のみ → グリッドは縦積みしない
   ============================================ */
@media (max-width: 1024px) {
  body.cops-handheld-ua .cops-features.uk-grid,
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid,
  body.cops-handheld-ua .cops-pages-howto .uk-grid {
    margin-left: 0 !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
  }

  body.cops-handheld-ua .cops-features.uk-grid > .uk-width-1-3,
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid > .uk-width-1-3,
  body.cops-handheld-ua .cops-pages-howto .uk-grid > .uk-width-1-4 {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: 0 !important;
    flex: 0 0 auto !important;
    flex-basis: auto !important;
    float: none !important;
    box-sizing: border-box !important;
  }

  body.cops-handheld-ua .cops-features.uk-grid > .uk-width-1-3 + .uk-width-1-3,
  body.cops-handheld-ua .cops-pages-home-admin .uk-grid > .uk-width-1-3 + .uk-width-1-3 {
    margin-top: 16px !important;
  }

  body.cops-handheld-ua .cops-pages-howto .uk-grid > .uk-width-1-4 + .uk-width-1-4 {
    margin-top: 12px !important;
  }
}

/* PC zoom: application.css の @media(max-width:1024px) レスポンシブ変換を PC ではキャンセル */
@media (max-width: 1024px) {
  body:not(.cops-handheld-ua) .cops-mobile-full-btn {
    display: inline-block !important;
    width: auto !important;
    text-align: left !important;
    margin-bottom: 0 !important;
  }
  body:not(.cops-handheld-ua) .back-link {
    display: inline !important;
    width: auto !important;
  }
}

/* PC zoom: UIkit 2 のグリッド縦積み（<768px）を PC ではキャンセル */
@media (max-width: 767px) {
  body:not(.cops-handheld-ua) [class*="uk-width-1-3"] { width: 33.333% !important; float: left !important; }
  body:not(.cops-handheld-ua) [class*="uk-width-1-4"] { width: 25% !important; float: left !important; }
  body:not(.cops-handheld-ua) [class*="uk-width-1-2"] { width: 50% !important; float: left !important; }
  body:not(.cops-handheld-ua) [class*="uk-width-2-3"] { width: 66.666% !important; float: left !important; }
  body:not(.cops-handheld-ua) [class*="uk-width-3-4"] { width: 75% !important; float: left !important; }
}
