/* 帰り道 EP - Custom Styles */

/* Tailwind Configuration */
:root {
  --primary: #469eea;
  --secondary: #808080;
  --content: #f0f0f0;
}

/* Custom animations for loading screen */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Loading screen specific styles */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 50%, #1a1a1a 100%);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-spinner .spinner {
  animation: spin 1s linear infinite;
  border-radius: 50%;
  height: 5rem;
  width: 5rem;
  border: 4px solid white;
  border-top-color: transparent;
  margin: 0 auto;
}

.animate-fade-in-up {
  animation: fadeInUp 1s ease-out forwards;
}

.animate-fade-in {
  animation: fadeIn 1s ease-out forwards;
}

/* Monogatari Series Loading Screen Styles */
.monogatari-loading-container {
  max-width: 700px;
  width: 90%;
  padding: 1rem;
  text-align: center;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

@media (max-width: 768px) {
  .monogatari-loading-container {
    width: 95%;
    padding: 1rem;
    height: 100vh;
  }
  
  .monogatari-text-container {
    margin-bottom: 1.5rem;
    max-height: 80vh;
  }
}

@media (max-width: 480px) {
  .monogatari-loading-container {
    width: 98%;
    padding: 0.5rem;
    height: 100vh;
  }
  
  .monogatari-text-container {
    margin-bottom: 1rem;
    max-height: 75vh;
    padding: 0 0.2rem;
  }
}

@media (max-width: 360px) {
  .monogatari-loading-container {
    width: 100%;
    padding: 0.3rem;
    height: 100vh;
  }
  
  .monogatari-text-container {
    margin-bottom: 0.8rem;
    max-height: 70vh;
    padding: 0 0.1rem;
  }
}

.monogatari-text-container {
  margin-bottom: 1.5rem;
  max-height: 80vh;
  overflow: visible;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.monogatari-text-line {
  font-size: 1.5rem;
  line-height: 2.2;
  color: #ffffff;
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 0.8rem;
  transition: opacity 0.8s ease-in-out;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  max-width: 100%;
  word-wrap: break-word;
}

/* New text block styling for better line breaks */
.monogatari-text-block {
  font-size: 1.1rem;
  line-height: 1.9;
  color: #ffffff;
  font-weight: 300;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
  transition: opacity 0.8s ease-in-out;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  /* Japanese text optimization */
  word-break: keep-all;
  line-break: strict;
  /* Modern CSS text wrapping with fallbacks */
  text-wrap: balance;
  text-wrap: pretty; /* Fallback for older browsers */
  hanging-punctuation: allow-end;
  /* Additional fallback properties */
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  /* Prevent orphans and widows */
  orphans: 2;
  widows: 2;
}

/* タブレット向けサイズ調整 */
@media (max-width: 768px) {
  .monogatari-text-block {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 0.9rem;
    letter-spacing: 0.02em;
  }
}

/* 確実な改行制御のための基本スタイル */
.no-break {
  white-space: nowrap !important;
  display: inline !important;
  word-break: keep-all !important;
  line-break: strict !important;
}

/* ダッシュ区切りスタイル */
.dash-separator {
  white-space: nowrap !important;
  display: inline !important;
  margin: 0 0.2em;
  word-break: keep-all !important;
}

/* レスポンシブテキスト表示制御 - デスクトップ版（デフォルト） */
.desktop-text {
  display: block;
}

.tablet-text {
  display: none;
}

.mobile-text {
  display: none;
}

.hidden {
  display: none !important;
}

/* 360px以下の極小画面対応 */
@media (max-width: 360px) {
  .monogatari-text-block {
    font-size: 0.75rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
    letter-spacing: 0.01em;
  }
  
  .mobile-text .monogatari-text-block {
    font-size: 0.65rem;
    line-height: 1.4;
    padding: 0 0.1rem;
    margin-bottom: 0.4rem;
    letter-spacing: 0;
  }
  
  .dash-separator {
    margin: 0;
  }
}

/* タブレット版のフォント調整のみ */
@media (max-width: 768px) and (min-width: 481px) {
  .tablet-text .monogatari-text-block {
    font-size: 0.9rem;
    line-height: 1.7;
    letter-spacing: 0.02em;
  }
}

/* モバイル版のフォント調整のみ */
@media (max-width: 480px) {
  .monogatari-text-block {
    font-size: 0.8rem;
    line-height: 1.6;
    margin-bottom: 0.7rem;
    letter-spacing: 0.02em;
  }
  
  .mobile-text .monogatari-text-block {
    font-size: 0.7rem;
    line-height: 1.5;
    letter-spacing: 0.01em;
    padding: 0 0.2rem;
    margin-bottom: 0.5rem;
  }
  
  .mobile-text .dash-separator {
    margin: 0 0.1em;
  }
}

/* 320px以下の極小デバイス対応 */
@media (max-width: 320px) {
  .monogatari-text-block {
    font-size: 0.65rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    letter-spacing: 0;
  }
  
  .mobile-text .monogatari-text-block {
    font-size: 0.6rem;
    line-height: 1.3;
    padding: 0;
    margin-bottom: 0.3rem;
  }
  
  .dash-separator {
    margin: 0;
    font-size: 0.7rem;
  }
}

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2) {
  .monogatari-text-block {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

@media (max-width: 768px) {
  .monogatari-text-line {
    font-size: 1.2rem;
    line-height: 2;
  }
}

@media (max-width: 480px) {
  .monogatari-text-line {
    font-size: 1rem;
    line-height: 1.8;
  }
}

/* Monogatari Final Title Styles */
.monogatari-title-container {
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  padding-top: 3rem;
  transition: opacity 1s ease-in-out;
}

.monogatari-final-title {
  font-size: 3rem;
  font-weight: 200;
  color: #ffffff;
  letter-spacing: 0.15em;
  margin-bottom: 1rem;
  position: relative;
}

.monogatari-final-title::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: -0.5rem;
  width: 2px;
  height: 2rem;
  background-color: #469eea;
}

.monogatari-final-title::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  right: -0.5rem;
  width: 2px;
  height: 2rem;
  background-color: #469eea;
}

.monogatari-final-subtitle {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  letter-spacing: 0.1em;
}

@media (max-width: 768px) {
  .monogatari-final-title {
    font-size: 2.5rem;
  }
  
  .monogatari-final-subtitle {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .monogatari-final-title {
    font-size: 2rem;
  }
  
  .monogatari-final-subtitle {
    font-size: 0.9rem;
  }
}

/* Text animation keyframes */
@keyframes monogatariTextReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.monogatari-text-reveal {
  animation: monogatariTextReveal 0.6s ease-out forwards;
}

.monogatari-paragraph {
  margin-bottom: 1rem;
  transition: opacity 0.6s ease-in-out;
}

/* Monogatari series inspired design elements */
.monogatari-title {
  position: relative;
  display: inline-block;
}

.monogatari-title::before,
.monogatari-title::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 3rem;
  background-color: currentColor;
}

.monogatari-title::before {
  top: -0.5rem;
  left: -0.5rem;
}

.monogatari-title::after {
  bottom: -0.5rem;
  right: -0.5rem;
}

/* Section decorative elements */
.section-decoration {
  position: relative;
  display: inline-block;
}

.section-decoration::before,
.section-decoration::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 3rem;
}

.section-decoration::before {
  top: -0.5rem;
  left: -0.5rem;
}

.section-decoration::after {
  bottom: -0.5rem;
  right: -0.5rem;
}

/* Paragraph dots */
.paragraph-dot {
  position: absolute;
  left: -2rem;
  top: 0;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

/* Responsive design improvements */
@media (max-width: 768px) {
  .monogatari-about {
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  .monogatari-about .space-y-12 > * {
    margin-left: 0 !important;
  }
}

/* Grid center fix for single items */
.center-single-item {
  display: flex;
  justify-content: center;
}

.center-single-item > .grid {
  justify-content: center;
}

/* Ensure consistent card sizes */
.member-item {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}