/* ============================================================================
   Personal Story Section - Independent Styles
   ============================================================================ */

/* ============================================================================
   CSS Variables - Story-specific
   ============================================================================ */
:root {
  /* Base colors (shared with main site but can diverge) */
  --bg: #080c14;
  --bg-secondary: #0f1419;
  --bg-tertiary: #161b22;
  --card-bg: #0d1117;
  
  /* Text colors */
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  
  /* Brand colors */
  --primary: #22d3ee;
  --primary-dim: rgba(34, 211, 238, 0.1);
  --accent: #a78bfa;
  --accent-dim: rgba(167, 139, 250, 0.1);
  
  /* UI elements */
  --border: #21262d;
  --radius: 12px;
  --radius-sm: 8px;
  
  /* Spacing */
  --section-padding: 5rem 0;
  --container-max: 1200px;
  --content-max: 900px;
  
  /* Story-specific colors */
  --story-gradient: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  --story-overlay: linear-gradient(to top, rgba(8, 12, 20, 0.9), transparent);
}

/* ============================================================================
   Base & Reset
   ============================================================================ */
.story-body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   Story Header - Minimal & Personal
   ============================================================================ */
.story-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(8, 12, 20, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.story-header__container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-brand {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.story-brand:hover {
  color: var(--primary);
}

.story-nav__link {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.story-nav__link:hover {
  color: var(--text);
}

#main-content {
  padding-top: 4rem;
}

/* ============================================================================
   Hero Section - Immersive & Atmospheric
   ============================================================================ */
.story-hero {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-secondary) 100%);
  position: relative;
  overflow: hidden;
  padding: 6rem 2rem;
}

.story-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 30% 50%, rgba(34, 211, 238, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(167, 139, 250, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.story-hero__content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 1rem;
  display: block;
}

.story-hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-weight: 700;
}

.lead {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ============================================================================
   Sections
   ============================================================================ */
.story-section {
  padding: var(--section-padding);
}

.story-section--alt {
  background: var(--bg-secondary);
}

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

.content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.section-heading {
  text-align: center;
  margin-bottom: 3rem;
}

.section-heading h2 {
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ============================================================================
   Story Divider
   ============================================================================ */
.story-divider {
  width: 60px;
  height: 3px;
  background: var(--story-gradient);
  margin: 3rem auto;
  border-radius: 2px;
}

/* ============================================================================
   Story Introduction
   ============================================================================ */
.story-intro {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text);
}

.story-intro p {
  margin-bottom: 1.5rem;
}

/* ============================================================================
   Book Preview Cards
   ============================================================================ */
.book-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.book-chapter-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: border-color 0.3s, transform 0.3s;
  cursor: pointer;
}

.book-chapter-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.book-chapter-number {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.book-chapter-title {
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 1rem;
}

.book-chapter-excerpt {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.book-chapter-button {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.book-chapter-button:hover {
  background: var(--primary);
  color: var(--bg);
}

/* ============================================================================
   Book Reader - Fullscreen reading experience
   ============================================================================ */
.book-reader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.book-reader.is-open {
  display: block;
  opacity: 1;
}

.book-reader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 12, 20, 0.95);
  backdrop-filter: blur(8px);
}

.book-reader-container {
  position: relative;
  z-index: 2;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.book-reader-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, color 0.3s;
  z-index: 10;
}

.book-reader-close:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.book-reader-progress {
  position: absolute;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.book-reader-progress-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(8px);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.book-reader-content {
  flex: 1;
  overflow-y: auto;
  padding: 6rem 2rem 4rem;
  scroll-behavior: smooth;
}

.book-chapter {
  max-width: 700px;
  margin: 0 auto;
  background: rgba(13, 17, 23, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(33, 38, 45, 0.5);
  border-radius: 16px;
  padding: 4rem 3rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: none;
  animation: fadeInChapter 0.6s ease forwards;
}

.book-chapter.is-active {
  display: block;
}

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

.chapter-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.chapter-header::after {
  content: '';
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
}

.chapter-number {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--primary);
  margin-bottom: 1rem;
  opacity: 0.8;
}

.chapter-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.3;
  color: var(--text);
  font-weight: 600;
  margin: 0;
}

.chapter-content {
  margin: 3rem 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 1.125rem;
  line-height: 1.9;
  color: var(--text);
}

.chapter-content p {
  margin-bottom: 1.5rem;
  text-indent: 0;
}

.chapter-content p:first-child {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 500;
  font-family: 'Inter', sans-serif;
}

.chapter-content p:last-child {
  margin-bottom: 0;
}

/* Book Navigation */
.book-reader-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(to top, rgba(8, 12, 20, 0.95), transparent);
  display: flex;
  justify-content: center;
  gap: 2rem;
  z-index: 10;
}

.book-nav-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s, opacity 0.3s;
}

.book-nav-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.book-nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.book-nav-button svg {
  transition: transform 0.3s;
}

.book-nav-button:hover:not(:disabled) svg {
  transform: translateX(4px);
}

.book-nav-prev:hover:not(:disabled) svg {
  transform: translateX(-4px);
}

/* ============================================================================
   Timeline - Vertical with center line
   ============================================================================ */
.timeline {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline-item {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
  position: relative;
}

.timeline-item:nth-child(even) .timeline-content:first-child {
  order: 3;
}

.timeline-item:nth-child(even) .timeline-marker {
  order: 2;
}

.timeline-item:nth-child(even) .timeline-content:last-child {
  order: 1;
}

.timeline-content {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color 0.3s;
}

.timeline-content:hover {
  border-color: var(--primary);
}

.timeline-content h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.timeline-year {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: block;
}

.timeline-content p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0;
}

.timeline-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.timeline-marker-dot {
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  border: 4px solid var(--bg);
  box-shadow: 0 0 0 2px var(--primary);
}

/* ============================================================================
   Gallery Grid
   ============================================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.gallery-item {
  aspect-ratio: 4/3;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.gallery-item-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg) 100%);
  color: var(--text-muted);
  font-size: 3rem;
}

.gallery-item-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--story-overlay);
  padding: 1rem;
  color: var(--text);
  font-size: 0.875rem;
}

/* ============================================================================
   Hobby Cards
   ============================================================================ */
.hobby-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.hobby-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-align: center;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.hobby-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.hobby-card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.hobby-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hobby-card p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0;
}

/* ============================================================================
   Projects Showcase
   ============================================================================ */
.projects-showcase {
  display: grid;
  gap: 3rem;
  max-width: 900px;
  margin: 2rem auto 0;
}

.project-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  transition: border-color 0.3s;
}

.project-item:hover {
  border-color: var(--primary);
}

.project-item-image {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
}

.project-item-content {
  padding: 2rem 2rem 2rem 0;
}

.project-item h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.project-item-meta {
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 1rem;
  display: block;
}

.project-item p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ============================================================================
   Animations
   ============================================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================================
   Footer
   ============================================================================ */
.story-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 2rem;
  margin-top: 4rem;
}

.story-footer__container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.story-footer__content {
  margin-bottom: 1.5rem;
}

.story-footer__content p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}

.story-footer__content a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

.story-footer__content a:hover {
  color: var(--accent);
}

.story-footer__copyright p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

/* ============================================================================
   Utilities
   ============================================================================ */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: var(--bg);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

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

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 768px) {
  .story-hero {
    min-height: 50vh;
    padding: 4rem 1.5rem;
  }
  
  .container {
    padding: 0 1.5rem;
  }
  
  .story-section {
    padding: 3rem 0;
  }
  
  .book-preview {
    grid-template-columns: 1fr;
  }
  
  .book-chapter {
    padding: 2.5rem 1.5rem;
  }
  
  .chapter-content {
    font-size: 1.0625rem;
    line-height: 1.8;
  }
  
  .book-reader-content {
    padding: 5rem 1rem 4rem;
  }
  
  .book-reader-nav {
    gap: 1rem;
  }
  
  .book-nav-button {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  .timeline::before {
    left: 20px;
  }
  
  .timeline-item {
    grid-template-columns: 40px 1fr;
    gap: 1rem;
  }
  
  .timeline-item:nth-child(even) .timeline-content:first-child {
    order: 2;
  }
  
  .timeline-item:nth-child(even) .timeline-marker {
    order: 1;
  }
  
  .timeline-item:nth-child(even) .timeline-content:last-child {
    display: none;
  }
  
  .timeline-content:first-child {
    order: 2;
  }
  
  .timeline-marker {
    order: 1;
  }
  
  .timeline-content:last-child {
    display: none;
  }
  
  .project-item {
    grid-template-columns: 1fr;
  }
  
  .project-item-content {
    padding: 2rem;
  }
  
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .hobby-cards {
    grid-template-columns: 1fr;
  }
}
