/* =========================================
   Base Blank CSS (modern starter)
   ========================================= */

/* 1. Reset & base
   ----------------------------------------- */

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

* {
  margin: 0;
  padding: 0;
}

/* よりきれいなフォントレンダリング＆スムーズスクロール */
html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

/* デフォルト: light/dark 両対応宣言 */
:root {
  color-scheme: light dark;
}

/* 画像・メディアの基本 */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* フォーム要素のフォント継承 */
input,
button,
textarea,
select {
  font: inherit;
}

/* テキスト折り返し */
body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* 2. Design Tokens (CSS Variables)
   ----------------------------------------- */

:root {
  /* カラーパレット（ライト） */
  --color-bg: #f5f5f7;
  --color-bg-elevated: #ffffff;
  --color-fg: #111111;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;

  --color-accent: #2563eb;      /* ブルー系 */
  --color-accent-soft: #dbeafe;
  --color-danger: #ef4444;

  /* タイポグラフィ */
  
  /* --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace; */
  /* Google Fonts を利用したフォント設定 */
  /* --font-sans: "Noto Sans JP", "Roboto Flex", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Noto Serif JP", "Roboto", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace; */

  /* 和文は Noto Sans JP、欧文は Roboto Flex を優先 */
  --font-sans: "Roboto Flex", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* セクションタイトルや長文に適した serif */
  --font-serif: "Noto Serif JP", serif;

  /* コードフォントは変えない */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

/* ベース文字サイズ（スマホ〜PCで滑らかに変化） */
  --font-size-base: clamp(0.95rem, 0.9rem + 0.4vw, 1.1rem);

  /* 見出し：スマホで読みやすく、PCではしっかり大きく */
  --font-size-h1: clamp(1.9rem, 1.6rem + 2vw, 2.8rem);
  --font-size-h2: clamp(1.6rem, 1.4rem + 1.2vw, 2.2rem);
  --font-size-h3: clamp(1.3rem, 1.2rem + 0.8vw, 1.7rem);


  /* fluidなベースフォントサイズ（16px〜18pxくらい） */
  --font-size-base: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);

  /* 見出しサイズ */
  --font-size-h1: clamp(2rem, 1.8rem + 1.2vw, 2.6rem);
  --font-size-h2: clamp(1.6rem, 1.4rem + 0.8vw, 2rem);
  --font-size-h3: clamp(1.3rem, 1.2rem + 0.4vw, 1.5rem);

  /* スペーシング（fluid） */
  --space-xs: clamp(0.25rem, 0.2rem + 0.2vw, 0.5rem);
  --space-sm: clamp(0.5rem, 0.4rem + 0.3vw, 0.75rem);
  --space-md: clamp(1rem, 0.8rem + 0.5vw, 1.5rem);
  --space-lg: clamp(1.5rem, 1.2rem + 0.8vw, 2.5rem);
  --space-xl: clamp(2rem, 1.6rem + 1vw, 3rem);

  /* レイアウト */
  --layout-max-width: 1120px;
  --layout-inline-padding: clamp(1rem, 3vw, 2.5rem);

  /* ボーダー・ラディウス・シャドウ */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);

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

/* ダークモード */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #020617;
    --color-bg-elevated: #020818;
    --color-fg: #f9fafb;
    --color-muted: #9ca3af;
    --color-border: #1f2933;

    --color-accent-soft: rgba(37, 99, 235, 0.15);
    --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.9);
  }
}

/* 3. Body & Typography
   ----------------------------------------- */

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.7;
  background-color: var(--color-bg);
  color: var(--color-fg);
}

/* ベースリンク */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* アクセシブルなフォーカスリング */
:where(a, button, input, textarea, select) {
  outline: none;
}

:where(a, button, input, textarea, select):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 999px;
}

/* 見出し */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.25;
}

h1 {
  font-size: var(--font-size-h1);
  letter-spacing: -0.04em;
}

h2 {
  font-size: var(--font-size-h2);
  letter-spacing: -0.03em;
}

h3 {
  font-size: var(--font-size-h3);
}

p + p {
  margin-top: var(--space-sm);
}

/* 見出しはセリフ体で上質・読みやすく */
/* h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
} */


/* 本文：読みやすい400中心 */
body {
  font-weight: 400;
}

/* 見出し：階層に応じて太さを変える */
h1 {
  font-family: var(--font-serif);
  font-weight: 700;
}
h2 {
  font-family: var(--font-serif);
  font-weight: 600;
}
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
}
h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 500;
}
/* 見出しをすべてゴシック系に統一 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
}
/* 日本語タイトル専用フォントスムージング */
:lang(ja) h1,
:lang(ja) h2,
:lang(ja) h3,
:lang(ja) h4,
:lang(ja) h5,
:lang(ja) h6 {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* UI項目（ボタン・ラベルなど）は視認性重視で500 */
button,
label,
nav a {
  font-weight: 500;
}


/* 4. Layout Utilities
   ----------------------------------------- */

/* 中央寄せコンテナ */
.container {
  width: min(
    100% - var(--layout-inline-padding) * 2,
    var(--layout-max-width)
  );
  margin-inline: auto;
}

/* 縦積み（Stackレイアウト） */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
/* =========================================
   Stack Extensions (modifier utilities)
   ========================================= */

/* Gap variations（余白サイズ違い） */
.stack-xs {
  gap: var(--space-xs);
}

.stack-sm {
  gap: var(--space-sm);
}

.stack-md {
  gap: var(--space-md); /* stack の初期値 */
}

.stack-lg {
  gap: var(--space-lg);
}

.stack-xl {
  gap: var(--space-xl);
}

/* Stack Center - 子要素を中央揃え */
.stack-center {
  align-items: center;
  text-align: center;
}

/* Stack Start / End - 横方向の整列 */
.stack-start {
  align-items: flex-start;
}

.stack-end {
  align-items: flex-end;
}

/* Stack Split - よく使うパターン：
   最初と最後の要素を上下で離し、それ以外は通常の積層
   （カードヘッダーやセクションタイトルに便利） */
.stack-split {
  display: flex;
  flex-direction: column;
}

.stack-split > :first-child {
  margin-bottom: auto;
}

/* Stack Flush - 最後の要素だけ余白ゼロにする（リストの末尾に効果的） */
.stack-flush > :last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Max-width 制限（文章コンテンツで読みやすくする） */
.stack-readable {
  max-width: 65ch;
}



/* 行方向の並び（Clusterレイアウト） */
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
}

/* =========================================
   Cluster Extensions (modifier utilities)
   ========================================= */

/* 中央寄せ */
.cluster-center {
  justify-content: center;
}

/* 右寄せ */
.cluster-end {
  justify-content: flex-end;
}

/* 左寄せ（デフォルトなので明示化したい時用） */
.cluster-start {
  justify-content: flex-start;
}

/* 均等配置（左右端に余白あり） */
.cluster-between {
  justify-content: space-between;
}

/* 均等配置（両端も含めて均等） */
.cluster-around {
  justify-content: space-around;
}

/* 要素間をまんべんなく均等 */
.cluster-evenly {
  justify-content: space-evenly;
}

/* 高さ方向の揃え方バリエーション */
.cluster-top {
  align-items: flex-start;
}

.cluster-middle {
  align-items: center; /* cluster の初期値と同一 */
}

.cluster-bottom {
  align-items: flex-end;
}

/* ギャップ（gap）のサイズ調整 */
.cluster-gap-xs {
  gap: var(--space-xs);
}

.cluster-gap-sm {
  gap: var(--space-sm); /* cluster の初期値と同一 */
}

.cluster-gap-md {
  gap: var(--space-md);
}

.cluster-gap-lg {
  gap: var(--space-lg);
}

.cluster-gap-xl {
  gap: var(--space-xl);
}


/* カード用 */
.card {
  background-color: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: var(--space-lg);
  box-shadow: var(--shadow-soft);
}

/* セクション余白 */
.section {
  padding-block: var(--space-xl);
}

/* 5. Buttons
   ----------------------------------------- */

button {
  border: none;
  background: none;
  cursor: pointer;
}

/* ベースボタン */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.55em 1.1em;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid transparent;
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal),
    border-color var(--transition-normal),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

/* プライマリボタン */
.btn-primary {
  background-color: var(--color-accent);
  color: #ffffff;
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

/* アウトラインボタン */
.btn-outline {
  background-color: transparent;
  border-color: var(--color-border);
  color: var(--color-fg);
}

.btn-outline:hover {
  background-color: var(--color-accent-soft);
}

/* テキストボタン */
.btn-ghost {
  background-color: transparent;
  color: var(--color-fg);
}

.btn-ghost:hover {
  background-color: var(--color-accent-soft);
}

/* 6. Forms
   ----------------------------------------- */

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 0.6em 0.75em;
  background-color: var(--color-bg-elevated);
  color: var(--color-fg);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-muted);
}

/* 7. Helpers
   ----------------------------------------- */

/* スクリーンリーダー専用テキスト */
.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;
}

/* 中央寄せ */
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 薄いテキスト */
.text-muted {
  color: var(--color-muted);
}

/* テキスト中央寄せ */
.text-center {
  text-align: center;
}

/* マルチカラム・レスポンシブグリッド */
.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* 8. Motion
   ----------------------------------------- */

/* 動きに弱い人向けのアニメーション抑制 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
