/**
 * HSM Archive Shared Styles
 * Common CSS variables, post card grid, pagination, and animations
 * Used by both category.php and tag.php templates.
 *
 * @package HelloBizChild
 * @since   1.1.0
 */

/* =============================================================================
   CSS VARIABLES (Design Tokens)
   ============================================================================= */

:root {
    --hsm-display: 'Playfair Display', Georgia, serif;
    --hsm-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --hsm-blue: #4A8FE7;
    --hsm-blue-dark: #3A7BD5;
    --hsm-blue-pale: #F0F7FF;
    --hsm-blue-glow: rgba(74, 143, 231, 0.2);
    --hsm-ink: #2D3748;
    --hsm-ink-light: #4A5568;
    --hsm-ink-muted: #718096;
    --hsm-silk: #F7FAFC;
    --hsm-line: #E2E8F0;
    --hsm-white: #FFFFFF;
    --hsm-shadow-soft: 0 2px 12px rgba(0,0,0,0.06);
    --hsm-shadow-medium: 0 8px 30px rgba(0,0,0,0.08);
    --hsm-shadow-lift: 0 20px 40px rgba(74,143,231,0.15);
    --hsm-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Override Hello Biz parent theme pink (#c36) on all HSM interactive elements.
   Parent sets: button { border: 1px solid #c36; color: #c36 }
                button:hover { background-color: #c36; color: #fff }
   We reset these generics so our component styles take over cleanly. */
.site-main button[class*="hsm-"] {
    background-color: transparent;
    border: none;
    color: inherit;
    border-radius: 0;
}
.site-main button[class*="hsm-"]:hover,
.site-main button[class*="hsm-"]:focus {
    background-color: transparent;
    color: inherit;
}
.site-main summary[class*="hsm-"] {
    list-style: none;
}

/* Override parent theme pink on <a> elements with HSM/HSH classes.
   Parent sets: a { color: #c36; text-decoration: none }
   We use :where() so this reset has near-zero specificity (0,0,1) —
   just enough to beat the parent's `a` rule, but every component
   class easily overrides these defaults. */
:where(.site-main) a:where([class*="hsm-"]),
:where(.site-main) a:where([class*="hsh-"]) {
    color: inherit;
    text-decoration: none;
}
:where(.site-main) a:where([class*="hsm-"]):hover,
:where(.site-main) a:where([class*="hsh-"]):hover {
    color: inherit;
    text-decoration: none;
}

/* Hide theme defaults on archive pages */
.archive-header,
.page-header,
.archive-description,
.taxonomy-description,
.category .page-title,
.tag .page-title,
.archive .page-title,
.term-description {
    display: none !important;
}

body.category,
body.tag {
    background: var(--hsm-white);
}

/* =============================================================================
   BREADCRUMB (shared)
   ============================================================================= */

.hsm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--hsm-ink-muted);
    margin-bottom: 24px;
}

.hsm-breadcrumb a {
    color: var(--hsm-ink-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.hsm-breadcrumb a:hover { color: var(--hsm-blue); }

.hsm-breadcrumb svg {
    width: 14px;
    height: 14px;
    opacity: 0.4;
    flex-shrink: 0;
}

.hsm-breadcrumb span {
    color: var(--hsm-ink);
    font-weight: 500;
}

/* =============================================================================
   TOOLBAR (shared)
   ============================================================================= */

.hsm-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 50px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--hsm-line);
    border-bottom: 1px solid var(--hsm-line);
    font-family: var(--hsm-body);
}

.hsm-toolbar-count {
    font-size: 14px;
    color: var(--hsm-ink-muted);
}

.hsm-toolbar-count strong {
    font-weight: 600;
    color: var(--hsm-ink);
}

.hsm-toolbar-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hsm-toolbar-sort label {
    font-size: 13px;
    color: var(--hsm-ink-muted);
}

.hsm-toolbar-sort select {
    padding: 8px 32px 8px 14px;
    border: 1.5px solid var(--hsm-line);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--hsm-body);
    color: var(--hsm-ink);
    background: var(--hsm-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.hsm-toolbar-sort select:hover {
    border-color: var(--hsm-blue);
}

@media (max-width: 768px) {
    .hsm-toolbar { padding: 14px 16px; }
    .hsm-toolbar-sort { display: none; }
}

/* =============================================================================
   POSTS GRID
   ============================================================================= */

.hsm-posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
    padding: 50px;
    font-family: var(--hsm-body);
}

@media (max-width: 1200px) { .hsm-posts-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
@media (max-width: 900px)  { .hsm-posts-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 40px 24px; } }
@media (max-width: 500px)  { .hsm-posts-grid { grid-template-columns: 1fr; gap: 20px; padding: 30px 16px; } }

/* =============================================================================
   POST CARD
   ============================================================================= */

.hsm-post-card {
    position: relative;
    background: var(--hsm-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--hsm-shadow-soft);
    transition: all 0.4s var(--hsm-ease);
    display: flex;
    flex-direction: column;
}

.hsm-post-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--hsm-shadow-lift);
}

/* Card Image */
.hsm-post-card-image {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
    display: block;
    background: var(--hsm-silk);
    flex-shrink: 0;
}

.hsm-post-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.6s var(--hsm-ease);
}

.hsm-post-card:hover .hsm-post-card-image img {
    transform: scale(1.08);
}

/* Card Title */
.hsm-post-card-title {
    font-family: var(--hsm-display);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    padding: 18px;
    color: var(--hsm-ink);
    background: var(--hsm-white);
}

.hsm-post-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.hsm-post-card:hover .hsm-post-card-title a {
    color: var(--hsm-blue);
}

/* Card Excerpt */
.hsm-post-card-excerpt {
    font-family: var(--hsm-body);
    font-size: 13px;
    line-height: 1.5;
    color: var(--hsm-ink-muted);
    margin: 0;
    padding: 0 18px 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

.hsm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 50px 24px 70px;
    flex-wrap: wrap;
    font-family: var(--hsm-body);
}

.hsm-pagination a,
.hsm-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
    padding: 0 18px;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    color: var(--hsm-ink-light);
    background: var(--hsm-white);
    border: 1.5px solid var(--hsm-line);
    text-decoration: none;
    transition: all 0.25s ease;
}

.hsm-pagination a:hover {
    background: var(--hsm-blue);
    border-color: var(--hsm-blue);
    color: var(--hsm-white);
    transform: translateY(-2px);
}

.hsm-pagination .current {
    background: var(--hsm-blue);
    border-color: var(--hsm-blue);
    color: var(--hsm-white);
}

.hsm-pagination .dots {
    border: none;
    background: transparent;
    min-width: auto;
    padding: 0 8px;
}

/* =============================================================================
   PILL TAGS / SUBCATS (shared)
   ============================================================================= */

.hsm-pills-section {
    padding: 0 50px 40px;
    font-family: var(--hsm-body);
}

.hsm-pills-label {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--hsm-ink-muted);
    margin-bottom: 16px;
}

.hsm-pills-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.hsm-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--hsm-white);
    border: 1.5px solid var(--hsm-line);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--hsm-ink-light);
    text-decoration: none;
    transition: all 0.25s ease;
}

.hsm-pill:hover {
    background: var(--hsm-blue);
    border-color: var(--hsm-blue);
    color: var(--hsm-white);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--hsm-blue-glow);
}

.hsm-pill-count {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--hsm-silk);
    border-radius: 20px;
    color: var(--hsm-ink-muted);
    transition: all 0.25s ease;
}

.hsm-pill:hover .hsm-pill-count {
    background: rgba(255,255,255,0.2);
    color: var(--hsm-white);
}

@media (max-width: 768px) {
    .hsm-pills-section { padding: 0 16px 30px; }
    .hsm-pill { padding: 10px 18px; font-size: 13px; }
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

@keyframes hsmFadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hsm-toolbar  { animation: hsmFadeUp 0.4s var(--hsm-ease) 0.15s both; }

.hsm-post-card {
    opacity: 0;
    animation: hsmFadeUp 0.5s var(--hsm-ease) both;
}

.hsm-post-card:nth-child(1) { animation-delay: 0.1s; }
.hsm-post-card:nth-child(2) { animation-delay: 0.15s; }
.hsm-post-card:nth-child(3) { animation-delay: 0.2s; }
.hsm-post-card:nth-child(4) { animation-delay: 0.25s; }
.hsm-post-card:nth-child(5) { animation-delay: 0.3s; }
.hsm-post-card:nth-child(6) { animation-delay: 0.35s; }
.hsm-post-card:nth-child(7) { animation-delay: 0.4s; }
.hsm-post-card:nth-child(8) { animation-delay: 0.45s; }
.hsm-post-card:nth-child(n+9) { animation-delay: 0.5s; }

/* =============================================================================
   FAQ SECTION (unique per-category Q&A)
   ============================================================================= */

.hsm-faq {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 50px 70px;
    font-family: var(--hsm-body);
    border-top: 1px solid var(--hsm-line);
}

.hsm-faq-title {
    font-family: var(--hsm-display);
    font-size: 28px;
    font-weight: 500;
    color: var(--hsm-ink);
    margin: 0 0 32px;
    text-align: center;
}

.hsm-faq-item {
    border: 1.5px solid var(--hsm-line);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.hsm-faq-item[open] {
    border-color: var(--hsm-blue);
    box-shadow: 0 4px 16px var(--hsm-blue-glow);
}

.hsm-faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    font-size: 16px;
    font-weight: 600;
    color: var(--hsm-ink);
    cursor: pointer;
    list-style: none;
    transition: color 0.2s ease;
}

.hsm-faq-q::-webkit-details-marker { display: none; }

.hsm-faq-q::after {
    content: '+';
    font-size: 22px;
    font-weight: 400;
    color: var(--hsm-ink-muted);
    flex-shrink: 0;
    margin-left: 16px;
    transition: transform 0.3s var(--hsm-ease);
}

.hsm-faq-item[open] .hsm-faq-q::after {
    content: '−';
    color: var(--hsm-blue);
}

.hsm-faq-item[open] .hsm-faq-q {
    color: var(--hsm-blue);
}

.hsm-faq-a {
    padding: 0 24px 20px;
}

.hsm-faq-a p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--hsm-ink-light);
    margin: 0;
}

@media (max-width: 768px) {
    .hsm-faq { padding: 40px 16px 50px; }
    .hsm-faq-title { font-size: 24px; }
    .hsm-faq-q { padding: 16px 18px; font-size: 15px; }
    .hsm-faq-a { padding: 0 18px 16px; }
}

/* =============================================================================
   SUB-THEME FILTER PILLS
   ============================================================================= */

.hsm-themes {
    padding: 0 50px 20px;
    font-family: var(--hsm-body);
    animation: hsmFadeUp 0.4s var(--hsm-ease) 0.12s both;
}

.hsm-themes-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--hsm-ink-muted);
    margin-bottom: 12px;
}

.hsm-themes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hsm-theme-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: var(--hsm-white);
    border: 1.5px solid var(--hsm-line);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--hsm-body);
    color: var(--hsm-ink-light);
    cursor: pointer;
    transition: all 0.25s ease;
}

.hsm-theme-pill:hover {
    border-color: var(--hsm-blue);
    color: var(--hsm-blue);
}

.hsm-theme-pill.active {
    background: var(--hsm-blue);
    border-color: var(--hsm-blue);
    color: var(--hsm-white);
}

@media (max-width: 768px) {
    .hsm-themes { padding: 0 16px 16px; }
    .hsm-theme-pill { padding: 8px 16px; font-size: 13px; }
}
