/* Toursure Article Content Styles */
.toursure-article-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: inherit;
    line-height: 1.8;
    color: #333;
}

.toursure-article-content .article-body {
    font-size: 16px;
}

/* Emoji/Icon Support - แสดงผลขนาดปกติ */
.toursure-article-content img.emoji,
.toursure-article-content .emoji {
    display: inline !important;
    width: 1em !important;
    height: 1em !important;
    margin: 0 0.1em !important;
    vertical-align: -0.1em !important;
    border: none !important;
    box-shadow: none !important;
}

/* Icon Support (FontAwesome, Dashicons, etc.) */
.toursure-article-content i,
.toursure-article-content .dashicons,
.toursure-article-content [class^="icon-"],
.toursure-article-content [class*=" icon-"] {
    display: inline-block;
    vertical-align: middle;
    font-size: inherit;
}

/* Typography */
.toursure-article-content h1 {
    font-size: 2em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #222;
}

.toursure-article-content h2 {
    font-size: 1.5em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #333;
}

.toursure-article-content h3 {
    font-size: 1.25em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #444;
}

.toursure-article-content h4,
.toursure-article-content h5,
.toursure-article-content h6 {
    font-size: 1.1em;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.toursure-article-content p {
    margin-bottom: 1em;
}

/* Images */
.toursure-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 1em auto;
}

.toursure-article-content img.alignleft {
    float: left;
    margin: 0.5em 1em 0.5em 0;
}

.toursure-article-content img.alignright {
    float: right;
    margin: 0.5em 0 0.5em 1em;
}

.toursure-article-content img.aligncenter {
    display: block;
    margin: 1em auto;
}

/* Lists */
.toursure-article-content ul,
.toursure-article-content ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.toursure-article-content li {
    margin-bottom: 0.5em;
}

/* Blockquote */
.toursure-article-content blockquote {
    border-left: 4px solid #0073aa;
    padding: 1em 1.5em;
    margin: 1.5em 0;
    background: #f9f9f9;
    font-style: italic;
    color: #555;
}

/* Links */
.toursure-article-content a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s ease;
}

.toursure-article-content a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Tables */
.toursure-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
}

.toursure-article-content th,
.toursure-article-content td {
    padding: 0.75em;
    border: 1px solid #ddd;
    text-align: left;
}

.toursure-article-content th {
    background: #f5f5f5;
    font-weight: 600;
}

/* Code */
.toursure-article-content pre,
.toursure-article-content code {
    font-family: monospace;
    background: #f5f5f5;
    border-radius: 4px;
}

.toursure-article-content code {
    padding: 0.2em 0.4em;
    font-size: 0.9em;
}

.toursure-article-content pre {
    padding: 1em;
    overflow-x: auto;
    margin: 1.5em 0;
}

/* Figure and Caption */
.toursure-article-content figure {
    margin: 1.5em 0;
}

.toursure-article-content figcaption {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    margin-top: 0.5em;
}

/* Clearfix */
.toursure-article-content::after {
    content: "";
    display: table;
    clear: both;
}

/* ============================================
   Collapsible "Read More" Section - Airbnb Style
   ============================================ */

/* Collapsible Container */
.article-collapsible {
    position: relative;
}

/* Body Wrapper - ควบคุมความสูง */
.article-collapsible .article-body-wrapper {
    position: relative;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* State: Collapsed */
.article-collapsible.is-collapsed .article-body-wrapper {
    max-height: 250px;
}

/* State: Expanded */
.article-collapsible.is-expanded .article-body-wrapper {
    max-height: none;
}

/* Gradient Overlay - Fade Effect */
.article-gradient-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.7) 40%,
        rgba(255, 255, 255, 0.95) 70%,
        rgba(255, 255, 255, 1) 100%
    );
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease-out;
    z-index: 1;
}

.article-collapsible.is-expanded .article-gradient-overlay {
    opacity: 0;
    visibility: hidden;
}

/* Hidden state when content is short */
.article-collapsible.no-collapse .article-gradient-overlay {
    display: none;
}

/* Toggle Button - Airbnb Style */
.article-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    padding: 14px 24px;
    background: transparent;
    border: 1.5px solid #222222;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    color: #222222;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.article-toggle-btn:hover {
    background: #f7f7f7;
    transform: scale(1.01);
}

.article-toggle-btn:active {
    transform: scale(0.99);
    background: #ebebeb;
}

.article-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px #222222;
}

.article-toggle-btn:focus:not(:focus-visible) {
    box-shadow: none;
}

.article-toggle-btn:focus-visible {
    box-shadow: 0 0 0 2px #222222;
}

/* Toggle Icon */
.article-toggle-btn .toggle-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.article-collapsible.is-expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Hide button when content doesn't need collapse */
.article-collapsible.no-collapse .article-toggle-btn {
    display: none;
}

/* ============================================
   Alternative Button Style - Underline Link
   ============================================ */
.article-toggle-btn.style-link {
    border: none;
    background: none;
    padding: 12px 0;
    width: auto;
    margin: 16px 0 0 0;
}

.article-toggle-btn.style-link .toggle-text {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-toggle-btn.style-link:hover {
    background: none;
    transform: none;
}

.article-toggle-btn.style-link:hover .toggle-text {
    text-decoration-thickness: 2px;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 768px) {
    .toursure-article-content {
        padding: 15px;
    }

    .toursure-article-content .article-body {
        font-size: 15px;
    }

    .toursure-article-content h1 {
        font-size: 1.75em;
    }

    .toursure-article-content h2 {
        font-size: 1.35em;
    }

    .toursure-article-content h3 {
        font-size: 1.15em;
    }

    .toursure-article-content img.alignleft,
    .toursure-article-content img.alignright {
        float: none;
        display: block;
        margin: 1em auto;
    }

    .toursure-article-content table {
        display: block;
        overflow-x: auto;
    }

    /* Collapsible Mobile Adjustments */
    .article-collapsible.is-collapsed .article-body-wrapper {
        max-height: 200px;
    }

    .article-gradient-overlay {
        height: 100px;
    }

    .article-toggle-btn {
        padding: 12px 20px;
        font-size: 15px;
        gap: 6px;
    }

    .article-toggle-btn .toggle-icon {
        width: 16px;
        height: 16px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .article-collapsible.is-collapsed .article-body-wrapper {
        max-height: 180px;
    }

    .article-toggle-btn {
        padding: 11px 16px;
        font-size: 14px;
        border-radius: 6px;
    }
}

/* ============================================
   Animation for smooth height transition
   ============================================ */
.article-collapsible .article-body-wrapper {
    will-change: max-height;
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .article-collapsible .article-body-wrapper {
        transition: none;
    }

    .article-gradient-overlay {
        transition: none;
    }

    .article-toggle-btn .toggle-icon {
        transition: none;
    }
}
