/* ========================================
   Visual Enhancement CSS - Make website more professional and cool
   ======================================== */

/* ========================================
   0. PDF Page Full Screen Layout - About, Service, Film Fund (Exclude Fund, Contact)
   ======================================== */

/* Add 100vh full screen layout for About, Service, Film Fund pages (Exclude Home, all Fund pages, Contact) */
body:has(.pdf-section):not(:has(.home-hero)):not(:has(.fund-scenario)):not(:has(.fund-basic-premium)):not(:has(.fund-page9)):not(:has(.fund-metro)):not(:has(.fund-urban)):not(:has(.fund-final-icons)):not(:has(.contact-section)) {
  height: 100vh;
  overflow-y: hidden; /* Disable vertical scrolling */
  overflow-x: hidden; /* Disable horizontal scrolling - fix mobile horizontal scrollbar issue */
  display: flex;
  flex-direction: column;
}

body:has(.pdf-section):not(:has(.home-hero)):not(:has(.fund-scenario)):not(:has(.fund-basic-premium)):not(:has(.fund-page9)):not(:has(.fund-metro)):not(:has(.fund-urban)):not(:has(.fund-final-icons)):not(:has(.contact-section)) main {
  flex: 1; /* main occupies remaining space (between header and footer) */
  overflow: hidden; /* Disable both vertical and horizontal scrolling */
  display: flex;
  flex-direction: column;
}

body:has(.pdf-section):not(:has(.home-hero)):not(:has(.fund-scenario)):not(:has(.fund-basic-premium)):not(:has(.fund-page9)):not(:has(.fund-metro)):not(:has(.fund-urban)):not(:has(.fund-final-icons)):not(:has(.contact-section)) .pdf-section {
  height: 100%; /* Fill 100% of main's height */
  flex: 1;
  min-height: auto; /* Override min-height in base.css */
  aspect-ratio: auto !important; /* Cancel fixed aspect ratio, fill container instead */
  overflow: hidden; /* Prevent content overflow causing scrollbar */
}

/* ========================================
   1. Fund Page - Tab Card Switching Style
   ======================================== */

/* Tab wrapper - relative positioning container */
.fund-tab-wrapper {
  position: relative;
  width: 100%;
  min-height: 100vh; /* Use viewport height, ensure background is high enough */
  overflow: visible; /* Change to visible, allow content to expand naturally */
  background: #000; /* Fallback background color */
}

/* Background layer - fixed, but height adapts to content */
.fund-postcode-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 100%; /* At least 100% height */
  z-index: 1;
}

.fund-postcode-bg .postcode-bg-desktop,
.fund-postcode-bg .postcode-bg-mobile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Desktop shows desktop background */
.fund-postcode-bg .postcode-bg-desktop {
  display: block;
}

.fund-postcode-bg .postcode-bg-mobile {
  display: none;
}

/* Mobile shows mobile background */
@media (max-width: 900px) {
  .fund-postcode-bg .postcode-bg-desktop {
    display: none;
  }

  .fund-postcode-bg .postcode-bg-mobile {
    display: block;
  }
}

/* Unified title - floats above background */
.fund-postcode-title {
  position: relative;
  z-index: 10;
  text-align: center;
  color: #fff;
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: 300;
  letter-spacing: 0.02em;
  padding: 40px 20px 20px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* Tab navigation bar - card style (floats above background) */
.fund-tab-nav {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto 40px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tab button - clean text style */
.fund-tab-btn {
  flex: 1;
  padding: 14px 28px;
  font-size: clamp(14px, 1.4vw, 18px);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  font-family: "Zalando Sans Expanded", Arial, sans-serif;
}

/* Hover effect */
.fund-tab-btn:hover {
  color: #fff;
  background: rgba(124, 195, 255, 0.1);
  transform: translateY(-2px);
}

/* Active state - card highlight */
.fund-tab-btn.active {
  background: linear-gradient(135deg, #7cc3ff 0%, #5aa3e0 100%);
  color: #000;
  font-weight: 600;
  box-shadow:
    0 4px 20px rgba(124, 195, 255, 0.4),
    0 0 40px rgba(124, 195, 255, 0.2);
}

/* Tab content container (floats above background) */
.fund-tab-content {
  position: relative;
  z-index: 5;
  min-height: 600px;
  padding: 20px;
  overflow: visible; /* Changed to visible, no height restriction */
}

/* Tab content panel - overlapping display, instant switching */
.fund-tab-pane {
  display: none;
  width: 100%;
}

/* Active tab - instant display, no fade in/out */
.fund-tab-pane.active {
  display: block;
}

/* Desktop and mobile content switching */
.fund-tab-pane .desktop-content {
  display: block; /* Show on desktop */
}

.fund-tab-pane .mobile-content {
  display: none; /* Hide on desktop */
}

@media (max-width: 900px) {
  .fund-tab-pane .desktop-content {
    display: none; /* Hide on mobile */
  }

  .fund-tab-pane .mobile-content {
    display: block; /* Show on mobile */
  }
}

/* Ensure internal overlay styles work properly */
.fund-tab-pane .metro-desktop-layer,
.fund-tab-pane .metro-mobile-overlay,
.fund-tab-pane .urban-desktop-layer,
.fund-tab-pane .urban-mobile-overlay {
  position: relative;
  overflow: visible; /* Remove max-height restriction */
}

/* Desktop table container - restrict height */
.fund-tab-pane .metro-table-container,
.fund-tab-pane .urban-table-container {
  max-width: 90%;
  margin: 3vh auto;
}

/* Desktop table style maintains original */
.fund-tab-pane .metro-table,
.fund-tab-pane .urban-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.24);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  font-size: clamp(10px, 1vw, 16px);
  color: #fff;
}

.fund-tab-pane .metro-table th,
.fund-tab-pane .metro-table td,
.fund-tab-pane .urban-table th,
.fund-tab-pane .urban-table td {
  border: 1px solid rgba(255,255,255,0.5);
  padding: clamp(8px, 1.2vw, 16px);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

/* Metro table City and State columns prevent line breaks (desktop) */
.fund-tab-pane .metro-table th:nth-child(1),
.fund-tab-pane .metro-table td:nth-child(1),
.fund-tab-pane .metro-table th:nth-child(2),
.fund-tab-pane .metro-table td:nth-child(2) {
  white-space: nowrap;
}

/* Mobile tab styles */
@media (max-width: 900px) {
  .fund-tab-wrapper {
    min-height: 100vh; /* Use viewport height */
  }

  .fund-postcode-title {
    font-size: clamp(18px, 5vw, 26px);
    padding: 30px 15px 15px;
  }

  .fund-tab-nav {
    flex-direction: row;
    gap: 12px;
    padding: 8px;
    max-width: 90%;
  }

  .fund-tab-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: clamp(13px, 3.5vw, 16px);
  }

  .fund-tab-content {
    min-height: 900px;
    padding: 10px;
    overflow: visible; /* Changed to visible, remove scrollbar */
  }

  /* Mobile table - restore original style (column width auto) */
  .fund-tab-pane .metro-mobile-table-wrapper,
  .fund-tab-pane .urban-mobile-table-wrapper {
    width: 92%;
    margin: 0 auto;
    overflow-x: auto; /* Allow horizontal scrolling */
    -webkit-overflow-scrolling: touch;
  }

  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table,
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: clamp(11px, 2vw, 14px) !important;
    border-collapse: collapse;
    background: rgba(255,255,255,0.22);
    backdrop-filter: blur(3px);
    color: #fff;
  }

  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table th,
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table td,
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table th,
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table td {
    padding: 1.6vw !important;
    white-space: normal !important;
    word-break: break-word !important;
    vertical-align: top;
    border: 1px solid rgba(255,255,255,0.5);
  }

  /* Metro table column widths - adjust City and State column widths */
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table th:nth-child(1),
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table td:nth-child(1) {
    width: 18% !important;
    white-space: nowrap !important; /* Prevent city name line breaks */
  }
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table th:nth-child(2),
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table td:nth-child(2) {
    width: 12% !important;
    white-space: nowrap !important; /* Prevent state name line breaks */
  }
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table th:nth-child(3),
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table td:nth-child(3) {
    width: 30% !important;
  }
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table th:nth-child(4),
  .fund-tab-pane .metro-mobile-table-wrapper table.metro-table td:nth-child(4) {
    width: 40% !important;
  }

  /* Urban table column widths - auto-adapt to content */
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table th:nth-child(1),
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table td:nth-child(1) {
    width: 30% !important;
  }
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table th:nth-child(2),
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table td:nth-child(2) {
    width: 25% !important;
  }
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table th:nth-child(3),
  .fund-tab-pane .urban-mobile-table-wrapper table.urban-table td:nth-child(3) {
    width: 45% !important;
  }

  /* Mobile title and note styles */
  .fund-tab-pane .metro-mobile-title,
  .fund-tab-pane .urban-mobile-title {
    text-align: left;
    width: 92%;
    margin: 0 auto 3vw;
    color: #fff;
    font-weight: 300;
    line-height: 1.35;
    font-size: clamp(14px, 2.5vw, 18px) !important;
  }

  .fund-tab-pane .metro-mobile-note,
  .fund-tab-pane .urban-mobile-note {
    width: 92%;
    margin: 3vw auto 0;
    text-align: left;
    color: #fff;
    font-size: clamp(10px, 2.4vw, 12px) !important;
    opacity: 0.8;
    padding-bottom: 4vw;
  }
}

/* ========================================
   2. Card hover effect - scale + glow
   ======================================== */
.hover-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

/* Glow effect - using pseudo-element */
.hover-card::after {
  content: '';
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle at center, rgba(124, 195, 255, 0.3), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: -1;
  filter: blur(20px);
}

.hover-card:hover {
  transform: scale(1.05) translateY(-8px);
  z-index: 10;
}

.hover-card:hover::after {
  opacity: 1;
}

/* About page text card special handling */
.about-section .col.hover-card {
  background: rgba(255, 255, 255, 0.05);
  padding: 24px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.about-section .col.hover-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(124, 195, 255, 0.4);
  box-shadow: 0 8px 32px rgba(124, 195, 255, 0.2);
}

/* Funding Scenario 卡片 */
.fs-cards img.hover-card:hover {
  box-shadow: 0 20px 60px rgba(124, 195, 255, 0.4);
}

/* Fund Basic/Premium 卡片 */
.fbp-card.hover-card,
.fp9-card.hover-card {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.fbp-card.hover-card:hover,
.fp9-card.hover-card:hover {
  box-shadow: 0 12px 40px rgba(124, 195, 255, 0.3);
}

/* Office location card */
.office-card.hover-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.office-card.hover-card:hover {
  transform: scale(1.08) translateY(-10px);
}

.office-card.hover-card::after {
  background: radial-gradient(circle at center, rgba(124, 195, 255, 0.4), transparent 60%);
}

/* Final Icons card */
.ffi-card.hover-card:hover {
  transform: scale(1.1) translateY(-10px);
}

/* ========================================
   3. Scroll animation enhancement
   ======================================== */
/* Already implemented via JavaScript in main.js */

/* ========================================
   4. General transition animation optimization
   ======================================== */
/* Smooth transition effects */
* {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Navigation link enhancement */
.nav a {
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav a::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #7cc3ff, #5aa3e0);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav a:hover::before,
.nav a.active::before {
  width: 100%;
}

/* Button hover effect */
.btn,
.btn-submit {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn::before,
.btn-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover,
.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 195, 255, 0.4);
}

.btn:hover::before,
.btn-submit:hover::before {
  opacity: 1;
}

/* ========================================
   5. Page load animation
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ========================================
   6. Table style enhancement
   ======================================== */
.metro-table tbody tr,
.urban-table tbody tr {
  transition: all 0.3s ease;
}

.metro-table tbody tr:hover,
.urban-table tbody tr:hover {
  background: rgba(124, 195, 255, 0.1);
  transform: translateX(4px);
}

/* ========================================
   7. Mobile optimization
   ======================================== */
@media (max-width: 900px) {
  /* Reduce hover effects on mobile to avoid touch issues */
  .hover-card:hover {
    transform: scale(1.02) translateY(-4px);
  }

  /* Mobile buttons */
  .btn:hover,
  .btn-submit:hover {
    transform: translateY(-1px);
  }
}

/* ========================================
   8. Performance optimization - GPU acceleration
   ======================================== */
.hover-card,
.fund-tab,
.btn,
.btn-submit {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ========================================
   9. Accessibility - focus state
   ======================================== */
.fund-tab:focus,
.btn:focus,
.btn-submit:focus {
  outline: 2px solid #7cc3ff;
  outline-offset: 2px;
}

/* Reduce animations (respect user preference) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   10. About page text card fade-in animation
   ======================================== */

/* About page three text cards */
.about-section .col,
body:has(.pdf-section:not(.service-section):not(.film-fund)) .cols .col {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(30px);
  animation: textFadeInFocus 1.2s ease-out forwards;
}

/* Three cards fade in sequentially (staggered delay) */
.cols .col:nth-child(1) {
  animation-delay: 0.3s;
}

.cols .col:nth-child(2) {
  animation-delay: 0.6s;
}

.cols .col:nth-child(3) {
  animation-delay: 0.9s;
}

/* Text fade-in animation - blur to clear + rise up */
@keyframes textFadeInFocus {
  0% {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
    transform: translateY(0);
  }
}

/* Mobile optimization - faster fade-in */
@media (max-width: 768px) {
  .cols .col {
    animation-duration: 0.9s;
  }

  .cols .col:nth-child(1) {
    animation-delay: 0.2s;
  }

  .cols .col:nth-child(2) {
    animation-delay: 0.4s;
  }

  .cols .col:nth-child(3) {
    animation-delay: 0.6s;
  }
}

/* ========================================
   11. About & Film Fund page background animation
   ======================================== */

/* About page background - focus only, no scaling (single playback) */
/* Exclude all .pdf-section with additional class names */
.pdf-section:not(.contact-section):not(.service-section):not(.film-fund):not(.fund-scenario):not(.fund-basic-premium):not(.fund-page9):not(.fund-metro):not(.fund-urban):not(.fund-final-icons) .bg {
  position: absolute;
  inset: 0;
  width: 105% !important;  /* Reduce space, only need focus effect */
  height: 105% !important;
  top: -2.5% !important;
  left: -2.5% !important;
  object-fit: cover;
  animation: pageFocusOnly 3s ease-out 0s 1 normal forwards;
}

/* Film Fund page background - focus only, no scaling (single playback) */
.film-fund .bg,
.film-fund .ff-bg-desktop {
  position: absolute;
  width: 105% !important;  /* Reduce space, only need focus effect */
  height: 105% !important;
  top: -2.5% !important;
  left: -2.5% !important;
  object-fit: cover;
  animation: pageFocusOnly 3s ease-out 0s 1 normal forwards;
}

/* Film Fund mobile background - fluid layout, animation only */
.film-fund .ff-bg-mobile {
  /* Maintain film.css display: block fluid layout */
  animation: pageFocusOnly 3s ease-out 0s 1 normal forwards;
}

/* Page focus animation - focus only, no scaling */
@keyframes pageFocusOnly {
  0% {
    filter: blur(20px);      /* Heavy blur */
    transform: scale(1.05);  /* Slightly enlarged */
  }
  100% {
    filter: blur(0px);       /* Completely clear */
    transform: scale(1);     /* Restore original size, no more scaling */
  }
}

/* Mobile optimization - About page */
@media (max-width: 768px) {
  .pdf-section:not(.contact-section):not(.service-section):not(.film-fund):not(.fund-scenario):not(.fund-basic-premium):not(.fund-page9):not(.fund-metro):not(.fund-urban):not(.fund-final-icons) .bg {
    width: 105% !important;
    height: 105% !important;
    top: -2.5% !important;
    left: -2.5% !important;
    animation: pageFocusOnlyMobile 2.5s ease-out 0s 1 normal forwards;
  }
}

/* Film Fund mobile optimization - 900px breakpoint */
@media (max-width: 900px) {
  /* Film Fund desktop background hidden below 900px, no animation needed */
  .film-fund .ff-bg-desktop {
    animation: none;
  }

  /* Film Fund mobile background - animation only, maintain fluid layout */
  .film-fund .ff-bg-mobile {
    animation: pageFocusOnlyMobile 2.5s ease-out 0s 1 normal forwards;
  }

  /* Mobile focus animation - focus only, no scaling */
  @keyframes pageFocusOnlyMobile {
    0% {
      filter: blur(15px);      /* Reduced blur level */
      transform: scale(1.05);
    }
    100% {
      filter: blur(0px);       /* Completely clear */
      transform: scale(1);     /* Restore original size, no more scaling */
    }
  }
}
