/* ========================================
   MARK: CSS Custom Properties / Design Tokens
   ======================================== */
:root {
  /* Colors */
  --color-btn-video-start: #e84b1a;
  --color-btn-video-end: #c73a0e;
  --color-btn-video-highlight: #ff7a4d;
  --color-btn-learn-start: #5ba8d9;
  --color-btn-learn-end: #3a7fb8;
  --color-btn-learn-highlight: #8ac6ea;
  --color-btn-text: #ffffff;
  --color-btn-shadow: rgba(0, 0, 0, 0.25);
  --color-btn-inner-shadow: rgba(255, 255, 255, 0.3);

  /* Typography */
  --font-primary: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;
  --font-weight-bold: 700;

  /* Sizing */
  --hero-max-width: 100%;

  /* Transitions */
  --transition-hover: 0.2s ease;
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   MARK: Reset & Base
   ======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  background-color: #f0f8ff;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ========================================
   MARK: Hero Section
   ======================================== */
.hero {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 500px;
  overflow: hidden;
}

/* ----------------------------------------
   MARK: Background Layers
   ---------------------------------------- */
.hero__layer {
  position: absolute;
  left: 0;
  width: 100%;
  pointer-events: none;
}

/* Sky - full background */
.hero__layer--sky {
  top: 0;
  height: 100%;
  z-index: 1;
}

.hero__layer--sky img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Grassy back - positioned at bottom */
.hero__layer--grassy-back {
  bottom: 0;
  height: 100%;
  z-index: 2;
}

.hero__layer--grassy-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;
}

/* Grassy front - positioned at bottom, in front */
.hero__layer--grassy-front {
  bottom: 0;
  height: 100%;
  z-index: 10;
}

.hero__layer--grassy-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;
}

/* ----------------------------------------
   MARK: Animals
   ---------------------------------------- */
@keyframes animal-pop-up {
  0% {
    transform: translateY(40vh);
    /* 草むらの下へ沈めておく */
    opacity: 0;
  }

  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.hero__animal {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  animation: animal-pop-up 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Dairy Cow - full overlay, image self-positions to left */
.hero__animal--dairy-cow {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  animation-delay: 0.1s;
}

.hero__animal--dairy-cow img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left bottom;
}

/* Pig - full overlay, image self-positions to left-bottom */
.hero__animal--pig {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 7;
  animation-delay: 0.5s;
}

.hero__animal--pig img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left bottom;
}

/* Beef Cattle - full overlay, image self-positions to right */
.hero__animal--beef-cattle {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  animation-delay: 0.3s;
}

.hero__animal--beef-cattle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right bottom;
}

/* Chicken - full overlay, image self-positions to right-bottom */
.hero__animal--chicken {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 7;
  animation-delay: 0.7s;
}

.hero__animal--chicken img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right bottom;
}

/* ----------------------------------------
   MARK: Title & Speech Balloons
   ---------------------------------------- */
.hero__title {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  /* 草原レイヤーの上 */
  width: 80%;
  max-width: 700px;
  pointer-events: none;
}

.hero__title img {
  width: 100%;
  height: auto;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.15));
}

/* Shared balloon styles */
.hero__balloon {
  position: absolute;
  z-index: 5;
  /* 動物レイヤーの後ろ */
  pointer-events: none;
  --balloon-x: -50%;
  --balloon-y: -50%;
  transform: translate(var(--balloon-x), var(--balloon-y));
}

.hero__balloon img {
  width: 100%;
  height: auto;
  filter: drop-shadow(1px 2px 4px rgba(0, 0, 0, 0.1));
}

/* Remote Therapy - top-left, above dairy cow */
.hero__balloon--remote-therapy {
  left: calc(50% + max(-30vw, -300px));
  top: calc(50% + max(-34vw, -250px));
  /* vwで縦横比を固定連動 */
  width: min(45.7vw, 400px);
}

/* Farm Management - top-right, above beef cattle */
.hero__balloon--farm-management {
  left: calc(50% + min(30vw, 300px));
  top: calc(50% + max(-32vw, -240px));
  width: min(43.4vw, 380px);
}

/* AMR - left-center, near pig */
.hero__balloon--amr {
  left: calc(50% + max(-35vw, -350px));
  top: calc(50% + min(3vw, 80px));
  width: min(32vw, 280px);
}

/* Quiz - right-center, near chicken */
.hero__balloon--quiz {
  left: calc(50% + min(35vw, 350px));
  top: calc(50% + min(2vw, 50px));
  width: min(26.2vw, 230px);
}

/* Balloon pop-up & float animations */
@keyframes balloon-pop-up {
  0% {
    transform: translate(var(--balloon-x), calc(var(--balloon-y) + 30px)) scale(0.3);
    opacity: 0;
  }

  100% {
    transform: translate(var(--balloon-x), var(--balloon-y)) scale(1);
    opacity: 1;
  }
}

@keyframes balloon-float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.hero__balloon--remote-therapy {
  animation: balloon-pop-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.0s both;
}

.hero__balloon--remote-therapy img {
  animation: balloon-float 3s ease-in-out infinite;
}

.hero__balloon--farm-management {
  animation: balloon-pop-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.2s both;
}

.hero__balloon--farm-management img {
  animation: balloon-float 3.5s ease-in-out infinite 0.4s;
}

.hero__balloon--amr {
  animation: balloon-pop-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.4s both;
}

.hero__balloon--amr img {
  animation: balloon-float 4s ease-in-out infinite 0.8s;
}

.hero__balloon--quiz {
  animation: balloon-pop-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 1.6s both;
}

.hero__balloon--quiz img {
  animation: balloon-float 3.2s ease-in-out infinite 1.2s;
}

/* ----------------------------------------
   MARK: CTA Buttons Area
   ---------------------------------------- */
.hero__cta {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0;
  z-index: 20;
  width: 62%;
  justify-content: center;
}

/* Shared Button Styles */
.hero__btn {
  max-width: 350px;
}

.hero__btn:hover {}

/* Video Button - Red/Orange */
.hero__btn--video {}

/* Learn Button - Blue */
.hero__btn--learn {}


/* ----------------------------------------
   MARK: Animal subtle idle animations
   ---------------------------------------- */
@keyframes float-gentle {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes sway-gentle {

  0%,
  100% {
    transform: rotate(0deg);
  }

  50% {
    transform: rotate(2deg);
  }
}

.hero__animal--dairy-cow img {
  animation: sway-gentle 5s ease-in-out infinite;
}

.hero__animal--pig img {
  animation: float-gentle 4s ease-in-out infinite;
  animation-delay: 0.5s;
}

.hero__animal--beef-cattle img {
  animation: sway-gentle 6s ease-in-out infinite;
  animation-delay: 1s;
}

.hero__animal--chicken img {
  animation: float-gentle 3.5s ease-in-out infinite;
  animation-delay: 0.3s;
}

/* ----------------------------------------
   MARK: Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
  .hero {
    /* full viewport on mobile too */
  }

  .hero__cta {
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 80%;
    bottom: 10%;
  }

  .hero__btn {
    min-width: 220px;
    padding: 0px 30px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .hero__btn {
    min-width: 180px;
    padding: 0px 30px;
    font-size: 14px;
    gap: 0px;
  }
}

/* ========================================
   MARK: Movie / Learn Page
   ======================================== */
.page-movie {
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 30px 20px 100px;
}

.movie-content {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.movie-header {
  margin-bottom: 40px;
}

.learn-header {
  margin-bottom: 40px;
}

.movie-header__title {
  max-width: 380px;
  width: 100%;
  filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.1));
}

.learn-header__title {
  max-width: 480px;
  width: 100%;
  filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.1));
}

/* Grid */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  width: 100%;
}

/* Card Base */
.movie-card {
  display: flex;
  flex-direction: column;
  border-radius: 40px;
  /* border: 6px solid var(--card-border-color); */
  /* 枠線を太く */
  border-bottom: 8px solid var(--card-shadow-color);
  /* 3Dシャドウを少し強調 */
  overflow: hidden;
  text-decoration: none;
  transition: transform var(--transition-hover);
  background: linear-gradient(to bottom, var(--card-grad-top), var(--card-grad-bottom));

}

.movie-card:hover {
  transform: translateY(-6px);
}

.movie-card__image-wrap {
  height: 230px;
  border-radius: 34px;
  margin: 6px 6px 0;
  /* 固定高さを指定 */
  background-color: #ffffff;
  background-image: var(--card-bg-img);
  background-repeat: no-repeat;
  background-position: var(--card-bg-pos);
  /* ラベル側に揃える */
  background-size: var(--card-bg-size);
  /* 横が見切れないように */
}

.movie-card__label {
  padding: 8px 10px;
  /* 余白を多めに */
  text-align: center;
  color: #ffffff;
  font-size: 28px;
  /* モックに合わせて大きく */
  font-weight: 900;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.05em;
  /* 立体感用のハイライト */
}

/* Card - Colors and Images */
.movie-card--yellow {
  --card-bg-img: url('../images/thumb_movie_remote_therapy.png');
  --card-border-color: #F8C857;
  --card-shadow-color: #953f23;
  --card-grad-top: #e4bb62;
  --card-grad-bottom: #cf8e3d;
  --card-bg-pos: top center;
  --card-bg-size: 85% auto;
}

.movie-card--blue {
  --card-bg-img: url('../images/thumb_movie_farm_management.png');
  --card-border-color: #99CEE8;
  --card-shadow-color: #355f7c;
  --card-grad-top: #98cee8;
  --card-grad-bottom: #68a8d1;
  --card-bg-pos: 0px 20px;
  --card-bg-size: 85% auto;
}

.movie-card--green {
  --card-bg-img: url('../images/thumb_movie_amr.png');
  --card-border-color: #BED583;
  --card-shadow-color: #4e6825;
  --card-grad-top: #bed684;
  --card-grad-bottom: #7db656;
  --card-bg-pos: center;
  --card-bg-size: auto 90%;
}

.movie-card--pink {
  --card-bg-img: url('../images/thumb_movie_quiz.png');
  --card-border-color: #F0C9D8;
  --card-shadow-color: #97586e;
  --card-grad-top: #f0cbd8;
  --card-grad-bottom: #e5a1b9;
  --card-bg-pos: center;
  --card-bg-size: auto 90%;
}

.movie-card--learn-vr {
  --card-bg-img: url('../images/thumb_learn_vr.png');
  --card-border-color: #99CEE8;
  --card-shadow-color: #355f7c;
  --card-grad-top: #98cee8;
  --card-grad-bottom: #68a8d1;
  --card-bg-pos: center;
  --card-bg-size: cover;
}

.movie-card--learn-quiz {
  --card-bg-img: url('../images/thumb_learn_quiz.png');
  --card-border-color: #F0C9D8;
  --card-shadow-color: #97586e;
  --card-grad-top: #f0cbd8;
  --card-grad-bottom: #e5a1b9;
  --card-bg-pos: center;
  --card-bg-size: auto 90%;
}

/* ========================================
   MARK: Video Detail Page
   ======================================== */
.page-movie-detail {
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 50px 20px 100px;
}

.movie-detail-content {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Base Theme Vars */
.theme-yellow {
  --color-button: #d9a552;
  --color-shadow: #953f23;
  --color-grad-top: #e4bb62;
  --color-grad-bottom: #cf8e3d;
  --template-columns: repeat(3, 1fr);
}

.theme-blue {
  --color-button: #7fbcdf;
  --color-shadow: #355f7c;
  --color-grad-top: #97cde7;
  --color-grad-bottom: #5caad6;
  --template-columns: repeat(2, 1fr);
}

.theme-green {
  --color-button: #a4c46b;
  --color-shadow: #4e6825;
  --color-grad-top: #bcd580;
  --color-grad-bottom: #87aa4b;
  --template-columns: repeat(3, 1fr);
}

.theme-pink {
  --color-button: #ebb6c9;
  --color-shadow: #97586e;
  --color-grad-top: #f0cad6;
  --color-grad-bottom: #e49ab4;
  --template-columns: repeat(2, 1fr);
}

/* Header */
.movie-detail-header {
  margin-bottom: 50px;
}

.movie-detail-header__title {
  display: inline-block;
  padding: 12px 60px;
  background: linear-gradient(to bottom, var(--color-grad-top), var(--color-grad-bottom));
  color: #ffffff;
  font-size: 32px;
  font-weight: 900;
  border-radius: 40px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  margin: 0;
}

/* Grid */
.movie-detail-grid {
  display: grid;
  grid-template-columns: var(--template-columns);
  gap: 30px;
  width: 100%;
  justify-items: center;
}

/* Video Card */
.video-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, var(--color-grad-top), var(--color-grad-bottom));
  border-radius: 40px;
  /* border: 6px solid var(--color-border); */
  border-bottom: 8px solid var(--color-shadow);
  padding: 20px 20px 25px;
  max-width: 380px;
  width: 100%;
  position: relative;
}

.video-card.new::after {
  content: "NEW";
  display: block;
  position: absolute;
  top: -15px;
  left: -10px;
  background-color: #ffe600;
  color: #e30000;
  padding: 10px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, .1);
  display: inline-block;
  flex: 1;
  text-align: center;
  max-width: 150px;
}

.video-card__title {
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 15px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  flex: 1;
}

.video-card__thumb {
  background-color: #ffffff;
  border-radius: 8px;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 20px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

.video-card__footer {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.video-card__btn {
  background-color: #ffffff;
  color: var(--color-button);
  padding: 8px 20px;
  border-radius: 30px;
  font-size: 24px;
  font-weight: 900;
  text-decoration: none;
  transition: transform var(--transition-hover);
  box-shadow: 0px 2px 5px var(--color-shadow);
  display: inline-block;
  flex: 1;
  text-align: center;
  max-width: 150px;
}

.video-card__btn:hover {
  transform: translateY(-4px);
}

/* Back Button */
.btn-back {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 150px;
  height: auto;
  z-index: 100;
  transition: transform var(--transition-bounce);
}

.btn-back:hover {
  transform: scale(1.1) rotate(-3deg);
}

/* ----------------------------------------
   MARK: Responsive
   ---------------------------------------- */
@media (max-width: 768px) {
  .movie-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 480px;
  }

  .movie-header {
    margin-bottom: 30px;
  }

  .movie-header__title {
    max-width: 280px;
  }

  .btn-back {
    width: 100px;
    bottom: 10px;
    right: 10px;
  }

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

@media (max-width: 480px) {
  .movie-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   MARK: Video Modal
   ======================================== */
.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.video-modal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.video-modal__content {
  position: relative;
  z-index: 1001;
  width: 90%;
  max-width: 900px;
  background: #000;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.video-modal.is-active .video-modal__content {
  transform: scale(1);
}

.video-modal__close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 32px;
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1002;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  line-height: 1;
}

.video-modal__close:hover {
  color: var(--color-btn-video-highlight);
}

.video-modal__iframe-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  /* 16:9 Aspect Ratio */
}

.video-modal__iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}