/**
 * Base Styles
 * リセット・基本スタイル・ユーティリティクラス
 * Premium Editorial Design
 */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--text-main);
  background-color: var(--bg-main);
  overflow-x: hidden;
  width: 100%;
  min-width: 320px;
  font-feature-settings: "palt";
}

/* === 選択スタイル === */
::selection {
  background-color: var(--forest-200);
  color: var(--forest-900);
}

/* === レイアウトのベース === */
.site {
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100vh;
}

.site-main {
  width: 100%;
  margin: 0 auto;
  display: block;
  flex: 1 0 auto;
}

/* === タイポグラフィ === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  color: var(--text-main);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-display);
  margin-bottom: var(--space-lg);
}

h2 {
  font-size: var(--font-size-xxxl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--font-size-xxl);
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-sm);
}

h5 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
}

h6 {
  font-size: var(--font-size-md);
  margin-bottom: var(--space-xs);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-main);
}

/* === リンク === */
a {
  color: var(--accent-main);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* フォーカススタイル */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-main);
  outline-offset: 2px;
}

/* === 画像 === */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 16:9 アスペクト比ユーティリティ */
.aspect-video {
  aspect-ratio: var(--aspect-video);
  overflow: hidden;
}

.aspect-video img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* === コンテナ === */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--content {
  max-width: var(--container-content);
}

/* === セクション === */
.section {
  padding: var(--space-section) 0;
  position: relative;
}

.section--bg {
  background-color: var(--bg-sub);
}

.section--dark {
  background: var(--gradient-dark);
  color: var(--text-invert);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: var(--text-invert);
}

.section--dark p {
  color: rgba(255, 255, 255, 0.85);
}

/* === セクションヘッダー === */
.section-header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--space-xxl);
}

.section-eyebrow {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-widest);
  text-transform: uppercase;
  color: var(--accent-main);
  margin-bottom: var(--space-sm);
}

.section-title {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-xxxl);
  font-weight: var(--font-weight-semibold);
  color: var(--text-main);
  margin-bottom: var(--space-md);
  letter-spacing: var(--letter-spacing-tight);
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-sub);
  line-height: var(--line-height-relaxed);
}

/* === ボタン === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-family-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base) var(--ease-out-cubic);
  text-decoration: none;
}

.btn--primary {
  background: var(--gradient-hero);
  color: var(--text-invert);
  box-shadow: var(--shadow-md);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--text-invert);
}

.btn--secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1.5px solid var(--border-strong);
}

.btn--secondary:hover {
  background-color: var(--accent-soft);
  border-color: var(--accent-main);
  color: var(--accent-main);
}

.btn--ghost {
  background-color: transparent;
  color: var(--text-main);
  padding: var(--space-xs) var(--space-sm);
}

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

.btn--lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
}

/* === ユーティリティ === */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slower) var(--ease-out-expo),
              transform var(--transition-slower) var(--ease-out-expo);
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* スタガードアニメーション */
.stagger-item {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow) var(--ease-out-expo),
              transform var(--transition-slow) var(--ease-out-expo);
}

.stagger-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.stagger-item:nth-child(1) { transition-delay: 0.05s; }
.stagger-item:nth-child(2) { transition-delay: 0.1s; }
.stagger-item:nth-child(3) { transition-delay: 0.15s; }
.stagger-item:nth-child(4) { transition-delay: 0.2s; }
.stagger-item:nth-child(5) { transition-delay: 0.25s; }
.stagger-item:nth-child(6) { transition-delay: 0.3s; }

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === 区切り線 === */
.divider {
  width: 100%;
  height: 1px;
  background-color: var(--border-soft);
  margin: var(--space-xxl) 0;
}

.divider--accent {
  height: 2px;
  background: var(--gradient-hero);
  width: 80px;
  margin: var(--space-lg) auto;
}

/* === カード共通 === */
.card {
  background-color: var(--bg-main);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-base) var(--ease-out-cubic),
              box-shadow var(--transition-base) var(--ease-out-cubic);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

/* === グリッドシステム === */
.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

/* === レスポンシブ === */
@media (max-width: 1024px) {
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  html {
    overflow-x: hidden;
    width: 100%;
  }

  html,
  body,
  #page,
  .site,
  .site-main {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  /* 全要素のオーバーフロー防止 */
  * {
    max-width: 100%;
  }

  .container {
    padding: 0 var(--space-md);
    max-width: 100%;
    width: 100%;
  }

  .section {
    padding: var(--space-xl) 0;
    width: 100%;
    max-width: 100%;
  }

  .section-header {
    margin-bottom: var(--space-xl);
    padding: 0;
  }

  .section-title {
    font-size: var(--font-size-xl);
    word-break: keep-all;
  }

  .section-subtitle {
    font-size: var(--font-size-base);
    line-height: 1.7;
  }

  .section-eyebrow {
    font-size: 10px;
  }

  /* タイポグラフィのモバイル調整 */
  h1 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    word-break: keep-all;
  }

  h2 {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    word-break: keep-all;
  }

  h3 {
    font-size: clamp(1.125rem, 4vw, 1.375rem);
  }

  h4 {
    font-size: var(--font-size-base);
  }

  p {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-sm);
    line-height: 1.8;
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .btn {
    font-size: var(--font-size-sm);
  }

  .btn--lg {
    padding: var(--space-sm) var(--space-lg);
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-sm);
  }

  .section {
    padding: var(--space-lg) 0;
  }

  .section-title {
    font-size: var(--font-size-lg);
  }

  h1 {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
  }

  h2 {
    font-size: clamp(1.125rem, 4.5vw, 1.375rem);
  }

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

/* === スムーズスクロールバー（Webkit） === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}
