/* ==========================================================================
   COCO-JOB Responsive CSS — Phase 10 Complete
========================================================================== */

/* --------------------------------------------------------------------------
   Tablet  ≤ 1024px
-------------------------------------------------------------------------- */
@media screen and (max-width: 1024px) {

  /* Header */
  .main-nav,
  .header-auth { display: none; }
  .hamburger    { display: flex; }

  /* Hero (動画) */
  .hero { height: clamp(300px, 55vw, 600px); }

  /* Search Bar */
  .search-bar { flex-wrap: wrap; gap: 0; }
  .search-bar__field {
    flex: 1 1 45%;
    border-right: none;
    border-bottom: 1px solid var(--cj-border);
  }
  .search-bar__btn { width: 100%; margin: 6px; border-radius: var(--r-md); }

  /* Grids */
  .company-grid,
  .company-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .blog-grid        { grid-template-columns: repeat(2, 1fr); }
  .features-grid    { grid-template-columns: repeat(2, 1fr); }
  .posts-grid       { grid-template-columns: repeat(2, 1fr); }
  .stats-grid       { grid-template-columns: repeat(2, 1fr); }

  /* About リデザイン — タブレット */
  .about-header { grid-template-columns: 1fr; gap: 20px; margin-bottom: 48px; }
  .features-zigzag { grid-template-columns: repeat(2, 1fr); }
  .flow-redesign__steps { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .flow-redesign__steps::before { display: none; }

  /* Flow steps */
  .flow-steps { gap: 6px; }
  .flow-step__arrow { display: none; }

  /* Counseling 2col */
  .counseling-cta { grid-template-columns: 1fr; gap: 40px; }

  /* Content Layout */
  .content-layout--with-sidebar {
    grid-template-columns: 1fr;
  }
  .content-sidebar { position: static; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 40px; }
  .footer-nav-group { grid-template-columns: repeat(3, 1fr); }

  /* Counseling CTA */
  .counseling-cta {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  .counseling-cta__visual { display: none; }
  .counseling-cta__points { align-items: center; }

  /* Archive Company */
  .archive-header--company { padding: 40px 0 32px; }
  .archive-controls { flex-direction: column; align-items: flex-start; gap: 8px; }
  .search-bar__field--keyword { flex: 1 1 100%; }
  .search-bar__field--select  { flex: 1 1 45%; }

  /* Company Detail */
  .company-detail__layout { grid-template-columns: 1fr; }
  .company-detail__sidebar {
    position: static;
    order: -1;
  }
  .sidebar-cta { flex-direction: row; }
  .btn--entry,
  .btn--favorite { flex: 1; }
  .company-detail__sidebar .back-to-list { display: none; }
  /* company-fv はスタックレイアウト、min-height 不要 */
  .company-fv__bg { max-height: 360px; }
  .company-fv__bg img { max-height: 360px; }

  /* Toast */
  #cj-toast-container { right: 16px; bottom: 20px; }
}

/* --------------------------------------------------------------------------
   Mobile  ≤ 768px
-------------------------------------------------------------------------- */
@media screen and (max-width: 768px) {

  /* My Page */
  .mypage-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .mypage-tabs::-webkit-scrollbar { display: none; }
  .mypage-tabs__btn { padding: 12px 16px; font-size: 13px; white-space: nowrap; }

  .mp-profile-card { flex-wrap: wrap; gap: 20px; padding: 20px; }
  .mp-profile-card__body { order: 2; min-width: 0; }
  .mp-completion {
    order: 3;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    width: 100%;
  }
  .mp-completion__label { text-align: left; }

  .mp-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mp-stat-card { padding: 14px 8px; }
  .mp-stat-card__num { font-size: 22px; }

  .mp-history__item {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
    gap: 6px 8px;
  }
  .mp-history__date  { font-size: 11px; color: var(--cj-gray-l); }
  .mp-history__status { grid-column: 2; font-size: 11px; }

  .mp-form__row--half { grid-template-columns: 1fr; }
  .mp-nudge { flex-wrap: wrap; gap: 8px; }

  /* Content layout */
  .content-layout--with-sidebar { gap: 24px; }
}

/* --------------------------------------------------------------------------
   Mobile  ≤ 640px
-------------------------------------------------------------------------- */
@media screen and (max-width: 640px) {

  /* Section */
  .section { padding: clamp(40px, 8vw, 64px) 0; }

  /* Hero */
  .hero { height: clamp(240px, 60vw, 480px); }

  /* Search Bar */
  .search-bar__field { flex: 1 1 100%; }
  .search-bar-wrap   { border-radius: var(--r-md); }

  /* Grids */
  .company-grid,
  .company-grid--4,
  .blog-grid,
  .features-grid,
  .posts-grid,
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Blog row — scroll維持 */
  .blog-row { gap: 14px; }
  .blog-card { flex: 0 0 230px; width: 230px; }
  .blog-card__image { width: 100%; aspect-ratio: 16/9; height: auto; }

  /* About リデザイン — モバイル */
  .flow-redesign__steps { grid-template-columns: repeat(2, 1fr); }
  .flow-redesign { padding: 32px 20px; }
  .flow-redesign::before { display: none; }
  .features-zigzag { grid-template-columns: 1fr; gap: 14px; }

  /* Flow steps mobile */
  .flow-steps { flex-wrap: wrap; gap: 12px; }
  .flow-step { flex: 0 0 calc(50% - 6px); }

  /* Counseling */
  .counseling-cta { grid-template-columns: 1fr; }
  .section-header--between { flex-direction: column; align-items: flex-start; gap: 16px; }

  /* Footer */
  .footer-nav-group      { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom__inner  { flex-direction: column; text-align: center; }
  .footer-legal-nav      { flex-wrap: wrap; justify-content: center; gap: 12px 20px; }

  /* Post Nav */
  .post-navigation { grid-template-columns: 1fr; }

  /* Error */
  .error-page__code  { font-size: 80px; }
  .error-page__actions { flex-direction: column; align-items: center; }

  /* Counseling CTA */
  .btn--counseling { width: 100%; justify-content: center; }

  /* Section Header */
  .section-header { margin-bottom: 32px; }

  /* Archive */
  .archive-header--company .archive-header__title { font-size: 24px; }
  .archive-search { padding: 20px 0; }
  .archive-filter-state { gap: 6px; }
  .nav-links { gap: 4px; }
  .page-numbers { width: 38px; height: 38px; font-size: 13px; }

  /* Auth */
  .auth-card { padding: 24px 20px; border-radius: var(--r-lg); }
  .auth-card__title { font-size: 20px; }
  .auth-form__row--inline { grid-template-columns: 1fr; gap: 0; }

  /* Company Detail */
  .company-fv__title { font-size: 20px; }
  .company-fv__inner { padding-top: 36px; padding-bottom: 36px; }
  .company-fv__breadcrumb { display: none; }
  .sidebar-cta { flex-direction: column; }
  .btn--entry,
  .btn--contact,
  .btn--favorite { width: 100%; }
  .emp-profile { flex-direction: column; text-align: center; }
  .emp-profile__years { display: inline-block; }
  .emp-schedule__item { flex-direction: column; gap: 4px; }
  .emp-schedule__time { min-width: auto; }
  .entry-modal__head { padding: 28px 20px 16px; }
  .entry-form { padding: 20px 20px 28px; }
  .job-table__label { width: 35%; min-width: 90px; padding: 12px; font-size: 12px; }
  .job-table__value { padding: 12px; font-size: 13px; }
  .detail-section { padding: 20px; }
  .editor-note { flex-direction: column; gap: 12px; }

  /* Modal */
  .entry-modal__box {
    max-width: 100%;
    margin: 16px;
    max-height: calc(100vh - 32px);
  }

  /* Toast */
  #cj-toast-container {
    left: 12px;
    right: 12px;
    bottom: 16px;
  }
  .cj-toast { min-width: 0; max-width: 100%; }

  /* My Page */
  .mp-stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .mp-stat-card__icon { display: none; }
  .mp-salary-range__labels { flex-wrap: wrap; }
  .mp-form__avatar-row { flex-direction: column; text-align: center; }

  /* Favorites grid on mobile */
  .mp-fav-grid { grid-template-columns: 1fr !important; }
}

/* --------------------------------------------------------------------------
   Extra Small  ≤ 375px
-------------------------------------------------------------------------- */
@media screen and (max-width: 375px) {
  .header-inner  { gap: 12px; }
  .footer-nav-group { grid-template-columns: 1fr; }
  .mp-stats { gap: 4px; }
  .mp-stat-card { padding: 10px 6px; }
  .mp-stat-card__num { font-size: 18px; }
  .mypage-tabs__btn { padding: 10px 12px; font-size: 12px; }
}

/* --------------------------------------------------------------------------
   Landscape phone  max-height: 480px
-------------------------------------------------------------------------- */
@media screen and (max-height: 480px) and (orientation: landscape) {
  .hero { min-height: auto; }
  .hero__inner { padding-top: 32px; padding-bottom: 32px; }
  .mobile-menu { overflow-y: auto; }
  .entry-modal__box { max-height: 90vh; }
}

/* --------------------------------------------------------------------------
   Hover: カード hover はマウス環境のみ有効
-------------------------------------------------------------------------- */
@media (hover: none) {
  .company-card:hover,
  .blog-card:hover,
  .feature-card:hover,
  .mp-stat-card:hover,
  .mp-fav-card:hover { transform: none; box-shadow: var(--shadow-xs); }

  .company-card:hover .company-card__image img,
  .blog-card:hover .blog-card__image img { transform: none; }
}

/* --------------------------------------------------------------------------
   Wide screen  ≥ 1400px
-------------------------------------------------------------------------- */
@media screen and (min-width: 1400px) {
  :root { --container: 1320px; }
  .company-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* --------------------------------------------------------------------------
   ヘッダーナビ ドロップダウン レスポンシブ
-------------------------------------------------------------------------- */
@media screen and (max-width: 1024px) {
  /* タブレット以下: ドロップダウンは使わずモバイルメニューへ */
  .nav-item--dd .nav-dropdown { display: none !important; }

  /* sticky 検索はタブレットではヘッダー高さ調整 */
  #sticky-search { top: 68px; }
}

@media screen and (max-width: 640px) {
  #sticky-search { top: 64px; }
  #sticky-search .search-bar-wrap { border-radius: var(--r-md); }
}
