/* ==========================================================================
   microblog-minimal — theme tokens
   Light theme is the default. Dark theme layers on in two ways:
   1. prefers-color-scheme, so it works with zero JavaScript.
   2. [data-theme="dark"] / [data-theme="light"], which the toggle button
      sets explicitly, overriding the OS preference once a person chooses.
   ========================================================================== */

:root {
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --content-width: 42rem; /* ~672px — wide enough that longer posts don't wrap awkwardly */

    --color-bg: #ffffff;
    --color-bg-card: #ffffff;
    --color-text: #14171a;
    --color-text-muted: #5b6673;
    --color-border: #e1e8ed;
    --color-link: #1d4ed8;
    --color-accent: #1d4ed8;
    --color-focus: #1d4ed8;

    --radius: 0.75rem;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #15181c;
        --color-bg-card: #1a1e23;
        --color-text: #e7e9ea;
        --color-text-muted: #8b98a5;
        --color-border: #2f3336;
        --color-link: #8ab4f8;
        --color-accent: #8ab4f8;
        --color-focus: #8ab4f8;
    }
}

[data-theme="dark"] {
    --color-bg: #15181c;
    --color-bg-card: #1a1e23;
    --color-text: #e7e9ea;
    --color-text-muted: #8b98a5;
    --color-border: #2f3336;
    --color-link: #8ab4f8;
    --color-accent: #8ab4f8;
    --color-focus: #8ab4f8;
}

/* ==========================================================================
   Reset + base
   ========================================================================== */

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

html {
    color-scheme: light dark;
}

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    transition: background-color 0.15s ease, color 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

.wrap {
    max-width: var(--content-width);
    margin-inline: auto;
    padding-inline: 1.25rem;
}

a {
    color: var(--color-link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

a:hover { text-decoration-thickness: 2px; }

/* Visible, high-contrast focus ring for every interactive element */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

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

/* ==========================================================================
   Accessibility utilities
   ========================================================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    background: var(--color-accent);
    color: var(--color-bg);
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    z-index: 100;
    transition: top 0.15s ease;
}

.skip-link:focus { top: 1rem; }

/* ==========================================================================
   Site header / footer
   ========================================================================== */

.site-header {
    border-bottom: 1px solid var(--color-border);
    padding-block: 1rem;
}

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-title {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-text);
    text-decoration: none;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg-card);
    color: var(--color-text);
    cursor: pointer;
}

.icon-btn:hover { border-color: var(--color-accent); }

#theme-toggle .icon-moon { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun { display: none; }
[data-theme="dark"] #theme-toggle .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #theme-toggle .icon-sun { display: none; }
    :root:not([data-theme="light"]) #theme-toggle .icon-moon { display: block; }
}

.site-nav {
    padding-top: 0.6rem;
    margin-top: 0.6rem;
    border-top: 1px dashed var(--color-border);
}

.site-nav__list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    margin: 0;
    padding: 0;
}

.site-nav__list a {
    display: inline-block;
    padding: 0.15rem 0;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.95rem;
}

.site-nav__list a:hover { color: var(--color-text); }

.site-nav__list a[aria-current="page"] {
    color: var(--color-text);
    font-weight: 600;
    border-bottom: 2px solid var(--color-accent);
}

.site-footer .site-nav {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
    margin-bottom: 0.75rem;
}

.site-footer__copyright {
    margin: 0;
}

.site-footer {
    border-top: 1px solid var(--color-border);
    margin-top: 3rem;
    padding-block: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.site-footer a { color: inherit; }

/* ==========================================================================
   Feed + post card — the social-post look
   ========================================================================== */

.feed {
    padding-block: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.archive-heading {
    padding-top: 1.5rem;
    font-size: 1.25rem;
}

.author-header {
    padding-block: 2rem 0.5rem;
    text-align: center;
}

.author-header__avatar {
    border-radius: 999px;
    margin-inline: auto;
}

.author-header__name {
    margin-block: 0.75rem 0.25rem;
    font-size: 1.35rem;
}

.author-header__bio {
    color: var(--color-text-muted);
    max-width: 32rem;
    margin-inline: auto;
}

.author-header__location {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-block: 0.25rem;
}

.author-header__links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    padding: 0;
    margin-block: 1rem 0;
}

.author-header__links a {
    display: inline-block;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
}

.author-header__links a:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.post-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem 0.75rem;
}

.post-card__header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.post-card__avatar {
    flex-shrink: 0;
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    overflow: hidden;
}

.post-card__avatar img { border-radius: 999px; }

.post-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.6rem;
    padding-top: 0.3rem;
}

.post-card__author {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.post-card__author:hover { text-decoration: underline; }

.post-card__tags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    text-decoration: none;
}

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

/* Subtle, optional colour cue for known platform-source tags.
   Purely decorative — the tag's own text is always the real signal. */
.tag[href*="/tag/mastodon/"] { border-left: 3px solid #6364ff; }
.tag[href*="/tag/bluesky/"]  { border-left: 3px solid #1185fe; }
.tag[href*="/tag/twitter/"]  { border-left: 3px solid #1da1f2; }

.post-card__content {
    padding-block: 0.75rem;
    overflow-wrap: break-word;
}

.post-card__content p:first-child { margin-top: 0; }
.post-card__content p:last-child { margin-bottom: 0; }

.post-card__content img,
.post-card__content video,
.post-card__content figure {
    border-radius: var(--radius);
}

/* Koenig ships every card (image, bookmark, embed, gallery, etc.) with
   generous outer margins tuned for wide article layouts. Reset those to
   align flush with the paragraph text on either side, and to match the
   tighter vertical rhythm of a short post rather than a long article. */
.post-card__content .kg-card {
    margin-block: 0.75rem;
    margin-inline: 0;
    width: 100%;
    max-width: 100%;
}

.post-card__content .kg-card:first-child { margin-top: 0; }
.post-card__content .kg-card:last-child { margin-bottom: 0; }

.post-card__content .kg-bookmark-card,
.post-card__content .kg-bookmark-container {
    width: 100%;
}

.post-card__content .kg-bookmark-content {
    padding: 0.85rem 1rem;
}

.post-card__content .kg-bookmark-title {
    font-size: 0.95rem;
}

.post-card__content .kg-bookmark-description {
    font-size: 0.85rem;
}

.post-card__content .kg-bookmark-metadata {
    font-size: 0.8rem;
}

/* Koenig editor's "wide" and "full" width options. A true edge-of-viewport
   bleed would poke images out past the card's own border, which reads as
   broken rather than intentional in a card-based layout — so both classes
   bleed only to the card's own edge, past its inner padding. */
.post-card__content .kg-width-wide,
.post-card__content .kg-width-full {
    width: calc(100% + 2.5rem);
    max-width: calc(100% + 2.5rem);
    margin-inline: -1.25rem;
}

.post-card__content .kg-width-wide img,
.post-card__content .kg-width-full img {
    border-radius: 0;
}

@media (max-width: 30rem) {
    .post-card__content .kg-width-wide,
    .post-card__content .kg-width-full {
        width: calc(100% + 2rem);
        max-width: calc(100% + 2rem);
        margin-inline: -1rem;
    }
}

/* Reply-context marker, carried over from the archive import
   (a plain <p class="reply-context"> prepended to reply posts) */
.reply-context {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-block-end: 0.5rem;
}

.reply-context a { color: inherit; }

.post-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--color-border);
    padding-block: 0.5rem;
}

.post-card__time {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    margin-inline-start: -0.5rem;
    border-radius: 999px;
}

.post-card__time:hover {
    color: var(--color-accent);
    background: var(--color-border);
}

.post-card__share {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
}

.post-card__share:hover {
    color: var(--color-accent);
    background: var(--color-border);
}

.post-card__actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-inline-end: -0.5rem;
}

.post-card__share-wrap {
    position: relative;
}

.share-menu {
    position: absolute;
    z-index: 20;
    bottom: calc(100% + 0.4rem);
    right: 0;
    min-width: 10rem;
    padding: 0.35rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.share-menu[hidden] { display: none; }

.share-menu__item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: none;
    border-radius: 0.4rem;
    background: transparent;
    color: var(--color-text);
    font-size: 0.9rem;
    font-family: inherit;
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.share-menu__item:hover,
.share-menu__item:focus-visible {
    background: var(--color-border);
}

.post-card__like {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
}

.post-card__like:hover {
    color: #e0245e;
    background: var(--color-border);
}

.post-card__like.is-liked {
    color: #e0245e;
}

.post-card__like.is-liked .icon-heart {
    fill: currentColor;
}

.post-card__like.is-bursting .icon-heart {
    animation: heart-pop 0.4s ease;
}

.post-card__like.is-bursting::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: currentColor;
    color: #e0245e;
    opacity: 0.35;
    animation: heart-ring 0.5s ease-out;
    pointer-events: none;
}

@keyframes heart-pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.5); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes heart-ring {
    0% { transform: scale(0.6); opacity: 0.45; }
    100% { transform: scale(1.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .post-card__like.is-bursting .icon-heart,
    .post-card__like.is-bursting::after {
        animation: none;
    }
}

.feed--single .post-card { padding-bottom: 0.75rem; }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: space-between;
    padding-block: 1.5rem 2.5rem;
    font-weight: 600;
}

.pagination a {
    text-decoration: none;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

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

/* ==========================================================================
   Static pages (About, etc.) — the one place a title is shown
   ========================================================================== */

.page { padding-block: 1.5rem; }
.page-title { font-size: 1.75rem; margin-bottom: 1rem; }

/* ==========================================================================
   Error page
   ========================================================================== */

.error-page { padding-block: 3rem; text-align: center; }

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 30rem) {
    .post-card { padding-inline: 1rem; }
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.post-card__content .kg-image-card img.is-lightboxable,
.post-card__content .kg-gallery-card img.is-lightboxable {
    cursor: zoom-in;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 1.5rem;
}

.lightbox[hidden] { display: none; }

.lightbox__img {
    max-width: min(90vw, 60rem);
    max-height: 85vh;
    width: auto;
    height: auto;
    border-radius: var(--radius);
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
    background: rgba(255, 255, 255, 0.24);
}

.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox__counter {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.85rem;
}

@media (max-width: 30rem) {
    .lightbox__prev,
    .lightbox__next {
        width: 2.25rem;
        height: 2.25rem;
    }
}

/* ==========================================================================
   Toast (share confirmation, etc.)
   ========================================================================== */

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%) translateY(0.5rem);
    margin: 0;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 0.9rem;
    z-index: 250;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast[hidden] { display: none; }

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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