/*
 * 公認会計士 短答トレーナー サポートサイトの共通スタイル。
 * 色はアプリのテーマ（lib/src/core/theme/app_theme.dart）に合わせる。
 */

:root {
  --bg: #f8f7f3;
  --text: #18202a;
  --text-muted: #56616a;
  --border: #dde3df;
  --primary: #21486b;
  --content-width: 46rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111820;
    --text: #e7eaef;
    --text-muted: #a7b1ba;
    --border: #2d3a44;
    --primary: #aac9e4;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.85;
  letter-spacing: 0.02em;
  line-break: strict;
  overflow-wrap: break-word;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  background: var(--primary);
  color: var(--bg);
}

.skip-link:focus {
  top: 1rem;
}

/* ヘッダー */

.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header__inner,
.site-footer__inner,
.site-main {
  width: 100%;
  max-width: calc(var(--content-width) + 2.5rem);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-header__inner {
  padding-top: 0.875rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}

.brand__icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  flex: none;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.brand__name {
  font-weight: 700;
  font-size: 0.95rem;
}

.brand__sub {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.site-nav ul {
  display: flex;
  gap: 0.25rem;
  margin: 0.5rem -0.5rem 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav ul::-webkit-scrollbar {
  display: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: block;
  padding: 0.5rem 0.5rem 0.625rem;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--primary);
  color: var(--text);
  font-weight: 700;
}

@media (max-width: 40rem) {
  /* 横にスクロールできることが分かるよう、右端を薄くする */
  .site-nav ul {
    -webkit-mask-image: linear-gradient(to right, #000 82%, transparent);
    mask-image: linear-gradient(to right, #000 82%, transparent);
    padding-right: 2rem;
  }
}

/* 本文 */

.site-main {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header__eyebrow {
  margin: 0 0 0.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

h1,
h2,
h3,
h4 {
  word-break: auto-phrase;
  line-height: 1.45;
  font-feature-settings: "palt";
  letter-spacing: 0.04em;
}

h1 {
  margin: 0;
  font-size: clamp(1.625rem, 4vw, 2.125rem);
}


h2 {
  margin: 3.5rem 0 1rem;
  font-size: 1.375rem;
}

h3 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.125rem;
}

h4 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}

p,
ul,
ol,
table,
details {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.5rem;
}

li + li {
  margin-top: 0.25rem;
}

.page-updated {
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

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

strong {
  font-weight: 700;
}

/* 表: 囲み線や背景を付けず、行の間の細い罫線だけで区切る */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.7;
  table-layout: fixed;
}

/* 列幅を表どうしで揃える。2列の表は 30% / 70%、3列の表は 30% / 25% / 45% */
th:first-child {
  width: 30%;
}

th:nth-child(2):not(:last-child) {
  width: 25%;
}

th,
td {
  padding: 0.625rem 1rem 0.625rem 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 40rem) {
  /* JavaScript が動かない場合は横スクロールにする */
  table:not(.is-stackable) {
    display: block;
    overflow-x: auto;
  }

  table.is-stackable,
  table.is-stackable tbody,
  table.is-stackable tr,
  table.is-stackable td {
    display: block;
  }

  table.is-stackable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  table.is-stackable tr {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
  }

  table.is-stackable td {
    padding: 0;
    border: 0;
  }

  table.is-stackable td:first-child {
    font-weight: 700;
  }

  table.is-stackable td + td {
    margin-top: 0.375rem;
  }

  table.is-stackable td + td::before {
    content: attr(data-label) "：";
    color: var(--text-muted);
    font-size: 0.8125rem;
  }
}

/* 折りたたみ */

summary {
  cursor: pointer;
  color: var(--primary);
}

details[open] summary {
  margin-bottom: 0.5rem;
}

/* フッター */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.site-footer__inner {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.site-footer p {
  margin: 0.25rem 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.footer-links li + li {
  margin-top: 0;
}

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

/* プライバシーポリシーの要点・目次・注記は、囲みを付けず本文と同じ組み方にする */

.summary h2 {
  margin-top: 2rem;
}

.summary li + li {
  margin-top: 0.5rem;
}

.toc {
  margin: 2rem 0 0;
}

.toc p {
  margin: 0 0 0.25rem;
  font-weight: 700;
}

.toc ol {
  columns: 2 14rem;
  column-gap: 2rem;
  margin: 0;
}

.toc li {
  break-inside: avoid;
}

.toc li + li {
  margin-top: 0;
}

.note,
.caution {
  margin: 1.5rem 0;
}

.note > :last-child,
.caution > :last-child {
  margin-bottom: 0;
}

.note p:first-child,
.caution p:first-child {
  margin-bottom: 0.25rem;
}
