* {
    box-sizing: border-box;
}

:root {
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

body {
    font-family: var(--font-mono);
    margin: 0;
    padding: 0;
    background-color: #F5F4EF;
    color: #000000;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 2em;
    font-weight: normal;
    margin: 0;
    color: #000000;
    font-family: 'Times New Roman', Times, serif;
}

nav a {
    margin-left: 20px;
    text-decoration: none;
    color: #000000;
    font-size: 0.8em;
    padding-bottom: 5px;
    font-family: 'Times New Roman', Times, serif;
}

nav a.active, nav a:hover {
    border-bottom: 2px solid #000000;
}

.ca-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

.ca-container canvas {
    width: 100%;
    height: 200px;
    display: block;
    cursor: crosshair;
    background-color: #F5F4EF;
}

.ca-caption {
    text-align: right;
    font-size: 0.68em;
    color: #999999;
    margin: 4px 0 0;
    font-family: var(--font-mono);
}

.intro {
    padding: 20px 0;
    font-size: 0.88em;
    line-height: 1.6;
    color: #000000;
    overflow: auto; /* Basic clearfix */
}

.intro::after { /* More robust clearfix */
    content: "";
    clear: both;
    display: table;
}

.intro-text {
    /* Text wraps around floated image naturally */
}

.intro-text p {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.intro-links {
    display: flex;
    gap: 14px;
    margin-top: 8px;
}

.intro-links a {
    color: #000000;
    text-decoration: none;
    opacity: 0.5;
    transition: opacity 0.2s;
    display: inline-flex;
}

.intro-links a:hover {
    opacity: 1;
}

.intro-image {
    width: 150px;
    height: 150px;
    border-radius: 15px;
    background-image: url('imgs/random/rob-plain.jpeg');
    background-size: cover;
    background-position: center;
    float: right;
    margin-left: 25px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.intro-image-zone {
    position: absolute;
    top: 0;
    height: 100%;
    width: 50%;
    z-index: 1;
}

.intro-image-zone::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 150px;
    height: 150px;
    background-size: cover;
    background-position: center;
    border-radius: 15px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.intro-image-left {
    left: 0;
}

.intro-image-left::after {
    left: 0;
    background-image: url('imgs/random/rob_golden.png');
}

.intro-image-right {
    right: 0;
}

.intro-image-right::after {
    right: 0;
    left: auto;
    background-image: url('imgs/random/rob-gpt.png');
}

.intro-image-zone:hover::after {
    opacity: 1;
}

#listings-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    position: relative;
    --timeline-gap: 40px;
    align-items: start;
}

#listings-container::before {
    content: '';
    position: absolute;
    top: 60px;
    bottom: 0;
    left: 50%;
    width: 2px;
    background-color: #cccccc;
    transform: translateX(-50%);
    pointer-events: none;
}

#news, #blog {
    min-width: 0;
}

h2 {
    font-size: 1.76em;
    font-weight: normal;
    margin-top: 0px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    color: #000000;
    font-family: 'Times New Roman', Times, serif;
}

.timeline {
    list-style: none;
    padding: 0;
    position: relative;
}

.timeline::before {
    content: none;
}

.timeline li {
    padding: 15px 10px 10px;
    position: relative;
    border-bottom: 1px solid #eeeeee;
    display: flex;
    flex-direction: column;
    min-height: 110px;
    margin-bottom: 14px;
}

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

.timeline li::before {
    content: '';
    position: absolute;
    top: 20px; 
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background-color: #000000;
    border: 3px solid #F5F4EF;
}

#news .timeline li::before {
    left: calc(100% + (var(--timeline-gap) / 2) - 7px);
}

#blog .timeline li::before {
    left: calc(-1 * (var(--timeline-gap) / 2) - 7px);
}

.timeline .entry-date {
    margin-top: auto;
    align-self: flex-end;
    font-size: 0.72em;
    color: #888;
    font-family: var(--font-mono);
}

.timeline h3 {
    font-size: 0.96em;
    margin-top: 0;
    margin-bottom: 5px;
    font-weight: bold;
    color: #000000;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline h3 a {
    text-decoration: none;
    color: inherit; /* Inherit color from parent h3 */
}

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

.timeline li p {
    font-size: 0.8em;
    line-height: 1.5;
    margin: 0.5em 0;
    color: #666;  /* Grey color for summaries */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.new-tag {
    background-color: #FBD45B;
    color: #000000;
    padding: 2px 6px;
    font-size: 0.64em;
    font-weight: bold;
    border-radius: 3px;
    margin-right: 10px;
    display: inline-block;
}

#news li, #blog li {
    padding-bottom: 12px;
}

.view-toggle {
    padding: 0;
    border: none;
    background: none;
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.7em;
    cursor: pointer;
    text-decoration: underline;
}

.view-toggle:hover {
    text-decoration: none;
}

.view-toggle.is-disabled {
    opacity: 0.45;
    cursor: default;
    text-decoration: none;
}

@media (max-width: 720px) {
    #listings-container {
        grid-template-columns: 1fr;
        gap: 20px;
        --timeline-gap: 20px;
    }

    #listings-container::before {
        content: none;
    }

    .timeline::before {
        content: '';
        position: absolute;
        left: 5px;
        top: 0;
        bottom: 0;
        width: 2px;
        background-color: #cccccc;
    }

    .timeline li {
        padding: 15px 10px 18px 30px;
    }

    #news .timeline li::before,
    #blog .timeline li::before {
        left: -2px;
    }
}

footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #ddd;
    font-size: 0.72em;
    color: #555555;
}

/* Specific styling for items that have useBox enabled */
.timeline li.use-box {
    border: 1px solid #000000;
    padding: 20px;
    position: relative;
    background-color: #000000;
    color: #FFFFFF;
    font-family: var(--font-mono);
    z-index: 1;
}

.timeline li.use-box::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: #FFFFFF;
    border: 1px solid #000000;
    top: 4px;
    left: 4px;
    z-index: -1;
}

/* Ensure headings and paragraphs within boxed items have correct styling */
.timeline li.use-box h3 {
    color: #000000 !important;
    font-family: var(--font-mono) !important;
    font-weight: bold !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.96em !important;  /* Keep original size */
    line-height: normal !important;
}

.timeline li.use-box p {
    color: #666 !important;  /* Keep grey color */
    font-family: var(--font-mono) !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.8em !important;  /* Keep original size */
    line-height: 1.5 !important;
}

/* Adjust date position for boxed items */
.timeline li.use-box .entry-date {
    color: #666;
}

/* Adjust the ::before pseudo-element for boxed items */
.timeline li.use-box::before {
    top: 20px;
    background-color: #000000;
    border: 3px solid #FFFFFF;
    z-index: 2;
}

/* Ensure links within boxed items inherit correct color */
.timeline li.use-box h3 a {
    color: inherit;
}

/* Styling for individual post pages */
.post-page article {
    padding: 20px 0;
}

.post-page .post-header {
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 15px;
}

.post-page .post-header h2 {
    font-size: 2em; /* Slightly smaller than main page H2 */
    margin-top: 0; /* Reset margin for post title */
    border-bottom: none; /* Remove double border */
}

.post-page .post-meta {
    font-size: 0.8em;
    color: #555555;
    margin-top: 5px;
}

.post-page .post-content p {
    font-size: 1em; /* Reset to a base paragraph font size for posts */
    line-height: 1.7;
    margin-bottom: 1em;
}

.post-page a {
    color: #000000; /* Standard link color */
    text-decoration: underline;
}

.post-page a:hover {
    text-decoration: none;
}

/* Ensure links within specifically styled news items are white */
#news li:nth-child(2) h3 a,
#news li:nth-child(4) h3 a,
#news li:nth-child(6) h3 a {
    color: inherit; /* Will inherit the #FFFFFF from the parent h3 */
}

/* Post metadata styling */
.post-metadata {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    margin: 15px 0;
    font-size: 0.8em;
    color: #666;
}

.post-metadata .label {
    font-weight: bold;
    color: #000;
    font-family: var(--font-mono);
}

.post-metadata .value {
    color: #666;
    font-family: var(--font-mono);
}

.post-metadata .value.tags span {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-family: var(--font-mono);
    border: 1px dashed currentColor;
    transition: all 0.2s ease;
    gap: 4px;
    position: relative;
    line-height: 1;
}

.post-metadata .value.tags svg {
    display: inline-block;
    vertical-align: middle;
}

.post-metadata .value.tags .arxiv-logo {
    width: 14px;
    height: 14px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.post-metadata .value.tags .tag-paper {
    color: #2a9d8f;
}

.post-metadata .value.tags .tag-link {
    color: #e76f51;
}

.post-metadata .value.tags .tag-blog {
    color: #8d6e63;
}

.post-metadata .value.tags .tag-youtube {
    color: #ff0000;
}

.post-metadata .value.tags .tag-code {
    color: #24292f;
}

.post-metadata .value.tags .tag-tweet {
    color: #1da1f2;
}

.post-metadata .value.tags .tag-video {
    color: #e63946;
}

.post-metadata .value.tags .tag-medium {
    color: #00ab6c;
}

.post-metadata .value.tags a {
    text-decoration: none;
    margin-right: 12px;
}

.post-metadata .value.tags a:hover span {
    background: rgba(0, 0, 0, 0.03);
}

/* Adjust tags in boxed posts */
.timeline li.use-box .post-metadata .value.tags span {
    border-style: dashed;
}

.timeline li.use-box .post-metadata .value.tags a:hover span {
    background: rgba(255, 255, 255, 0.1);
}

/* Adjust metadata in boxed posts */
.timeline li.use-box .post-metadata {
    margin: 15px 0;
}

.timeline li.use-box .post-metadata .label {
    color: #000;
}

.timeline li.use-box .post-metadata .value {
    color: #666;
}

.timeline li.use-box .post-metadata .value.tags span {
    border-color: #666;
}

/* Remove the old date positioning since we're including it in metadata */
.timeline .date {
    display: none;
}

/* Post page styling */
.post-header {
    margin-bottom: 2em;
    padding-bottom: 1em;
    border-bottom: 1px solid #ddd;
}

.post-header h1 {
    font-size: 2em;
    margin: 0 0 0.5em 0;
    font-family: 'Times New Roman', Times, serif;
    font-weight: normal;
}

.post-content {
    margin-top: 2em;
    font-size: 0.96em;
    line-height: 1.6;
}

.post-content img {
    max-width: 100%;
    height: auto;
}

.post-content .repo-card {
    border: 1px solid #dddddd;
    padding: 12px 14px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 360px;
    margin: 0 auto;
}

.post-content .repo-title {
    font-size: 0.95em;
    font-weight: bold;
    margin: 0;
}

.post-content .repo-title a {
    color: #000000;
    text-decoration: underline;
}

.post-content .repo-title a:hover {
    text-decoration: none;
}

.post-content .repo-desc {
    margin: 0;
    font-size: 0.82em;
    line-height: 1.5;
    color: #444444;
}

.post-content .repo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    font-size: 0.72em;
    color: #666666;
    font-family: var(--font-mono);
}

/* Post metadata styling (both for list and individual pages) */
.post-metadata {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 20px;
    margin: 15px 0;
    font-size: 0.8em;
    color: #666;
}

.post-metadata .label {
    font-weight: bold;
    color: #000;
    font-family: var(--font-mono);
}

.post-metadata .value {
    color: #666;
    font-family: var(--font-mono);
}

.post-metadata .value.tags span {
    display: inline-block;
    border: 1px dashed #666;
    padding: 2px 8px;
    margin-right: 8px;
    font-family: var(--font-mono);
}

/* Back button styling */
#back-to-listings {
    display: inline-block;
    margin-bottom: 0em;
    padding: 5px 10px;
    border: none;
    background: none;
    color: #000;
    font-family: var(--font-mono);
    font-size: 0.8em;
    cursor: pointer;
    text-decoration: none;
}

#back-to-listings:hover {
    text-decoration: underline;
}

/* Code block styling */
/* Inline code */
code {
    font-family: var(--font-mono);
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.92em;
    color: #d73a49;
}

/* Code blocks */
pre {
    font-family: var(--font-mono);
    background-color: #282c34;
    color: #abb2bf;
    padding: 16px 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    line-height: 1.5;
    font-size: 0.9em;
    position: relative;
}

pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    border-radius: 0;
    font-size: 1em;
}

/* Add subtle shadow for depth */
pre {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Scrollbar styling for code blocks */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: #1d1f23;
}

pre::-webkit-scrollbar-thumb {
    background: #4b5263;
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: #5c6370;
}

/* Copy button styling */
.code-copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.75em;
    font-family: var(--font-mono);
    background-color: #3e4451;
    color: #abb2bf;
    border: 1px solid #4b5263;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

pre:hover .code-copy-button {
    opacity: 1;
}

.code-copy-button:hover {
    background-color: #4b5263;
}

.code-copy-button:active {
    background-color: #5c6370;
}

.code-copy-button.copied {
    background-color: #98c379;
    color: #282c34;
    border-color: #98c379;
}

/* Table styling for blog posts */
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5em 0;
    font-size: 0.9em;
}

.post-content table th,
.post-content table td {
    border: 1px solid #ddd;
    padding: 10px 12px;
    text-align: left;
}

.post-content table th {
    background-color: #f5f5f5;
    font-weight: bold;
    border-bottom: 2px solid #000;
}

.post-content table tr:hover {
    background-color: #fafafa;
}

/* Image caption styling - removed conflicting rules */

/* Center YouTube videos and Twitter embeds */
.post-content iframe {
    display: block;
    margin: 2em auto;
    max-width: 100%;
}

.post-content .twitter-tweet {
    margin: 2em auto !important;
}

/* Twitter Carousel */
.twitter-carousel {
    position: relative;
    max-width: 550px;
    margin: 2em auto;
    overflow: hidden;
}

.twitter-carousel-track {
    display: flex;
    transition: transform 0.3s ease-in-out;
}

.twitter-carousel-slide {
    min-width: 100%;
    flex-shrink: 0;
}

.twitter-carousel-slide .twitter-tweet {
    margin: 0 auto !important;
}

.twitter-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    color: #333;
    z-index: 10;
    transition: background 0.2s;
}

.twitter-carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.twitter-carousel-nav.prev {
    left: -20px;
}

.twitter-carousel-nav.next {
    right: -20px;
}

.twitter-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.twitter-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1em;
}

.twitter-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: background 0.2s;
}

.twitter-carousel-dot.active {
    background: #1da1f2;
}
