/*
 * top.css — jutaku-tool.com トップページ専用スタイル
 * money-keisan.com デザイン準拠
 * base.css + tool.css と組み合わせて使用
 */

/* ── tool.css 変数をトップページでも使えるよう再定義 ── */
.top-page {
  /* プライマリカラー系（Slate Blue） */
  --primary:     #1e3a5f;
  --primary2:    #2a4f7e;
  --primary3:    #3560a0;
  --primary-l:   #e8f0f9;
  --primary-ll:  #f4f8fd;
  --primary-mid: #6b9fd4;

  /* アクセント */
  --accent:      #c8570a;
  --accent-l:    #fff0e6;
  --accent2:     #e07030;
  --accent-hover: #a84308;

  /* 背景・サーフェス */
  --bg:          #f7f5f0;
  --bg2:         #edeae3;
  --bg3:         #e0ddd4;
  --surface:     #ffffff;

  /* テキスト */
  --ink:         #1a2030;
  --ink2:        #445060;
  --ink3:        #8090a8;

  /* ヘッダー */
  --hdr-bg:      #1e3a5f;
  --hdr-txt:     rgba(255,255,255,0.85);
  --hdr-logo:    #ffffff;
  --hdr-border:  rgba(255,255,255,0.12);

  /* ヒーロー */
  --hero-bg:     #1e3a5f;

  /* 共通トークン */
  --white:       #ffffff;
  --r:           10px;
  --r-lg:        18px;
  --shadow:      0 4px 24px rgba(0,0,0,0.09);
  --shadow-sm:   0 2px 10px rgba(0,0,0,0.06);
}

/* ── トップページ body 調整 ── */
.top-page { background: var(--hdr-bg, #1e3a5f); }
.top-page .pr-disclosure {
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.45);
}
.top-page .breadcrumb { display: none; }
.top-page main { margin: 0; padding: 0; }

/* ── ヘッダー上書き（ネイビー背景） ── */
.top-page .site-header {
  background: var(--hdr-bg);
  border-bottom: none;          /* ヒーローと同色なので境界線不要 */
  box-shadow: none;
}

.top-page .site-logo {
  color: var(--hdr-logo);
}

.top-page .site-logo span {
  color: rgba(255,255,255,0.6);
  display: inline;
  font-size: inherit;
  font-weight: 400;
}

.top-page .site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* Firefox */
}
.top-page .site-nav::-webkit-scrollbar { display: none; }

.top-page .site-nav a {
  color: var(--hdr-txt);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.top-page .site-nav a:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}

/* ── ヘッダー検索アイコン ── */
.search-icon-btn {
  background: none;
  border: none;
  color: var(--hdr-txt, rgba(255,255,255,0.85));
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.search-icon-btn:hover {
  background: rgba(255,255,255,0.1);
}
.search-icon-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* =============================================
   ヒーローセクション
   ============================================= */
.top-hero {
  background: var(--hero-bg, #1e3a5f);
  padding: 56px 24px 48px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.top-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(53,96,160,0.4), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(200,87,10,0.06), transparent 50%);
  pointer-events: none;
}

.top-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.top-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.top-hero-title {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-weight: 800;
  color: #ffffff;
  font-size: clamp(26px, 5.5vw, 40px);
  line-height: 1.25;
  margin: 0 0 16px;
}

.top-hero-title em {
  font-style: normal;
  position: relative;
  display: inline-block;
}

.top-hero-title em::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 4px;
  background: var(--accent, #c8570a);
  border-radius: 2px;
}

.top-hero-sub {
  color: rgba(255,255,255,0.82);
  font-size: 15px;
  line-height: 1.75;
  margin: 0 0 28px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ── ヒーローCTA ── */
.top-hero-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent, #c8570a);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(200,87,10,0.3);
}

.top-hero-cta-btn::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid #ffffff;
  border-top: 2px solid #ffffff;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.top-hero-cta-btn:hover {
  background: var(--accent-hover, #a84308);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(200,87,10,0.35);
  color: #ffffff;
}

.top-hero-cta-btn:hover::after {
  transform: rotate(45deg) translateX(2px);
}

/* =============================================
   シーン別カード
   ============================================= */
.scenes-section {
  padding: 56px 0 40px;
  background: #ffffff;
}

.scenes-section .container {
  max-width: 960px;
}

.section-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary2, #2a4f7e);
  background: var(--primary-l, #e8f0f9);
  border: 1px solid rgba(30,58,95,0.12);
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 12px;
  font-family: var(--font-heading);
}

.scenes-heading {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(22px, 4vw, 28px);
  color: var(--ink, #1a2030);
  margin: 0 0 32px;
  text-align: center;
  display: block;
}

/* h2::after をリセット（base.css の下線を消す） */
.scenes-heading::after,
.tools-heading::after {
  display: none;
}

.scenes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.scene-card {
  background: var(--primary-ll, #f4f8fd);
  border: 1px solid rgba(30,58,95,0.08);
  border-radius: 14px;
  padding: 24px 20px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.scene-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.scene-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.scene-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink, #1a2030);
  line-height: 1.5;
  margin: 0 0 14px;
}

/* h3::after を抑制 */
.scene-title::after { display: none; }

.scene-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scene-links li {
  margin: 0;
}

.scene-links a {
  font-size: 13px;
  color: var(--primary2, #2a4f7e);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.scene-links a:hover {
  color: var(--accent, #c8570a);
}

/* =============================================
   ツール一覧セクション
   ============================================= */
.tools-section {
  padding: 48px 0 56px;
  background: var(--bg, #f7f5f0);
}

.tools-section .container {
  max-width: 960px;
}

.tools-heading {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(22px, 4vw, 28px);
  color: var(--ink, #1a2030);
  margin: 0 0 8px;
  text-align: center;
  display: block;
}

.tools-sub {
  text-align: center;
  font-size: 13px;
  color: var(--ink2, #445060);
  margin: 0 0 28px;
}

/* ── 検索バー ── */
.top-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 1.5px solid rgba(30,58,95,0.12);
  border-radius: 12px;
  padding: 10px 16px;
  max-width: 520px;
  margin: 0 auto 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.top-search-bar:focus-within {
  border-color: var(--primary2, #2a4f7e);
  box-shadow: 0 0 0 3px rgba(42,79,126,0.1);
}

.top-search-icon {
  flex-shrink: 0;
  color: var(--ink3, #8090a8);
}

.top-search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--ink, #1a2030);
  outline: none;
  min-width: 0;
}

.top-search-input::placeholder {
  color: var(--ink3, #8090a8);
  font-size: 14px;
}

.top-search-clear {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink3, #8090a8);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.top-search-clear.visible {
  display: flex;
}

.top-search-clear:hover {
  background: rgba(0,0,0,0.05);
}

/* ── 検索結果ドロップダウン ── */
.top-search-results {
  display: none;
  background: #ffffff;
  border: 1px solid rgba(30,58,95,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  max-width: 520px;
  margin: -12px auto 20px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 20;
  position: relative;
}

.top-search-results.open {
  display: block;
}

.sr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--ink, #1a2030);
  transition: background 0.12s;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.sr-item:last-child {
  border-bottom: none;
}

.sr-item:hover {
  background: var(--primary-ll, #f4f8fd);
}

.sr-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-l, #e8f0f9);
  border-radius: 10px;
}

.sr-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sr-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #1a2030);
}

.sr-desc {
  font-size: 12px;
  color: var(--ink2, #445060);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ink3, #8090a8);
}

/* ── カテゴリタブ ── */
.top-cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 32px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: center;
  flex-wrap: wrap;
}

.top-cat-tabs::-webkit-scrollbar {
  display: none;
}

.top-cat-tab {
  flex-shrink: 0;
  background: #ffffff;
  border: 1.5px solid rgba(30,58,95,0.12);
  color: var(--ink2, #445060);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
  white-space: nowrap;
}

.top-cat-tab:hover {
  border-color: var(--primary2, #2a4f7e);
  color: var(--primary, #1e3a5f);
  background: var(--primary-ll, #f4f8fd);
}

.top-cat-tab.active {
  background: var(--primary, #1e3a5f);
  border-color: var(--primary, #1e3a5f);
  color: #ffffff;
}

/* ── カテゴリセクション ── */
.tool-cat-section {
  margin-bottom: 40px;
}

.tool-cat-header {
  margin-bottom: 18px;
  padding-left: 4px;
}

.tool-cat-name {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 20px;
  color: var(--ink, #1a2030);
  margin: 0 0 4px;
}

/* h3::after を抑制 */
.tool-cat-name::after { display: none; }

.tool-cat-sub {
  font-size: 13px;
  color: var(--ink2, #445060);
  margin: 0;
}

/* ── ツールグリッド ── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ── ツールカード ── */
.tool-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(30,58,95,0.08);
  border-radius: 14px;
  padding: 24px 20px 18px;
  text-decoration: none;
  color: var(--ink, #1a2030);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  border-color: rgba(30,58,95,0.15);
}

.tool-card.featured {
  border-color: var(--accent, #c8570a);
  border-width: 2px;
}

.tool-card.featured::before {
  content: 'POPULAR';
  position: absolute;
  top: -1px;
  right: 16px;
  background: var(--accent, #c8570a);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0 0 6px 6px;
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--primary-l, #e8f0f9);
  border-radius: 12px;
  margin-bottom: 14px;
}

.card-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink, #1a2030);
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-desc {
  font-size: 13px;
  color: var(--ink2, #445060);
  line-height: 1.6;
  margin-bottom: 12px;
  flex: 1;
}

.feature-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary2, #2a4f7e);
  background: var(--primary-l, #e8f0f9);
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
}

.card-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid rgba(30,58,95,0.06);
}

.card-link-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #c8570a);
}

.card-arrow {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--accent, #c8570a);
  border-top: 2px solid var(--accent, #c8570a);
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.tool-card:hover .card-arrow {
  transform: rotate(45deg) translateX(3px);
}

.tool-card:hover .card-link-text {
  color: var(--accent-hover, #a84308);
}

/* =============================================
   検索オーバーレイ
   ============================================= */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-overlay-inner {
  background: #ffffff;
  border-radius: 16px;
  width: 90%;
  max-width: 560px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  overflow: hidden;
}

.search-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  color: var(--ink3, #8090a8);
}

.overlay-search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 16px;
  font-family: var(--font-body);
  color: var(--ink, #1a2030);
  outline: none;
}

.overlay-search-input::placeholder {
  color: var(--ink3, #8090a8);
}

.overlay-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink3, #8090a8);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.overlay-close-btn:hover {
  background: rgba(0,0,0,0.05);
}

.overlay-search-results {
  max-height: 360px;
  overflow-y: auto;
}

.overlay-search-results .sr-item {
  padding: 14px 20px;
}

/* =============================================
   レスポンシブ
   ============================================= */
@media (max-width: 768px) {
  /* ドロワーモードに切り替え — base.css のモバイルスタイルを継承 */
  .top-page .site-nav {
    position: fixed;
    top: 56px;
    right: 0;
    width: 260px;
    height: calc(100dvh - 56px);
    background: var(--hdr-bg, #1e3a5f);
    border-left: 1px solid rgba(255,255,255,0.12);
    box-shadow: -4px 0 16px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s ease, visibility .3s;
    z-index: 200;
    pointer-events: none;
  }
  .top-page .site-nav.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .top-page .site-nav a {
    display: block;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.9);
    white-space: normal;
  }
  .top-page .site-nav a:first-child,
  .top-page .site-nav a:last-child {
    display: block;
  }
  .top-page .site-nav a:hover,
  .top-page .site-nav a:active {
    background: rgba(255,255,255,0.1);
    color: #fff;
  }

  /* モバイル追加リンク（nav-mobile-only）ネイビードロワー用 */
  .top-page .site-nav .nav-mobile-only {
    display: block;
    color: rgba(255,255,255,0.9);
  }
  .top-page .site-nav .nav-mobile-only:first-of-type {
    margin-top: 4px;
    border-top: 2px solid rgba(255,255,255,0.18);
    padding-top: 14px;
  }

  /* ドロワー内CTA（ネイビー背景用） */
  .top-page .site-nav .nav-drawer-cta {
    display: block;
    margin: 12px 16px;
    padding: 14px 16px;
    background: var(--color-cta, #ff7a00);
    color: #fff !important;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    border-radius: 8px;
    text-decoration: none;
    border-bottom: none !important;
  }

  /* ハンバーガーバーの色（白背景用→白に） */
  .top-page .nav-toggle-bar {
    background: rgba(255,255,255,0.85);
  }

  /* 検索アイコン非表示 */
  .top-page .search-icon-btn {
    display: none;
  }

  /* オーバーレイ */
  .top-page .nav-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    width: 100%;
    height: calc(100dvh - 56px);
    background: rgba(0,0,0,.4);
    z-index: 199;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
  }
  .top-page .nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
  }

  /* ヒーロー */
  .top-hero {
    padding: 40px 20px 36px;
  }

  /* シーン */
  .scenes-section {
    padding: 40px 0 32px;
  }

  .scenes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* ツール */
  .tools-section {
    padding: 36px 0 44px;
  }

  .top-cat-tabs {
    justify-content: flex-start;
    flex-wrap: nowrap;
    padding: 0 0 8px;
    margin-bottom: 24px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .tool-card {
    padding: 18px 16px 14px;
  }

  .card-icon {
    width: 40px;
    height: 40px;
    font-size: 22px;
    border-radius: 10px;
    margin-bottom: 10px;
  }

  .card-name {
    font-size: 14px;
  }

  .card-desc {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .feature-tag {
    font-size: 10px;
    padding: 2px 8px;
  }

}

@media (max-width: 480px) {
  .scenes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .tool-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .scene-card {
    padding: 14px 10px;
  }
  .scene-icon {
    font-size: 24px;
    margin-bottom: 6px;
  }
  .scene-title {
    font-size: 12px;
    margin-bottom: 6px;
  }
  .scene-links {
    font-size: 11px;
  }
  .scene-links li {
    margin-bottom: 2px;
  }

  .tool-card {
    padding: 14px 10px 10px;
  }
  .card-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
    border-radius: 8px;
    margin-bottom: 8px;
  }
  .card-name {
    font-size: 12px;
    line-height: 1.4;
  }
  .card-desc {
    font-size: 11px;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card-cta {
    font-size: 11px;
  }

  .top-hero-cta-btn {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .scene-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    row-gap: 4px;
  }

  .scene-icon {
    grid-row: 1 / 3;
    align-self: center;
    margin-bottom: 0;
  }

  .scene-title {
    margin-bottom: 0;
  }
}
