/* ============================================================
   components.css — 卡片 / 按钮 / 物理标签 / 彩蛋 / 入场动画
   [INPUT]: 依赖 base.css 的 CSS 变量
   [OUTPUT]: 所有可复用 UI 组件样式
   [POS]: 组件层，被 index.html 和 resume.html 共享
   [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
   ============================================================ */

/* ============================================================
   Base Card
   ============================================================ */
.bento-card {
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    cursor: default;
    /* 入场动画初始状态 */
    opacity: 0;
    transform: translateY(40px);
    animation: cardFadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    z-index: 10;
}

.card-content {
    position: relative;
    z-index: 2;
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   Card Style 1: Light
   ============================================================ */
.style-light {
    background-color: var(--c1-bg);
    color: var(--c1-text);
    box-shadow: var(--shadow-card);
}

.halftone-bottom {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 50%;
    background-image: radial-gradient(var(--c1-dot) 1.5px, transparent 1.5px);
    background-size: 16px 16px;
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
    z-index: 0;
}

/* Hero */
.hero-title {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--c1-text);
}

.hero-sub {
    font-size: 0.95rem;
    color: var(--c1-sub);
    max-width: 90%;
}

/* Social Buttons */
.social-buttons {
    display: flex;
    gap: 12px;
    margin-top: auto;
    position: relative;
}

.social-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--social-btn-bg, rgba(0,0,0,0.06));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c1-text);
    font-size: 18px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-btn:hover {
    transform: scale(1.1);
    background: var(--social-btn-hover, rgba(0,0,0,0.12));
    opacity: 1;
}

.social-btn svg { display: block; }

.social-btn.easter-egg {
    border: none;
    cursor: pointer;
}

/* Easter Egg */
.easter-egg-wrapper {
    position: relative;
    display: inline-flex;
}

.easter-egg-popup {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    width: 260px;
    background: var(--c1-bg);
    border-radius: 16px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    text-align: center;
    pointer-events: none;
}

.easter-egg-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.popup-arrow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 16px;
    height: 16px;
    background: var(--c1-bg);
    box-shadow: 4px 4px 8px rgba(0,0,0,0.05);
}

.popup-msg {
    font-size: 14px;
    color: var(--c1-text);
    line-height: 1.5;
}

[data-theme="dark"] .easter-egg-popup {
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

/* Status Dot */
.status-dot {
    width: 10px;
    height: 10px;
    background-color: #22c55e;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

/* Resume Card */
.resume-card { cursor: pointer; }

.resume-card .card-content {
    padding: 20px;
    justify-content: space-between;
}

.resume-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.resume-icon { font-size: 1.5rem; color: var(--c3-text); }
.resume-arrow { font-size: 1rem; color: var(--c3-sub); }
.resume-text { display: flex; flex-direction: column; }

/* ============================================================
   Card Style 2: Blue (Contact)
   ============================================================ */
.style-blue {
    background-color: var(--c2-bg);
    color: var(--c2-text);
    box-shadow: var(--shadow-card);
    border: none;
}

.halftone-full {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(var(--c2-dot) 2px, transparent 2px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

.style-blue.grid-contact { position: relative; }

.contact-text {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.4;
    pointer-events: none;
    z-index: 20;
}

/* Physics Container & Tags */
.physics-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 10;
}

.physics-tag {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: grab;
    transition: background 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.physics-tag i {
    font-size: 1.2rem;
    line-height: 1;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.physics-tag:hover { background: rgba(255, 255, 255, 0.3); }
.physics-tag:active { cursor: grabbing; outline: none; }

/* ============================================================
   Card Style 3: Dark
   ============================================================ */
.style-dark {
    background-color: var(--c3-bg);
    color: var(--c3-text);
    border: 1px solid var(--c3-border);
    box-shadow: var(--shadow-card);
}

.texture-diagonal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        repeating-linear-gradient(45deg, var(--c3-texture) 0, var(--c3-texture) 1px, transparent 1px, transparent 8px),
        repeating-linear-gradient(-45deg, var(--c3-texture) 0, var(--c3-texture) 1px, transparent 1px, transparent 8px);
    z-index: 0;
    pointer-events: none;
}

.stacked-text {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
}

.stacked-text span { display: block; }

.clock-display {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.blog-meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--c3-sub);
}

.arrow-icon {
    background: var(--c3-icon);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   入场动画
   ============================================================ */
@keyframes cardFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 阶梯延迟 */
.grid-hero                          { animation-delay: 0.1s; }
.grid-about                         { animation-delay: 0.2s; }
.grid-stacked .bento-card:nth-child(1) { animation-delay: 0.3s; }
.grid-stacked .bento-card:nth-child(2) { animation-delay: 0.4s; }
.grid-contact                       { animation-delay: 0.5s; }
.grid-timezone                      { animation-delay: 0.6s; }
.grid-blog                          { animation-delay: 0.7s; }

/* 博客列表卡片入场 */
.post-list-card {
    opacity: 0;
    transform: translateY(30px);
    animation: cardFadeIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.post-list-card:nth-child(1) { animation-delay: 0.1s; }
.post-list-card:nth-child(2) { animation-delay: 0.2s; }
.post-list-card:nth-child(3) { animation-delay: 0.3s; }
.post-list-card:nth-child(4) { animation-delay: 0.4s; }
.post-list-card:nth-child(5) { animation-delay: 0.5s; }
