/*
 * 外链优 Theme Custom Styles
 * @package Wailian_You
 * @since 1.0.0
 */

/* ============================================
 * Base & Reset
 * ============================================ */
* {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
 * Shadow Utilities
 * ============================================ */
.card-shadow {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.text-shadow-sm {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============================================
 * Modal
 * ============================================ */
.modal-mask {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-mask.hidden {
    display: none !important;
}

/* Modal Animations */
@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-fade-in {
    animation: modalFadeIn 0.3s ease-out;
}

.modal-fade-out {
    animation: modalFadeOut 0.3s ease-out;
}

/* ============================================
 * Line Clamp
 * ============================================ */
.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;
}

/* ============================================
 * Pagination
 * ============================================ */
.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.page-numbers:hover {
    background-color: #eff6ff;
    color: #2563eb;
}

.page-numbers.current {
    background-color: #2563eb;
    color: #ffffff;
}

.page-numbers .fas {
    font-size: 12px;
}

/* ============================================
 * WP Core Styles
 * ============================================ */
.wp-caption {
    max-width: 100%;
}

.wp-caption-text {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    padding: 8px 0;
}

.aligncenter {
    text-align: center;
}

.alignleft {
    float: left;
    margin-right: 20px;
}

.alignright {
    float: right;
    margin-left: 20px;
}

.sticky {
    /* sticky post style */
}

.gallery-caption {
    font-size: 13px;
    color: #64748b;
}

.bypostauthor .comment-author {
    font-weight: 700;
}

/* ============================================
 * Comment Styles
 * ============================================ */
.comment-list {
    list-style: none;
    padding: 0;
}

.comment-list .children {
    list-style: none;
    padding-left: 40px;
}

.comment-body {
    padding: 16px 0;
    border-bottom: 1px solid #e2e8f0;
}

.comment-author .avatar {
    border-radius: 50%;
    float: left;
    margin-right: 12px;
}

.comment-author .fn {
    font-style: normal;
    font-weight: 600;
    color: #1e293b;
}

.comment-metadata {
    font-size: 13px;
    color: #94a3b8;
    margin-bottom: 8px;
}

.comment-content {
    color: #475569;
    line-height: 1.7;
    margin-top: 8px;
}

.reply {
    margin-top: 8px;
}

.reply a {
    color: #2563eb;
    font-size: 13px;
    text-decoration: none;
}

.reply a:hover {
    text-decoration: underline;
}

.comment-respond {
    margin-top: 24px;
}

.comment-form label {
    display: block;
    font-weight: 500;
    color: #334155;
    margin-bottom: 4px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.comment-form .form-submit input {
    background-color: #2563eb;
    color: #fff;
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.comment-form .form-submit input:hover {
    background-color: #1e40af;
}

/* ============================================
 * Custom Logo
 * ============================================ */
.custom-logo-link img {
    max-height: 40px;
    width: auto;
}

/* ============================================
 * Responsive — Mobile-First
 * ============================================ */

/* Small devices (phones, <640px) */
@media (max-width: 639px) {
    /* Hero sections */
    .hero-title {
        font-size: 1.75rem !important;
    }

    /* Filter grid: stack all items */
    #filter-section .grid {
        grid-template-columns: 1fr !important;
    }

    /* Filter buttons: full width on mobile */
    #filter-section .flex-wrap.gap-3 {
        flex-direction: column;
    }
    #filter-section .flex-wrap.gap-3 button {
        width: 100%;
        justify-content: center;
    }

    /* Results table: horizontal scroll */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    /* Stats + sort: stack vertically */
    .flex.flex-col.sm\\:flex-row.items-start.sm\\:items-center.justify-between {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Pagination buttons: smaller */
    .page-btn,
    .page-numbers {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    /* Table cells: tighter padding */
    .w-full th,
    .w-full td {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Card grids: single column */
    .grid-cols-1\\.5,
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }

    /* Font sizes */
    h1.text-\[clamp\(2rem\,5vw\,3\.5rem\)\] {
        font-size: 1.75rem !important;
    }
    .text-3xl {
        font-size: 1.5rem !important;
    }
    .text-2xl {
        font-size: 1.25rem !important;
    }

    /* Padding adjustments */
    .py-16 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Cards: reduce padding */
    .p-8 {
        padding: 1.25rem !important;
    }
    .p-6 {
        padding: 1rem !important;
    }

    /* Service process: smaller circles */
    .w-16.h-16 {
        width: 48px !important;
        height: 48px !important;
    }

    /* Case study charts */
    .h-\[250px\],
    .h-\[280px\] {
        height: 200px !important;
    }

    /* Contact form: stack */
    .grid-cols-1\\.5,
    .md\\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Medium devices (tablets, 640px-1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    /* Filter grid: 2 columns */
    #filter-section .grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Card grids: 2 columns */
    .lg\\:grid-cols-3,
    .lg\\:grid-cols-4 {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Blog sidebar: full width */
    .lg\\:w-80 {
        width: 100% !important;
    }
}

/* Tables: ensure horizontal scroll on small screens */
.w-full table {
    min-width: 600px;
}

/* Fix for mobile nav */
@media (max-width: 767px) {
    .md\\:hidden {
        display: block !important;
    }
    .md\\:flex {
        display: none !important;
    }
}

/* ============================================
 * Mobile Menu — slide in from right
 * ============================================ */
.mobile-menu-mask {
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    -webkit-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
}
.mobile-menu-mask.hidden {
    display: none;
}
.mobile-menu-mask.is-open {
    opacity: 1;
}

.mobile-menu-panel {
    -webkit-transform: translateX(100%);
    transform: translateX(100%);
    -webkit-transition: -webkit-transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}
.mobile-menu-mask.is-open .mobile-menu-panel {
    -webkit-transform: translateX(0);
    transform: translateX(0);
}

/* Mobile menu nav items */
.mobile-menu-panel nav a {
    display: block;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    color: #475569;
    -webkit-transition: background-color 0.15s ease, color 0.15s ease;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.mobile-menu-panel nav a:hover {
    background-color: #f1f5f9;
    color: #2563eb;
}
.mobile-menu-panel nav a.text-primary,
.mobile-menu-panel nav a.current-menu-item {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

/* ============================================
 * Favorites Modal
 * ============================================ */
#favorites-modal-mask {
    -webkit-transition: opacity 0.2s ease;
    transition: opacity 0.2s ease;
}
#favorites-modal-mask.hidden {
    display: none !important;
}
#favorites-modal {
    -webkit-animation: modalFadeIn 0.2s ease-out;
    animation: modalFadeIn 0.2s ease-out;
}
#favorites-list::-webkit-scrollbar {
    width: 4px;
}
#favorites-list::-webkit-scrollbar-track {
    background: transparent;
}
#favorites-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}
.remove-fav-btn {
    opacity: 0.6;
    -webkit-transition: opacity 0.15s ease;
    transition: opacity 0.15s ease;
}
.remove-fav-btn:hover {
    opacity: 1;
}

/* Toast notification */
.wailian-toast {
    pointer-events: none;
    z-index: 9999;
}

/* Favorites button badge alignment */
#favorites-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Tailwind nav-h spacing override for mobile */
@media (max-width: 639px) {
    .pt-nav-h {
        padding-top: 56px !important;
    }
}

/* ============================================
 * Selection
 * ============================================ */
::selection {
    background-color: rgba(37, 99, 235, 0.2);
}

/* ============================================
 * Scrollbar
 * ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}