/* Journal entry pages (generated by scripts/journal-cms.js). Kept in its own file
   so the browser downloads it once and reuses it for every entry */

.entry-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2em;
}

h1, h2, h3 {
    color: var(--text-color);
}


.logo {
    text-align: center;
    font-family: var(--font-secondary);
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.logo a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.logo a:hover {
    color: var(--text-color);
}

/* Font Awesome glyphs (ICONS at the top of this file) */
.glyph {
    margin-right: 0.35em;
}

/* Centered header, like the page titles on Journal and Voice Acting:
   back link, title, subtitle, date, then a squiggle into the post */
.entry-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: var(--space-6);
    text-align: center;
}

.entry-header::after {
    content: "";
    width: 4.5rem;
    height: 0.7rem;
    margin-top: var(--space-6);
    background: var(--accent-color);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10'%3E%3Cpath d='M2,6 Q10,3 20,4.5 Q30,6 40,3.5 Q50,1 60,4 Q70,7 80,3.5 Q90,0 98,5' stroke='black' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10'%3E%3Cpath d='M2,6 Q10,3 20,4.5 Q30,6 40,3.5 Q50,1 60,4 Q70,7 80,3.5 Q90,0 98,5' stroke='black' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

/* Way back to the list, before the title; styled like "Back to home" on the 404 page.
   a. prefixes outrank the global a:link underline. */
a.entry-back,
a.entry-back:link,
a.entry-back:visited {
    display: inline-block;
    margin-bottom: var(--space-6);
    color: var(--text-color);
    opacity: 1;
    font-size: var(--text-base);
    text-decoration: none;
}

.entry-back span {
    margin-right: 0.5em;
}

a.entry-back:hover,
a.entry-back:focus-visible {
    color: var(--accent-color) !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 0 var(--space-6) !important;
    text-decoration: none !important;
}

/* Older and newer posts, above "View all posts" */
.entry-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    margin: var(--space-6) 0 0;
}

.entry-pager-link,
a.entry-pager-link:link,
a.entry-pager-link:visited {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    opacity: 1;
    text-decoration: none;
}

.entry-pager-newer {
    text-align: right;
}

.entry-pager-label {
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--skills-color);
}

.entry-pager-title {
    font-family: var(--font-secondary);
    font-size: var(--text-xl);
    line-height: var(--leading-snug);
    color: var(--accent-color);
}

a.entry-pager-link:hover,
a.entry-pager-link:focus {
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
}

a.entry-pager-link:hover .entry-pager-title,
a.entry-pager-link:focus .entry-pager-title {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

@media (max-width: 640px) {
    .entry-pager {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .entry-pager-newer {
        text-align: left;
    }

    /* Nothing on one side? Don't leave a gap */
    span.entry-pager-link {
        display: none;
    }
}

.entry-title {
    margin: 0 0 var(--space-4);
    font-family: var(--font-secondary);
    font-size: 4.5rem;
    line-height: 0.95;
    color: var(--accent-color);
    text-wrap: balance;
}

.entry-byline {
    color: var(--skills-color);
    font-size: 1rem;
    margin-bottom: 15px;
    font-style: italic;
}

/* Subtitle type comes from .page-intro, same as the page intros */
.entry-subtitle {
    text-wrap: balance;
}

/* Date and reading time, labeled like the months on /journal */
.entry-meta {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--skills-color);
}

.entry-content {
    color: var(--text-color);
    line-height: 1.6;
}

.entry-content p:first-of-type {
    font-size: var(--text-lg);
    line-height: var(--leading-normal);
}

/* Image styling */
.entry-content img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    object-position: center;
    margin: 0 0 2rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .entry-content img {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .entry-content img {
        height: 250px;
    }
}

/* Transparent PNGs (cutouts, scattered prints) show whole, with no frame of their own */
.entry-content img[src$=".png"],
[data-theme="dark"] .entry-content img[src$=".png"] {
    height: auto;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

/* Captioned image: the caption sits tight under the image it describes */
.entry-figure {
    margin: 0 0 2rem 0;
}

.entry-content .entry-figure img {
    margin-bottom: 0;
}

.entry-figure figcaption {
    max-width: 52ch;
    margin: 0.5rem auto 0;
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    color: var(--skills-color);
    text-align: center;
}

/* Code styling */
.entry-content pre {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

[data-theme="dark"] .entry-content pre {
    background: rgba(255, 255, 255, 0.1);
}

.entry-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 0.9em;
}

[data-theme="dark"] .entry-content code {
    background: rgba(255, 255, 255, 0.1);
}

.entry-content pre code {
    background: none;
    padding: 0;
}

/* Book recommendation at end */
.entry-content > hr:last-of-type {
    margin: 3rem 0 2rem 0;
}

.entry-content > hr:last-of-type ~ p {
    margin-top: 0;
}

/* Table styling */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

.entry-content table thead {
    display: table-header-group;
}

.entry-content table tbody {
    display: table-row-group;
}

.entry-content table tr {
    display: table-row;
}

.entry-content table th,
.entry-content table td {
    display: table-cell;
    border: 1px solid var(--skills-color);
    padding: 0.5rem;
    text-align: left;
    white-space: normal;
}

.entry-content table th {
    background: rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

[data-theme="dark"] .entry-content table th {
    background: rgba(255, 255, 255, 0.1);
}

/* Links */
.entry-content a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.entry-content a:hover {
    border-bottom-color: var(--accent-color);
}

blockquote p.source {
    font-family: var(--font-main);
    font-size: 1rem;
}

blockquote p.source::before {
    content: "— ";
}

.navigation {
    display: flex;
    justify-content: center;
    margin: 40px 0;
}

.view-all {
    color: var(--text-color) !important;
    text-decoration: none !important;
    padding: 0.5rem 1rem !important;
    border: 1px solid var(--tertiary-color) !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    font-size: 1rem !important;
    background: none !important;
    display: inline-block !important;
}

.view-all:hover {
    color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    transform: translateY(-2px) !important;
    background: none !important;
}

.info-section {
    background: rgba(var(--accent-rgb), 0.08);
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.info-section p {
    text-align: left;
    font-size: 1rem;
    color: var(--text-color-secondary, var(--skills-color));
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.info-section-row {
    display: flex;
    gap: 1.5rem;
}

.info-section a {
    color: var(--skills-color);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.info-section a:hover {
    color: var(--accent-color);
}

.info-section .material-symbols-outlined {
    font-size: 1rem;
}

.info-section p .material-symbols-outlined {
    font-size: 1.1rem;
    margin-right: 0.5rem;
    vertical-align: text-bottom;
}

/* Tags Section */
.tags-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(var(--accent-rgb), 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.tags-section h2 {
    font-family: var(--font-secondary);
    font-size: 1.2rem;
    color: var(--heading-color);
    margin: 0 0 1rem 0;
}

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

.tag,
.tag:visited,
.tag:hover,
.tag:focus,
.tag:active {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: var(--accent-color) !important;
    color: var(--bg-color) !important;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 700;
    text-decoration: none !important;
    opacity: 1 !important;
    margin: 0;
    transition: all 0.2s ease;
}

.tag:hover,
.tag:focus {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

/* Related Posts Section */
.related-posts-section {
    margin: 2rem 0;
}

.related-posts-section h3 {
    font-family: var(--font-secondary);
    font-size: 1.5rem;
    color: var(--heading-color);
    margin: 0 0 1.5rem 0;
}

.related-posts-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.related-post-item {
    padding: 1.25rem;
    background: rgba(var(--accent-rgb), 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
    transition: all 0.3s ease;
}

.related-post-item:hover {
    background: rgba(var(--accent-rgb), 0.08);
    transform: translateX(4px);
}

.related-post-item h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-family: var(--font-secondary);
}

.related-post-item h4 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.related-post-item h4 a:hover {
    color: var(--accent-color);
}

.related-post-excerpt {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

@media (min-width: 768px) {
    .related-posts-list {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Table of Contents - Floating on right */
.table-of-contents {
    position: fixed;
    /* Clear of the nav (6.1rem tall) and its divider */
    top: 7.6rem;
    right: 2rem;
    background: rgba(var(--accent-rgb), 0.08);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    z-index: 100;
    max-width: 280px;
}

.toc-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 1rem 1.25rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-family: var(--font-secondary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading-color);
    transition: all 0.2s ease;
}

.toc-toggle:hover {
    color: var(--accent-color);
}

.toc-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.table-of-contents.collapsed .toc-toggle-icon {
    transform: rotate(-90deg);
}

.toc-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1.25rem;
}

.table-of-contents:not(.collapsed) .toc-content {
    max-height: 500px;
    padding: 0 1.25rem 1.25rem;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.625rem;
}

.toc-list a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: all 0.2s ease;
    display: inline-block;
    padding-left: 1rem;
    position: relative;
}

.toc-list a:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    transition: transform 0.2s ease;
    font-size: 0.875rem;
}

.toc-list a:hover,
.toc-list a:focus {
    color: var(--accent-color);
    transform: translateX(4px);
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.toc-list a:hover:before {
    transform: translateX(4px);
}

/* Mobile TOC (collapsible dropdown) */
.toc-mobile {
    display: none;
}

.toc-mobile-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 1rem 1.25rem;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-family: var(--font-secondary);
    font-size: 1rem;
    font-weight: 700;
    color: var(--heading-color);
    transition: all 0.2s ease;
}

.toc-mobile-toggle:hover {
    color: var(--accent-color);
}

.toc-mobile-toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.toc-mobile.collapsed .toc-mobile-toggle-icon {
    transform: rotate(-90deg);
}

.toc-mobile-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1.25rem;
}

.toc-mobile:not(.collapsed) .toc-mobile-content {
    max-height: 300px;
    padding: 0 1.25rem 1.25rem;
}

.toc-select {
    width: 100%;
    padding: 1rem 2.5rem 1rem 1.25rem;
    font-size: 1rem;
    font-family: var(--font-primary);
    color: var(--text-color);
    background: var(--bg-color);
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23FF6B6B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
}

.toc-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.2);
}

.toc-select option {
    padding: 0.75rem;
}

/* Responsive: Show dropdown on mobile/tablet at top of content */
@media (max-width: 1024px) {
    .table-of-contents {
        position: static;
        max-width: 100%;
        margin: 0 0 2rem 0;
        right: auto;
    }

    .toc-desktop {
        display: none;
    }

    .toc-mobile {
        display: block;
    }
}

/* Responsive scaling for entry title */
@media (max-width: 768px) {
    .entry-title {
        font-size: 3.5rem;
    }
}

@media (max-width: 500px) {
    .entry-title {
        font-size: 2.8rem;
    }
}

/* Shown on draft previews only (stories marked Draft: true) */
.entry-draft-notice {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border: 1px dashed var(--accent-color);
    border-radius: 6px;
    font-size: var(--text-sm);
    color: var(--text-color);
}
