/* esnail — a quiet old-school Japanese-style Ghost theme. */
/* Self-hosted fonts (relative path resolves under /assets/fonts/ in both Ghost and preview). */
@font-face {
    font-family: "M PLUS 2";
    font-style: normal;
    font-weight: 400;
    src: url("../fonts/m-plus-2-latin-400-normal.woff2") format("woff2"), url("../fonts/m-plus-2-latin-400-normal.woff") format("woff");
    font-display: swap;
}

@font-face {
    font-family: "M PLUS 2";
    font-style: normal;
    font-weight: 700;
    src: url("../fonts/m-plus-2-latin-700-normal.woff2") format("woff2"), url("../fonts/m-plus-2-latin-700-normal.woff") format("woff");
    font-display: swap;
}
@font-face {
    font-family: "Noto Serif";
    font-style: normal;
    font-weight: 400;
    src: url("../fonts/noto-serif-latin-400-normal.woff2") format("woff2"), url("../fonts/noto-serif-latin-400-normal.woff") format("woff");
    font-display: swap;
}
@font-face {
    font-family: "Noto Serif";
    font-style: italic;
    font-weight: 400;
    src: url("../fonts/noto-serif-latin-400-italic.woff2") format("woff2"), url("../fonts/noto-serif-latin-400-italic.woff") format("woff");
    font-display: swap;
}
@font-face {
    font-family: "Noto Serif";
    font-style: normal;
    font-weight: 700;
    src: url("../fonts/noto-serif-latin-700-normal.woff2") format("woff2"), url("../fonts/noto-serif-latin-700-normal.woff") format("woff");
    font-display: swap;
}
@font-face {
    font-family: "M PLUS Code Nerd";
    font-style: normal;
    font-weight: 400;
    src: url("../fonts/M+CodeLat60NerdFontMono-Regular.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "M PLUS Code Nerd";
    font-style: normal;
    font-weight: 700;
    src: url("../fonts/M+CodeLat60NerdFontMono-Bold.ttf") format("truetype");
    font-display: swap;
}


@font-face {
    font-family: "SHINGO";
    font-style: normal;
    font-weight: 300;
    src: url("../fonts/SHINGO-Light-Latin.woff") format("woff");
    unicode-range: U+0000-024F, U+2000-206F, U+20A0-20CF;
    font-display: swap;
}
@font-face {
    font-family: "SHINGO";
    font-style: normal;
    font-weight: 300;
    src: url("../fonts/SHINGO-Light-Extended.woff") format("woff");
    unicode-range: U+0250-1FFF, U+2070-209F, U+20D0-FFFF, U+10000-10FFFF;
    font-display: swap;
}

:root {
    --bg: #faf8f3;
    --ink: #26221f;
    --heading: #514b46;
    --muted: #6b6560;
    --line: #d8d2c4;
    --divider: #ded9ce;
    --section-space: 1.75rem;
    --accent: #8b2e2e;
    --max-width: 42rem;
    --gh-font-heading: "SHINGO", "M PLUS 2", serif;
    --gh-font-body: "M PLUS 2", "Noto Serif", serif;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 100%;
}

body {
    margin: 0;
    overflow-wrap: anywhere;
    background: var(--bg);
    color: var(--ink);
    font-family: "M PLUS 2", "Noto Serif", "Noto Serif JP", serif;
    line-height: 1.6;
    font-size: 1.0625rem;
    -webkit-font-smoothing: antialiased;
}

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

/* header */

.site-header {
    position: relative;
    text-align: center;
    margin-bottom: 3rem;
}

.site-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    color: var(--heading);
    text-decoration: none;
    border: 0;
    border-radius: 0;
}
.site-header > .site-icon {
    position: absolute;
    top: -0.25rem;
    right: 0;
}
.site-icon img {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
    image-rendering: pixelated;
}
.site-icon span {
    font-size: 1.5rem;
    line-height: 1;
}

.site-title {
    font-family: "SHINGO", serif;
    font-size: 1.75rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-decoration: none;
    color: var(--heading);
}

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

.site-description {
    color: var(--muted);
    font-size: 0.9375rem;
    margin: 0.5rem 0 0;
    letter-spacing: 0.05em;
}

.site-nav {
    margin-top: 1.25rem;
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

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

/* archive / index */

.page-intro {
    text-align: center;
    color: var(--muted);
    font-size: 0.9375rem;
    margin-bottom: 2rem;
}

.archive-title {
    font-family: "SHINGO", serif;
    font-size: 1.375rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-align: center;
    margin: 0 0 2rem;
    color: var(--heading);
}

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

.post-item {
    padding: 0;
}

.post-item + .post-item {
    margin-top: var(--section-space);
}

.post-item::after {
    content: "";
    display: block;
    height: 1px;
    background: var(--divider);
    margin-top: var(--section-space);
}

.post-item:last-child::after {
    display: none;
}

.post-item:first-child {
    padding-top: 0;
}

.post-item-title {
    font-family: "SHINGO", serif;
    font-size: 1.25rem;
    font-weight: 300;
    margin: 0 0 0.5rem;
}

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

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

.post-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    color: var(--muted);
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
}

.post-item-meta time {
    white-space: nowrap;
}

.post-item-tag a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.8125rem;
}

.post-item-tag a:hover {
    color: var(--accent);
}

.post-item-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    color: var(--muted);
    font-family: "M PLUS 2", "Noto Serif", serif;
    font-size: 0.9375rem;
    margin: 0;
    line-height: 1.8;
}

/* pagination */

.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    text-align: center;
}

.page-number {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
}

.page-number:hover {
    color: var(--accent);
}

.page-number.current {
    color: var(--ink);
    font-weight: 700;
}

.newer-posts,
.older-posts {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.25rem 0.75rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.875rem;
}

.newer-posts:hover,
.older-posts:hover {
    color: var(--accent);
}

/* single post */

.post-header {
    margin-bottom: 2.5rem;
}

.post-title {
    font-family: "SHINGO", serif;
    font-size: 1.75rem;
    font-weight: 300;
    line-height: 1.4;
    margin: 0 0 1rem;
    color: var(--heading);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    color: var(--muted);
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
}

.post-meta time {
    white-space: nowrap;
}

.post-author {
    min-width: 0;
}

.post-tag a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.8125rem;
}

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

/* post content */

.post-content {
    font-size: 1.0625rem;
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.post-content p,
.post-content li {
    text-align: justify;
    text-justify: inter-word;
}

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

.post-content h2,
.post-content h3,
.post-content h4 {
    font-family: "SHINGO", serif;
    font-weight: 300;
    margin: 3rem 0 0.75rem;
    line-height: 1.4;
    color: var(--heading);
}

.post-content h2 {
    font-size: 1.375rem;
}

.post-content h3 {
    font-size: 1.1875rem;
}

.post-content h4 {
    font-size: 1.0625rem;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
}

.post-content a:hover {
    color: var(--ink);
}

.post-content blockquote {
    margin: 2rem 0;
    padding: 0 0 0 1.25rem;
    border-left: 2px solid var(--accent);
    color: var(--muted);
}

.post-content blockquote p {
    margin-bottom: 0.5rem;
}

.post-content ul,
.post-content ol {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.post-content figure {
    margin: 2rem 0;
}

.post-content figcaption {
    color: var(--muted);
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    text-align: center;
}

.post-content pre {
    background: #f5f2ec;
    border: 1px solid #eae2d5;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    font-family: "M PLUS Code Nerd", monospace;
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0 0 1.5rem;
}

.post-content code {
    font-family: "M PLUS Code Nerd", monospace;
    font-size: 0.875em;
}

.post-content p code,
.post-content li code {
    background: none;
    padding: 0.1em 0.3em;
}

.post-content hr {
    border: none;
    height: 1px;
    background: var(--divider);
    margin: 2.5rem 0;
}

.post-content hr::after {
    display: none;
}

.post-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.post-content th,
.post-content td {
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.post-content th {
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

/* post footer */

.post-footer {
    margin-top: 3rem;
}
.post-footer::before {
    content: "";
    display: block;
    height: 1px;
    background: var(--divider);
    margin-bottom: 1.5rem;
}

.post-footer a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9375rem;
    letter-spacing: 0.05em;
}

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

/* site footer */

.site-footer {
    margin-top: 4rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
}

.site-footer p {
    margin: 0;
}

/* image grid */

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    margin: 2rem 0;
    width: 140%;
    margin-left: -20%;
}
.image-grid-single {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2px;
    margin: 2rem 0;
    width: 140%;
    margin-left: -20%;
}
.image-grid-double {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    margin: 2rem 0;
    width: 140%;
    margin-left: -20%;
}

.image-grid a {
    display: block;
    overflow: hidden;
    border: 1px solid var(--line);
}

.image-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.image-grid a:hover img {
    opacity: 0.7;
}

@media (max-width: 480px) {
    :root {
        --section-space: 1.5rem;
    }

    .image-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 960px) {
    .image-grid,
    .image-grid-single,
    .image-grid-double {
        width: 100%;
        margin-left: 0;
    }
}

/* small screens */

@media (max-width: 480px) {
    .page {
        padding: 2rem 1rem 3rem;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .post-title {
        font-size: 1.5rem;
    }

    .post-item-title {
        font-size: 1.125rem;
    }

    .post-content p,
    .post-content li {
        text-align: start;
    }
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
}
.lightbox.active {
    display: flex;
}
.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border: none;
}
.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: 0;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: 0;
    font: inherit;
    font-size: 2rem;
}

.kg-width-wide {
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}
.kg-width-full {
    width: 100%;
    max-width: none;
    padding-left: max(0px, calc((100% - var(--max-width)) / 2));
    padding-right: max(0px, calc((100% - var(--max-width)) / 2));
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1100;
    padding: 0.5rem 0.75rem;
    color: var(--ink);
    background: var(--bg);
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .image-grid img {
        transition: none;
    }
}
