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

:root {
  --font: 'Yu Gothic','YuGothic','Hiragino Sans','Meiryo',sans-serif;
  --color-bg: #000;
  --color-text: #fff;
  --color-text-muted: rgba(255,255,255,0.7);
  --color-text-subtle: rgba(255,255,255,0.6);
  --color-text-faint: rgba(255,255,255,0.5);
  --color-border: rgba(255,255,255,0.1);
  --color-border-strong: rgba(255,255,255,0.4);
  --page-gutter: 24px;
}

html,
body {
  width: 100%;
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* 要素セレクタで当てる（詳細度 0,0,1）。
   `.site-page a` のようにクラスを噛ませると詳細度 0,1,1 になり、
   `.site-footer-link` や `.text-link` など単一クラスの color 指定に勝ってしまう。 */
a {
  color: inherit;
}

.site-page a:focus-visible,
.site-page button:focus-visible,
.error-page a:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 4px;
}

/* ━━━ 下層ページ共通レイアウト ━━━ */
.site-page {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  overflow-x: hidden;
}

.site-header {
  display: flex;
  align-items: center;
  padding: 18px 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.site-logo-link {
  display: block;
  line-height: 0;
}

.site-logo {
  display: block;
  width: auto;
  height: 28px;
}

.site-main {
  flex: 1;
  padding: 48px var(--page-gutter) 96px;
  padding-left: max(var(--page-gutter), env(safe-area-inset-left));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right));
}

.document {
  width: 100%;
  max-width: 920px;
  overflow-wrap: anywhere;
}

/* `.document` の `overflow-wrap:anywhere`（長い URL の折り返し用）は
   禁則処理を殺し、「プライバシーポリシ／ー」のように長音符だけが行頭に落ちる。
   見出しは通常の日本語改行に戻して、禁則の効いた位置で折らせる。 */
.document h1,
.document h2,
.document h3 {
  overflow-wrap: normal;
  line-break: strict;
}

.document h1 {
  max-width: 900px;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 0;
}

.document h2 {
  margin-top: 48px;
  margin-bottom: 16px;
  font-size: 22px;
  line-height: 1.4;
}

.document h3 {
  margin-top: 32px;
  margin-bottom: 12px;
  font-size: 18px;
  line-height: 1.5;
}

.document p,
.document dl {
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-text-muted);
}

.document p {
  max-width: 760px;
}

.document p + p,
.document dl + p,
.document ul + p,
.document ol + p {
  margin-top: 24px;
}

/* ul/ol と同じ扱い。これが無いと直前の段落に張り付く。 */
.document dl {
  max-width: 760px;
  margin-top: 24px;
}

.document dt,
.document dd {
  font-weight: 400;
}

/* dt は本文より一段明るくして項目名として立たせる。
   アクセントカラーは使わず、白と半透明白の対比だけで階層をつくる。 */
.document dt {
  margin-top: 24px;
  color: var(--color-text);
}

.document dl > dt:first-child {
  margin-top: 0;
}

.document dd {
  margin: 0;
}

.document ul,
.document ol {
  max-width: 760px;
  margin-top: 24px;
  padding-left: 1.5em;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.8;
}

.document li + li {
  margin-top: 8px;
}

.document strong {
  color: var(--color-text);
  font-weight: 700;
}

.document a:not([class]) {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.text-link {
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  color: var(--color-text);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* 制定日・改定日。h1 直下に置く小さなメタ行。 */
.document-meta {
  margin-top: 16px;
  color: var(--color-text-faint);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* 問い合わせ窓口。住所・社名を行単位で並べる。 */
.document-contact {
  margin-top: 24px;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.8;
  font-style: normal;
}

.document-contact span {
  display: block;
}

.statement-text {
  margin-top: 40px;
}

.signature {
  max-width: 760px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--color-border-strong);
  color: var(--color-text);
  font-size: 14px;
  line-height: 1.8;
}

.signature address {
  font-style: normal;
}

/* `.document p`（詳細度 0,1,1）に負けないよう `.document` を噛ませて 0,2,0 にする。
   単一クラスで書くと日付だけ本文色 (--color-text-muted) のままになる。 */
.document .signature-date,
.document .signature-body {
  color: var(--color-text);
}

.signature-body span {
  display: block;
}

/* ━━━ 平文モード ━━━
   賃上げ表明のように、体裁で何も主張させたくない法定公表物向け。
   見出し・署名を本文と同じサイズ・色・太さに落として、
   段落が並んでいるだけの見た目にする。
   詳細度は `.document h1` (0,1,1) や `.document .signature-date` (0,2,0) に
   確実に勝つよう `.document.document--plain` (0,2,x) 以上で書く。 */
.document.document--plain h1 {
  max-width: none;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.8;
  letter-spacing: 0;
  color: var(--color-text-muted);
}

.document.document--plain .statement-text {
  margin-top: 24px;
}

.document.document--plain .signature {
  margin-top: 24px;
  padding-top: 0;
  border-top: 0;
  color: var(--color-text-muted);
}

.document.document--plain .signature-date,
.document.document--plain .signature-body {
  color: var(--color-text-muted);
}

/* ━━━ 下層ページ共通フッター ━━━ */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px var(--page-gutter);
  padding-left: max(var(--page-gutter), env(safe-area-inset-left));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right));
  padding-bottom: max(var(--page-gutter), env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
  text-align: center;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 20px;
  list-style: none;
}

/* フッターリンクの値は style.css と同期すること */
.site-footer-link {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
  padding: 10px;
  margin: -10px;
  padding-inline: 0;
  padding-bottom: 2px;
  margin-inline: 0;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.5);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.05em;
  transition: color 0.2s, border-color 0.2s;
}

.site-footer-link:hover {
  color: rgba(255,255,255,0.8);
  border-bottom-color: rgba(255,255,255,0.4);
}

.site-footer-copy {
  color: var(--color-text-faint);
  font-size: 10px;
  letter-spacing: 0.05em;
}

/* ━━━ 404（既存表示を維持） ━━━ */
.error-page .page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.error-page .background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.error-page .overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.68);
}

.error-page .nav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  padding: 18px 24px;
}

.error-page .logo {
  display: block;
  width: auto;
  height: 28px;
}

.error-page .content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 48px 24px 96px;
}

.error-page .code {
  color: var(--color-text-subtle);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.error-page h1 {
  max-width: 760px;
  margin-top: 16px;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 0;
}

.error-page p {
  max-width: 560px;
  margin-top: 14px;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.8;
}

.error-page .home-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 32px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-border-strong);
  color: var(--color-text);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.error-page .home-link span {
  font-size: 16px;
  line-height: 1;
}

@media (min-width: 768px) {
  :root {
    --page-gutter: 48px;
  }

  /* ヘッダーのみ 404 実績値の 44px を維持 */
  .site-header {
    padding: 26px 44px;
    padding-left: max(44px, env(safe-area-inset-left));
    padding-right: max(44px, env(safe-area-inset-right));
  }

  .site-main {
    padding: 64px var(--page-gutter) 112px;
    padding-left: max(var(--page-gutter), env(safe-area-inset-left));
    padding-right: max(var(--page-gutter), env(safe-area-inset-right));
  }

  .document h1 {
    font-size: 56px;
  }

  .document h2 {
    font-size: 28px;
  }

  .document h3 {
    font-size: 20px;
  }

  .document p,
  .document dl,
  .document ul,
  .document ol,
  .document-contact,
  .signature {
    font-size: 15px;
  }

  .text-link {
    font-size: 12px;
  }

  /* フッターリンクの値は style.css と同期すること */
  .site-footer-link {
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .statement-text {
    margin-top: 48px;
  }

  .document.document--plain h1 {
    font-size: 15px;
  }

  .document.document--plain .statement-text,
  .document.document--plain .signature {
    margin-top: 24px;
  }

  .site-footer {
    padding: 28px var(--page-gutter);
    padding-left: max(var(--page-gutter), env(safe-area-inset-left));
    padding-right: max(var(--page-gutter), env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .site-footer-copy {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .error-page .nav {
    padding: 26px 44px;
  }

  .error-page .content {
    padding: 64px 48px 112px;
  }

  .error-page h1 {
    font-size: 56px;
  }

  .error-page p {
    font-size: 15px;
  }

  .error-page .home-link {
    margin-top: 40px;
    font-size: 12px;
  }
}

@media print {
  html, body { background:#fff; color:#000; }
  .site-page, .site-main { min-height:0; }
  /* muted 色を持つ要素はすべて列挙する。`.document dl` などを落とすと
     白背景に薄いグレーで刷られて読めなくなる。 */
  .document h1, .document p, .document ul, .document ol,
  .document dl, .document dt, .document dd,
  .document-meta, .document-contact,
  .signature, .signature-date, .signature-body { color:#000; }
  .site-header, .site-footer { border:0; }
  .site-footer-links { display:none; }
  /* ロゴは白抜き PNG。白背景に刷ると消えるため反転させる。 */
  .site-logo { filter: invert(1); }
  a { color:#000; text-decoration:none; }
  /* 法務ページは章単位で読まれるため、見出しだけが頁末に残らないようにする */
  .document h2, .document h3 { break-after: avoid; }
  .document-contact { break-inside: avoid; }
}
