/* ============================================================
   SEO研究チャンネル 資料配布システム — 共通スタイル
   app.css
   - すべての画面（ユーザー向け / 管理画面）で読み込む共通CSS
   - デザイントークン + 共通コンポーネントクラスで構成
   - Tailwind を使う場合は、各コンポーネントクラスを
     @apply に置き換えても同じ見た目になるよう、素のCSSで定義
   ============================================================ */

/* ---------- デザイントークン ---------- */
:root {
  --navy:        #16263f;  /* 見出し最濃 */
  --ink:         #1c2c47;  /* 基本テキスト（濃ネイビー） */
  --blue:        #2557c7;  /* プライマリ（ブルー） */
  --blue-dark:   #1f4cb0;  /* プライマリ hover */
  --blue-bg:     #eaf0fc;  /* 薄ブルー面 */
  --text:        #3c4656;  /* 本文 */
  --muted:       #5b6577;  /* 補足 */
  --muted-2:     #6b7588;  /* ラベル */
  --faint:       #97a0b0;  /* 最も薄い補足 */
  --bg:          #f4f6f9;  /* ページ背景 */
  --surface:     #ffffff;  /* カード面 */
  --line:        #e7eaf0;  /* 罫線 */
  --line-2:      #eef1f6;  /* 罫線（薄） */
  --field-border:#d3dae6;  /* 入力欄の枠 */
  --danger:      #d92d20;  /* エラー */
  --radius:      12px;
  --radius-sm:   8px;
}

/* ---------- ベース ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont,
               "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--ink);
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- sticky-footer レイアウト ----------
   .page を min-h-dvh の縦フレックスにし、main を flex:1、footer を mt-auto。
   position:fixed は使わない。 */
.page        { min-height: 100dvh; display: flex; flex-direction: column; }
.page__main  { flex: 1 0 auto; }
.site-footer { margin-top: auto; }

/* ---------- 共通コンテナ幅 ----------
   ユーザー向け = 960px / 管理画面（.page--admin）= 1160px */
.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.page--admin .container { max-width: 1160px; }

/* ============================================================
   共通ヘッダー  (partials/site-header.php)
   ============================================================ */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__dot { width: 8px; height: 8px; border-radius: 2px; background: var(--blue); }
.brand__name { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: .01em; }
.site-header__right { display: flex; align-items: center; gap: 12px; }
.site-header__user  { font-size: 13px; color: var(--muted-2); }

/* 右上バッジ：ユーザー向け = アウトライン / 管理画面 = 塗り */
.badge-pill { font-size: 12px; font-weight: 500; color: var(--muted-2); border: 1px solid #dde2ec; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.badge-pill--admin { font-weight: 700; color: var(--ink); background: var(--blue-bg); border-color: #d4e0fa; padding: 4px 12px; }

/* ============================================================
   共通フッター  (partials/site-footer.php)
   ============================================================ */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); }
.site-footer__inner { padding: 24px 0; }
.site-footer__copy  { font-size: 12px; color: #8a93a5; }

/* ============================================================
   共通カード
   ============================================================ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card--pad   { padding: 40px; }                 /* PC 40px / スマホ 24px */
@media (max-width: 640px) { .card--pad { padding: 24px; } }
.card--soft  { background: #f7f9fc; border-color: var(--line-2); }

/* ============================================================
   共通ボタン
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1;
  text-decoration: none; cursor: pointer; border: none;
  padding: 15px 28px; min-height: 52px; border-radius: var(--radius-sm);
  transition: background .15s ease, border-color .15s ease;
}
.btn:focus-visible { outline: 3px solid rgba(37,87,199,.35); outline-offset: 2px; }
.btn--primary   { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-dark); }
.btn--secondary { background: #fff; color: var(--ink); border: 1px solid #cdd5e3; }
.btn--secondary:hover { background: var(--bg); border-color: #b7c1d4; }
.btn--sm  { font-size: 14px; padding: 12px 22px; min-height: 48px; }
/* ファーストビュー/フォーム用CTA：スマホ100% / PC最大400px */
.btn--cta { width: 100%; max-width: 400px; }
.btn--block { width: 100%; }

/* アイコンだけの小ボタン（URLコピー等） */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--muted); background: #fff; border: 1px solid var(--field-border); border-radius: 6px; cursor: pointer; text-decoration: none; transition: background .15s ease, color .15s ease; }
.icon-btn:hover { background: var(--bg); color: var(--blue); }
.icon-btn:focus-visible { outline: 2px solid rgba(37,87,199,.4); outline-offset: 2px; }

/* ============================================================
   見出し / リード
   ============================================================ */
.eyebrow    { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--blue); letter-spacing: .04em; }
.eyebrow--muted { color: var(--muted-2); }
.page-title { margin: 0 0 8px; font-size: 26px; font-weight: 700; line-height: 1.4; color: var(--navy); }
.hero-title { margin: 0 0 18px; font-size: 30px; font-weight: 700; line-height: 1.5; color: var(--navy); text-wrap: pretty; }
.lead       { margin: 0; font-size: 14px; line-height: 1.75; color: var(--muted); }
.section-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; color: var(--navy); }
.section-desc  { margin: 0 0 16px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.divider { border: none; border-top: 1px solid var(--line-2); margin: 32px 0; }

/* ============================================================
   ステータスバッジ（管理画面 一覧）
   公開中 = 緑系 / 期限切れ = アンバー系（強い赤は不使用）
   ============================================================ */
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.status__dot { width: 6px; height: 6px; border-radius: 50%; }
.status--active  { color: #1f6b41; background: #eaf4ee; border: 1px solid #c6e3cf; }
.status--active  .status__dot { background: #2f9e5f; }
.status--expired { color: #8a6a2e; background: #fbf3e6; border: 1px solid #f0deba; }
.status--expired .status__dot { background: #c79338; }

/* 必須 / 任意 バッジ（フォーム） */
.tag-req { font-size: 11px; font-weight: 700; color: #b4541a; background: #fdf0e6; border: 1px solid #f3d5b8; border-radius: 5px; padding: 2px 8px; }
.tag-opt { font-size: 11px; font-weight: 700; color: var(--muted-2); background: #f0f3f9; border: 1px solid #dde2ec; border-radius: 5px; padding: 2px 8px; }

/* ============================================================
   フォーム
   ============================================================ */
.field { margin-bottom: 22px; }
.field__head  { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.field__label { font-size: 14px; font-weight: 700; color: var(--ink); }
.field__hint  { margin: 7px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--faint); }
.field__error { margin: 7px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--danger); }

.input, .select, .textarea {
  width: 100%; box-sizing: border-box; font-family: inherit;
  font-size: 15px; color: var(--ink);
  padding: 12px 14px; min-height: 48px;
  border: 1px solid var(--field-border); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.select { cursor: pointer; }
.textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; line-height: 1.7; padding: 14px 16px; min-height: 320px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,87,199,.16); }
.input--auto { width: auto; }  /* type=date 等、幅を内容に合わせる */

/* アクセシブルなファイル選択ボックス（標準UIは視覚的に隠す） */
.file-box { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1.5px dashed #c4cee0; border-radius: 10px; background: #fafbfd; cursor: pointer; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.file-box:hover { border-color: var(--blue); background: #f5f8ff; }
.file-box:focus-within { border-color: var(--blue); background: #f5f8ff; box-shadow: 0 0 0 3px rgba(37,87,199,.16); }
.file-box__icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px; background: var(--blue-bg); display: flex; align-items: center; justify-content: center; }
.file-box__name { margin-left: auto; font-size: 12.5px; color: var(--faint); background: #fff; border: 1px solid #e1e7f1; border-radius: 6px; padding: 6px 12px; white-space: nowrap; }
.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; }

.char-count { display: flex; justify-content: flex-end; margin-top: 6px; }
.char-count span { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* 送信ボタンエリア：PC 左右 / スマホ 縦並び */
.form-actions { display: flex; flex-direction: column; gap: 14px; }
.form-actions__note { order: 2; margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted-2); }
.form-actions__buttons { order: 1; display: flex; flex-direction: column; gap: 10px; }
.form-actions__buttons > * { width: 100%; }
@media (min-width: 640px) {
  .form-actions { flex-direction: row; align-items: center; justify-content: space-between; }
  .form-actions__note { order: 1; }
  .form-actions__buttons { order: 2; flex-direction: row; align-items: center; }
  .form-actions__buttons > * { width: auto; }
}

/* ============================================================
   通知 / 情報ボックス
   ============================================================ */
.alert { display: flex; gap: 9px; align-items: flex-start; padding: 13px 15px; border-radius: var(--radius-sm); }
.alert__icon { margin-top: 2px; flex-shrink: 0; }
.alert__text { font-size: 13.5px; line-height: 1.7; }
.alert--error   { background: #fef3f2; border: 1px solid #f5c4bf; border-left: 3px solid var(--danger); }
.alert--error   .alert__text { color: #b42318; }
.alert--success { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; background: #eef6f0; border: 1px solid #c6e3cf; border-left: 3px solid #2f9e5f; padding: 14px 18px; }
.alert--warn    { background: #fff8f0; border: 1px solid #f2dcbb; border-left: 3px solid #e0902a; }
.alert--warn    .alert__text { color: #6b4a1d; }

/* 落ち着いた情報ボックス（薄ブルー） */
.info-box { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; background: #f0f3f9; border: 1px solid #e1e7f1; border-radius: var(--radius-sm); }
.info-box__icon { margin-top: 2px; flex-shrink: 0; }
.info-box__text { margin: 0; font-size: 13px; line-height: 1.75; color: var(--text); }
.info-box__sub  { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--faint); }

/* ============================================================
   Markdown 本文（ユーザーLP）  material.bodyMarkdownHtml を流し込む
   ============================================================ */
.prose { color: var(--text); font-size: 16px; line-height: 1.95; }
.prose > :first-child { margin-top: 0; }
.prose h2 { color: var(--ink); font-size: 21px; font-weight: 700; line-height: 1.5; margin: 2.2em 0 .8em; padding-bottom: .5em; border-bottom: 1px solid var(--line); letter-spacing: .01em; }
.prose h3 { color: var(--ink); font-size: 17px; font-weight: 700; line-height: 1.5; margin: 1.8em 0 .6em; }
.prose p  { margin: 1.1em 0; }
.prose ul, .prose ol { margin: 1.1em 0; padding-left: 1.4em; }
.prose li { margin: .5em 0; padding-left: .2em; }
.prose ul li::marker { color: var(--blue); }
.prose a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose blockquote { margin: 1.4em 0; padding: .4em 1.1em; border-left: 3px solid #c9d3e6; color: var(--muted); background: #f7f9fc; border-radius: 0 6px 6px 0; }
.prose code { font-size: .88em; background: var(--line-2); color: var(--ink); padding: .15em .4em; border-radius: 4px; }
code.inline { font-size: .88em; background: var(--line-2); color: var(--ink); padding: .1em .4em; border-radius: 4px; }

/* ============================================================
   状態画面（期限切れ / リンク無効）の中央カード
   ============================================================ */
.state-wrap { min-height: 100dvh; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; }
.state-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 48px 36px; text-align: center; }
.state-icon { width: 64px; height: 64px; margin: 0 auto 24px; border-radius: 50%; background: #f0f3f9; display: flex; align-items: center; justify-content: center; }
.state-icon--blue { background: var(--blue-bg); }
.state-title { margin: 0 0 14px; font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.state-text  { margin: 0; font-size: 15px; line-height: 1.85; color: var(--muted); }

/* ============================================================
   管理画面 一覧テーブル / カード切替
   PCテーブル = .pc-only / スマホカード = .sp-only
   ============================================================ */
.pc-only { display: none; }
.sp-only { display: block; }
@media (min-width: 880px) {
  .pc-only { display: block; }
  .sp-only { display: none; }
}

.mtable { width: 100%; border-collapse: collapse; }
.mtable th { font-size: 12px; font-weight: 700; color: var(--muted-2); text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
.mtable td { font-size: 13px; color: var(--text); padding: 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.mtable tr:last-child td { border-bottom: none; }
.mtable .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); white-space: nowrap; }
.url-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ink); background: #f3f5f9; border-radius: 5px; padding: 4px 8px; white-space: nowrap; }

/* ページネーション */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 28px; }
.pager a { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 42px; min-height: 42px; font-size: 13px; font-weight: 700; color: var(--muted); background: #fff; border: 1px solid var(--field-border); border-radius: var(--radius-sm); text-decoration: none; padding: 0 14px; }
.pager a:hover { background: var(--bg); }
.pager a[aria-current="page"] { color: #fff; background: var(--blue); border-color: var(--blue); }
.pager a:focus-visible { outline: 2px solid rgba(37,87,199,.4); outline-offset: 2px; }

/* 空状態 */
.empty { padding: 56px 32px; text-align: center; }
.empty__icon { width: 60px; height: 60px; margin: 0 auto 20px; border-radius: 50%; background: #f0f3f9; display: flex; align-items: center; justify-content: center; }
.empty__title { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: var(--navy); }
.empty__text  { margin: 0 auto 24px; max-width: 400px; font-size: 14px; line-height: 1.8; color: var(--muted); }

/* 戻るリンク */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--blue); }

/* User-facing header: simple text link only */
.brand--link { text-decoration: none; }
.brand--link:hover .brand__name { color: var(--blue); }

/* Responsive admin list helpers. Do not use inline display on these blocks. */
.sp-only.sp-stack { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 880px) { .sp-only.sp-stack { display: none; } }
.status--stopped { color: #5b6577; background: #f0f3f9; border: 1px solid #dde2ec; }
.status--stopped .status__dot { background: #7d8aa3; }

/* ============================================================
   v7: Claude Design 最新LP / 申請フォーム適用
   対象: /d/{slug}, /d/{slug}/request
   ============================================================ */
:root {
  --warn: #c5392b;
}

/* ユーザー向けページはClaude Designの800px幅に寄せる。管理画面は既存の1160pxを維持。 */
.page:not(.page--admin) .site-header .container,
.page:not(.page--admin) .site-footer .container {
  max-width: 800px;
}

/* ---------- LP ---------- */
.lp-main {
  max-width: 800px;
  padding-top: 36px;
  padding-bottom: 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero {
  padding: 44px 44px 40px;
}

.hero > .btn--cta {
  display: flex;
  margin-left: auto;
  margin-right: auto;
}


.hero__title {
  margin: 0 0 30px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--navy);
  text-wrap: pretty;
}

.hero__lead {
  margin: 0 0 30px;
  font-size: 16px;
  line-height: 1.9;
  color: #4b5566;
  max-width: 620px;
  text-wrap: pretty;
}

.hero__note {
  margin: 12px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted-2);
  max-width: 460px;
}


.hero .btn--cta {
  display: flex;
  margin-left: auto;
  margin-right: auto;
}

.body-card {
  padding: 40px;
}

.bottom-cta {
  margin-top: 12px;
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}

.bottom-cta__lead {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

/* ---------- 申請フォーム ---------- */
.form-main {
  max-width: 800px;
  padding-top: 28px;
  padding-bottom: 56px;
}

.form-main > .back-link {
  margin-bottom: 22px;
}

.form-card {
  padding: 40px;
}

.form-eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  letter-spacing: .04em;
}

.form-title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--navy);
  text-wrap: pretty;
}

.form-desc {
  margin: 0 0 30px;
  font-size: 16px;
  line-height: 1.9;
  color: #4b5566;
  text-wrap: pretty;
}

.form-card .form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-card .field__label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.form-card .field__label-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.form-card .input {
  min-height: 50px;
  padding: 13px 14px;
}

.note-warn {
  margin: 9px 0 0;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.7;
  color: var(--warn);
}

.note-sub {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--faint);
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.consent input {
  margin: 2px 0 0;
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  flex-shrink: 0;
  cursor: pointer;
}

.consent__text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.consent__text a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent__req {
  color: var(--danger);
  font-weight: 700;
}

.alert-error {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 12px 14px;
  background: #fef3f2;
  border: 1px solid #fbd5d0;
  border-radius: var(--radius-sm);
  margin-bottom: 26px;
}

.alert-error__icon {
  margin-top: 1px;
  flex-shrink: 0;
}

.alert-error__text {
  font-size: 13.5px;
  line-height: 1.7;
  color: #b42318;
}

.form-card .btn--block {
  min-height: 54px;
  padding: 16px 28px;
}

@media (max-width: 640px) {
  .lp-main {
    padding-top: 28px;
    padding-bottom: 48px;
  }

  .hero {
    padding: 32px 24px;
  }

  .hero__title {
    font-size: 26px;
  }

  .body-card {
    padding: 28px 24px;
  }

  .form-main {
    padding-top: 24px;
    padding-bottom: 48px;
  }

  .form-card {
    padding: 28px 24px;
  }
}

/* ============================================================
   v8: country restriction behavior for request/download only
   - LP remains public worldwide
   - Request form is visible but disabled outside Japan
   ============================================================ */
.alert-error--country {
  margin-bottom: 26px;
  border-left: 3px solid var(--danger);
}
.form--disabled {
  opacity: .72;
}
.input:disabled,
.textarea:disabled,
.select:disabled {
  color: #7d8aa3;
  background: #f3f5f9;
  border-color: #dfe4ee;
  cursor: not-allowed;
}
.consent--disabled {
  cursor: not-allowed;
}
.consent--disabled .consent__text {
  color: #7d8aa3;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  background: #9aa7bd;
  color: #fff;
  cursor: not-allowed;
}
.btn:disabled:hover,
.btn[aria-disabled="true"]:hover {
  background: #9aa7bd;
}


/* ============================================================
   v10: User LP cleanup
   - Hero no longer shows auto-generated lead text or explanatory note
   - Main CTA is centered
   - Favicon is set in layout-head.php
   ============================================================ */
.hero .btn--cta {
  display: flex;
  margin-left: auto;
  margin-right: auto;
}
.hero__title {
  margin-bottom: 28px;
}
.hero {
  text-align: left;
}
@media (max-width: 640px) {
  .hero .btn--cta {
    max-width: none;
  }
}
