/* ============================================================
   template.css — Template Gallery 入口页独立样式
   不依赖 home.css / web.css，仅复用 fx.css 基础重置
   ============================================================ */

/* ── CSS Variables ── */
:root {
    --tpl-primary: #ff6101;
    --tpl-primary-light: #ff8a3d;
    --tpl-primary-dark: #e05500;
    --tpl-bg: #fafafa;
    --tpl-surface: #ffffff;
    --tpl-text: #1a1a2e;
    --tpl-text-secondary: #6b7280;
    --tpl-border: #f0f0f0;
    --tpl-radius: 16px;
    --tpl-radius-sm: 10px;
    --tpl-shadow: 0 2px 12px rgba(0,0,0,.05);
    --tpl-shadow-hover: 0 12px 32px rgba(255,97,1,.12);
    --tpl-max-width: 1080px;
}

/* ── Header ── */
.tpl-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 60px; background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,.06);
    display: flex; align-items: center; justify-content: center;
}
.tpl-header-inner {
    width: 100%; max-width: var(--tpl-max-width);
    padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
}
.tpl-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.tpl-logo img { width: 32px; height: 32px; }
.tpl-logo-text { font-size: 18px; font-weight: 700; color: var(--tpl-text); }
.tpl-nav { display: flex; gap: 28px; }
.tpl-nav a { font-size: 14px; color: var(--tpl-text-secondary); text-decoration: none; font-weight: 500; transition: color .15s; }
.tpl-nav a:hover { color: var(--tpl-primary); }
.tpl-nav a.active { color: var(--tpl-primary); }
.tpl-header-cta {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--tpl-primary); color: #fff; border-radius: var(--tpl-radius-sm);
    padding: 8px 20px; font-size: 13px; font-weight: 600; text-decoration: none;
    transition: background .2s;
}
.tpl-header-cta:hover { background: var(--tpl-primary-dark); }

/* ── Hero ── */
.tpl-hero {
    margin-top: 60px; padding: 80px 24px 100px;
    background: linear-gradient(135deg, #ff6101 0%, #ff8a3d 50%, #ffad6e 100%);
    color: white; text-align: center; position: relative; overflow: hidden;
}
.tpl-hero::before {
    content: ''; position: absolute; width: 500px; height: 500px;
    background: rgba(255,255,255,.06); border-radius: 50%;
    top: -150px; right: -80px; pointer-events: none;
}
.tpl-hero::after {
    content: ''; position: absolute; width: 320px; height: 320px;
    background: rgba(255,255,255,.04); border-radius: 50%;
    bottom: -100px; left: 8%; pointer-events: none;
}
.tpl-hero-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
    border-radius: 20px; padding: 4px 16px; font-size: 12px;
    font-weight: 500; margin-bottom: 16px; letter-spacing: .03em;
}
.tpl-hero h1 { font-size: 44px; font-weight: 800; margin: 0 0 14px; letter-spacing: -.5px; line-height: 1.15; }
.tpl-hero p { font-size: 17px; opacity: .9; max-width: 580px; margin: 0 auto; line-height: 1.7; }
.tpl-hero-stats {
    display: flex; gap: 36px; margin-top: 32px; justify-content: center; flex-wrap: wrap;
}
.tpl-hero-stats .stat { display: flex; flex-direction: column; align-items: center; }
.tpl-hero-stats .stat-num { font-size: 24px; font-weight: 800; }
.tpl-hero-stats .stat-lbl { font-size: 12px; opacity: .75; margin-top: 2px; }

/* ── Filter Bar ── */
.tpl-filter {
    padding: 32px 24px 0; max-width: var(--tpl-max-width); margin: 0 auto;
    display: flex; gap: 8px; flex-wrap: wrap;
}
.tpl-filter-btn {
    background: var(--tpl-surface); border: 1px solid var(--tpl-border);
    border-radius: 20px; padding: 6px 18px; font-size: 13px; font-weight: 500;
    color: var(--tpl-text-secondary); cursor: pointer; transition: all .2s;
}
.tpl-filter-btn:hover, .tpl-filter-btn.active {
    background: var(--tpl-primary); color: #fff; border-color: var(--tpl-primary);
}

/* ── Section Divider ── */
.tpl-section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0 4px;
}
.tpl-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tpl-border);
}
.tpl-section-divider span {
    font-size: 14px;
    font-weight: 600;
    color: var(--tpl-text-secondary);
    white-space: nowrap;
    letter-spacing: .02em;
}

/* ── Template Grid ── */
.tpl-grid-section {
    padding: 32px 24px 80px; max-width: var(--tpl-max-width); margin: 0 auto;
}
.tpl-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.tpl-card {
    background: var(--tpl-surface); border-radius: var(--tpl-radius);
    border: 1px solid var(--tpl-border); overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
    text-decoration: none; color: inherit; display: flex; flex-direction: column;
}
.tpl-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tpl-shadow-hover);
}
.tpl-card-thumb {
    width: 100%; aspect-ratio: 16/10; background: #f3f4f6;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
/* ── Thumb emoji placeholder ── */
.tpl-thumb-emoji {
    font-size: 48px; position: absolute; z-index: 1;
    transition: opacity .4s ease;
}
.tpl-thumb-emoji.hidden { opacity: 0; }
/* ── Thumb image (lazy loaded) ── */
.tpl-thumb-img {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover; object-position: top;
    opacity: 0; transition: opacity .4s ease;
    z-index: 2;
}
.tpl-thumb-img.loaded { opacity: 1; }
/* ── Short image: static display ── */
.tpl-thumb-img.short { height: 100%; }
/* ── Long image: full-height, hover auto-scroll ── */
.tpl-thumb-img.long {
    height: auto;           /* natural height exceeds container → triggers scroll */
    min-height: 100%;
    object-fit: cover;
    object-position: top;
}
.tpl-card:hover .tpl-thumb-img.long:not(.tpl-assess-form):not(.tpl-assess-report) {
    animation: thumb-scroll 5s ease-in-out forwards;
}
@keyframes thumb-scroll {
    0%   { transform: translateY(0); }
    100% { transform: translateY(calc(-1 * var(--scroll-y, 0px))); }
}

/* ── Assessment: dual-image stacking ── */
.tpl-thumb-assessment .tpl-assess-form {
    position: absolute; top: 0; left: 0;
    width: 100%; height: auto; min-height: 100%;
    object-fit: cover; object-position: top;
    z-index: 3;
    opacity: 1;
    transition: opacity .3s ease;
}
.tpl-thumb-assessment .tpl-assess-report {
    position: absolute; top: 0; left: 0;
    width: 100%; height: auto; min-height: 100%;
    object-fit: cover; object-position: top;
    z-index: 2;
    opacity: 0;
    transition: opacity .3s ease;
}
/* ── Assessment: phase indicator dots ── */
.tpl-assess-indicator {
    position: absolute; bottom: 8px; left: 50%;
    transform: translateX(-50%);
    z-index: 5; display: flex; gap: 6px;
}
.tpl-assess-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,.4);
    transition: all .3s ease;
}
.tpl-assess-dot.active {
    background: #fff; width: 18px; border-radius: 3px;
}

/* ── Assessment: hover left/right phase switch ── */
/* Phase: Form (hover left 50%) */
.tpl-assess-phase-form .tpl-assess-form {
    opacity: 1;
}
.tpl-assess-phase-form .tpl-assess-form.long {
    animation: assess-form-scroll-up 4s ease-in-out forwards;
}
.tpl-assess-phase-form .tpl-assess-report {
    opacity: 0;
    animation: none;
}
.tpl-assess-phase-form .tpl-assess-dot[data-phase="form"] {
    background: #fff; width: 18px; border-radius: 3px;
}
.tpl-assess-phase-form .tpl-assess-dot[data-phase="report"] {
    background: rgba(255,255,255,.4); width: 6px; border-radius: 50%;
}

/* Phase: Report (hover right 50%) */
.tpl-assess-phase-report .tpl-assess-form {
    opacity: 0;
    animation: none;
}
.tpl-assess-phase-report .tpl-assess-report {
    opacity: 1;
}
.tpl-assess-phase-report .tpl-assess-report.long {
    animation: assess-report-scroll-up 4s ease-in-out forwards;
}
.tpl-assess-phase-report .tpl-assess-dot[data-phase="form"] {
    background: rgba(255,255,255,.4); width: 6px; border-radius: 50%;
}
.tpl-assess-phase-report .tpl-assess-dot[data-phase="report"] {
    background: #fff; width: 18px; border-radius: 3px;
}

@keyframes assess-form-scroll-up {
    0%   { transform: translateY(0); }
    100% { transform: translateY(calc(-1 * var(--scroll-y, 0px))); }
}
@keyframes assess-report-scroll-up {
    0%   { transform: translateY(0); }
    100% { transform: translateY(calc(-1 * var(--scroll-y-report, 0px))); }
}

/* ── Assessment: industry label ── */
.tpl-industry-assessment {
    background: var(--tpl-primary);
    color: #fff !important;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* ── Assessment: feature badges ── */
.tpl-card-badges {
    display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap;
}
.tpl-badge {
    font-size: 11px; padding: 2px 8px; border-radius: 10px;
    font-weight: 600; line-height: 1.4;
}
.tpl-badge-form    { background: #e8f0fe; color: #1a73e8; }
.tpl-badge-report  { background: #fff3e0; color: #ff6101; }
.tpl-badge-expert  { background: #e8f5e9; color: #34a853; }
.tpl-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.tpl-card-industry {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: var(--tpl-primary); letter-spacing: .05em; margin-bottom: 8px;
}
.tpl-card-title { font-size: 17px; font-weight: 700; color: var(--tpl-text); margin: 0 0 8px; line-height: 1.3; }
.tpl-card-desc { font-size: 13px; color: var(--tpl-text-secondary); line-height: 1.6; margin: 0 0 14px; flex: 1; }
.tpl-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tpl-card-tag {
    background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 2px 10px; font-size: 11px; color: #6b7280;
}
.tpl-card-cta {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--tpl-primary); font-weight: 600; font-size: 14px;
    text-decoration: none; transition: gap .2s;
}
.tpl-card-cta:hover { gap: 10px; }

/* ── Why Section ── */
.tpl-why {
    padding: 64px 24px 72px; background: var(--tpl-surface);
    max-width: var(--tpl-max-width); margin: 0 auto;
}
.tpl-why-title { font-size: 22px; font-weight: 700; color: var(--tpl-text); text-align: center; margin: 0 0 8px; }
.tpl-why-subtitle { font-size: 15px; color: var(--tpl-text-secondary); text-align: center; margin: 0 0 32px; }
.tpl-why-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.tpl-why-card {
    background: #fafafa; border: 1px solid var(--tpl-border);
    border-radius: 14px; padding: 24px 20px;
}
.tpl-why-icon { font-size: 28px; margin-bottom: 10px; }
.tpl-why-card h3 { font-size: 15px; font-weight: 600; color: var(--tpl-text); margin: 0 0 6px; }
.tpl-why-card p { font-size: 13px; color: var(--tpl-text-secondary); line-height: 1.65; margin: 0; }

/* ── CTA Banner ── */
.tpl-cta-banner {
    background: linear-gradient(135deg, #1a1a2e, #2d2b55);
    padding: 48px 24px; text-align: center; color: white;
}
.tpl-cta-banner h2 { font-size: 24px; font-weight: 700; margin: 0 0 12px; }
.tpl-cta-banner p { font-size: 15px; opacity: .8; max-width: 500px; margin: 0 auto 20px; line-height: 1.6; }
.tpl-cta-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--tpl-primary); color: #fff; border-radius: var(--tpl-radius-sm);
    padding: 12px 28px; font-size: 15px; font-weight: 600; text-decoration: none;
    transition: background .2s;
}
.tpl-cta-btn:hover { background: var(--tpl-primary-dark); }

/* ── Footer ── */
.tpl-footer {
    background: #1a1a2e; color: rgba(255,255,255,.6); padding: 48px 24px 32px;
}
.tpl-footer-inner {
    max-width: var(--tpl-max-width); margin: 0 auto;
    display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap;
}
.tpl-footer-brand { max-width: 280px; }
.tpl-footer-brand-name { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 8px; }
.tpl-footer-brand p { font-size: 13px; line-height: 1.6; margin: 0; }
.tpl-footer-col-title { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.8); margin-bottom: 12px; }
.tpl-footer-col a { display: block; font-size: 13px; color: rgba(255,255,255,.5); text-decoration: none; margin-bottom: 8px; transition: color .15s; }
.tpl-footer-col a:hover { color: #fff; }
.tpl-footer-bottom {
    max-width: var(--tpl-max-width); margin: 32px auto 0;
    padding-top: 20px; border-top: 1px solid rgba(255,255,255,.08);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
    font-size: 12px;
}
.tpl-footer-bottom a { color: rgba(255,255,255,.4); text-decoration: none; margin-left: 16px; }
.tpl-footer-bottom a:hover { color: rgba(255,255,255,.7); }

/* ── Responsive ── */
@media screen and (max-width: 860px) {
    .tpl-grid { grid-template-columns: repeat(2, 1fr); }
    .tpl-hero h1 { font-size: 32px; }
    .tpl-why-grid { grid-template-columns: 1fr; }
    /* 移动端不做hover滚动动画 */
    .tpl-card:hover .tpl-thumb-img.long { animation: none; }
    .tpl-assess-phase-form .tpl-assess-form.long,
    .tpl-assess-phase-report .tpl-assess-report.long { animation: none; }
}
@media screen and (max-width: 560px) {
    .tpl-grid { grid-template-columns: 1fr; }
    .tpl-hero h1 { font-size: 26px; }
    .tpl-nav { display: none; }
    .tpl-hero-stats { gap: 20px; }
}
