/* Reset base styles */
body {
  font-family: 'Onset', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  color: #000;
  background-color: #fff;
}

/* Journal Page Styles */
#journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 32px;
  /* Allow grid to grow and fill available space */
  flex: 1;
}

.article-card {
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.article-image {
  height: 300px;
  background-size: cover;
  background-position: center;
}

.article-content {
  padding: 24px;
}

.article-date {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 8px;
  font-weight: 500;
}

.article-title {
  font-size: 32px;
  margin-bottom: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.article-excerpt {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 16px;
  line-height: 1.5;
}

.read-more {
  display: inline-block;
  color: #000;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
}

.read-more:hover {
  text-decoration: underline;
}

/* Journal Entry Detail Styles */
#journal-detail {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

/* Error page styling */
.error {
  text-align: center;
  padding: 2rem;
  color: #666;
}

.error-link {
  color: #000;
  text-decoration: underline;
  font-weight: 500;
}

.error-link:hover {
  text-decoration: none;
}

/* Journal Entry Layout */
.journal-entry {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Override main.css .content styles for journal page to prevent width constraints */
body[data-page="journal"] .content {
  /* Remove padding and max-width constraints from main.css */
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

.journal-content {
  max-width: 850px;
  margin: 0 auto;
  padding: 24px 2rem 2rem 2rem;
  width: 100%;
  /* Override main.css .content flexbox properties for journal page */
  display: block !important;
  flex: none !important;
}

/* We hide h1 in content since we display it separately in the hero section */
.journal-content h1 {
  display: none;
}

.journal-content p {
  font-size:  20px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.journal-content h2 {
  font-size: 38px;
  line-height: 1.2;
  font-weight: 600;
  margin: 24px 0 24px;
}

.journal-content img {
  max-width: 100%;
  height: auto;
  margin: 32px 0;
  border-radius: 4px;
  cursor: default; /* Remove pointer cursor */
}

/* Figure and figcaption styles for image descriptions */
.journal-content figure {
  margin: 48px 0 0 0;
  text-align: center;
}

.journal-content figcaption {
  font-size: 14px;
  color: #5f6368;
  margin-top: 6px;
  font-style: italic;
  line-height: 1.4;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.journal-content ul,
.journal-content ol {
  margin: 24px 0;
  padding-left: 34px;
}

.journal-content li {
  margin-bottom: 12px;
  font-size: 20px; /* Increased font size */
}

/* Link styles for journal content */
.journal-content a {
  color: var(--color-text);
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s ease;
}

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


/* External link indicator for better UX */
.journal-content a[href^="http"]:not([href*="kerezov.com"]):after {
  content: "↗";
  font-size: 0.85em;
}

/* Removed fixed date styling since we display it in the subtitle */

.journal-meta-bottom {
  margin-top: 50px;
  padding-top: 0px;
  font-size: 18px;
  color: #8a8e92;
}

.journal-meta-bottom .author,
.journal-meta-bottom .tags {
  display: block;
  margin-bottom: 8px;
  font-weight: 400;
}

/* Journal hero section */
.journal-hero {
  padding: 80px 0 0;
  position: relative;
  background-color: #fff;
}

.journal-hero .container {
  max-width: 850px;
  margin: 0 auto;
}

/* Main headline animation setup */
.journal-headline {
  font-size: 70px;
  line-height: 1.2;
  font-weight: 700;
  margin-bottom: 24px;
  overflow: hidden;
  color: #000;
}

/* Subtitle styling */
.journal-subtitle {
  font-size: 19px;
  color: #76777a;
  margin-bottom: 20px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.journal-subtitle span {
  margin-right: 24px;
}

/* Journal content layout */
.journal-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
}

/* For code blocks and lists in journal content */
.journal-content pre {
  background: var(--color-gray);
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* Ensure full interactivity on journal page */
body[data-page="journal"] main,
body[data-page="journal"] .content,
body[data-page="journal"] #journal-grid,
body[data-page="journal"] .article-card,
body[data-page="journal"] .article-content,
body[data-page="journal"] .article-link {
  pointer-events: auto;
}

/* Enable text selection on journal page */
body[data-page="journal"] {
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
  cursor: default;
}

/* Tablet Responsive adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
  .journal-hero {
    padding: 120px 0 70px;
  }

  .journal-headline {
    font-size: 42px;
  }

  .journal-content h1 {
    font-size: 42px;
  }

  .journal-content h2 {
    font-size: 28px;
    margin: 45px 0 22px;
  }

  .journal-content h3 {
    font-size: 22px;
    margin: 35px 0 18px;
  }

  .journal-content p {
    font-size: 17px;
    line-height: 1.7;
  }

  .journal-date {
    font-size: 15px;
  }

  .journal-entry {
    padding-bottom: 2.5rem;
  }
  
  .journal-content {
    padding: 0 1.5rem;
  }
}

/* Mobile Responsive adjustments */
@media (max-width: 768px) {
  .journal-hero {
    padding: 80px 0 50px;
  }

  .journal-headline {
    font-size: 32px;
    line-height: 1.1;
  }

  .journal-content h1 {
    font-size: 32px;
    line-height: 1.1;
  }

  .journal-content h2 {
    font-size: 22px;
    margin: 35px 0 18px;
  }

  .journal-content h3 {
    font-size: 18px;
    margin: 30px 0 15px;
  }

  .journal-content p {
    font-size: 15px;
    line-height: 1.6;
  }

  .journal-date {
    position: static;
    transform: none;
    margin-bottom: 12px;
    color: #5f6368;
    font-size: 14px;
  }

  .journal-entry {
    padding-bottom: 1.5rem;
  }
  
  .journal-content {
    padding: 0 1rem;
  }
  
  .journal-summary {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
  }
}

/* PDF Content Styles for Journal Articles */
.journal-content .pdf-title {
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 24px;
  color: #333;
  text-align: center;
}

.journal-content .pdf-container {
  margin: 32px 0 48px;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

/* PDF error styling for journal */
.journal-content .pdf-error {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  margin: 32px 0;
}

.journal-content .pdf-error p {
  margin-bottom: 16px;
  color: #666;
}

.journal-content .pdf-error a {
  color: #007acc;
  text-decoration: underline;
  font-weight: 500;
}

.journal-content .pdf-error a:hover {
  color: #005a99;
}