/* ============================================================
   Elaina.cat 全站共享视觉外壳
   与主页 index.html 保持同一套玻璃面板 / 字体 / 动效语言
   纯 CSS（不依赖 Tailwind 的 @apply），可直接被静态页引用
   ============================================================ */

/* ---------- 全局字体与背景 ---------- */
* {
    box-sizing: border-box;
    font-family: 'LXGW WenKai', 'Microsoft YaHei', system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: 'LXGW WenKai', 'Microsoft YaHei', system-ui, sans-serif;
    font-weight: 600;
    background:
        radial-gradient(circle at 12% 8%, rgba(238, 232, 213, 0.96), transparent 30%),
        radial-gradient(circle at 85% 14%, rgba(214, 226, 240, 0.88), transparent 34%),
        linear-gradient(135deg, #f8f5ef 0%, #edf2f7 48%, #f7f1f3 100%);
    color: #2f3440;
    overflow-x: hidden;
}

/* ---------- 页面入场动画 ---------- */
.page-enter {
    opacity: 0;
}
.page-enter-active {
    opacity: 1;
    transition: opacity 0.6s ease;
}

/* ---------- 柔和渐显动画 ---------- */
/* 未启用 JS 时保持内容可见：只有 html.js 才隐藏初始状态 */
.js .soft-reveal {
    opacity: 0;
    transition: opacity 0.9s ease;
}
.soft-reveal.visible {
    opacity: 1;
}
.js .soft-reveal-bounce {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.soft-reveal-bounce.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 文本与渐变工具类 ---------- */
.text-shadow {
    text-shadow: 0 2px 16px rgba(77, 58, 46, 0.18);
}
.bg-gradient-magic {
    background: linear-gradient(135deg, #7c5f4b 0%, #50677f 58%, #9a746e 100%);
}
.transition-smooth {
    transition: all 0.3s ease-in-out;
}

/* ---------- 玻璃面板 ---------- */
.floating-panel {
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 45px rgba(62, 69, 82, 0.16);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.content-panel {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 0 24px 60px rgba(62, 69, 82, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.reading-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 244, 0.78));
    border: 1px solid rgba(206, 190, 171, 0.48);
    box-shadow: 0 18px 50px rgba(86, 72, 55, 0.12);
}
.reading-panel,
.content-panel {
    transition: opacity 0.9s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.reading-panel:hover,
.content-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 64px rgba(62, 69, 82, 0.16);
}
.hairline {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124, 95, 75, 0.36), transparent);
}
.quote-item {
    border-left: 3px solid rgba(124, 95, 75, 0.34);
}

/* ---------- 右上角菜单 ---------- */
.menu-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    margin-right: 13px;
    color: #667085;
    stroke-width: 1.8;
    transition: color 0.2s ease, transform 0.2s ease;
}
.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #2f3440;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.menu-item:hover {
    background: rgba(47, 52, 64, 0.05);
    color: #111827;
}
.menu-item:hover .menu-icon {
    color: #5d4037;
    transform: translateX(2px);
}

/* ---------- 菜单开合动画 ---------- */
.menu-enter {
    opacity: 0;
    transform: translateY(-10px);
}
.menu-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ---------- 汉堡图标动画 ---------- */
.menu-toggle-icon {
    --menu-line-height: 2.4px;
    position: relative;
    display: block;
    width: 17px;
    height: 15px;
}
.menu-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: var(--menu-line-height);
    border-radius: 999px;
    background: #2d3748;
    transform-origin: center;
    backface-visibility: hidden;
    transition: top 0.24s ease, transform 0.24s ease, opacity 0.18s ease;
}
.menu-line:nth-child(1) {
    top: 1px;
}
.menu-line:nth-child(2) {
    top: calc(50% - var(--menu-line-height) / 2);
}
.menu-line:nth-child(3) {
    top: calc(100% - var(--menu-line-height) - 1px);
}
#menu-btn.is-open .menu-line:nth-child(1) {
    top: calc(50% - var(--menu-line-height) / 2);
    transform: rotate(45deg);
}
#menu-btn.is-open .menu-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0.2);
}
#menu-btn.is-open .menu-line:nth-child(3) {
    top: calc(50% - var(--menu-line-height) / 2);
    transform: rotate(-45deg);
}

/* ---------- 语言切换器滑动指示器 ---------- */
.lang-switcher {
    --lang-indicator-x: 6px;
    --lang-indicator-w: 0px;
    isolation: isolate;
    opacity: 1;
    transition: opacity 0.14s ease;
}
.lang-switcher-indicator {
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 0;
    z-index: 0;
    width: var(--lang-indicator-w);
    border-radius: 999px;
    background: linear-gradient(135deg, #2f3440 0%, #50677f 100%);
    box-shadow: 0 8px 18px rgba(47, 52, 64, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translate3d(var(--lang-indicator-x), 0, 0);
    transition:
        transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
        width 0.42s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.18s ease,
        box-shadow 0.28s ease;
    will-change: transform, width;
}
.lang-switcher.is-ready .lang-switcher-indicator {
    opacity: 1;
}
.lang-switcher.is-initializing {
    opacity: 0;
    pointer-events: none;
}
.lang-switcher.is-initializing .lang-switcher-indicator,
.lang-switcher.is-initializing .lang-btn {
    transition: none !important;
}
.lang-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 32px;
    color: #4b5563;
    background: transparent;
    transition:
        color 0.24s ease,
        background-color 0.22s ease,
        transform 0.18s ease,
        text-shadow 0.24s ease;
}
.lang-switcher:not(.is-ready) .lang-btn.is-active {
    color: #fff;
    background: #2f3440;
    box-shadow: 0 8px 18px rgba(47, 52, 64, 0.22);
}
.lang-btn:hover {
    background: rgba(47, 52, 64, 0.08);
    color: #111827;
    transform: translateY(-1px);
}
.lang-btn.is-active {
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.22);
}
.lang-switcher.is-ready .lang-btn.is-active,
.lang-switcher.is-ready .lang-btn.is-active:hover {
    background: transparent;
    color: #fff;
    transform: translateY(0);
}
.lang-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ---------- 键盘可达性 ---------- */
.nav-btn:focus-visible,
.lang-btn:focus-visible,
.function-btn:focus-visible,
.lightbox-close:focus-visible,
.carousel-indicator:focus-visible,
.back-link:focus-visible {
    outline: 3px solid rgba(80, 103, 127, 0.34);
    outline-offset: 3px;
}

/* ---------- 图片查看器 ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    cursor: zoom-out;
}
.lightbox.active {
    opacity: 1;
    visibility: visible;
}
.lightbox img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transform: scale(0.9);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}
.lightbox img.is-empty {
    visibility: hidden;
}
.lightbox.active img {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 76px);
    right: calc(env(safe-area-inset-right, 0px) + 16px);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
@media (min-width: 768px) {
    .lightbox-close {
        top: calc(env(safe-area-inset-top, 0px) + 20px);
        right: calc(env(safe-area-inset-right, 0px) + 84px);
        width: 46px;
        height: 46px;
    }
}
.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ---------- 回到顶部 ---------- */
.back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 24px rgba(62, 69, 82, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 90;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}
.back-to-top.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.back-to-top:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 12px 32px rgba(62, 69, 82, 0.2);
    transform: translateY(-2px);
}
.back-to-top:active {
    transform: translateY(0);
}

/* ---------- APlayer 迷你模式 ---------- */
.aplayer.aplayer-fixed {
    z-index: 99;
}
.aplayer.aplayer-fixed .aplayer-body {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
}
.aplayer.aplayer-fixed .aplayer-miniswitcher {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.12);
}
.aplayer.aplayer-fixed .aplayer-lrc {
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.aplayer.aplayer-fixed .aplayer-lrc.aplayer-lrc-show {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* ---------- Waline 留言区 ---------- */
.waline-container {
    transition: all 0.3s ease;
}
.waline-container .wl-comments,
.waline-container .wl-editor {
    border-radius: 0.5rem;
    border-color: #e5e7eb;
}
.waline-container .wl-count {
    font-size: 1.25rem;
    line-height: 1.75rem;
    font-weight: 700;
    color: #5d4037;
    margin-bottom: 1rem;
}
.waline-container .wl-btn {
    color: #fff;
}
.waline-container .wl-editor .wl-btn[type="submit"] {
    background-color: #42b983 !important;
    border-color: #42b983 !important;
}
.waline-container .wl-editor .wl-btn[type="submit"]:hover {
    background-color: #359469 !important;
    border-color: #359469 !important;
}
.waline-loading {
    text-align: center;
    padding: 2rem;
}
.waline-loading i {
    animation: spin 1.5s linear infinite;
    font-size: 2rem;
    color: #6b46c1;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---------- 博客列表卡片 ---------- */
.blog-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 250, 244, 0.78));
    border: 1px solid rgba(206, 190, 171, 0.48);
    box-shadow: 0 18px 50px rgba(86, 72, 55, 0.12);
    transition: opacity 0.9s ease, transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.blog-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 95, 75, 0.34);
    box-shadow: 0 24px 60px rgba(62, 69, 82, 0.16);
}
.blog-image-container {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f4f0ea;
}
.blog-image {
    transition: transform 0.5s ease;
}
.blog-card:hover .blog-image {
    transform: scale(1.04);
}
.post-date {
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
}
.post-excerpt {
    color: #4b5563;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.read-more {
    display: inline-flex;
    align-items: center;
    color: #1f2937;
    font-weight: 600;
    transition: all 0.3s ease-in-out;
}
.read-more:hover {
    color: #5d4037;
}
.read-more i {
    margin-left: 0.25rem;
    transition: transform 0.3s ease;
}
.read-more:hover i {
    transform: translateX(4px);
}

/* ---------- 文章页 ---------- */
.article-image-container {
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 1rem;
    margin-bottom: 1rem;
    background: #f4f0ea;
    box-shadow: 0 18px 45px rgba(62, 69, 82, 0.12);
}
.article-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.article-image:hover {
    transform: scale(1.02);
}
.article-content {
    font-size: 1.125rem;
    color: #4a5568;
}
.article-content p {
    margin-bottom: 1.5rem;
    line-height: 1.9;
}
.author-info {
    display: inline-flex;
    align-items: center;
    color: #2f3440;
    text-decoration: none;
    transition: all 0.3s ease;
}
.author-info:hover {
    color: #5d4037;
    text-decoration: underline;
}
.author-info i {
    margin-left: 0.25rem;
    font-size: 0.85rem;
}
.back-link {
    display: inline-flex;
    align-items: center;
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
    .menu-line,
    .lang-switcher-indicator,
    .lang-btn,
    .soft-reveal,
    .soft-reveal-bounce {
        transition: none;
    }
}
