/**
 * base.css - リセット・ベーススタイル
 *
 * ブラウザのデフォルトスタイルをリセットし、
 * アプリ全体の基本スタイルを設定する。
 *
 * [REF]
 * - CSS: variables.css のカスタムプロパティに依存
 * - HTML: index.html の <body> に適用
 * - 読み込み順: variables.css → base.css（2番目）
 */

/* ===== リセット ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== HTML / Body ===== */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  /* 微細なグリッドパターンで奥行きを演出 */
  background-image:
    radial-gradient(circle at 20% 50%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== カスタムスクロールバー ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(136, 136, 168, 0.3);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(136, 136, 168, 0.5);
}

/* Firefox スクロールバー */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(136, 136, 168, 0.3) var(--bg-primary);
}

/* ===== 基本要素 ===== */
a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* ===== テキストユーティリティ ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
}

/* ===== レイアウトユーティリティ ===== */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

/* ===== メインコンテンツエリア ===== */
.app-content {
  padding-top: calc(var(--navbar-height) + var(--spacing-xl));
  padding-bottom: var(--spacing-3xl);
  min-height: calc(100vh - var(--navbar-height));
}

/* ===== 画面セクション（routerで切替） ===== */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ===== 選択無効化（インタラクティブ要素用） ===== */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}

/* ===== 非表示ユーティリティ ===== */
.hidden {
  display: none !important;
}

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