@charset "UTF-8";
/* ==========================================================================
   デタマチ（Japan Open Data Lab）共通 UI/UX スタイル v1
   - 既存ページのブランドトークン（--bg / --ink / --teal 等）を尊重しつつ、
     未定義トークン・アクセシビリティ・390pxモバイル操作性・下部固定バー余白を統一。
   ========================================================================== */

/* 1. 共通カラートークン補完（各ページの :root が優先されるよう :where を使用） */
:where(:root) {
  --bg: #f7f9fa;
  --surface: #ffffff;
  --surface2: #f2f5f4;
  --card: #ffffff;
  --ink: #17242e;
  --ink-soft: #5b6b76;
  --sub: #5b6b76;
  --line: #dde4e8;
  --navy: #10314f;
  --teal: #0b7285;
  --teal-dark: #095a6a;
  --teal-tint: #e6f3f4;
  --amber: #F59E0B;
  --focus: #0b7285;
  --bar-track: #e6edf0;
  --radius: 10px;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  --mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

:where(:root[data-theme="dark"]) {
  --bg: #081426;
  --surface: #0E1E33;
  --surface2: #132a44;
  --card: #0E1E33;
  --ink: #E9EEF3;
  --ink-soft: #9DB0C1;
  --sub: #9DB0C1;
  --line: #223850;
  --navy: #9fc3e2;
  --teal: #2FB3C6;
  --teal-dark: #8FD3DE;
  --teal-tint: #12283d;
  --focus: #2FB3C6;
  --bar-track: #1b3350;
  color-scheme: dark;
}

/* 2. アクセシビリティ・フォーカス表示・動きを減らす設定 */
:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus, var(--teal, #0b7285));
  outline-offset: 2px;
  border-radius: 4px;
}

:root[data-theme="dark"] :focus-visible {
  outline-color: #2FB3C6;
}

.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;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 3. UI TYPES v1 共通数値・カード補強 */
.num-big,
.num-mid,
.tabular {
  font-variant-numeric: tabular-nums;
}

.card-x {
  background: var(--surface, #ffffff);
  border: 1px solid var(--line);
  border-radius: 14px;
}

:root[data-theme="dark"] .card-x {
  background: var(--surface, #0E1E33);
}

/* 4. 共通ヘッダーとブランドロゴ（390px幅でのはみ出し防止・タップ最適化） */
.brand-logo {
  height: 38px;
  width: auto;
  display: block;
}

:root[data-theme="dark"] .brand-logo {
  background: #ffffff;
  border-radius: 8px;
  padding: 2px 6px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
}

:root[data-theme="dark"] .site-header {
  background: var(--surface, #0E1E33);
  border-bottom-color: var(--line);
}

@media (max-width: 640px) {
  .brand-logo {
    height: 31px;
  }

  .site-header .wrap {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 10px 16px;
  }

  .site-header .nav-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .site-header .site-nav .l-diag {
    font-size: 13.5px;
    font-weight: 700;
    min-height: 36px;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
  }

  .site-header .site-nav .nav-pill {
    padding: 5px 11px;
    font-size: 12px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .site-header .site-nav .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .site-header .nav-secondary {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
    mask-image: linear-gradient(90deg, #000 92%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
  }

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

  .site-header .nav-secondary a {
    font-size: 13px;
    min-height: 36px;
    padding: 4px 2px;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
  }
}

/* 5. 下部固定バー（.tab-bar）とページ先頭ボタン（.to-top）の安全領域保護 */
.tab-bar {
  display: none;
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface, #ffffff);
  color: var(--ink-soft, var(--sub, #5b6b76));
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
  z-index: 55;
  box-shadow: 0 6px 18px rgba(7, 24, 48, 0.14);
  padding: 0;
}

.to-top.show {
  opacity: 1;
  visibility: visible;
}

.to-top:hover {
  color: var(--ink);
  border-color: var(--ink-soft, var(--sub, #5b6b76));
}

:root[data-theme="dark"] .to-top {
  background: #0E1E33;
}

@media (max-width: 640px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
  }

  .tab-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 65;
    background: var(--surface, #ffffff);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(11, 31, 58, 0.08);
  }

  :root[data-theme="dark"] .tab-bar {
    background: #0E1E33;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
  }

  .tab-bar a {
    flex: 1;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 4px;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ink-soft, var(--sub, #5b6b76));
    text-decoration: none;
    position: relative;
  }

  .tab-bar a.active {
    color: var(--teal, #0b7285);
  }

  .tab-bar a.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 18%;
    right: 18%;
    height: 2.5px;
    border-radius: 0 0 2px 2px;
    background: var(--teal, #0b7285);
  }

  .to-top {
    bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    right: 14px !important;
    width: 44px !important;
    height: 44px !important;
  }
}

/* 6. フッター共通調整（--ink-soft 欠損対策＋390px 2列グリッド整理） */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
}

.site-footer .f-head,
.site-footer .f-group a,
.site-footer .f-meta,
.site-footer .f-meta a,
.site-footer .f-copy {
  color: var(--ink-soft, var(--sub, #5b6b76));
}

.site-footer .f-group a:hover {
  color: var(--teal, #0b7285);
}

@media (max-width: 640px) {
  .site-footer {
    margin-top: 48px;
    padding: 24px 0 28px;
  }

  .site-footer .f-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 16px;
    justify-content: start;
    margin-top: 16px;
  }

  .site-footer .f-group {
    text-align: left;
    align-items: flex-start;
    gap: 4px;
  }

  .site-footer .f-group a {
    min-height: 34px;
    padding: 4px 0;
    display: inline-flex;
    align-items: center;
  }

  .site-footer .f-meta {
    text-align: left;
    margin-top: 22px;
  }

  .site-footer .f-bottom {
    flex-direction: row;
    text-align: left;
    margin-top: 22px;
  }
}
