/* =========================================================
   theme.css — ライト/ダーク共通テーマオーバーライド
   全ページ共通で読み込む。:root のダーク値をベースに、
   [data-theme="light"] 時の上書き値をここにまとめる。
   ========================================================= */

/* =========================================================
   モバイル横スクロール防止(共通セーフティネット)
   全ページで読み込まれるこのファイルに置くことで一括対応する。
   ========================================================= */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }

/* flexの子要素は中身の幅ぶん最低限確保しようとして
   親からはみ出すことがあるため、はみ出しやすい行コンテナには
   min-width:0 を明示して縮められるようにする */
.nav-inner,
.nav-right,
.nav-links,
.social-icons,
.footer-inner,
.footer-links,
.footer-legal,
.status-head,
.status-name-wrap,
.status-updated-row,
.overall-banner,
.status-foot,
.legend,
.gear-name,
.spec-info,
.download-card,
.host-banner {
  min-width: 0;
}
.nav-inner > *,
.footer-inner > * {
  min-width: 0;
}

/* ナビの右側(アイコン・ボタン群)は詰まりやすいので、
   ブランド名は必要なら省略記号で縮められるようにしておく */
.nav-brand {
  min-width: 0;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-brand a { min-width: 0; overflow: hidden; }

@media (max-width: 768px) {
  /* SNSアイコンはフッターにも同じものがあるため、モバイルではナビから外して幅を確保 */
  header.nav .social-icons { display: none; }
  header.nav .nav-right { gap: 10px; }
}
@media (max-width: 400px) {
  /* さらに狭い端末では「見てみる/ホームへ」ボタンも省略し、ハンバーガーメニューに集約 */
  header.nav .nav-cta { display: none; }
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-bg-hover: rgba(245, 245, 247, 0.95);

  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.18);
}

/* ライト時の背景・カード類は影を軽く */
[data-theme="light"] body { background: var(--bg); }

[data-theme="light"] header.nav { background: rgba(255, 255, 255, 0.75); }

[data-theme="light"] .social-icons a {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.06);
  color: var(--ink-soft);
}
[data-theme="light"] .social-icons a:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .nav-brand {
  background: linear-gradient(135deg, #1d1d1f 0%, #52525b 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* index.html の白背景CTAはライト時は反転させて視認性を確保 */
[data-theme="light"] a.nav-cta.nav-cta-invert {
  background: #1d1d1f !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.15) !important;
}
[data-theme="light"] a.nav-cta.nav-cta-invert:hover {
  background: #000000 !important;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="light"] h1.hero-title .grad {
  background: linear-gradient(135deg, #1d1d1f 0%, #52525b 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
[data-theme="light"] .stat-num {
  background: linear-gradient(180deg, #1d1d1f 0%, #52525b 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

[data-theme="light"] .section-head h2,
[data-theme="light"] .panel h3,
[data-theme="light"] .gcard h4,
[data-theme="light"] .download-card h3,
[data-theme="light"] .spec-value,
[data-theme="light"] .gear-name,
[data-theme="light"] .gear-category h3,
[data-theme="light"] .status-name,
[data-theme="light"] .faq-q span,
[data-theme="light"] .legal h2,
[data-theme="light"] .legal h3 {
  color: var(--ink);
}

[data-theme="light"] .mock-window { border-color: rgba(0, 0, 0, 0.1); }
[data-theme="light"] .mock-dots span { background: rgba(0, 0, 0, 0.15); }
[data-theme="light"] .mock-line { background: rgba(0, 0, 0, 0.1); }
[data-theme="light"] .mock-bubble {
  background: linear-gradient(135deg, #1d1d1f, #3f3f46) !important;
  color: #fff !important;
}
[data-theme="light"] .mock-cell {
  background: rgba(0, 0, 0, 0.025);
  border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .panel-tools:hover .mock-cell {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .btn-download {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
  border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .panel,
[data-theme="light"] .gcard,
[data-theme="light"] .download-card,
[data-theme="light"] .spec-card,
[data-theme="light"] .gear-card,
[data-theme="light"] .status-card,
[data-theme="light"] .faq-item,
[data-theme="light"] .legal-card {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .panel:hover,
[data-theme="light"] .gcard:hover,
[data-theme="light"] .download-card:hover,
[data-theme="light"] .spec-card:hover,
[data-theme="light"] .gear-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] footer { background: var(--bg-alt); }

/* footer legal row (共通) */
.footer-legal {
  display: flex;
  gap: 20px;
  font-size: 12px;
}
.footer-legal a { color: var(--ink-soft); transition: color 0.2s; }
.footer-legal a:hover { color: var(--ink); }
.footer-inner { row-gap: 12px; }
@media (max-width: 640px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* =========================================================
   テーマ切り替えボタン
   ========================================================= */
.theme-toggle {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: color 0.3s var(--ease-apple, ease), background 0.3s, border-color 0.3s, transform 0.3s var(--ease-spring, ease);
}
[data-theme="light"] .theme-toggle {
  background: rgba(0, 0, 0, 0.03);
}
.theme-toggle:hover {
  color: var(--ink);
  transform: translateY(-2px) scale(1.08);
  border-color: var(--line-strong);
}
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* =========================================================
   モバイル用ハンバーガーメニュー(全ページ共通)
   ========================================================= */
.mobile-menu-btn {
  display: none;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  align-items: center; justify-content: center;
  color: var(--ink-soft); cursor: pointer; flex-shrink: 0;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}
[data-theme="light"] .mobile-menu-btn { background: rgba(0, 0, 0, 0.03); }
.mobile-menu-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.mobile-menu-btn svg { width: 18px; height: 18px; }
.mobile-menu-btn .icon-close { display: none; }
header.nav.mobile-open .mobile-menu-btn .icon-open { display: none; }
header.nav.mobile-open .mobile-menu-btn .icon-close { display: block; }

@media (max-width: 768px) {
  .mobile-menu-btn { display: inline-flex; }

  header.nav .nav-links {
    display: none;
  }
  header.nav.mobile-open {
    background: var(--bg);
  }
  header.nav.mobile-open .nav-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: absolute;
    top: 56px; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 10px 24px 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    z-index: 90;
  }
  [data-theme="light"] header.nav.mobile-open .nav-links {
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12);
  }
  header.nav.mobile-open .nav-links a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--line);
    font-size: 15px;
  }
  header.nav.mobile-open .nav-links a:last-child { border-bottom: none; }
}
