/* ====== 基本 ====== */
* { box-sizing: border-box; }

:root{
  /* ベース（ライト） */
  --bg: #e0eff8;            /* 淡い水色 */
  --text: #111;
  --surface: #ffffff;
  --border: #e5e7eb;

  /* ブランド（水色〜青） */
  --brand: #004b87;
  --link: #0b57d0;

  /* UI */
  --radius: 10px;
  --focus: #2dd4bf;         /* 青緑（色覚多様性に比較的強く、水のイメージにも合う） */
  --focus_shadow: rgba(45, 212, 191, 0.25);
}

body{
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.85;        /* 老眼配慮で少し広め */
  font-size: 16.5px;        /* 老眼配慮でほんの少し大きく */
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

/* リンク（色だけに頼らない） */
a{
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover{
  text-decoration-thickness: 2px;
}

/* キーボード操作の見やすさ（アクセシビリティ） */
a:focus-visible,
.btn:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus_shadow);
}

/* ====== 見出し ====== */
h1{
  margin: 0 0 10px 0;
  font-size: 1.45rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

h2{
  margin: 28px 0 14px;
  font-size: 1.45rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 4px;
  color: var(--brand);
}

h3{
  margin: 22px 0 8px;
  font-size: 1.12rem;
}

/* ====== リスト ====== */
ul{
  padding-left: 1.2em;
  margin: 10px 0 18px;
}

li{
  margin: 6px 0;
}

/* ====== レイアウト（幅・余白） ====== */
main, header, footer{
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 18px;
}

main{
  background: var(--surface);
  border-radius: var(--radius);
  margin-top: 16px;
}

/* ====== ヘッダー ====== */
header{
  padding-top: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

header h1{
  margin: 0;
}

header h1 a{
  text-decoration: none;     /* サイト名リンクは下線なしでOK */
  color: inherit;
}

header h1 a:hover{
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ====== ナビ（ボタンっぽさを抑える） ====== */
header nav{
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 1rem;
}

/* “ボタン化”の原因だった padding/角丸/背景を基本オフ */
header nav a{
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 2px 0;
  border-radius: 0;
}

/* ただし hover は「控えめに」視認性アップ（背景はうっすら） */
header nav a:hover{
  background: transparent;
  text-decoration-thickness: 2px;
}

/* ナビを区切りたい場合（控えめ） */
header nav a + a{
  position: relative;
  padding-left: 12px;
}
header nav a + a::before{
  content: "";
  position: absolute;
  left: 5px;
  top: 55%;
  transform: translateY(-50%);
  width: 1px;
  height: 14px;
  background: var(--border);
}

/* ====== 本文 ====== */
main p{
  margin: 10px 0 14px;
}

main p strong{
  display: inline-block;
  font-weight: 750;
}

/* ====== ボタン（角丸を控えめに・読みやすく） ====== */
.btn{
  display: inline-block;
  margin: 10px 0;
  padding: 11px 14px;
  border-radius: 8px;        /* 10→8で少し“ボタン感”控えめ */
  background: var(--link);
  color: #fff;
  text-decoration: none;     /* ボタンは下線なし */
  font-weight: 750;
}

.btn:hover{
  filter: brightness(0.95);
}

/* ====== メールリンク（本文内だけ） ====== */
main a[href^="mailto"]{
  font-weight: 600;
}

/* ====== フッター ====== */
footer{
  border-top: 1px solid var(--border);
  padding: 18px 0 24px;
  font-size: 0.95rem;        /* 0.9→0.95 老眼配慮 */
  color: #444;
}

/* フッターレイアウト */
footer nav{
  margin-bottom: 10px;
}

footer .footer-info{
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

footer .related-links ul{
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

/* フッターリンク */
footer a{
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

footer a:hover{
  text-decoration-thickness: 2px;
}

/* ====== 表（record_dates.html など） ====== */
table{
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;              /* 角丸を効かせる */
  background: var(--surface);
}

thead th{
  text-align: left;
  font-weight: 750;
  color: var(--brand);
  background: rgba(0, 75, 135, 0.06);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

tbody td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td{
  border-bottom: none;
}

/* うっすら交互色（色だけに頼らず境界線もあるので、色弱にも優しい） */
tbody tr:nth-child(even){
  background: rgba(0, 0, 0, 0.02);
}

/* セル内の長文・URLを折り返す */
td, th{
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ====== 例会記録（record.html）見出し・本文の整形 ====== */
h4{
  margin: 20px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 1.05rem;
  color: var(--brand);
}

.event-title{
  font-weight: 800;
}

.speaker{
  display: inline-block;
  margin-top: 4px;
  color: rgba(17, 17, 17, 0.82);
}

/* スマホ：表は横スクロールで崩れ防止（2列ならほぼ崩れませんが保険） */
@media (max-width: 700px){
  table{
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  thead, tbody, tr{
    width: 100%;
  }
}

/* ====== スマホ微調整 ====== */
@media (max-width: 520px){
  body{ font-size: 16px; }
  h1{ font-size: 1.25rem; }
  h2{ margin: 24px 0 12px; }
  h3{ margin: 18px 0 6px; }
  main, header, footer{ padding: 14px 14px; }
}

/* ====== ダークモード（上下水道：青/水色系、色弱配慮で高コントラスト） ====== */
@media (prefers-color-scheme: dark){

  :root{
    /* 背景は“真っ黒”を避けて疲れにくく */
    --bg: #071826;           /* 深い青緑寄り（夜の水面イメージ） */
    --surface: #0b2234;      /* カード背景：少し明るい */
    --text: #eaf2f7;         /* 文字：しっかり明るく */
    --border: rgba(255,255,255,0.16);

    /* ブランドは保ちつつ、暗背景で沈まない青へ */
    --brand: #7dd3fc;        /* 見出し：水色（読みやすい） */
    --link: #a5f3fc;         /* リンク：青緑寄りの明るい水色 */

    /* フォーカス：さらに目立つ（色覚多様性＋暗所での視認性） */
    --focus: #22d3ee;
    --focus_shadow: rgba(34, 211, 238, 0.28);
  }

  body{
    background: var(--bg);
    color: var(--text);
  }

  main{
    background: var(--surface);
  }

  header, footer{
    border-color: var(--border);
  }

  /* 見出しの境界線も暗背景で見えるように */
  h2{
    border-bottom-color: var(--border);
    color: var(--brand);
  }

  /* リンク：色だけでなく下線で確実に判別（色弱対応の肝） */
  a{
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
  }

  a:hover{
    text-decoration-thickness: 2px;
  }

  /* ナビ hover は背景を“うっすら”出して、どこにいるか分かるように */
  header nav a:hover{
    background: rgba(165, 243, 252, 0.10);
  }

  /* ナビの区切り線も暗背景で */
  header nav a + a::before{
    background: var(--border);
  }

  /* ボタン：青系のまま、暗背景でコントラスト確保 */
  .btn{
    background: #38bdf8;     /* 明るい水色寄りの青 */
    color: #062033;          /* 文字は濃い色で読みやすく */
  }

  .btn:hover{
    filter: brightness(0.98);
  }

  /* フッター文字を少し明るくして潰れ防止 */
  footer{
    color: rgba(234, 242, 247, 0.88);
  }

  footer a{
    color: var(--brand);
  }
/* 表：暗背景での視認性 */
table{
  border-color: var(--border);
  background: var(--surface);
}

thead th{
  background: rgba(125, 211, 252, 0.12);
  border-bottom-color: var(--border);
  color: var(--brand);
}

tbody td{
  border-bottom-color: var(--border);
}

tbody tr:nth-child(even){
  background: rgba(255, 255, 255, 0.04);
}

/* record.html の話者表示 */
.speaker{
  color: rgba(234, 242, 247, 0.86);
}

}
/* ====== 上へ戻るボタン ====== */
/* ====== ページ最上部へ戻る（安全領域対応・安定版） ====== */
.to-top{
  position: fixed;

  /* iPhoneのノッチ/ホームバーの安全領域を避ける */
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));

  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;

  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;

  border-radius: 999px;
  z-index: 999;

  /* 透明すぎると見失うので少し“実体”を持たせる */
  background: rgba(255,255,255,0.92);
  color: #0b3f73;
  border: 1px solid rgba(11,63,115,0.25);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);

  /* 横はみ出し防止（まれに影で横幅扱いが出るのを抑える） */
  max-width: 40px;
  overflow: hidden;
}

/* 対応ブラウザだけガラス風を足す（不安定対策） */
@supports ((-webkit-backdrop-filter: blur(6px)) or (backdrop-filter: blur(6px))){
  .to-top{
    background: rgba(80, 150, 210, 0.18);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}

/* ダークモードで見えるように */
@media (prefers-color-scheme: dark){
  .to-top{
    background: rgba(15, 23, 42, 0.72);
    color: #dbeafe;
    border: 1px solid rgba(219,234,254,0.25);
  }
}

/* ====== スマホではフル幅（左右の“間”をなくす） ====== */
@media (max-width: 520px){
  header, main, footer{
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;     /* カード感をやめる */
    padding-left: 14px;   /* 余白は最低限 */
    padding-right: 14px;
  }

  body{
    background: var(--surface);   /* 端の色差を消して“余り感”を減らす */
  }
}
/* ===== iPhone/Safariでの横ズレ対策 ===== */
html, body{
  width: 100%;
  max-width: 100%;
  overflow-x: clip;         /* 対応してない場合は下の hidden が効く */
}

@supports not (overflow: clip){
  html, body{ overflow-x: hidden; }
}

/* iPhone Safariの文字サイズ自動調整でレイアウトが動くのを抑える */
body{
  -webkit-text-size-adjust: 100%;
}

/* 記録ページの本文で、長いURL等が横にはみ出さないように */
main p, main li, main .speaker, main .event-title{
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ===== Googleフォーム ===== */
.form-embed{
  margin: 14px 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.form-embed iframe{
  width: 100%;
  height: 1050px; /* フォームに応じて調整 */
  border: 0;
  display: block;
}