/* ===================================
   CSS Variables & Reset
   =================================== */
:root {
  --primary-color: #FF6B35;
  --secondary-color: #4ECDC4;
  --accent-color: #FFE66D;
  --dark-color: #2C3E50;
  --light-color: #F7F7F7;
  --white: #FFFFFF;
  --text-color: #333333;
  --text-light: #666666;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
  --border-radius: 0;
  --max-width: 1200px;
}



body {
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--white);
}



/* ===================================
   Utility & Content Styles
   =================================== */
.text-link {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 500;
}

.text-link:hover {
  text-decoration: underline;
}

.hover-text-orange {
  text-decoration: none;
  color: var(--text-color);
  transition: color 0.3s ease;
}

.hover-text-orange:hover {
  color: var(--primary-color);
}

.content-image-4-3 {
  display: block;
  aspect-ratio: 4 / 3;
  width: 80%;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin: 2rem auto;
  cursor: pointer;
  border-radius: var(--border-radius);
  margin: 2rem auto;
  cursor: pointer;
  /* Removed transition/transform from container base if we want inner zoom */
}

/* Zoom Wrapper */
.img-zoom-wrapper {
  overflow: hidden;
  border-radius: var(--border-radius);
  display: block; /* Ensure it behaves as a block/floatable */
  cursor: pointer;
}

.img-zoom-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

.img-zoom-wrapper:hover img {
  transform: scale(1.05); /* Match requested scale */
}

/* Modifying existing selectors to work with wrapper or img inside wrapper */
/* content-image-4-3 is now often a wrapper class */

/* ===================================
   Hero Section
   =================================== */
.hero {
  position: relative;
  height: 80vh; /* Match contest desktop hero */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 90px; /* Header height */
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0 2rem;
  text-align: center;
  color: var(--white);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===================================
   Container & Sections
   =================================== */
.container {
  max-width: var(--max-width);
  margin: 40px auto;
  padding: 1rem 5rem;
}

section {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--dark-color);
}

.section-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 1rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.rounded-title {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 0.1rem 2rem;
  border-radius: 50px;
  width: fit-content;
  margin: 0 auto 2rem;
}

/* ===================================
   Workshop Explanation
   =================================== */
.workshop-explanation {
  background-color: var(--light-color);
  padding: 3rem 4rem;
  border-radius: var(--border-radius);
  margin-bottom: 2rem; /* Reduced bottom spacing from default container */
}
/* Override default container margin for #about */
#about.container {
  margin-bottom: 0;
}

.workshop-explanation p {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
  max-width: 960px;
  margin: 0 auto 1rem;
}

section p {
  font-size: 0.95rem;
  font-weight: 300;
  padding-top: 10px;
  text-align: justify;
  line-height: 1.45;
}

/* ===================================
   Recommendation Section
   =================================== */
.recommendation {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--white);
  padding: 3rem 2rem;
  border-radius: var(--border-radius);
}

.recommendation .section-title {
  color: var(--white);
}

.recommendation-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.recommendation-text {
  font-size: 1.1rem;
  text-align: center;
  line-height: 1.6;
  margin-bottom: 1rem;
  font-style: italic;
}

.recommendation-author {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
}

/* ===================================
   Programs Grid
   =================================== */
/* ===================================
   Programs Scroll Section
   =================================== */
/* Ensure sticky works by unsetting overflow hidden from global styles */
html,
body,
main,
.programs-scroll-section {
  overflow: visible !important;
}

.programs-scroll-section {
  height: 400vh; /* Adjust length of scroll */
  position: relative;
  margin-bottom: 0; /* Remove bottom margin to reduce gap */
}

.sticky-wrapper {
  position: sticky;
  top: 120px; /* Header height (90px) + 30px spacing */
  height: auto;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 30px; /* Space between header and content */
}

/* Remove default container margin/padding inside sticky wrapper to reduce vertical space */
.sticky-wrapper .container {
  margin-top: 0;
  margin-bottom: 0; /* Remove bottom spacing */
  padding-top: 0;
  padding-bottom: 0;
}

.horizontal-scroll-container {
  width: 100%;
  overflow: hidden;
  padding: 0 10vw; /* Side padding */
  margin-bottom: 0;
  padding-bottom: 0;
  /* Ensure this container takes available space but doesn't force overflow */
  flex-grow: 1;
  display: flex;
  align-items: center; /* Center cards vertically if needed */
}

.horizontal-scroll-track {
  display: flex;
  gap: 2rem;
  width: max-content;
  will-change: transform;
}

.program-card {
  background-color: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid #9e9e9e;
  transition: var(--transition);
  /* Fixed width for horizontal scrolling */
  min-width: 300px; 
  width: 23vw;
  max-width: 400px;
}

/* Override existing grid styles if needed, or rely on specificity */
.programs-grid {
  display: none; /* Hide old grid if it still exists */
}

/* .program-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-lg);
} */

.program-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.program-content {
  padding: 0rem 1.5rem 1.5rem;
}

.program-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0rem;
  line-height: 1.2;
  color: var(--primary-color);
}

.program-description {
  color: var(--text-light);
  line-height: 1.5;
}

/* ===================================
   Information Section
   =================================== */
#info.container {
  margin-top: 2rem; /* Further reduced from 6rem */
  padding-top: 1rem; /* minimal padding */
}

/* Specific spacing for Info title */
#info .section-title {
  margin-bottom: 2rem;
}

.information {
  background-color: var(--light-color);
  padding: 2rem;
  border-radius: var(--border-radius);
  max-height: 400px;
  overflow-y: auto;
}

.info-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.95rem;
  align-items: flex-start;
}

.info-label {
  font-weight: 700;
  color: var(--dark-color);
  min-width: 120px;
}

.info-value {
  color: var(--text-color);
}

.info-value a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

.info-value a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

/* ===================================
   Archive Page - Year Sections
   =================================== */
.year-section {
  margin-bottom: 4rem;
}

.year-title {
  font-size: 2rem;
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--secondary-color);
}

.schools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
}

.school-card {
  background-color: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid #ccc;
}

/* .school-card:hover styles removed to match masked zoom style */

.school-thumbnail {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  transition: transform 0.5s ease; /* Updated from var(--transition) to match img-zoom-wrapper */
}

.school-name {
  padding: 1rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  color: var(--dark-color);
}

.school-card:hover .school-thumbnail {
  transform: scale(1.05);
}

.school-card:hover .school-name {
  color: var(--primary-color);
}

/* ===================================
   Detail Page - Gallery
   =================================== */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
  cursor: pointer;
  aspect-ratio: 4/3;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.gallery-item:hover img {
  transform: scale(1.1);
}

.gallery-item::after {
  content: '🔍';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  opacity: 0;
  transition: var(--transition);
}

.gallery-item:hover::after {
  opacity: 1;
}

/* ===================================
   Video Section
   =================================== */
.videos {
  margin-top: 40px;
}

.videos-grid,
.videos-grid-dense,
.videos-scroll-container {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 1rem;
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.videos-grid .video-embed-container,
.videos-grid-dense .video-embed-container,
.videos-scroll-container .video-embed-container {
  flex: 0 0 calc(25% - 0.75rem);
  width: calc(25% - 0.75rem);
  scroll-snap-align: start;
}

@media (max-width: 1024px) {
  .videos-grid .video-embed-container,
  .videos-grid-dense .video-embed-container,
  .videos-scroll-container .video-embed-container {
    flex: 0 0 calc(50% - 0.5rem);
    width: calc(50% - 0.5rem);
  }
}

@media (max-width: 599px) { /* Smartphones usually below 600px */
  .videos-grid .video-embed-container,
  .videos-grid-dense .video-embed-container,
  .videos-scroll-container .video-embed-container {
    flex: 0 0 100%;
    width: 100%;
  }
}

.video-embed-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

/* ===================================
   Lightbox
   =================================== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}

.lightbox-content img,
.lightbox-content iframe {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--border-radius);
}

.lightbox-content iframe {
  width: 80vw;
  height: 45vw;
  max-width: 1200px;
  max-height: 675px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 3rem;
  color: var(--white);
  cursor: pointer;
  background: none;
  border: none;
  z-index: 10000;
  transition: var(--transition);
}

.lightbox-close:hover {
  transform: scale(1.2);
  color: var(--primary-color);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  color: var(--white);
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  padding: 1rem;
  border-radius: 0;
  transition: var(--transition);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* ===================================
   Footer
   =================================== */
/* Footer styles removed to use global css/style.css */

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1024px) {
  .container {
    padding: 1rem 1.5rem;
    margin: 20px auto;
  }

  .no-hero {
    margin-top: 110px !important; /* Increased to prevent header overlap on iPad Air/Mini */
  }


}

@media (max-width: 768px) {




  .container {
    margin: 0 auto;
  }

  .content-image-4-3 {
    width: 100%;
    margin: 2rem 0;
    border-radius: 0;
  }

  .section-title {
    font-size: 2rem;
  }

  .programs-grid {
    grid-template-columns: 1fr;
  }

  .schools-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }



  .videos {
    margin-top: 2rem;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  nav ul.dropdown-menu {
    position: static;
    box-shadow: none;
    background-color: transparent;
    padding: 0 0 0 1rem;
    width: 100%;
  }
  
  .dropdown:hover .dropdown-menu {
    display: flex;
  }

  .lightbox-content iframe {
    width: 90vw;
    height: 50.625vw;
  }

  .no-hero {
    margin-top: 110px !important; /* Increased to prevent header overlap on iPad Mini / Tablets */
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 0 1rem;
  }

  .container {
    margin: 0px auto;
    padding: 1rem 1rem;
  }

  .horizontal-scroll-container {
    padding: 0 1rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .hero {
    height: 300px; /* Match contest index mobile */
    margin-top: 70px;
  }

  /* Mobile Layout Adjustments */
  .workshop-explanation {
    padding: 1rem 1.5rem; /* Reduced top/bottom padding */
  }

  /* Specific Adjustments for Workshop Index Sections */
  #info.container {
    margin-top: 1rem; /* Reduced from 2rem */
    padding-top: 0;
  }
  
  .recommendation {
    padding: 1rem;
  }


  .horizontal-scroll-track {
    gap: 1.2rem; /* Reduced gap */
  }

  .program-card {
    min-width: 92vw; /* Wider cards */
    width: 90vw;
    margin-right: 0;
  }

  /* Adjust spacing for pages without hero */
  .no-hero {
    margin-top: 90px !important; /* Prevent header overlap on mobile */
  }
}

/* Desktop default for no-hero */
.no-hero {
  margin-top: 130px;
}

/* ===================================
   Animations
   =================================== */
.fade-in-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-up.active {
  opacity: 1;
  transform: translateY(0);
}

.mask-up {
  clip-path: inset(0 100% 0 0); /* Horizontal wipe? Or Vertical? User said "Mask Up" */
  /* Usually "Mask Up" means revealed from bottom up, so mask moves up. */
  /* Ideally: Image is hidden, and revealed upwards. */
  /* clip-path: inset(0 0 100% 0) -> inset(0 0 0 0) reveals from top? No. */
  /* inset(top right bottom left) */
  /* inset(100% 0 0 0) -> cuts 100% from top (invisible). Revealed by reducing to 0%. (Reveals from Bottom) */
  /* inset(0 0 100% 0) -> cuts 100% from bottom. Revealed by reducing to 0%. (Reveals from Top) */
  /* "Mask Up" -> Effect moves Up? Or Mask moves Up? */
  /* Usually implies content moves up or mask reveals upwards. */
  /* Let's try vertical reveal from bottom (inset(100% 0 0 0) -> inset(0 0 0 0) reveals from bottom?) */
  /* Wait: inset(100% 0 0 0) leaves 0 height at bottom? No. leaves 0 height at top? No. */
  /* inset(100% 0 0 0) clips everything from top edge downwards. Result is empty. */
  /* Transition to inset(0 ... ) reveals from bottom to top. */
  -webkit-clip-path: inset(100% 0 0 0);
  clip-path: inset(100% 0 0 0);
  /* Combine existing transform transition (var(--transition) = all 0.3s ease) with clip-path */
  transition: -webkit-clip-path 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), clip-path 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.3s ease;
  /* Make sure opacity is 1 if it defaults to something else, but img usually 1 */
}

.mask-up.active {
  -webkit-clip-path: inset(0 0 0 0);
  clip-path: inset(0 0 0 0);
}

/* ===================================
   Yubetsu Intro Section
   =================================== */
.intro-container {
  display: block; /* Ensure block layout */
  margin-bottom: 30px;
}

/* Clearfix */
.intro-container::after {
  content: "";
  display: table;
  clear: both;
}

.intro-text {
  /* No special styles needed for block layout */
  display: block;
}

/* Float Image Styling */
.intro-float-image {
  float: right;
  width: 60%; /* Or 55% as per user preference, trying 60% based on previous attempt */
  margin-left: 2rem; 
  margin-bottom: 1rem;
  /* Ensure aspect ratio stays correct */
  height: auto;
  aspect-ratio: 4/3;
  /* Ensure aspect ratio stays correct */
  height: auto;
  aspect-ratio: 4/3;
  /* object-fit: cover; removed as it applies to img */
  border-radius: var(--border-radius); 
  margin-top: -10px; /* Align with title text */
}

/* Float Image Styling (Left) */
.intro-float-image-left {
  float: left;
  width: 60%;
  margin-right: 2rem;
  margin-bottom: 1rem;
  height: auto;
  aspect-ratio: 4/3;
  /* object-fit: cover; */
  border-radius: var(--border-radius);
  margin-top: -10px;
}
/* Removed explicit hover transform on container, handled by .img-zoom-wrapper logic if used */

/* Adjustments for text */
.intro-text .section-title {
  font-size: 1.5rem;
  margin-top: 0;
  line-height: 1.2;
}

.intro-text .section-subtitle {
  font-size: 1.0rem;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .intro-container {
    display: block;
    padding-top: 0;
    margin-bottom: 16px;
  }

  .intro-text {
    display: flex;
    flex-direction: column;
  }

  .intro-float-image,
  .intro-float-image-left {
    order: 2;
    float: none;
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 0;
    margin-left: 0;
    margin-right: 0;
  }
  
  .intro-text .section-title,
  .intro-text .section-subtitle {
     margin-left: 0 !important;
     margin-right: 0 !important;
     text-align: left !important;
  }
}

/* ===================================
   Custom Layouts
   =================================== */
.left-float-images {
  float: left;
  width: 45%;
  margin-right: 2rem;
  margin-top: 0px; /* Aligned slightly up as requested */
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.left-float-images + p {
  padding-top: 0;
  margin-top: 0;
}

  /* Update selectors to target wrapper div or img inside */
  /* If wrapped, these styles apply to wrapper */
  /* width is calculated via flex */

.left-float-images .img-zoom-wrapper {
  flex: 0 0 calc(50% - 0.5rem);
  width: 0;
  min-width: 0;
  aspect-ratio: 4/3;
}

/* Reset basic tagging for imgs if they are not wrapped (legacy) OR if wrapped */
.left-float-images img {
  /* If wrapped, these are reset by img-zoom-wrapper img rule, but we keep basic safety */
  border-radius: var(--border-radius);
  object-fit: cover;
}

.right-float-images {
  float: right;
  width: 45%;
  margin-left: 2rem;
  margin-top: 5px;
  margin-bottom: 1rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.right-float-images + p {
  padding-top: 0;
  margin-top: 0;
}

.right-float-images .img-zoom-wrapper {
  flex: 0 0 calc(50% - 0.5rem);
  width: 0;
  min-width: 0;
  aspect-ratio: 4/3;
}

.steamfes-dual-images {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.steamfes-dual-images .intro-float-image-left,
.steamfes-dual-images .right-float-images {
  margin: 0;
  width: 48%; /* Adjust width for side-by-side on PC */
  float: none;
}

@media (max-width: 768px) {
  .left-float-images,
  .right-float-images {
    float: none;
    width: 100%;
    margin-right: 0;
    margin-left: 0;
    margin-bottom: 2rem;
  }
  
  .steamfes-dual-images {
    display: flex;
    flex-direction: column;
  }
  
  .steamfes-dual-images .intro-float-image-left {
    order: 1; /* Large image TOP */
    margin-top: 0;
    margin-bottom: 1rem;
    width: 100%;
  }
  
  .steamfes-dual-images .right-float-images {
    order: 2; /* Grid BOTTOM */
    margin-top: 0;
    width: 100%;
  }
}

.steamfes-middle-section {
  margin-top: 2rem;
}

@media (max-width: 1024px) {
  .steamfes-middle-section {
    margin-top: 2rem;
  }
}

@media (max-width: 768px) {
  .steamfes-middle-section {
    margin-top: 1.5rem;
  }
}

.workshop-subheading {
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 0.2rem;
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .steamfes-dual-images + p.workshop-subheading {
    margin-top: -1rem; /* Pull up to reduce gap */
  }
}

.intro-text .section-title {
  position: relative;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.intro-text .section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 120px; /* Doubled length */
  height: 1px;
  background-color: var(--primary-color);
}

@media (max-width: 768px) {
  .intro-text .section-title::after {
    left: 0;
    transform: none;
  }
}
