@tailwind base;
@tailwind components;
@tailwind utilities;

/* 字体加载优化：确保所有字体使用 swap 策略，避免阻塞渲染 */
@font-face {
    font-family: 'Barlow Condensed';
    font-display: swap; /* 字体加载时立即显示后备字体，加载完成后切换 */
}

body {
    @apply text-gray-700;
    box-sizing: border-box !important;
    font-family: 'Barlow Condensed', sans-serif;
}

/* 设置最外层 #__nuxt 元素的样式 */
#__nuxt {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

/* Headings with Barlow Condensed */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
}
p,span {
    font-weight: 400;
}

/* Leafly Packaging CSS Variables */
:root {
    /* Brand Colors */
    --primary-color: #00a651;
    --secondary-color: #f9a51a;
    --green-500: #059669;
    --green-600: #059669;
    --green-700: #047857;
    --green-800: #065f46;
    --green-50: #f0fdf4;

    /* Gray Scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Neutral Colors */
    --text-color: #333;
    --light-gray: #f4f4f4;
    --white: #fff;
    --black: #000;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Z-index */
    --z-dropdown: 50;
    --z-sticky: 40;
    --z-fixed: 100;
    --z-modal: 1000;
}

/* 无障碍优化：提高对比度，符合 WCAG 2.1 AA 标准 (4.5:1) */
/* Tailwind 的 green-600 (#059669) 对比度不足，使用更深的绿色 */
.text-green-600 {
    color: #047857 !important; /* green-700，对比度约 4.6:1 */
}

.hover\:text-green-700:hover {
    color: #065f46 !important; /* green-800，对比度更高 */
    font-weight: 600;
}

/* Tailwind 的 gray-600 (#4b5563) 对比度约 7:1，符合标准，但可以稍微加深以提供更好的可读性 */
.text-gray-600 {
    color: #374151 !important; /* gray-700，对比度约 10:1 */
}

.hover\:text-gray-800:hover {
    color: #1f2937 !important; /* gray-800 */
}

/* 确保链接在白色背景上有足够的对比度 */
a.text-green-600,
.text-green-600 a {
    color: #047857 !important;
}

/* 针对特定的按钮和链接样式 */
.font-weight-600.text-green-600 {
    color: #047857 !important;
}



.font-weight-400 {
    font-weight: 400;
}


.font-weight-600 {
    font-weight: 600;
}


/* 通用样式 */
.leafly-btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    text-align: center;
    transition: all 0.3s ease;
}
.leafly-btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: 1px solid var(--primary-color);
}
.leafly-btn-primary :hover {
    background-color: var(--white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.leafly-btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
    border: 1px solid var(--secondary-color);
}
.leafly-btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}


.category-banner {
    background-size: cover;
    background-position: center;
    width: 100%;
    height:450px;
    @media screen and (max-width: 1920px) {
        height:420px;
    }
    
}
/* 首页的section头部文字样式 */
.leafly-section {
    padding: 60px 0;
}
.leafly-section-title {
    font-size: 1.75rem;
    font-weight: 600;
    position: relative;
}
.leafly-section-second-title {
    font-size:1.25rem;
    font-weight: 400;
    position: relative;
    margin-top:-6px
}
@media (max-width: 768px) {
    .leafly-section {
        padding: 40px 0;
    }
    .leafly-section-title {
        font-size: 28px;
        line-height: 28px;
    }
    .leafly-section-second-title{
        margin-top:8px;
        line-height: 22px;
    }
}

/* 每个页面category产品列表文字样式 */
.leafly-article-item-title {
    font-size: 1.25rem;
}

.leafly-article-item-content{
    font-size: 1.05rem;
    line-height:1.45rem;
}

/* 每个页面头部的字体的样式 */
.leafly-page-title {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1;
    color:white;
}
.leafly-page-second-title {
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    color: white;
    margin-top: 1rem;
}

/* 这个就是文章的样式 */
.article-content-detail {
    img{
        margin: 0 auto;
        max-width:100%;
        margin-top: 8px;
        margin-bottom: 8px;
    }
    p {
        font-size:18px !important;
        /* 行首两个空格缩进 */
        text-indent: 2em; 
        font-weight: 400;
    }
    h2 {
        margin-top:24px !important;
        color:#059669 !important;
        font-size:24px !important;
        font-weight: 600;
    }

    h3 {
        margin-top:12px !important;
        font-size:20px !important;
        font-weight: 600;
    }
    h4{
        font-size:22px;
        margin-top:12px;
    }
    h5 {
        font-size:18px;
        margin-top:8px;
    }

    ul{
        li{
            padding-left:3rem;
            p{
                position: relative;
                margin-bottom: 0px !important;
                /* 列表中的段落不缩进 */
                text-indent: 0; 
                &::before {
                    content: "  · ";
                    position: absolute;
                    left: -16px;
                    color: #4CAF50;
                    font-weight: bold;
                    font-size:20px;
                    margin-top:-4px;
                }
            }

        }
    }
    table {
        width:97%;
        margin-left:3%;
        margin-top:8px;
        tr{
            text-align: left;
        }
        td{
            padding: 2px 4px;
        }
        thead{
            tr{
                border-bottom: 2px solid #aaa;
            }
        }
        tbody{
            tr{
                border-bottom: 1px solid #eee;
            }
        }
    }
    b, strong{
        font-weight: bold;
        span {
            font-weight: bold;
        }
    }
}

/* 全局容器 */
#main-content {
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: visible; /* 确保垂直方向的 sticky 效果正常工作 */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 全局输入框样式 */
#main-content input {
    border-color: #059669 !important;
}   
.edui-video-video{
    margin: 0 auto;
}


/*分享插件的样式*/
.share-item {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 仅显示平台图标，隐藏文字 - 在 main.css 中不能使用 :deep()，直接使用后代选择器 */
.share-item .social-share__label,
.share-item .social-share-button__label {
    display: none !important;
}

.share-item button,
.share-item a {
    width: 44px !important;
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    gap: 0 !important;
    padding: 10px !important;
    font-size: 0 !important;
    /* 隐藏文字 */
}

.share-item svg {
    width: 20px !important;
    height: 20px !important;
}

/* 针对 styled 模式的样式 */
.social-share-button--styled .social-share-button__label {
    display: none !important;
}

@media (max-width: 768px) {
    .share-widget {
        bottom: 8px;
        right: 16px;
    }

    .share-button {
        width: 52px;
        height: 52px;
    }

    .share-panel {
        bottom: 68px;
    }
}

/* ========== Utility Classes ========== */

/* Text Utilities */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.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;
}

/* Flex Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Button Utilities */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: background-color var(--transition-base);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--green-600);
    color: var(--white);

    &:hover {
        background-color: var(--green-700);
    }
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-700);

    &:hover {
        background-color: var(--gray-300);
    }
}

/* Card Utilities */
.card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-slow);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* Input Utilities */
.input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-full);
    outline: none;
    font-size: 1rem;
    color: var(--gray-700);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);

    &:focus {
        border-color: var(--green-600);
        box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
    }
}

/* Navigation Utilities */
.nav-link {
    position: relative;
    color: var(--gray-800);
    text-decoration: none;
    transition: color var(--transition-fast);

    &:hover {
        color: var(--green-600);
    }
}

/* Animation Utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

.animate-slide-down {
    animation: slideDown 0.3s ease-out;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
