/* AI Stories - Base Styles */
/* Typography from netflix_act1_story.html */

:root {
  /* Light mode colors */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-sidebar: #f8fafc;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;
  --accent-color: #4f46e5;
  --accent-light: #eef2ff;
  --accent-hover: #3730a3;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --bg-primary: #111111;
  --bg-secondary: #1a1a1a;
  --bg-sidebar: #0d0d0d;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --border-color: #374151;
  --border-light: #1f2937;
  --accent-color: #818cf8;
  --accent-light: #1e1b4b;
  --accent-hover: #a5b4fc;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
  padding: 0;
  font-size: 16px;
}

.headline, h1, h2, h3, h4 {
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  color: var(--text-primary);
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* Layout */
.site-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6b7280, #374151);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-logo-text {
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-nav {
  padding: 1rem 0;
}

.nav-section {
  margin-bottom: 0.5rem;
}

.nav-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--accent-color);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent-color);
  border-left-color: var(--accent-color);
  font-weight: 500;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Main content area */
.main-wrapper {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
}

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

.breadcrumb-separator {
  color: var(--text-light);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border-color);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.header-btn:hover {
  background: var(--bg-secondary);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.header-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.header-link:hover {
  background: var(--bg-secondary);
  color: var(--accent-color);
}

/* Main content */
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Story Grid */
.story-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.story-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none;
  display: block;
}

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

.story-card.featured {
  grid-column: span 2;
  grid-row: span 2;
}

.story-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-secondary);
}

.story-card.featured .story-card-image {
  aspect-ratio: 4/3;
}

.story-card-content {
  padding: 1rem;
}

.story-card-tag {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--accent-light);
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.story-card-title {
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.story-card.featured .story-card-title {
  font-size: 1.5rem;
}

.story-card-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card.featured .story-card-excerpt {
  -webkit-line-clamp: 4;
}

.story-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* Search Modal */
.search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}

.search-modal.active {
  display: flex;
}

.search-container {
  background: var(--bg-primary);
  width: 100%;
  max-width: 600px;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  margin-right: 0.75rem;
}

.search-input {
  flex: 1;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

.search-result-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.search-result-excerpt {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.search-no-results {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* Page layouts */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
}

.page-description {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 600px;
}

/* Prose content (for story pages) */
.prose {
  font-size: 1.125rem;
  line-height: 1.85;
  max-width: 680px;
  margin: 0 auto;
  color: var(--text-secondary);
}

.prose p {
  margin-bottom: 1.75rem;
}

.prose strong {
  color: var(--text-primary);
  font-weight: 600;
}

.prose h2 {
  font-size: 1.75rem;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.prose h3 {
  font-size: 1.375rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent-color);
}

/* Responsive */
@media (max-width: 1200px) {
  .story-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .story-card.featured {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .story-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .story-card.featured {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header {
    padding: 0 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .story-grid {
    grid-template-columns: 1fr;
  }

  .story-card.featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  .page-title {
    font-size: 1.75rem;
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

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

/* Card list for resources/courses */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

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

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-color);
}

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.card-title {
  font-family: 'Inter', 'Roboto', -apple-system, sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

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

/* Contact form */
.contact-form {
  max-width: 500px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

.form-button {
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.form-button:hover {
  background: var(--accent-hover);
}

/* ============================================
   STORY READER PANEL
   ============================================ */
.story-reader-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 280px;
  background: var(--bg-primary);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.story-reader-panel.active {
  transform: translateX(0);
}

.story-reader-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.story-reader-header {
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  z-index: 10;
}

.story-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1rem;
}

.story-back-btn:hover {
  background: var(--accent-light);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.story-reader-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.story-reader-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.story-reader-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--accent-light);
  color: var(--accent-color);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
}

.story-reader-time,
.story-reader-timeline {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* Story iframe - loads story content with complete isolation
   The story's original layout, styles, and scripts are fully preserved */
.story-iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 180px); /* Full height minus header */
  border: none;
  background: #ffffff;
}

/* Dark mode background for the iframe container */
[data-theme="dark"] .story-iframe {
  background-color: var(--bg-primary);
}

/* Loading state */
.story-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.story-error {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.story-error .btn-primary {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.story-error .btn-primary:hover {
  background: var(--accent-hover);
}

/* Responsive story reader */
@media (max-width: 768px) {
  .story-reader-panel {
    left: 0;
  }

  .story-reader-header {
    padding: 1rem;
  }

  .story-reader-title {
    font-size: 1.5rem;
  }

  .story-iframe {
    height: calc(100vh - 150px); /* Adjusted for smaller header on mobile */
  }
}

/* ============================================
   INCREASED FONT SIZES
   ============================================ */
.page-description {
  font-size: 1.1875rem;
}

.story-card-excerpt {
  font-size: 0.9375rem;
}

.story-card-title {
  font-size: 1.1875rem;
}

.story-card.featured .story-card-title {
  font-size: 1.625rem;
}

.nav-item {
  font-size: 1rem;
}

.card-description {
  font-size: 1rem;
}

.breadcrumb {
  font-size: 0.9375rem;
}

/* Breadcrumb story title truncation */
.breadcrumb-story {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
}
