:root {
    --primary-color: #d9534f;
    --text-color: #333333;
    --text-light: #777777;
    --bg-color: #f7f7f7;
    --white: #ffffff;
    --dark-bg: #2b3036;
    --darker-bg: #1a1d20;
    --border-color: #e0e0e0;
    
    --tag-blue: #5b7cfa;
    --tag-teal: #4bc0c0;
    --tag-purple: #9b59b6;

    --font-main: 'Jost', sans-serif;
}

body.dark-mode {
    --text-color: #f0f0f0;
    --text-light: #aaaaaa;
    --bg-color: #121212;
    --white: #1e1e1e;
    --border-color: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-color);
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* UI Icons */
.ui-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}
.icon-white {
    filter: brightness(0) invert(1);
}
body.dark-mode .ui-icon:not(.icon-white) {
    filter: brightness(0) invert(1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    border-radius: 3px;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

/* Top Bar */
.top-bar {
    background-color: var(--dark-bg);
    color: #fff;
    font-size: 0.85rem;
    padding: 8px 0;
}

.top-date {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Header */
.main-header {
    background-color: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo a {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-color);
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 25px;
}

.main-nav a {
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Ticker */
.ticker-wrapper {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.ticker {
    display: flex;
    align-items: center;
}

.ticker-label {
    background-color: var(--primary-color);
    color: #fff;
    padding: 5px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 3px;
    margin-right: 20px;
    white-space: nowrap;
    z-index: 2;
}

.ticker-content {
    overflow: hidden;
    white-space: nowrap;
    flex-grow: 1;
}

.ticker-track {
    display: inline-block;
    animation: ticker 20s linear infinite;
}

.ticker-item {
    display: inline-block;
    margin-right: 40px;
    font-size: 0.95rem;
    font-weight: 500;
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Hero Section */
.hero {
    position: relative;
    background-size: cover;
    background-position: center;
    min-height: 500px;
    display: flex;
    align-items: flex-end;
    padding-bottom: 40px;
    margin-bottom: 40px;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.8) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 100%;
}

.hero-article {
    color: #fff;
}

.hero-article h2 {
    font-size: 2rem;
    margin: 10px 0;
    line-height: 1.2;
}

.tags {
    margin-bottom: 10px;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 3px;
    color: #fff;
    margin-right: 5px;
}

.tag-blue { background-color: var(--tag-blue); }
.tag-teal { background-color: var(--tag-teal); }
.tag-purple { background-color: var(--tag-purple); }

.meta {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.hero-article .meta {
    color: #e0e0e0;
}

.avatar {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

/* Post Cards */
.post-card {
    background-color: var(--white);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.post-img {
    width: 100%;
    height: 350px;
    object-fit: cover;
}

.post-content {
    padding: 25px;
}

.post-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.post-content p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.read-more {
    font-weight: 600;
    text-decoration: underline;
}

/* Sidebar */
.widget {
    background-color: var(--white);
    padding: 25px;
    border-radius: 5px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.widget-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
}

.widget-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.search-form {
    display: flex;
}

.search-form input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px 0 0 3px;
    background-color: var(--white);
    color: var(--text-color);
}

.search-form button {
    border-radius: 0 3px 3px 0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.page-num {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--white);
    border-radius: 50%;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.page-num.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Recommended Posts */
.recommended {
    background-color: var(--white);
    padding: 30px;
    border-radius: 5px;
    margin-bottom: 50px;
}

.section-header {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.recommended-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.rec-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 10px;
}

.rec-info h4 {
    font-size: 0.95rem;
    line-height: 1.3;
    margin-top: 5px;
}

/* Welcome Section Before Footer */
.welcome-section {
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 50px 0;
    text-align: center;
}

.welcome-box {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border: 1px solid #cce5ff;
    background-color: #f8fbff;
    border-radius: 8px;
}

body.dark-mode .welcome-box {
    background-color: #1a222b;
    border-color: #2c3e50;
}

.welcome-box h2 {
    color: var(--tag-blue);
    margin-bottom: 15px;
}

/* Footer */
.main-footer {
    background-color: var(--dark-bg);
    color: #d1d1d1;
    padding-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul a {
    text-decoration: underline;
}

.disclaimer-col {
    font-size: 0.85rem;
    line-height: 1.8;
    color: #999;
}

.footer-bottom {
    background-color: var(--darker-bg);
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
}

/* Cookie Modal */
.cookie-modal {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    background-color: var(--white);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 9999;
    padding: 25px;
    border-left: 4px solid var(--primary-color);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-modal.hidden {
    opacity: 0;
    visibility: hidden;
}

.cookie-content h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.cookie-content p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.cookie-content button {
    width: 100%;
}

/* Responsive */
@media (max-width: 992px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .hero-content {
        grid-template-columns: 1fr;
    }
    .recommended-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none; /* simple mobile fallback */
    }
    .recommended-grid {
        grid-template-columns: 1fr;
    }
    .cookie-modal {
        right: 50%;
        transform: translate(50%, -50%);
        width: 90%;
    }
}

/* Inner page styles */
/* INTERNAL PAGE SPECIFIC STYLES */

.internal-page {
    margin-top: 30px;
}

.single-article {
    background-color: var(--white);
    padding: 35px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    margin-bottom: 40px;
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 20px;
}
.breadcrumbs a {
    color: var(--primary-color);
}
.breadcrumbs span {
    color: var(--text-color);
}

/* Text Tags H1-H6, P, SPAN */
.single-article h1 {
    font-size: 2.4rem;
    line-height: 1.25;
    margin-bottom: 15px;
    color: var(--text-color);
    font-weight: 700;
}

.article-meta {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.article-body h2 {
    font-size: 1.8rem;
    margin: 40px 0 20px;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    padding-bottom: 5px;
}

.article-body h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
    color: var(--text-color);
}

.article-body h4 {
    font-size: 1.2rem;
    margin: 25px 0 10px;
    color: var(--text-color);
}

.article-body h5, .article-body h6 {
    font-size: 1.05rem;
    margin: 20px 0 10px;
    color: var(--text-color);
}

.article-body p {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 20px;
    color: var(--text-color);
}

.article-body span.highlight {
    background-color: rgba(217, 83, 79, 0.1);
    color: var(--primary-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* Responsive Images */
.article-main-img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 30px;
}

.article-inline-img {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: cover;
    border-radius: 8px;
    margin: 25px 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

/* Table of Contents (TOC) */
.toc {
    background-color: var(--bg-color);
    padding: 25px;
    border-radius: 8px;
    margin: 30px 0;
    border-left: 5px solid var(--primary-color);
}
.toc h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: var(--text-color);
}
.toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc ul li {
    margin-bottom: 10px;
}
.toc ul li a {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}
.toc ul li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Lists UL, OL */
.article-body ul, .article-body ol {
    margin: 0 0 25px 25px;
    padding-left: 15px;
}
.article-body ul li, .article-body ol li {
    margin-bottom: 12px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-color);
}
.article-body ul li::marker {
    color: var(--primary-color);
}
.article-body ol li::marker {
    color: var(--primary-color);
    font-weight: 600;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin: 30px 0;
}
.article-body table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
}
.article-body table th, .article-body table td {
    padding: 15px;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}
.article-body table th {
    background-color: var(--dark-bg);
    color: #fff;
    font-weight: 600;
}
.article-body table tbody tr:nth-child(even) {
    background-color: var(--bg-color);
}
body.dark-mode .article-body table tbody tr:nth-child(even) {
    background-color: rgba(255,255,255,0.02);
}

/* Forms Generic Styles (Contact & Comments) */
.form-wrapper {
    background-color: var(--white);
    padding: 35px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    margin-top: 40px;
}
.form-wrapper h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}
.form-wrapper p {
    color: var(--text-light);
    margin-bottom: 25px;
}
.custom-form {
    display: grid;
    gap: 20px;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.custom-form input, .custom-form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.custom-form input:focus, .custom-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(217, 83, 79, 0.1);
}
.custom-form textarea {
    resize: vertical;
    min-height: 150px;
}

/* Comments Specific */
.comments-list {
    margin-bottom: 40px;
}
.comment-item {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}
.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.comment-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--bg-color);
}
.comment-content h5 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}
.comment-date {
    font-size: 0.85rem;
    color: var(--text-light);
    display: block;
    margin-bottom: 10px;
}
.comment-content p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
}

.comment-form-block h4 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
}

/* Social Share */
.share-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}
.share-bar span {
    font-weight: 600;
}

/* Sidebar Related Articles Widget */
.related-widget .related-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}
.related-widget .related-item:last-child {
    margin-bottom: 0;
}
.related-widget img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
}
.related-info {
    display: flex;
    flex-direction: column;
}
.tag-small {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    color: #fff;
    display: inline-block;
    margin-bottom: 5px;
    align-self: flex-start;
}
.related-info a {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Responsive adjustments for internal page */
@media (max-width: 768px) {
    .single-article h1 {
        font-size: 1.8rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .comment-item {
        flex-direction: column;
        gap: 10px;
    }
}