/* Custom Styles */

/* Back Button Styles */
.back-button-container {
  position: relative;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text);
  text-decoration: none;
  font-size: var(--scale-sm);
  transition: all 0.2s ease;
}

.back-button:hover {
  color: var(--text);
  text-decoration: none;
}

.back-button svg {
  width: 14px;
  height: 14px;
}

@media (min-width: 768px) {
  .back-button-container {
    position: fixed;
    left: 8rem;
    top: 8rem;
    z-index: 100;
    margin-bottom: 0;
  }
}

/* H1 Margin */
h1 {
  margin-bottom: var(--space-lg);
}

/* Global External Link Icons */
:root {
    a[href^="http://"]:after, a[href^="https://"]:after {
        content: '';
        display: inline-block;
        width: 10px;
        height: 10px;
        margin-left: 0.25em;
        vertical-align: text-top;
        background-image: url('data:image/svg+xml;utf8,%3Csvg%20width=%2210%22%20height=%2210%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cpath%20d=%22M5%2019L19%205M5%205h14v14%22%20stroke=%22%2340513B%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22/%3E%3C/svg%3E');
        background-size: contain;
        background-repeat: no-repeat;
        opacity: 0.7;
    }
}

[data-theme="dark"] {
    a[href^="http://"]:after, a[href^="https://"]:after {
        background-image: url('data:image/svg+xml;utf8,%3Csvg%20width=%2210%22%20height=%2210%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cpath%20d=%22M5%2019L19%205M5%205h14v14%22%20stroke=%22%23E7EDE3%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22/%3E%3C/svg%3E');
    }
}

/* Exclude from certain elements */
.toc-list a[href^="http://"]:after, 
.toc-list a[href^="https://"]:after,
.nav a[href^="http://"]:after, 
.nav a[href^="https://"]:after,
.footer a[href^="http://"]:after, 
.footer a[href^="https://"]:after {
  display: none;
}

/* Special handling for card grid - icon appears next to h4 */
.card-grid a[href^="http://"]:after, 
.card-grid a[href^="https://"]:after {
  display: none;
}

.card-grid a[href^="http://"] h4:after, 
.card-grid a[href^="https://"] h4:after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 0.25em;
  vertical-align: text-top;
  background-image: url('data:image/svg+xml;utf8,%3Csvg%20width=%2210%22%20height=%2210%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cpath%20d=%22M5%2019L19%205M5%205h14v14%22%20stroke=%22%2340513B%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22/%3E%3C/svg%3E');
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.7;
}

[data-theme="dark"] .card-grid a[href^="http://"] h4:after, 
[data-theme="dark"] .card-grid a[href^="https://"] h4:after {
  background-image: url('data:image/svg+xml;utf8,%3Csvg%20width=%2210%22%20height=%2210%22%20viewBox=%220%200%2024%2024%22%20fill=%22none%22%20xmlns=%22http://www.w3.org/2000/svg%22%3E%3Cpath%20d=%22M5%2019L19%205M5%205h14v14%22%20stroke=%22%23E7EDE3%22%20stroke-width=%222%22%20stroke-linecap=%22round%22%20stroke-linejoin=%22round%22/%3E%3C/svg%3E');
}

/* Library Description Link Styles */
.library-description a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.library-description a:hover {
  color: var(--title);
  text-decoration-thickness: 2px;
}

.library-description .wiki-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.library-description .wiki-link:hover {
  border-bottom-color: var(--text);
  color: var(--title);
}

/* Generic List Page Styles */
.list-items {
  list-style: none;
  padding: 0;
}

.list-items li {
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.list-items li:last-child {
  border-bottom: none;
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.list-content {
  flex: 1;
}

.list-title {
  margin-bottom: var(--space-xs);
}

.list-title a {
  color: var(--title);
  text-decoration: none;
  font-weight: var(--weight-medium);
}

.list-title a:hover {
  color: var(--text);
  text-decoration: underline;
}

.list-meta {
  color: var(--text);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  opacity: 0.8;
  border: 1px solid var(--border);
}

.list-description {
  margin-top: var(--space-sm);
  color: var(--text);
  font-size: var(--scale-sm);
  line-height: 1.6;
}

.list-location {
  margin-top: var(--space-xs);
  color: var(--text);
  font-size: var(--scale-xs);
  opacity: 0.7;
  font-style: italic;
}

@media (max-width: 768px) {
  .list-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .list-meta {
    align-self: flex-start;
  }
}

/* Generic small link style */
.small-link {
  font-size: var(--scale-xs);
  color: var(--text);
  opacity: 0.7;
}

.small-link a {
  text-decoration: none;
  color: var(--text);
  opacity: 0.7;
}

.small-link a:hover {
  text-decoration: underline;
  opacity: 1;
}

/* Project Item Styles - Simplified to match notes design */
.project-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  /*margin-bottom: var(--space-md);*/
  border-bottom: 1px solid var(--border);
}

.project-item:last-child {
  border-bottom: none;
}

.project-content {
  flex: 1;
}

.project-title {
  margin: 0 0 var(--space-sm) 0;
  color: var(--title);
}

.project-title a {
  color: var(--title);
  text-decoration: none;
}

.project-title a:hover {
  color: var(--text);
  text-decoration: underline;
}

.project-description {
  margin: 0;
  color: var(--text);
  font-size: var(--scale-sm);
  line-height: 1.5;
  opacity: 0.8;
}

.project-description:hover {
  text-decoration: none;
}

.project-period {
  flex-shrink: 0;
}

.period-pill {
  display: inline-block;
  padding: 2px 6px;
  color: var(--text);
  font-size: var(--scale-xs);
  opacity: 0.7;
  white-space: nowrap;
}

/* Library Item Styles - Matching project layout exactly */
.library-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.library-item:last-child {
  border-bottom: none;
}

.library-content {
  flex: 1;
}

.library-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.library-title-text {
  color: var(--title);
  font-size: var(--scale-base);
  font-weight: var(--weight-medium);
  flex: 1 1 auto;
  min-width: 0;
}

.library-title-text a {
  color: var(--title);
  text-decoration: none;
}

.library-title-text a:hover {
  color: var(--text);
  text-decoration: underline;
}

.library-description {
  margin: 0;
  color: var(--text);
  font-size: var(--scale-sm);
  line-height: 1.5;
  opacity: 0.8;
}

.library-description p {
  margin: 0;
  display: inline;
}

.library-description p:not(:last-child)::after {
  content: " ";
}

.library-date {
  color: var(--text);
  font-size: var(--scale-xs);
  opacity: 0.7;
  font-style: normal;
  margin-left: 0;
  display: inline;
}

.type-pill {
  display: inline-block;
  padding: 2px 6px;
  color: var(--text);
  font-size: var(--scale-xs);
  opacity: 0.7;
  white-space: nowrap;
  text-transform: capitalize;
  border: 1px solid var(--bg2);
  border-radius: 2em;
  margin-left: 1em;
  margin-right: 0;
  flex-shrink: 0;
}

/* Fix external link icon positioning for library titles */
.library-title a[href^="http://"]:after, 
.library-title a[href^="https://"]:after {
  vertical-align: middle;
  margin-left: 0.25em;
  width: 10px;
  height: 10px;
}

@media (max-width: 768px) {
  .project-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .project-period {
    align-self: flex-start;
  }
  
  .library-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
}

/* Notes and Project List Styles */
.notelist-feed p {
  margin: 0;
  padding-bottom: 0;
}

.notelist-feed a {
  color: inherit;
}

/* Underline on hover for notes list only (not projects) */
.notelist-feed:not(.project-item) a:hover {
  text-decoration: underline;
}

/* Library Filter Styles */
.library-filter {
  margin: var(--space-lg) 0 var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.filter-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.filter-label {
  color: var(--text);
  font-size: var(--scale-sm);
  font-weight: var(--weight-medium);
  opacity: 0.8;
}

.filter-dropdown {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--text);
  font-size: var(--scale-sm);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  min-width: 120px;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
}

.filter-dropdown:hover {
  border-color: var(--title);
}

.filter-dropdown:focus {
  outline: none;
  border-color: var(--title);
  box-shadow: 0 0 0 2px rgba(var(--title-rgb), 0.1);
}

@media (max-width: 768px) {
  .filter-container {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }
  
  .filter-dropdown {
    align-self: flex-end;
  }
}

/* Library Filter Badge Styles */
.filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: flex-end;
  margin-bottom: var(--space-md);
}

.filter-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-size: var(--scale-xs);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  outline: none;
  text-transform: capitalize;
}

.filter-badge.active, .filter-badge:focus {
  background: var(--bg2);
  border-color: var(--title);
}

.filter-badge:hover {
  background: var(--border);
  color: var(--title);
}

@media (max-width: 768px) {
  .filter-badges {
    justify-content: flex-start;
  }
}

/* Page Header with Description */
.page-header {
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  margin-bottom: var(--space-xs);
}

.page-header p {
  margin: 0;
  color: var(--text);
  font-size: var(--scale-base);
  line-height: 1.6;
  opacity: 0.8;
}
