/* =====================================================
   お金の悩みドットコム — メインスタイル（モバイルファースト）
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:   #0f1f4b;
  --navy2:  #162d6e;
  --gold:   #f5c842;
  --gold2:  #e8a030;
  --white:  #ffffff;
  --bg:     #f4f2ee;
  --text:   #1a1a2e;
  --text2:  #5a5a7a;
  --text3:  #9a9aaa;
  --border: #e0dcd4;
  --r:      10px;
  --rl:     14px;
}

html { font-size: 15px; }
body { font-family: 'Noto Sans JP', sans-serif; background: var(--bg); color: var(--text); line-height: 1.7; }
a { color: inherit; text-decoration: none; }
body.nav-open { overflow: hidden; }

/* ---- Topbar ---- */
.topbar { background: var(--navy); text-align: center; font-size: 11px; color: #8aabce; padding: 5px 12px; }

/* ---- Header ---- */
header { background: var(--navy); position: sticky; top: 0; z-index: 200; box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.header-inner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; max-width: 1040px; margin: 0 auto; }
.logo { flex: 1; min-width: 0; }
.logo-ja { display: block; font-family: 'Noto Serif JP', serif; font-size: clamp(14px, 4vw, 20px); color: var(--gold); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-en { display: block; font-size: 9px; color: #7a9cc4; letter-spacing: .1em; margin-top: 2px; }

.header-search { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 24px; padding: 7px 14px; width: 200px; transition: width .2s; }
.header-search:focus-within { width: 240px; }
.header-search input { background: none; border: none; outline: none; color: #fff; font-size: 13px; width: 100%; font-family: inherit; }
.header-search input::placeholder { color: #6a8ab0; }
.search-btn { background: none; border: none; cursor: pointer; font-size: 15px; padding: 0; line-height: 1; flex-shrink: 0; }

/* Hamburger */
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; flex-shrink: 0; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--gold); border-radius: 2px; transition: all .25s; }

/* ---- Nav (Desktop) ---- */
nav#global-nav { background: var(--navy2); border-top: 1px solid rgba(255,255,255,.07); }
.nav-inner { display: flex; max-width: 1040px; margin: 0 auto; overflow-x: auto; scrollbar-width: none; }
.nav-inner::-webkit-scrollbar { display: none; }
.nav-item { display: flex; align-items: center; gap: 5px; padding: 11px 14px; font-size: 12px; color: #a8c4e8; white-space: nowrap; position: relative; transition: color .15s; }
.nav-item:hover { color: var(--gold); }
.nav-item.active { color: var(--gold); }
.nav-item.active::after { content: ''; position: absolute; bottom: 0; left: 8px; right: 8px; height: 2px; background: var(--gold); border-radius: 2px; }

.nav-backdrop { display: none; }

/* ---- Main layout ---- */
main { max-width: 1040px; margin: 0 auto; padding: 16px 12px 40px; }
.two-col { display: grid; grid-template-columns: 1fr 288px; gap: 20px; align-items: start; }

/* ---- Hero ---- */
.hero { background: linear-gradient(135deg, var(--navy) 55%, #1a3a7a); border-radius: var(--rl); padding: clamp(20px,5vw,36px); margin-bottom: 24px; position: relative; overflow: hidden; }
.hero::before { content: '¥'; position: absolute; right: -10px; top: 50%; transform: translateY(-50%); font-size: clamp(100px,25vw,200px); font-family: 'Noto Serif JP', serif; font-weight: 700; color: rgba(245,200,66,.05); pointer-events: none; line-height: 1; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: center; }
.hero-badge { display: inline-flex; align-items: center; gap: 5px; background: rgba(245,200,66,.15); border: 1px solid rgba(245,200,66,.3); border-radius: 20px; padding: 4px 12px; font-size: 11px; color: var(--gold); margin-bottom: 12px; }
.hero h1 { font-family: 'Noto Serif JP', serif; font-size: clamp(18px,4vw,24px); color: #fff; font-weight: 700; line-height: 1.6; margin-bottom: 10px; }
.hero h1 em { color: var(--gold); font-style: normal; }
.hero-desc { font-size: 12px; color: #8aabce; line-height: 1.9; }
.hero-stats { display: flex; gap: 18px; margin-top: 16px; }
.stat-num { font-family: 'Noto Serif JP', serif; font-size: clamp(18px,5vw,24px); color: var(--gold); font-weight: 700; display: block; }
.stat-unit { font-size: 10px; color: #8aabce; }

/* Hero ranking card */
.hero-card { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: var(--r); padding: 16px; }
.hero-card-title { font-size: 11px; color: #7a9cc4; margin-bottom: 12px; }
.pick-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); text-decoration: none; }
.pick-item:last-child { border: none; }
.pick-rank { font-family: 'Noto Serif JP', serif; font-size: 20px; font-weight: 700; color: var(--gold); min-width: 24px; text-align: center; }
.pick-name { font-size: 12px; color: #e0eaf5; font-weight: 500; line-height: 1.4; }
.pick-sub { font-size: 10px; color: #7a9cc4; margin-top: 2px; }
.pick-badge { margin-left: auto; background: rgba(245,200,66,.15); border-radius: 4px; padding: 2px 7px; font-size: 10px; color: var(--gold); white-space: nowrap; flex-shrink: 0; }

/* ---- Section ---- */
.section { margin-bottom: 28px; }
.sec-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
.sec-title { font-family: 'Noto Serif JP', serif; font-size: clamp(15px,4vw,17px); font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.sec-title::before { content: ''; display: block; width: 3px; height: 20px; background: var(--gold); border-radius: 2px; flex-shrink: 0; }
.sec-more { font-size: 12px; color: #3a6abf; white-space: nowrap; }

/* ---- Category grid ---- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 8px; text-align: center; transition: all .2s; }
.cat-card:hover, .cat-card:focus { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 6px 18px rgba(15,31,75,.1); }
.cat-icon { font-size: clamp(22px,6vw,28px); margin-bottom: 6px; }
.cat-name { font-size: clamp(10px,2.5vw,12px); font-weight: 500; color: var(--navy); line-height: 1.4; }
.cat-count { font-size: 10px; color: var(--text3); margin-top: 3px; }

/* ---- Article grid ---- */
.article-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.article-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; transition: all .2s; }
.article-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(15,31,75,.1); }
.article-thumb { aspect-ratio: 16/8; display: flex; align-items: center; justify-content: center; font-size: clamp(32px,8vw,44px); position: relative; flex-shrink: 0; }
.article-label { position: absolute; top: 8px; left: 8px; background: var(--navy); color: var(--gold); font-size: 9px; padding: 2px 8px; border-radius: 20px; }
.article-body { padding: 12px; flex: 1; display: flex; flex-direction: column; }
.article-cat { font-size: 10px; color: #3a6abf; font-weight: 500; margin-bottom: 5px; }
.article-title { font-size: clamp(12px,3vw,13px); font-weight: 700; color: var(--text); line-height: 1.6; flex: 1; }
.article-meta { display: flex; gap: 8px; font-size: 10px; color: var(--text3); margin-top: 8px; }

/* ---- Sidebar ---- */
.sidebar-widget { background: var(--white); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 14px; }
.widget-head { background: var(--navy); padding: 10px 14px; font-size: 12px; color: var(--gold); font-weight: 700; }
.widget-body { padding: 12px 14px; }
.rank-list {}
.rank-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f4f2ee; transition: background .15s; }
.rank-item:last-child { border: none; }
.rank-item:hover { background: #faf9f7; }
.rank-num { font-family: 'Noto Serif JP', serif; font-size: 20px; font-weight: 700; min-width: 26px; text-align: center; }
.r1{color:var(--gold2)}.r2{color:#7a9cc4}.r3{color:#b8775a}.r4,.r5{color:#ccc}
.rank-title { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.4; }
.rank-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }
.rank-arrow { margin-left: auto; color: #ccc; font-size: 16px; }
.cat-list-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f4f2ee; font-size: 13px; color: var(--text); }
.cat-list-item:last-child { border: none; }

/* ---- Banner ---- */
.banner { background: linear-gradient(120deg, var(--navy), #1a3a7a); border-radius: var(--r); padding: 20px; margin-bottom: 14px; position: relative; overflow: hidden; }
.banner::after { content: '¥'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 70px; font-family: 'Noto Serif JP', serif; color: rgba(245,200,66,.07); font-weight: 700; pointer-events: none; }
.banner-label { font-size: 10px; color: var(--gold); letter-spacing: .1em; margin-bottom: 8px; }
.banner-title { font-family: 'Noto Serif JP', serif; font-size: 14px; color: #fff; font-weight: 700; line-height: 1.6; margin-bottom: 12px; }
.banner-btn { display: inline-block; background: var(--gold); color: var(--navy); font-size: 12px; font-weight: 700; padding: 8px 18px; border-radius: 20px; }

/* ---- Article detail ---- */
.article-detail { background: var(--white); border: 1px solid var(--border); border-radius: var(--rl); overflow: hidden; }
.article-hero { aspect-ratio: 2/1; max-height: 220px; display: flex; align-items: center; justify-content: center; font-size: clamp(60px,15vw,90px); }
.article-content-wrap { padding: clamp(16px,5vw,32px); }
.cat-badge { display: inline-flex; align-items: center; gap: 5px; background: #e6f1fb; color: #1a5a9a; font-size: 11px; padding: 4px 12px; border-radius: 20px; margin-bottom: 12px; }
.article-content-wrap h1 { font-family: 'Noto Serif JP', serif; font-size: clamp(18px,5vw,26px); font-weight: 700; color: var(--navy); line-height: 1.5; margin-bottom: 12px; }
.article-meta-row { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text3); margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.article-body-content { line-height: 2; }
.article-body-content h2 { font-family: 'Noto Serif JP', serif; font-size: clamp(16px,4vw,20px); font-weight: 700; color: var(--navy); margin: 28px 0 12px; padding-left: 14px; border-left: 4px solid var(--gold); }
.article-body-content h3 { font-size: 15px; font-weight: 700; margin: 20px 0 8px; color: var(--navy); }
.article-body-content p { margin-bottom: 14px; }
.article-body-content ul, .article-body-content ol { padding-left: 22px; margin-bottom: 14px; }
.article-body-content li { margin-bottom: 5px; }
.article-body-content table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 13px; display: block; overflow-x: auto; }
.article-body-content th { background: var(--navy); color: var(--gold); padding: 10px 12px; text-align: left; white-space: nowrap; }
.article-body-content td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.article-body-content tr:nth-child(even) td { background: #faf9f7; }
.article-body-content a { color: #3a6abf; text-decoration: underline; }
.excerpt-box { background: #f8f7f4; border-radius: 8px; padding: 14px 16px; margin-bottom: 20px; font-size: 13px; color: var(--text2); line-height: 1.8; border-left: 3px solid var(--gold); }

/* ---- Breadcrumb ---- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--text3); margin-bottom: 14px; }
.breadcrumb a { color: var(--text3); } .breadcrumb a:hover { color: var(--navy); }

/* ---- Search ---- */
.search-hero { background: var(--navy); border-radius: var(--rl); padding: clamp(20px,5vw,32px); text-align: center; margin-bottom: 20px; }
.search-hero h1 { font-family: 'Noto Serif JP', serif; font-size: clamp(16px,5vw,22px); color: #fff; margin-bottom: 16px; }
.search-form { display: flex; gap: 8px; max-width: 480px; margin: 0 auto; }
.search-form input { flex: 1; padding: 12px 16px; border-radius: 24px; border: none; font-size: 14px; font-family: inherit; outline: none; }
.search-form button { padding: 12px 20px; background: var(--gold); color: var(--navy); border: none; border-radius: 24px; font-weight: 700; cursor: pointer; font-family: inherit; white-space: nowrap; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--white); font-size: 13px; color: var(--text2); transition: all .15s; }
.page-btn:hover { border-color: var(--navy); color: var(--navy); }
.page-btn.active { background: var(--navy); color: var(--gold); border-color: var(--navy); }

/* ---- Empty ---- */
.empty { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ---- Footer ---- */
footer { background: var(--navy); padding: clamp(24px,5vw,36px) 16px; }
.footer-inner { max-width: 1040px; margin: 0 auto; }
.footer-logo { font-family: 'Noto Serif JP', serif; font-size: 18px; color: var(--gold); font-weight: 700; margin-bottom: 8px; }
.footer-desc { font-size: 12px; color: #6a8ab0; line-height: 1.8; margin-bottom: 16px; max-width: 480px; }
.footer-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.footer-cats a { background: rgba(255,255,255,.06); border-radius: 20px; padding: 5px 12px; font-size: 11px; color: #8aabce; transition: all .15s; }
.footer-cats a:hover { background: rgba(245,200,66,.15); color: var(--gold); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.footer-links a { font-size: 11px; color: #6a8ab0; }
.footer-links a:hover { color: var(--gold); }
.footer-copy { font-size: 10px; color: #4a6a8a; }

/* ======================================================
   モバイル (〜640px)
   ====================================================== */
@media (max-width: 640px) {
  /* ヘッダー：検索は隠してハンバーガー表示 */
  .header-search { display: none; }
  .hamburger { display: flex; }

  /* ナビ：ドロワー化 */
  nav#global-nav {
    position: fixed; top: 0; right: -100%; width: min(80vw, 280px);
    height: 100vh; z-index: 300; background: var(--navy2);
    overflow-y: auto; transition: right .3s ease;
    padding-top: 60px;
  }
  nav#global-nav.open { right: 0; }
  nav#global-nav .nav-inner { flex-direction: column; max-width: none; overflow: visible; }
  nav#global-nav .nav-item { font-size: 14px; padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
  nav#global-nav .nav-item.active::after { display: none; }
  nav#global-nav .nav-item.active { background: rgba(245,200,66,.08); }

  /* バックドロップ */
  .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 299; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .nav-backdrop.show { opacity: 1; pointer-events: auto; }

  /* レイアウト */
  .two-col { grid-template-columns: 1fr; }
  .sidebar { display: none; } /* サイドバーは記事詳細では非表示 */
  .hero-grid { grid-template-columns: 1fr; }
  .hero-card { display: none; }

  /* カテゴリ：2列 */
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* 記事：1列 */
  .article-grid { grid-template-columns: 1fr; }

  /* 記事カードを横並びに */
  .article-card { flex-direction: row; }
  .article-thumb { width: 90px; min-width: 90px; aspect-ratio: 1; font-size: 30px; }
  .article-label { display: none; }
  .article-body { padding: 10px 12px; }

  /* 検索フォーム */
  .search-form { flex-direction: column; }
  .search-form input, .search-form button { width: 100%; }

  /* モバイル用検索ボックスをヘッダーに追加 */
  .header-inner { flex-wrap: wrap; padding: 10px 14px 8px; }
  .mobile-search { order: 3; width: 100%; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); border-radius: 20px; padding: 7px 14px; margin-top: 6px; }
  .mobile-search input { background: none; border: none; outline: none; color: #fff; font-size: 13px; width: 100%; font-family: inherit; }
  .mobile-search input::placeholder { color: #6a8ab0; }

  /* ヒーロー */
  .hero { padding: 20px 16px; }
}

/* タブレット (641px 〜 900px) */
@media (min-width: 641px) and (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .sidebar-widget { margin-bottom: 0; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
}

/* デスクトップ (901px〜) */
@media (min-width: 901px) {
  .cat-grid { grid-template-columns: repeat(6, 1fr); }
  .article-grid { grid-template-columns: repeat(3, 1fr); }
}
