/* ============================================
   CALIUS DIGITAL - Main Stylesheet
   High-Performance, Mobile-First Design
   ============================================ */

/* CSS Variables for Easy Customization */
:root {
  /* Colors - Updated to match Calius Digital brand */
  --primary-color: #06D6A0;
  /* Brand color (can be set by admin) */
  --brand-color: var(--primary-color);
  --brand-contrast: #0A0E27;
  --primary-dark: #0396A6;
  --primary-light: #06D6A0;
  --secondary-color: #FF6B35;
  --accent-color: #F7931E;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-dark: #111827;
  --border-color: #e5e7eb;
  --error-color: #ef4444;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  
  /* Typography */
  --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;
  
  /* Layout */
  --max-width: 1280px;
  --header-height: 70px;
  --footer-height: 300px;
  /* Blog card tuning (defaults can be overridden) */
  --blog-excerpt-lines: 2;
  --blog-image-height: 160px;
  --blog-image-height-mobile: 140px;
  --blog-thumb-border: 1px solid rgba(0,0,0,0.06);
  --blog-thumb-radius: 6px;
}

/* Accessibility helpers */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================
   Reset & Base Styles
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

strong, b {
  font-weight: 600;
}

/* ============================================
   Layout Components
   ============================================ */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.section {
  padding: var(--spacing-3xl) 0;
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto var(--spacing-2xl);
}

/* ============================================
   Header & Navigation
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  transition: all var(--transition-base);
}

.header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo img, .site-logo {
  height: 40px;
  width: auto;
  display: block;
}

.logo .logo-text {
  display: inline-block;
  font-weight: 700;
  color: var(--primary-color);
}

/* Reduce logo size on very small screens and optimize header */
@media (max-width: 480px) {
  .logo img, .site-logo { height: 28px; }
  /* Hide the text label to save space on tiny screens */
  .logo .logo-text { font-size: 1rem; display: none; }
  /* Show mobile toggle and hide full nav on very small screens */
  .mobile-menu-toggle { display: inline-block; }
  .nav-menu { display: none; }
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--spacing-lg);
}

.nav-link {
  color: var(--text-primary);
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: #778dd6;
  background-color: var(--bg-secondary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* language switcher styles removed (site now English-only) */

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

/* ============================================
   Hero Section
   ============================================ */

.hero {
  padding-top: calc(var(--header-height) + var(--spacing-3xl));
  padding-bottom: var(--spacing-3xl);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.6rem, 6vw, 3rem);
  color: white;
  margin-bottom: var(--spacing-lg);
}

.hero-subtitle {
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  color: rgba(255, 255, 255, 0.9);
  max-width: 700px;
  margin: 0 auto var(--spacing-xl);
}

.hero-cta {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background-color: white;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
  background-color: #778dd6;
  color: white;
}

.btn-outline {
  background-color: transparent;
  color: white;
  border: 2px solid white;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-outline:hover {
  background-color: rgba(255,255,255,0.95);
  color: #778dd6;
  border-color: rgba(255,255,255,0.95);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Accessible focus state for keyboard users */
.btn:focus-visible {
  outline: 3px solid rgba(37,99,235,0.18);
  outline-offset: 3px;
  border-radius: var(--radius-md);
}

/* ============================================
   WhatsApp Floating Action Button (FAB)
   Fixed bottom-left on all public pages
   ============================================ */
.whatsapp-fab {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 1200;
}
.whatsapp-fab a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background-color: #25D366; /* WhatsApp green */
  color: #ffffff;
  border-radius: 9999px;
  box-shadow: 0 6px 18px rgba(37,99,235,0.12);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}
.whatsapp-fab a:hover {
  transform: scale(1.12);
  box-shadow: 0 10px 22px rgba(37,99,235,0.16);
}
.whatsapp-fab a:active {
  transform: scale(0.96);
}
.whatsapp-fab svg {
  width: 22px;
  height: 22px;
  display: block;
}
.whatsapp-fab .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ============================================
   Home - Blog Card Styles
   Fixed image height, excerpt line-clamp, and hover
   ============================================ */
#home-latest-blogs .card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

#home-latest-blogs .card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
}

#home-latest-blogs .card-image {
  width: 100%;
  height: var(--blog-image-height); /* configurable fixed height for consistent layout */
  object-fit: cover;
  display: block;
  background: var(--bg-secondary);
}

#home-latest-blogs .card-body {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1 1 auto;
}

#home-latest-blogs .card-title {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin: 0;
}

#home-latest-blogs .card-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: var(--blog-excerpt-lines);
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#home-latest-blogs .card .btn {
  margin-top: auto; /* push CTA to bottom */
  align-self: flex-start;
}

@media (max-width: 768px) {
  #latest-blogs-grid { grid-template-columns: 1fr; }
  #home-latest-blogs .card-image { height: var(--blog-image-height-mobile); }
}

/* Optional small thumbnail border for blog images. Add the class `thumb-border` to the image element to enable. */
#home-latest-blogs .card-image.thumb-border {
  border: var(--blog-thumb-border);
  border-radius: var(--blog-thumb-radius);
}


.btn-lg {
  padding: var(--spacing-lg) var(--spacing-2xl);
  font-size: 1.125rem;
}

.btn-sm {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.875rem;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* Project card media wrapper + overlay for hero-like preview */
.project-card .card-media {
  position: relative;
  overflow: hidden;
}

.project-card .card-media .card-image {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 300ms ease;
}

.project-card:hover .card-media .card-image,
.project-card:focus-within .card-media .card-image {
  transform: scale(1.03);
}

.image-overlay { display: none; }

/* Bottom caption bar on project thumbnails */
/* Removed caption bar CSS now that captions are deleted */
/* .image-caption { display: none; } */
/* .image-caption { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.25) 30%, rgba(0,0,0,0.6) 100%); color: #fff; padding: 0.8rem 1rem; } */
/* .image-caption .caption-title { margin: 0; font-size: 1rem; font-weight: 700; text-shadow: 0 3px 12px rgba(0,0,0,0.6); } */
/* .image-caption .caption-sub { margin: 0.25rem 0 0; font-size: 0.85rem; color: rgba(255,255,255,0.92); } */

.card-media { position: relative; }

@media (max-width: 768px) {
  .project-card .card-media .card-image { height: 160px; }
  .overlay-title { font-size: 1rem; }
  .overlay-sub { font-size: 0.9rem; }
}

/* Feature card icon (centered and subtle fade-in) */
.card-icon {
  display: block;
  text-align: center;
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 360ms ease, transform 360ms ease;
}

/* Reveal on card hover, focus or when card has the fade-in utility */
.card:hover .card-icon,
.card:focus-within .card-icon,
.card.fade-in .card-icon {
  opacity: 1;
  transform: translateY(0);
}

/* Features grid: center title and excerpt and add subtle reveal */
.features-grid .card-title,
.features-grid .card-text {
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 360ms ease, transform 360ms ease;
}

.features-grid .card:hover .card-title,
.features-grid .card:focus-within .card-title,
.features-grid .card.fade-in .card-title,
.features-grid .card:hover .card-text,
.features-grid .card:focus-within .card-text,
.features-grid .card.fade-in .card-text {
  opacity: 1;
  transform: translateY(0);
}

.card-body {
  padding: var(--spacing-lg);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: var(--spacing-sm);
}

.card-text {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

.card-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

/* ============================================
   Grid System
   ============================================ */

.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   Forms
   ============================================ */

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-primary);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* ============================================
   Footer
   ============================================ */

.footer {
  background-color: var(--bg-dark);
  color: white;
  padding: var(--spacing-3xl) 0 var(--spacing-lg);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-2xl);
  margin-bottom: var(--spacing-2xl);
}

.footer-section h3 {
  color: white;
  margin-bottom: var(--spacing-md);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--spacing-sm);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: white;
}

.footer-bottom {
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   Utility Classes
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.hidden { display: none; }
.visible { display: block; }

/* ============================================
   Loading & Animations
   ============================================ */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.fade-in {
  animation: fadeIn var(--transition-base);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  .hero-title { font-size: 2rem; }
  
  .nav-menu {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .nav-menu.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
  }
  
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .section {
    padding: var(--spacing-2xl) 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .btn {
    width: 100%;
  }
  
  .hero-cta {
    flex-direction: column;
  }

  /* Templates - mobile optimizations */
  #templates-grid {
    gap: var(--spacing-md);
  }

  @media (min-width: 1024px) {
    .filters-container { gap: var(--spacing-lg); }
    .filters-section { padding: calc(var(--spacing-lg) * 1.25) 0; }
    .grid-3 { gap: var(--spacing-2xl); }
  }

  .template-card {
    width: 100%;
    box-shadow: var(--shadow-sm);
    display: block;
  }

  .template-image {
    height: 160px;
  }

  .template-content {
    padding: var(--spacing-md);
  }

  .template-title { font-size: 1.125rem; }
  .template-description { -webkit-line-clamp: 3; font-size: 0.9rem; }

  .template-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .template-actions { width: 100%; display: flex; gap: var(--spacing-sm); }
  .template-actions .btn { flex: 1; }

  /* Filters stack on small screens */
  .filters-container { flex-direction: column; align-items: stretch; gap: var(--spacing-md); }
  .filters-container .filter-group { width: 100%; display: flex; gap: var(--spacing-sm); flex-wrap: wrap; }
  .filter-btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* smaller badges on very small screens */
  .badge { top: var(--spacing-sm); right: var(--spacing-sm); font-size: 0.65rem; padding: 0.2rem 0.5rem; }
}

@media (max-width: 360px) {
  .template-image { height: 140px; }
  .template-title { font-size: 1rem; }
  .filters-container { gap: var(--spacing-sm); }
}

/* Fine-tuning for common device widths */
@media (min-width: 361px) and (max-width: 399px) {
  .template-title { font-size: 1.02rem; }
  .template-description { font-size: 0.9rem; }
  .template-image { height: 150px; }
}

@media (min-width: 400px) and (max-width: 479px) {
  .template-title { font-size: 1.08rem; }
  .template-description { font-size: 0.92rem; }
  .template-image { height: 160px; }
  .filters-section { padding: var(--spacing-sm) 0; }
}

@media (min-width: 480px) and (max-width: 599px) {
  .template-title { font-size: 1.12rem; }
  .template-description { font-size: 0.94rem; }
  .template-image { height: 180px; }
  .container { padding: 0 var(--spacing-md); }
}

@media (min-width: 600px) and (max-width: 767px) {
  .template-title { font-size: 1.14rem; }
  .template-description { font-size: 0.96rem; }
  .template-image { height: 210px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .template-title { font-size: 1.2rem; }
  .template-description { font-size: 0.98rem; }
  .template-image { height: 240px; }
  .filters-container { gap: var(--spacing-md); }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .header,
  .footer,
  .btn,
  .mobile-menu-toggle {
    display: none;
  }
}
