/*==================================================
  Theme: Modern Engineering White (Large Text & Center Title)
  Concept: "Clean, crisp, and professional"
  文字サイズを大きくし、読みやすさを向上させた最終版
==================================================*/
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500&family=Noto+Sans+JP:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

/*==================================================
  配色変数
==================================================*/
:root {
  --bg-body: #f4f7f9;
  --bg-card: #ffffff;
  --text-main: #24292f;
  --text-sub: #57606a;
  --accent: #0969da;
  --code-bg: #1f2328; 
  --code-text: #e6edf3;
  --shadow-card: 0 3px 6px rgba(140, 149, 159, 0.15);
}

/*==================================================
  1. 基本設定（★文字サイズを調整）
==================================================*/
html {
  font-size: 17px; /* ★16pxから17pxに変更（少し大きく） */
}
body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Inter', 'Noto Sans JP', sans-serif;
  line-height: 1.8; /* 行間は広めをキープ */
  margin: 0;
}
a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
a:hover {
  color: #054da7;
  text-decoration: underline;
}
*, *:before, *:after { box-sizing: border-box; }

/*==================================================
  2. レイアウト
==================================================*/
#container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

#content-inner {
  display: flex;
  gap: 40px;
  margin-top: 40px;
}

#main {
  flex: 1;
  min-width: 0;
}

#box2 {
  width: 300px;
  flex-shrink: 0;
}

/*==================================================
  3. ヘッダー（中央揃え）
==================================================*/
/*#blog-title {
  padding: 60px 0 30px;
  text-align: center;
  border-bottom: 1px solid #d0d7de;
  margin-bottom: 20px;
}

#blog-title #title a {
  font-family: 'Inter', sans-serif;
  font-size: 40px;
  font-weight: 800;
  color: #1f2328;
  letter-spacing: -0.02em;
}

#blog-title #blog-description {
  color: var(--text-sub);
  margin-top: 10px;
  font-size: 16px;
  font-family: 'Noto Sans JP', sans-serif;
}*/
/*==================================================
  3. ヘッダー（Future Blueprint Style）
  動くグリッド背景と、ホバー時のグリッチ演出
==================================================*/
#blog-title {
  /* 余白調整 */
  padding: 100px 0 60px;
  text-align: center;
  margin-bottom: 40px;
  
  /* --- 未来感の核：動くグリッド背景 --- */
  background-color: #f4f7f9;
  background-image: 
    linear-gradient(rgba(9, 105, 218, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(9, 105, 218, 0.05) 1px, transparent 1px);
  background-size: 50px 50px; /* グリッドのサイズ */
  
  /* グリッドをゆっくり動かすアニメーション */
  animation: grid-move 20s linear infinite;
  
  /* 下線：ネオンブルーのグラデーション */
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(to right, transparent, var(--accent), transparent);
  border-image-slice: 1;
}

/* グリッドが流れるアニメーション定義 */
@keyframes grid-move {
  0% { background-position: 0 0; }
  100% { background-position: 50px 50px; }
}

/* --- タイトル文字 --- */
#blog-title #title a {
  font-family: 'Inter', sans-serif;
  font-size: 56px; /* 更に大きくインパクトを */
  font-weight: 900;
  color: #1f2328;
  letter-spacing: -0.04em;
  line-height: 1;
  position: relative;
  display: inline-block;
  transition: color 0.2s;
}

/* ホバー時の「グリッチ（ノイズ）」エフェクト */
#blog-title #title a:hover {
  color: var(--accent);
  text-shadow: 2px 0 #ff00ff, -2px 0 #00ffff; /* 色ずれを起こす */
  animation: glitch-skew 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

/* グリッチの揺れアニメーション */
@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  20% { transform: skew(-10deg); }
  40% { transform: skew(10deg); }
  60% { transform: skew(-5deg); }
  80% { transform: skew(5deg); }
  100% { transform: skew(0deg); }
}

/* --- サブタイトル（ターミナル風） --- */
#blog-title #blog-description {
  font-family: 'Roboto Mono', monospace; /* 等幅フォントで機械っぽく */
  color: var(--accent); /* アクセントカラーにする */
  margin-top: 20px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.8); /* 文字が見やすいように背景を少し白く */
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid rgba(9, 105, 218, 0.2);
}

/* お気に入りの点滅カーソル */
#blog-title #blog-description::after {
  content: '_';
  display: inline-block;
  margin-left: 8px;
  color: var(--text-main);
  animation: blink-cursor 1s step-end infinite;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/*==================================================
  4. 記事カードデザイン
==================================================*/
.entry {
  background-color: var(--bg-card);
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 48px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-card);
}

/* 記事タイトル */
.entry-title {
  font-size: 34px; /* ★本文に合わせて少し大きく */
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.3;
  color: #1f2328;
}
.entry-title a { color: inherit; }
.entry-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* 日付 */
.date {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-sub);
  display: block;
  margin-bottom: 30px;
}

/*--- 見出しデザイン（★本文に合わせてサイズ調整） ---*/
.entry-content h3 {
  font-size: 26px; /* ★24pxから26pxへ */
  color: #1f2328;
  margin: 50px 0 24px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e1e4e8;
  font-weight: 700;
  position: relative;
}
.entry-content h3::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background-color: var(--accent);
}

.entry-content h4 {
  font-size: 22px; /* ★20pxから22pxへ */
  font-weight: 700;
  margin: 40px 0 16px;
  color: #24292f;
  padding-left: 16px;
  border-left: 4px solid var(--accent);
}

/*--- コードブロック ---*/
.entry-content pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 24px;
  border-radius: 8px;
  font-family: 'Roboto Mono', monospace;
  font-size: 16px; /* ★コードも少し大きく */
  line-height: 1.6;
  overflow-x: auto;
  margin: 30px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* インラインコード */
.entry-content code {
  background-color: #eff1f3;
  color: #24292f;
  padding: 0.2em 0.5em;
  border-radius: 6px;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9em;
  margin: 0 2px;
  border: 1px solid #d0d7de;
}
.entry-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  border: none;
}

/*--- 目次 ---*/
.table-of-contents {
  background-color: #f6f8fa;
  padding: 30px;
  margin: 30px 0;
  border-radius: 8px;
  border: 1px solid #d0d7de;
}
.table-of-contents::before {
  content: "目次";
  display: block;
  font-weight: bold;
  font-size: 1.1em;
  margin-bottom: 15px;
  color: var(--text-main);
}
.table-of-contents ul { padding-left: 20px; }

/*==================================================
  5. サイドバー
==================================================*/
.hatena-module {
  background-color: var(--bg-card);
  border: 1px solid #d0d7de;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.hatena-module-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
  border-bottom: 1px solid #d0d7de;
  padding-bottom: 10px;
}

/*==================================================
  6. スマホ対応
==================================================*/
@media screen and (max-width: 959px) {
  #container { padding: 0 16px; }
  #content-inner {
    flex-direction: column;
    gap: 30px;
  }
  #main, #box2 { width: 100%; }
  .entry { padding: 24px; }
  .entry-title { font-size: 26px; }
  #blog-title { padding: 40px 0 20px; }
}


/*--- グローバルナビゲーション ---*/
#global-nav {
    margin: 0 auto 40px; /* タイトル下の余白 */
    border-bottom: 1px solid #d0d7de;
    max-width: 1280px;
}
#global-nav ul {
    display: flex;
    justify-content: center; /* 中央揃え */
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 30px; /* メニュー間の隙間 */
}
#global-nav li a {
    display: block;
    padding: 15px 0;
    color: #57606a; /* 少し薄めの色 */
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.05em;
    position: relative;
    text-decoration: none;
}
/* ホバー時に青い線がニョキッと出るアニメーション */
#global-nav li a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    transform: scaleX(0); /* 最初は隠しておく */
    transition: transform 0.3s ease;
}
#global-nav li a:hover {
    color: var(--accent);
}
#global-nav li a:hover::after {
    transform: scaleX(1); /* ホバーで線が出る */
}


/*--- サイドバー追従 ---*/
@media screen and (min-width: 960px) {
  #box2 {
    position: sticky;
    top: 20px; /* 画面上から20pxの位置で止まる */
    height: fit-content;
  }
}


/*--- プロフィールアイコンの装飾 ---*/
.hatena-module-profile .profile-icon {
    border-radius: 50%; /* 完全に丸くする */
    border: 3px solid #fff; /* 白い枠線をつける */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* 影で浮かせる */
    width: 100px; /* アイコンサイズ調整（お好みで） */
    height: 100px;
    object-fit: cover;
}

/*==================================================
  Animation A: 点滅カーソル (The Engineer)
==================================================*/
#blog-title #title a::after {
  content: '|'; /* カーソルの形（| や █ に変えてもOK） */
  display: inline-block;
  margin-left: 8px; /* 文字との隙間 */
  color: var(--accent); /* アクセントカラー（青）を使用 */
  animation: blink-cursor 1s step-end infinite;
  vertical-align: bottom;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}



/*==================================================
  Animation B: オーロラ・フロー (Modern Tech)
==================================================*/
#blog-title #title a {
  /* ベースの色と、光る色（アクセントカラー）のグラデーションを作る */
  background: linear-gradient(to right, #1f2328 20%, #0969da 50%, #1f2328 80%);
  background-size: 200% auto;
  
  /* 文字の形に背景を切り抜く魔法の記述 */
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  
  /* アニメーション設定 */
  animation: shine-flow 3s linear infinite;
}

@keyframes shine-flow {
  to {
    background-position: 200% center;
  }
}

/*==================================================
  Mobile Fix: スマホ表示の緊急調整
  (タイトルの改行を防ぎ、余白を最適化)
==================================================*/
@media screen and (max-width: 959px) {
  
  /* ヘッダーの余白をスマホ用にコンパクトにする */
  #blog-title {
    padding: 60px 10px 40px; /* 上60px, 横10px, 下40px */
  }

  /* タイトルのフォントサイズをガツンと下げる */
  #blog-title #title a {
    /* 画面幅に合わせて自動調整（最小20px, 最大30px） */
    font-size: clamp(20px, 6vw, 30px); 
    
    /* 強制的に改行させないおまじない */
    white-space: nowrap; 
    
    /* 万が一はみ出しても崩れないようにする */
    width: 100%;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* グリッド背景のアニメーション速度を少し落とす（スマホの負荷軽減） */
  #blog-title {
    animation-duration: 30s;
  }
}