:root {
  /* Palette */
  --color-bg: #F5F5F7;
  --color-surface: #FFFFFF;
  --color-primary: #ff7828;
  --color-primary-hover: #ff8b4a; /* Darker shade for hover */
  --color-secondary: #FF2D55;
  --color-text: #1D1D1F;
  --color-text-light: #86868B;
  --color-border: #E5E5EA; /* Apple style border */
  
  /* Components */
  --border-radius-base: 10px;
  --shadow-card: 0 4px 8px rgba(0,0,0,0.08);
  --shadow-float: 0 8px 16px rgba(0,0,0,0.12);
  --navbar-blur: blur(20px); /* Slightly stronger blur for better effect */
  --navbar-height: 84px;
}

:root {
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-s: 12px;
  --space-m: 16px;
  --space-l: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --btn-height: 44px;
  --btn-height-sm: 32px;
  --btn-height-lg: 48px;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* Sticky Footer Layout */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  /* Ensure content starts below the fixed navbar */
  margin-top: var(--navbar-height);
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4, h5, h6, .uk-h1, .uk-h2, .uk-h3, .uk-h4, .uk-h5, .uk-h6 {
  color: var(--color-text);
  font-weight: 600;
  letter-spacing: -0.02em; /* Apple-style tight tracking */
}

/* Navbar */
.glass-navbar {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: var(--navbar-blur);
  -webkit-backdrop-filter: var(--navbar-blur);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.3s ease;
}

.uk-navbar-nav > li > a {
  color: var(--color-text);
  font-size: 15px;
  font-weight: 600;
  opacity: 0.88;
  transition: color 0.2s ease, opacity 0.2s ease;
  padding-left: var(--space-m);
  padding-right: var(--space-m);
}

.uk-navbar-nav > li > a:hover,
.uk-navbar-nav > li.uk-active > a {
  color: var(--color-primary);
  opacity: 1;
}

/* Buttons */
.uk-button {
  border-radius: var(--border-radius-base);
  font-weight: 600;
  text-transform: none;
  transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
  padding: 0 var(--space-l);
  line-height: var(--btn-height);
  font-size: 15px;
}
.uk-button-small { line-height: var(--btn-height-sm); padding: 0 var(--space-m); }
.uk-button-large { line-height: var(--btn-height-lg); padding: 0 var(--space-xl); }

.uk-button:active {
  transform: scale(0.96);
}

.uk-button-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  border: none;
}

.uk-button-primary:hover {
  background-color: var(--color-primary-hover);
}

.uk-button-secondary {
  background-color: var(--color-secondary);
  color: #ffffff;
  border: none;
}

.uk-button-default {
  background-color: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid rgba(255, 120, 40, 0.3);
}

.uk-button-default:hover {
  background-color: rgba(255, 120, 40, 0.08);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Cards */
.uk-card {
  border-radius: 18px; /* Slightly larger radius for cards */
}

.uk-card-default {
  background-color: var(--color-surface);
  box-shadow: var(--shadow-card);
  border: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.uk-card-default:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-float);
}

.uk-card-title {
  color: var(--color-text);
  font-weight: 600;
}

/* Text Colors */
.text-primary { color: var(--color-primary) !important; }
.text-secondary { color: var(--color-secondary) !important; }
.text-muted { color: var(--color-text-light) !important; }
.text-dark { color: var(--color-text) !important; }

/* Sections */
.section-muted {
  background-color: #F5F5F7;
}
.section-white {
  background-color: #FFFFFF;
}

.page-container {
  padding-top: 100px;
  padding-bottom: 60px;
  min-height: 80vh;
}

/* Animations */
.uk-transition-slide-bottom-small {
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.4s ease;
}

/* Utility Overrides */
.uk-text-lead {
  color: var(--color-text-light);
  font-weight: 400;
}

.uk-icon-button {
  transition: transform 0.1s ease;
}
.uk-icon-button:active {
  transform: scale(0.90);
}

/* Ensure primary icon buttons use brand colors and white icon */
.uk-icon-button.uk-button-primary { background-color: var(--color-primary) !important; border-color: var(--color-primary) !important; color: #fff !important; }
.uk-icon-button.uk-button-primary:hover { background-color: var(--color-primary-hover) !important; border-color: var(--color-primary-hover) !important; }
.uk-icon-button.uk-button-primary svg { stroke: #fff !important; fill: none !important; }
.uk-icon-button.uk-button-primary svg polyline, .uk-icon-button.uk-button-primary svg path { stroke: #fff !important; }
.uk-dotnav > * > * { width: 8px; height: 8px; border: 2px solid rgba(255,255,255,0.6); background: transparent; transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease; }
.uk-dotnav > .uk-active > * { background: #fff; border-color: #fff; transform: scale(1.2); }
.uk-dotnav > * > *:hover { border-color: #fff; }

/* Footer */
.footer-link {
  color: var(--color-text-light);
  transition: color 0.2s;
}
.footer-link:hover {
  color: var(--color-text);
  text-decoration: none;
}
.footer-link + .footer-link::before { content: "|"; margin: 0 8px; color: var(--color-text-light); pointer-events: none; }

/* Footer layout helpers */
.footer-icp-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.footer-icp-left { justify-self: start; }
.footer-icp-center { justify-self: center; }
.footer-icp-right { justify-self: end; }
.footer-icp-logo { display: inline-block; }
#footer > .uk-container::before, #footer > .uk-container::after { content: none !important; display: none !important; }
.footer-social { min-height: 36px; }
.footer-brandline { min-height: 32px; }
.footer-policy-nav { min-height: 24px; }
#footer .uk-icon-button { width: 36px; height: 36px; }
#footer .uk-icon-button [uk-icon] { width: 20px; height: 20px; display: inline-block; }
#footer .uk-icon-button + .uk-icon-button { margin-left: 8px; }

/* Home main bar styles */
/* Main Bar Styles */
#main_bar {
  position: relative;
  z-index: 1;
  margin-top: var(--space-m);
  margin-bottom: var(--space-xxl);
  height: auto !important;
  overflow: hidden; /* clip overflowing cover anchors when capped */
}

/* Fixed Dimension Square Card */
#main_bar .mainbar-card { 
  box-sizing: border-box;
  position: relative; 
  width: 440px;     /* Fixed width (Reduced from 500px) */
  height: 440px;    /* Fixed height = width for square */
  padding: 40px;    /* Reduced padding */
  border-radius: 0; /* Sharp corners */
  background-color: rgba(255, 255, 255, 0.65); 
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(24px); 
  -webkit-backdrop-filter: blur(24px);
  text-align: left; 
  color: var(--color-text); 
  z-index: 1; 
  opacity: 0;
  /* Flexbox for internal vertical alignment */
  display: flex;
  flex-direction: column;
  justify-content: center; /* Center content vertically */
  align-items: flex-start; /* Align content to left */
}

/* Animation triggers when slide is active */
#main_bar li.uk-active .mainbar-card {
  animation: cardEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 0.2s;
}

@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

#main_bar .hero-overlay { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.05) 100%); z-index: 0; }

/* Typography & Content Constraints */
#main_bar .mainbar-card-logo {
  margin-bottom: 24px;
  /* Square container for logo if needed, but user asked for logo IMG to be square */
}

#main_bar .mainbar-card-logo img { 
  width: 100px;      /* Fixed square size (Reduced from 120px) */
  height: 100px;     /* Fixed square size */
  object-fit: contain; /* Maintain aspect ratio inside square, or cover if strictly needed */
  display: block; 
  background: rgba(255,255,255,0.5); /* Optional: subtle bg for logo box */
  padding: 10px;     /* Padding inside logo box */
  border-radius: 0;  /* Sharp corners */
}

#main_bar .mainbar-card-title { 
  color: var(--color-text); 
  font-size: 40px;   /* Fixed large font (Reduced from 48px) */
  font-weight: 800; 
  line-height: 1.1; 
  margin-bottom: 16px;
  width: 100%;
  
  /* Single line truncation as per "don't show all words" */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#main_bar .mainbar-card-brief { 
  color: var(--color-text); 
  font-size: 18px;
  font-weight: 500; 
  opacity: 0.85; 
  line-height: 1.6; 
  margin-bottom: 32px;
  
  /* Limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#main_bar .mainbar-card-button { 
  margin-top: auto; /* Push to bottom if needed, or just margin */
}

/* Custom Bravo-style Button */
#main_bar .mainbar-card-button .uk-button {
  border-radius: 0;          /* Square button */
  background: transparent;   /* Transparent bg */
  color: var(--color-text);  /* Dark text */
  border: 2px solid var(--color-text); /* Dark border */
  padding: 0 32px;
  height: 48px;
  line-height: 44px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  transition: color 0.3s ease;
  box-shadow: none !important; /* Remove default shadow */
  z-index: 1;
}

/* Button Hover Fill Effect */
#main_bar .mainbar-card-button .uk-button::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--color-text);
  z-index: -1;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.7, 0, 0.3, 1);
}

#main_bar .mainbar-card-button .uk-button:hover {
  color: #fff; /* White text on hover */
  transform: none !important; /* Disable lift */
  box-shadow: none !important;
}

#main_bar .mainbar-card-button .uk-button:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

/* Responsive Adjustments */
@media (max-width: 960px) {
  #main_bar .mainbar-content-wrapper { padding: 0 !important; justify-content: center; }
  
  #main_bar .mainbar-card { 
    width: 80vw;     /* Reduced responsive width */
    height: 80vw;    /* Keep square aspect ratio */
    max-width: 340px; /* Reduced max width (was 400px) */
    max-height: 340px;
    padding: 24px;   /* Reduced padding */
    background-color: rgba(255, 255, 255, 0.85); 
  }
  
  #main_bar .mainbar-card-title { font-size: 28px; margin-bottom: 12px; }
  #main_bar .mainbar-card-brief { font-size: 15px; margin-bottom: 20px; -webkit-line-clamp: 2; }
  #main_bar .mainbar-card-logo { margin-bottom: 16px; }
  #main_bar .mainbar-card-logo img { width: 64px; height: 64px; }
  #main_bar .mainbar-card-button .uk-button { height: 40px; line-height: 36px; padding: 0 24px; font-size: 14px; }
}

@media (max-width: 640px) {
  #main_bar { height: auto !important; }
  #main_bar .mainbar-card { width: 85vw; height: 85vw; max-width: 320px; max-height: 320px; padding: 20px; }
}

/* Carousel Navigation Arrows - Updated per request */
#main_bar .uk-slidenav {
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  border: none;
  width: 64px; /* Larger hit area */
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  /* Remove backdrop filter and border as requested */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3); /* Shadow for visibility */
}

#main_bar .uk-slidenav:hover {
  color: #fff;
  transform: scale(1.1);
  background: transparent;
  box-shadow: none;
}

#main_bar .uk-slidenav svg {
  width: 40px; /* Much larger arrow */
  height: 40px;
  stroke-width: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); /* Shadow on the arrow itself */
}

#main_bar .uk-slidenav:active {
  transform: scale(0.95);
}

/* Ensure arrows are vertically centered and visible on mobile */
#main_bar [uk-slideshow-item="previous"],
#main_bar [uk-slideshow-item="next"] {
  top: 50%;
  transform: translateY(-50%);
  display: flex !important; /* Force show on mobile */
}

/* Override UIkit's default hiding on hover/mobile if necessary */
.uk-visible-toggle:not(:hover) .uk-slidenav {
  opacity: 0.7; /* Keep visible but dimmed when not hovering slideshow */
  display: flex !important;
}

/* Mobile specific adjustments */
@media (max-width: 640px) {
  #main_bar .uk-slidenav {
    width: 48px;
    height: 48px;
    padding: 0 10px;
  }
  #main_bar .uk-slidenav svg {
    width: 32px;
    height: 32px;
  }
}
.loading-spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #e5e5ea; border-top-color: var(--color-primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 400px) { #main_bar { height: auto !important; } }
@media (min-width: 1200px) { #main_bar { height: auto !important; } }

/* Responsive slideshow height caps to keep footer visible */
@media (max-width: 640px) {
  #main_bar { max-height: 65vh; min-height: 420px; }
}
@media (min-width: 641px) and (max-width: 960px) {
  #main_bar { max-height: 70vh; min-height: 500px; }
}
@media (min-width: 961px) and (max-width: 1200px) {
  #main_bar { max-height: 72vh; }
}
@media (min-width: 1201px) {
  #main_bar { max-height: 75vh; }
}

/* Make slides follow container height when capped */
#main_bar .uk-slideshow,
#main_bar .uk-slideshow-items,
#main_bar .uk-slideshow-items > li {
  height: 100% !important;
}
#footer .footer-brandline { display: grid !important; grid-template-columns: auto 1fr; align-items: center !important; column-gap: 8px; }
/* Keep slideshow dots above overlay and away from footer */
#main_bar .uk-slideshow-nav.uk-dotnav { position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--space-m); z-index: 1; }

/* Responsive adjustments for mainbar layout */
@media (max-width: 640px) {
  #main_bar .mainbar-card { max-width: 92vw; padding: 16px 20px; }
}
@media (min-width: 960px) {
  #main_bar .mainbar-card { margin-left: 8vw; }
}

/* Ensure footer sits above mainbar when overlapping at page bottom */
#footer { position: relative; z-index: 2; }
