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

body {
    background-color: var(--cream);
    background-image: url("data:image/svg+xml,%3Csvg width='56' height='100' viewBox='0 0 56 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%23C1502E' stroke-width='1' stroke-opacity='0.25'/%3E%3C/svg%3E");
    
    color: var(--espresso);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    animation: driftMatrix 30s linear infinite;
}
/* 
  The animation engine. 
  112 and 200 are exact multiples of the SVG's 56x100 dimensions, 
  ensuring the loop resets seamlessly without skipping a frame!
*/
@keyframes driftMatrix {
    0% {
        background-position: 0px 0px;
    }
    100% {
        background-position: 112px 200px; 
    }
}

.navbar {
    background-color: var(--paper);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10%;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 600;
    color: var(--terracotta);
}

.nav-links {
    display: flex;
    gap: 24px;
    list-style: none;
}

.nav-links a {
    text-decoration: none;    
    color: var(--espresso);
    font-family: var(--mono); /* Using the monospace font for nav items */
    font-size: 14px;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--terracotta);          
}

/* =========================================
   TYPOGRAPHY & CONTAINERS
   ========================================= */
.wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 24px;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.5em;
}

h2 { font-size: 28px; margin-top: 0; }
h3 { font-size: 19px; margin-bottom: 0.6em; }
p { margin: 0 0 1em; }
a { color: var(--terracotta); }

.eyebrow {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--sage-dark);
    margin: 0 0 10px;
}

header.hero {
    padding: 64px 0 40px;
    border-bottom: 1px solid var(--border);
}

.kanji {
    font-family: var(--serif);
    font-size: 64px;
    font-weight: 600;
    color: var(--terracotta);
    line-height: 1;
    margin-bottom: 6px;
}

.hero h1 { font-size: 44px; margin-bottom: 8px; }
.hero .sub { font-size: 16px; color: var(--muted); max-width: 520px; }
.hero .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 24px; }


section {
    padding: 52px 0;
    border-bottom: 1px solid var(--border);
}
section:last-of-type { border-bottom: none; }

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    transition: border-color 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.post-card {
    position: relative;
    padding-right: 54px;
}

.post-card-link {
    color: inherit;
    text-decoration: none;
    display: block;
}

.post-delete-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--cream);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.post-delete-btn:hover {
    color: #9c3d2d;
    border-color: var(--terracotta);
    background: #fff2ec;
}

.post-delete-btn:focus-visible,
.modal-action:focus-visible {
    outline: 3px solid rgba(193, 80, 46, 0.2);
    outline-offset: 2px;
}

.card:hover {
    border-color: var(--terracotta);
}

.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14.5px; margin-bottom: 0; }
.card .tag { color: var(--sage); font-family: var(--mono); font-size: 12px; margin-top: 12px; display: block; }


/* =========================================
   FOOTER
   ========================================= */
.site-footer {
    padding: 40px 0 60px;
    border-top: 1px solid var(--border);
    margin-top: 52px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;    
    flex-wrap: wrap;
    gap: 20px;
}

.footer-text p {
    color: var(--muted);
    font-size: 13.5px;
    margin: 0 0 4px 0;
}

.footer-text a {
    color: var(--espresso);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 4px;
    transition: all 0.2s ease;
}

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

.footer-links {
    display: flex;
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links a {
    color: var(--muted);
    transition: color 0.2s ease;
    display: flex;
}

.footer-links a:hover {
    color: var(--terracotta);
    transition: transform 0.2s ease;
    transform: translateY(-2px);
}


/* Button on about page */
.btn-outline {
    display: inline-block;
    margin-top: 16px;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--terracotta);
    text-decoration: none;
    border: 1px solid var(--terracotta);
    padding: 8px 16px;
    border-radius: 4px;
    background: transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    flex-shrink: 0; /* Prevent the button from shrinking in flex containers */
}

.btn-outline:hover {
    background: var(--terracotta);
    color: var(--paper); 
}

.btn-outline:active {
    transform: translateY(2px); 
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-card {
    background: var(--paper);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-action {
    padding: 10px 20px;
    border-radius: 6px;
    font-family: var(--sans);
    cursor: pointer;
    transition: 0.2s;
}

.modal-action-secondary {
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--espresso);
}

.modal-action-danger {
    border: none;
    background: var(--terracotta);
    color: white;
}


/* markdown content */
.markdown-content {
    font-size: 17px;
    line-height: 1.8;
    color: var(--espresso);
}

.markdown-content a {
    color: var(--terracotta);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.markdown-content strong {
    font-weight: 700;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content del {
    color: var(--muted);
}

.markdown-content u {
    text-decoration-color: var(--terracotta);
    text-underline-offset: 3px;
}

.markdown-content pre {
    margin: 1.25rem 0;
    padding: 16px 18px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow-x: auto;
    white-space: pre;
}

.markdown-content code {
    font-family: var(--mono);
    font-size: 0.95em;
}

.markdown-content pre code {
    display: block;
    color: var(--espresso);
}

.markdown-content img {
    max-width: 100%;
    height: auto;
}


/* =========================================
   MOBILE & TABLET RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    .grid2 {
        grid-template-columns: 1fr;
    }

    .hero h1 { 
        font-size: 34px; 
    }
    .kanji { 
        font-size: 48px; 
    }

    .navbar {
        padding: 16px 5%;
        flex-direction: column;
        gap: 16px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    .footer-links {
        justify-content: center;
    }

    .editor-title {
        font-size: 28px;
    }

    .modal-card {
        padding: 24px;
    }

    .modal-actions {
        flex-direction: column;
    }
}