/* ============================================================
   Care Support Pass — Shared mobile navigation CSS
   全ページ共通の三本線メニュー + ドロワー + lightbox スタイル
   各ページの個別 CSS の後に読み込むことで上書きできるよう設計。
   ============================================================ */

/* ハンバーガー button (PC では非表示) */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid #e7e0d5;
  color: #2a2a2a;
  width: 38px; height: 36px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  transition: background .15s ease;
}
.nav-toggle svg { display: block; width: 18px; height: 18px; }
.nav-toggle:hover { background: #faf7f1; }
.nav-toggle:focus-visible { outline: 2px solid #e94436; outline-offset: 1px; }

/* Backdrop */
.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 40, 0);
  z-index: 998;
  pointer-events: none;
  transition: background .25s ease;
}
.nav-drawer-backdrop.open {
  background: rgba(15, 20, 40, 0.55);
  pointer-events: auto;
}

/* Drawer */
.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: 84vw;
  max-width: 320px;
  background: #fff;
  z-index: 999;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.22,.61,.36,1);
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.25);
  visibility: hidden;
}
.nav-drawer.open {
  transform: translateX(0);
  visibility: visible;
}
.nav-drawer-head {
  padding: 22px 22px 14px;
  border-bottom: 1px solid #e7e0d5;
}
.nav-drawer-head .label {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .2em;
  color: #e94436;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.nav-drawer-head .title {
  font-weight: 700;
  font-size: 16px;
  color: #2a2a2a;
}
.nav-drawer-links {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
  overflow-y: auto;
}
.nav-drawer-links a,
.nav-drawer-links button {
  display: block;
  padding: 14px 22px;
  color: #5b5340;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
  width: 100%;
  cursor: pointer;
  font-family: inherit;
}
.nav-drawer-links a:hover,
.nav-drawer-links button:hover {
  background: #faf7f1;
  color: #2a2a2a;
  border-left-color: #e94436;
}
.nav-drawer-links a.active {
  background: #faf7f1;
  color: #2a2a2a;
  border-left-color: #e94436;
  font-weight: 600;
}
.nav-drawer-cta {
  padding: 14px 22px 22px;
  border-top: 1px solid #e7e0d5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-drawer-cta .btn {
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* タップで拡大できる要素のヒント */
.lb-trigger { cursor: zoom-in; }

/* Lightbox */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 40, 0.94);
  z-index: 9999;
  display: none;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}
.lb-overlay.open {
  display: flex;
  flex-direction: column;
}
.lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-close:hover { background: rgba(255,255,255,.2); }
.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 36px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.lb-content {
  background: #fff;
  border-radius: 8px;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  overflow: auto;
  padding: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.4);
}
.lb-content.lb-kind-image {
  background: transparent;
  padding: 0;
  display: flex;
}
.lb-content.lb-kind-image img {
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 78vh;
  display: block;
  border-radius: 6px;
}
.lb-content.lb-kind-table {
  width: 96vw;
  max-width: 1200px;
}
.lb-content.lb-kind-table > * {
  border: none;
  overflow: auto;
  max-height: 80vh;
}
.lb-content.lb-kind-table table {
  font-size: 13px;
  min-width: 100%;
}
.lb-content.lb-kind-chart {
  background: #fff;
  padding: 24px;
  width: 96vw;
  max-width: 900px;
}
.lb-hint {
  text-align: center;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  padding: 10px 14px 16px;
  flex-shrink: 0;
}

/* ===================== モバイルブレークポイント ===================== */
@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav .nav-menu { display: none !important; }
  /* ナビCTA: マイページ・参加するなどボタン2個以上ある場合、primary だけ残して他は隠す */
  .nav-cta .btn.ghost,
  .nav-cta a.btn:not(.primary) { display: none; }
  .nav-in {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}

@media (max-width: 540px) {
  /* 極小画面では nav-cta も全部隠してハンバーガーだけに */
  .nav-cta { display: none !important; }
  .nav-toggle { margin-left: 0; }
}

/* テーブルの「タップで拡大」ヒント */
@media (max-width: 720px) {
  .lb-trigger.table-trigger {
    position: relative;
  }
  .lb-trigger.table-trigger::after {
    content: "🔍 タップで拡大";
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e94436;
    color: #fff;
    font-family: ui-monospace, 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: .08em;
    padding: 4px 8px;
    border-radius: 999px;
    pointer-events: none;
    z-index: 1;
  }
}

/* ============================================================
   汎用モバイル調整 (各ページに横断適用)
   各ページのCSSの後で読まれるため、上書きする際は specificity を上げるか !important
   ============================================================ */

@media (max-width: 720px) {
  /* hero タイトル/リード/CTA はモバイル時に詰める */
  .hero h1, h1 {
    font-size: clamp(24px, 6.5vw, 36px) !important;
    line-height: 1.2 !important;
  }
  .hero .lead, .hero p.lead, .hero-lead, p.lead {
    font-size: 14px !important;
  }
  /* セクション余白を縮める */
  section { padding: 48px 16px !important; }

  /* テーブルが画面幅を超える場合に強制的にレスポンシブ化 */
  table {
    font-size: 11.5px;
  }
  /* mypage の status-row 系 */
  .status-row {
    flex-wrap: wrap;
    gap: 4px;
  }
  /* form フィールド */
  .form-row label, .field label {
    font-size: 12px;
  }
  /* 申込フォームの3カラムを1カラムに */
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* CTAボタンを全幅化 */
  .btn.large, .btn.primary.large {
    width: 100%;
    justify-content: center;
  }

  /* ダッシュボードカード */
  .card {
    padding: 18px 16px !important;
  }
}

@media (max-width: 420px) {
  .hero {
    padding: 60px 16px 48px !important;
  }
  section {
    padding: 36px 12px !important;
  }
  /* 数字系の大きな表示は少し縮める */
  .stat-value, .csp-amount-value {
    font-size: 24px !important;
  }
}
