/* ============================================
   In His Own Words - Main Stylesheet
   ============================================ */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-blue: #4a90e2;
  --secondary-green: #7cb342;
  --light-gray: #f5f7fa;
  --dark-gray: #2c3e50;
  --text-gray: #555555;
  --border-gray: #e0e0e0;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s ease;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-gray);
  background-color: #fafbfc;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.header {
  background: linear-gradient(135deg, var(--primary-blue) 0%, #3d7bc9 100%);
  color: white;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.5rem;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.95;
  font-weight: 300;
}

/* ============================================
   Main Content
   ============================================ */
main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* ============================================
   Story Grid
   ============================================ */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  width: 100%;
}

/* ============================================
   Story Card
   ============================================ */
.story-card {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.story-card h2 {
  font-size: 1.4rem;
  color: var(--dark-gray);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.story-card p {
  color: var(--text-gray);
  margin-bottom: 1.5rem;
  flex-grow: 1;
  font-size: 0.95rem;
}

.story-card-controls {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  margin-top: auto;
}

/* ============================================
   Audio Player (Compact)
   ============================================ */
.audio-player-container {
  flex: 1;
  display: flex;
  align-items: center;
}

.audio-player-container audio {
  width: 100%;
  height: 35px;
  border-radius: 6px;
}

/* ============================================
   Buttons
   ============================================ */
button, a.btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background-color: #3d7bc9;
  transform: translateY(-2px);
}

.btn-primary:focus {
  outline: 2px solid var(--secondary-green);
  outline-offset: 2px;
}

.btn-secondary {
  background-color: var(--secondary-green);
  color: white;
}

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

.btn-secondary:focus {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

.btn-outline {
  background-color: transparent;
  color: var(--primary-blue);
  border: 2px solid var(--primary-blue);
}

.btn-outline:hover {
  background-color: var(--primary-blue);
  color: white;
}

/* ============================================
   Story Page Layout
   ============================================ */
.story-header {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.story-header h1 {
  font-size: 2rem;
  color: var(--dark-gray);
  flex: 1;
  min-width: 200px;
}

.story-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.story-player {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.story-player audio {
  width: 100%;
  border-radius: 8px;
}

.transcript-container {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  line-height: 1.8;
  color: var(--text-gray);
  max-height: 500px;
  overflow-y: auto;
}

.transcript-container h3 {
  color: var(--dark-gray);
  margin-bottom: 1rem;
}

.transcript-container p {
  margin-bottom: 1rem;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background-color: var(--dark-gray);
  color: white;
  text-align: center;
  padding: 2rem;
  margin-top: auto;
  font-size: 0.9rem;
  opacity: 0.9;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.8rem;
  }

  main {
    padding: 2rem 1.5rem;
  }

  .stories-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
  }

  .story-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .story-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .story-header h1 {
    width: 100%;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .header {
    padding: 2rem 1rem;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .header p {
    font-size: 0.95rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .stories-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .story-card {
    padding: 1.5rem;
  }

  .story-card-controls {
    flex-direction: column;
  }

  .audio-player-container audio {
    height: 40px;
  }

  button, a.btn {
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    width: 100%;
  }

  .story-content {
    gap: 1.5rem;
  }

  .transcript-container {
    padding: 1.5rem;
    max-height: 400px;
  }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */
button:focus, a:focus {
  outline: 2px solid var(--secondary-green);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background-color: var(--primary-blue);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}
