/* ============================================================
   ponion Tech Blog — はてなブログ カスタムCSS
   ponion.jp のブランドデザインに準拠
   ============================================================ */

/* ----- ブランド変数 ----- */
:root {
  --brand-blue: #0048C8;
  --brand-blue-dark: #003499;
  --brand-blue-light: #F0F8FF;
  --brand-pink: #F55A68;
  --brand-pink-light: #FFF0F1;
  --text-color: #222222;
  --text-light: #666666;
  --text-muted: #999999;
  --bg-white: #FFFFFF;
  --bg-light: #F0F8FF;
  --bg-grey: #F5F6F8;
  --border-color: #E2E2E2;
  --radius: 8px;
  --font-ja: "游ゴシック体", YuGothic, "游ゴシック Medium", "Yu Gothic Medium", "游ゴシック", "Yu Gothic", "メイリオ", sans-serif;
  --font-en: futura-pt, "游ゴシック体", YuGothic, sans-serif;
}

/* ============================================================
   1. ベース
   ============================================================ */
html {
  font-size: 62.5%; /* 1rem = 10px（ブラウザデフォルト 16px の 62.5%） */
}

body {
  font-family: var(--font-ja);
  color: var(--text-color);
  background: var(--bg-white);
  font-size: 1.6rem; /* 16px：未指定要素が html(10px) を継承して縮むのを防ぐ */
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-blue) !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--brand-blue-dark) !important;
}

/* ============================================================
   2. ヘッダー / ブログタイトル
   ============================================================ */
#blog-title {
  background: var(--bg-white);
  margin: 0 0 28px;
}

.header-image-enable #blog-title #blog-title-inner {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: auto;
  background-position: top center;
  background-size: contain;
  aspect-ratio: 1440 / 230;
  height: auto;
}

#blog-title-content {
  text-align: center;
}

#title {
  margin: 0;
}

.header-image-enable #blog-title #title a {
  color: var(--brand-blue);
  font-family: var(--font-en);
  font-size: 5.6rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  --pad: 70px;
  padding: 0 0 0 var(--pad);
  background: url(https://ponion.jp/images/common/svg/ponion_logo.svg?id=181892b94cf05a1149cf3917bb5cfa14) no-repeat left center;
  background-size: contain;
  text-shadow: none;
}

.header-image-enable #blog-title #blog-description {
  margin-bottom: 0;
  font-size: 2rem;
  color: var(--text-light);
  text-shadow: none;
}

.pager a {
  color: var(--brand-blue-light) !important;
  font-weight: bold;
}

/* ============================================================
   3. グローバルナビ（カテゴリリンクをナビとして使う場合）
   ============================================================ */
#top-box {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
}

#top-box .breadcrumb {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  font-size: 1.3rem;
  color: var(--text-muted);
}

/* ============================================================
   4. コンテナ / レイアウト
   ============================================================ */
#container {
  width: 100%;
  min-width: 1080px;
  margin: 0 auto;
  box-sizing: border-box;
}

#wrapper {
  flex: 1;
  min-width: 0;
  max-width: 760px;
  padding-top: 40px;
}

#content-inner {
  display: flex;
  gap: 48px;
  width: 80%;
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================================================
   5. 記事カード / エントリー
   ============================================================ */
.page-archive .archive-entry {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-areas:
    "thumb header"
    "thumb category"
    "thumb body";
  column-gap: 24px;
  align-items: start;
  margin-bottom: 24px;
  padding: 12px 24px 12px 12px;
  border-bottom: 1px solid var(--border-color);
}

.page-archive .archive-entry:first-child {
  border-top: 1px solid var(--border-color);
  padding-top: 36px;
}

.archive-entry-header {
  grid-area: header;
  padding-top: 12px;
}

.entry-thumb-link {
  grid-area: thumb;
}

.page-archive .entry-thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 10 / 7;
  border-radius: 8px;
}

.archive-entry-body {
  grid-area: body;
  padding-bottom: 12px;
}

.entry-description {
  font-size: 1.4rem;
}

.categories {
  grid-area: category;
}

/* ----- 日付 ----- */
.date {
  font-size: 1.3rem;
  color: var(--text-muted);
  font-family: var(--font-en);
  letter-spacing: 0.04em;
}

.date a {
  color: var(--text-muted);
}

/* ----- 記事タイトル ----- */
.entry-title {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.5;
  margin: 8px 0 16px;
}

.entry-title a {
  color: var(--text-color);
}

.entry-title a:hover {
  color: var(--brand-blue);
}

/* ----- カテゴリ ----- */
.entry-categories.categories {
  margin: 12px 0 24px;
}

.categories a {
  display: inline-block;
  font-size: 1.4rem;
  color: var(--brand-blue);
  background: var(--brand-blue-light);
  border: 1px solid rgba(0, 72, 200, 0.15);
  border-radius: 100px;
  padding: 2px 14px;
  margin: 0 6px 6px 0;
  transition: background 0.2s ease;
}

.categories a:hover {
  background: rgba(0, 72, 200, 0.12);
}

/* ============================================================
   6. 記事本文
   ============================================================ */
#main,
#main .entry,
#main .entry-inner,
#main .entry-content {
  min-width: 0;
}

#main {
  overflow-x: hidden; /* fallback for Safari < 16 */
  overflow-x: clip;
}

.entry-content {
  font-size: 1.7rem;
  line-height: 1.9;
  color: var(--text-color);
  font-weight: 500;
}

/* ----- 見出し ----- */
.entry-content h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-color);
  border-left: 4px solid var(--brand-blue);
  padding: 4px 0 4px 16px;
  margin: 48px 0 24px;
}

.entry-content h3 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-color);
  border-bottom: 2px solid var(--brand-blue);
  padding-bottom: 8px;
  margin: 40px 0 20px;
}

.entry-content h4 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin: 32px 0 16px;
}

.entry-content h5 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 24px 0 12px;
}

/* ----- 段落 ----- */
.entry-content p {
  margin: 0 0 24px;
}

/* ----- リスト ----- */
.entry-content ul,
.entry-content ol {
  margin: 0 0 24px;
  padding-left: 24px;
}

.entry-content li {
  margin-bottom: 6px;
  margin-left: 20px;
}

/* ----- 引用 ----- */
.entry-content blockquote {
  border-left: 4px solid var(--text-light);
  background: var(--bg-grey);
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
}

.entry-content blockquote p:last-child {
  margin-bottom: 0;
}

/* ----- コードブロック ----- */
.entry-content pre {
  background: #1E293B;
  color: #E2E8F0;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 24px 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  font-size: 1.4rem;
  line-height: 1.6;
}

.entry-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.entry-content code {
  background: var(--bg-light);
  color: var(--brand-blue);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* ----- テーブル ----- */
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 1.5rem;
  display: block;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.entry-content table th {
  background: var(--brand-blue);
  color: var(--bg-white);
  font-weight: 700;
  padding: 10px 16px;
  text-align: left;
}

.entry-content table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
}

.entry-content table tr:nth-child(even) td {
  background: var(--bg-light);
}

/* ----- 画像 ----- */
.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* ----- 水平線 ----- */
.entry-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 40px 0;
}

/* ----- 目次 ----- */
.table-of-contents {
  border: 1px solid var(--brand-blue);
  border-radius: var(--radius);
  padding: 20px 24px 20px 40px;
  margin: 24px 0 32px;
  font-size: 1.5rem;
  line-height: 1.8;
}

.table-of-contents::before {
  content: "目次";
  display: block;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 8px;
  margin-left: 0;
  font-size: 1.4rem;
}

/* ============================================================
   7. 記事フッター
   ============================================================ */
.entry-footer {
  margin-top: 24px;
}

.entry-footer-section {
  font-size: 1.3rem;
  color: var(--text-muted);
}

/* はてなスター */
.hatena-star-container {
  margin-top: 12px;
}

/* ソーシャルボタン */
.social-buttons {
  margin-top: 16px;
}

/* ============================================================
   8. サイドバー
   ============================================================ */
#box2 {
  width: 280px;
  flex-shrink: 0;
  padding-top: 40px;
}

#box2-inner {
  border-radius: 12px;
  background: var(--brand-blue-light);
}

#box2 .hatena-module {
  padding: 24px;
}

#box2 .hatena-module-title {
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-color);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

#box2 .hatena-module-title a {
  color: var(--text-color) !important;
}

#box2 .hatena-module-body {
  font-size: 1.6rem;
  line-height: 1.7;
}

#box2 .hatena-module-body a {
  color: var(--text-color);
}

#box2 .hatena-module-body a:hover {
  color: var(--brand-blue);
}

/* ----- プロフィール ----- */
.hatena-module-profile .profile-icon {
  border-radius: 50%;
  width: 80px;
  height: 80px;
}

/* ----- 検索ボックス ----- */
.search-form {
  display: flex;
}

.search-module-input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  padding: 8px 12px;
  font-size: 1.4rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-module-input:focus {
  border-color: var(--brand-blue);
}

.search-module-button {
  flex-shrink: 0;
  box-sizing: border-box;
  background: var(--brand-blue);
  color: var(--bg-white);
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 16px;
  font-size: 1.4rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.search-module-button:hover {
  background: var(--brand-blue-dark);
}

/* ----- 最新記事・カテゴリ等のリスト ----- */
#box2 .hatena-urllist {
  list-style: none;
  padding: 0;
  margin: 0;
}

#box2 .hatena-urllist li {
  padding: 8px 0;
  font-size: 1.6rem;
}

/* ============================================================
   9. ページャー
   ============================================================ */
.pager {
  margin: 40px 0;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.pager a {
  display: inline-block;
  background: var(--brand-blue);
  color: var(--bg-white);
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 1.4rem;
  font-weight: bold;
  transition: background 0.2s ease;
}

.pager a:hover {
  background: var(--brand-blue-dark);
  color: var(--bg-white);
}

/* ============================================================
   10. フッター
   ============================================================ */
#footer {
  background: var(--bg-grey);
  color: var(--text-color);
  margin-top: 64px;
  padding: 32px 0;
  text-align: center;
  font-size: 1.3rem;
}

#footer a {
  color: var(--text-color) !important;
}

#footer a:hover {
  color: var(--bg-white) !important;
}

/* ============================================================
   11. コメント欄
   ============================================================ */
.comment-box {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

.comment-box .comment {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 1.5rem;
}

.leave-comment-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand-blue);
}

/* ============================================================
   12. レスポンシブ
   ---
   構造（4種の MQ で記述・min-width / range query を活用）：
   - 共有レイアウト    : screen and (max-width: 1024px)                          ← タブレット & スマホで共通（縦並び等）
   - タブレット専用    : screen and (min-width: 601px) and (max-width: 1024px)   ← HTML スケーリング
   - スマートフォン専用: screen and (max-width: 600px)                           ← px 直接管理
   - PC 専用          : screen and (min-width: 1025px)                          ← 将来の上書き枠（現在は空）
   ============================================================ */

/* --- 共有レイアウト：タブレット & スマートフォン共通（縦並び） --- */
@media screen and (max-width: 1024px) {
  #container {
    min-width: 0;
  }

  #content-inner {
    flex-direction: column;
    width: 90%;
    max-width: none;
  }

  #wrapper {
    max-width: none;
  }

  #box2 {
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
    margin-top: 32px;
  }

  /* ----- ヘッダ画像：タブレット & スマートフォン共通の SP 用画像に差し替え ----- */
  .header-image-enable #blog-title #blog-title-inner {
    background-image: url(https://cdn-ak.f.st-hatena.com/images/fotolife/p/ponion-inc/20260519/20260519113213.png) !important;
    aspect-ratio: 1125 / 360 !important; /* SP 用画像のアスペクト比（PC の 1440/230 から差し替え） */
  }

  #blog-title {
    padding: 0;
  }

  /* ----- テーブル：狭幅では nowrap で表の形を保ち、横スワイプで読ませる ----- */
  .entry-content table {
    white-space: nowrap;
  }
}

/* --- タブレット専用：HTML サイズスケーリング（range query で smartphone と完全分離） --- */
@media screen and (min-width: 601px) and (max-width: 1024px) {
  html {
    font-size: 70%; /* 1rem = 11.2px：+12% で文字サイズ系を一律拡大（.entry-content が 17.92px ≒ SmartBank 18px） */
  }
}

/* --- スマートフォン専用 --- */
@media screen and (max-width: 600px) {
  html {
    font-size: 62.5%; /* 1rem = 10px に戻す：tablet の 70% を打ち消し、スマホは独立スケール */
  }

  /* ----- 本文 ----- */
  body {
    font-size: 15px;
  }

  .entry-content {
    font-size: 16px;
  }

  .entry-content table {
    font-size: 16px;
  }

  /* ----- 見出し（Figma: マーク上 + テキスト下の縦積みレイアウト） ----- */
  .header-image-enable #blog-title #title a {
    display: block;
    text-align: center;
    font-size: 24px;
    line-height: 36px;
    font-weight: 500;
    letter-spacing: -0.01em;
    padding: 44px 0 0 0;
    background-position: top center;
    background-size: auto 40px;
  }

  .entry-title {
    font-size: 20px;
  }

  .entry-content h2 {
    font-size: 19px;
    margin: 36px 0 18px;
  }

  .entry-content h3 {
    font-size: 17px;
    margin: 30px 0 14px;
  }

  .entry-content pre {
    padding: 16px;
    font-size: 13px;
  }

  /* ----- 記事カード（縦積み：サムネ→ヘッダ→本文） ----- */
  .page-archive .archive-entry {
    grid-template-columns: 1fr;
    grid-template-areas:
      "thumb"
      "header"
      "category"
      "body";
    column-gap: 0;
    padding: 12px;
  }

  .entry-description {
    display: none;
  }

  /* ----- レイアウト ----- */
  .pager a {
    padding: 8px 18px;
  }
}

/* --- PC 専用：将来の上書き枠（現在は空） --- */
@media screen and (min-width: 1025px) {
  /* 現在は空。PC 専用の上書きが必要になったときに追加 */
}
