/**
 * TSW Components — Cards, Shared UI Elements
 *
 * @package TSW
 * @since   1.0.0
 */

/* ══════════════════════════════════════════════════════════
 *  TEXT CLAMP UTILITIES
 *
 *  CSS-level safety net: even if PHP truncation is missed,
 *  these classes prevent any text from breaking card grids.
 *  Pair with tsw_card_title(), tsw_card_excerpt(), etc.
 * ══════════════════════════════════════════════════════════ */

/* Line-clamp: restrict visible lines with ellipsis */
.tsw-clamp-1,
.tsw-clamp-2,
.tsw-clamp-3,
.tsw-clamp-4 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tsw-clamp-1 { -webkit-line-clamp: 1; }
.tsw-clamp-2 { -webkit-line-clamp: 2; }
.tsw-clamp-3 { -webkit-line-clamp: 3; }
.tsw-clamp-4 { -webkit-line-clamp: 4; }

/* Single-line truncate (inline text) */
.tsw-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Fixed-height blocks for card grids — guarantees uniform card sizing */
.tsw-fixed-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 2.4em;       /* 2 lines × 1.2 line-height */
    line-height: 1.2;
}

.tsw-fixed-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    min-height: 4.2em;       /* 3 lines × 1.4 line-height */
    line-height: 1.4;
}

.tsw-fixed-tagline {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
    min-height: 1.3em;
    line-height: 1.3;
}

/* Google Translate: protect brand names from translation */
.notranslate {
    /* class is enough — Google Translate detects it */
}

/* Word-break safety for long URLs or technical strings */
.tsw-break-word {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}


/* ══════════════════════════════════════════════════════════
 *  BLOG CARD
 * ══════════════════════════════════════════════════════════ */
.tsw-blog-card {
    background: var(--ts-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}
.tsw-blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.tsw-blog-card__thumb {
    display: block;
    overflow: hidden;
    aspect-ratio: 3 / 2;
}
.tsw-blog-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}
.tsw-blog-card:hover .tsw-blog-card__thumb img {
    transform: scale(1.05);
}
.tsw-blog-card__body {
    padding: var(--space-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}
.tsw-blog-card__cat {
    display: inline-block;
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ts-green);
    margin-bottom: var(--space-sm);
}
.tsw-blog-card__title {
    font-size: var(--fs-lg);
    margin-bottom: var(--space-sm);
}
.tsw-blog-card__title a {
    color: var(--ts-ink);
}
.tsw-blog-card__title a:hover {
    color: var(--ts-green);
}
.tsw-blog-card__excerpt {
    font-size: var(--fs-sm);
    color: var(--ts-mist);
    flex: 1;
    margin-bottom: var(--space-md);
}
.tsw-blog-card__meta {
    display: flex;
    gap: var(--space-lg);
    font-size: var(--fs-xs);
    color: var(--ts-mist);
    margin-top: auto;
    padding-top: var(--space-md);
    border-top: var(--border-light);
}
.tsw-blog-card__meta i {
    margin-right: 4px;
}


/* ══════════════════════════════════════════════════════════
 *  POST TAGS
 * ══════════════════════════════════════════════════════════ */
.tsw-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}
.tsw-post-tags > i {
    color: var(--ts-mist);
}
.tsw-tag {
    display: inline-block;
    padding: 4px 12px;
    background: var(--ts-cloud);
    color: var(--ts-slate);
    font-size: var(--fs-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}
.tsw-tag:hover {
    background: var(--ts-green);
    color: var(--ts-white);
}


/* ══════════════════════════════════════════════════════════
 *  POST META (single post)
 * ══════════════════════════════════════════════════════════ */
.tsw-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    font-size: var(--fs-sm);
    color: var(--ts-mist);
}
.tsw-post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ══════════════════════════════════════════════════════════
 *  WIDGET: Quick Contact Card
 * ══════════════════════════════════════════════════════════ */
.tsw-qc-card {
    background: var(--ts-cloud);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    border: var(--border-light);
}
.tsw-qc-card__title {
    font-size: var(--fs-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--ts-ink);
}
.tsw-qc-card__text {
    font-size: var(--fs-sm);
    color: var(--ts-mist);
    margin-bottom: var(--space-lg);
}
.tsw-qc-card__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--fs-sm);
    margin-bottom: var(--space-md);
}
.tsw-qc-card__item i {
    color: var(--ts-green);
    font-size: 1.1rem;
}
.tsw-qc-card__item a {
    color: var(--ts-slate);
}
.tsw-qc-card__item a:hover {
    color: var(--ts-green);
}
.tsw-qc-card__btn {
    width: 100%;
    justify-content: center;
    margin-top: var(--space-md);
}


/* ══════════════════════════════════════════════════════════
 *  WIDGET: Recent Posts (sidebar)
 * ══════════════════════════════════════════════════════════ */
.tsw-recent-posts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tsw-recent-posts-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: var(--border-light);
}
.tsw-recent-posts-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.tsw-recent-posts-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.tsw-recent-posts-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tsw-recent-posts-info {
    flex: 1;
    min-width: 0;
}
.tsw-recent-posts-title {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--ts-ink);
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.tsw-recent-posts-title:hover {
    color: var(--ts-green);
}
.tsw-recent-posts-date {
    font-size: var(--fs-xs);
    color: var(--ts-mist);
}
.tsw-recent-posts-date i {
    margin-right: 4px;
}


/* ══════════════════════════════════════════════════════════
 *  WIDGET: Services List (sidebar)
 * ══════════════════════════════════════════════════════════ */
.tsw-services-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.tsw-services-list li {
    border-bottom: var(--border-light);
}
.tsw-services-list li:last-child {
    border-bottom: none;
}
.tsw-services-list a {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 0;
    font-size: var(--fs-sm);
    color: var(--ts-slate);
    transition: all var(--transition-fast);
}
.tsw-services-list a:hover {
    color: var(--ts-green);
    padding-left: 6px;
}
.tsw-services-list li.active a {
    color: var(--ts-green);
    font-weight: 600;
}
.tsw-services-list a i {
    color: var(--ts-green);
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}


/* ══════════════════════════════════════════════════════════
 *  SIDEBAR WIDGET SHARED STYLES
 * ══════════════════════════════════════════════════════════ */
.tsw-sidebar-widget {
    margin-bottom: var(--space-xl);
}
.tsw-sidebar-widget__title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--ts-ink);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--ts-green);
}

.tsw-service-widget {
    margin-bottom: var(--space-xl);
}
.tsw-service-widget__title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--ts-ink);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--ts-green);
}

.tsw-legal-widget {
    margin-bottom: var(--space-xl);
}
.tsw-legal-widget__title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--ts-ink);
    padding-bottom: var(--space-md);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--ts-green);
}


/* ══════════════════════════════════════════════════════════
 *  BACK TO TOP BUTTON
 * ══════════════════════════════════════════════════════════ */
.tsw-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ts-green);
    color: var(--ts-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition);
    z-index: var(--z-dropdown);
    box-shadow: var(--shadow-md);
}
.tsw-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.tsw-back-to-top:hover {
    background: var(--ts-green-dark);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Move back-to-top when popup trigger exists */
.has-popup .tsw-back-to-top {
    bottom: 90px;
}


/* Shared buttons now unified in theme.css: .tsw-btn-primary / .tsw-btn-outline + .tsw-dark-cta */
