/* Posts — diary style */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --ts-w: 4.5rem;
    --ts-gap: 0.8rem;
    --indent: calc(var(--ts-w) + var(--ts-gap));
    --seam: 20vw;           /* plus & motes track this edge */
}

body {
    font-family: "Artifex Hand", Georgia, 'Times New Roman', Times, serif;
    font-size: 18px;
    line-height: 1.7;
    color: #333;
    background: #fff3e4;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Dawn canvas — right edge */
#dawn {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--seam);
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background-color: #fffcf7;
}

/* ========================================
   SHARED ENTRY — diary layout
   ======================================== */

.entry {
    display: grid;
    grid-template-columns: var(--ts-w) 1fr;
    gap: 0 var(--ts-gap);
    align-items: baseline;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e8e8e8;
}

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

.entry-time {
    grid-row: 1 / 3;
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
    padding-top: 0.15em;
}

.entry-time a {
    color: #999;
    text-decoration: none;
}

.entry-time a:hover {
    color: #4c0c9e;
}

.entry-content {
    font-family: "Artifex Hand", Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555;
}

.entry-content a.entry-link {
    text-decoration: none;
    color: inherit;
}

.entry-content a.entry-link:hover .t {
    color: #4c0c9e;
    text-decoration: underline;
}

.entry-content .t {
    font-weight: 700;
    color: #0c279e;
}

.entry-content .s {
    font-weight: 100;
    color: #ccc;
    margin: 0 0.1em;
}

.entry-content .b {
    font-weight: 200;
    color: #555;
}

/* HTML body content within entries */
.entry-content .b p { margin-bottom: 0.6em; }
.entry-content .b p:last-child { margin-bottom: 0; }
.entry-content .b a { color: #2563a8; }
.entry-content .b a:hover { color: #1a4a80; }

.entry-content .b blockquote {
    border-left: 3px solid #e8e8e8;
    padding-left: 1em;
    margin: 1em 0;
    color: #666;
    font-style: italic;
}

.entry-content .b code {
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 0.9em;
    background: #f5f5f5;
    padding: 2px 5px;
    border-radius: 3px;
}

.entry-content .b pre {
    background: #f5f5f5;
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1em 0;
}

.entry-content .b pre code {
    background: none;
    padding: 0;
}

.entry-content .b img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-top: 0.5em;
}

.entry-meta {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 0.7rem;
    color: #bbb;
    margin-top: 0.3rem;
}

.entry-meta .stat {
    display: flex;
    align-items: center;
    gap: 3px;
}

.entry-meta .bsky-link a {
    color: #2563a8;
    text-decoration: none;
}

.entry-meta .bsky-link a:hover {
    text-decoration: underline;
}

/* ========================================
   POST PAGE (permalink view)
   ======================================== */

.post-page {
    position: relative;
    z-index: 1;
    max-width: min(720px, calc(65vw - 1rem));
    padding: 4rem 2.5rem 3rem;
}

/* Indent to align with entry text column */
.post-page .post-back,
.post-page .post-footer {
    margin-left: var(--indent);
}

.post-page .entry {
    border-bottom: none;
    margin-bottom: 1.5rem;
    padding-bottom: 0;
}

/* Back link */
.post-back {
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    margin-bottom: 2rem;
}

.post-back a {
    color: #999;
    text-decoration: none;
}

.post-back a:hover {
    color: #4c0c9e;
}

/* Footer nav */
.post-footer {
    padding-top: 1.5rem;
    border-top: 1px solid #e8e8e8;
}

.post-footer-nav {
    list-style: none;
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    font-family: "SF Mono", "Fira Code", Consolas, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.post-footer-nav a {
    color: #999;
    text-decoration: none;
}

.post-footer-nav a:hover {
    color: #4c0c9e;
}

/* ========================================
   POSTS INDEX (/posts/)
   ======================================== */

.posts-index {
    position: relative;
    z-index: 1;
    max-width: min(720px, calc(65vw - 1rem));
    padding: 4rem 2.5rem 3rem;
}

/* Indent non-entry content to align with entry text */
.posts-index h1,
.posts-index .tagline,
.posts-index .post-back,
.posts-index .post-footer {
    margin-left: var(--indent);
}

.posts-index h1 {
    font-family: "Artifex Hand", Georgia, serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: #0c279e;
    margin-bottom: 0.25rem;
    letter-spacing: -0.01em;
}

.posts-index .tagline {
    font-family: "Artifex Hand", Georgia, serif;
    font-size: 0.95rem;
    font-weight: 300;
    color: #999;
    font-style: italic;
    margin-bottom: 3rem;
}

/* Loading state */
.loading {
    position: relative;
    z-index: 1;
    padding: 4rem 0;
    padding-left: var(--indent);
    color: #999;
    font-style: italic;
}

/* Not found */
.not-found {
    position: relative;
    z-index: 1;
    padding: 4rem 2.5rem;
    padding-left: calc(2.5rem + var(--indent));
}

.not-found h1 {
    font-family: "Artifex Hand", Georgia, serif;
    color: #0c279e;
    margin-bottom: 0.5rem;
}

.not-found p { color: #888; }
.not-found a { color: #2563a8; }

/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet: seam stays at 20vw (the default) */
@media (max-width: 1000px) and (min-width: 701px) {
    .post-page,
    .posts-index {
        max-width: min(720px, calc(80vw - 1rem));
    }
}

/* Mobile: canvas flips horizontal */
@media (max-width: 700px) {
    :root {
        --indent: 0;
    }

    #dawn {
        position: relative;
        width: 100%;
        height: 120px;
    }

    .post-page,
    .posts-index {
        max-width: 100%;
        padding: 2rem 1rem 3rem;
    }

    .entry {
        grid-template-columns: 1fr;
    }

    .entry-time {
        grid-row: auto;
        margin-bottom: 0.15rem;
    }

    .entry-meta {
        grid-column: 1;
    }

    .posts-index h1 { font-size: 1.8rem; }
    .posts-index .tagline { margin-bottom: 2rem; }

    .not-found {
        padding-left: 1rem;
    }
}

/* Tablet: sized for 640px content well */
@media (min-width: 701px) and (max-width: 1000px) {
    .entry-content {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    .entry-time {
        font-size: 0.8rem;
        padding-top: 0.3em;
    }

    .post-page .entry-content {
        font-size: 2rem;
        line-height: 1.2;
    }

    .post-page .entry-time {
        font-size: 0.85rem;
        padding-top: 0.4em;
    }
}

/* Desktop: full size with canvas room */
@media (min-width: 1001px) {
    .entry-content {
        font-size: 2rem;
        line-height: 1.2;
    }

    .entry-time {
        font-size: 0.85rem;
        padding-top: 0.4em;
    }

    .post-page .entry-content {
        font-size: 3rem;
        line-height: 1.15;
    }

    .post-page .entry-time {
        font-size: 0.9rem;
        padding-top: 0.55em;
    }
}
