/* blog/static/blog/blog.css */

/* ==========================================================================
   Layout helpers
   ========================================================================== */

/* CKEditor image alignment styles with resize support */
.article-body figure.image.image-style-side {
	float: right;
	max-width: 50%;
	margin: 0 0 1rem 1rem;
}

/* Respect CKEditor inline width styles for resized images */
.article-body figure.image.image-style-side img[style*="width"],
.article-body figure.image.image-style-side img[width],
.article-body figure.image.image-style-side img[style*="aspect-ratio"] {
	max-width: none !important;
	width: 100% !important;
	height: auto !important;
	border-radius: 10px;
}

.article-body figure.image.image-style-align-right {
	float: right;
	max-width: 50%;
	margin: 0 0 1rem 1rem;
}

.article-body figure.image.image-style-align-right img[style*="width"],
.article-body figure.image.image-style-align-right img[width],
.article-body figure.image.image-style-align-right img[style*="aspect-ratio"] {
	max-width: none !important;
	width: 100% !important;
	height: auto !important;
	border-radius: 10px;
}

.article-body figure.image.image-style-align-left {
	float: left;
	max-width: 50%;
	margin: 0 1rem 1rem 0;
}

.article-body figure.image.image-style-align-left img[style*="width"],
.article-body figure.image.image-style-align-left img[width],
.article-body figure.image.image-style-align-left img[style*="aspect-ratio"] {
	max-width: none !important;
	width: 100% !important;
	height: auto !important;
	border-radius: 10px;
}

.container-narrow {
	max-width: 900px;
	margin: 0 auto;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.hr-spaced { margin: 24px 0; }

.muted-note {
	font-size: .9rem;
	opacity: .8;
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumbs {
	margin: 8px 0;
	font-size: 1.2em;
	color:#3f3f3f;
}
.breadcrumbs .breadcrumb-link {
	text-decoration: none;
	color: inherit;
}
.breadcrumbs .breadcrumb-link:hover {
	text-decoration: underline;
}
.breadcrumbs .breadcrumb-sep {
	margin: 0;
	color: #9ca3af; /* slate-400 */
}
.breadcrumbs .breadcrumb-current {
	color: #111827; /* gray-900 */
}

/* ==========================================================================
   Article header
   ========================================================================== */

.article-meta {
	display: flex;
	align-items: center;
	gap: 10px;
	opacity: .9;
    justify-content: space-between;
    border-top: 4px dotted #e1e1e1;
    padding: 10px 0;
}

.article-interactions {
    display: flex;
    align-content: center;
    align-items: center;
    flex-direction: row;
    flex-wrap: nowrap;
}

@media (max-width: 600px) {
    .article-meta {
        flex-direction: column;

    }
    .article-interactions {
        flex-direction: column;
        gap: 12px;

    }
}

article h1, .section-main h1 {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: normal;
    color: #111827;
    margin-top: 0;
    font-size: 2.6em;
    line-height: 1.2;
}

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
    color: #374151; /* gray-700 */
}

.article-date {
    font-size: 0.9em;
    color: #6b7280; /* gray-500 */
}

.author-avatar {
	width: 36px;
	height: 36px;
	border-radius: 9999px;
	object-fit: cover;
}

.category-list { margin-top: 10px; }

.category-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 9999px;
	background: #eef;
	margin-right: 6px;
	text-decoration: none;
}

.article-body {
    margin-top: 16px;
    font-size: 1.1em;
    font-weight: 300;
    margin-top: 40px;
}

/* Paragraph styling within article body */
.article-body p {
    font-size: 1.1em;
    line-height: 1.6;
    margin: 1em 0;
}

/* Heading styles within article body - serif font to match h1 */
.article-body h2 {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: normal;
    color: #111827;
    font-size: 2em;
    line-height: 1.3;
    margin-top: 2.5em;
    margin-bottom: 0.8em;
}

.article-body h3 {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: normal;
    color: #111827;
    font-size: 1.6em;
    line-height: 1.3;
    margin-top: 2.2em;
    margin-bottom: 0.7em;
}

.article-body h4 {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: normal;
    color: #111827;
    font-size: 1.3em;
    line-height: 1.5;
    margin-top: 2em;
    margin-bottom: 0.6em;
}

/* Ensure first heading after content doesn't have excessive top margin */
.article-body > h2:first-child,
.article-body > h3:first-child,
.article-body > h4:first-child {
    margin-top: 0.5em;
}

/* ---- HERO via CKEditor class: image-style-align-center ------------------ */
/* Scope to the article body to avoid side effects elsewhere */
.article-body figure.image.image-style-align-center {
	clear: both;          /* cancel any previous floats */
	float: none;
	margin: 1.5rem 0;     /* vertical rhythm */
	text-align: center;   /* center the caption text */
}

.article-body figure.image.image-style-align-center img {
	display: block;       /* remove inline gaps */
	width: 100%;          /* full width of the content column */
	max-width: 100%;
	height: auto;
	margin: 0 auto;
    border-radius: 10px;
}

.article-body figure.image.image-style-align-center figcaption {
	margin-top: .5rem;
	font-size: .9rem;
	line-height: 1.35;
	color: #666;
}

/* Optional: if you also use CKEditor’s "side" style, keep this handy */
.article-body figure.image.image-style-side {
	float: right;
	max-width: 50%;
	margin: 0 0 1rem 1rem;
}



.btn-spaced { margin-left: 12px; }

.like-btn, .like-btn.is-liked {
    background: transparent;
    border: 1px solid #9ca3af; /* gray-400 */
    border-radius: 9999px;
    padding: 0 8px;
    margin: 0 20px;
    height: 30px;
    line-height:30px;
    color: #000000; /* rgb(223, 43, 43) */
    cursor: pointer;
    font-size: 1em;
    font-weight:normal
}
.like-btn span {
    font-weight: normal;
    font-size: 0.9em;
}
/* Like button visual state */
.like-btn .heart-icon {
	color: #9ca3af; /* gray when NOT liked */
	transition: color .15s ease-in-out;
}
.like-btn.is-liked .heart-icon {
	color: #df2b2b; /* red when liked */
}

/* ==========================================================================
   Comments
   ========================================================================== */

/* Commenting as section */
.commenting-as img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    flex-shrink: 0;
}

.comment-list {
    margin-bottom: 24px;
}



.comment {
	padding: 20px 0;
	border-bottom: 1px solid #d1d1d1;
}

.comment:last-child {
	border-bottom: none;
}

.comment-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
}

.comment-avatar {
	flex-shrink: 0;
}

.comment-avatar .avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid #e5e7eb;
}

.comment-avatar .avatar-placeholder {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: bold;
	font-size: 16px;
	border: 2px solid #e5e7eb;
}

.comment-username {
    font-size: 18px;
    color: #222222;

}
.comment-meta {
	font-size: .9em;
	opacity: .9;
    line-height: 20px;
}

#comments {
    margin-top: 60px;
}

/* Comments heading: centered with lines on both sides */
#comments h3 {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;              /* space between text and lines */
	font-size: 1.8em;
    font-family: Georgia, 'Times New Roman', Times, serif;
	margin: 34px 0 6px 0;
	text-align: center;
}

#comments h3::before,
#comments h3::after {
	content: "";
	flex: 1 1 0;
	border-top: 1px solid #e5e7eb; /* subtle line color */
}

.comment-date {
	opacity: .7;
}

/* Comment textarea: always span full width */
#comment-form textarea,
.comment-form textarea,
textarea[data-testid="comment-body"] {
	display: block;
    height: 100px;
	width: 100%;
	min-width: 100%;
	max-width: 100%;
	box-sizing: border-box; /* include padding/border in width */
}

@media (max-width: 600px) {
    .mt-8 button {
        width: 100%;
    }
}


.pending-note {
	margin-top: 6px;
    margin-bottom:10px;
	padding: 6px 10px;
	border-radius: 8px;
	background: #FFFBEB;          /* amber-50 */
	border: 1px solid #FDE68A;     /* amber-300 */
	color: #92400E;                /* amber-800 */
	font-size: 0.9em;
}
.comment-body {
    margin: 4px 0 0 20px;
    font-size:0.9em;
    color: rgb(66, 66, 66);
    line-height: 1.4;
}

.comment-body p {
    margin: 0.5em 0;
}

.comment-body p:first-child {
    margin-top: 0;
}

.comment-body p:last-child {
    margin-bottom: 0;
}

/* Reactions row */
.reactions {
	margin-top: 6px;
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Icon-only button for the trigger */
.btn-icon {
	border: 0;
	margin: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
	font-size: 1.6rem;
	vertical-align: baseline;
}
.icon-24 {
	width: 24px;
	height: 24px;
	vertical-align: middle;
}

/* Ensure emoji render nicely across platforms */
.reactions,
.reaction-popover {
	font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji","Segoe UI Symbol",system-ui,sans-serif;
}

/* Popover visuals */
.reaction-popover {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,.08);
	padding: 6px;
	display: flex;
	gap: 6px;
	z-index: 20;
}
/* Position popover under the trigger within the reactions container */
.reactions .reaction-popover {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 6px;
}
/* Honor the [hidden] attribute even if JS set display:flex earlier */
.reaction-popover[hidden] { display: none !important; }

.reaction-popover .emoji {
	border: 1px solid transparent;
	background: #f9fafb;
	border-radius: 6px;
	padding: 4px 8px;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
}
.reaction-popover .emoji:hover { border-color: #e5e7eb; }

/* Reaction chips */
.reaction-summary {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

@keyframes ho-flash {
	0% { background: rgba(255, 235, 59, .45); }
	100% { background: transparent; }
}
.reaction-summary.flash {
	animation: ho-flash 260ms ease-in-out 1;
	border-radius: 6px;
}

.reaction-summary .rc {
	background: #f3f4f6;
	border: 1px solid #e5e7eb;
	border-radius: 9999px;
	padding: 2px 8px;
	font-size: 13px;
	cursor: pointer;
	user-select: none;
}
.reaction-summary .rc .count { font-variant-numeric: tabular-nums; }

/* List styling within article body */
.article-body ul,
.article-body ol {
    margin: 1.5em 0;
    padding-left: 2em;
    line-height: 1.6;
    font-size: 1.1em; /* Explicitly match paragraph font size */
}

.article-body ul {
    list-style-type: disc;
}

.article-body ol {
    list-style-type: decimal;
}

.article-body li {
    margin-bottom: 0.5em;
    padding-left: 0.25em;
    font-size: 1em; /* Relative to 1.1em parent = 1.1em actual size */
}

.article-body li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.article-body ul ul,
.article-body ol ol,
.article-body ul ol,
.article-body ol ul {
    margin: 0.5em 0;
    padding-left: 1.5em;
    font-size: 1.1em; /* Explicitly set nested list font size */
}

.article-body ul ul li,
.article-body ol ol li,
.article-body ul ol li,
.article-body ol ul li {
    font-size: 1em; /* Relative to 1.1em nested parent = 1.1em actual size */
}

.article-body ul ul {
    list-style-type: circle;
}

.article-body ul ul ul {
    list-style-type: square;
}

/* Optional: content link styling inside article body */
.article-body a {
	color: #1d4ed8;
	text-decoration: underline;
	text-underline-offset: 2px;
}
.article-body a:hover { text-decoration-thickness: 2px; }

/* Reference link styling - superscript numbers with circles */
.article-body a[href^="#ref-"] {
	text-decoration: none;
	color: #6b7280;
}

.article-body a[href^="#ref-"] sup {
	display: inline-block;
	background: #9ba2af;
	color: white;
	border-radius: 50%;
	width: 1.3em;
	height: 1.3em;
	line-height: 1.4em;
	text-align: center;
	font-size: 0.5em;
	font-weight: 500;
	margin-left: 2px;
	vertical-align: baseline;
	position: relative;
	top: -10px;
}

.article-body a[href^="#ref-"]:hover sup {
	background: #4b5563;
	transform: scale(1.1);
	transition: all 0.2s ease;
}

/* References list styling - smaller font size */
.article-body ol.references {
    font-size: 0.9em !important;
}

.article-body ol.references li {
    font-size: 1em !important; /* Normal size for list items */
    line-height: 1.2 !important; /* Tighter line height */
}

/* Collapsible references section - JavaScript solution */
.references-wrapper {
    margin: 2em 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.references-header {
    background: #f8f9fa;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #374151;
    font-size: 1.1em;
}

.references-header:hover {
    background: #f1f3f4;
}

.references-header::after {
    content: "▼";
    font-size: 0.8em;
    transition: transform 0.2s ease;
    color: #6b7280;
}

.references-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 16px;
}

/* When expanded via JavaScript */
.references-wrapper.expanded .references-header::after {
    transform: rotate(180deg);
}

.references-wrapper.expanded .references-content {
    max-height: 1000px; /* Large enough value to show all content */
    padding: 16px;
}

/* Style the references list within the collapsible section */
.references-content ol.references {
    margin: 0;
    font-size: 0.9em !important;
}

.references-content ol.references li {
    font-size: 1em !important;
    line-height: 1.2 !important;
}
/* ==========================================================================
   Article list and previews
   ========================================================================== */

.article-preview {
    padding: 24px 0;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.article-preview:last-child {
    border-bottom: none;
}

.article-thumbnail {
    flex-shrink: 0;
    width: 150px;
    height: 100px;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f3f4f6;
}

.article-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.article-content {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-family: Georgia, 'Times New Roman', Times, serif;
    font-weight: normal;
    color: #111827;
    margin: 0 0 12px 0;
    font-size: 1.8em;
    line-height: 1.3;
}

.article-title a {
    color: inherit;
    text-decoration: none;
}

.article-title a:hover {
    color: #1d4ed8;
    text-decoration: none;
}

.article-excerpt {
    color: #4b5563;
    font-size: 1em;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.article-excerpt .read-more {
    color: #1d4ed8;
    text-decoration: none;
    margin-left: 8px;
    font-weight: 500;
}

.article-excerpt .read-more:hover {
    text-decoration: underline;
}

.article-meta-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    opacity: .9;
    font-size: 0.95em;
}

@media (max-width: 600px) {
    .article-meta-preview {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.article-stats {
    display: flex;
    align-items: center;
    color: #6b7280;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
}

.pagination .btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    color: #374151;
    background: #f9fafb;
    transition: all 0.15s ease-in-out;
}

.pagination .btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* ==========================================================================
   Responsive design for mobile
   ========================================================================== */

@media (max-width: 768px) {
    .article-preview {
        flex-direction: column;
        gap: 12px;
    }
    
    .article-thumbnail {
        width: 100%;
        height: 200px;
        align-self: stretch;
    }
    
    /* Mobile responsive images - make side images full width and centered */
    .article-body figure.image.image-style-side,
    .article-body figure.image.image-style-align-right,
    .article-body figure.image.image-style-align-left {
        float: none !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 1.5rem 0 !important;
        text-align: center;
        clear: both;
    }
    
    .article-body figure.image.image-style-side img,
    .article-body figure.image.image-style-align-right img,
    .article-body figure.image.image-style-align-left img {
        width: 100% !important;
        max-width: 100% !important;
        display: block;
        margin: 0 auto;
    }
}

/* ==========================================================================
   Profile Setup Modal
   ========================================================================== */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #dee2e6;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #495057;
}

.modal-close {
    font-size: 38px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    float: right;
}

.modal-close:hover {
    color: #000;
}

.modal-body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

    }

.modal-body p {
    margin-bottom: 20px;
    color: #6c757d;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.15s ease-in-out;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.9em;
    color: #6c757d;
}

.feedback-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.feedback-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    font-size: 16px;
}

.feedback-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    font-size: 16px;
}

.avatar-preview {
    margin-top: 12px;
    text-align: center;
}

.avatar-preview img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.15s ease-in-out;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* Profile setup required section */
.profile-setup-required h4 {
    margin-top: 0;
    margin-bottom: 12px;
}

.profile-setup-required p {
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header, .modal-body {
        padding: 16px;
    }
    
    .form-actions {
        flex-direction: column;
    }
}
