
.wrapped-image {
  float: right;
  display: table;          /* make this a CSS table */
  margin: 0 0 1em 1em;     /* gap to the left & below */
  max-width: 50%;          /* but never more than half the text-block */
}

.wrapped-image img {
  display: table-cell;     /* become the sole table cell */
  max-width: 100%;         /* never exceed the table's width */
  height: auto;            /* preserve aspect ratio */
}

.wrapped-image figcaption {
  display: table-caption;  /* pull it out of the table's width calculation */
  caption-side: bottom;    /* position it below the "table" */
  margin-top: 0.5em;
  font-size: 0.9em;
  line-height: 1.4;
  /* you can force long URLs to break rather than overflow */
  overflow-wrap: anywhere;
}

.wrapped-image figcaption br {
  display: none;  /* hide the line break that's causing extra space */
}

/* optional styling for your two caption spans */
.wrapped-image .caption-text {
  display: block;
  margin-bottom: 0.3em;
  font-style: italic;
}

.wrapped-image .caption-source {
  display: block;
  font-size: 0.8em;
  color: #999;
}

/* optional: on very narrow viewports, drop the float and go full-width */
@media (max-width: 600px) {
  .wrapped-image {
    float: none;
    margin: 1em auto;
    max-width: 100%;
  }
}

/* Responsive video container */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 1em 0;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Post tags styling */
.post-tags {
  margin: 0.5rem 0 1.5rem 0;
  padding: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-link {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background-color: #f8f8f8;
  color: #888;
  text-decoration: none;
  border-radius: 12px;
  font-size: 0.8rem;
  border: 1px solid #e8e8e8;
  transition: all 0.2s ease;
}

.tag-link:hover {
  background-color: #e8e8e8;
  color: #555;
  text-decoration: none;
}

/* Tags section styling */
.tags-tree {
  margin-top: 0.5rem;
}

.tag-item {
  margin-bottom: 0.25rem;
}

.tag-item a {
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  transition: background-color 0.2s;
}

.tag-item a:hover {
  background-color: rgba(255,255,255,0.1);
}

/* Tag pages styling */
.tag-page h1 {
  margin-bottom: 1rem;
  color: #303030;
}

.post-preview {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.post-preview h3 {
  margin: 0 0 0.5rem 0;
}

.post-preview h3 a {
  color: #303030;
  text-decoration: none;
}

.post-preview h3 a:hover {
  text-decoration: underline;
}

.post-meta {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.post-meta span {
  margin-right: 1rem;
}

.post-excerpt {
  color: #555;
  line-height: 1.5;
}

.tag-navigation {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.back-to-tags {
  color: #666;
  text-decoration: none;
}

.back-to-tags:hover {
  text-decoration: underline;
}

/* Tags index page styling */
.tags-index h1 {
  margin-bottom: 1.5rem;
  color: #303030;
}

.tag-entry {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: none;
}

.tag-entry h3 {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.2;
}

.tag-entry h3 a {
  color: #303030;
  text-decoration: none;
  font-size: 0.9rem;
}

.tag-entry h3 a:hover {
  text-decoration: underline;
}

.tag-count {
  font-weight: normal;
  color: #666;
  font-size: 0.9rem;
}

.tag-posts-preview {
  margin-left: 1rem;
}

.post-link {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.post-link a {
  color: #555;
  text-decoration: none;
}

.post-link a:hover {
  text-decoration: underline;
}

.post-date {
  color: #999;
  margin-left: 0.5rem;
}

.more-posts {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.more-posts a {
  color: #666;
  text-decoration: none;
}

.more-posts a:hover {
  text-decoration: underline;
}

/* Font family overrides */
html {
  font-family: "Source Serif Pro", Georgia, "Times New Roman", serif;
}

h1, h2, h3, h4, h5, h6 {
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
}

.sidebar {
  font-family: "Source Sans Pro", Helvetica, Arial, sans-serif;
}

/* Always visible sidebar modifications */
.sidebar {
  left: 0 !important;
  visibility: visible !important;
  z-index: 10;
  background-color: #4a4a4a !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Ensure content never flows under sidebar */
.wrap {
  margin-left: 14rem;
  width: calc(100% - 14rem);
  box-sizing: border-box;
}

/* Sidebar hero image styling */
.sidebar-hero {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-hero-image {
  width: 100%;
  height: auto;
  display: block;
}

/* Hide the sidebar toggle button since sidebar is always visible */
.sidebar-toggle {
  display: none !important;
}
@media (min-width: 38em) {
  .container {
    max-width: 32rem;
  }
}
@media (min-width: 56em) {
  .container {
    max-width: 38rem;
  }
}

/* Post link colors */
.post a,
.post a:link,
.post a:visited {
  color: #8B0000; /* Apple's cayenne color */
  text-decoration: none;
}

.post a:hover,
.post a:focus {
  color: #8B0000;
  text-decoration: underline;
}

.post a:active {
  color: #5D0000; /* Darker version of cayenne for clicked state */
}

/* Copyright footer styling */
.sidebar-item:last-child {
  margin-top: auto;
}

/* Responsive adjustments for mobile */
@media (max-width: 48em) {
  .sidebar {
    position: fixed;
    left: -14rem !important;
    visibility: hidden !important;
    z-index: 10;
  }
  
  .wrap {
    margin-left: 0;
    width: 100%;
  }
  
  .sidebar-toggle {
    display: flex !important;
  }
  
  /* Restore toggle functionality on mobile */
  #sidebar-checkbox:checked + .sidebar {
    left: 0 !important;
    visibility: visible !important;
    transform: none !important;
  }
  
  #sidebar-checkbox:checked ~ .wrap {
    margin-left: 14rem;
    width: calc(100% - 14rem);
    transform: none !important;
  }
}

/* Figure styling */
figure {
  text-align: center;
  margin: 1.5em auto;
  max-width: 100%;
}

/* Override wrapped-image styling for centered figures */
figure:not(.wrapped-image) {
  float: none;
  margin: 1.5em auto;
  max-width: 100%;
}

figure img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* Figure caption styling */
figcaption {
  text-align: center;
  margin-top: 0.5em;
  max-width: 100%;
}

figcaption .caption-text {
  font-weight: normal;
  color: #333;
}

figcaption .caption-source {
  font-size: 0.8rem;
  color: #666;
  font-style: italic;
}

figcaption .caption-source a,
figcaption .caption-source a:link,
figcaption .caption-source a:visited {
  color: #666 !important;
  text-decoration: none;
}

figcaption .caption-source a:hover,
figcaption .caption-source a:focus {
  text-decoration: underline;
  color: #555 !important;
}

figcaption .caption-source a:active {
  color: #444 !important;
}
