/* Minimalist Journal CSS */

:root {
    /* New Off-White & Blue Palette */
    --bg-primary: #f8fafc;      /* Very light off-white (ice) */
    --bg-secondary: #ffffff;    /* Pure white for cards */
    --text-primary: #1e293b;    /* Slate blue-gray for readability */
    --text-secondary: #3b82f6;  /* Action Blue (primary accents) */
    --text-tertiary: #64748b;   /* Muted blue-gray for metadata */
    --accent: #0f172a;          /* Deep Navy for headers */
    --border: #e2e8f0;          /* Soft blue-tinted border */
    --hover-bg: #eff6ff;        /* Very light blue tint on hover */
    --upvote-active: #2563eb;   /* Solid Royal Blue */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Crimson Pro', 'Georgia', serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Load Google Font */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@300;400;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* Header */
header {
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.9);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: var(--accent);
    font-family: 'Crimson Pro', serif;
    position: relative;
    display: inline-block;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 1px;
    background-color: var(--text-tertiary);
    opacity: 0.5;
}

/* Main Content */
main {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* Blog List */
.blog-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.blog-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.75rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    gap: 1.5rem;
}

.blog-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    /* background-color: var(--hover-bg);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1); */
    z-index: 0;
}

.blog-item:hover::before {
    width: 100%;
}

.blog-item:hover {
    border-color: var(--text-tertiary);
}

.blog-item:first-child {
    border-top: 1px solid var(--border);
}

/* Blog Info */
.blog-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: relative;
    z-index: 1;
}

.blog-info a {
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 400;
    transition: var(--transition);
    letter-spacing: -0.01em;
    line-height: 1.4;
    outline: none;
}

.blog-info a:focus,a:active{
    outline: none;
}

.blog-info a:hover {
    color: rgb(0, 77, 192);
    transform: translateX(4px);
}

.time-ago {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Upvote Button */
.upvote-btn {
/* Layout: Force horizontal alignment */
    display: inline-flex;
    flex-direction: row; 
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Space between "Upvote" and the number */
    white-space: nowrap; /* Prevents text from ever splitting into two lines */
    
    /* Styling: Keeping your original design */
    background-color: transparent;
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--text-secondary);
    
    /* Positioning & Sizing */
    min-width: 120px; /* Increased slightly to fit "Upvoted" comfortably */
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.upvote-btn:hover {
    background-color: var(--hover-bg);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.upvote-btn:active {
    transform: translateY(0);
}

.upvote-btn.voted {
    background-color: var(--upvote-active);
    border-color: var(--upvote-active);
    color: white;
}

.upvote-btn .count {
    font-size: 0.75rem;
    font-weight: 500;
    display: block;
}

/* Responsive Design */

/* Tablet */
@media (max-width: 768px) {
    header {
        padding: 2.5rem 1.25rem 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 2rem 1rem;
    }

    .blog-item {
        padding: 1.5rem 1rem;
        gap: 1rem;
    }

    .blog-info a {
        font-size: 1.125rem;
    }

    .upvote-btn {
        min-width: 55px;
        padding: 0.65rem 0.85rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    header {
        padding: 2rem 1rem 1.25rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    main {
        padding: 1.5rem 0.75rem;
    }

    .blog-item {
        padding: 1.25rem 0.75rem;
        gap: 0.75rem;
        flex-direction: column;
        align-items: stretch;
    }

    .blog-info {
        gap: 0.375rem;
    }

    .blog-info a {
        font-size: 1rem;
    }

    .time-ago {
        font-size: 0.8125rem;
    }

    .upvote-btn {
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem;
        min-width: unset;
        width: 100%;
    }

    .upvote-btn .count {
        font-size: 0.875rem;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.5rem;
    }

    .blog-info a {
        font-size: 0.9375rem;
    }

    .blog-item {
        padding: 1rem 0.5rem;
    }
}

/* Focus States for Accessibility */
/* .upvote-btn:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
} */

/* Loading State (optional) */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.blog-item {
    animation: fadeIn 0.5s ease-out backwards;
}

.blog-item:nth-child(1) {
    animation-delay: 0.05s;
}

.blog-item:nth-child(2) {
    animation-delay: 0.1s;
}

.blog-item:nth-child(3) {
    animation-delay: 0.15s;
}

.blog-item:nth-child(4) {
    animation-delay: 0.2s;
}

.blog-item:nth-child(5) {
    animation-delay: 0.25s;
}
