/**
 * site.css — step-method.kazunalab.com サイト固有スタイル
 *
 * Melta UI ds-theme.css（CDN）が提供するのはセマンティックカラー変数
 * （--bg-page, --text-default 等）のみ。スペーシング・タイポ・コンポーネント
 * クラスは kazunalab.com 本体の同等定義から本サイトに必要な分だけ抽出している。
 */

:root {
  /* コンテナ幅 */
  --container-lg: 1024px;
  --container-xl: 1280px;

  /* タイプスケール */
  --text-h1: 2.5rem;
  --text-h2: 2rem;
  --text-h3: 1.5rem;
  --text-h4: 1.25rem;
  --text-body-lg: 1.125rem;
  --text-body: 1rem;
  --text-body-sm: 0.875rem;
  --text-caption: 0.75rem;

  /* スペーシング（4pxベース） */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* プライマリカラー（Melta UI tokens.json 準拠） */
  --color-primary-50: #f0f5ff;
  --color-primary-400: #6492ff;
  --color-primary-500: #2b70ef;
  --color-primary-700: #1a40b5;

  /* 行間・字間（Tailwind既定値） */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-relaxed: 1.625;
  --tracking-wider: 0.05em;

  /* シャドウ（Tailwind既定値） */
  --shadow-sm: 0 1px 3px 0 #0000001a, 0 1px 2px -1px #0000001a;
  --shadow-md: 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;

  /* トランジション */
  --transition-fast: 150ms ease;

  --font-sans:
    "Inter", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    sans-serif;
}

/* =========================================
   基本リセット
   本体（kazunalab.com）は Tailwind Preflight でこれらが
   既定リセットされているが、本サイトは依存ゼロ方針のため
   Tailwind を使わない。同等の最小限のリセットをここで明示する。
   欠くと、ブラウザ既定の margin・box-sizing があらゆる
   コンポーネントに個別に漏れ出し、本体と挙動が食い違う。
   ========================================= */

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

* {
  margin: 0;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* =========================================
   基本スタイル
   ========================================= */

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-sans);
  color: var(--text-default);
  background-color: var(--bg-page);
}

body.antialiased {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   スキップリンク
   ========================================= */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 1000;
  padding: 1rem;
  background-color: var(--text-heading);
  color: #ffffff;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: top var(--transition-fast);
}

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

:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* =========================================
   コンテナ
   ========================================= */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 768px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* =========================================
   ボタン
   ========================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 500;
  font-size: var(--text-body);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition:
    background-color 200ms ease,
    color 200ms ease,
    border-color 200ms ease;
  height: 2.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
  border-radius: 0.5rem;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(43, 112, 239, 0.5);
}

.btn-primary {
  background-color: var(--color-primary-500);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-primary-700);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-heading);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover {
  background-color: var(--bg-page);
  border-color: var(--text-muted);
}

.btn-lg {
  height: 3rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* =========================================
   目次（TOC）— 移植元: kazunalab.com table-of-contents.css
   ========================================= */

.toc {
  margin-bottom: var(--space-10);
}

.toc-details {
  border: 1px solid var(--border-default);
  border-radius: 0.75rem;
  background: var(--bg-surface);
}

.toc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  user-select: none;
  list-style: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.toc-summary::-webkit-details-marker {
  display: none;
}

.toc-details[open] .toc-summary {
  border-bottom-color: var(--border-default);
}

.toc-label {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.toc-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.toc-details[open] .toc-chevron {
  transform: rotate(180deg);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: var(--space-3) var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toc-item {
  margin: 0;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin: 0 calc(var(--space-3) * -1);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.toc-link:hover {
  background-color: var(--color-primary-50);
}

.toc-link:hover .toc-number {
  color: var(--color-primary-500);
}

.toc-link:hover .toc-text {
  color: var(--color-primary-700);
}

.toc-number {
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-primary-400);
  min-width: 1.25rem;
  transition: color 0.15s ease;
}

.toc-text {
  font-size: var(--text-body-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
  transition: color 0.15s ease;
}

@media (max-width: 640px) {
  .toc-details:not([open]) .toc-summary {
    border-bottom-color: transparent;
  }

  .toc-list {
    padding: var(--space-2) var(--space-4) var(--space-3);
  }

  .toc-link {
    padding: var(--space-2);
  }
}

/* =========================================
   パンくず — 移植元: kazunalab.com breadcrumb.css
   ========================================= */

.breadcrumb {
  padding-block: var(--space-4);
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-body-sm);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.breadcrumb-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-link:hover {
  color: var(--text-default);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb-separator {
  color: var(--text-muted);
  opacity: 0.6;
  flex-shrink: 0;
}

.breadcrumb-current {
  color: var(--text-heading);
  font-weight: 500;
}

/* =========================================
   Cookie 同意バナー — 移植元: kazunalab.com cookie-consent.css
   ========================================= */

.cookie-consent {
  position: fixed;
  bottom: var(--space-4);
  left: var(--space-4);
  right: var(--space-4);
  z-index: 1000;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: var(--space-6);
}

@media (min-width: 768px) {
  .cookie-consent {
    left: auto;
    right: var(--space-4);
    max-width: 400px;
  }
}

.cookie-consent-text {
  font-size: var(--text-body-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}

.cookie-consent-text a {
  color: var(--color-primary-500);
  text-decoration: none;
}

.cookie-consent-text a:hover {
  text-decoration: underline;
}

.cookie-consent-buttons {
  display: flex;
  gap: var(--space-3);
}

.cookie-consent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 2.75rem;
  padding: 0 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 0.5rem;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    border-color 150ms ease;
}

.cookie-consent-btn-accept {
  background-color: var(--color-primary-500);
  color: #ffffff;
  border: none;
}

.cookie-consent-btn-accept:hover {
  background-color: var(--color-primary-700);
}

.cookie-consent-btn-decline {
  background-color: var(--bg-surface);
  color: var(--text-heading);
  border: 1px solid var(--border-default);
}

.cookie-consent-btn-decline:hover {
  background-color: var(--bg-page);
  border-color: var(--text-muted);
}

.cookie-consent-btn:focus-visible {
  outline: 2px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* =========================================
   ミニユーティリティ（Tailwind非依存の最小実装）
   ========================================= */

.hidden {
  display: none;
}

@media (min-width: 640px) {
  .sm\:inline {
    display: inline;
  }
}

.w-4 {
  width: 1rem;
}

.h-4 {
  height: 1rem;
}

/* =========================================
   簡易ヘッダー
   ========================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-default);
}

.site-header-inner {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: var(--space-3) 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .site-header-inner {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.site-header-logo {
  font-weight: 700;
  font-size: var(--text-body-lg);
  line-height: 1;
  color: var(--text-heading);
  text-decoration: none;
}

.site-header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
  font-size: var(--text-body-sm);
}

.site-header-nav a {
  position: relative;
  color: var(--text-default);
  text-decoration: none;
  padding: var(--space-2) 0;
  transition: color 0.2s;
}

.site-header-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--text-heading);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header-nav a[aria-current="page"] {
  color: var(--color-primary-500);
  font-weight: 600;
}

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

.site-header-nav a:hover::after {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .site-header-nav a::after {
    transition: none;
  }
}

.site-header-nav a.site-header-brand-link {
  color: var(--text-muted) !important;
  border-left: 1px solid var(--border-default);
  padding-left: var(--space-5);
}

/* =========================================
   簡易フッター
   ========================================= */

.site-footer {
  border-top: 1px solid var(--border-default);
  background-color: var(--bg-surface);
  margin-top: var(--space-16);
}

.site-footer-inner {
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6) var(--space-2);
}

.site-footer-top {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
}

@media (min-width: 640px) {
  .site-footer-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.site-footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
}

.site-footer-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.site-footer-brand-names {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-footer-brand {
  font-size: var(--text-body-sm);
  font-weight: 600;
  color: var(--text-heading);
  line-height: 1.4;
}

.site-footer-tagline {
  font-size: var(--text-caption);
  color: var(--text-muted);
  line-height: 1.4;
}

.site-footer-main-link {
  display: inline-block;
  color: var(--color-primary-500);
  text-decoration: none;
  font-size: var(--text-body-sm);
  white-space: nowrap;
}

.site-footer-main-link:hover {
  text-decoration: underline;
}

.site-footer-bottom {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-caption);
  color: var(--text-muted);
}

@media (min-width: 640px) {
  .site-footer-bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

.site-footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  font-size: 0.6875rem;
}

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

.site-footer-legal a:hover {
  text-decoration: underline;
  color: var(--text-heading);
}

.site-footer-legal-divider {
  color: var(--border-default);
}

.site-footer-copyright {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--text-muted);
}
