/* Fifth Province — v0.3.0 */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600&family=Barlow+Condensed:wght@400;500;600;700&family=Space+Mono:wght@400;700&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --color-ink: #1c1c1e;
    --color-bone: #f2efeb;
    --color-mid: #8a8780;
    --color-faint: #d6d3ce;
    --color-signal: #3a6a5a;
    --color-glow: #4a8a72;

    --color-vol-0: #8B1A1A;
    --color-vol-1: #2D5F3F;
    --color-vol-2: #B8860B;
    --color-vol-site: #8B8378;

    --font-body: 'Source Serif 4', Georgia, serif;
    --font-heading: 'Barlow Condensed', system-ui, sans-serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;

    --max-width: 38rem;
    --max-width-wide: 52rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--color-ink);
    background: var(--color-bone);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--color-signal);
    color: var(--color-bone);
}

a {
    color: var(--color-ink);
    text-decoration-color: var(--color-faint);
    text-underline-offset: 0.15em;
    transition: text-decoration-color 0.2s;
}

a:hover {
    text-decoration-color: var(--color-ink);
}

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


/* ---- layout ---- */

.site-header,
.site-content,
.site-footer {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.post-content,
.page-content {
    max-width: var(--max-width);
    margin: 0 auto;
}


/* ---- header ---- */

.site-header {
    padding-top: 3.5rem;
    padding-bottom: 2rem;
    margin-bottom: 2.5rem;
}

.site-title {
    font-family: 'Oriya MN', 'Hoefler Text', Georgia, serif;
    font-size: 1.55rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    margin: 0;
    position: relative;
}

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

.site-title a:hover {
    text-shadow:
        0.04em 0 0 rgba(255, 60, 60, 0.35),
        -0.04em 0 0 rgba(60, 60, 255, 0.35);
}

.site-description {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-mid);
    margin: 0.4rem 0 0;
    letter-spacing: 0.02em;
}

.site-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 2rem;
}

.site-nav {
    margin: 0;
    flex-shrink: 0;
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
}

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

.site-nav a {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.03em;
    color: var(--color-mid);
    text-decoration: none;
    transition: color 0.2s;
}

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

.nav-subscribe {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color 0.2s;
}

.nav-subscribe:hover {
    color: var(--color-ink);
}

.site-nav-mobile {
    display: none;
}

/* scan line divider */
.header-rule {
    border: none;
    height: 1px;
    background: var(--color-faint);
    margin: 0;
    position: relative;
}

.header-rule::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-faint);
    opacity: 0.5;
}


/* ---- subscribe form ---- */

.subscribe-form {
    max-width: var(--max-width-wide);
    margin: 0 auto;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--color-faint);
}

.subscribe-form form,
.post-end-form {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.post-end-form {
    justify-content: center;
}

.subscribe-form input,
.post-end-form input {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    color: var(--color-ink);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--color-faint);
    padding: 0.3rem 0;
    outline: none;
    width: 14rem;
    transition: border-color 0.2s;
}

.subscribe-form input:focus,
.post-end-form input:focus {
    border-color: var(--color-ink);
}

.subscribe-form input::placeholder,
.post-end-form input::placeholder {
    color: var(--color-mid);
}

.subscribe-form button,
.post-end-form button {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    color: var(--color-mid);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.subscribe-form button:hover,
.post-end-form button:hover {
    color: var(--color-ink);
}

.subscribe-msg {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    letter-spacing: 0.02em;
    margin: 0.5rem 0 0;
}

.post-end-subscribe .subscribe-msg {
    text-align: center;
}


/* ---- post feed (index) ---- */

.post-feed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.post-card {
    padding: 2rem 0;
    border-bottom: 1px solid var(--color-faint);
}

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

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

.post-card-link:hover .post-title {
    text-shadow:
        0.03em 0 0 rgba(255, 60, 60, 0.3),
        -0.03em 0 0 rgba(60, 60, 255, 0.3);
}

.post-title {
    font-family: 'Barlow', system-ui, sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.35;
    margin: 0 0 0.4rem;
    color: var(--color-ink);
    transition: text-shadow 0.2s;
}

.post-excerpt {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-ink);
    margin: 0.6rem 0 0;
    opacity: 0.7;
}

.post-sign-off {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--color-ink);
    letter-spacing: 0.02em;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.sign-off-sep {
    opacity: 0.35;
    margin: 0 0.15rem;
}

.post-continue {
    transition: color 0.2s;
}

.post-card-link:hover .post-continue {
    color: var(--color-ink);
}

.excerpt-continue {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}


/* ---- volume colours (Crane Bag inspired) ---- */

/* tag text colour (always on) */

.post-card[data-tag="volume-0"] .post-tag { color: var(--color-vol-0); }
.post-card[data-tag="volume-1"] .post-tag { color: var(--color-vol-1); }
.post-card[data-tag="volume-2"] .post-tag { color: var(--color-vol-2); }
.post-card[data-tag="site"] .post-tag { color: var(--color-vol-site); }

.post-meta[data-tag="volume-0"] span { color: var(--color-vol-0); }
.post-meta[data-tag="volume-1"] span { color: var(--color-vol-1); }
.post-meta[data-tag="volume-2"] span { color: var(--color-vol-2); }
.post-meta[data-tag="site"] span { color: var(--color-vol-site); }

/* coloured scanline below post title */

.post-card[data-tag] .post-title::after {
    content: '';
    display: block;
    width: 2.5rem;
    height: 1px;
    margin-top: 0.4rem;
}
.post-card[data-tag="volume-0"] .post-title::after { background: var(--color-vol-0); }
.post-card[data-tag="volume-1"] .post-title::after { background: var(--color-vol-1); }
.post-card[data-tag="volume-2"] .post-title::after { background: var(--color-vol-2); }
.post-card[data-tag="site"] .post-title::after { background: var(--color-vol-site); }


/* ---- single post ---- */

.post-header,
.page-header {
    max-width: var(--max-width);
    margin: 0 auto 2.5rem;
}

.post-header h1,
.page-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.6rem;
    letter-spacing: -0.01em;
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    letter-spacing: 0.02em;
    text-transform: lowercase;
    margin: 0 0 0.5rem;
}

.post-meta .sep {
    opacity: 0.4;
    margin: 0 0.4em;
}

.post-header .post-meta {
    margin-bottom: 0;
}

.post-byline {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--color-mid);
    letter-spacing: 0.02em;
    margin-top: 0.6rem;
}

.post-tags {
    margin-top: 0.5rem;
}

.post-tags a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-signal);
    text-decoration: none;
    margin-right: 0.75rem;
    letter-spacing: 0.02em;
}

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

.post-feature-image {
    max-width: var(--max-width);
    margin: 0 auto 2.5rem;
}

.post-feature-image img {
    width: 100%;
    display: block;
    filter: saturate(0.55) contrast(1.05);
    transition: filter 3s ease;
}

.post-feature-image img:hover {
    filter: saturate(1) contrast(1);
    transition: filter 0.4s ease;
}

.post-feature-image figcaption {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    text-align: center;
    margin-top: 0.5rem;
}


/* ---- ghost editor image cards ---- */

.kg-image-card,
.kg-gallery-card {
    margin: 2rem 0;
}

.kg-image-card img,
.kg-gallery-card img {
    display: block;
    width: 100%;
    filter: saturate(0.55) contrast(1.05);
    transition: filter 3s ease;
}

.kg-image-card img:hover,
.kg-gallery-card img:hover {
    filter: saturate(1) contrast(1);
    transition: filter 0.4s ease;
}

.kg-image-card.kg-width-wide {
    max-width: var(--max-width-wide);
    margin-left: calc(50% - 26rem);
    margin-right: calc(50% - 26rem);
}

.kg-image-card.kg-width-full {
    max-width: none;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
}

.kg-embed-card {
    margin: 2rem 0;
    max-width: var(--max-width-wide);
}

.kg-embed-card iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: none;
}

.kg-image-card figcaption {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    text-align: center;
    margin-top: 0.5rem;
}

.post-content,
.page-content {
    margin-bottom: 3rem;
}

.post-content h2,
.page-content h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: lowercase;
    margin: 2.5rem 0 1rem;
}

.post-content h3,
.page-content h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 2rem 0 0.8rem;
}

.post-content blockquote,
.page-content blockquote {
    border-left: 2px solid var(--color-faint);
    margin: 1.5rem 0;
    padding: 0 0 0 1.5rem;
    color: var(--color-mid);
    font-style: italic;
}

.post-content hr,
.page-content hr {
    border: none;
    height: 1px;
    background: var(--color-faint);
    margin: 2.5rem 0;
    position: relative;
}

.post-content hr::after,
.page-content hr::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-faint);
    opacity: 0.5;
}

.post-content figcaption,
.page-content figcaption {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    text-align: center;
    margin-top: 0.5rem;
}

.post-content code,
.page-content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.04);
    padding: 0.1em 0.3em;
    border-radius: 2px;
}


/* ---- post footer (end of article) ---- */

.post-footer {
    max-width: var(--max-width);
    margin: 0 auto;
}

.post-end-rule {
    height: 1px;
    background: var(--color-faint);
    margin: 3rem 0 2rem;
    position: relative;
}

.post-end-rule::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-faint);
    opacity: 0.5;
}

.post-end-subscribe {
    text-align: center;
    padding: 1rem 0 2rem;
}

.post-end-text {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-mid);
    margin: 0 0 0.6rem;
    letter-spacing: 0.02em;
}

.post-end-link {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color 0.2s;
}

.post-end-link:hover {
    color: var(--color-ink);
}


/* ---- footer ---- */

.site-footer {
    padding-top: 2rem;
    padding-bottom: 3rem;
    border-top: 1px solid var(--color-faint);
    margin-top: 2rem;
}

.site-footer p {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    letter-spacing: 0.02em;
    margin: 0;
}


/* ---- pagination ---- */

.pagination {
    display: flex;
    justify-content: space-between;
    padding: 2rem 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.pagination a {
    color: var(--color-mid);
    text-decoration: none;
    transition: color 0.2s;
}

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


/* ---- 404 / error ---- */

.error-page {
    text-align: center;
    padding: 4rem 1.5rem 6rem;
}

.error-coin {
    width: 10rem;
    height: auto;
    filter: grayscale(40%) contrast(1.1);
    margin-bottom: 2rem;
    opacity: 0.7;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-mid);
    letter-spacing: 0.1em;
    margin: 0 0 0.5rem;
}

.error-message {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--color-ink);
    margin: 0 0 1.5rem;
}

.error-link {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-mid);
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color 0.2s;
}

.error-link:hover {
    color: var(--color-ink);
}


/* ---- glitch / atmosphere ---- */

@keyframes signal {
    0%, 100% { opacity: 1; }
    28% { opacity: 1; }
    29% { opacity: 0.88; }
    31% { opacity: 1; }
    70% { opacity: 1; }
    71% { opacity: 0.85; }
    73% { opacity: 1; }
}

@keyframes glitch-shift {
    0%, 100% {
        text-shadow: none;
    }
    18% {
        text-shadow: none;
    }
    19% {
        text-shadow:
            0.06em 0 0 rgba(255, 40, 40, 0.4),
            -0.06em 0 0 rgba(40, 40, 255, 0.4);
    }
    22% {
        text-shadow: none;
    }
    63% {
        text-shadow: none;
    }
    64% {
        text-shadow:
            -0.04em 0.01em 0 rgba(255, 40, 40, 0.3),
            0.04em -0.01em 0 rgba(40, 40, 255, 0.3);
    }
    66% {
        text-shadow: none;
    }
}

.site-title a {
    animation: signal 8s ease-in-out infinite, glitch-shift 11s step-end infinite;
}

.post-card:hover {
    position: relative;
}

.post-card:hover::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    right: -1.5rem;
    top: 50%;
    height: 1px;
    background: var(--color-faint);
    opacity: 0;
    animation: scanline 0.4s ease-out forwards;
    pointer-events: none;
}

@keyframes scanline {
    0% { opacity: 0.8; top: 20%; }
    100% { opacity: 0; top: 80%; }
}

.error-coin {
    animation: signal 12s ease-in-out infinite;
}


/* ---- responsive ---- */

@media (max-width: 640px) {
    body {
        font-size: 1.05rem;
    }

    .site-header {
        padding-top: 3rem;
        padding-bottom: 2.5rem;
        margin-bottom: 0;
    }

    .site-header,
    .site-content,
    .site-footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .site-title {
        font-size: 1.8rem;
        margin-bottom: 0.3rem;
    }

    .site-description {
        margin-top: 0.6rem;
    }

    .site-header-row {
        flex-direction: column;
        gap: 0;
    }

    .site-header .site-nav {
        display: none;
    }

    .site-nav-mobile {
        display: flex;
        padding: 1rem 1.25rem 0;
        max-width: var(--max-width-wide);
        margin: 0 auto;
        gap: 1.5rem;
        align-items: baseline;
    }

    .site-nav-mobile a {
        font-size: 0.75rem;
    }

    .post-card {
        padding: 1.5rem 0;
    }

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

    .post-header h1,
    .page-header h1 {
        font-size: 1.75rem;
    }

    .post-header,
    .page-header {
        margin-bottom: 2rem;
    }

    .kg-image-card.kg-width-wide,
    .kg-image-card.kg-width-full {
        margin-left: -1.25rem;
        margin-right: -1.25rem;
        max-width: none;
        width: auto;
    }

    .post-content h2,
    .page-content h2 {
        font-size: 1.15rem;
        margin-top: 2rem;
    }

    .post-content h3,
    .page-content h3 {
        font-size: 1rem;
    }

    .post-content blockquote,
    .page-content blockquote {
        margin-left: 0;
        padding-left: 1rem;
    }

    .post-end-subscribe {
        padding: 0.5rem 0 1.5rem;
    }

    .error-coin {
        width: 7rem;
    }

    .error-page {
        padding: 3rem 1.25rem 4rem;
    }
}

@media (max-width: 380px) {
    .site-nav {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
}
