/* ==========================================================================
   RYUTA HISTORY - Roller Coaster Story Section Styles
   ========================================================================== */

/* --- Container & Layout (Smooth Scroll Page) --- */
.history-page-body {
  background-color: #0b132b;
  margin: 0;
  padding: 0;
  font-family: var(--font-base);
}

.history-container {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 60px 16px 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: url('../assets/history_cloud_skyway_bg.png') center top / cover no-repeat;
  position: relative;
  animation: pageFadeIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* --- Attraction Header Section --- */
.history-header-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
  margin-top: 0;
  z-index: 5;
  width: 100%;
  max-width: 560px;
  position: relative;
}

/* Dynamic Vertical Rising Balloons Overlay (Continuous Loop from Bottom to Top) */
.history-balloons-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.balloon-hist {
  position: absolute;
  bottom: -110px;
  width: 11vw;
  max-width: 48px;
  aspect-ratio: 30 / 90;
  height: auto;
  transform-origin: bottom center;
}

.balloon-hist-left-1 {
  left: 3%;
  animation: balloonRiseLoop 14s linear infinite 0s;
}

.balloon-hist-left-2 {
  left: 18%;
  animation: balloonRiseLoop 18s linear infinite 5.5s;
}

.balloon-hist-right-1 {
  right: 18%;
  animation: balloonRiseLoop 16s linear infinite 2.5s;
}

.balloon-hist-right-2 {
  right: 3%;
  animation: balloonRiseLoop 19s linear infinite 9.5s;
}

@keyframes balloonRiseLoop {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }

  8% {
    opacity: 0.95;
  }

  25% {
    transform: translateY(-30vh) rotate(-12deg);
  }

  50% {
    transform: translateY(-65vh) rotate(14deg);
  }

  75% {
    transform: translateY(-95vh) rotate(-10deg);
  }

  92% {
    opacity: 0.95;
  }

  100% {
    transform: translateY(-125vh) rotate(8deg);
    opacity: 0;
  }
}

/* Golden Ribbon Banner Header (Matching Coffee Cup / sns.css 100%) */
.history-ribbon-banner {
  position: relative;
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.22));
}

.history-ribbon-img {
  width: 100%;
  height: auto;
  display: block;
}

.history-curved-title-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.history-title-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.history-title-curved {
  font-family: var(--font-circus), 'Rye', 'Fredoka', cursive;
  font-size: 52px;
  font-weight: 700;
  fill: #3b4252;
  letter-spacing: 1px;
  filter: drop-shadow(2px 2px 0px rgba(255, 255, 255, 0.9));
}

/* --- Roller Coaster Experience Area --- */

/* --- Roller Coaster Experience Area --- */
.coaster-experience-area {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin-top: 0;
  margin-bottom: 80px;
  min-height: auto;
  box-sizing: border-box;
}

.coaster-track-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Roller Coaster Cart Element */
.coaster-cart {
  position: absolute;
  top: 0;
  left: 0;
  width: 170px;
  height: 170px;
  z-index: 4;
  will-change: transform;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  pointer-events: none;
}

.cart-body-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.cart-img {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.25));
  z-index: 1;
}

.cart-img-left {
  display: none;
}

.cart-img-right {
  display: block;
}

.coaster-cart.is-facing-left .cart-img-left {
  display: block;
}

.coaster-cart.is-facing-left .cart-img-right {
  display: none;
}

.coaster-cart.is-facing-right .cart-img-right {
  display: block;
}

.coaster-cart.is-facing-right .cart-img-left {
  display: none;
}

.cart-chibi-img {
  position: absolute;
  bottom: 40px;
  left: calc(46% + 20px);
  width: 160px;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
  z-index: 2;
}

.coaster-cart.is-facing-left .cart-chibi-img {
  transform: translateX(-50%) scaleX(1);
}

.coaster-cart.is-facing-right .cart-chibi-img {
  transform: translateX(-82%) scaleX(-1);
}

/* --- 14 Milestone Station Cards --- */
.milestones-wrapper {
  display: flex;
  flex-direction: column;
  gap: 64px;
  position: relative;
  z-index: 3;
  padding-top: 20px;
  width: 100%;
}

.milestone-card-station {
  font-family: var(--font-jap);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.94) 100%);
  backdrop-filter: blur(10px);
  border: 2.5px solid #d4af37;
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2), inset 0 0 12px rgba(255, 255, 255, 0.8);
  position: relative;
  width: 76%;
  max-width: 270px;
  box-sizing: border-box;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.4s ease;
  user-select: none;
}

/* Scroll-Linked Active Proximity State (Enlarges when coaster cart passes near this card) */
.milestone-card-station.is-active,
.milestone-card-station:hover {
  transform: translateY(-6px) scale(1.06);
  border-color: #f59e0b;
  box-shadow: 0 14px 36px rgba(217, 119, 6, 0.4), inset 0 0 16px rgba(255, 255, 255, 0.95);
  z-index: 10;
}

/* S-Curve Alternating Positions */
.station-left {
  align-self: flex-start;
  margin-left: 2%;
}

.station-right {
  align-self: flex-end;
  margin-right: 2%;
}

.station-anniversary {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(255, 253, 243, 0.98) 0%, rgba(254, 243, 199, 0.96) 100%);
}

.station-goal {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.98) 0%, rgba(253, 230, 138, 0.96) 100%);
  box-shadow: 0 12px 32px rgba(245, 158, 11, 0.35);
}

.station-badge {
  position: absolute;
  top: -12px;
  left: 16px;
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: #ffffff;
  font-family: var(--font-circus);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 12px;
  letter-spacing: 1px;
  box-shadow: 0 3px 8px rgba(180, 83, 9, 0.35);
}

.badge-gold {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.badge-goal {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  font-size: 11px;
  padding: 4px 14px;
}

.station-date {
  font-family: var(--font-circus), 'Rye', cursive;
  font-size: 20px;
  font-weight: 800;
  color: #b45309;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.gold-date {
  color: #d97706;
}

.station-title {
  font-family: var(--font-jap);
  font-size: 14.5px;
  font-weight: 700;
  color: #1e293b;
  margin: 4px 0 6px;
}

.gold-title {
  color: #78350f;
}

.station-desc {
  font-family: var(--font-jap);
  font-size: 11.5px;
  font-weight: 500;
  color: #475569;
  line-height: 1.55;
  margin: 0;
}

.station-x-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 4px 12px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #0284c7;
  border: 1.5px solid #bae6fd;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.station-x-link:hover {
  transform: translateY(-2px) scale(1.04);
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.station-x-svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  flex-shrink: 0;
}

.station-tag {
  font-family: var(--font-jap);
  display: inline-block;
  margin-top: 10px;
  font-size: 10px;
  font-weight: 700;
  color: #0284c7;
  background: #e0f2fe;
  padding: 3px 10px;
  border-radius: 10px;
  border: 1px solid #bae6fd;
}

/* ==========================================================================
   Media Queries (Grouped at the bottom per AGENTS.md guidelines)
   ========================================================================== */

/* --- 1. Large Desktop / PC (min-width: 1200px) --- */
@media (min-width: 1200px) {
  .history-container {
    padding: 60px 24px 50px;
    background-image: url('../assets/history_cloud_skyway_bg.png');
    background-position: center top;
  }

  .history-header-section {
    margin-top: 0;
  }

  .history-ribbon-banner {
    max-width: 620px;
  }

  .history-title-curved {
    font-size: 48px;
  }

  .coaster-experience-area {
    max-width: 500px;
  }

  .coaster-cart {
    width: 135px;
    height: 135px;
  }

  .cart-chibi-img {
    bottom: 30px;
    width: 130px;
    height: 130px;
  }

  .wheel {
    width: 13px;
    height: 13px;
  }

  .milestone-card-station {
    max-width: 290px;
    padding: 20px 22px;
  }

  .station-year {
    font-size: 28px;
  }

  .station-title {
    font-size: 16px;
  }
}

/* --- 2. Medium Desktop / Tablet Landscape (769px to 1199px) --- */
@media (min-width: 769px) and (max-width: 1199px) {
  .history-container {
    padding: 65px 20px 40px;
    background-image: url('../assets/history_cloud_skyway_bg.png');
  }

  .history-header-section {
    margin-top: 0;
  }

  .history-ribbon-banner {
    max-width: 500px;
  }

  .history-title-curved {
    font-size: 50px;
  }

  .coaster-experience-area {
    max-width: 460px;
  }
}

/* --- 3. Tablet Portrait / Small Tablet (481px to 768px) --- */
@media (min-width: 481px) and (max-width: 768px) {
  .history-container {
    padding: 60px 16px 40px;
    background-image: url('../assets/history_sp_bg.jpg');
    background-size: cover;
    background-position: center top;
  }

  .history-header-section {
    margin-top: 3%;
  }

  .history-ribbon-banner {
    max-width: 420px;
  }

  .history-title-curved {
    font-size: 46px;
  }

  .coaster-experience-area {
    max-width: 420px;
    min-height: auto;
  }

  .milestones-wrapper {
    gap: 60px;
  }

  .milestone-card-station {
    max-width: 250px;
    padding: 16px 18px;
  }
}

/* --- 4. Mobile Phone SP (max-width: 480px) --- */
@media (max-width: 480px) {
  .history-container {
    padding: 48px 10px 30px;
    background-image: url('../assets/history_sp_bg.jpg');
    background-size: cover;
    background-position: center top;
  }

  .history-ribbon-banner {
    max-width: 320px;
  }

  .history-title-curved {
    font-size: 38px;
  }

  .coaster-experience-area {
    max-width: 340px;
    margin-top: 60px;
    min-height: auto;
  }

  .coaster-cart {
    width: 110px;
    height: 110px;
  }

  .cart-chibi-img {
    bottom: 24px;
    width: 108px;
    height: 108px;
  }

  .milestones-wrapper {
    gap: 54px;
  }

  .milestone-card-station {
    width: 80%;
    max-width: 230px;
    padding: 14px 16px;
  }

  .station-date {
    font-size: 18px;
  }

  .station-title {
    font-size: 13.5px;
  }

  .station-desc {
    font-size: 11px;
  }
}