/*
Theme Name: FirstCH Investment Blog
Template: jin
Version: 1.1.5
Description: blog.first-ch.com 用のJIN子テーマ
*/

:root {
  --firstch-navy: #3b4675;
  --firstch-ink: #26345f;
  --firstch-accent: #eeee22;
}

/* 長いサイト名でも欠けない、コンパクトなヘッダー */
#header-box,
#header {
  min-height: 72px;
}

/* サイト名とグローバルナビが同じ行に並ぶため、サイト名は必要な幅だけ使う */
#header {
  align-items: center;
}

#header #site-info {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex: 0 1 auto;
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  margin: 0 !important;
  padding: 10px 24px 10px 0;
  box-sizing: border-box;
  text-align: left !important;
}

#header .tn-logo-size {
  display: block;
  flex: 0 1 auto !important;
  min-width: 0;
  margin: 0 !important;
  text-align: left !important;
}

/* サイト名は常に1行。入り切らない分は「…」で省略する */
#header .tn-logo-size a {
  display: block;
  max-width: 100%;
  color: #fff;
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  text-decoration: none;
}

/* デスクトップはナビと垂直中央を揃える */
@media (min-width: 768px) {
  #drawernav3 ul.menu-box {
    margin-top: 0;
  }

  /* リンク文字をボックス内で垂直中央にし、サイト名と高さを揃える */
  #drawernav3 ul.menu-box > li.menu-item > a {
    display: flex;
    align-items: center;
    height: 40px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* トップの記事一覧はデスクトップで横3列 */
@media (min-width: 1024px) {
  .home .toppost-list-box-simple .post-list-mag {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
  }

  .home .toppost-list-box-simple .post-list-mag > .post-list-item {
    width: auto !important;
    min-width: 0;
    margin: 0 0 4px !important;
  }

  .home .toppost-list-box-simple .post-list-mag > .post-list-item.pconly {
    grid-column: 1 / -1;
    order: 999;
    min-height: 0;
  }

  .home .toppost-list-box-simple .post-list-mag > .post-list-item.pconly:has(.adsbygoogle[data-ad-status="unfilled"]) {
    display: none !important;
  }

  .home .toppost-list-box-simple .post-list-mag .post-list-link,
  .home .toppost-list-box-simple .post-list-mag .post-list-inner {
    display: block;
    height: 100%;
  }

  .home .toppost-list-box-simple .post-list-mag .post-list-title {
    font-size: 0.82rem;
    line-height: 1.55;
  }
}

/* 本文の可読性 */
.cps-post-main-box {
  color: #20263a;
  font-size: 1rem;
  line-height: 1.9;
}

.cps-post-main-box h2 {
  margin-top: 1.8em;
  line-height: 1.5;
}

.cps-post-main-box h3 {
  margin-top: 1.4em;
  line-height: 1.55;
}

/* 配信済み(filled)以外の広告枠は畳んで空白を作らない */
ins.adsbygoogle:not([data-ad-status="filled"]) {
  display: none !important;
}

section.ad-single:has(ins.adsbygoogle:not([data-ad-status="filled"])),
.ad-single-h2:has(ins.adsbygoogle:not([data-ad-status="filled"])),
.adarea-box:has(ins.adsbygoogle:not([data-ad-status="filled"])),
.sponsor:has(+ section.ad-single ins.adsbygoogle:not([data-ad-status="filled"])),
.sponsor-top:has(+ section.ad-single ins.adsbygoogle:not([data-ad-status="filled"])),
.sponsor-h2-center:has(+ .ad-single-h2 ins.adsbygoogle:not([data-ad-status="filled"])) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Gutenberg変換で残った空段落を非表示にする */
.cps-post-main-box p:empty {
  display: none;
}

/* 結論ボックスと目次の上下余白を詰める */
.cps-post-main-box .kaisetsu-box4 {
  margin-top: 24px !important;
  margin-bottom: 24px !important;
}

.cps-post-main-box .kaisetsu-box4 li {
  line-height: 1.7;
}

.cps-post-main-box .rtoc-mokuji-content {
  margin-top: 24px !important;
  margin-bottom: 24px !important;
}

.cps-post-main-box a {
  text-underline-offset: 0.18em;
}

/* Gutenbergのコードブロック */
.cps-post-main-box pre.wp-block-code {
  position: relative;
  margin: 1.5rem 0;
  padding: 2.6rem 1.25rem 1.25rem;
  overflow-x: auto;
  border: 1px solid #263556;
  border-left: 4px solid var(--firstch-accent);
  border-radius: 6px;
  background: #111827;
  color: #e5edf8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.75;
  tab-size: 2;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

.cps-post-main-box pre.wp-block-code::before {
  position: absolute;
  top: 0.7rem;
  left: 1.25rem;
  color: #9fb0ca;
  content: "CODE";
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.cps-post-main-box pre.wp-block-code code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.cps-post-main-box p code,
.cps-post-main-box li code {
  padding: 0.12em 0.38em;
  border: 1px solid #d8dfeb;
  border-radius: 4px;
  background: #f2f5f9;
  color: #24355f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* Markdownの言語名が段落として残った旧記事では重複表示を隠す */
.postid-83 .cps-post-main-box p:has(+ pre.wp-block-code) {
  display: none;
}

/* 投資記事末尾の免責事項 */
.firstch-disclaimer {
  margin: 2.5em 0 1.5em;
  padding: 1em 1.25em;
  border: 1px solid #d8dfeb;
  border-radius: 6px;
  background: #f6f8fb;
  color: #5a6478;
  font-size: 0.82rem;
  line-height: 1.8;
}

.firstch-disclaimer__title {
  margin: 0 0 0.4em;
  color: var(--firstch-ink);
  font-size: 0.85rem;
  font-weight: 700;
}

.firstch-disclaimer p {
  margin: 0;
}

/* 著者カードはサイトのfaviconと同じアイコンを表示 */
.profile-thumbnail {
  overflow: hidden;
  border-radius: 50%;
  background: #fff url("/wp-content/uploads/2025/11/cropped-my-icon.png") center / cover no-repeat;
}

.profile-thumbnail img {
  opacity: 0;
}

.cps-post-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

/* タブレット以下では本文を優先し、サイドバーを下へ送る */
@media (max-width: 834px) {
  #contents {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  #main-contents,
  #sidebar {
    float: none;
    width: calc(100% - 30px);
    max-width: none !important;
    margin: 10px 15px 20px;
  }
}

@media (max-width: 767px) {
  #header-box,
  #header {
    min-height: 60px;
    height: auto;
  }

  #header #site-info {
    padding: 10px 16px;
  }

  #header .tn-logo-size a {
    font-size: clamp(1.05rem, 5vw, 1.3rem);
    line-height: 1.35;
    text-align: center;
  }

  .cps-post-header {
    padding-inline: 15px;
  }

  .cps-post-title {
    font-size: clamp(1.35rem, 6vw, 1.7rem);
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .cps-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    justify-content: flex-end;
    max-width: 100%;
  }

  .cps-post-date-box,
  .cps-post-date {
    max-width: 100%;
    white-space: normal;
  }

  .cps-post-main-box {
    font-size: 1rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
  }

  #sidebar .widget:first-child {
    margin-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .animate,
  .main-contents.animate,
  .sideber.animate {
    animation: none !important;
    opacity: 1 !important;
  }
}
