/* ============================================
   TechWeb Theme - Main Stylesheet
   ============================================ */

/* ============================================
   Animation System
   ============================================ */

/* ---- Keyframes ---- */
@keyframes tw-fadeup {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0);    }
}
@keyframes tw-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes tw-scaleup {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1);    }
}

/* ---- Hero entrance (CSS-only, fires on load) ---- */
@media (prefers-reduced-motion: no-preference) {
    .anim-fadeup  { animation: tw-fadeup  0.72s cubic-bezier(.4,0,.2,1) both; }
    .anim-fadein  { animation: tw-fadein  0.6s  ease both; }
    .anim-scaleup { animation: tw-scaleup 0.6s  cubic-bezier(.4,0,.2,1) both; }

    .anim-d1 { animation-delay: 0.12s; }
    .anim-d2 { animation-delay: 0.24s; }
    .anim-d3 { animation-delay: 0.38s; }
    .anim-d4 { animation-delay: 0.52s; }
}

/* ---- Scroll Reveal (added by JS) ---- */
@media (prefers-reduced-motion: no-preference) {
    .reveal {
        opacity: 0;
        transform: translateY(26px);
        transition: opacity 0.65s cubic-bezier(.4,0,.2,1),
                    transform 0.65s cubic-bezier(.4,0,.2,1);
    }
    .reveal.is-visible {
        opacity: 1;
        transform: translateY(0);
    }
    .reveal.delay-1 { transition-delay: 0.07s; }
    .reveal.delay-2 { transition-delay: 0.14s; }
    .reveal.delay-3 { transition-delay: 0.21s; }
    .reveal.delay-4 { transition-delay: 0.28s; }
    .reveal.delay-5 { transition-delay: 0.35s; }
    .reveal.delay-6 { transition-delay: 0.42s; }
    .reveal.delay-7 { transition-delay: 0.49s; }
    .reveal.delay-8 { transition-delay: 0.56s; }
    .reveal.delay-9 { transition-delay: 0.63s; }
}

/* ============================================
   Global Selection
   ============================================ */
/* Global Selection */
::selection {
    background-color: #3B82F6;
    color: #ffffff;
}

/* ---- Tech Grid Background ---- */
.tech-grid {
    background-size: 40px 40px;
    background-image:
        linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
}

/* ---- Glass Navigation ---- */
.glass-nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* ---- Hover Lift Card Effect ---- */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

/* ---- Hide Scrollbar (Carousel) ---- */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ---- Ping Animation (Hero Badge) ---- */
@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}
.animate-ping {
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ---- Gradient Text ---- */
.gradient-text {
    background: linear-gradient(to right, #0F172A, #3B82F6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Case Carousel Controls (hover reveal) ---- */
.carousel-wrapper:hover .carousel-btn {
    opacity: 1;
}
.carousel-btn {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* ---- FAQ Accordion ---- */
.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.faq-content.is-open {
    max-height: 600px;
}

/* ---- Responsive Typography ---- */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
}

/* ---- Hero Carousel ---- */
.hero-carousel {
    background-color: #0F172A;
}

.hero-carousel--fullscreen {
    width: 100%;
    margin-top: 0;
    overflow: hidden;
}

.hero-carousel__viewport {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
}

.hero-carousel__track {
    position: relative;
    width: 100%;
    aspect-ratio: 1920/800;
    overflow: hidden;
    background: #E2E8F0;
}

.hero-carousel__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.hero-carousel__slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.hero-carousel__link {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-carousel__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.hero-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.88);
    color: #334155;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hero-carousel__arrow:hover {
    background: #0F172A;
    color: #fff;
    border-color: #0F172A;
}

.hero-carousel__arrow--prev { left: 1.5rem; }
.hero-carousel__arrow--next { right: 1.5rem; }

.hero-carousel__dots {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
}

.hero-carousel__dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 9999px;
    border: none;
    padding: 0;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.hero-carousel__dot.is-active {
    background: #fff;
    transform: scale(1.25);
}

@media (max-width: 768px) {
    .hero-carousel__arrow {
        width: 2.25rem;
        height: 2.25rem;
    }

    .hero-carousel__arrow--prev { left: 0.75rem; }
    .hero-carousel__arrow--next { right: 0.75rem; }

    .hero-carousel__dots {
        bottom: 1rem;
    }
}


/* ============================================
   Component Classes
   ============================================ */

/* ---- Section Header ---- */
.section-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 1rem;
}
.section-divider {
    width: 3rem;
    height: 0.25rem;
    background-color: #3B82F6;
    margin-left: auto;
    margin-right: auto;
    border-radius: 9999px;
}
.section-desc {
    color: #64748B;
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Body Text ---- */
.body-text {
    color: #64748B;
    line-height: 1.75;
}

/* ---- Card ---- */
.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 0.75rem;
    line-height: 1.75rem;
}
.card-title-sm {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 0.5rem;
    line-height: 1.75rem;
}
.card-title a,
.card-title-sm a {
    transition: color 0.15s ease;
}
.card-title a:hover,
.card-title-sm a:hover {
    color: #3B82F6;
}
.card-cat {
    font-size: 0.75rem;
    color: #3B82F6;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}
.card-excerpt {
    color: #64748B;
    font-size: 0.875rem;
    line-height: 1.5rem;
}
.card-desc {
    color: #64748B;
    font-size: 0.875rem;
    line-height: 1.75;
}

/* ---- Services Grid (mobile 2-col) ---- */
.services-grid .services-card-title {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.services-grid .card-desc {
    font-size: 0.8125rem;
    line-height: 1.6;
}

@media (min-width: 640px) {
    .services-grid .services-card-title {
        font-size: 1.25rem;
        line-height: 1.75rem;
        margin-bottom: 0.75rem;
    }

    .services-grid .card-desc {
        font-size: 0.875rem;
        line-height: 1.75;
    }
}
.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #3B82F6;
    transition: color 0.15s ease;
}
.card-link:hover {
    color: #0F172A;
}

/* ---- Buttons ---- */
.btn-primary {
    display: inline-block;
    background-color: #0F172A;
    color: #fff;
    padding: 0.875rem 2rem;
    border-radius: 9999px;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    transition: background-color 0.15s ease;
}
.btn-primary:hover { background-color: #1E293B; color: #fff; }

.btn-primary-sm {
    display: inline-block;
    background-color: #0F172A;
    color: #fff;
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: background-color 0.15s ease;
}
.btn-primary-sm:hover { background-color: #1E293B; color: #fff; }

.btn-secondary {
    display: inline-block;
    background-color: #fff;
    color: #0F172A;
    border: 1px solid #E2E8F0;
    padding: 0.875rem 2rem;
    border-radius: 9999px;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover {
    background-color: #F8FAFC;
    border-color: #CBD5E1;
}

/* ---- Nav / Footer Links ---- */
.nav-link {
    transition: color 0.15s ease;
}
.nav-link:hover { color: #3B82F6; }

/* ---- Primary Navigation Dropdown ---- */
#desktop-nav .primary-menu > .menu-item {
    position: relative;
}

#desktop-nav .menu-item-has-children::after {
    content: '';
    position: absolute;
    left: -0.5rem;
    right: -0.5rem;
    top: 100%;
    height: 0.75rem;
}

#desktop-nav .primary-menu > .menu-item > a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0;
    transition: color 0.15s ease;
}

#desktop-nav .primary-menu > .menu-item > a:hover {
    color: #3B82F6;
}

#desktop-nav .menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 0.125rem;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.55;
    transition: transform 0.2s ease;
}

#desktop-nav .menu-item-has-children:hover > a::after,
#desktop-nav .menu-item-has-children:focus-within > a::after,
#desktop-nav .menu-item-has-children.is-dropdown-open > a::after {
    transform: rotate(180deg);
}

#desktop-nav .sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 22rem;
    max-width: 26rem;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 60;
    list-style: none;
}

#desktop-nav .menu-item-has-children:hover > .sub-menu,
#desktop-nav .menu-item-has-children:focus-within > .sub-menu,
#desktop-nav .menu-item-has-children.is-dropdown-open > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#desktop-nav .sub-menu .menu-item {
    margin: 0;
}

#desktop-nav .sub-menu .menu-item a {
    display: block;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #475569;
    border-radius: 0.5rem;
    white-space: normal;
    transition: color 0.15s ease, background-color 0.15s ease;
}

#desktop-nav .sub-menu .menu-item a:hover {
    color: #3B82F6;
    background-color: #F8FAFC;
}

/* ---- Mobile Navigation Submenu ---- */
#mobile-menu .mobile-menu > .menu-item {
    border-bottom: 1px solid #F1F5F9;
}

#mobile-menu .mobile-menu > .menu-item:last-child {
    border-bottom: none;
}

#mobile-menu .menu-item-has-children > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 0;
    color: #334155;
}

#mobile-menu .menu-item-has-children > a::after {
    content: '';
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #94A3B8;
    transition: transform 0.2s ease;
}

#mobile-menu .menu-item-has-children.is-open > a::after {
    transform: rotate(180deg);
}

#mobile-menu .menu-item:not(.menu-item-has-children) > a {
    display: block;
    padding: 0.75rem 0;
    color: #334155;
}

#mobile-menu .sub-menu {
    display: none;
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0 0 0.75rem 0.75rem;
    border-left: 2px solid #EFF6FF;
}

#mobile-menu .menu-item-has-children.is-open > .sub-menu {
    display: block;
}

#mobile-menu .sub-menu .menu-item a {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #64748B;
}

#mobile-menu .sub-menu .menu-item a:hover {
    color: #3B82F6;
}

/* ---- Link More (underline + arrow) ---- */
.link-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #0F172A;
    font-weight: 600;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #0F172A;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.link-more:hover {
    color: #3B82F6;
    border-color: #3B82F6;
}

/* ---- Footer ---- */
.site-footer {
    width: 100%;
}

.site-footer__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
}

/* Align with Tailwind max-w-7xl override (1440px) */
.max-w-7xl {
    max-width: 1440px;
}

.footer-heading {
    color: #0F172A;
    font-weight: 700;
    margin-bottom: 0;
    font-size: 0.875rem;
}

.footer-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
    padding: 0.75rem 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.footer-accordion-icon {
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.footer-accordion-item.is-open .footer-accordion-icon {
    transform: rotate(180deg);
}

@media (max-width: 767px) {
    .site-footer__grid {
        gap: 0;
    }

    .footer-accordion-panel {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .footer-accordion-item.is-open .footer-accordion-panel {
        max-height: 1200px;
    }

    .footer-accordion-item.is-open .footer-accordion-toggle {
        padding-bottom: 0.25rem;
    }
}

@media (min-width: 768px) {
    .footer-heading {
        margin-bottom: 1.75rem;
    }

    .footer-accordion-toggle {
        display: block;
        padding: 0;
        cursor: default;
    }

    .footer-accordion-panel {
        max-height: none !important;
        overflow: visible;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .site-footer__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 2.5rem;
        row-gap: 2.5rem;
    }

    .site-footer__brand {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1024px) {
    .site-footer__grid {
        grid-template-columns: 220px repeat(4, minmax(0, 1fr));
        column-gap: 3.5rem;
        row-gap: 2.5rem;
    }

    .site-footer__brand {
        grid-column: auto;
    }
}

/* ============================================
   Article Content Prose
   ============================================ */
.article-content {
    color: #334155;
    line-height: 1.9;
    font-size: 1rem;
    word-break: break-word;
    overflow-wrap: break-word;
}
.article-content > * + * { margin-top: 1.5rem; }

.article-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0F172A;
    margin-top: 2.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 2px solid #EFF6FF;
    line-height: 1.4;
}
.article-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0F172A;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}
.article-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1E293B;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}
.article-content p { margin-bottom: 1.5rem; }

.article-content ul,
.article-content ol {
    padding-left: 1.625rem;
    margin-bottom: 1.5rem;
}
.article-content ul { list-style-type: disc; }
.article-content ol { list-style-type: decimal; }
.article-content li { margin-bottom: 0.5rem; }
.article-content li > ul,
.article-content li > ol { margin-top: 0.5rem; margin-bottom: 0; }

.article-content blockquote {
    border-left: 4px solid #3B82F6;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: #EFF6FF;
    border-radius: 0 0.75rem 0.75rem 0;
    color: #475569;
    font-style: italic;
}
.article-content blockquote p { margin-bottom: 0; }

.article-content a {
    color: #3B82F6;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}
.article-content a:hover { color: #0F172A; }

.article-content img {
    border-radius: 0.75rem;
    max-width: 100%;
    height: auto;
    margin: 2rem auto;
    display: block;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
}

.article-content code {
    background: #F1F5F9;
    color: #0F172A;
    padding: 0.15em 0.4em;
    border-radius: 0.3rem;
    font-size: 0.875em;
    font-family: 'Fira Code', 'Courier New', monospace;
}
.article-content pre {
    background: #0F172A;
    color: #E2E8F0;
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.75;
    margin: 2rem 0;
}
.article-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.9rem;
    border-radius: 0.75rem;
    overflow: hidden;
}
.article-content th {
    background: #F8FAFC;
    font-weight: 600;
    color: #0F172A;
    padding: 0.75rem 1rem;
    border: 1px solid #E2E8F0;
    text-align: left;
}
.article-content td {
    padding: 0.75rem 1rem;
    border: 1px solid #E2E8F0;
    color: #475569;
}
.article-content tr:nth-child(even) td { background: #F8FAFC; }

.article-content hr {
    border: none;
    border-top: 1px solid #E2E8F0;
    margin: 2.5rem 0;
}

/* ---- TOC Sidebar ---- */
.toc-link {
    display: block;
    font-size: 0.8125rem;
    color: #64748B;
    padding: 0.3rem 0.625rem;
    border-left: 2px solid transparent;
    line-height: 1.4;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.toc-link:hover,
.toc-link.is-active {
    color: #3B82F6;
    border-left-color: #3B82F6;
}
.toc-link.toc-h3 { padding-left: 1.25rem; }

/* ---- Sidebar Navigation ---- */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748B;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.sidebar-link:hover {
    color: #0F172A;
    background-color: #F8FAFC;
}
.sidebar-link.is-active {
    color: #3B82F6;
    background-color: #EFF6FF;
    font-weight: 600;
}

/* 1. 抬升整个 header 层级，必须高于轮播 */
#site-header {
  position: relative;   /* sticky/fixed 也可以，但要有 position */
  z-index: 1000;
}

/* 2. 导航容器也设一层，避免被 header 内部其它元素影响 */
#desktop-nav {
  position: relative;
  z-index: 1001;
}

/* 3. 有下拉的 li 作为定位参照 */
#menu-main > li {
  position: relative;
}

/* 4. 下拉菜单本身 */
#menu-main .sub-menu,
#desktop-nav .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1002;
  /* 可选：保证可读性 */
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* 5. 压低轮播/首屏 hero 层级（按实际类名改） */
.hero-slider,
.swiper,
.swiper-container,
.elementor-widget-slides,
.elementor-slides-wrapper,
.carousel,
.banner-slider {
  position: relative;
  z-index: 1 !important;   /* 仅调试时可加 !important */
}
