/**
 * HairStyleMojo — Hairstyles Hub Page
 * All-categories hub: hero, popular grid, category groups, editorial, CTA.
 *
 * Uses design tokens from design-tokens.css:
 *   --font-display, --font-body
 *   --blue, --blue-dark, --blue-light, --blue-subtle, --blue-pale
 *   --charcoal, --charcoal-mid, --charcoal-light
 *   --gray-100, --gray-200, --gray-300, --white, --border
 *   --shadow-sm, --shadow-md, --shadow-lg
 *   --ease-out, --transition
 *
 * @package HelloBizChild
 * @since   1.4.0
 */

/* =============================================================================
   BASE / CONTAINER
   ============================================================================= */

.hsm-hub {
    font-family: var(--font-body);
    color: var(--charcoal);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.hsm-hub *,
.hsm-hub *::before,
.hsm-hub *::after {
    box-sizing: border-box;
}

.hsm-hub a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.hsm-hub img {
    max-width: 100%;
    height: auto;
    display: block;
}

.hsm-hub .hsm-container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* Section titles — reuse existing patterns */
.hsm-hub .hsm-section-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--charcoal);
    text-align: center;
    margin: 0 0 12px;
    line-height: 1.2;
}

.hsm-hub .hsm-section-desc {
    font-size: 1.125rem;
    color: var(--charcoal-mid);
    text-align: center;
    max-width: 700px;
    margin: 0 auto 48px;
    line-height: 1.6;
}

/* Buttons */
.hsm-hub .hsm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.hsm-hub .hsm-btn--primary {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(74, 143, 231, 0.3);
}

.hsm-hub .hsm-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 143, 231, 0.4);
}

.hsm-hub .hsm-btn--secondary {
    background: var(--white);
    color: var(--blue);
    border: 2px solid var(--blue);
}

.hsm-hub .hsm-btn--secondary:hover {
    background: var(--blue-subtle);
    transform: translateY(-2px);
}

.hsm-hub .hsm-btn--lg {
    padding: 16px 40px;
    font-size: 1.0625rem;
}


/* =============================================================================
   HERO SECTION
   ============================================================================= */

.hsm-hub-hero {
    position: relative;
    padding: 80px 0 64px;
    background: linear-gradient(180deg, var(--blue-subtle) 0%, var(--white) 100%);
    overflow: hidden;
    text-align: center;
}

.hsm-hub-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(ellipse at center top, rgba(74, 143, 231, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

.hsm-hub-hero__inner {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hsm-hub-hero__title {
    font-family: var(--font-display);
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--charcoal);
    margin: 0 0 20px;
}

.hsm-hub-hero__subtitle {
    font-size: 1.1875rem;
    line-height: 1.65;
    color: var(--charcoal-mid);
    margin: 0 0 40px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Stats Row ── */
.hsm-hub-hero__stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}

.hsm-hub-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 32px;
}

.hsm-hub-stat__number {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--blue);
    line-height: 1.1;
}

.hsm-hub-stat__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--charcoal-mid);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

.hsm-hub-stat__divider {
    width: 1px;
    height: 48px;
    background: var(--border);
}


/* =============================================================================
   POPULAR CATEGORIES — Large image cards
   ============================================================================= */

.hsm-hub-popular {
    padding: 80px 0;
}

.hsm-hub-popular__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* ── Popular Card ── */
.hsm-hub-popular__card {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    box-shadow: var(--shadow-sm);
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.hsm-hub-popular__card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(74, 143, 231, 0.15);
}

.hsm-hub-popular__img-wrap {
    position: absolute;
    inset: 0;
}

.hsm-hub-popular__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease-out);
}

.hsm-hub-popular__card:hover .hsm-hub-popular__img-wrap img {
    transform: scale(1.05);
}

.hsm-hub-popular__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--blue-subtle) 0%, var(--gray-200) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--charcoal-light);
}

.hsm-hub-popular__placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}

/* Dark overlay at bottom */
.hsm-hub-popular__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 48px 20px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    z-index: 2;
}

.hsm-hub-popular__name {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--white);
    margin: 0 0 4px;
    line-height: 1.3;
}

.hsm-hub-popular__count {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-block;
    width: fit-content;
}


/* =============================================================================
   CATEGORY GROUP SECTIONS — Browse by parent
   ============================================================================= */

.hsm-hub-group {
    padding: 72px 0;
}

.hsm-hub-group--alt {
    background: var(--gray-100);
}

/* ── Group Header ── */
.hsm-hub-group__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.hsm-hub-group__title-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    padding-left: 16px;
}

.hsm-hub-group__title-wrap::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
}

.hsm-hub-group__title {
    font-family: var(--font-display);
    font-size: 1.625rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.hsm-hub-group__title a {
    color: var(--charcoal);
}

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

.hsm-hub-group__desc {
    font-size: 0.9375rem;
    color: var(--charcoal-mid);
    margin: 6px 0 0;
    line-height: 1.5;
}

.hsm-hub-group__view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--blue);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 4px;
}

.hsm-hub-group__view-all:hover {
    color: var(--blue-dark);
}

.hsm-hub-group__view-all svg {
    transition: transform 0.25s var(--ease-out);
}

.hsm-hub-group__view-all:hover svg {
    transform: translateX(4px);
}

/* ── Group Grid ── */
.hsm-hub-group__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}


/* =============================================================================
   CATEGORY CARD (child / standalone)
   ============================================================================= */

.hsm-hub-card {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}

.hsm-hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(74, 143, 231, 0.12);
}

/* Card image */
.hsm-hub-card__img {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--gray-200);
}

.hsm-hub-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease-out);
}

.hsm-hub-card:hover .hsm-hub-card__img img {
    transform: scale(1.05);
}

.hsm-hub-card__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-300) 100%);
}

/* Card body */
.hsm-hub-card__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.hsm-hub-card__name {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0;
    line-height: 1.3;
}

.hsm-hub-card:hover .hsm-hub-card__name {
    color: var(--blue);
}

.hsm-hub-card__count {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--charcoal-light);
}

.hsm-hub-card__desc {
    font-size: 0.8125rem;
    color: var(--charcoal-light);
    line-height: 1.45;
    margin: 2px 0 0;
}


/* =============================================================================
   SEO EDITORIAL SECTION
   ============================================================================= */

.hsm-hub-editorial {
    padding: 64px 0;
    background: var(--white);
}

.hsm-hub-editorial__inner {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.hsm-hub-editorial__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--charcoal);
    margin: 0 0 16px;
}

.hsm-hub-editorial__text {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--charcoal-mid);
}

.hsm-hub-editorial__text p {
    margin: 0;
}


/* =============================================================================
   FINAL CTA SECTION
   ============================================================================= */

.hsm-hub-cta {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--blue-subtle) 0%, var(--blue-pale, #F5F9FF) 50%, var(--white) 100%);
    text-align: center;
}

.hsm-hub-cta__inner {
    max-width: 640px;
    margin: 0 auto;
}

.hsm-hub-cta__title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--charcoal);
    margin: 0 0 16px;
    line-height: 1.2;
}

.hsm-hub-cta__text {
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--charcoal-mid);
    margin: 0 0 36px;
}

.hsm-hub-cta__buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}


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

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

.hsm-hub-hero__inner {
    animation: hsmHubFadeUp 0.6s var(--ease-out) both;
}

.hsm-hub-popular__card {
    animation: hsmHubFadeUp 0.5s var(--ease-out) both;
}

.hsm-hub-popular__card:nth-child(2) { animation-delay: 0.05s; }
.hsm-hub-popular__card:nth-child(3) { animation-delay: 0.1s; }
.hsm-hub-popular__card:nth-child(4) { animation-delay: 0.15s; }
.hsm-hub-popular__card:nth-child(5) { animation-delay: 0.2s; }
.hsm-hub-popular__card:nth-child(6) { animation-delay: 0.25s; }
.hsm-hub-popular__card:nth-child(7) { animation-delay: 0.3s; }
.hsm-hub-popular__card:nth-child(8) { animation-delay: 0.35s; }


/* =============================================================================
   RESPONSIVE — 1024px (3 columns)
   ============================================================================= */

@media (max-width: 1024px) {
    .hsm-hub-popular__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hsm-hub-group__grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .hsm-hub-hero {
        padding: 64px 0 56px;
    }

    .hsm-hub-hero__title {
        font-size: 2.5rem;
    }

    .hsm-hub-stat__number {
        font-size: 2rem;
    }

    .hsm-hub-popular,
    .hsm-hub-group {
        padding: 64px 0;
    }
}


/* =============================================================================
   RESPONSIVE — 768px (2 columns, stacked layouts)
   ============================================================================= */

@media (max-width: 768px) {
    .hsm-hub-popular__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .hsm-hub-group__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .hsm-hub-hero {
        padding: 56px 0 48px;
    }

    .hsm-hub-hero__title {
        font-size: 2rem;
    }

    .hsm-hub-hero__subtitle {
        font-size: 1.0625rem;
    }

    .hsm-hub-stat {
        padding: 0 20px;
    }

    .hsm-hub-stat__number {
        font-size: 1.75rem;
    }

    .hsm-hub-stat__divider {
        height: 36px;
    }

    .hsm-hub-group__header {
        flex-direction: column;
        gap: 12px;
    }

    .hsm-hub-group__view-all {
        margin-top: 0;
    }

    .hsm-hub-popular,
    .hsm-hub-group {
        padding: 56px 0;
    }

    .hsm-hub-cta {
        padding: 64px 0;
    }

    .hsm-hub-cta__title {
        font-size: 1.75rem;
    }

    .hsm-hub-cta__buttons {
        flex-direction: column;
        gap: 12px;
    }

    .hsm-hub-cta__buttons .hsm-btn {
        width: 100%;
    }

    .hsm-section-title {
        font-size: 1.625rem;
    }

    .hsm-section-desc {
        font-size: 1rem;
        margin-bottom: 36px;
    }
}


/* =============================================================================
   RESPONSIVE — 640px (single column)
   ============================================================================= */

@media (max-width: 640px) {
    .hsm-hub .hsm-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hsm-hub-popular__grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .hsm-hub-popular__card {
        aspect-ratio: 16 / 9;
    }

    .hsm-hub-group__grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .hsm-hub-card {
        flex-direction: row;
        border-radius: 12px;
    }

    .hsm-hub-card__img {
        width: 120px;
        min-width: 120px;
        aspect-ratio: 1 / 1;
        border-radius: 12px 0 0 12px;
    }

    .hsm-hub-card__body {
        padding: 14px;
        justify-content: center;
    }

    .hsm-hub-hero {
        padding: 48px 0 40px;
    }

    .hsm-hub-hero__title {
        font-size: 1.75rem;
    }

    .hsm-hub-hero__subtitle {
        font-size: 1rem;
        margin-bottom: 32px;
    }

    .hsm-hub-hero__stats {
        gap: 0;
    }

    .hsm-hub-stat {
        padding: 0 16px;
    }

    .hsm-hub-stat__number {
        font-size: 1.5rem;
    }

    .hsm-hub-stat__label {
        font-size: 0.75rem;
    }

    .hsm-hub-stat__divider {
        height: 32px;
    }

    .hsm-hub-group__title {
        font-size: 1.375rem;
    }

    .hsm-hub-popular,
    .hsm-hub-group {
        padding: 48px 0;
    }

    .hsm-hub-editorial {
        padding: 48px 0;
    }

    .hsm-hub-cta {
        padding: 56px 0;
    }

    .hsm-hub-cta__title {
        font-size: 1.5rem;
    }

    .hsm-hub-cta__text {
        font-size: 1rem;
    }

    .hsm-hub .hsm-btn--lg {
        padding: 14px 28px;
        font-size: 1rem;
    }
}


/* =============================================================================
   RTL SUPPORT
   ============================================================================= */

[dir="rtl"] .hsm-hub-group__title-wrap {
    padding-left: 0;
    padding-right: 16px;
}

[dir="rtl"] .hsm-hub-group__title-wrap::before {
    left: auto;
    right: 0;
}

[dir="rtl"] .hsm-hub-group__view-all svg {
    transform: scaleX(-1);
}

[dir="rtl"] .hsm-hub-group__view-all:hover svg {
    transform: scaleX(-1) translateX(4px);
}

[dir="rtl"] .hsm-hub .hsm-btn svg {
    transform: scaleX(-1);
}

/* RTL mobile card layout */
@media (max-width: 640px) {
    [dir="rtl"] .hsm-hub-card {
        flex-direction: row-reverse;
    }

    [dir="rtl"] .hsm-hub-card__img {
        border-radius: 0 12px 12px 0;
    }
}


/* =============================================================================
   ACCESSIBILITY — Reduced motion
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .hsm-hub-hero__inner,
    .hsm-hub-popular__card {
        animation: none;
    }

    .hsm-hub-popular__card,
    .hsm-hub-card {
        transition: box-shadow 0.2s ease;
    }

    .hsm-hub-popular__card:hover,
    .hsm-hub-card:hover {
        transform: none;
    }

    .hsm-hub-popular__img-wrap img,
    .hsm-hub-card__img img {
        transition: none;
    }

    .hsm-hub-popular__card:hover .hsm-hub-popular__img-wrap img,
    .hsm-hub-card:hover .hsm-hub-card__img img {
        transform: none;
    }
}


/* =============================================================================
   FOCUS STATES — Keyboard navigation
   ============================================================================= */

.hsm-hub-popular__card:focus-visible,
.hsm-hub-card:focus-visible,
.hsm-hub-group__view-all:focus-visible,
.hsm-hub .hsm-btn:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

.hsm-hub-group__title a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
    border-radius: 4px;
}
