:root {
    --max-width: 720px;
    --color-text: #2b2b2b;
    --color-muted: #767676;
    --color-bg: #fdfdfb;
    --color-accent: #a64942;
    --color-border: #e6e2da;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.65;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Header */
.site-header {
    border-bottom: 1px solid var(--color-border);
    padding: 2rem 0 1.25rem;
    margin-bottom: 2.5rem;
}

.site-header-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.site-nav-auth {
    margin-left: auto;
}

.site-title {
    font-size: 1.9rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-title a {
    color: var(--color-text);
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 1.25rem;
}

.site-nav a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.site-nav a:hover {
    color: var(--color-accent);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--color-border);
    margin-top: 3.5rem;
    padding: 1.5rem 0 3rem;
    color: var(--color-muted);
    font-size: 0.85rem;
}

/* Post list */
.post-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.post-list-item {
    margin-bottom: 2.25rem;
    padding-bottom: 2.25rem;
    border-bottom: 1px solid var(--color-border);
}

.post-list-item:last-child {
    border-bottom: none;
}

.post-list-title {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
}

.post-list-title a {
    color: var(--color-text);
    text-decoration: none;
}

.post-list-title a:hover {
    color: var(--color-accent);
}

.post-meta {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}

.post-meta a {
    color: var(--color-muted);
}

.post-excerpt {
    margin: 0;
}

.empty-state {
    color: var(--color-muted);
    font-style: italic;
}

/* Post detail */
.post-title {
    font-size: 2.1rem;
    margin: 0 0 0.5rem;
    line-height: 1.25;
}

.post-content {
    margin-top: 1.75rem;
    font-size: 1.08rem;
}

.post-content p {
    margin: 0 0 1.25rem;
}

/* Prev/Next navigation */
.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.95rem;
}

.post-nav-link {
    flex: 1;
    text-decoration: none;
    color: var(--color-text);
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: border-color 0.15s ease;
}

.post-nav-link:hover {
    border-color: var(--color-accent);
}

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

.post-nav-label {
    display: block;
    color: var(--color-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.post-nav-spacer {
    flex: 1;
}

/* Comments */
.comments-section {
    margin-top: 3rem;
}

.comments-title {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment {
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.95rem;
}

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

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 600;
}

.comment-date {
    color: var(--color-muted);
    font-size: 0.8rem;
}

.comment-text {
    margin: 0.4rem 0 0;
}

.comment-deleted {
    color: var(--color-muted);
    font-style: italic;
    margin: 0;
}

.comment-edited {
    color: var(--color-muted);
    font-size: 0.8rem;
}

/* Comment dropdown menu */
.comment-menu {
    position: relative;
    margin-left: auto;
}

.comment-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 0 0.25rem;
    line-height: 1;
    border-radius: 4px;
}

.comment-menu-btn:hover {
    color: var(--color-text);
    background: var(--color-border);
}

.comment-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 110px;
    z-index: 10;
    overflow: hidden;
}

.comment-dropdown.open {
    display: block;
}

.comment-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--color-text);
}

.comment-dropdown-item:hover {
    background: var(--color-border);
}

.comment-dropdown-danger {
    color: #b33a3a;
}

/* Inline comment edit form */
.comment-edit-form {
    display: none;
    margin-top: 0.5rem;
}

.comment-edit-textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.comment-edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Archive */
.archive-title {
    margin-bottom: 0.25rem;
}

.archive-subnav {
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.archive-subnav a {
    color: var(--color-accent);
    text-decoration: none;
}

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

.archive-more {
    display: inline-block;
    margin-top: 0.4rem;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.15em;
}

.archive-more:hover {
    text-decoration: underline;
}

.archive-group-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin: 0 0 0.5rem;
}

.archive-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.archive-list li {
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--color-border);
}

.archive-list a {
    color: var(--color-text);
    text-decoration: none;
}

.archive-list a:hover {
    color: var(--color-accent);
}

.archive-date {
    color: var(--color-muted);
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

/* Year archive icon grid */
.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 1.25rem;
}

.year-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    aspect-ratio: 1 / 1;
    width: 96px;
    border-radius: 22px;
    background: linear-gradient(160deg, #f4efe6, #ece4d6);
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 0.12s ease, border-color 0.12s ease;
    overflow: hidden;
    padding: 0.5rem;
}

.year-icon:hover {
    transform: translateY(-2px);
    border-color: var(--color-accent);
}

.year-icon-year {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.year-icon-count {
    font-size: 0.7rem;
    color: var(--color-muted);
    text-align: center;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
}

.pagination-link {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-text);
}

.pagination-link:hover {
    border-color: var(--color-accent);
}

.pagination-link.current {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.pagination-link.disabled {
    color: var(--color-muted);
    border-color: var(--color-border);
    opacity: 0.5;
}

/* 404 / not found */
.not-found {
    text-align: center;
    padding: 4rem 0;
}

.not-found-title {
    font-size: 4rem;
    margin: 0;
    color: var(--color-accent);
}

.not-found-message {
    font-size: 1.1rem;
    color: var(--color-muted);
    margin: 1rem 0 2rem;
}

.not-found-link {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 0.95rem;
}

.not-found-link:hover {
    text-decoration: underline;
}

/* About page */
.about-photo {
    display: block;
    max-width: 100%;
    width: 320px;
    border-radius: 12px;
    margin: 1.5rem 0;
    border: 1px solid var(--color-border);
}

/* Forms */
.auth-form,
.comment-form {
    margin-top: 1.25rem;
    max-width: 480px;
}

.auth-form p,
.comment-form p {
    margin: 0 0 1rem;
}

.auth-form label,
.comment-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.auth-form input,
.auth-form textarea,
.comment-form textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    background: #fff;
    color: var(--color-text);
}

.auth-form input:focus,
.auth-form textarea:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.auth-form ul.errorlist,
.comment-form ul.errorlist {
    list-style: none;
    margin: 0 0 0.4rem;
    padding: 0;
    color: var(--color-accent);
    font-size: 0.85rem;
}

.form-error {
    color: var(--color-accent);
    font-size: 0.9rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1.25rem;
    background: #b33a3a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
    border-color: transparent;
}

.btn-danger {
    background: #b33a3a;
}

.post-admin-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin: 1.5rem 0;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 2rem;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-message {
    margin: 0 0 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.auth-switch {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.auth-switch a {
    color: var(--color-accent);
}

/* Logout button styled like a nav link */
.logout-form {
    display: inline;
    margin: 0;
}

.link-button {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    color: var(--color-muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
}

.link-button:hover {
    color: var(--color-accent);
}
