@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400..700;1,14..32,400..700&family=Lora:wght@400;600;700&display=swap');

:root {
    --bg-color: #f7f7f5;
    --surface-color: #ffffff;
    --text-color: #1a1a1a;
    --accent-color: #1a1a1a;
    --link-color: #b45309;
    --link-hover: #92400e;
    --secondary-color: #6b7280;
    --border-color: #d4d4d4;
    --border-light: #e5e5e5;
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --heading-font: 'Lora', 'Georgia', serif;
    --max-width: 900px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: var(--font-family);
    line-height: 1.65;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--heading-font);
    color: var(--text-color);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* --------------------
   Site Header & Nav
   -------------------- */

.site-header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
}

.site-header__inner {
    max-width: 66rem;
    margin: 0 auto;
    padding: 0 1.05rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.top-menu {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.top-menu__item {
    display: inline-flex;
    align-items: center;
}

.top-menu__link {
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--secondary-color);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    transition: color 0.2s ease, background 0.2s ease;
}

.top-menu__link:hover {
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

.top-menu__link[aria-current="page"] {
    color: var(--text-color);
}

.top-menu__divider {
    color: var(--border-color);
    margin: 0 0.1rem;
    user-select: none;
}

/* Legacy header styles for blog/admin pages */
header:not(.site-header) {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

header:not(.site-header) nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    font-size: 0.9rem;
}

header:not(.site-header) h1 {
    max-width: var(--max-width);
    margin: 0.5rem auto 0;
    padding: 0 1rem;
    font-size: 1.5rem;
}

header:not(.site-header) h1 a {
    color: var(--text-color);
    text-decoration: none;
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 60vh;
}

.flex-1 {
    flex: 1;
}

/* Post List */
.post-preview {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.post-preview h2 {
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.post-preview time {
    color: var(--secondary-color);
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Single Post */
.post-full header {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 1.5rem;
    text-align: left;
}

.post-full h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    padding: 0;
}

.post-full time {
    color: var(--secondary-color);
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}

.featured-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    margin-bottom: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* --------------------
   Site Footer
   -------------------- */

.site-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--secondary-color);
    font-size: 0.85rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
}

.site-footer__inner {
    max-width: 66rem;
    margin: 0 auto;
    padding: 0 1.05rem;
}

.site-footer__inner p {
    margin: 0.25rem 0;
}

.site-footer a {
    color: var(--secondary-color);
}

.site-footer a:hover {
    color: var(--text-color);
}

footer:not(.site-footer) {
    text-align: center;
    padding: 2rem 0;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

/* Responseiveness */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.25rem;
    }

    .post-full h1 {
        font-size: 1.75rem;
    }
}

/* --------------------
   Admin Area Styles
   -------------------- */

/* Wider layout for Admin */
body.admin-dashboard main,
body.admin-editor main,
body.admin-page main {
    max-width: 1200px;
    padding: 0 2rem;
}

body.admin-dashboard header,
body.admin-editor header {
    background: #1e293b;
    color: #e2e8f0;
    border-bottom: 1px solid #334155;
}

body.admin-dashboard header h1,
body.admin-editor header h1 {
    color: #f1f5f9;
}

body.admin-dashboard header a,
body.admin-editor header a {
    color: #94a3b8;
    transition: color 0.2s ease;
}

body.admin-dashboard header a:hover,
body.admin-editor header a:hover {
    color: #fff;
    text-decoration: none;
}

/* Admin Utilities */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    overflow: hidden;
}

th,
td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-published {
    background-color: #d4edda;
    color: #155724;
}

.status-draft {
    background-color: #ffeeba;
    color: #856404;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-primary {
    background-color: var(--text-color);
    color: white;
}

.btn-primary:hover {
    background-color: #333;
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
    text-decoration: none;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 3px;
    text-decoration: none;
}

.btn-edit {
    background-color: #e2e6ea;
    color: #333;
    border: 1px solid #ced4da;
}

.btn-edit:hover {
    background-color: #dae0e5;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
}

.btn-delete:hover {
    background-color: #c82333;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Forms */
.editor-form {
    background: var(--surface-color);
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group .flex-1,
.flex-1.form-group {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--surface-color);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--text-color);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
}

.form-group textarea {
    min-height: 500px;
    line-height: 1.6;
    font-family: 'Courier New', Courier, monospace;
    /* helpful for HTML editing */
}

.checkbox-group {
    display: flex;
    align-items: center;
    padding-top: 2rem;
}

.checkbox-group label {
    font-weight: normal;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Image Preview */
.image-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

.image-preview img {
    max-width: 200px;
    display: block;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.help-text {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Editor Styles (Quill overrides if needed) */
.editor-container {
    max-width: 900px !important;
    /* Restore width limit */
    margin: 0 auto;
}

@media (max-width: 1200px) {
    .editor-container {
        padding: 0 1rem;
    }
}

/* Blog Frontend Styles */
.blog-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2.5rem;
    margin-top: 2rem;
}

.blog-main {
    min-width: 0;
    /* Prevents grid blowout */
}

.blog-sidebar {
    position: sticky;
    top: 2rem;
    align-self: start;
}

.sidebar-widget {
    background: var(--surface-color);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-widget h3 {
    margin-top: 0;
    font-size: 1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--text-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.search-widget form {
    display: flex;
    gap: 0.5rem;
}

.search-widget input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.search-widget button {
    padding: 0.5rem 1rem;
    background: var(--text-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.search-widget button:hover {
    background: #333;
}

.archives-widget .archives-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.archive-year {
    border-radius: 0;
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}

.archive-year.expanded {
    box-shadow: none;
}

.archive-year-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-light);
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.archive-year.expanded .archive-year-toggle {
    color: var(--link-color);
    background: transparent;
    border-bottom-color: var(--link-color);
}

.archive-year-toggle:hover {
    color: var(--link-color);
    background: transparent;
}

.archive-year-label {
    flex: 1;
    text-align: left;
    letter-spacing: 0.02em;
}

.archive-year-count {
    color: var(--secondary-color);
    font-size: 0.8rem;
    font-weight: 500;
}

.archive-toggle-icon {
    font-size: 0.6rem;
    color: var(--secondary-color);
    transition: transform 0.25s ease;
    margin-left: 0.25rem;
}

.archive-year.expanded .archive-toggle-icon {
    transform: rotate(180deg);
}

.archive-months {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background: transparent;
    border: none;
    border-radius: 0;
}

.archive-months li {
    margin: 0;
    padding: 0;
}

.archive-months li:not(:last-child) {
    border-bottom: 1px solid var(--border-light);
}

.archive-months a {
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.archive-months a span {
    color: var(--secondary-color);
    font-size: 0.8rem;
    font-weight: 500;
}

.archive-months a:hover {
    color: var(--link-color);
    background: rgba(180, 83, 9, 0.04);
    text-decoration: none;
}

/* Post Thumbnails */
.post-preview {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    align-items: start;
    background: var(--surface-color);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-preview:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.post-thumbnail img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
}

.post-content h2 {
    margin-top: 0;
    font-size: 1.4rem;
}

/* Single Post View override to not grid */
.single-post-view {
    display: block;
    max-width: 800px;
    margin: 0 auto;
}

/* Post Navigation */
.post-navigation {
    display: flex;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.post-nav-item {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.post-nav-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--link-color);
    text-decoration: none;
}

.post-nav-image {
    flex-shrink: 0;
}

.post-nav-image img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 6px;
}

.post-nav-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.post-nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary-color);
    font-weight: 600;
}

.post-nav-title {
    font-family: var(--heading-font);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
}

.post-nav-next {
    text-align: right;
}

.post-nav-next .post-nav-content {
    align-items: flex-end;
}

.post-nav-prev .post-nav-content {
    align-items: flex-start;
}


@media (max-width: 900px) {
    .blog-container {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        position: static;
        margin-top: 3rem;
    }

    .post-preview {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .post-thumbnail img {
        height: 200px;
        width: 100%;
    }

    .post-navigation {
        flex-direction: column;
        gap: 1rem;
    }

    .post-nav-next {
        text-align: left;
    }

    .post-nav-next .post-nav-content {
        align-items: flex-start;
    }
}

@media (max-width: 1200px) {
    .editor-grid {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .editor-container-fluid {
        padding: 0 1rem;
    }

    .preview-pane {
        margin-top: 2rem;
        height: 500px;
    }
}