/* Enhanced Typography for Maya Angelou's "Phenomenal Woman" */

/* Self-hosted Variable Fonts */
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/crimson-pro-normal-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Crimson Pro';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('../fonts/crimson-pro-italic-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-normal-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter-italic-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* CSS Custom Properties for Typography System */
:root {
  /* Enhanced color palette with accessibility in mind */
  --primary-brown: #8B4513;
  --warm-gold: #996F00;  /* Darker gold for better contrast (4.5:1 ratio) */
  --deep-chocolate: #3C2414;
  --cream: #F5F5DC;
  --soft-gold: #F4E4BC;
  --accent-burgundy: #800020;
  --text-dark: #1A1A1A;
  --background-light: #FEFAF5;
  
  /* Typography Variables */
  --font-heading: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-accent: 'Inter', 'Segoe UI', system-ui, sans-serif;
  
  /* Fluid Typography Scale using clamp() */
  --text-xs: clamp(0.75rem, 0.5vw + 0.625rem, 0.875rem);
  --text-sm: clamp(0.875rem, 0.75vw + 0.75rem, 1rem);
  --text-base: clamp(1rem, 1vw + 0.875rem, 1.125rem);
  --text-lg: clamp(1.125rem, 1.25vw + 1rem, 1.25rem);
  --text-xl: clamp(1.25rem, 1.5vw + 1.125rem, 1.5rem);
  --text-2xl: clamp(1.5rem, 2vw + 1.25rem, 1.875rem);
  --text-3xl: clamp(1.875rem, 2.5vw + 1.5rem, 2.25rem);
  --text-4xl: clamp(2.25rem, 3vw + 1.875rem, 3rem);
  --text-5xl: clamp(3rem, 4vw + 2.25rem, 4rem);
  
  /* Fluid Spacing using clamp() */
  --space-xs: clamp(0.25rem, 0.5vw + 0.125rem, 0.5rem);
  --space-sm: clamp(0.5rem, 1vw + 0.25rem, 1rem);
  --space-md: clamp(1rem, 1.5vw + 0.75rem, 1.5rem);
  --space-lg: clamp(1.5rem, 2vw + 1rem, 2rem);
  --space-xl: clamp(2rem, 3vw + 1.5rem, 3rem);
  --space-2xl: clamp(3rem, 4vw + 2rem, 4rem);
  --space-3xl: clamp(4rem, 5vw + 3rem, 6rem);
  
  /* Variable Font Properties */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;
  
  /* Breakpoints */
  --mobile: 480px;
  --tablet: 768px;
  --desktop: 1024px;
  --wide: 1440px;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--background-light);
  overflow-x: hidden;
  font-feature-settings: "liga" 1, "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhance variable font properties for better readability */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-variation-settings: "wght" var(--weight-semibold);
}

/* Hero Section with Enhanced Typography */
.hero-section {
  position: relative;
  min-height: clamp(60vh, 10vw + 50vh, 80vh);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--deep-chocolate), var(--primary-brown));
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.9;
  z-index: 1;
  transition: all 0.6s ease;
  filter: 
    contrast(1.1) 
    saturate(1.15) 
    brightness(1.05);
}

.hero-section:hover .hero-image {
  transform: scale(1.02);
  opacity: 0.95;
  filter: 
    contrast(1.15) 
    saturate(1.25) 
    brightness(1.08);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.4);
  padding: var(--space-xl);
  border-radius: clamp(8px, 1vw + 4px, 16px);
  backdrop-filter: blur(8px);
  max-width: clamp(300px, 80vw, 600px);
  margin: 0 var(--space-md);
}

.hero-content h1 {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  font-variation-settings: "wght" var(--weight-bold);
  margin-bottom: var(--space-sm);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.author {
  font-family: var(--font-body);
  font-size: var(--text-xl);
  font-style: italic;
  font-weight: var(--weight-medium);
  font-variation-settings: "wght" var(--weight-medium);
  margin-bottom: var(--space-md);
  color: var(--warm-gold);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.01em;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: var(--weight-light);
  font-variation-settings: "wght" var(--weight-light);
  line-height: 1.5;
  opacity: 0.95;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
  letter-spacing: 0.005em;
}

/* Main content container with enhanced typography */
main {
  max-width: clamp(320px, 90vw, 800px);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

/* Image break sections - Enhanced for stunning visual impact */
.image-break {
  margin: var(--space-xxl) calc(-1 * var(--space-md));
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.15),
    0 4px 16px rgba(139, 69, 19, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  transform: translateY(0);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-break:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(139, 69, 19, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.image-break::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(218, 165, 32, 0.1) 0%,
    rgba(139, 69, 19, 0.05) 50%,
    rgba(128, 0, 32, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.image-break:hover::before {
  opacity: 1;
}

.section-image {
  width: 100%;
  height: auto;
  display: block;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: 
    contrast(1.05) 
    saturate(1.1) 
    brightness(1.02);
  position: relative;
  z-index: 0;
}

.section-image:hover {
  transform: scale(1.03);
  filter: 
    contrast(1.1) 
    saturate(1.2) 
    brightness(1.05);
}

/* Special styling for the final butterfly image */
.image-break:last-of-type {
  margin-bottom: var(--space-xxl);
  background: linear-gradient(
    135deg,
    rgba(218, 165, 32, 0.05),
    rgba(245, 245, 220, 0.1)
  );
  padding: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.image-break:last-of-type::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    var(--warm-gold),
    var(--accent-burgundy),
    var(--primary-brown)
  );
  border-radius: 16px;
  z-index: -1;
  margin: -2px;
}

.image-break:last-of-type:hover {
  transform: translateY(-12px) scale(1.01);
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.25),
    0 12px 32px rgba(218, 165, 32, 0.2);
}

/* Enhanced Stanza styling with variable fonts */
.stanza {
  margin-bottom: var(--space-2xl);
  padding: var(--space-xl);
  background: linear-gradient(135deg, 
    rgba(245, 245, 220, 0.6), 
    rgba(244, 228, 188, 0.4));
  border-radius: clamp(8px, 1vw + 4px, 16px);
  box-shadow: 0 4px 20px rgba(139, 69, 19, 0.1);
  border-left: clamp(3px, 0.5vw + 2px, 6px) solid var(--warm-gold);
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stanza:hover {
  transform: translateY(clamp(-1px, -0.2vw, -3px));
  box-shadow: 0 8px 32px rgba(139, 69, 19, 0.15);
}

.stanza-number {
  position: absolute;
  top: clamp(-8px, -1vw, -12px);
  left: var(--space-md);
  background: var(--warm-gold);
  color: var(--deep-chocolate);
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-variation-settings: "wght" var(--weight-semibold);
  font-size: var(--text-lg);
  width: clamp(32px, 5vw + 20px, 48px);
  height: clamp(32px, 5vw + 20px, 48px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3);
}

.lines {
  margin-left: var(--space-md);
}

/* Enhanced poetry line styling with variable font expressions */
.line {
  margin-bottom: var(--space-sm);
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: var(--weight-normal);
  font-variation-settings: "wght" var(--weight-normal);
  line-height: 1.7;
  color: var(--text-dark);
  transition: all 0.3s ease;
  position: relative;
  padding-left: var(--space-sm);
}

.line:hover {
  color: var(--primary-brown);
  font-variation-settings: "wght" var(--weight-medium);
}

.line::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(2px, 0.5vw + 1px, 4px);
  height: clamp(2px, 0.5vw + 1px, 4px);
  background: var(--warm-gold);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.line:hover::before {
  opacity: 1;
}

/* Enhanced emphasis for key lines - "Phenomenal woman, That's me" */
.line:nth-child(10),
.line:nth-child(11),
.line:nth-child(12),
.line:nth-child(13) {
  font-weight: var(--weight-bold);
  font-variation-settings: "wght" var(--weight-bold);
  color: var(--primary-brown);
  font-style: italic;
  font-size: var(--text-xl);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 2px rgba(139, 69, 19, 0.1);
}

/* Special styling for "I say," lines - building anticipation */
.line:nth-child(5),
.line:nth-child(8) {
  font-weight: var(--weight-medium);
  font-variation-settings: "wght" var(--weight-medium);
  color: var(--accent-burgundy);
  font-style: italic;
  margin-bottom: var(--space-xs);
}

/* Enhanced Footer styling with variable fonts */
footer {
  background: linear-gradient(135deg, var(--deep-chocolate), var(--primary-brown));
  color: var(--cream);
  padding: var(--space-xl) var(--space-md);
  margin-top: var(--space-2xl);
}

.footer-content {
  max-width: clamp(320px, 90vw, 800px);
  margin: 0 auto;
  text-align: center;
}

.footer-content p {
  margin-bottom: var(--space-md);
  line-height: 1.6;
  font-size: var(--text-base);
}

.student-info {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-variation-settings: "wght" var(--weight-semibold);
  font-size: var(--text-lg);
  color: var(--warm-gold);
  letter-spacing: 0.01em;
}

.poem-credit {
  font-family: var(--font-body);
  font-style: italic;
  font-weight: var(--weight-light);
  font-variation-settings: "wght" var(--weight-light);
  opacity: 0.9;
  font-size: var(--text-base);
}

.image-credit {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-normal);
  font-variation-settings: "wght" var(--weight-normal);
  opacity: 0.8;
}

/* Enhanced Responsive Design with Fluid Typography */
@media (max-width: 768px) {
  .hero-section {
    min-height: clamp(50vh, 8vw + 40vh, 70vh);
  }
  
  .hero-content {
    padding: var(--space-lg);
    margin: 0 var(--space-sm);
  }
  
  main {
    padding: var(--space-lg) var(--space-sm);
  }
  
  .stanza {
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
  }
  
  .lines {
    margin-left: var(--space-sm);
  }
  
  .image-break {
    margin: var(--space-xl) calc(-1 * var(--space-sm));
  }
  
  /* Adjust variable font settings for mobile */
  .line {
    font-variation-settings: "wght" 350;
  }
  
  .line:nth-child(10),
  .line:nth-child(11),
  .line:nth-child(12),
  .line:nth-child(13) {
    font-variation-settings: "wght" var(--weight-bold);
  }
}

@media (max-width: 480px) {
  .hero-content {
    padding: var(--space-md);
  }
  
  .stanza {
    padding: var(--space-md);
  }
  
  .stanza-number {
    font-size: var(--text-base);
  }
  
  /* Optimize typography for small screens */
  .line {
    font-variation-settings: "wght" 320;
  }
}

/* Enhanced accessibility and performance features */
@media (min-resolution: 2dppx) {
  .hero-image,
  .section-image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Enhanced print styles with typography considerations */
@media print {
  .hero-image,
  .section-image {
    break-inside: avoid;
  }
  
  .stanza {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--primary-brown);
  }
  
  /* Optimize typography for print */
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .line {
    font-size: 11pt;
  }
  
  .hero-content h1 {
    font-size: 24pt;
  }
}

/* Enhanced focus styles for accessibility */
img:focus,
.stanza:focus,
.line:focus {
  outline: 3px solid var(--warm-gold);
  outline-offset: 2px;
}

/* Smooth scrolling with variable font support */
html {
  scroll-behavior: smooth;
}

/* Enhanced loading animations */
.hero-image,
.section-image {
  opacity: 0;
  animation: fadeIn 1s ease-in-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(clamp(5px, 1vw + 2px, 15px));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Variable font animation for emphasis */
@keyframes emphasize {
  0%, 100% {
    font-variation-settings: "wght" var(--weight-normal);
  }
  50% {
    font-variation-settings: "wght" var(--weight-bold);
  }
}

/* Enhance key lines with subtle animation on load */
.line:nth-child(10),
.line:nth-child(11),
.line:nth-child(12),
.line:nth-child(13) {
  animation: emphasize 3s ease-in-out infinite;
  animation-delay: 2s;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .hero-image,
  .section-image,
  .line:nth-child(10),
  .line:nth-child(11),
  .line:nth-child(12),
  .line:nth-child(13) {
    animation: none;
  }
  
  html {
    scroll-behavior: auto;
  }
  
  .stanza:hover,
  .image-break:hover {
    transform: none;
  }
}