/* background-attachment: fixed と background-position アニメーションによる
   毎フレームのメインスレッド全面再描画（Safari/Firefox/Chromeのスクロールカクつき原因）を回避し、
   同一のグラデーション表現を GPU コンポジタ専用の transform レイヤーへ移譲 */
body.philosophy-body,
body.night-mode.philosophy-body,
body:has(.philosophy-page),
body.night-mode:has(.philosophy-page) {
  min-height: 100vh;
  min-height: 100svh;
  background-image: none;
  animation: none;
  background-attachment: scroll;
}

.philosophy-page {
  --glass-fill: linear-gradient(
    150deg,
    rgba(255, 255, 255, 0.96) 0%,
    rgba(229, 250, 255, 0.58) 22%,
    rgba(105, 175, 216, 0.28) 48%,
    rgba(239, 252, 255, 0.82) 69%,
    rgba(67, 127, 177, 0.38) 100%
  );
  --glass-stroke: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(225, 251, 255, 0.86);
  --glass-depth: rgba(46, 104, 151, 0.34);
  --glass-glow: rgba(143, 230, 255, 0.42);
  --small-word: rgba(250, 254, 255, 0.94);
  --small-word-shadow: rgba(54, 111, 153, 0.46);
  display: block;
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 300vh;
  min-height: 300svh;
  overflow-x: clip;
  padding: clamp(7.5rem, 14vh, 10rem) clamp(1.5rem, 5vw, 6rem) 6rem;
}

body.night-mode .philosophy-page {
  --glass-fill: linear-gradient(
    150deg,
    #e0e4e7 0%,
    #a9b3bb 36%,
    #7d8da0 68%,
    #bbc3c9 100%
  );
  --glass-stroke: rgba(218, 225, 229, 0.18);
  --glass-edge: rgba(235, 239, 241, 0.18);
  --glass-depth: rgba(3, 10, 23, 0.3);
  --small-word: rgba(207, 213, 217, 0.78);
  --small-word-shadow: rgba(2, 7, 17, 0.52);
}

.philosophy-sanctuary-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(180deg, #6bb3d6 0%, #98cce4 100%);
  contain: strict;
}

body.night-mode .philosophy-sanctuary-backdrop {
  background: linear-gradient(180deg, #050810 0%, #0c1120 100%);
}

/* 400%巨大テクスチャの移動ではなく、1画面サイズの軽量レイヤーの opacity 補間で
   従来と同一の空グラデーション推移を GPU 負荷ほぼゼロで再現 */
.philosophy-sanctuary-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #98cce4 0%, #e8f6ff 100%);
  opacity: 0;
  will-change: opacity;
  animation: philosophy-bg-drift-day 28s ease-in-out infinite;
}

body.night-mode .philosophy-sanctuary-backdrop::before {
  background: linear-gradient(180deg, #0c1120 0%, #1a2340 100%);
  animation: philosophy-bg-drift-night 32s ease-in-out infinite;
}

.philosophy-sanctuary-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 88% 2%, rgba(238, 255, 255, 0.72) 0%, rgba(202, 242, 255, 0.26) 25%, transparent 48%),
    radial-gradient(circle at 8% 88%, rgba(49, 127, 187, 0.18) 0%, transparent 43%);
}

body.night-mode .philosophy-sanctuary-backdrop::after {
  background:
    radial-gradient(circle at 86% 3%, rgba(111, 137, 157, 0.08) 0%, transparent 42%),
    radial-gradient(circle at 10% 90%, rgba(42, 65, 94, 0.1) 0%, transparent 45%);
}

@keyframes philosophy-bg-drift-day {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.99;
  }
}

@keyframes philosophy-bg-drift-night {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .philosophy-sanctuary-backdrop::before {
    animation: none;
  }

  .philosophy-floating-shape {
    will-change: auto;
  }
}

/* 3D要素はロード時に超高解像度SSAAで1回だけ静的ベイクし、スクロール中は WebGL を一切動かさず
   GPU コンポジタの translate3d パララックスのみで立体的な奥行き移動を表現 */
.philosophy-sanctuary-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.philosophy-sanctuary-svh-probe {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100vh;
  height: 100svh;
  visibility: hidden;
}

.philosophy-sanctuary-shapes {
  position: absolute;
  inset: 0;
  z-index: 1;
  isolation: isolate;
}

.philosophy-floating-shape {
  position: absolute;
  display: block;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

#philosophy-sanctuary-canvas {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  display: block;
}

.philosophy-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 112rem;
  margin: 0;
  contain: layout style;
}

.typographic-statement {
  width: 100%;
  margin: 0;
  color: var(--clr-text);
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
  line-height: 0.82;
  letter-spacing: -0.045em;
  text-align: left;
}

.statement-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  width: 100%;
  column-gap: clamp(0.35rem, 0.9vw, 1rem);
  row-gap: 0.15rem;
}

.statement-line + .statement-line {
  margin-top: clamp(1.6rem, 4.5vh, 3.75rem);
}

.statement-word {
  display: inline-block;
  position: relative;
  white-space: nowrap;
}

.statement-word--glass {
  z-index: 0;
  /* 字間と行間は詰めたまま、背景クリップを字形の右端と下端まで描く。 */
  padding-right: 0.08em;
  padding-bottom: 0.28em;
  margin-right: -0.08em;
  margin-bottom: -0.28em;
  color: transparent;
  background: var(--glass-fill);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1px var(--glass-stroke);
  text-shadow:
    0 -0.018em 0.025em var(--glass-edge),
    0 0.025em 0.035em var(--glass-depth),
    0 0.12em 0.22em rgba(31, 84, 126, 0.2);
}

.statement-word--glass::before,
.statement-word--glass::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* iOS Safari (WebKit) で background-clip: text + filter: drop-shadow / blur の
   オフスクリーンバッファ境界にマゼンタ線 (#ff00ff) が出る描画バグを根絶するため、
   背景クリップを持たない背面疑似要素のネイティブ text-shadow で同一の影・発光を描画 */
.statement-word--glass::before {
  z-index: -1;
  top: 0.035em;
  bottom: -0.035em;
  color: rgba(76, 139, 183, 0.15);
  -webkit-text-stroke: 0.03em rgba(64, 124, 170, 0.15);
  text-shadow:
    0 0.02em 0.09em rgba(46, 104, 151, 0.31),
    0 -0.035em 0.32em rgba(143, 230, 255, 0.39);
}

.statement-word--glass::after {
  z-index: 1;
  color: transparent;
  -webkit-text-stroke: 0.008em rgba(255, 255, 255, 0.78);
  text-shadow: 0 -0.018em 0.025em rgba(255, 255, 255, 0.72);
  opacity: 0.72;
}

.statement-word--connector {
  font-size: clamp(0.78rem, 1.35vw, 1.2rem);
  font-weight: 300;
  letter-spacing: 0.045em;
  line-height: 1;
  color: var(--small-word);
  text-shadow:
    0 1px 1px var(--small-word-shadow),
    0 0 0.65rem var(--glass-glow);
  opacity: 0.94;
}

.statement-word--freedom-first {
  font-size: clamp(4.5rem, 11.8vw, 11rem);
  font-weight: 700;
  letter-spacing: -0.075em;
}

.statement-word--born {
  font-size: clamp(2.8rem, 6.4vw, 6rem);
  font-weight: 500;
  letter-spacing: -0.06em;
}

.statement-word--valued {
  font-size: clamp(2.5rem, 5.4vw, 5.2rem);
  font-weight: 500;
  letter-spacing: -0.055em;
}

.statement-word--beyond {
  font-size: clamp(1.7rem, 3.8vw, 3.6rem);
  font-weight: 300;
  letter-spacing: -0.045em;
}

.statement-word--rigorous {
  font-size: clamp(4rem, 9.6vw, 9rem);
  font-weight: 700;
  letter-spacing: -0.07em;
}

.statement-word--system {
  font-size: clamp(2.4rem, 5.3vw, 5rem);
  font-weight: 500;
  letter-spacing: -0.055em;
}

.statement-word--lies {
  font-size: clamp(1.15rem, 2.3vw, 2.15rem);
  font-weight: 300;
  letter-spacing: 0;
  color: var(--small-word);
  text-shadow:
    0 1px 1px var(--small-word-shadow),
    0 0 0.65rem var(--glass-glow);
  opacity: 0.94;
}

.statement-word--true {
  font-size: clamp(2.8rem, 5.8vw, 5.4rem);
  font-weight: 500;
  letter-spacing: -0.06em;
}

.statement-word--freedom-last {
  font-size: clamp(4.4rem, 11.5vw, 10.75rem);
  font-weight: 700;
  letter-spacing: -0.075em;
}

body.night-mode .statement-word--glass {
  -webkit-text-stroke: 0.55px var(--glass-stroke);
  text-shadow: 0 0.025em 0.028em var(--glass-depth);
  filter: none;
}

body.night-mode .statement-word--glass::before {
  display: none;
}

body.night-mode .statement-word--glass::after {
  -webkit-text-stroke: 0.004em var(--glass-edge);
  text-shadow: none;
  opacity: 0.26;
}

body.night-mode .statement-word--connector,
body.night-mode .statement-word--lies {
  text-shadow: 0 1px 1px var(--small-word-shadow);
  opacity: 0.88;
}

body.night-mode .statement-word--freedom-first,
body.night-mode .statement-word--born,
body.night-mode .statement-word--valued,
body.night-mode .statement-word--beyond,
body.night-mode .statement-word--rigorous,
body.night-mode .statement-word--system,
body.night-mode .statement-word--true,
body.night-mode .statement-word--freedom-last {
  font-weight: 300;
}

body.night-mode .statement-word--freedom-first,
body.night-mode .statement-word--freedom-last {
  letter-spacing: -0.05em;
}

body.night-mode .statement-word--born,
body.night-mode .statement-word--beyond,
body.night-mode .statement-word--rigorous,
body.night-mode .statement-word--true {
  letter-spacing: -0.045em;
}

body.night-mode .statement-word--valued,
body.night-mode .statement-word--system {
  letter-spacing: -0.04em;
}

@media (min-width: 900px) {
  .statement-word--connector { font-size: clamp(0.75rem, 1vw, 1rem); }
  .statement-word--freedom-first { font-size: clamp(4.5rem, 9.8vw, 9.5rem); }
  .statement-word--born { font-size: clamp(2.8rem, 5.4vw, 5rem); }
  .statement-word--valued { font-size: clamp(2.5rem, 4.6vw, 4.5rem); }
  .statement-word--beyond { font-size: clamp(1.7rem, 3.2vw, 3.1rem); }
  .statement-word--rigorous { font-size: clamp(4rem, 8vw, 8rem); }
  .statement-word--system { font-size: clamp(2.4rem, 4.5vw, 4.25rem); }
  .statement-word--lies { font-size: clamp(1.1rem, 1.9vw, 1.9rem); }
  .statement-word--true { font-size: clamp(2.8rem, 4.8vw, 4.5rem); }
  .statement-word--freedom-last { font-size: clamp(4.4rem, 9.6vw, 9.25rem); }
}

@media (max-width: 520px) {
  .philosophy-page {
    padding-top: clamp(7rem, 15vh, 8.5rem);
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .statement-line {
    column-gap: 0.45rem;
  }

  .statement-word--freedom-first,
  .statement-word--rigorous,
  .statement-word--freedom-last {
    flex-basis: 100%;
  }
}
