/* ========== 基本レイアウト ========== */
:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --head: rgb(9, 98, 68);
  --headText: #ffffff;
}

body{
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.box{
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
}

.title{
  margin: 0 0 12px;
  font-size: 24px;
  letter-spacing: .02em;
}

/* ========== タイトル帯（.hero） ========== */
.hero{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  margin: 0 0 12px;
  background: #fff;
  position: relative;
}

/* 中の余白と文字 */
.hero-inner{
  padding: 34px 22px 30px;
  position: relative;
  z-index: 2;
}

.hero-title{
  margin: 0;
  font-size: 28px;
  letter-spacing: .04em;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.hero-sub{
  margin: 6px 0 0;
  font-size: 13px;
  color: rgba(255,255,255,.9);
}

/* 地紋（パターン）と、ちらちら（簡易アニメ） */
.hero::before{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: .95;
  background:
    radial-gradient(1200px 220px at 30% 0%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(900px 240px at 80% 20%, rgba(255,255,255,.20), transparent 60%),
    linear-gradient(135deg, #0b7a53, #0a5e43);
}

/* ====== Hero上にCanvasを重ねる（雪） ====== */
.hero::before{
  z-index: 1; /* 背景 */
}

/* 雪は背景より上、文字より下 */
#snowCanvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* 文字は一番上 */
.hero-inner{
  position: relative;
  z-index: 3;
}

/* ========== 季節ごとの雰囲気（色味＋粒の色） ========== */
.hero.season-winter::before{
  background:
    radial-gradient(1200px 220px at 30% 0%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(900px 240px at 80% 20%, rgba(255,255,255,.25), transparent 60%),
    linear-gradient(135deg, #1b4f7a, #0b7a53);
}
.hero.season-spring::before{
  background:
    radial-gradient(1200px 220px at 20% 0%, rgba(255,255,255,.40), transparent 60%),
    radial-gradient(900px 240px at 80% 20%, rgba(255,192,203,.35), transparent 60%),
    linear-gradient(135deg, #d946ef, #0b7a53);
}
.hero.season-summer::before{
  background:
    radial-gradient(1200px 220px at 20% 0%, rgba(255,255,255,.40), transparent 60%),
    radial-gradient(900px 240px at 80% 20%, rgba(255,255,0,.25), transparent 60%),
    linear-gradient(135deg, #2563eb, #0b7a53);
}
.hero.season-winter::before{
  background:
    radial-gradient(1200px 220px at 30% 0%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(900px 240px at 80% 20%, rgba(225,245,255,.35), transparent 60%),
    linear-gradient(135deg, #0b3a67, #4fb6e8);
}

/* ========== テーブル全体 ========== */
.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.table th,
.table td{
  border-bottom: 1px solid var(--border);
  padding: 14px 12px;
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
}

/* 列幅：文字列列は少し広め、画像列は固定気味 */
.table th:nth-child(1), .table td:nth-child(1){ width: 18%; }
.table th:nth-child(2), .table td:nth-child(2){ width: 10%; }
.table th:nth-child(3), .table td:nth-child(3){ width: 12%; }
.table th:nth-child(4), .table td:nth-child(4),
.table th:nth-child(5), .table td:nth-child(5),
.table th:nth-child(6), .table td:nth-child(6){ width: 20%; }

/* ========== ヘッダー ========== */
.table thead th{
  position: sticky;   /* スクロールしてもヘッダーが残る */
  top: 0;
  z-index: 2;
  background: var(--head);
  color: var(--headText);
  border-bottom: 1px solid rgba(255,255,255,.15);
}

.sortable{
  cursor: pointer;
  user-select: none;
}

.sortable:hover{
  filter: brightness(1.06);
}

/* ========== 行の見やすさ（装飾の肝） ========== */
.table tbody tr:nth-child(even){
  background: #fafafa;
}

.table tbody tr:hover{
  background: #eef6f1;
}

/* ========== 三角印 ========== */
.ascending:after { content: " ▲"; }
.descending:after { content: " ▼"; }

.sortable-always-arrows::after{
  content: " ▲▼";
  font-size: 0.9em;
  margin-left: 0.2em;
  opacity: .9;
}

.sortable-always-arrows.ascending::after,
.sortable-always-arrows.descending::after{
  content: "";
}

/* ========== リンク ========== */
.link{
  text-decoration: none;
  color: #2563eb;
  font-weight: 600;
}
.link:hover{
  text-decoration: underline;
}

/* ========== 画像（統一感＋歯抜け対策） ========== */
.thumb{
  width: 120px;          /* サムネ幅：少し大きくすると見栄えUP */
  height: 80px;          /* 高さ固定＝歯抜けしてもレイアウト崩れにくい */
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f3f4f6;   /* 読み込み中の“台”になる */
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  display: inline-block;
}

/* スマホでは横スクロールに */
@media (max-width: 900px){
  .table{
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .thumb{ width: 110px; height: 74px; }
}

/* ===== 検索バー（テーブル手前のコントロール） ===== */
.toolbar{
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin: 12px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  position: relative;   /* ★ 追加 */
  z-index: 50;          /* ★ 追加（まずは 50 で十分。ダメなら 200 へ） */
}

.search{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 520px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}

.search-icon{
  opacity: .75;
  font-size: 14px;
}

.search-input{
  border: 0;
  outline: none;
  width: 100%;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}

.search-clear{
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: .55;
  padding: 0 6px;
}
.search-clear:hover{ opacity: .9; }

.search-meta{
  font-size: 12px;
  color: var(--muted);
  min-width: 92px;
  text-align: right;
}

/* ===== help popover ( ? ) ===== */
.help-wrap{
  position: relative;     /* ポップオーバーの基準点 */
  display: inline-flex;
  align-items: center;
}

/* ボタン */
.help-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  color: rgba(0,0,0,0.55);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* ポップオーバー */
.help-popover{
  position: absolute;
  top: calc(100% + 10px);   /* ? の少し下 */
  right: 0;                 /* 右寄せ（必要なら left:0 に） */
  width: 360px;
  max-width: min(360px, 85vw);
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0,0,0,0.12);
  border: 1px solid rgba(0,0,0,0.08);

  z-index: 9999;            /* ★ これが本命：テーブルより前に出す */
}

/* 開閉（JSで is-open を付け外し） */
.help-popover{ display: none; }
.help-popover.is-open{ display: block; }



/* 検索で見つかった行の一時ハイライト（上品に） */
.table tbody tr.hit-flash{
  animation: hitFlash 1.1s ease;
}
@keyframes hitFlash{
  0%{ background: #fff7cc; }
  100%{ background: inherit; }
}

@media (max-width: 900px){
  .toolbar{ flex-direction: column; align-items: stretch; }
  .search{ max-width: none; }
  .search-meta{ text-align: left; min-width: auto; }
}

/* ===== 検索：行の見え方を少し気持ちよくする ===== */
.table tbody tr {
  transition: background-color 0.18s ease;
}

.table tbody tr.is-hit {
  background-color: rgba(255, 255, 255, 0.55);
}

/* ===== 検索input(type=search)の標準クリア(×)を消す ===== */
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

/* ===== Comments UI ===== */
.post-card {
  border: 1px solid #ddd;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #fff;
}

.post-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}

.post-tag {
  font-weight: 700;
}

.post-time {
  white-space: nowrap;
}

.post-body {
  margin: 8px 0;
  line-height: 1.6;
  white-space: pre-wrap; /* 改行を保つ */
}

.post-foot {
  font-size: 12px;
  color: #888;
}

/* ===== Comments layout (container) ===== */
.comments-list {
  max-width: 720px;
  margin: 16px 0;
}

.comment-form {
  max-width: 720px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  margin: 12px 0 16px;
}

.comment-form .comment-row {
  margin-bottom: 10px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
}

.comment-form textarea {
  min-height: 110px;
  resize: vertical;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Polish: tag + spacing ===== */
.post-card {
  margin-bottom: 16px; /* B: カード間の余白を少し増やす */
}

.post-tag {
  display: inline-block;
  background: #eef3ff;      /* A: タグを少し目立たせる */
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.comment-flash {
  font-size: 12px;
  margin-left: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e9f7ef;
  color: #1b4332;
  display: inline-block;
}
.comment-flash:empty {
  display: none; /* 空のときは非表示 */
}

/* ===== comment hint near search =====
  NOTE:
  baseline / line-height / toolbarのレイアウト影響で、単純な相殺(topとtranslateYの入れ替え)が成立しないことがある。
  見た目が決まっているこの値を正として固定する。
  微調整は下のCSS変数だけ触る。
*/
:root{
  --hint-top: -10px;      /* 文字（リンク全体）の上下 -で上がる +で下がる */
  --feather-y: 10px;      /* 羽根だけの上下（ペン先合わせ） -で上がる　+で下がる */
  --feather-size: 40px;  /* 羽根サイズ */
  --hint-gap: 0px;       /* 文字と羽根の距離 */
  --hint-left: -22px;   /* 検索窓と文字の横距離（-で左へ、+で右へ） */
}

.comment-hint{
  text-decoration: none;
  color: inherit;
  cursor: pointer;

  display: inline-flex;
  align-items: baseline;
  gap: var(--hint-gap);

  line-height: 1.2;
  margin-left: var(--hint-left);

  font-size: 0.82em;
  opacity: 0.78;
  letter-spacing: 0.02em;

  position: relative;
  top: var(--hint-top);
}

.comment-hint:hover{
  opacity: 0.92;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.comment-hint:focus-visible{
  outline: 2px solid rgba(0,0,0,0.15);
  outline-offset: 4px;
  border-radius: 999px;
}

.comment-hint-icon.feather{
  width: var(--feather-size);
  height: var(--feather-size);
  display: inline-block;

  background-color: #c7b082;

  -webkit-mask: url("/assets/img/feather.png") center / contain no-repeat;
          mask: url("/assets/img/feather.png") center / contain no-repeat;

  transform: translateY(var(--feather-y)) rotate(-12deg);
  opacity: 0.95;
}

/* ===== help popover (?) near search ===== */
.help-wrap{
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px; /* comment-hint との距離 */
}

.help-btn{
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.18);
  background: transparent;
  color: inherit;

  font-size: 12px;
  line-height: 1;
  opacity: 0.65;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.help-btn:hover{ opacity: 0.85; }
.help-btn:focus-visible{
  outline: 2px solid rgba(0,0,0,0.15);
  outline-offset: 3px;
}

.help-popover{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;

  min-width: 260px;
  max-width: 320px;

  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);

  font-size: 12.5px;
  line-height: 1.5;
  color: inherit;

  display: none; /* JSで開閉 */
  z-index: 30;
}

.help-popover.is-open{ display: block; }

.help-title{
  font-weight: 600;
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 6px;
}

.help-list{
  margin: 0;
  padding-left: 18px;
}

.help-list li{
  margin: 0 0 4px 0;
  opacity: 0.9;
}

/* モバイルではポップが画面外に出やすいので少し左寄せ */
@media (max-width: 820px){
  .help-popover{
    right: auto;
    left: 0;
  }
}



/* モバイル表示用 */
@media (max-width: 820px) {
  .comment-hint{
    display: inline-flex;     /* 消さない */
    margin-left: 0;           /* 変な食い込みを防ぐ */
    font-size: 0.78em;        /* 少し控えめ */
    opacity: 0.72;
  }
  .comment-hint-icon.feather{
    width: 32px;
    height: 32px;
  }
}

