/* ============================================
   THERAPY ATELIER - MAIN STYLESHEET
   Warm, modern, minimal design system
   
   Typography Note: Uses modern CSS text-wrap properties
   (balance/pretty) supported in Chrome 114+, Safari 17+
   Gracefully degrades in older browsers with max-width
   constraints and orphan/widow controls.
   ============================================ */

/* CSS Variables - Design Tokens */
:root {
  /* Colors - Warm, Natural Palette */
  --color-cream: #FAF9F7;
  --color-warm-white: #F5F4F0;
  --color-sage: #B4AA99;
  --color-clay: #D4C5B0;
  --color-clay-light: #E8E3D8;
  --color-terracotta: #C67B5C;
  --color-terracotta-hover: #B36B4D;
  --color-text-primary: #2C2825;
  --color-text-secondary: #5A5551;
  --color-border: #E5E1D8;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Lora', 'Georgia', serif;
  
  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --space-4xl: 8rem;
  
  /* Layout */
  --container-max: 1200px;
  --container-narrow: 800px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  
  /* Transitions */
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Enable better text wrapping across the site */
  -webkit-hyphens: auto;
  hyphens: auto;
  hanging-punctuation: first last;
}

body {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography 
   Anti-orphan strategy:
   - Use ch units for max-width (character-based sizing prevents awkward line breaks)
   - text-wrap: balance for headings (distributes words evenly)
   - text-wrap: pretty for body text (improved wrapping algorithm)
   - orphans/widows properties prevent single words on lines
   - Center headings with auto margins for better visual balance
*/
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin-bottom: var(--space-md);
  text-wrap: balance; /* Prevent orphans in headings */
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  letter-spacing: -0.02em;
  max-width: 20ch; /* Prevent long lines that create orphans */
  margin-left: auto;
  margin-right: auto;
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.01em;
  max-width: 25ch;
  margin-left: auto;
  margin-right: auto;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  max-width: 30ch;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--space-md);
  max-width: 75ch; /* Optimal reading length */
  orphans: 2; /* Prevent orphan words */
  widows: 2; /* Prevent widow words */
}

a {
  color: var(--color-terracotta);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--color-terracotta-hover);
}

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-4xl) 0;
}

.section-sm {
  padding: var(--space-3xl) 0;
}

.section-lg {
  padding: var(--space-4xl) 0;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: rgba(250, 249, 247, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
  transition: transform var(--transition-base);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  max-width: var(--container-max);
  margin: 0 auto;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-main {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
}

.nav-link {
  color: var(--color-text-secondary);
  font-size: 1rem;
  font-weight: 500;
  transition: color var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text-primary);
}

/* Mobile Menu */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
}

.hamburger {
  width: 24px;
  height: 2px;
  background-color: var(--color-text-primary);
  position: relative;
  transition: background-color var(--transition-base);
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background-color: var(--color-text-primary);
  transition: transform var(--transition-base);
}

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  bottom: -8px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-block;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  text-decoration: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background-color: var(--color-terracotta);
  color: white;
}

.btn-primary:hover {
  background-color: var(--color-terracotta-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(198, 123, 92, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text-primary);
  border: 2px solid var(--color-clay);
}

.btn-secondary:hover {
  background-color: var(--color-clay-light);
  border-color: var(--color-sage);
}

.btn-large {
  padding: 1.25rem 2.5rem;
  font-size: 1.125rem;
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  margin-top: 80px;
  background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-warm-white) 100%);
  position: relative;
}

/* Homepage hero uses full-bleed background image */
.hero-home {
  background-image: url('assets/bg.jpg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Keep text readable on top of image */
.hero-home::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(250, 249, 247, 0.72);
  pointer-events: none;
  z-index: 0;
}

/* About page hero */
.hero-about {
  background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-warm-white) 100%);
}

.hero-about::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(250, 249, 247, 0.6) 0%, rgba(250, 249, 247, 0) 40%, rgba(250, 249, 247, 0) 100%);
  pointer-events: none;
  z-index: 0;
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin-bottom: var(--space-lg);
  max-width: 18ch; /* Tighter control for hero heading */
}

.hero-subheadline {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.5;
  max-width: 35ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
}

.hero-text {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 55ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: pretty; /* Better text wrapping */
}

.hero-ctas {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   CARDS & COMPONENTS
   ============================================ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

.card {
  background-color: white;
  border-radius: var(--border-radius);
  padding: var(--space-xl);
  transition: all var(--transition-base);
  border: 1px solid var(--color-border);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(44, 40, 37, 0.08);
}

.card h3 {
  margin-bottom: var(--space-md);
  text-wrap: balance;
  max-width: 25ch;
}

.card p {
  max-width: 60ch;
  text-wrap: pretty;
}

.card-link {
  color: var(--color-terracotta);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  margin-top: var(--space-md);
}

.card-link::after {
  content: '→';
  margin-left: var(--space-xs);
  transition: transform var(--transition-base);
}

.card-link:hover::after {
  transform: translateX(4px);
}

/* ============================================
   SECTIONS
   ============================================ */

.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-header h2 {
  margin-bottom: var(--space-md);
}

.section-intro {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  max-width: 50ch;
  margin: 0 auto var(--space-lg);
  text-wrap: balance;
  orphans: 3;
  widows: 3;
}

.section-alt {
  background-image: url('assets/new-white-bg.jpg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

/* Work With Me page hero */
.hero-work-with-me {
  background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-warm-white) 100%);
  position: relative;
}

.hero-work-with-me::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(250, 249, 247, 0.92);
  pointer-events: none;
  z-index: 0;
}

/* How It Works page hero */
.hero-how-it-works {
  background: linear-gradient(135deg, var(--color-cream) 0%, var(--color-warm-white) 100%);
  position: relative;
}

.hero-how-it-works::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(250, 249, 247, 0.92);
  pointer-events: none;
  z-index: 0;
}

/* Four Pillars / Features List */
.pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

.pillar {
  padding: var(--space-lg);
}

.pillar h4 {
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
  text-wrap: balance;
  max-width: 20ch;
}

.pillar p {
  color: var(--color-text-secondary);
  margin-bottom: 0;
  max-width: 45ch;
  text-wrap: pretty;
  orphans: 2;
  widows: 2;
}

/* Step Process */
.steps {
  display: grid;
  gap: var(--space-3xl);
  margin-top: var(--space-3xl);
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-lg);
}

.step-number {
  width: 60px;
  height: 60px;
  background-color: var(--color-clay-light);
  color: var(--color-text-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-content h3 {
  margin-bottom: var(--space-sm);
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, var(--color-clay-light) 0%, var(--color-warm-white) 100%);
  text-align: center;
  padding: var(--space-4xl) var(--space-lg);
  border-radius: var(--border-radius);
  margin: var(--space-4xl) var(--space-lg);
}

.cta-section h2 {
  margin-bottom: var(--space-md);
  max-width: 20ch;
}

.cta-section p {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 45ch;
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
  orphans: 3;
  widows: 3;
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  background-color: var(--color-text-primary);
  color: var(--color-warm-white);
  padding: var(--space-3xl) 0 var(--space-lg);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
  max-width: var(--container-max);
  margin: 0 auto var(--space-2xl);
  padding: 0 var(--space-lg);
}

.footer-column h4 {
  color: var(--color-warm-white);
  font-size: 1rem;
  margin-bottom: var(--space-md);
}

.footer-column ul {
  list-style: none;
}

.footer-column li {
  margin-bottom: var(--space-sm);
}

.footer-column a {
  color: var(--color-clay);
  font-size: 0.95rem;
  transition: color var(--transition-base);
}

.footer-column a:hover {
  color: var(--color-warm-white);
}

.footer-bottom {
  border-top: 1px solid rgba(229, 225, 216, 0.2);
  padding-top: var(--space-lg);
  text-align: center;
  color: var(--color-clay);
  font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .nav-main {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .nav-main.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-cream);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    gap: var(--space-md);
  }
  
  .hero {
    min-height: 80vh;
    padding: var(--space-3xl) var(--space-md);
  }
  
  /* Keep full-bleed background image on mobile */
  .hero-home {
    background-image: url('assets/bg.jpg');
    background-size: cover;
    background-position: center;
  }
  
  .hero-home::before {
    display: block;
    background-color: rgba(250, 249, 247, 0.82);
  }
  
  .hero-about::before {
    background: linear-gradient(90deg, rgba(250, 249, 247, 0.9) 0%, rgba(250, 249, 247, 0.7) 40%, rgba(250, 249, 247, 0.3) 70%, rgba(250, 249, 247, 0) 100%);
  }
  
  
  .hero-ctas {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
  }
  
  .section {
    padding: var(--space-3xl) 0;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  
  .step {
    grid-template-columns: 1fr;
  }
  
  .pillars {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center {
  text-align: center;
}

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.color-secondary {
  color: var(--color-text-secondary);
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
