/* =========================================================================
   Lomia v2 — minimal flat reading site
   ========================================================================= */

:root {
    --font-main:
        "ResourceHanRounded", system-ui, -apple-system, "Segoe UI",
        "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-mono:
        "FiraCode", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* backgrounds */
    --c-bg-outer: #f0f5fb;
    --c-bg-main: #f0f5fb;
    --c-bg-soft: #e8eff8;
    --c-card: #f6f9fd;

    /* text */
    --c-text: #3f4870;
    --c-text-soft: #69729e;
    --c-text-faint: #98a0c4;

    /* borders */
    --c-line: #c9d3e8;
    --c-line-soft: #dde5f2;

    /* accents — blue */
    --c-deep: #5b7ab0;
    --c-blue: #5eaecd;
    --c-blue-soft: #d4e8f6;
    /* accents — sakura pink */
    --c-pink: #d887a2;
    --c-pink-soft: #f4e0e8;

    /* code — light lavender wash */
    --c-code-bg: #7c8cb6;
    --c-code-text: #eaf2fc;
    --c-code-border: #5c71a8;

    /* layout */
    --content-w: 54rem;
    --radius: 0.75rem;
    --radius-sm: 0.4rem;
}

/* === fonts === */
@font-face {
    font-family: "ResourceHanRounded";
    src: url("/static/fonts/ResourceHanRoundedCN-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "ResourceHanRounded";
    src: url("/static/fonts/ResourceHanRoundedCN-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "FiraCode";
    src: url("/static/fonts/FiraCode-Regular.woff2") format("woff2");
    font-display: swap;
}

/* === reset === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    background: var(--c-bg-main);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--c-text);
    background: var(--c-bg-outer);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* === global scrollbar === */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--c-line) var(--c-bg-main);
}
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--c-bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--c-line);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--c-text-faint);
}

/* flash prevention inline style injected from JS before first paint */

/* === layout: centered column === */
main {
    --main-px: 4rem;
    width: min(var(--content-w), 100%);
    margin: 0 auto;
    padding: 5rem var(--main-px) 4rem;
    min-height: 100vh;
    background: var(--c-bg-main);
}
main.has-cover {
    padding-top: 0;
}

.fade-in {
    animation: fadeUp 0.3s ease-out both;
}
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* === typography === */
h1,
h2,
h3 {
    color: var(--c-deep);
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}
h4,
h5,
h6 {
    color: var(--c-deep);
    font-weight: 700;
    line-height: 1.4;
}

h1 {
    font-size: 2.6rem;
    margin: 0.5rem 0 0.8rem;
    letter-spacing: -0.01em;
}
h2 {
    font-size: 2rem;
    margin: 2rem 0 0.8rem;
}
h3 {
    font-size: 1.55rem;
    margin: 1.6rem 0 0.6rem;
}
h4 {
    font-size: 1.15rem;
    margin: 1.3rem 0 0.5rem;
}
h5 {
    font-size: 1.05rem;
    margin: 1.1rem 0 0.4rem;
}
h6 {
    font-size: 0.95rem;
    margin: 0.9rem 0 0.35rem;
    color: var(--c-text-soft);
    font-weight: 600;
}

p {
    margin: 1.1rem 0;
}
.content p {
    margin: 1.2rem 0;
}

.section-intro .content p {
    margin: 0.8rem 0;
}

strong {
    font-weight: 700;
    color: var(--c-deep);
}

em,
i {
    font-style: italic;
}

del,
s {
    text-decoration: line-through;
    color: var(--c-text-faint);
    text-decoration-color: var(--c-text-faint);
}

ins,
u {
    text-decoration: underline;
    text-underline-offset: 0.07em;
    text-decoration-thickness: 0.1em;
}

a {
    color: var(--c-pink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 0.08em;
}

hr {
    border: none;
    height: 1px;
    background: var(--c-line);
    width: 60%;
    margin: 2.5rem auto;
}

ul,
ol {
    margin: 0.8rem 0 0.8rem 1.4rem;
    padding-left: 0.6rem;
}
li {
    margin: 0.2rem 0;
}
ul li::marker {
    color: var(--c-blue);
}
ol li::marker {
    color: var(--c-blue);
}

blockquote {
    margin: 1.5rem 0;
    padding: 0.9rem 1.2rem;
    border-left: 3px solid var(--c-blue);
    background: var(--c-blue-soft);
    color: var(--c-text-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
blockquote p {
    margin: 0.3rem 0;
}

/* === code — watercolor wash with soft edge === */
code {
    font-family: var(--font-mono);
    font-size: 0.89em;
    background: var(--c-code-bg);
    color: var(--c-code-text);
    padding: 0.1em 0.38em;
    border-radius: 0.28rem;
    border: 1px solid var(--c-code-border);
    font-style: normal;
}
pre {
    position: relative;
    margin: 1.4rem 0;
    padding: 1rem 0 1rem 1.15rem;
    background: var(--c-code-bg);
    color: var(--c-code-text);
    border: 1px solid var(--c-code-border);
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.91rem;
    line-height: 1.7;
}
pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* code block scrollbar — subtle, on the pre itself */
pre::-webkit-scrollbar {
    height: 5px;
}
pre::-webkit-scrollbar-track {
    background: transparent;
}
pre::-webkit-scrollbar-thumb {
    background: var(--c-code-border);
    border-radius: 3px;
}
pre {
    scrollbar-width: thin;
    scrollbar-color: var(--c-code-border) transparent;
}

/* copy button — sticky, stays put on horizontal scroll */
.copy-btn {
    position: sticky;
    right: 0.6rem;
    float: right;
    top: 0.45rem;
    padding: 0.18rem 0.5rem;
    margin-left: -4rem;
    font-size: 0.73rem;
    font-family: var(--font-main);
    color: var(--c-code-text);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--c-code-border);
    border-radius: 0.3rem;
    cursor: pointer;
    opacity: 0;
    z-index: 1;
    transition:
        opacity 0.25s ease,
        background 0.25s ease;
    white-space: nowrap;
}
pre:hover .copy-btn,
.copy-btn:focus {
    opacity: 1;
}
.copy-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* === images === */
img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.4rem auto;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 2px 8px rgba(109, 133, 181, 0.1));
}
.img-small {
    max-width: 35%;
}
.img-medium {
    max-width: 62%;
}
.img-large {
    max-width: 100%;
}
.img-flat {
    filter: none;
    box-shadow: none;
}
.img-square {
    border-radius: 0;
}

/* === tables === */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 1.5rem 0;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
    background: var(--c-card);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
thead th {
    background: var(--c-bg-soft);
    color: var(--c-deep);
    font-weight: 700;
    text-align: center;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--c-line);
    border-right: 1px solid var(--c-line);
}
thead th:last-child {
    border-right: none;
}
tbody td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--c-line-soft);
    border-right: 1px solid var(--c-line-soft);
    color: var(--c-text);
}
tbody td:last-child {
    border-right: none;
}
tbody tr:last-child td {
    border-bottom: none;
}

/* === spoiler === */
.spoiler {
    background: var(--c-deep);
    color: transparent;
    border-radius: 0.25rem;
    padding: 0.05em 0.35em;
    cursor: pointer;
    user-select: none;
    transition: color 0.25s ease;
}
.spoiler:hover {
    color: #fff;
}

/* === ruby annotation === */
.ruby {
    position: relative;
    display: inline-block;
    text-align: center;
    text-indent: 0;
}
.ruby::before {
    content: attr(attachment);
    position: absolute;
    top: -1.15em;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72em;
    color: var(--c-deep);
    white-space: nowrap;
    font-weight: 400;
}

/* =========================================================================
   site trigger (top-right) + drawer
   ========================================================================= */

.site-trigger {
    position: fixed;
    top: 0.9rem;
    right: 1rem;
    z-index: 60;
    width: 3.75rem;
    height: 3.75rem;
    border-radius: 50%;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    box-shadow: 0 2px 12px rgba(109, 133, 181, 0.15);
    cursor: pointer;
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}
.site-trigger img {
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: none;
    border-radius: 50%;
    display: block;
}
.site-trigger:hover {
    box-shadow: 0 4px 18px rgba(109, 133, 181, 0.2);
}
.site-trigger.is-pinned {
    box-shadow:
        0 0 0 2px var(--c-deep),
        0 4px 18px rgba(109, 133, 181, 0.2);
}

/* drawer — appears BELOW the trigger */
.site-drawer {
    position: fixed;
    top: calc(0.9rem + 3.75rem + 0.5rem);
    right: 1rem;
    z-index: 55;
    background: rgba(109, 133, 181, 0.92);
    backdrop-filter: blur(6px);
    color: #e9eefb;
    border-radius: var(--radius);
    padding: 0.8rem 0.9rem;
    min-width: 10rem;
    max-width: 14rem;
    box-shadow: 0 8px 28px rgba(80, 100, 140, 0.18);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}
.site-drawer.is-open {
    pointer-events: auto;
    opacity: 1;
    transform: none;
}
.site-drawer .site-name {
    display: block;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(233, 238, 251, 0.6);
    margin-bottom: 0.5rem;
    padding: 0 0.3rem;
}
.site-drawer nav {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    margin-bottom: 0.6rem;
}
.site-drawer nav a {
    display: block;
    padding: 0.42rem 0.6rem;
    color: #e9eefb;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 0.4rem;
    text-decoration: none;
    transition: background 0.15s ease;
}
.site-drawer nav a:hover,
.site-drawer nav a.is-active {
    background: rgba(255, 255, 255, 0.14);
}
.site-drawer nav hr.drawer-divider {
    margin: 0.3rem 0 0.15rem;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.site-drawer nav a.drawer-lang {
    display: inline-block;
    padding: 0.2rem 0.4rem;
    font-size: 0.82rem;
    border-radius: 0.25rem;
}
.site-drawer nav a.active-lang {
    background: rgba(255, 255, 255, 0.1);
    color: #e9eefb;
    cursor: default;
    pointer-events: none;
}
.site-drawer .drawer-search {
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    padding-top: 0.6rem;
}
.site-drawer .drawer-search input {
    width: 100%;
    padding: 0.42rem 0.65rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0.4rem;
    color: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition:
        background 0.25s ease,
        border-color 0.25s ease;
}
.site-drawer .drawer-search input::placeholder {
    color: rgba(233, 238, 251, 0.5);
}
.site-drawer .drawer-search input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* =========================================================================
   meta-row (breadcrumb + date / word count on one line)
   ========================================================================= */

.meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 1rem;
    font-size: 0.85rem;
    color: var(--c-text-faint);
    margin: 0.4rem 0 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--c-line-soft);
}
.meta-row .breadcrumb,
.meta-row .meta {
    font-size: inherit;
    margin: 0;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--c-text-faint);
}
.breadcrumb a {
    color: var(--c-text-soft);
    font-weight: 500;
    text-decoration: none;
    border-bottom: none;
    display: inline-flex;
    align-items: center;
}
.breadcrumb a:hover {
    color: var(--c-deep);
}
.breadcrumb-sep {
    width: 0.55em;
    height: 0.55em;
    color: var(--c-line);
    flex-shrink: 0;
}
.breadcrumb-home {
    width: 1.05em;
    height: 1.05em;
    color: var(--c-text-soft);
    flex-shrink: 0;
}
.breadcrumb a:hover .breadcrumb-home {
    color: var(--c-deep);
}

/* =========================================================================
   article page
   ========================================================================= */

.page-head {
    margin-bottom: 1.4rem;
}
.page-head h1 {
    margin-top: 0.3rem;
}
.meta {
    color: var(--c-text-faint);
    font-size: 0.88rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
    align-items: center;
    justify-content: center;
}
.meta .dot {
    color: var(--c-line);
}

/* cover hero — subtle gradient for title readability */
.page-cover {
    position: relative;
    margin-left: calc(-1 * var(--main-px));
    margin-right: calc(-1 * var(--main-px));
    margin-top: 0;
    margin-bottom: 1.8rem;
    width: calc(100% + 2 * var(--main-px));
    height: 20rem;
    overflow: hidden;
    background: var(--c-bg-soft);
}
.page-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    filter: none;
    border-radius: 0;
    display: block;
}
.page-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 25%,
        rgba(90, 120, 170, 0.08) 50%,
        rgba(90, 120, 170, 0.3) 80%,
        rgba(90, 120, 170, 0.65) 100%
    );
    pointer-events: none;
}
.page-cover-inner {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.5rem var(--main-px) 1.2rem;
    z-index: 1;
    background: linear-gradient(to bottom, transparent, var(--c-bg-main) 100%);
    padding-top: 3rem;
}
.page-cover-inner h1 {
    color: var(--c-deep);
    margin: 0.2rem 0;
}
.page-cover-inner .meta {
    color: rgba(255, 255, 255, 0.8);
    justify-content: flex-start;
}

.content > :first-child {
    margin-top: 0;
}
.content > :last-child {
    margin-bottom: 0;
}

/* =========================================================================
   article prev/next nav
   ========================================================================= */

.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--c-line);
    flex-wrap: wrap;
}
.article-nav a {
    display: flex;
    flex-direction: column;
    max-width: 46%;
    text-decoration: none;
    color: var(--c-text-soft);
}
.article-nav-next {
    text-align: right;
    margin-left: auto;
}
.article-nav .nav-arrow {
    font-size: 0.78rem;
    color: var(--c-text-faint);
    margin-bottom: 0.15rem;
}
.article-nav .nav-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--c-deep);
}
.article-nav a:hover .nav-title {
    color: var(--c-pink);
}

/* =========================================================================
   section pages — newspaper list style
   ========================================================================= */

.section-intro {
    margin-bottom: 1.8rem;
}
.section-intro h1 {
    margin: 0.2rem 0 0.5rem;
}
.section-intro > :last-child {
    margin-bottom: 0;
}

/* frontpage intro — body content directly, no card */
.frontpage-intro {
    margin-bottom: 2rem;
}
.frontpage-intro h1 {
    margin-top: 0.5rem;
}
.frontpage-intro > :first-child {
    margin-top: 0;
}

/* newspaper list — 3 : 7 cover : body, title overlays cover */
.news-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.news-item {
    display: grid;
    grid-template-columns: 3fr 7fr;
    gap: 1.1rem;
    align-items: stretch;
    padding: 1.3rem 0;
    border-bottom: 1px solid var(--c-line-soft);
}
.news-item:last-child {
    border-bottom: none;
}

.news-cover {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-sm);
    background: var(--c-bg-soft) center/cover no-repeat;
    overflow: hidden;
    display: block;
    width: 100%;
    align-self: start; /* prevent grid stretch from breaking aspect-ratio */
}
.news-cover:not(.is-empty) {
    filter: saturate(0.85) brightness(1.02);
}
.news-cover.is-empty {
    background: linear-gradient(135deg, #d4e8f6, #f4e0e8);
}

.news-body .news-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--c-deep);
    text-decoration: none;
    margin-bottom: 0.25rem;
}
.news-body .news-title:hover {
    color: var(--c-pink);
}

.news-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.news-summary {
    font-size: 0.92rem;
    color: var(--c-text);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    text-indent: 0;
}
.news-meta {
    font-size: 0.8rem;
    color: var(--c-text-faint);
    margin-top: 0.5rem;
}

/* entry list (no cover) */
.entry-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.entry-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--c-line-soft);
}
.entry-list li:last-child {
    border-bottom: none;
}
.entry-list a {
    color: var(--c-text);
    font-weight: 500;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}
.entry-list a:hover {
    color: var(--c-pink);
}
.entry-date {
    color: var(--c-text-faint);
    font-size: 0.83rem;
    flex-shrink: 0;
}
.entry-empty {
    color: var(--c-text-faint);
    padding: 2rem 0;
    text-align: center;
    font-style: italic;
}

/* =========================================================================
   pagination
   ========================================================================= */

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    margin: 2rem 0 0;
}
.pagination a,
.pagination .pg-current,
.pagination .pg-gap {
    min-width: 2rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.35rem;
    text-align: center;
    font-size: 0.88rem;
    text-decoration: none;
}
.pagination a {
    border: 1px solid var(--c-line);
    color: var(--c-text-soft);
}
.pagination a:hover {
    background: var(--c-bg-soft);
    color: var(--c-deep);
}
.pagination .pg-current {
    background: var(--c-deep);
    color: #fff;
}
.pagination .pg-gap {
    color: var(--c-text-faint);
}

/* =========================================================================
   gallery / micro / search
   ========================================================================= */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.55rem;
    margin: 1.2rem 0;
}
.gallery img {
    margin: 0;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    width: 100%;
    height: 100%;
}

.micro-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}
.micro-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--c-line-soft);
}
.micro-item:last-child {
    border-bottom: none;
}
.micro-item p {
    margin: 0.3rem 0;
}
.micro-meta {
    color: var(--c-text-faint);
    font-size: 0.83rem;
}

.search-results {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}
.search-results li {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--c-line-soft);
}
.search-results a {
    font-size: 1.05rem;
    font-weight: 700;
}

/* =========================================================================
   star button — flat
   ========================================================================= */

#star-button-wrapper {
    display: flex;
    justify-content: center;
    margin: 2rem 0 0.5rem;
}
.star-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.85rem;
    background: transparent;
    border: none;
    border-radius: 999px;
    color: var(--c-text-faint);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: color 0.25s ease;
}
.star-btn:hover,
.star-btn.is-starred {
    color: var(--c-pink);
}
.star-btn.is-error {
    color: #d97777;
}
.star-btn[disabled] {
    opacity: 0.6;
    cursor: wait;
}

/* =========================================================================
   comments
   ========================================================================= */

#comments-section {
    margin-top: 3rem;
    border-top: 1px solid var(--c-line);
    padding-top: 1.5rem;
}
.comments-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 0.3rem 0;
}
.comments-head h2 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 1.2rem;
}
.comments-toggle {
    color: var(--c-text-soft);
    font-size: 0.9rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
#comments-section.is-collapsed .comments-toggle {
    transform: rotate(-90deg);
}
.comments-body {
    overflow: hidden;
    max-height: 9999px;
    opacity: 1;
    transition:
        max-height 0.3s ease,
        opacity 0.3s ease;
}
#comments-section.is-collapsed .comments-body {
    max-height: 0;
    opacity: 0;
}

.comment-hint {
    margin: 0.8rem 0;
    font-size: 0.9rem;
    color: var(--c-text-faint);
    font-style: italic;
    text-align: center;
    text-indent: 0;
}
.hint-desktop {
    display: inline;
}
.hint-mobile {
    display: none;
}
@media (max-width: 48rem) {
    .hint-desktop {
        display: none;
    }
    .hint-mobile {
        display: inline;
    }
}

#comment-user-bar {
    display: none;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.8rem;
    background: var(--c-bg-soft);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--c-text-soft);
}
#comment-user-bar a {
    color: var(--c-blue);
    text-decoration: none;
    font-weight: 500;
}
#btn-comment-logout {
    padding: 0.25rem 0.65rem;
    background: transparent;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    color: var(--c-text-soft);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: auto;
}
#btn-comment-logout:hover {
    color: var(--c-deep);
    border-color: var(--c-blue-soft);
}

.comment-form {
    display: none;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1.2rem;
}
.comment-form textarea {
    width: 100%;
    min-height: 5.5rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    background: var(--c-card);
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.25s ease;
}
.comment-form textarea:focus {
    border-color: var(--c-blue);
}
.comment-form .form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.comment-form button[type="submit"] {
    padding: 0.4rem 1rem;
    background: var(--c-deep);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.25s ease;
}
.comment-form button[type="submit"]:hover {
    background: #4a64ad;
}
.comment-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: wait;
}

#comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-top: 0.5rem;
}
#comments-list > p {
    color: var(--c-text-faint);
    text-align: center;
    padding: 1.5rem 0;
}

.comment {
    display: flex;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    background: var(--c-card);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
}
.comment-avatar {
    flex-shrink: 0;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: var(--c-bg-soft) center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--c-deep);
    overflow: hidden;
}
.comment-avatar img {
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    filter: none;
}
.comment-main {
    flex: 1;
    min-width: 0;
}
.comment-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.22rem;
}
.comment-author-name {
    font-weight: 700;
    color: var(--c-deep);
    font-size: 0.93rem;
    text-decoration: none;
}
a.comment-author-name:hover {
    color: var(--c-pink);
}
.comment-acct {
    color: var(--c-text-faint);
    font-size: 0.8rem;
}
.comment time {
    color: var(--c-text-faint);
    font-size: 0.78rem;
    margin-left: auto;
}
.comment-body {
    font-size: 0.93rem;
    line-height: 1.7;
    word-wrap: break-word;
}
.comment-body p {
    margin: 0.25rem 0;
}
.comment-footer {
    margin-top: 0.35rem;
}
.reply-btn,
.cancel-reply-btn {
    background: none;
    border: none;
    color: var(--c-text-faint);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.12rem 0.35rem;
    border-radius: 0.25rem;
    transition:
        color 0.15s ease,
        background 0.15s ease;
}
.reply-btn:hover,
.cancel-reply-btn:hover {
    color: var(--c-pink);
    background: var(--c-pink-soft);
}
.cancel-reply-btn {
    margin-left: 0.35rem;
}
.reply-form {
    margin-top: 0.6rem;
    display: flex !important;
}

.comment-children {
    margin-top: 0.65rem;
    margin-left: 0.5rem;
    padding-left: 0.85rem;
    border-left: 2px solid var(--c-line);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.comment-children .comment-children {
    margin-left: 0;
    padding-left: 0.7rem;
}

/* =========================================================================
   lock / error
   ========================================================================= */

.lock-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
}
.lock-form input {
    flex: 1;
    min-width: 11rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    background: var(--c-card);
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
}
.lock-form input:focus {
    border-color: var(--c-blue);
}
.lock-form button {
    padding: 0.5rem 1.1rem;
    background: var(--c-deep);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
}
.error {
    background: var(--c-pink-soft);
    border: 1px solid var(--c-pink);
    color: #b94a6a;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* =========================================================================
   mascot
   ========================================================================= */

/* desktop — half-body portrait, fully below viewport until visible */
.mascot {
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: clamp(11rem, 16vw, 16rem);
    pointer-events: none;
    /* transform hides it fully below the viewport (% = own height) */
    transform: translateY(calc(100% + 4px));
    transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
    user-select: none;
}
.mascot.is-visible {
    transform: none;
    pointer-events: auto;
}

.mascot-img-wrap {
    position: relative;
    cursor: pointer;
}
.mascot-img-wrap img {
    margin: 0;
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 14px rgba(109, 133, 181, 0.12));
    border-radius: 0;
}
.mascot-img-wrap .mascot-direct {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.mascot-img-wrap:hover .mascot-direct,
.mascot-img-wrap.is-active .mascot-direct {
    opacity: 1;
}

/* mascot dialog bubble */
.mascot-dialog {
    position: fixed;
    left: clamp(11rem, 16vw, 16rem);
    bottom: 1.2rem;
    z-index: 41;
    width: min(21rem, calc(100vw - 2rem));
    background: var(--c-card);
    border: 1px solid var(--c-line);
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(80, 100, 140, 0.12);
    padding: 1rem 1.1rem;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}
.mascot-dialog.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
.mascot-dialog::before {
    content: "";
    position: absolute;
    left: -7px;
    bottom: 1.8rem;
    width: 12px;
    height: 12px;
    background: var(--c-card);
    border-left: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    transform: rotate(45deg);
}
.mascot-dialog h4 {
    margin: 0 0 0.45rem;
    font-size: 0.98rem;
}
.mascot-dialog p {
    font-size: 0.86rem;
    color: var(--c-text-soft);
    margin: 0.15rem 0 0.55rem;
}
.fedi-login-fields {
    margin-bottom: 0.5rem;
}
.fedi-login-fields input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--c-line);
    border-radius: var(--radius-sm);
    background: var(--c-bg-main);
    color: var(--c-text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.25s ease;
}
.fedi-login-fields input:focus {
    border-color: var(--c-blue);
}
.fedi-login-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.fedi-btn {
    padding: 0.38rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 0.84rem;
    cursor: pointer;
    transition: opacity 0.25s ease;
}
.fedi-btn:hover {
    opacity: 0.85;
}
.mastodon-btn {
    background: #9899ec;
}
.misskey-btn {
    background: #84cbc8;
}
.interact-btn {
    background: var(--c-pink);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

#mascot-dialog-user {
    display: none;
}
#mascot-dialog-user strong {
    color: var(--c-deep);
}
.dialog-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
}
.dialog-action-row button,
.dialog-action-row a {
    padding: 0.37rem 0.8rem;
    background: var(--c-deep);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.84rem;
    cursor: pointer;
    text-decoration: none;
}
.dialog-action-row .secondary {
    background: transparent;
    color: var(--c-text-soft);
    border: 1px solid var(--c-line);
}

/* mobile mascot — circular avatar FAB */
.mascot-fab {
    display: none;
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    z-index: 40;
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 50%;
    border: 2px solid var(--c-line);
    background: var(--c-bg-main) center/cover no-repeat;
    box-shadow: 0 2px 12px rgba(109, 133, 181, 0.15);
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s ease,
        box-shadow 0.25s ease;
}
.mascot-fab.is-visible {
    opacity: 1;
    pointer-events: auto;
}
.mascot-fab:hover {
    box-shadow: 0 4px 18px rgba(109, 133, 181, 0.22);
}
.mascot-fab img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    filter: none;
    border-radius: 0;
    transition: opacity 0.25s ease;
}
.mascot-fab .fab-direct {
    opacity: 0;
}
.mascot-fab.is-active .fab-direct {
    opacity: 1;
}

/* mobile dialog: above fab, full-width at bottom */
@media (max-width: 48rem) {
    .mascot {
        display: none;
    }
    .mascot-fab {
        display: block;
    }
    .mascot-dialog {
        left: 5rem;
        right: 1rem;
        bottom: 1rem;
        width: auto;
        max-width: none;
    }
    .mascot-dialog::before {
        display: none;
    }
}

/* =========================================================================
   footer
   ========================================================================= */

footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--c-text-faint);
    font-size: 0.84rem;
    border-top: 1px solid var(--c-line);
    margin-top: 0rem;
    width: min(var(--content-w), 100%);
    margin-left: auto;
    margin-right: auto;
    background: var(--c-bg-main);
}

/* =========================================================================
   PJAX transition
   ========================================================================= */

.pjax-out {
    opacity: 0;
    transition: opacity 0.15s ease;
}
.pjax-in {
    animation: fadeUp 0.25s ease-out both;
}

/* =========================================================================
   mobile
   ========================================================================= */

@media (max-width: 48rem) {
    body {
        font-size: 1rem;
        background: var(--c-bg-main);
    }
    main {
        --main-px: 1rem;
        padding: 4.5rem var(--main-px) 3rem;
        border-left: none;
        border-right: none;
        width: 100%;
    }
    h1 {
        font-size: 1.65rem;
    }
    h2 {
        font-size: 1.3rem;
    }
    h3 {
        font-size: 1.12rem;
    }

    .page-cover {
        height: 13rem;
    }
    .page-cover-inner {
        padding: 1.2rem 1rem 1rem;
    }
    .page-cover-inner h1 {
        font-size: 1.5rem;
    }

    .img-small {
        max-width: 40%;
    }
    .img-medium {
        max-width: 88%;
    }

    .news-item {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    .news-cover {
        aspect-ratio: 16 / 9;
        width: 100%;
    }
    .news-body .news-title {
        font-size: 1.15rem;
        text-align: center;
    }
    .news-summary {
        -webkit-line-clamp: 3;
        text-align: center;
    }
    .news-meta {
        text-align: center;
    }

    .article-nav a {
        max-width: 100%;
    }
    .article-nav {
        flex-direction: column;
    }
    .article-nav-next {
        text-align: left;
        margin-left: 0;
    }

    pre {
        font-size: 0.84rem;
        padding: 0.85rem 0.9rem;
    }
    table {
        font-size: 0.86rem;
    }
    thead th,
    tbody td {
        padding: 0.5rem 0.65rem;
    }

    .comment {
        padding: 0.65rem 0.75rem;
        gap: 0.55rem;
    }
    .comment-avatar {
        width: 2rem;
        height: 2rem;
    }

    .site-trigger {
        width: 3.2rem;
        height: 3.2rem;
        top: 0.7rem;
        right: 0.7rem;
    }
    .site-drawer {
        top: calc(0.7rem + 3.2rem + 0.4rem);
        right: 0.7rem;
    }

    footer {
        width: 100%;
    }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
    html {
        scroll-behavior: auto;
    }
}
