/*
 * 利用規約・プライバシーポリシー（public/terms/, public/privacy/）の共通スタイル。
 * アプリ本体とは独立した静的ページ（未ログインでも読めるように、AuthGate の外に置く）。
 * CSP（netlify.toml）は style-src 'self' を許可しているので、外部CSSはこのファイルだけにする。
 *
 * フォントは外部（Google Fonts）から読み込まない（BACKLOGINSIGHTS-38）。本文はアプリ本体と同じく端末のフォント
 * （Tailwind の font-sans と同じ指定）。ロゴはアプリと同じ画像（public/images/logo.png）を使う。
 */

:root {
  --brand-dark: #0c3832;
  --brand-primary: #00c896;
  --brand-secondary: #1e7868;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --pending-bg: #fef3c7;
  --pending-text: #92400e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  font-size: 15px;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--brand-secondary);
}

a:hover {
  color: var(--brand-dark);
}

.inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ヘッダー */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

/* アプリと同じワードマーク（Bのアイコン＋「Backlog Insights」。横:縦 = 5:1） */
.brand img {
  display: block;
  width: auto;
  height: 32px;
}

.doc-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  font-size: 13px;
}

.doc-nav a {
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
}

.doc-nav a:hover {
  background: var(--bg);
  color: var(--text);
}

.doc-nav a[aria-current='page'] {
  background: var(--brand-dark);
  color: #fff;
}

/* アプリへの導線。本文を読み終えた人が、そのまま登録・ログインに進めるようにする */
.auth-links {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.auth-link {
  padding: 6px 14px;
  border: 1px solid var(--brand-dark);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.auth-link.login {
  background: var(--surface);
  color: var(--brand-dark);
}

.auth-link.login:hover {
  background: var(--bg);
  color: var(--brand-dark);
}

.auth-link.signup {
  border-color: var(--brand-primary);
  background: var(--brand-primary);
  color: #04261f;
}

.auth-link.signup:hover {
  border-color: #00b386;
  background: #00b386;
  color: #04261f;
}

/* 本文 */
.doc {
  max-width: 880px;
  margin: 32px auto 48px;
  padding: 40px 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.draft-banner {
  margin: 0 0 28px;
  padding: 12px 16px;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  background: #fffbeb;
  color: var(--pending-text);
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.4;
  color: var(--brand-dark);
}

.service {
  margin: 4px 0 28px;
  color: var(--text-muted);
  font-size: 13px;
}

/* 版（最終更新日）。同意の記録に残す版と同じ値 */
.service .updated {
  margin-left: 16px;
}

h2 {
  margin: 0 0 12px;
  padding-left: 12px;
  border-left: 4px solid var(--brand-primary);
  font-size: 18px;
  line-height: 1.5;
  color: var(--brand-dark);
}

section {
  margin-top: 36px;
}

p {
  margin: 0 0 12px;
}

/* 目次 */
.toc {
  margin: 0 0 28px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 14px;
}

.toc-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--brand-dark);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 24px;
}

.toc li {
  break-inside: avoid;
}

.toc a {
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

/* 条文の番号付きリストは「1.」、その下の階層は「(1)」にする */
section ol,
section ul {
  margin: 0 0 12px;
  padding-left: 1.6em;
}

section li {
  margin: 2px 0;
}

section ol.sub {
  counter-reset: sub;
  list-style: none;
  padding-left: 2.2em;
}

section ol.sub > li {
  counter-increment: sub;
  position: relative;
}

section ol.sub > li::before {
  content: '(' counter(sub) ')';
  position: absolute;
  left: -2.2em;
  color: var(--text-muted);
}

section ul.sub {
  list-style: disc;
}

/* 表 */
.table-wrap {
  margin: 0 0 16px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.7;
}

th,
td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--bg);
  font-weight: 700;
  white-space: nowrap;
}

td:first-child {
  min-width: 8em;
}

/* 未決定の箇所（草案のあいだだけ使う） */
mark.pending {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--pending-bg);
  color: var(--pending-text);
  font-weight: 500;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* 問い合わせ窓口 */
.contact-card {
  margin: 0 0 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-primary);
  border-radius: 10px;
  background: var(--bg);
}

.contact-name {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--brand-dark);
}

.contact-card dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 20px;
  margin: 0;
}

.contact-card dt {
  color: var(--text-muted);
}

.contact-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.to-top {
  margin: 40px 0 0;
  text-align: right;
  font-size: 13px;
}

/* フッター */
.site-footer {
  padding: 24px 0 40px;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer p {
  margin: 0;
}

/* スマートフォン */
@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .inner {
    padding: 0 16px;
  }

  .site-header .inner {
    flex-wrap: wrap;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 8px;
    gap: 8px 12px;
  }

  .auth-links {
    margin-left: auto;
    gap: 6px;
  }

  .auth-link {
    padding: 4px 10px;
    font-size: 12px;
  }

  .doc-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .contact-card dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .contact-card dd {
    margin-bottom: 6px;
  }

  .brand {
    gap: 8px;
  }

  .brand img {
    height: 26px;
  }

  .doc-nav {
    gap: 2px;
  }

  html {
    scroll-padding-top: 104px;
  }

  .doc-nav a {
    padding: 4px 8px;
    font-size: 12px;
  }

  .doc {
    margin: 0 0 32px;
    padding: 28px 20px;
    border: 0;
    border-radius: 0;
  }

  h1 {
    font-size: 22px;
  }

  .toc ol {
    columns: 1;
  }
}

/* 印刷 */
@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .auth-links,
  .toc,
  /* 問い合わせ窓口 */
.contact-card {
  margin: 0 0 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-primary);
  border-radius: 10px;
  background: var(--bg);
}

.contact-name {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--brand-dark);
}

.contact-card dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 20px;
  margin: 0;
}

.contact-card dt {
  color: var(--text-muted);
}

.contact-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.dates {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.to-top {
    display: none;
  }

  .doc {
    margin: 0;
    padding: 0;
    border: 0;
  }

  section {
    break-inside: auto;
  }

  h2 {
    break-after: avoid;
  }
}
