/* Dark mode style — Header size matched to Version1 */
:root{
  --accent:#64b5f6;
  --muted:#9aa4b2;
  --bg:#071019;
  --card:#0f1720;
  --surface:#0b1620;
  --border:#162330;
  --text:#e6eef6;
  --muted-2:#b6c2cc;
  --max-width:1100px;
  --header-height:64px; /* 初期値（JS が実測で上書き） */
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "メイリオ", Meiryo, sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:linear-gradient(180deg,var(--bg),#031219 120%);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.6;
  padding-top: var(--header-height);
  transition: background-color .2s, color .2s;
}

/* ハッシュ遷移用パディング（ヘッダー高さそのまま） */
html {
  scroll-padding-top: var(--header-height);
}
[id], [name] {
  scroll-margin-top: calc(var(--header-height) + 0.5rem);
}
h1,h2,h3,h4,h5,h6 {
  scroll-margin-top: calc(var(--header-height) + 0.5rem);
}

.container{
  max-width:var(--max-width);
  margin:0 auto;
  padding:1rem;
}

/* 固定ヘッダー（Version1 相当の高さ） */
.site-header{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:1000;
  background:linear-gradient(90deg, rgba(15,23,32,0.92), rgba(11,22,30,0.86));
  border-bottom:1px solid rgba(255,255,255,0.03);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(3,6,10,0.6);
}
.site-header .container{
  display:flex;
  align-items:center;
  gap:1rem;
  height:auto;
  padding:0.6rem 1rem; /* Version1 と同じ */
}

/* サイトタイトル Ruichiji - Version1 相当 */
.site-title{
  margin:0;
  font-size:1.05rem;     /* Version1 のサイズ */
  font-weight:700;
  letter-spacing:0.2px;
  white-space:nowrap;
  color:var(--text);
  text-decoration:none; /* 下線なし */
  display:inline-block;
}

.site-title a {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}

/* social icon links in header */
.main-nav .social-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  text-decoration:none;
  padding:.3rem .45rem;
  border-radius:6px;
  transition: color .12s, background-color .12s, transform .06s;
  margin-right: 0.25rem;
}

/* Ensure images inside social links are sized consistently by CSS (overrides inline width/height) */
.main-nav .social-link img {
  display:block;
  width:18px;
  height:18px;
  object-fit:contain;
}

/* Make niconico logo slightly larger for better visibility */
.main-nav .social-link-nico img {
  width:35px !important;
  height:35px !important;
}

/* Optional: slightly larger X logo (if desired) */
/* .main-nav .social-link-x img { width:20px !important; height:20px !important; } */

.main-nav .social-link svg { display:block; width:18px; height:18px; }
.main-nav .social-link:hover { color:var(--accent); background: rgba(100,181,246,0.04); transform: translateY(-1px); }

/* ハンバーガーボタン（デフォルトは非表示、モバイルで表示）
   修正: 表示時に縦積みになるよう flex-direction: column を指定 */
.hamburger {
  display: none; /* shown on mobile via @media */
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: .4rem;
  border-radius: 6px;
  cursor: pointer;

  /* make the button a column flex container so the three bars stack vertically */
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem; /* spacing between hamburger and site title */
}
.hamburger:focus {
  outline: 3px solid rgba(100,181,246,0.18);
  outline-offset: 2px;
  border-radius: 6px;
}

/* three-bar icon lines — each is a horizontal short bar; stacked vertically by parent */
.hamburger .bar {
  display:block;
  width:22px;     /* adjust length of each bar (長さは必要に応じて調整してください) */
  height:2px;
  background:currentColor;
  margin:4px 0;   /* vertical spacing between bars */
  border-radius:2px;
}

/* When nav is open, change hamburger color */
body.nav-open .hamburger { color: var(--accent); }

/* ホーム専用リストの区切り・余白 */
#home-list {
  margin-top: 0.25rem;
}
#home-list ul { padding: 0; margin: 0; }

/* Home top contact notice */
.home-contact {
  background: linear-gradient(180deg, rgba(100,181,246,0.03), rgba(100,181,246,0.01));
  border: 1px solid rgba(100,181,246,0.05);
  color: var(--muted-2);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  font-size: 0.98rem;
}

/* 各項目のベーススタイル（枠無し、薄い区切り） */
#home-list .item {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.04); /* 薄い区切り線 */
  padding: 0.9rem 0;
  transition: background-color .12s, transform .08s;
  display: block;
}

/* 最後の項目だけ下線を消す */
#home-list .item:last-child {
  border-bottom: none;
}

/* ホバーで軽い強調（枠ではなく背景のトーン変化） */
#home-list .item:hover {
  background: linear-gradient(90deg, rgba(100,181,246,0.02), rgba(58,160,255,0.01));
  transform: translateY(-1px);
}

/* 項目内の見出し調整 */
#home-list h2 {
  margin: 0 0 .25rem 0;
  font-size: 1.08rem; /* 通常のリスト見出しサイズ */
  font-weight: 700;
}

/* ---- CHANGED: remove broad first-child rule and use explicit class for outer headings ---- */
/* Use .section-heading on the outer h2 elements (in index.html) to make them visually larger */
#home-list .section-heading {
  font-size: 1.36rem; /* 大きめ（要調整可） */
  letter-spacing: 0.2px;
}

/* 見出し内のリンク装飾調整（クリック領域を広げる） */
#home-list h2 a {
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  padding: .05rem 0;
}

/* プレビュー本文（薄め） */
#home-list .preview {
  color: var(--muted-2);
  margin-top: .35rem;
  font-size: .96rem;
  line-height: 1.55;
}

/* サムネ非表示（ホームでは視線をテキストに集中させる） */
#home-list .thumb { display: none; }

#home-list #latest-album .thumb,
#home-list #latest-album img.thumb {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  float: left;
  margin-right: 12px;
  border-radius: 6px;
}

/* preview 内のテキストがサムネに回り込むように微調整 */
#home-list #latest-album .preview {
  margin-left: 0; /* inline markup で float を使っているため余分な左マージンは避ける */
  overflow: hidden; /* float 解除の保険 */
}

/* ====== Discography list: larger album thumbnails ====== */
/* discography ページ内のカード中のサムネを大きくする（#discography-list を想定） */
#discography-list .card img.thumb,
#discography-list .card .thumb {
  width: 180px;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0; /* フレックスレイアウト内でも縮まないように */
}

/* Make #discography-list display a grid with max 2 columns */
#discography-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}
/* On small screens, fall back to single column */
@media (max-width: 720px) {
  #discography-list {
    grid-template-columns: 1fr;
  }
}

/* card 内のレイアウトが崩れないように、img を左に寄せるルール（既存の inline style と併用されてもOK）*/
#discography-list .card > div { align-items: center; }

/* === 新規追加: Discography 個別ページ（アルバムページ）での大きなカバー表示 ===
   個別アルバムページの <body> に data-album-id がセットされている前提で適用します。
   ここでサイズを大きく設定し、モバイルでは適切に縮小します。 */
body[data-album-id] .card img.thumb,
body[data-album-id] .card .thumb {
  width: 320px;   /* 個別ページでの大きい表示幅 */
  height: 320px;  /* 個別ページでの大きい表示高さ */
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  margin-bottom: 0.6rem;
}

/* 個別ページ内で横並びレイアウトの場合にサムネを左に寄せる補助 */
body[data-album-id] .card > div { display: flex; gap: 1rem; align-items: flex-start; }

/* album-page 用: 個別アルバムページのカバーを大きく表示（.album-page クラス対応） */
.album-page .card img.thumb,
.album-page .card .thumb {
  width: 320px;
  height: 320px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  margin-bottom: 0.6rem;
}

/* Album page レイアウト補助（横並びにする等） */
.album-page .card > div { display: flex; gap: 1rem; align-items: flex-start; }

/* レスポンシブ: タブレット / モバイル用の縮小と縦並び対応 */
@media (max-width: 920px) {
  .album-page .card img.thumb,
  .album-page .card .thumb,
  body[data-album-id] .card img.thumb,
  body[data-album-id] .card .thumb {
    width: 240px !important;
    height: 240px !important;
  }
}

/* モバイルではジャケットを上、テキストを下に縦並びにする */
@media (max-width: 520px) {
  .album-page .card img.thumb,
  .album-page .card .thumb,
  body[data-album-id] .card img.thumb,
  body[data-album-id] .card .thumb {
    width: 100% !important;
    height: auto !important;
    max-height: 360px !important;
    border-radius: 8px !important;
    margin-bottom: 0.6rem;
  }

  /* stacked layout: image on top, then title / artists / description */
  .album-page .card > div,
  body[data-album-id] .card > div {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
  }
}

/* スマホでは画像をやや小さく */
@media (max-width: 520px) {
  #home-list #latest-album .thumb,
  #home-list #latest-album img.thumb {
    width: 96px;
    height: 96px;
  }
  #discography-list .card img.thumb,
  #discography-list .card .thumb {
    width: 120px;
    height: 120px;
  }
}

/* モバイル調整 */
@media (max-width:520px){
  /* Show hamburger on mobile and hide main-nav by default */
  .hamburger { display: inline-flex; }

  /* Enhanced mobile nav behavior:
     - ensure nav is hidden by default on mobile (use !important to override other rules)
     - when body.nav-open is present, force show nav (also !important)
     - position nav as an overlay panel under the header
  */
  .main-nav {
    display: none !important;
    width: 100%;
    flex-direction: column;
    gap: .25rem;
    padding: .6rem;
    background: rgba(6,12,16,0.96);
    border-top: 1px solid rgba(255,255,255,0.02);
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--header-height));
    z-index: 1100;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
  }
  /* When open, show as a stacked panel (force with !important) */
  body.nav-open .main-nav {
    display: flex !important;
  }

  /* prevent background scrolling when menu open */
  body.nav-open { overflow: hidden; }

  #home-list .item { padding: 0.8rem 0; }
  /* Mobile: apply smaller size to explicit .section-heading (not to inner h2) */
  #home-list .section-heading { font-size: 1.26rem; }
  #home-list h2 { font-size: 1.02rem; }

  /* make social links wrap nicely in mobile nav */
  .main-nav .social-link { margin-right: 0; padding: .4rem; }

  /* mobile nav link styles */
  .main-nav a {
    display: block;
    padding: .7rem 1rem;
    font-size: 1rem;
    color: var(--text);
    background: transparent;
  }
  .main-nav a:hover { background: rgba(255,255,255,0.02); color:var(--accent); }
}

/* メニューバー */
.main-nav{
  margin-left:auto;
  display:flex;
  gap:.25rem;
  align-items:center;
  flex-wrap:wrap;
}
.main-nav a{
  color:var(--muted);
  text-decoration:none;
  padding:.45rem .6rem;
  border-radius:8px;
  font-size:.95rem;
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  transition: color .12s, background-color .12s, transform .06s;
}
.main-nav a:hover{
  color:var(--accent);
  background:rgba(100,181,246,0.06);
  transform:translateY(-1px);
}
.main-nav a.active{
  color:var(--accent);
  background:linear-gradient(90deg, rgba(58,160,255,0.08), rgba(100,181,246,0.04));
  box-shadow: inset 0 -2px 0 rgba(58,160,255,0.06);
}

/* Grid & Lists */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:1rem;
  margin-top:1rem;
}
.card{
  background:linear-gradient(180deg,var(--card), var(--surface));
  padding:1rem;
  border-radius:10px;
  box-shadow: 0 4px 18px rgba(2,6,12,0.6);
  border: 1px solid var(--border);
}
.list{
  margin-top:1rem;
}
.preview{margin:0.5rem 0}

/* list items */
.item{
  display:flex;
  gap:1rem;
  padding:.75rem 0;
  border-bottom:1px dashed rgba(255,255,255,0.03);
}
.item:last-child{border-bottom:none}
.item .meta{
  min-width:110px;
  color:var(--muted);
  font-size:.9rem;
}

/* Card image (album thumbnail) */
.thumb{
  width:96px;
  height:96px;
  flex-shrink:0;
  background:linear-gradient(180deg,#09202b,#051018);
  border-radius:8px;
  object-fit:cover;
  border:1px solid rgba(255,255,255,0.04);
}

/* small utilities */
.more{display:inline-block;margin-top:.5rem;color:var(--accent);text-decoration:none}
.meta-small{color:var(--muted-2);font-size:.9rem}
.kicker{color:var(--accent);font-weight:700}
.site-footer{padding:1rem 0;border-top:1px solid rgba(255,255,255,0.02);margin-top:2rem;background:transparent}
a{color:var(--accent)}
a:visited{color:rgba(100,181,246,0.8)}
code{background:#03181f;padding:.1rem .3rem;border-radius:4px;font-family:monospace;font-size:.9rem;color:var(--muted-2)}

/* audio / iframe の背景調整（ダークに馴染ませる） */
audio, iframe {
  background: transparent;
  color: var(--text);
}

/* main top margin */
main.container{
  margin-top:0.5rem;
}

/* responsiveness tweaks */
@media (max-width:920px){
  :root{--header-height:72px}
  .site-header .container{padding:.6rem .8rem}
  .site-title{font-size:1.0rem}
}
@media (max-width:520px){
  :root{--header-height:96px}
  .site-header .container{flex-direction:row;align-items:center;gap:.5rem;padding:.7rem} /* keep row so hamburger and brand align */
  .main-nav{margin-left:0;width:100%;gap:.25rem}
  .main-nav a{font-size:.95rem;padding:.5rem .6rem}
  .site-title{font-size:0.98rem}
}

/* Accessibility: focus styles */
a:focus, .main-nav a:focus {
  outline: 3px solid rgba(100,181,246,0.18);
  outline-offset: 2px;
  border-radius:6px;
}

hr { border: none; border-top:1px solid rgba(255,255,255,0.03); margin:1rem 0; }

/* 手動採番を残すため、該当 ol の自動マーカーを消す */
ol.manual-number {
  list-style: none;       /* ブラウザの自動番号（マーカー）を無効化 */
  margin-left: 0;         /* 必要なら調整 */
  padding-left: 0;
}

/* 手動番号は li のテキスト先頭に入っている想定なので、
   見た目を整えるために少し左パディングを入れる */
ol.manual-number li {
  padding-left: 0.25rem;  /* 手動番号とテキストの間隔調整 */
  margin: 0.25rem 0;
  line-height: 1.5;
}

/* === 個別ページタイトル上余白調整（安全なデフォルトも維持） === */
body[data-topic-id] article.card > h2,
body[data-music-id] article.card > h2,
body[data-album-id] article.card > h2,
body[data-live-id] article.card > h2 {
  margin-top: 0.4rem;
  padding-top: 0;
}

/* フォールバック（テンプレートに data- 属性がない場合、全カード見出しの余白を小さくする） */
article.card > h2,
.card > h2 {
  margin-top: 0.4rem;
  padding-top: 0;
}

/* 必要なら強制的に適用するオプション（コメント外して使用） */
/* article.card > h2 { margin-top: 0.4rem !important; padding-top: 0 !important; } */