/* RateLens Legal */

:root {
  color-scheme: light dark;

  --bg: #FAF7F0;
  --surface: #F0EBDF;
  --surface-elevated: #E4DCCB;
  --text-primary: #14121A;
  --text-secondary: #2E2A36;
  --text-tertiary: #514B5C;
  --divider: rgba(20, 18, 26, 0.14);
  --accent: #0E6E64;
  --accent-ink: #FFFFFF;
  --accent-2: #0B7A94;
  --warn: #9A6400;
  --hero-bg: #0B0F1A;
  --hero-text: #F5F1E6;
  --hero-accent: #4FD1B8;

  --radius: 6px;

  --font-text: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0F1A;
    --surface: #141A2A;
    --surface-elevated: #1E2639;
    --text-primary: #F5F1E6;
    --text-secondary: #DAD4C6;
    --text-tertiary: #9A94A6;
    --divider: rgba(245, 241, 230, 0.14);
    --accent: #4FD1B8;
    --accent-ink: #0B0F1A;
    --accent-2: #3DD6F5;
    --warn: #FFD84D;
    --hero-bg: #141A2A;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
a:hover { text-decoration-thickness: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg);
  border-bottom: 2px solid var(--text-primary);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  text-decoration: none;
}
.brand img { width: 28px; height: 28px; image-rendering: pixelated; }

.lang-switch {
  display: inline-flex;
  border: 2px solid var(--text-primary);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}
.lang-switch a {
  padding: 3px 12px;
  color: var(--text-primary);
  text-decoration: none;
}
.lang-switch a.active { background: var(--text-primary); color: var(--bg); }

/* ---------- Layout ---------- */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.hero {
  margin-bottom: 40px;
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--hero-bg);
  color: var(--hero-text);
  border-top: 4px solid var(--hero-accent);
}
.hero .eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--hero-accent);
}
.hero h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 40px);
  line-height: 1.25;
  color: var(--hero-text);
}
.hero .meta {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgba(245, 241, 230, 0.72);
}

/* ---------- TOC ---------- */
.toc {
  margin: 0 0 40px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--divider);
}
.toc h2 {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.toc ol { margin: 0; padding-left: 24px; }
.toc li { font-size: 15px; }
.toc a { color: var(--text-primary); }

/* ---------- Sections ---------- */
section.legal { margin: 40px 0; scroll-margin-top: 72px; }
section.legal h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.4;
}
section.legal h2 .num {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 15px;
}
section.legal h3 { margin: 24px 0 6px; font-size: 17px; }
h1, h2, h3 { text-wrap: balance; word-break: auto-phrase; }
section.legal p,
section.legal li { color: var(--text-secondary); font-size: 15.5px; }
section.legal ul,
section.legal ol { padding-left: 24px; }
section.legal li + li { margin-top: 4px; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.callout {
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border-left: 4px solid var(--accent-2);
  font-size: 15px;
  color: var(--text-secondary);
}
.callout.warn { border-left-color: var(--warn); }

.table-wrap { width: 100%; overflow-x: auto; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
  vertical-align: top;
}
th { background: var(--surface); color: var(--text-primary); }

.contact {
  display: inline-block;
  margin: 4px 0;
  padding: 10px 16px;
  border: 2px solid var(--text-primary);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px 24px 40px;
  border-top: 2px solid var(--text-primary);
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}
.site-footer .links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin-bottom: 10px;
}
.site-footer .links a { color: var(--text-tertiary); }

/* ---------- Landing ---------- */
.landing-hero { margin: 24px 0 40px; }
.landing-hero .badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 3px 10px;
  border: 2px solid var(--text-primary);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.landing-hero h1 { margin: 0 0 12px; font-size: clamp(26px, 6vw, 38px); line-height: 1.3; }
.landing-hero p { margin: 0; color: var(--text-tertiary); font-size: 16px; }

.group-title {
  margin: 40px 0 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.doc-card {
  display: block;
  padding: 18px 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid var(--text-primary);
  color: var(--text-primary);
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.doc-card:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--accent); }
.doc-card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.doc-card h3 { margin: 4px 0 6px; font-size: 18px; }
.doc-card p { margin: 0; font-size: 14px; color: var(--text-tertiary); }

/* ---------- 404 ---------- */
.page-404 { text-align: center; margin: 80px auto; max-width: 480px; }
.page-404 .display {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 88px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}
.page-404 h1 { margin: 20px 0 8px; font-size: 22px; }
.page-404 p { color: var(--text-tertiary); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 600px) {
  .site-header { padding: 10px 16px; }
  main { padding: 28px 16px 64px; }
  .hero { padding: 22px 18px; }
  section.legal h2 { font-size: 19px; }
  .toc { padding: 16px 18px; }

  /* 表はスマホでは行ごとのカードにする */
  .table-wrap { overflow-x: visible; }
  table { min-width: 0; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr {
    display: block;
    margin: 0 0 12px;
    border: 1px solid var(--divider);
    border-radius: var(--radius);
    background: var(--surface);
  }
  tbody td {
    display: block;
    padding: 8px 12px;
    border-bottom: 1px solid var(--divider);
  }
  tbody td:last-child { border-bottom: none; }
  tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
  }
}
