/* 
 * que_sera_sera.css
 * Theme: Flow & Release (流れと手放し)
 * Breaking the rigid blog structure with floating elements and organic shapes.
 */

:root {
  --flow-bg-start: #e0f7fa; /* Pale Cyan */
  --flow-bg-end: #f3e5f5; /* Pale Purple */
  --card-bg: rgba(255, 255, 255, 0.85);
  --text-primary: #37474f;
  --accent-flow: #4dd0e1; /* Cyan Accent */
  --accent-warm: #ff8a65; /* Soft Orange */
}

/* =========================================
   Base Layout Overrides
   ========================================= */
body {
  background: linear-gradient(
    135deg,
    var(--flow-bg-start) 0%,
    #ffffff 50%,
    var(--flow-bg-end) 100%
  );
  background-attachment: fixed;
  background-size: cover;
  /* animation: bgGradientFlow 20s ease infinite; REMOVED for accessibility */
  overflow-x: hidden;
}

/* Animation removed */
/* @keyframes bgGradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
} */

/* Remove default white background from main content area to let the flow shine through */
.manuscript-card {
  background: transparent;
  box-shadow: none;
  padding: 0;
  overflow: visible;
}

/* Reseting typography for specific elements */
.article-header h1 {
  font-family: "Kaisei Opti", serif;
  font-size: 3rem;
  color: #2c3e50;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.1em;
}

.article-header .subtitle {
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.2rem;
  color: var(--accent-warm);
  display: block;
  margin-bottom: 0.5rem;
}

/* =========================================
   Floating Content Blocks
   ========================================= */
.content-block {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 2.5rem;
  margin-bottom: 3rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: transform 0.5s ease;
}

/* Rotation removed based on user feedback for stability */
.content-block:nth-of-type(odd) {
  transform: none;
}

.content-block:nth-of-type(even) {
  transform: none;
}

/* Headings with organic underline */
.content-block h3 {
  font-family: "Kaisei Opti", serif;
  font-size: 1.8rem;
  color: #00838f;
  border-bottom: none;
  position: relative;
  display: inline-block;
  padding-bottom: 0px;
}

.content-block h3::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 8px;
  background: rgba(77, 208, 225, 0.3);
  border-radius: 4px;
  z-index: -1;
  transform: skewX(-20deg);
}

/* =========================================
   Worry Dissolver Section (Interactive)
   ========================================= */
.dissolver-container {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 30px;
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.dissolver-container::before {
  content: "Tap cards to embrace the flow";
  position: absolute;
  top: 15px;
  right: 25px;
  font-family: "Zen Kurenaido", sans-serif;
  color: #888;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

/* =========================================
   3D Flap Card Styles
   ========================================= */
/* =========================================
   3D Flap Card Styles (Scattered Grid)
   ========================================= */
.worry-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  perspective: 2000px;
}

.worry-item {
  width: 100%;
  height: 220px; /* Taller for better aspect ratio */
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s ease;
}

/* Random Rotations REMOVED for cleaner layout */
.worry-item:hover {
  z-index: 10;
  transform: translateY(-5px); /* Simple lift on hover */
}

/* Flap Inner Container */
.flap-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
}

.worry-item.flipped .flap-inner {
  transform: rotateX(180deg);
}

/* Common Face Styles */
.flap-front,
.flap-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

/* Front Face */
.flap-front {
  background: #fff;
  color: #607d8b;
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.05rem;
  border: 1px solid rgba(0,0,0,0.05);
}

.flap-front strong {
  display: block;
  color: #ef5350; /* Red-Orange for "Worry" */
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}

/* Back Face */
.flap-back {
  background: linear-gradient(135deg, #26c6da, #4dd0e1);
  color: #fff;
  transform: rotateX(180deg);
  border: 4px solid #fff;
  overflow: hidden; /* For inner text transitions */
}

/* Advice Text (Stage 2) */
.advice-text {
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.1rem;
  line-height: 1.6;
  opacity: 1;
  transition: opacity 1s ease, transform 1s ease;
}

/* Mantra Text (Stage 3) */
.mantra-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-family: "Kaisei Opti", serif;
  font-size: 2.2rem;
  font-weight: bold;
  width: 100%;
  text-align: center;
  opacity: 0;
  transition: opacity 1s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* State Classes for Transitions */
.worry-item.show-mantra .advice-text {
  opacity: 0;
  transform: translateY(-20px);
}

.worry-item.show-mantra .mantra-text {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Stage 4: Fly Away Animation */
@keyframes flyAway {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    /* Move UP (negative Y) and fade out, slightly rotate Z for effect */
    transform: translateY(-800px) scale(0.5) rotate(10deg);
    opacity: 0;
  }
}

.worry-item.fly-away {
  pointer-events: none;
  animation: flyAway 2.5s ease-in forwards;
}

/* =========================================
   Shout Box (Affirmation)
   ========================================= */
/* =========================================
   Shout Box (Unified & Cohesive)
   ========================================= */
.shout-box-flow {
  text-align: center;
  margin: 4rem auto;
  padding: 3rem;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.4) 70%,
    rgba(255, 255, 255, 0) 100%
  );
  border-radius: 50%; /* Subtle circular glow area */
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  transition: transform 0.3s ease;
}

.shout-box-flow:hover {
  transform: scale(1.05);
}

.shout-intro {
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.2rem;
  color: #78909c;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.shout-intro i {
  color: #4dd0e1;
}

.shout-text-flow {
  display: block;
  font-size: 3.5rem;
  font-family: "Kaisei Opti", serif;
  background: linear-gradient(45deg, #00acc1, #ab47bc);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: bold;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  line-height: 1.2;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-boost {
  background: white;
  border: 2px solid #ce93d8;
  color: #ab47bc;
  padding: 0.6rem 1.5rem;
  border-radius: 50px;
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 0 #ce93d8;
  outline: none;
  margin-top: 1rem;
}

.btn-boost:hover {
  background: #f3e5f5;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #ce93d8;
}

.btn-boost:active {
  transform: translateY(4px);
  box-shadow: none;
}

@keyframes pulseGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 5px rgba(77, 208, 225, 0.4));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(171, 71, 188, 0.6));
    transform: scale(1.05);
  }
}

/* =========================================
   Quotes Section
   ========================================= */
/* =========================================
   Quotes Section (Premium Upgrade)
   ========================================= */
.quotes-section {
  border-top: none;
  padding: 4rem 2rem;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  align-items: center;
}

.quote-item {
  position: relative;
  background: #fff;
  padding: 3rem 4rem;
  border-left: none; /* Remove old border */
  border-radius: 12px;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.05),
    0 1px 3px rgba(0, 0, 0, 0.1);
  max-width: 800px;
  width: 100%;
  text-align: center;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.quote-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px; /* Gold Accent Bar */
  height: 100%;
  background: linear-gradient(
    to bottom,
    #f0c27b,
    #4b1248
  ); /* Gold to Deep Purple elegant gradient */
}

/* Float efffect on hover */
.quote-item:hover {
  transform: translateY(-5px);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.08),
    0 5px 15px rgba(0, 0, 0, 0.05);
}

/* Decorative Quote Mark */
.quote-item::after {
  content: "“";
  position: absolute;
  top: -20px;
  left: 20px;
  font-family: "Georgia", serif;
  font-size: 10rem;
  line-height: 1;
  color: rgba(240, 194, 123, 0.2); /* Faint Gold */
  pointer-events: none;
}

.quote-text {
  position: relative;
  font-family: "Kaisei Opti", serif;
  font-size: 1.4rem;
  color: #2c3e50;
  line-height: 2;
  letter-spacing: 0.05em;
  margin-bottom: 2rem;
  z-index: 1;
  text-wrap: balance; /* Improves multi-line text flow */
}

.quote-author {
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.1rem;
  color: #7f8c8d;
  display: inline-block;
  position: relative;
  padding-top: 1.5rem;
  width: auto; /* Allow natural width */
}

/* Styled separator line using pseudo-element */
.quote-author::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px; /* Fixed width for the line only */
  height: 1px;
  background-color: #e0e0e0;
}

/* =========================================
   Background Canvas for Particles
   ========================================= */
#flow-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* =========================================
   Release Experience Section (NEW)
   ========================================= */
.release-section {
  text-align: center;
  overflow: hidden; /* Ensure canvas stays inside */
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.1),
    inset 0 0 20px rgba(77, 208, 225, 0.1);
}

.release-intro {
  margin-bottom: 2rem;
  color: #546e7a;
  line-height: 1.8;
}

.release-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 10;
}

#worry-input {
  width: 100%;
  max-width: 500px;
  height: 120px;
  padding: 1.5rem;
  border-radius: 20px;
  border: 2px solid #b2ebf2; /* Light cyan */
  background: rgba(255, 255, 255, 0.9);
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.1rem;
  color: #37474f;
  resize: vertical;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

#worry-input:focus {
  border-color: var(--accent-flow);
  box-shadow: 0 0 0 4px rgba(77, 208, 225, 0.2);
}

#worry-input::placeholder {
  color: #b0bec5;
  font-style: italic;
}

.btn-release {
  background: linear-gradient(135deg, #4dd0e1, #26c6da);
  color: white;
  border: none;
  padding: 0.8rem 2.5rem;
  border-radius: 50px;
  font-family: "Kaisei Opti", serif;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(38, 198, 218, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.btn-release:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(38, 198, 218, 0.4);
}

.btn-release:active {
  transform: translateY(1px);
}

.release-canvas-container {
  position: relative;
  width: 100%;
  height: 400px; /* Taller for sky */
  border-radius: 15px;
  background: linear-gradient(
    to top,
    #e0f7fa 0%,
    #81d4fa 100%
  ); /* Sky gradient */
  overflow: hidden;
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

#release-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.release-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

.release-message.visible {
  opacity: 1;
}

.release-message span {
  font-family: "Kaisei Opti", serif;
  font-size: 1.8rem;
  color: #00838f;
  text-shadow: 0 2px 10px rgba(255, 255, 255, 0.8);
  display: block;
  animation: float-message 3s ease-in-out infinite;
}

@keyframes float-message {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* --- Shout Particle Effect --- */
.shout-particle {
  position: absolute;
  pointer-events: none;
  font-family: "Kaisei Opti", serif;
  font-weight: bold;
  white-space: nowrap;
  background: linear-gradient(45deg, #00acc1, #ab47bc);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: 100;
  animation: shoutFlyUp 1.5s ease-out forwards;
}

@keyframes shoutFlyUp {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -300px) scale(1.5);
    opacity: 0;
  }
}

/* =========================================
   Ultra-Optimism Playground
   ========================================= */
.optimism-playground {
  background: #f5f5f5;
  border-radius: 15px;
  padding: 2rem;
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: background 0.8s ease;
  border: 1px solid rgba(0,0,0,0.05);
}

.optimism-playground.active {
  background: linear-gradient(135deg, #e0f7fa 0%, #fff9c4 100%); /* Bright & Sunny */
  border-color: #fff;
  box-shadow: 0 0 30px rgba(255, 235, 59, 0.3);
}

.playground-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.5s ease;
}

.playground-state i {
  font-size: 4rem;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.playground-state span {
  font-family: "Zen Kurenaido", sans-serif;
  color: #78909c;
  font-weight: bold;
}

/* State: Complex (Initial) */
.state-complex {
  transform: scale(1);
  opacity: 1;
}

.state-complex i {
  color: #546e7a;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

/* State: Simple (Result) */
.state-simple {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  display: flex; /* Ensure centering works for new layout */
  flex-direction: column;
  align-items: center;
}

.state-simple i {
  font-size: 4rem; /* Adjusted for better fit */
  background: linear-gradient(to bottom, #ffd700, #ff8f00); /* Rich Gold Gradient */
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)); /* Slightly softer glow */
  margin-bottom: 0.5rem;
}

.state-simple span {
  font-size: 1.5rem;
  color: #ff8f00; /* Matching darker gold/orange text */
  margin-top: 10px;
  font-weight: bold;
}

/* Active State Transitions */
.optimism-playground.active .state-complex {
  transform: scale(0) rotate(180deg);
  opacity: 0;
}

.optimism-playground.active .state-simple {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  transition-delay: 0.3s;
}

.optimism-playground.active .btn-switch {
  transform: scale(0); /* Hide button */
  opacity: 0;
}

/* Switch Button */
.btn-switch {
  background: white;
  border: 2px solid #b0bec5;
  color: #546e7a;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  font-family: "Zen Kurenaido", sans-serif;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 0 #b0bec5;
  outline: none;
  z-index: 10;
}

.btn-switch:hover {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b0bec5;
  border-color: #4dd0e1;
  color: #00838f;
}

.btn-switch:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* =========================================
   Final Dramatic Transition
   ========================================= */
#transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
  backdrop-filter: blur(5px);
}

#transition-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.final-action-area {
  margin-top: 4rem;
  text-align: center;
  padding: 3rem;
}

.btn-final-mantra {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  color: #5d4037;
  border: 4px solid #fff;
  padding: 1.5rem 3.5rem;
  border-radius: 60px;
  font-family: "Kaisei Opti", serif;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 179, 0, 0.4);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.btn-final-mantra:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 15px 45px rgba(255, 179, 0, 0.6);
}

.final-flying-text {
  position: fixed;
  z-index: 10001;
  font-family: "Kaisei Opti", serif;
  font-size: 3rem;
  font-weight: bold;
  background: linear-gradient(to bottom, #ffd700, #ff8f00);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
  animation: finalFlyUp 2s ease-in forwards;
}

@keyframes finalFlyUp {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    filter: blur(0);
  }
  100% {
    transform: translate(-50%, -800px) scale(3);
    opacity: 0;
    filter: blur(10px);
  }
}

.wisdom-focus {
  animation: wisdomGlow 2s infinite alternate;
}

@keyframes wisdomGlow {
  from { box-shadow: 0 0 10px rgba(255, 215, 0, 0.2); }
  to { box-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
}
