/* =============================
   styles.css（ブログ1ページ＋ヘッダー右上に検索）
   初心者向けコメント付き
   ============================= */

/* === 1) リセット＆基本設定 ====================== */
/* すべての要素のボックスサイズを「枠線込み」に統一（レイアウト崩れを防ぐ） */
*, *::before, *::after { box-sizing: border-box; }

/* ページ全体の高さを100%にしておく（必要に応じて使える） */
html, body { height: 100%; }

/* 基本の文字設定と行間。日本語では少し広めの行間が読みやすい */
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans JP", sans-serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* 画像は親の幅を超えないようにする */
img { max-width: 100%; height: auto; display: block; }

/* === 2) カラーテーマ（変数） ==================== */
/* ライトモードの色。あとからここを変えるだけで配色を一括調整可能 */
:root{
  --bg: #ffffff;      /* 背景色 */
  --fg: #0f172a;      /* 文字色 */
  --muted: #475569;   /* 補助文字色（薄め） */
  --border: #e2e8f0;  /* 罫線色 */
  --surface: #f8fafc; /* カードなどの面の色 */
  --primary: #0ea5e9; /* アクセント色（リンク・ボタン等） */

  --maxw: 920px;      /* コンテンツ最大幅 */
  --radius: 14px;     /* 角丸 */
  --shadow: 0 8px 24px rgba(2,6,23,.08); /* 影 */
}

/* OSがダークモードのときの配色（自動で切替） */
@media (prefers-color-scheme: dark){
  :root{
    --bg: #0b1220;
    --fg: #e5e7eb;
    --muted: #94a3b8;
    --border: #1f2937;
    --surface: #0f172a;
    --primary: #38bdf8;
    --shadow: 0 8px 24px rgba(0,0,0,.45);
  }
}

/* ページ全体の背景色と文字色 */
body { background: var(--bg); color: var(--fg); }

/* リンクの色（アクセント色を使用） */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* アクセシビリティ用：画面には見せないがスクリーンリーダーには読ませる */
.sr-only{
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* === 3) レイアウト共通 =========================== */
/* 中央寄せの共通コンテナ。左右の余白は画面幅に応じて可変 */
.container{
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(16px, 2vw, 24px);
}

/* === 4) ヘッダー（上部固定＆半透明背景） ======== */
.site-header{
  position: sticky;  /* スクロールしても上に張り付く */
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg) 90%, transparent); /* 背景をわずかに透過風 */
  backdrop-filter: blur(8px); /* 背景をぼかしてガラス風に */
  border-bottom: 1px solid var(--border);
}

/* ヘッダー内の左右配置（ロゴ・検索・メニュー） */
.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
}

/* サイト名＆ロゴ */
.brand{
  display: flex; align-items: center; gap: 10px;
  font-weight: 700;
}
.logo{
    background-image: url("./images/rogo2.png")          /* 画像のURLを指定       */
    background-repeat:  no-repeat;                /* 画像の繰り返しを指定  */              
    width:28px;                                    /* 横幅のサイズを指定    */
    height:28px;                                 /* 縦幅のサイズを指定    */
}
.brand-name{ font-size: 25px; }

/* === 5) ヘッダー右側（検索とナビボタン） ========= */
/* 検索フォームとメニュー開閉ボタンを横並び */
.header-actions{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* 狭い画面でのオーバーフロー防止 */
}

/* 検索テキストボックス */
.search-input{
  width: clamp(140px, 24vw, 240px); /* 画面幅に応じて自動で伸び縮み */
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  outline: none;
}
.search-input:focus{
  border-color: color-mix(in oklab, var(--primary) 60%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 25%, transparent);
}

/* 検索ボタン */
.search-btn{
  padding: 9px 12px;
  border: 1px solid color-mix(in oklab, var(--primary) 60%, var(--border));
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}
.search-btn:hover{ filter: brightness(1.05); }

/* ハンバーガー（モバイル） */
.nav-toggle{
  display: none;                /* PCでは非表示 */
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  padding: 8px 10px;
  border-radius: 10px;
}
.nav-toggle .bars{
  display: inline-block;
  inline-size: 18px; block-size: 2px;
  background: currentColor;
  box-shadow: 0 6px 0 0 currentColor, 0 12px 0 0 currentColor; /* 3本線に見せる */
}

/* === 6) グローバルナビ（PC/モバイル） ========== */
.primary-nav{ display: flex; }
.nav-list{
  display: flex; gap: 6px;
  list-style: none; margin: 0; padding: 0;
}
.nav-list a{
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
}
.nav-list a:hover{
  background: color-mix(in oklab, var(--primary) 12%, transparent);
  text-decoration: none;
}

/* 画面幅が狭いときのナビ表示（ドロップダウン風） */
@media (max-width: 880px){
  .nav-toggle{ display: inline-flex; }        /* モバイルで表示 */
  .primary-nav{
    position: absolute;
    inset-inline: 16px;
    top: 54px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow);
    display: none;                            /* 最初は閉じる */
  }
  .primary-nav.open{ display: block; }
  .nav-list{ flex-direction: column; padding: 8px; }

  /* 検索欄が窮屈なときは幅を少し短くする */
  .search-input{ width: clamp(120px, 32vw, 200px); }
}

/* === 7) 記事ヘッダー（タイトルなど） ============ */
.layout{ padding-block: 20px; }
.article-header{ margin-block: 10px 18px; }
.eyebrow{
  font-size: 12px; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
}
.title{
  font-size: clamp(22px, 4.6vw, 40px);
  line-height: 1.15;
  margin: .2em 0;
}
.meta{ color: var(--muted); font-size: 14px; }
.hero{
  margin: 14px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}
.hero figcaption{
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* === 8) 本文（読みやすさ重視） ================== */
.prose{ font-size: clamp(16px, 2.1vw, 18.5px); line-height: 1.9; }
.prose h2{
    position: relative;
    padding: .3em 0 .2em 1em;
    border-bottom: 3px solid #2547d0;
    color: #333333;
}

.prose h2::before {
    position: absolute;
    top: 0;
    left: .3em;
    transform: rotate(55deg);
    height: 11px;
    width: 12px;
    background: #2547d0;
    content: '';
}

.prose h2::after {
    position: absolute;
    transform: rotate(15deg);
    top: .6em;
    left: 0;
    height: 8px;
    width: 8px;
    background: #2547d0;
    content: '';
}
.prose h3{ font-size: clamp(18px, 2.5vw, 22px); margin: 1.2em 0 .4em; }
.prose p{ margin: .9em 0; }
.prose ul, .prose ol{ padding-left: 1.2em; margin: .8em 0; }
.prose li{ margin: .3em 0; }
.prose blockquote{
  margin: 1em 0; padding: .6em 1em;
  border-left: 3px solid color-mix(in oklab, var(--primary) 40%, transparent);
  background: color-mix(in oklab, var(--primary) 6%, transparent);
}
.prose code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .95em;
  padding: .1em .3em;
  border-radius: 6px;
  background: color-mix(in oklab, var(--fg) 10%, transparent);
}
.prose pre{
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in oklab, var(--fg) 12%, transparent);
  overflow: auto;
}
figure{ margin: 1em 0; }
figcaption{ color: var(--muted); font-size: .9em; margin-top: .4em; }

.button-1 {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 350px;
    margin:0 auto;
    padding: .9em 2em;
    border: 1px solid #0e55e1;
    border-radius: 25px;
    background-color: #fff;
    color: #0e55e1;
    font-size: 1em;
}

.button-1::after {
    transform: rotate(45deg);
    width: 5px;
    height: 5px;
    margin-left: 10px;
    border-top: 2px solid #0e55e1;
    border-right: 2px solid #0e55e1;
    content: '';
}

/* === 8-2) 本文3連ボックス================== */
.mission {
  padding: 80px 20px;
  background: #faf9f7;
}

.mission-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 40px;
}

.mission-item {
  flex: 1;
  text-align: center;
}

.mission-item img {
  width: 100%;
  max-width: 280px;
  height: auto;
  margin-bottom: 24px;
}

.mission-item h3 {
  font-size: 20px;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  font-weight: 600;
}

.mission-item p {
  font-size: 14px;
  line-height: 1.9;
  color: #555;
}

@media screen and (max-width: 768px) {
  .mission-inner {
    flex-direction: column;
    gap: 60px;
  }
}

/* === 8-3) 本文最新情報================== */
.news {
  padding: 80px 20px;
  background: #ffffff;
}

.news-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.news-title {
  font-size: 26px;
  text-align: center;
  margin-bottom: 60px;
  letter-spacing: 0.1em;
}

.news-list {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.news-card.horizontal {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #faf9f7;
  color: inherit;
  text-decoration: none;
  padding: 16px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}


.news-card.horizontal:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.news-image {
  width: 200px;
  flex-shrink: 0;
}

.news-image img {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.news-text {
  padding: 24px;
}

.news-text time {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.news-text h3 {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 12px;
  font-weight: 600;
}

.news-text p {
  font-size: 14px;
  line-height: 1.8;
  color: #555;
}

@media screen and (max-width: 768px) {
  .news-card.horizontal {
    flex-direction: column;
    align-items: flex-start;
  }

  .news-image {
    width: 100%;
  }

  .news-image img {
    height: 180px;
  }
}


/* === 9) 表（横スクロール対応） ================== */
.table-wrap{
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
table{ border-collapse: collapse; min-width: 560px; width: 100%; }
th, td{ padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
thead th{ position: sticky; top: 0; background: var(--surface); }

/* 注意枠（メモなど） */
.note{
  margin: 1em 0; padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: color-mix(in oklab, var(--primary) 5%, transparent);
}

.login-box {
  width: 260px;
  margin: 120px auto;
}

input, button {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px;
}

#error {
  color: red;
  font-size: 0.9em;
}

/* === 10) 記事フッター（著者情報） ============== */
.article-footer{
  margin-top: 26px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.author{ display: flex; align-items: center; gap: 12px; }
.avatar{
  inline-size: 48px; block-size: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.author-name{ font-weight: 600; margin: 0; }
.author-bio{ margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* === 11) サイト全体フッター ====================== */
.site-footer{ margin-top: 28px; border-top: 1px solid var(--border); }
.footer-inner{ padding: 18px 0; color: var(--muted); font-size: 14px;}

/* === 12) 検索結果オーバーレイ ==================== */
/* 画面全体を覆う黒半透明のレイヤー（最初は非表示） */
#searchOverlay{
  display: none;              /* JSで block に切り替え */
  position: fixed;
  inset: 0;                   /* top/right/bottom/left を一括指定 */
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  overflow-y: auto;           /* 結果が長い場合はスクロール */
}

/* オーバーレイ中央の白いカード */
#searchResults{
  background: #fff;
  color: #111;
  margin: 5% auto;
  padding: 20px;
  width: 80%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* 閉じるボタン（右上） */
#closeBtn{
  float: right;
  cursor: pointer;
  background: #f44336;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
}
#closeBtn:hover{ filter: brightness(1.05); }

/* ダークモードで結果カードの文字色を読みやすく */
@media (prefers-color-scheme: dark){
  #searchResults{
    background: #111827;
    color: #e5e7eb;
  }
}
/* ヘッダーを3カラムに（左：ブランド / 中央：ナビ / 右：検索） */
.header-inner{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

/* ナビは中央、検索は右端 */
.primary-nav{ justify-self: center; }
.header-actions{ justify-self: end; display: flex; align-items: center; gap: 8px; }

/* 狭い画面での調整：検索幅を抑え、ナビはドロップダウンへ */
@media (max-width: 880px){
  .header-inner{
    grid-template-columns: auto 1fr auto; /* そのままでもOK */
  }
  .search-input{ width: clamp(120px, 40vw, 200px); }
}