/**
 * iPhoto Theme Styles
 * Typecho-iPhoto-Theme v1.3.0
 * Author: RAO
 * https://qi.loc.cc/
 */

/* ========================
   Swup 页面过渡动画
   ======================== */
.transition-main {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

html.is-animating .transition-main {
    opacity: 0;
    transform: translateY(8px);
}

html.is-leaving .transition-main {
    opacity: 0;
    transform: translateY(-8px);
}

/* ========================
   通用样式
   ======================== */

/* 多行文本截断 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ========================
   轮播图
   ======================== */
#hero-slider .slider-slide {
    pointer-events: none;
}

#hero-slider .slider-slide.active,
#hero-slider .slider-slide:first-child {
    pointer-events: auto;
}

/* ========================
   文章卡片
   ======================== */
.iphoto-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.iphoto-card:hover {
    transform: translateY(-2px);
}

/* ========================
   文章正文排版
   ======================== */
.post-content {
    font-size: 15px;
    line-height: 1.8;
    color: #374151;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-content p {
    margin-bottom: 1.25em;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em auto;
    display: block;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    font-weight: 700;
    color: #1f2937;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}

.post-content h1 { font-size: 1.75em; }
.post-content h2 { font-size: 1.5em; }
.post-content h3 { font-size: 1.25em; }
.post-content h4 { font-size: 1.1em; }

.post-content a {
    color: #f25c6e;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: #e04a5c;
}

.post-content blockquote {
    border-left: 4px solid #f25c6e;
    padding: 0.75em 1.25em;
    margin: 1.25em 0;
    background: #fef2f2;
    border-radius: 0 8px 8px 0;
    color: #6b7280;
}

.post-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 1.25em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.25em 0;
    font-size: 0.875em;
    line-height: 1.7;
}

.post-content code {
    background: #f3f4f6;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #f25c6e;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.post-content ul,
.post-content ol {
    padding-left: 1.5em;
    margin-bottom: 1.25em;
}

.post-content ul {
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content li {
    margin-bottom: 0.35em;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25em 0;
}

.post-content th,
.post-content td {
    border: 1px solid #e5e7eb;
    padding: 0.625em 1em;
    text-align: left;
}

.post-content th {
    background: #f9fafb;
    font-weight: 600;
}

.post-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2em 0;
}

/* ========================
   分页导航（Typecho pageNav 输出）
   ======================== */
.iphoto-pagination ol {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.iphoto-pagination ol li {
    display: flex;
    align-items: center;
    justify-content: center;
}

.iphoto-pagination ol li a,
.iphoto-pagination ol li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 9999px;
    font-size: 14px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.iphoto-pagination ol li a {
    color: #f25c6e;
}

.iphoto-pagination ol li a:hover {
    background-color: rgb(242 92 110 / 0.2);
}

/* 当前页码 */
.iphoto-pagination ol li.current a,
.iphoto-pagination ol li.current span,
.iphoto-pagination ol li span.current {
    background-color: #f25c6e;
    color: #fff;
    font-weight: 500;
}

/* 上一页/下一页箭头 */
.iphoto-pagination ol li.prev a,
.iphoto-pagination ol li.next a {
    color: #f25c6e;
}

.iphoto-pagination ol li.prev a:hover,
.iphoto-pagination ol li.next a:hover {
    background-color: #fef2f2;
}

/* 省略号 */
.iphoto-pagination ol li span.text {
    color: #9ca3af;
}

/* ========================
   评论区域
   ======================== */

/* 重置评论列表默认样式 */
.comment-list,
.comment-list ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* 顶级评论之间分隔线 */
.comment-list > .comment-body {
    border-bottom: 1px solid #f3f4f6;
}

.comment-list > .comment-body:last-child {
    border-bottom: none;
}

/* 嵌套子评论容器 */
.comment-list ol.comment-list {
    margin-left: 48px;
    padding-left: 16px;
    border-left: 2px solid #f3f4f6;
}

/* 评论文字内容中的 p 标签去除多余间距 */
.comment-text p {
    margin: 0;
}

/* 回复链接样式 */
.comment-reply a {
    font-size: 12px;
    color: #f25c6e;
    text-decoration: none;
}

.comment-reply a:hover {
    color: #e04a5c;
}

/* 取消回复按钮 */
#cancel-comment-reply-link {
    font-size: 12px;
    color: #9ca3af;
    margin-left: 8px;
}

#cancel-comment-reply-link:hover {
    color: #6b7280;
}

/* ========================
   侧边栏
   ======================== */
.sidebar-widget + .sidebar-widget {
    margin-top: 1.5em;
}

/* ========================
   响应式补充
   ======================== */
@media (max-width: 640px) {
    .post-content {
        font-size: 14px;
    }

    .post-content img {
        margin: 1em auto;
    }
}

/* ========================
   加载动画
   ======================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.iphoto-card {
    animation: fadeInUp 0.5s ease forwards;
}

.iphoto-card:nth-child(1)  { animation-delay: 0.02s; }
.iphoto-card:nth-child(2)  { animation-delay: 0.04s; }
.iphoto-card:nth-child(3)  { animation-delay: 0.06s; }
.iphoto-card:nth-child(4)  { animation-delay: 0.08s; }
.iphoto-card:nth-child(5)  { animation-delay: 0.10s; }
.iphoto-card:nth-child(6)  { animation-delay: 0.12s; }
.iphoto-card:nth-child(7)  { animation-delay: 0.14s; }
.iphoto-card:nth-child(8)  { animation-delay: 0.16s; }
.iphoto-card:nth-child(9)  { animation-delay: 0.18s; }
.iphoto-card:nth-child(10) { animation-delay: 0.20s; }

/* ========================
   Gravatar 头像圆形样式
   ======================== */
.comment-body img[class*="gravatar"],
.comment-body img.rounded-full {
    border-radius: 50% !important;
    border-radius: 9999px !important;
}

/* ========================
   自定义边框透明度
   ======================== */
.border-primary\/20 {
    border-color: rgb(242 92 110 / 0.8) !important;
}

/* ========================
   返回顶部按钮
   ======================== */
#back-to-top {
    transition: all 0.3s ease;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:not(.show) {
    transform: translateY(20px);
}

/* ========================
   导航下拉菜单（用原生 CSS 控制，避免 Tailwind 重扫 class 引起的闪跳）
   ======================== */

/* 只针对导航分类下拉，不影响搜索框等其他 relative 容器 */
#site-header nav .relative > .absolute {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
    /* 用 padding-top 桥接按钮与下拉菜单之间的 mt-1 间隙，保持 hover 不中断 */
    margin-top: 0;
    padding-top: 8px;
    top: 100%;
}

#site-header nav .relative:hover > .absolute {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* 防止 Swup 动画期间 header 参与过渡层叠导致闪烁 */
#site-header {
    will-change: auto;
    transform: translateZ(0);
}

/* ========================
   文章标签胶囊样式
   ======================== */
.post-tags a {
    display: inline-block;
    padding: 2px 10px;
    font-size: 12px;
    color: #f25c6e;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 9999px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    line-height: 1.6;
}

.post-tags a:hover {
    background: #f25c6e;
    color: #fff;
    border-color: #f25c6e;
}
