/*
@font-face {
    font-family: 'Mincho';
    src: url('https://s.liuwei.me/Huiwenmincho-improved.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
*/

body {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    font-family: -apple-system, 'Poppins', 'Helvetica Neue', Helvetica, 'Nimbus Sans L', Arial, 'Liberation Sans', 'PingFang SC', 'Hiragino Sans GB',
        'Source Han Sans CN', 'Source Han Sans SC', 'Microsoft YaHei', 'Wenquanyi Micro Hei', 'WenQuanYi Zen Hei', 'ST Heiti', SimHei,
        'WenQuanYi Zen Hei Sharp', sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

header {
    text-align: center;
    margin: 2em 0;
}

h1 {
    box-shadow: inset 0 -0.5em 0 0 #f8e71c;
    display: inline-block;
    margin: 0;
    font-weight: 600;
    line-height: 1.2em;
}

main {
    margin: 20px;
}

p {
    margin-block-end: 2em;
    position: relative;
    width: 100%;
}

span.ntime {
    display: block;
    font-size: 0.7em;
    color: #CCC;
    margin-bottom: 0.5em;
    letter-spacing: 0.03em;
}

span.tweet {
    display: block;
    word-wrap: break-word;
    white-space: pre-wrap;
    /* font-family: 'Mincho', serif; */
}

.photo-title {
    display: block;
    margin-top: 0.85em;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.tweet-attachment {
    display: block;
    margin-top: 0.75em;
    padding: 14px;
    background: #f6f6f6;
    border: 1px solid #f1f1f1;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.tweet-attachment:hover {
    background: #f6f6f6;
    border-color: #f6f6f6;
}

.tweet-attachment-title {
    display: block;
    font-weight: 600;
    color: #8c8c8c;
}

.tweet-attachment-url {
    display: block;
    margin-top: 4px;
    font-size: 0.85em;
    color: #ccc;
    word-break: break-all;
}

img {
    width: 800px;
    height: auto;
    display: block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-left: calc((800px - 100%) / -2);
}

/* Load More Container */
.load-more-container {
    text-align: center;
    margin: 4em 0 3em 0;
    padding: 0;
    position: relative;
}

/* Load More Button - 极简优雅风格 */
button#load-more {
    border: none;
    background: transparent;
    font-size: 0.85em;
    font-weight: 500;
    color: #999;
    padding: 16px 32px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* 底部装饰线 */
button#load-more::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 1px;
    background: #e0e0e0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

button#load-more:hover {
    color: #333;
}

button#load-more:hover::after {
    width: 80px;
    background: #f8e71c;
}

button#load-more:active {
    transform: scale(0.98);
}

/* Loading Spinner - 优雅的三点脉冲 */
.loading-spinner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px 0;
}

.loading-spinner span {
    display: none;
}

.htmx-request .loading-spinner {
    display: flex;
}

.htmx-request button#load-more {
    display: none;
}

/* 三点脉冲动画 */
.spinner {
    display: flex;
    gap: 6px;
}

.spinner::before,
.spinner::after,
.spinner {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ccc;
    animation: pulse 1.4s ease-in-out infinite;
}

.spinner::before {
    animation-delay: 0s;
}

.spinner {
    animation-delay: 0.2s;
}

.spinner::after {
    animation-delay: 0.4s;
}

@keyframes pulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 新内容淡入动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.htmx-settling {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@media only screen and (max-width: 1400px) {
    body {
        padding: 0;
        max-width: 100%;
    }

    main {
        margin: 0;
    }

    p {
        margin-block-end: 2em;
        width: 100%;
    }

    img {
        width: 100vw;
        max-width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        margin-left: 0vw;
        margin-right: -50vw;
    }

    span.ntime,
    span.tweet {
        padding: 0 20px;
        box-sizing: border-box;
        width: 100%;
        display: block;
    }

    /* Mobile Load More Button */
    .load-more-container {
        margin: 3em 0 2em 0;
        padding: 0 20px;
    }

    button#load-more {
        font-size: 0.8em;
        padding: 14px 28px;
    }

    /* Touch feedback */
    button#load-more:active {
        transform: scale(0.96);
    }
}

@media only screen and (min-width: 800px) and (max-width: 1400px) {
    body {
        padding: 0 20px;
    }

    img {
        width: calc(100vw - 40px);
        margin-left: calc(-50vw + 50% + 20px);
    }

    span.ntime,
    span.tweet {
        padding: 0;
    }
}
