/* Page-Specific Styles (e.g., Entry Page) */

/* New container for the entire page content to manage overall flow */
.entry-page-container {
  padding: 20px; /* Consistent padding around the entire entry content */
  max-width: 1200px;
  margin: 0 auto; /* Center the content */
}

/* Entry Title (Full Width) */
.entry-title {
  color: black;
  margin-bottom: 20px; /* Space below the title */
  font-size: 2.4rem; /* Example size, adjust as needed */
  text-align: left; /* Align title to left */
  width: 100%; /* Ensure it takes full width */
}

/* Main Content Layout Container (Manages side-by-side elements on desktop) */
.main-content-layout {
  display: flex; /* Enable flexbox */
  flex-wrap: wrap; /* Allow wrapping for mobile */
  gap: 30px; /* Space between content and info box */
  align-items: flex-start; /* Align items to the top */
}

/* Main Content Area (Entry Page Specific) Styles */
.entry-content { /* Renamed from .main-content to .entry-content for clarity */
  flex: 1; /* Allows this to grow and take available space */
  min-width: 300px; /* Minimum width before wrapping */
  text-align: justify;
  overflow: hidden; /* Contains floats if any internal elements use them */
}

.entry-content li {
  font-family: 'Roboto', sans-serif;
  font-size: 1.4rem;
  list-style: disc;
}

textarea {
  height: 90vh;
  width: 80%;
}

.entry-content p {
  margin-top: 0;
  margin-bottom: 16px;
  line-height: 1.4;
}

.entry-content strong { font-weight: normal; }

.entry-content h4 {
  margin-bottom: 16px;
  font-size: 1.6rem;
}

.entry-content h5 {
  margin-bottom: 16px;
  font-size: 1.4rem;
}

.entry-content a {
  margin-bottom: 16px; /* May not apply to all 'a' elements, but kept as specified */
  color: #01990e; /* Specific link color for main content */
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
  margin-top: 20px;
  margin-bottom: 15px;
  font-weight: normal;
  color: var(--primary-color);
}

/* --- Image and Bio Box Styles --- */
.image_bio_box {
  width: 220px; /* Fixed width for the sidebar info box on desktop */
  flex-shrink: 0; /* Prevent it from shrinking */
  margin-left: 0; /* Remove float-related margin */
  margin-bottom: 10px;
  display: flex; /* Enable flexbox for its internal elements */
  flex-direction: column; /* Stack image and bio box vertically */
  gap: 20px; /* Space between image and bio box */
}

.main-image {
  width: 200px; /* Specific width */
  height: 200px; /* Specific height */
  border-radius: 10px;
  margin: 0 auto; /* Center the image within its container */
  object-fit: cover;
  display: block;
  box-shadow: var(--box-shadow);
}

.bio_box {
  max-width: fit-content; /* fixed spacing typo */
  margin-top: 0; /* Reset margin-top from previous float-based layout */
  background: var(--light-bg);
  padding: 20px;
  border-radius: var(--border-radius);
  border: 1px solid #ccc; /* Optional: add border for distinction */
  height: auto; /* Allow height to adjust based on content */
}

.bio_content {
  min-width: 100%;
  word-wrap: break-word;
  margin-bottom: 15px;
  height: auto; /* Allow height to adjust based on content */
}

#birth-info {
  font-style: italic;
  color: var(--light-text);
}

.no-image {
  /*background: var(--light-bg);
  padding: 40px;
  text-align: center;
  border-radius: var(--border-radius);
  color: var(--light-text);*/
  display: none;
}

/* Metadata and Action Sections */
.entry-metadata,
.entry-actions {
  clear: both; /* Ensure these appear below any floated content */
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

/* --- Entry Metadata Styles (rest unchanged) --- */
.entry-category,
.entry-tags,
.entry-references { margin-bottom: 25px; }

.entry-tags ul,
.entry-references ul {
  list-style-type: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.entry-tags li,
.entry-references li {
  background: var(--light-bg);
  padding: 5px 12px;
  border-radius: var(--border-radius);
}

.entry-references li {
  background: transparent;
  padding: 0;
}

.entry-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entry-actions .action-link {
  all: unset;
  display: inline-block;
  font-family: 'Roboto', sans-serif;
  font-size: 1.2rem;
  color: var(--primary-color);
  cursor: pointer;
  padding: 4px 6px;
  margin-right: 10px;
}

.entry-actions .action-link:hover { text-decoration: underline; }

.link-separator {
  margin: 8px 15px;
  color: var(--primary-color);
}

/* --- Markdown Image Styles --- */
.mkdwn_image {
  max-width: 20%;
  height: auto;
  border: 2px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin: 15px 15px 0;
  float: right; /* Kept float for markdown images within the text */
}

/* --- Table Styles --- */
.bio_content table {
  width: 200px;
  border-collapse: collapse;
  border-bottom: 2px solid #fcfbfb;
  margin: 20px 0;
  font-size: 1.6rem;
  text-align: left;
}

.bio_content table th,
.bio_content table td {
  padding: 10px;
  font-size: 1.35rem;
  border-bottom: 2px solid #c9c8c8;
  font-family: 'Roboto', sans-serif;
}

.entry-content th,
.entry-content td {
  padding: 10px;
  font-size: 1.35rem;
  border-bottom: 2px solid #fcfbfb;
  font-family: 'Roboto', sans-serif;
  /* white-space: nowrap; */
  /*max-width: none;*/
}

.entry-content th { background-color: #bdbcbc; }

/* ----------------- Search results ----------------- */
.search-results {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 12px;
}

/* Modern (Grid) */
@supports (display: grid) {
  .search-card {
    display: grid;
    /* image left (auto), text fills remaining (1fr) */
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
  }

  /* Collapse to one column when no image */
  .search-card:not(.has-thumb) {
    grid-template-columns: 1fr;
  }

  .search-card:not(.has-thumb) .result-text {
    grid-column: 1 / -1;
  }

  .result-link {
    display: contents;
    color: inherit;
    text-decoration: none;
  }

  .result-text {
    grid-column: 2;
    min-width: 0;
  }

  .result-thumb {
    grid-column: 1;
    width: 200px;
    height: 197px;
    object-fit: cover;
    border-radius: 10px;
    background: #f5f5f5;
  }

  .result-title {
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e6e6e6;
    font-weight: 700;
    line-height: 1.2;
    font-size: 1.8rem;
  }

  .result-snippet {
    margin: 10px 0 0;
    color: #444;
    font-size: 1.5rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;  /* older WebKit/Blink */
    line-clamp: 3;          /* standard */
    overflow-wrap: anywhere;
  }
}

/* Fallback (Flexbox) */
@supports not (display: grid) {
  .search-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fff;
    gap: 16px;
  }

  .result-link {
    display: flex;
    width: 100%;
    color: inherit;
    text-decoration: none;
    gap: 16px;
    align-items: stretch;
    flex-direction: row;
  }

  .result-thumb {
    flex: 0 0 300px;
    width: 300px;
    height: 280px;
    object-fit: cover;
    border-radius: 10px;
    background: #f5f5f5;
  }

  .result-text {
    flex: 1 1 auto;
    min-width: 0;
  }

  .result-title {
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e6e6e6;
    font-weight: 700;
    line-height: 1.2;
    font-size: 1.8rem;
  }

  .result-snippet {
    margin: 10px 0 0;
    color: #444;
    font-size: 1.5rem;
    overflow: hidden;
    max-height: 4.6em;           /* ~3 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    word-break: break-word;
  }

  .search-card:not(.has-thumb) .result-link { gap: 0; }
}

/* Prefer standard clamp when supported */
@supports (line-clamp: 3) {
  .result-snippet { display: block; }
}

/* Responsive tweak: stack image on top */
@media (max-width: 620px) {
  @supports (display: grid) {
    .search-card.has-thumb {
      grid-template-columns: 1fr;
      grid-template-rows: auto auto;
    }
    .result-thumb {
      grid-row: 1;
      grid-column: 1;
      width: 100%;
      height: auto;
      justify-self: start;
    }
    .result-text {
      grid-row: 2;
      grid-column: 1;
    }
  }
  @supports not (display: grid) {
    .result-link { flex-direction: column; }
    .result-thumb {
      order: 1;
      width: 100%;
      height: auto;
      align-self: flex-start;
    }
    .result-text { order: 2; }
  }
}
