/* ============================================================
   チョクモのツールボックス — top.css
   ============================================================ */

/* ── リセット ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── デザイントークン ── */
:root {
  /* カラー（わたるくんと共通） */
  --bg:           #FDF4EA;
  --surface:      #FFFFFF;
  --surface2:     #F5EAD8;
  --border:       rgba(73,167,206,0.15);
  --border2:      rgba(73,167,206,0.30);
  --text:         #2C2C2C;
  --muted:        #7A7A7A;
  --muted-light:  #B0B0B0;
  --accent:       #49A7CE;
  --accent-dark:  #3388AD;
  --accent-light: rgba(73,167,206,0.10);

  /* 角丸 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ── ベース ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  min-height: 100vh;
  line-height: 1.7;
}

/* ============================================================
   ヘッダー
   ============================================================ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  padding: 0 2rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.2rem 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: block;
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.logo-text small {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  font-family: 'Noto Sans JP', sans-serif;
  letter-spacing: 0;
}

/* ============================================================
   ヒーロー
   ============================================================ */
.hero {
  background: linear-gradient(135deg, #FDF4EA 0%, #FEF1DA 50%, #FDF4EA 100%);
  border-bottom: 2px solid rgba(73,167,206,0.15);
  padding: 3.5rem 2rem;
  text-align: center;
}

.hero-inner {
  max-width: 640px;
  margin: 0 auto;
}

.hero-eyebrow {
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-lead {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.85;
  max-width: 520px;
  margin: 0 auto;
}

/* ============================================================
   カテゴリフィルター
   ============================================================ */
.filter-section {
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.filter-inner {
  max-width: 960px;
  margin: 0 auto;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.filter-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.filter-btn--active:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

/* ============================================================
   ツール一覧
   ============================================================ */
.tools-section {
  padding: 3.5rem 2rem 5rem;
}

.tools-inner {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  row-gap: 2rem;
}

/* ── カードラッパー（aタグ＋説明文をまとめる） ── */
.tool-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tool-card-wrap .tool-desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.65;
  width: 90%;
  padding-left: 1.25rem;
}

/* ── ツールカード共通 ── */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

/* ── 公開中カード ── */
.tool-card--active {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(73,167,206,0.12);
}

.tool-card--active:hover {
  background: var(--accent-light);
  box-shadow: 0 8px 28px rgba(73,167,206,0.20);
  transform: translateY(-2px);
}

/* ── 近日公開カード ── */
.tool-card--soon {
  padding-bottom: 1.25rem;
  opacity: 0.6;
}

/* ── カード内上部レイアウト（テキスト＋イラスト横並び） ── */
.tool-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 1;
  margin-right: -1.2rem;
}

.tool-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

/* ── カード内イラスト ── */
.tool-illust {
  flex-shrink: 0;
  width: 120px;
  display: flex;
  align-items: flex-end;
  align-self: flex-end;
}

.tool-illust img {
  width: 120px;
  height: auto;
  display: block;
  margin-bottom: -9px;
}

/* ── ステータスバッジ ── */
.tool-status {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
  width: fit-content;
}

.tool-status--live {
  background: rgba(45,168,112,0.12);
  color: #2DA870;
}

.tool-status--css {
  background: rgba(73,167,206,0.12);
  color: var(--accent-dark);
}

.tool-status--soon {
  background: rgba(73,167,206,0.10);
  color: var(--accent);
}

/* ── ツール名 ── */
.tool-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.tool-name--muted {
  color: var(--muted);
}

/* ── 説明文 ── */
.tool-desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
}

.tool-desc--muted {
  color: var(--muted-light);
}

/* ============================================================
   開発コスト
   ============================================================ */
.cost-section {
  background: var(--surface2);
  border-top: 1px solid var(--border2);
  padding: 3.5rem 2rem;
}

.cost-inner {
  max-width: 960px;
  margin: 0 auto;
}

.cost-heading {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.9rem;
}

.cost-lead {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.85;
  margin-bottom: 1.75rem;
  max-width: 680px;
}

.cost-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.cost-stat {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 180px;
}

.cost-stat__label {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: 'Noto Sans JP', sans-serif;
}

.cost-stat__value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1.1;
}

.cost-stat__unit {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 2px;
}

.cost-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-md);
}

.cost-link {
  color: var(--accent);
  text-decoration: none;
}

.cost-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
  display: block; /* wrapの幅を参照させる */
}

/* thead・tfoot固定、tbodyのみスクロール */
.cost-table thead,
.cost-table tfoot {
  display: block;
  width: 100%;
}

.cost-table thead tr,
.cost-table tfoot tr,
.cost-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.cost-table tbody {
  display: block;
  max-height: 440px; /* 約10行分 */
  overflow-y: auto;
  width: 100%;
}

/* スクロールバーのスタイル（Webkit系） */
.cost-table tbody::-webkit-scrollbar {
  width: 6px;
}
.cost-table tbody::-webkit-scrollbar-track {
  background: transparent;
}
.cost-table tbody::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}

.cost-table thead tr {
  border-bottom: 2px solid var(--border2);
}

.cost-table tfoot tr {
  border-top: 2px solid var(--border2);
}

.cost-table th,
.cost-table td {
  padding: 0.75rem 1rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
}

.cost-table th {
  color: var(--muted);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* 列幅：2・3列目を固定px、1列目は残り全部 */
.cost-table th:first-child,
.cost-table td:first-child {
  width: calc(100% - 240px); /* 2・3列目の合計を引いた残り */
}

.cost-table th:nth-child(2),
.cost-table td:nth-child(2) {
  width: 120px;
  text-align: right;
  white-space: nowrap;
}

.cost-table th:nth-child(3),
.cost-table td:nth-child(3) {
  width: 120px;
  text-align: right;
  white-space: nowrap;
}

.cost-table td:nth-child(2),
.cost-table td:nth-child(3) {
  font-family: 'Outfit', sans-serif;
  font-variant-numeric: tabular-nums;
}

.cost-table-total td,
.cost-table tfoot td {
  border-top: 2px solid var(--border2);
  border-bottom: none;
  font-weight: 700;
}

/* ============================================================
   ヘッダー 累計利用回数
   ============================================================ */
.header-usage-count {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--muted);
  font-family: 'Noto Sans JP', sans-serif;
  white-space: nowrap;
}

.header-usage-count strong {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  color: var(--accent-dark);
}

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 768px) {
  .tools-inner {
    grid-template-columns: 1fr;
  }

  /* カード全体の最低高さを確保 */
  .tool-card {
    min-height: 120px;
  }

  /* イラストをスマホでも表示 */
  .tool-illust {
    display: flex;
    width: 100px;
  }

  .tool-illust img {
    width: 100px;
  }

  /* ツール名を2行表示に（長くても折り返す） */
  .tool-name {
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: normal;
    word-break: auto-phrase;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  .header-usage-count { display: none; }
}
