/* Saint of the Day Section Styles - Modern Card Edition (Compact Version) */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lato:wght@300;400;700&display=swap');

:root {
  /* Original Palette - Keeping for consistency with global styles */
  --primary-color: #2A3F3F; /* Dark Teal */
  --primary-dark: #1F2E2E; /* Darker shade */
  --accent-color: #C9A053; /* Antique Gold */
  --accent-glow: rgba(201, 160, 83, 0.3); /* Antique Gold glow */
  --accent-dark: #A88743; /* Darker shade */
  --secondary-color: #8B3A3A; /* Rust Red */
  --text-light: #FFFFF0; /* Ivory White */
  --text-dark: #333F48; /* Charcoal Grey (Will use this inside the card) */
  --bg-dark: #2A3F3F; /* Dark Teal (For the main section background) */
  --card-bg-light: rgba(42, 63, 63, 0.8); /* Dark Teal with opacity (Original card bg - NOT USED FOR MODERN) */

  /* NEW: Modern Card Specific Variables */
  --modern-card-bg: rgba(25, 35, 35, 0.7); /* Dark, slightly transparent bg */
  --modern-card-bg-opaque: rgb(25, 35, 35); /* Opaque version */
  --modern-card-border: rgba(201, 160, 83, 0.3); /* Subtle gold border */
  --modern-text-primary: #EAEAEA; /* Light grey for primary text on card */
  --modern-text-secondary: rgba(234, 234, 234, 0.7); /* Lighter grey for secondary text */
  --modern-glow-focus: 0 0 0 3px rgba(201, 160, 83, 0.5); /* Gold focus ring */

  /* Dimensions & Transitions */
  --radius-md: 12px; /* Slightly reduced radius */
  --transition-normal: 0.3s ease;
  --transition-fast: 0.2s ease;

  /* Fonts */
  --font-primary: 'Cinzel', Georgia, serif;
  --font-body: 'Lato', Arial, sans-serif; /* Clean sans-serif */

  /* Effects */
  --modern-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
  --modern-hover-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

/* --- Original Background Styles (Reduced Height) --- */
.saint-of-the-day {
  position: relative;
  padding: 3rem 0; /* Increased padding for better spacing */
  color: var(--text-light); /* Ivory White for section text */
  background-color: var(--bg-dark); /* Dark Teal */
  text-align: center;
  overflow: hidden;
  min-height: 0; /* Remove minimum height constraint to adapt to content */
  display: flex; /* Use flexbox for alignment */
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.starry-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.stars-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Simplified star background */
.stars-small {
  background-image: radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 240, 0.7), transparent),
                    radial-gradient(1px 1px at 70% 20%, rgba(255, 255, 240, 0.5), transparent),
                    radial-gradient(1px 1px at 90% 80%, rgba(255, 255, 240, 0.7), transparent);
  background-size: 550px 550px;
}

.stars-medium {
  background-image: radial-gradient(1.5px 1.5px at 15% 15%, rgba(255, 255, 240, 0.8), transparent),
                    radial-gradient(1.5px 1.5px at 75% 35%, rgba(255, 255, 240, 0.8), transparent);
  background-size: 800px 800px;
}

.cosmic-glow {
  position: absolute;
  top: 50%;
  left: 20%;
  width: 60%;
  height: 200px; /* Reduced height */
  background: radial-gradient(ellipse at center, rgba(112, 128, 144, 0.2) 0%, transparent 70%);
  transform: translateY(-50%);
  filter: blur(40px);
  z-index: 0;
}

.container {
  position: relative;
  max-width: 950px; /* Increased width for better proportions */
  width: 90%;
  margin: 0 auto;
  padding: 0 15px; /* Reduced padding */
  z-index: 1;
}

/* Section Title Styling (Reduced size) */
.section-title {
  font-family: var(--font-primary);
  font-size: clamp(1.8rem, 4vw, 2.5rem); /* Reduced size */
  color: var(--text-light);
  margin-bottom: 0.5rem; /* Reduced margin */
  text-transform: uppercase;
  letter-spacing: 1px; /* Reduced letter spacing */
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.section-description {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 1.5vw, 1.1rem); /* Reduced size */
  line-height: 1.5;
  color: rgba(255, 255, 240, 0.8);
  max-width: 600px; /* Reduced width */
  margin: 0 auto 1.5rem; /* Reduced margin */
}

/* Saint Feature Container */
.saint-feature {
  max-width: 850px; /* Increased for better content proportions */
  margin: 0 auto;
}

/* --- Modern Saint Card Styling (Compact) --- */
.saint-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--modern-shadow);
  background-color: var(--modern-card-bg);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  border: 1px solid var(--modern-card-border);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
}

.saint-card:hover {
  transform: translateY(-5px); /* Reduced lift */
  box-shadow: var(--modern-hover-shadow);
}

.saint-card-inner {
  display: grid;
  grid-template-columns: 40% 1fr; /* Better balanced ratio (was 35%) */
  gap: 0;
  min-height: 475px; /* Set minimum height to prevent squished appearance */
}

/* Feast Day Badge */
.feast-badge {
  display: inline-block;
  background: linear-gradient(45deg, var(--accent-color), var(--accent-dark));
  color: var(--primary-dark);
  padding: 0.3rem 0.8rem; /* Reduced padding */
  border-radius: 15px;
  font-size: 0.75rem; /* Reduced font size */
  font-weight: 700;
  letter-spacing: 0.5px;
  position: absolute;
  top: 0.75rem; /* Repositioned to top right */
  right: 1.5rem; /* Position on top right for better balance */
  left: auto; /* Remove left positioning */
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

.saint-card:hover .feast-badge {
  transform: translateY(-2px);
}

/* Saint Visual (Image) Section */
.saint-visual {
  padding: 0;
  display: flex;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--modern-card-border);
  aspect-ratio: 3/4; /* Better aspect ratio for typical saint images */
  min-height: 100%; /* Fill the full height of the container */
}

.saint-image-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.saint-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%; /* Better framing for Saint faces */
  display: block;
  transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.3s ease;
  filter: brightness(1) saturate(1);
}

.saint-card:hover .saint-image-container img {
  transform: scale(1.05);
  filter: brightness(1.05) saturate(1.1);
}

/* Optional: Subtle gradient overlay on image bottom */
.saint-visual::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30%;
  background: linear-gradient(to top, var(--modern-card-bg-opaque) 0%, transparent 100%);
  pointer-events: none;
  opacity: 0.6;
  transition: opacity var(--transition-normal);
}

.saint-card:hover .saint-visual::after {
  opacity: 0.4;
}

/* Saint Details Section */
.saint-details {
  padding: 1.75rem 1.5rem; /* Increased padding for better content spacing */
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* This ensures content is spaced throughout the container */
  color: var(--modern-text-primary);
  text-align: left;
  position: relative;
  height: 100%; /* Fill the container height */
}

/* Added structured content sections for better organization */
.saint-info-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.saint-content-mid {
  flex-grow: 1; /* Take up available space */
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

/* Saint Title */
.saint-title {
  font-family: var(--font-primary);
  font-size: clamp(1.4rem, 3vw, 1.8rem); /* Reduced size */
  color: var(--modern-text-primary);
  margin: 0 0 0.75rem 0; /* Reduced margin */
  padding-top: 1rem; /* Reduced padding */
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Saint Metadata */
.saint-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); /* Reduced size */
  gap: 0.5rem; /* Reduced gap */
  margin-bottom: 1rem; /* Reduced margin */
  padding-bottom: 1rem; /* Reduced padding */
  border-bottom: 1px solid var(--modern-card-border);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* Reduced gap */
  font-size: clamp(0.75rem, 1vw, 0.85rem); /* Reduced size */
  color: var(--modern-text-secondary);
}

.meta-item i {
  color: var(--accent-color);
  font-size: 1em; /* Reduced relative size */
  width: 16px; /* Reduced width */
  text-align: center;
  flex-shrink: 0;
}

/* Saint Quote */
.saint-quote {
  margin-bottom: 1rem; /* Reduced margin */
  padding-left: 0.75rem; /* Reduced padding */
  border-left: 2px solid var(--accent-color); /* Thinner border */
  position: relative;
}

.saint-quote blockquote {
  font-style: italic;
  color: var(--modern-text-secondary);
  font-size: clamp(0.85rem, 1.2vw, 0.95rem); /* Reduced size */
  line-height: 1.5;
  margin: 0;
  font-weight: 300;
}

/* Saint Description */
.saint-description {
  margin-bottom: 1rem; /* Reduced margin */
  color: var(--modern-text-primary);
  line-height: 1.5;
  font-size: clamp(0.85rem, 1.2vw, 0.95rem); /* Reduced size */
  font-weight: 400;
  /* Set min-height to ensure consistent spacing */
  min-height: 4.5rem; 
  max-height: 9rem; /* Limit height for very long descriptions */
  overflow-y: auto; /* Add scrolling if content exceeds max height */
}

/* Saint Categories */
.saint-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem; /* Reduced gap */
  margin-bottom: 1rem; /* Reduced margin */
}

.category-tag {
  background-color: rgba(201, 160, 83, 0.15);
  color: #FFFFFF;
  padding: 0.2rem 0.6rem; /* Reduced padding */
  border-radius: 12px; /* Reduced radius */
  font-size: 0.7rem; /* Reduced size */
  font-weight: 600;
  border: 1px solid rgba(201, 160, 83, 0.3);
  transition: all var(--transition-fast);
}

.category-tag:hover {
  background-color: rgba(201, 160, 83, 0.3);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

/* Action Buttons */
.saint-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* Reduced gap */
  margin-top: auto; /* Push to bottom of flex container */
  padding-top: 1rem; /* Reduced padding */
  border-top: 1px solid var(--modern-card-border);
}

.saint-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem; /* Reduced gap */
  background-color: var(--secondary-color);
  color: var(--text-light);
  padding: 0.5rem 1rem; /* Reduced padding */
  border-radius: 20px; /* Reduced radius */
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px rgba(139, 58, 58, 0.3); /* Reduced shadow */
  font-size: 0.8rem; /* Reduced size */
  border: 1px solid transparent;
  flex-grow: 1;
  text-align: center;
}

.saint-link:hover,
.saint-link:focus-visible {
  background-color: var(--accent-color);
  color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(201, 160, 83, 0.4); /* Reduced shadow */
  outline: none;
}

.saint-link:focus-visible {
  box-shadow: var(--modern-glow-focus), 0 4px 12px rgba(201, 160, 83, 0.4);
}

.saint-link i {
  transition: transform var(--transition-normal);
  font-size: 1.1em;
}

.saint-link:hover i {
  transform: translateX(3px);
}

.follow-saint {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px; /* Reduced size */
  height: 34px; /* Reduced size */
  background-color: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 0.9rem; /* Reduced size */
  flex-shrink: 0;
}

.follow-saint:hover,
.follow-saint:focus-visible {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--primary-dark);
  transform: scale(1.1);
  outline: none;
}

.follow-saint:focus-visible {
  box-shadow: var(--modern-glow-focus);
}

.follow-saint.followed {
  background-color: var(--accent-dark);
  color: var(--text-light);
  border-color: var(--accent-dark);
}

.follow-saint.followed:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: var(--primary-dark);
}

/* Loading State - FIXED: Never block button interactions */
.saint-feature.loading {
  min-height: 300px; /* Reduced height */
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.saint-feature.loading .saint-card {
  /* FIXED: Ensure buttons remain clickable */
  pointer-events: auto;
  opacity: 1;
}

/* FIXED: Ensure all buttons are always clickable */
.saint-feature.loading .saint-actions,
.saint-feature.loading .saint-link,
.saint-feature.loading .follow-saint,
.saint-feature.loading button,
.saint-feature.loading a {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.saint-feature.loading::after {
  content: '';
  display: block;
  position: absolute;
  width: 40px; /* Reduced size */
  height: 40px; /* Reduced size */
  border: 3px solid var(--accent-glow); /* Thinner border */
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Today's Note */
.todays-note {
  font-size: 0.8rem; /* Reduced size */
  margin-top: 0.75rem; /* Reduced margin */
  color: rgba(255, 255, 240, 0.7);
  font-style: italic;
  text-align: center;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .saint-card-inner {
    grid-template-columns: 1fr; /* Stack columns */
    grid-template-rows: minmax(250px, 40vh) auto; /* Fixed height for image, auto for content */
    min-height: auto; /* Let height be determined by content */
  }

  .saint-visual {
    grid-row: 1;
    aspect-ratio: 16/9; /* Wider aspect ratio for mobile */
    max-height: 40vh;
    min-height: 250px; /* Ensure minimum reasonable height */
    border-right: none;
    border-bottom: 1px solid var(--modern-card-border);
  }
  
  .saint-visual::after {
    height: 20%;
  }

  .saint-details {
    grid-row: 2;
    padding: 1.5rem; /* Slightly increased padding */
    height: auto; /* Let height be determined by content */
  }

  .feast-badge {
    top: auto;
    bottom: -1px; /* Overlap bottom border */
    right: auto;
    left: 1rem; /* Reduced spacing */
    transform: translateY(50%);
    background: rgba(25, 35, 35, 0.9);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
  }
  
  .saint-card:hover .feast-badge {
    transform: translateY(calc(50% - 2px));
  }

  .saint-title {
    padding-top: 0.75rem; /* Reduced padding */
  }
  
  .saint-description {
    min-height: 3rem; /* Reduced min-height for mobile */
    max-height: 7.5rem; /* Reduced max-height for mobile */
  }
}

@media (max-width: 768px) {
  .saint-of-the-day {
    padding: 2.5rem 0; /* Slightly increased padding */
    min-height: auto; /* Allow natural height */
  }
  
  .saint-visual {
    aspect-ratio: 16/10; /* Wider aspect ratio */
    max-height: 35vh; /* Further reduced height */
  }
  
  .saint-details {
    padding: 1.25rem; /* Slightly increased padding */
  }
  
  .saint-title {
    font-size: clamp(1.2rem, 4vw, 1.6rem); /* Reduced size */
  }
  
  .saint-meta {
    grid-template-columns: 1fr; /* Single column */
    gap: 0.5rem;
    padding-bottom: 0.75rem; /* Reduced padding */
    margin-bottom: 0.75rem; /* Reduced margin */
  }
  
  .saint-quote, .saint-description, .saint-categories {
    margin-bottom: 0.75rem; /* Reduced margin */
  }
  
  .saint-description {
    min-height: 0; /* Remove min-height constraint for smallest screens */
    max-height: 6rem;
  }
  
  .saint-actions {
    padding-top: 0.75rem; /* Reduced padding */
    flex-direction: column; /* Stack buttons */
    align-items: stretch; /* Full width */
  }
  
  .follow-saint {
    width: auto; /* Allow button to take width */
    padding: 0.5rem; /* Reduced padding */
  }

  .feast-badge {
    padding: 0.3rem 0.75rem; /* Reduced padding */
    font-size: 0.7rem; /* Reduced size */
    bottom: 0.75rem; /* Reduced spacing */
    left: 0.75rem; /* Reduced spacing */
  }
}

@media (max-width: 576px) {
  .container {
    width: 95%; /* Slightly wider on smallest screens */
  }
  
  .section-title {
    font-size: 1.5rem; /* Fixed smaller size */
  }
  
  .section-description {
    font-size: 0.85rem; /* Fixed smaller size */
    margin-bottom: 1rem; /* Reduced margin */
  }
  
  .saint-title {
    font-size: 1.3rem; /* Fixed smaller size */
  }
  
  .saint-link {
    font-size: 0.75rem; /* Reduced size */
    padding: 0.4rem 0.8rem; /* Reduced padding */
  }
  
  .saint-visual {
    max-height: 30vh; /* Further reduced height */
    min-height: 200px; /* Ensure minimum height on smallest screens */
  }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  .saint-card,
  .saint-image-container img,
  .feast-badge,
  .saint-link,
  .follow-saint,
  .category-tag,
  .saint-visual::after {
    transition: none;
  }

  .saint-card:hover {
    transform: none;
    box-shadow: var(--modern-shadow);
  }

  .saint-card:hover .saint-image-container img {
    transform: none;
    filter: brightness(1) saturate(1);
  }

  .saint-card:hover .saint-visual::after {
    opacity: 0.6;
  }

  .saint-card:hover .feast-badge,
  .saint-link:hover,
  .saint-link:hover i,
  .follow-saint:hover,
  .category-tag:hover {
    transform: none;
  }

  .saint-feature.loading::after {
    animation: none;
    border-style: solid;
  }
}