/* custom.css - Healthify Website */

/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */

:root {
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Focus ring */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --focus-ring-color: #E07A5F;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Section spacing */
  --section-compact: 3rem;
  --section-standard: 4rem;
  --section-emphasis: 5rem;
}

@media (min-width: 768px) {
  :root {
    --section-compact: 4rem;
    --section-standard: 6rem;
    --section-emphasis: 8rem;
  }
}

/* ========================================
   Base Styles
   ======================================== */

/* Prevent FOUC for includes - hide placeholder divs */
[data-include] {
  min-height: 1px;
  display: block;
}

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   Button Components
   ======================================== */

/* Primary CTA Button - Coral with hover effect */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background-color: #C45C40;
  color: white;
  font-weight: 600;
  font-size: 1.125rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background-color: #A44D35;
  box-shadow: 0 20px 25px -5px rgba(196, 92, 64, 0.3);
  transform: translateY(-2px);
}

.btn-primary:focus {
  outline: 2px solid #E07A5F;
  outline-offset: 2px;
}

.btn-primary svg {
  margin-left: 0.5rem;
  width: 1.25rem;
  height: 1.25rem;
}

/* Secondary CTA Button - Sage border with hover fill */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background-color: transparent;
  border: 2px solid #6B7F6B;
  color: #6B7F6B;
  font-weight: 600;
  font-size: 1.125rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background-color: #6B7F6B;
  color: white;
  transform: translateY(-2px);
}

.btn-secondary:focus {
  outline: 2px solid #E07A5F;
  outline-offset: 2px;
}

.btn-secondary svg {
  margin-left: 0.5rem;
  width: 1.25rem;
  height: 1.25rem;
}

/* Tertiary/Text Button - Minimal style with underline */
.btn-tertiary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #2D2D2D;
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.btn-tertiary:hover {
  color: #C45C40;
  border-bottom-color: #C45C40;
}

.btn-tertiary:focus {
  outline: 2px solid #E07A5F;
  outline-offset: 2px;
}

.btn-tertiary svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Small button variant - for header and compact spaces */
.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  background-color: #C45C40;
  color: white;
  font-weight: 500;
  font-size: 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-primary-sm:hover {
  background-color: #A44D35;
  box-shadow: 0 10px 15px -3px rgba(196, 92, 64, 0.3);
}

.btn-primary-sm:focus {
  outline: 2px solid #E07A5F;
  outline-offset: 2px;
}

/* ========================================
   Unified Button System
   ======================================== */

/* Button base - use with color variant */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all var(--transition-base);
}

.btn:focus {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Size variants */
.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-md {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

/* Color variants */
.btn-coral {
  background-color: #C45C40;
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-coral:hover {
  background-color: #A44D35;
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(196, 92, 64, 0.25);
}

.btn-coral:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-sage {
  background-color: #4A594A;
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-sage:hover {
  background-color: #3D4F3D;
  transform: translateY(-2px);
  box-shadow: 0 20px 25px -5px rgba(74, 89, 74, 0.25);
}

.btn-sage:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-outline-sage {
  background-color: transparent;
  border: 2px solid #4A594A;
  color: #4A594A;
}

.btn-outline-sage:hover {
  background-color: #4A594A;
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline-sage:active {
  transform: translateY(0);
}

/* ========================================
   Unified Card System
   ======================================== */

/* Card base */
.card {
  background-color: white;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid #E5E2DF;
  transition: all var(--transition-slow);
}

/* Card with hover elevation */
.card-elevated {
  box-shadow: var(--shadow-md);
}

.card-elevated:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

/* Card with focus-within for accessibility */
.card:focus-within {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Card accent variants */
.card-accent-sage {
  border-left: 4px solid #6B7F6B;
}

.card-accent-coral {
  border-left: 4px solid #C45C40;
}

/* Card image container */
.card-image {
  position: relative;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

/* Card body */
.card-body {
  padding: 1.5rem;
}

/* ========================================
   Content Band Layouts
   ======================================== */

.content-band {
  padding-top: var(--section-standard);
  padding-bottom: var(--section-standard);
}

.content-band-compact {
  padding-top: var(--section-compact);
  padding-bottom: var(--section-compact);
}

.content-band-emphasis {
  padding-top: var(--section-emphasis);
  padding-bottom: var(--section-emphasis);
}

/* Responsive button sizing */
@media (max-width: 640px) {
  .btn-primary,
  .btn-secondary {
    width: 100%;
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }

  .btn-tertiary {
    font-size: 1rem;
  }
}

/* ========================================
   Hero Section Variants
   ======================================== */

/* Small Hero - For 404, legal pages */
.hero-sm {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (min-width: 768px) {
  .hero-sm {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

/* Medium Hero - For services, FAQ pages */
.hero-md {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

@media (min-width: 768px) {
  .hero-md {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
}

/* Large Hero - For about, contact, medical-director pages */
.hero-lg {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

@media (min-width: 768px) {
  .hero-lg {
    padding-top: 8rem;
    padding-bottom: 8rem;
  }
}

/* Full Hero - For homepage with image */
.hero-full {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

@media (min-width: 768px) {
  .hero-full {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
}

/* ========================================
   Skip Link
   ======================================== */

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 9999;
  padding: 12px 24px;
  background-color: #C45C40;
  color: white;
  font-weight: 500;
  border-radius: 8px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
  outline: 2px solid #E07A5F;
  outline-offset: 2px;
}

/* ========================================
   Focus Styles
   ======================================== */

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced link focus for navigation */
a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: 0.25rem;
}

/* Active page indicator for navigation */
[aria-current="page"] {
  color: #4A594A; /* sage-700 */
}

[aria-current="page"]::after {
  width: 100% !important;
}

/* ========================================
   Standardized Interaction States
   ======================================== */

/* Interactive link with underline animation */
.link-animated {
  position: relative;
  text-decoration: none;
  transition: color var(--transition-base);
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width var(--transition-base);
}

.link-animated:hover::after {
  width: 100%;
}

/* Interactive icon (for icons that respond to hover) */
.icon-interactive {
  transition: transform var(--transition-base), color var(--transition-base);
}

.icon-interactive:hover {
  transform: scale(1.1);
}

/* Group hover utilities for parent-triggered animations */
.group:hover .group-hover-lift {
  transform: translateY(-4px);
}

.group:hover .group-hover-scale {
  transform: scale(1.05);
}

/* ========================================
   Animation Classes
   ======================================== */

/* Initial state for animated elements - set in CSS to avoid flash */
[data-animate="fade-up"] {
  opacity: 0;
  transform: translateY(20px);
}

/* No-JS fallback */
.no-js [data-animate="fade-up"] {
  opacity: 1;
  transform: none;
}

/* Animated state */
[data-animate="fade-up"].is-visible {
  animation: fadeUp 0.6s ease-out forwards;
}

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

/* Fade-in animation */
[data-animate="fade-in"] {
  opacity: 0;
}

.no-js [data-animate="fade-in"] {
  opacity: 1;
}

[data-animate="fade-in"].is-visible {
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ========================================
   Mobile Typography Optimization
   ======================================== */

/* Improve readability on mobile devices */
@media (max-width: 640px) {
  body {
    font-size: 16px;
    line-height: 1.6;
  }

  /* Ensure minimum tap target size (44x44px) */
  button,
  a[role="button"],
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Prevent text from being too wide */
  p,
  li {
    max-width: 65ch;
  }

  /* Optimize heading sizes for small screens */
  h1 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    line-height: 1.2;
  }

  h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.3;
  }

  h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    line-height: 1.4;
  }
}

/* ========================================
   Condition Cards Lists
   ======================================== */

[data-component="condition-group"] ul {
  list-style: none;
  padding-left: 0;
}

[data-component="condition-group"] ul li {
  position: relative;
  padding-left: 1.25rem;
}

[data-component="condition-group"] ul li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #6B7F6B;
  font-weight: 500;
}

/* ========================================
   FAQ Accordion
   ======================================== */

details summary {
  list-style: none;
  position: relative;
  padding-right: 3.5rem;
  min-height: 44px; /* Touch target minimum */
  display: flex;
  align-items: center;
}

details summary::-webkit-details-marker {
  display: none;
}

/* Chevron icon */
details summary::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7F6B'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform 0.3s ease, opacity 0.2s ease;
  opacity: 0.7;
}

/* Hover state */
details summary:hover::after {
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}

/* Open state - rotate chevron */
details[open] summary::after {
  transform: translateY(-50%) rotate(180deg);
  opacity: 1;
}

/* Enhanced hover background */
details summary:hover {
  background-color: rgba(107, 127, 107, 0.05);
}

/* Open state enhancement */
details[open] {
  background-color: rgba(107, 127, 107, 0.03);
}

details[open] summary {
  border-bottom: 1px solid rgba(107, 127, 107, 0.15);
  margin-bottom: 0.5rem;
}

/* ========================================
   Mobile Menu Animation
   ======================================== */

#mobile-navigation {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
  opacity: 0;
}

#mobile-navigation:not(.hidden) {
  max-height: 400px;
  opacity: 1;
}

/* Ensure hidden class still works for no-JS fallback */
#mobile-navigation.hidden {
  max-height: 0;
  opacity: 0;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  /* Hide non-essential elements */
  header,
  footer,
  .skip-link,
  [data-component="cta-button"],
  nav,
  #mobile-menu-toggle {
    display: none !important;
  }

  /* Reset backgrounds */
  body,
  main,
  section {
    background: white !important;
    color: black !important;
  }

  /* Show URLs for links */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Don't show URLs for internal links */
  a[href^="/"]::after,
  a[href^="tel:"]::after,
  a[href^="mailto:"]::after {
    content: none;
  }

  /* Typography adjustments */
  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  h1 { font-size: 24pt; }
  h2 { font-size: 18pt; }
  h3 { font-size: 14pt; }

  /* Avoid page breaks in bad places */
  h1, h2, h3, h4 {
    page-break-after: avoid;
  }

  p, li {
    orphans: 3;
    widows: 3;
  }
}
