/* style.css - Minimalist card style */

:root {
    --bg-color: #fcfbf7; /* Warm off-white */
    --text-primary: #111827; /* Near black */
    --text-secondary: #4b5563; /* Medium gray */
    --accent: #fde047; /* Yellow accent, optional */
    --border-radius: 12px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header Navbar */
header {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 a {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

header nav {
    display: flex;
    align-items: center;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 15px;
}

#search-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

#search-toggle:hover {
    color: var(--text-primary);
}

.search-input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    opacity: 0;
    transition: width 0.3s ease, opacity 0.3s ease, padding 0.3s ease, border-bottom 0.3s ease;
    border-bottom: 1px solid transparent;
}

.search-input.active {
    width: 140px;
    opacity: 1;
    padding: 5px 8px;
    margin-left: 5px;
    border-bottom: 1px solid var(--text-secondary);
}

.search-input:focus {
    outline: none;
    border-bottom-color: var(--text-primary);
}

header nav a {
    text-decoration: none;
    color: var(--text-secondary);
    margin-left: 20px;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

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

/* Main Container */
main.home-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

main.article-layout {
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 20px 80px 20px;
}

/* Admin Container uses home width or separate */
main.admin-layout {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Post Grid / List */
.post-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 20px;
}

@media (max-width: 900px) {
    .post-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .post-list {
        grid-template-columns: 1fr;
    }
}

/* Post Card */
.post-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03); /* Extremely soft shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.post-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    background-color: #f3f4f6; /* Placeholder gray */
    background-size: cover;
    background-position: center;
}

.post-content {
    padding: 24px 28px;
}

.post-content h2 {
    font-family: var(--font-serif);
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.post-content p.date {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-content p.excerpt {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Truncate excerpt */
    line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

/* Single Post View */
.article-header {
    text-align: center;
    margin-bottom: 40px;
}

.article-header h1 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    line-height: 1.3;
    margin-bottom: 15px;
}

.article-header .date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.article-cover {
    width: 100%;
    border-radius: var(--border-radius);
    aspect-ratio: 21 / 9;
    object-fit: cover;
    margin-bottom: 40px;
}

.markdown-body {
    font-size: 1.05rem;
    line-height: 1.8;
}

.markdown-body h2, .markdown-body h3 {
    font-family: var(--font-serif);
    margin-top: 2em;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

.markdown-body pre {
    background: #0d1117;
    color: #c9d1d9;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.markdown-body code {
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
    font-size: 0.9em;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

/* Fix image max-width inside markdown */
.markdown-body img {
    max-width: 100%;
    border-radius: 12px;
    margin: 30px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* Blockquote styling */
.markdown-body blockquote {
    margin: 20px 0;
    padding: 0 20px;
    color: var(--text-secondary);
    border-left: 4px solid var(--text-primary);
    font-style: italic;
}

/* Admin Setup */
.admin-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group textarea {
    min-height: 400px;
    resize: vertical;
}

.btn {
    background: var(--text-primary);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
}

.btn:hover {
    opacity: 0.9;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 40px;
    padding-bottom: 20px;
}

.pagination button {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid #e5e7eb;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--text-primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f9f9f9;
}
