#single {
    padding: 60px 0;
    line-height: 1.7em;
    font-size: 17px;
}

#single .title > h1 {
    opacity: 0.8;
    color: var(--text-color) !important;
}

#single .title small {
    opacity: 0.7;
}

#single .featured-image {
    padding: 1rem;
    padding-top: 0;
}

#single .featured-image img {
    border-radius: 1rem;
    box-shadow: 0px 8px 56px rgba(15, 80, 100, 0.16);
    margin-bottom: 1rem;
    background-color: var(--secondary-color);
}

#single .page-content img {
    max-width: 100%;
    border-radius: 1rem;
}

#single .page-content img {
    max-width: 100%;
    border-radius: 1rem;
}

#single .page-content a {
    display: inline-block;
    text-decoration: none;
    color: var(--text-link-color) !important;
}

#single .page-content a::after {
    content: "";
    display: block;
    width: 0px;
    height: 2px;
    bottom: 0.37em;
    background-color: var(--primary-color);
    transition: all 0.25s cubic-bezier(0.645,0.045,0.355,1);
    opacity: 0.5;
}

#single .page-content a:hover::after, #single .page-content a:focus::after, #single .page-content a:active::after {
    width: 100%;
}

#single .page-content h1, #single .page-content h2, #single .page-content h3, #single .page-content h4, #single .page-content h5, #single .page-content h6 {
    color: var(--text-link-color) !important;
    margin-bottom: 0.7em;
    opacity: 0.9;
}

#single .page-content blockquote {
    padding: 20px 30px;
    border-left: 6px solid var(--primary-color) !important;
    color: var(--text-secondary-color) !important;
    font-weight: 600;
    font-size: 20px;
    margin: 30px 0;
    border-radius: 5px;
}

#single .page-content blockquote, #single .page-content blockquote * {
    background-color: var(--secondary-color) !important;
}

/* table */
/* General table styles (will apply if table is not in a wrapper) */
#single .page-content table {
    width: auto; /* This allows table to be naturally sized if not 100% */
    border-radius: 5px;
    /* padding: 0.1rem; -- Padding on the table itself might be redundant if wrapper has padding */
    margin-bottom: 1.2em;
    max-width: 100%;
    display: block; /* This combined with overflow-x makes it responsive */
    overflow-x: auto; /* For responsiveness on the table directly */
    opacity: 0.8; /* You have this, keep if desired */
    border-collapse: collapse; /* Good for consistent borders */
}

/* Your existing specific styles for table parts */
#single .page-content table > thead > tr > th {
    padding: 0.5rem !important;
    background-color: var(--primary-color) !important;
    color: var(--secondary-color) !important;
    border: 1px solid var(--secondary-color); /* Consider a more distinct border if --secondary-color is also cell bg */
    opacity: 0.9;
    text-align: left; /* Added for consistency */
}
#single .page-content table > tbody > tr > td {
    padding: 0.5rem !important;
    border: 1px solid var(--primary-color); /* Changed from --secondary-color to contrast with cell bg */
                                            /* Or use a dedicated border variable: var(--table-border-color) */
    background-color: var(--secondary-color) !important;
    opacity: 0.9;
    text-align: left; /* Added for consistency */
}

/* This rule seems to override individual cell backgrounds.
   If you want --secondary-color for the whole table bg,
   and then --primary-color for TH bg, it might conflict.
   Let's assume you want cell backgrounds to be dominant.
*/
/* #single .page-content table > thead > tr {
    background-color: var(--secondary-color) !important;
    color: var(--secondary-color) !important;
} */
/* This rule #single .page-content table > tr { height: 40px !important; } can be kept if desired */

/* === UNIFIED STYLES FOR CAPTION TEXT (Applies to image, table, AND video captions) === */

#single .page-content .image-with-caption .caption-text,
#single .page-content .table-caption-wrapper .table-caption-text,
#single .page-content .video-with-caption .caption-text { /* ADDED THIS SELECTOR */
    color: var(--primary-color);
    text-align: center;
    font-size: 13px;
    font-style: italic;
    margin-top: 0;
    margin-bottom: 0;
}

/* === STYLES FOR IMAGE WITH CAPTION COMPONENT (SIDE-BY-SIDE FLEX) === */
#single .page-content .image-with-caption {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.2em;
    flex-wrap: wrap; 
    background-color: var(--secondary-color) !important;
    padding: 1rem;
    border-radius: 0.7rem;
    box-sizing: border-box;
}

#single .page-content .image-with-caption img {
    order: 1; 
    flex-basis: 60%;
    max-width: 60%;
    flex-shrink: 0;
    height: auto;
    border-radius: 0.5rem; 
}

#single .page-content .image-with-caption .caption-text {
    order: 2; 
    flex-basis: 35%;
    max-width: 35%;
    flex-grow: 1;
}

/* === STYLES FOR TABLE WITH CAPTION COMPONENT (SIDE-BY-SIDE FLEX) === */
#single .page-content .table-caption-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.2em; 
    flex-wrap: wrap; 
    background-color: var(--secondary-color) !important;
    padding: 1rem;
    border-radius: 0.7rem;
    box-sizing: border-box;
    max-width: 100%;
}

#single .page-content .table-caption-wrapper .table-responsive-container {
    order: 1;
    flex-basis: 65%;
    max-width: 65%;
    flex-shrink: 0; /* Prevent it from shrinking if caption is short */

    max-height: 60vh;   /* Or your preferred desktop max-height (e.g., 600px) */
    overflow-y: auto;   /* Enable vertical scrolling for tall tables */
    overflow-x: auto;   /* Keep for wide tables */
}

#single .page-content .table-caption-wrapper .table-caption-text {
    order: 2;
    flex-basis: 30%;  /* Current value */
    max-width: 30%;   /* Current value */
    flex-grow: 1;     /* Current value, allows it to take space if table is < 65% */
    /* min-width: 150px; /* Optional, if you want to ensure it has a minimum width */

    /* --- ADDED: To help vertically center the text within its own box --- */
    /* This is helpful if the caption box itself becomes taller due to align-items: center
       on the parent, especially if the table box is tall. */
    display: flex;          /* Make the caption paragraph a flex container for its text */
    flex-direction: column; /* Stack its lines of text (if it wraps) */
    justify-content: center;/* Vertically center the text content within the caption box */
                            /* For a single line of text, this will center it. */
                            /* For multiple lines, it centers the block of text. */
    /* text-align: center; is from the unified rule and centers text horizontally */
}

/* === STYLES FOR VIDEO WITH CAPTION COMPONENT (SIDE-BY-SIDE FLEX) === */
#single .page-content .video-with-caption {
    display: flex;
    align-items: center; /* Vertically align video and caption if heights differ */
    gap: 15px;           /* Space between video and caption */
    margin-bottom: 1.2em; /* Consistent with other caption components */
    flex-wrap: wrap;     /* Allow caption to wrap below video if space is tight */
    background-color: var(--secondary-color) !important; /* Consistent background */
    padding: 1rem;       /* Consistent padding */
    border-radius: 0.7rem; /* Consistent rounding */
    box-sizing: border-box;
    max-width: 100%;     /* Ensure wrapper doesn't exceed parent column width */
}

#single .page-content .video-with-caption .video-container {
    order: 1;         /* Video on the left */
    flex-basis: 60%;  /* Video takes ~60% of space (adjust as needed) */
    max-width: 60%;   /* Video capped at ~60% (adjust as needed) */
    flex-shrink: 0;   /* Don't let video container shrink if caption is short */
    line-height: 0;   /* Fix potential extra space below video */
}

#single .page-content .video-with-caption .video-container video {
    width: 100%;      /* Make video fill its container (.video-container) */
    height: auto;     /* Maintain aspect ratio */
    display: block;   /* Remove extra space below if video is inline */
    border-radius: 0.5rem; /* Optional: round corners of video player */
}

#single .page-content .video-with-caption .caption-text {
    order: 2;         /* Caption on the right */
    flex-basis: 35%;  /* Caption takes ~35% (adjust as needed, ensure sum with video basis + gap is reasonable) */
    max-width: 35%;   /* Caption capped at ~35% (adjust as needed) */
    flex-grow: 1;     /* Caption can grow if video is narrower than its basis */
    /* Font styles are handled by the unified caption rules below */
}

/* === RESPONSIVE STACKING FOR IMAGE, TABLE, & VIDEO CAPTION COMPONENTS === */
@media (max-width: 768px) {
    #single .page-content .image-with-caption,
    #single .page-content .table-caption-wrapper,
    #single .page-content .video-with-caption { /* ADDED THIS SELECTOR */
        flex-direction: column;
        align-items: center; 
    }

/* Styling for stacked IMAGE and VIDEO containers (width and margins) */
#single .page-content .image-with-caption img,
#single .page-content .video-with-caption .video-container {
    order: 1;
    flex-basis: auto;
    width: 100%;    /* Image/Video container takes full 90% width available */
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 10px;
}

/* Styling for stacked TABLE container (width, margins, AND height constraint) */
#single .page-content .table-caption-wrapper .table-responsive-container {
    order: 1;
    flex-basis: auto;
    width: 100%;    /* Table container takes full 90% width available */
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 10px;
    /* --- ADDED for tall tables --- */
    max-height: 60vh; /* Example: Max height is 60% of viewport height. Adjust as needed. */
                       /* You could also use a pixel value like 400px or 500px. */
    overflow-y: auto; /* Enable vertical scrolling if table content is taller than max-height */
    /* overflow-x: auto; is already set from desktop styles and should persist for wide tables */
}

    /* Styling for the caption text block when stacked */
    #single .page-content .image-with-caption .caption-text,
    #single .page-content .table-caption-wrapper .caption-text,
    #single .page-content .video-with-caption .caption-text { /* ADDED THIS SELECTOR */
        order: 2; 
        flex-basis: auto; 
        width: 90%;       
        max-width: 90%;   
        /* text-align: center; is inherited from the unified rule above */
    }
}

/* General rule for non-shortcode image captions, if still needed */
img + p > em:only-child {
  display: block;
  font-style: italic;
  font-size: 13px; /* CHANGED: Set to the same fixed pixel size */
  text-align: center;
  color: var(--primary-color);
  margin-top: 0.35em;
  margin-bottom: 1.25em;
}

#single .page-content pre {
  border-radius: 0.7em !important;
  margin: 5px;
  margin-bottom: 2em;
  padding: 2em;
  background-color: var(--secondary-color) !important;
  color: var(--text-secondary-color) !important;
  max-height: 450px;
}

#single .page-content pre > code {
  color: var(--text-secondary-color) !important;
}

#single .page-content code {
  color: var(--primary-color) !important;
}

/* kbd and mark */

#single .page-content kbd {
  color: var(--primary-color) !important;
  background-color: var(--secondary-color) !important;
}

#single .page-content mark {
  color: var(--primary-color) !important;
  background-color: var(--secondary-color) !important;
}

/* list */

#single .page-content ol, #single .page-content ul {
    margin-bottom: 1.2em;
    padding-left: 1.5em;
    list-style-position: inside;
    opacity: 0.9;
}

#single .page-content ol li li, #single .page-content ul li li {
    margin-bottom: 0.5em;
    padding-left: 1.5em;
}

/* sidebar */

#single aside {
    background-color: var(--secondary-color);
    border-radius: .7rem;
    padding: .7rem 1rem;
    margin-bottom: 1em;
}

#single .sticky-sidebar {
  position: sticky;
}

#single .sticky-sidebar ::-webkit-scrollbar {
    height: 0px;
    width: 8px;
}

/* Tags */
#single aside.tags {
    max-height: 35vh;
    overflow: scroll;
}

#single aside.tags h5 {
    margin: .7em 0;
    margin-bottom: 1em;
}


#single aside.tags ul.tags-ul li a {
    padding: 5px 10px;
    margin-bottom: 2px;
    border-radius: 10px;
    background-color: var(--background-color);
    text-decoration: none;
    color: var(--text-link-color) !important;
}

#single aside.tags ul.tags-ul li {
    margin-bottom: 0.8rem;
}

#single aside.tags ul.tags-ul li:hover {
    opacity: 0.8;
}


/*TOC*/
#single aside.toc {
    padding: .7rem 1rem;
    max-height: 50vh;
    overflow: scroll;
}

#single aside.toc h5 {
    margin: .7em 0;
    margin-bottom: 1em;
    color: var(--text-color);
}

#single aside.toc .toc-content ol, #single aside.toc .toc-content ul {
    margin-bottom: 1em;
    padding-left: .5em;
    list-style: none;
    opacity: 0.9;
}

#single aside.toc .toc-content ol li a, #single aside.toc .toc-content ul li a {
    font-size: 16px;
    text-decoration: none;
    color: var(--text-link-color) !important;
    opacity: 0.9;
}

#single aside.toc .toc-content ol li a:hover, #single aside.toc .toc-content ul li a:hover {
    color: var(--primary-color);
    opacity: 1.2;
}

#single aside.toc .toc-content ol li li, #single aside.toc .toc-content ul li li {
    padding-left: .7em;
}

/* Social */

#single aside.social {
    padding: .7rem 1rem;
}

#single aside.social h5 {
    margin: .7em 0;
    margin-bottom: 1em;
    color: var(--text-color);
}

#single aside.social .social-content {
    margin-bottom: 1em;
    opacity: 0.9;
}

#single aside.social .social-content ul {
    margin-bottom: 1em;
    opacity: 0.9;
}

#single aside.social .social-content ul li a {
    border: 1px solid var(--primary-color);
    padding: .7rem;
    color: var(--text-link-color) !important;
    border-radius: 10px;
    overflow: hidden;
}

#single aside.social .social-content ul li {
    margin: .7rem .5rem;
    margin-left: 0;
}

#single aside.social .social-content ul li:hover a {
    opacity: .8;
    color: var(--text-link-color) !important;
}

/* Top scroll */

#single #topScroll {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 10px;
}

#single #topScroll:hover {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    transition: .5s;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
}

/* Singlepage scroll progress start */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--background-color);
    z-index: 999;
}

.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: var(--primary-color);
    transition: width .2s;
}

/* Singlepage scroll progress end */

/* === CUSTOM THEMED BUTTON (To EXACTLY Match #contact .btn) === */
.btn-custom-themed {
  /* Base button styles - trying to establish these without relying on an external .btn class */
  display: inline-block;
  font-weight: 400;     /* COMMON DEFAULT - ADJUST if "Mail me" is different */
  line-height: 1.5;       /* COMMON DEFAULT - ADJUST if "Mail me" is different */
  text-align: center;
  text-decoration: none !important;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 1rem; /* COMMON PADDING - VERY IMPORTANT TO MATCH "Mail me" button's actual padding */
  font-size: 1rem;      /* COMMON FONT-SIZE - ADJUST to match "Mail me" */

  /* Styles directly from #contact .btn */
  background-color: var(--secondary-color) !important;
  color: var(--text-color) !important;
  border: 1px solid var(--primary-color) !important; /* Ensure full border definition */
  border-radius: .5rem !important;

  /* Transition - ONLY for opacity, to match #contact .btn */
  transition: opacity 0.3s ease-in-out; /* REMOVED transform and box-shadow from transition */
}

.btn-custom-themed:hover,
.btn-custom-themed:focus { /* Grouped hover and focus for consistent opacity change */
  opacity: .7;                 /* This is the hover effect from #contact .btn */
  text-decoration: none !important;
  /* NO transform: translateY(-2px); -- Animation removed */
  /* Ensure colors don't change from other hover rules if not intended */
  color: var(--text-color) !important;
  background-color: var(--secondary-color) !important;
  border-color: var(--primary-color) !important;
}

.btn-custom-themed:focus {
  box-shadow: none !important;   /* Matches #contact .btn:focus */
  outline: 0;                    /* Good practice to remove default outline if using custom focus (or none) */
}

.btn-custom-themed:active {
  /* If #contact .btn has a specific :active style (e.g., different opacity), replicate it here. */
  /* For now, let's assume it might just use the hover opacity or a slight press */
  opacity: .8; /* Example: slightly less transparent than hover when pressed */
  /* NO transform for active state if there's no hover transform */
}