/* ==========================================================================
   File: Resource/font/font.css
   KHALA STUDIO — FONT RESOURCE MODULE
   - Dual Sticky Shells: Search + Live Custom Preview Generator
   - Blue Generate Button with Magic Icon (#1A73E8)
   - Dynamic Clear (X) Action
   - Large Specimen Font Rendering (No Faux-Bold / No Synthesis)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Top bar — Back button + Topic Title
   -------------------------------------------------------------------------- */
.font-top-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 50px 0 20px;
}

/* --------------------------------------------------------------------------
   Dual Sticky Control Bar
   -------------------------------------------------------------------------- */
.font-controls-sticky-bar {
    position: sticky;
    top: 0 !important;
    z-index: 1000;
    background-color: var(--hub-bg) !important;
    padding: 6px 0 16px 0;
    margin-bottom: 8px;
    width: 100%;
    display: flex;
    gap: var(--hub-gap);
    opacity: 1;
    visibility: visible;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease, opacity 0.25s ease, visibility 0.25s ease;
}

.font-controls-sticky-bar.nav-hidden {
    transform: translateY(-100%) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.font-controls-sticky-bar.is-stuck {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Shell 1: Search Font Name */
.font-search-shell {
    flex: 1;
    min-width: 0;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px 0 20px;
    background: var(--hub-soft);
    border-radius: 32px;
    transition: background-color .18s ease;
}

.font-search-shell:focus-within {
    background: var(--hub-soft-hover);
}

.font-search-shell .material-symbols-outlined {
    font-size: 22px;
    color: var(--hub-text);
    flex: 0 0 auto;
}

.font-search-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--hub-title);
    font: inherit;
    font-size: 1rem;
}

.font-search-input::placeholder {
    color: #a9a9b3;
    opacity: 1;
}

/* Shell 2: Custom Text Preview with Generate & Clear */
.font-preview-shell {
    flex: 1.4;
    min-width: 0;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 0 20px;
    background: var(--hub-soft);
    border-radius: 32px;
    transition: background-color .18s ease;
}

.font-preview-shell:focus-within {
    background: var(--hub-soft-hover);
}

.font-preview-shell .preview-lead-icon {
    font-size: 22px;
    color: var(--hub-accent);
    flex: 0 0 auto;
}

.font-preview-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--hub-title);
    font: inherit;
    font-size: 1rem;
}

.font-preview-input::placeholder {
    color: #a9a9b3;
    opacity: 1;
}

/* Clear (X) Button */
.font-preview-clear-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--hub-text);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color .18s ease, color .18s ease;
}

.font-preview-clear-btn.show {
    display: inline-flex;
}

.font-preview-clear-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--hub-title);
}

.font-preview-clear-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Blue Generate Button */
.font-preview-generate-btn {
    height: 38px;
    padding: 0 16px;
    border: 0;
    border-radius: 20px;
    background: var(--hub-accent);
    color: #ffffff;
    font-size: 1rem !important;
    font-weight: 500 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity .18s ease;
}

.font-preview-generate-btn:hover {
    opacity: 0.9;
}

.font-preview-generate-btn .material-symbols-outlined {
    font-size: 18px !important;
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   2-Column Font Card Grid
   -------------------------------------------------------------------------- */
.font-grid-viewport {
    position: relative;
    width: 100%;
    min-height: 400px;
}

.font-loading-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--hub-bg);
    z-index: 10;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    pointer-events: none;
}

.font-loading-mask.hidden {
    opacity: 0;
    visibility: hidden;
}

.font-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--hub-gap);
    width: 100%;
    opacity: 0;
    animation: pureFadeIn 0.28s ease forwards;
}

.font-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 24px 20px 24px;
    background: var(--hub-soft);
    border-radius: var(--hub-radius);
    border: 0;
    cursor: pointer;
    transition: background-color .18s ease;
    min-height: 165px;
}

.font-card:hover {
    background: var(--hub-soft-hover);
}

.font-card:focus-visible {
    outline: 2px solid var(--hub-accent);
    outline-offset: 3px;
}

.font-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.font-name {
    font-size: 1rem !important;
    color: var(--hub-text);
    line-height: 1.25;
    font-weight: 500;
}

.font-download-btn {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 0;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.121);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity .18s ease;
}

.font-download-btn span {
    font-size: 20px !important;
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Large Font Specimen (1.75rem / 28px)
   -------------------------------------------------------------------------- */
.font-sample-text {
    font-size: 1.75rem !important;
    line-height: 1.45 !important;
    color: var(--hub-title) !important;
    margin: 16px 0 18px !important;
    word-break: break-word !important;

    /* Raw Glyph Rendering Protection */
    font-weight: normal !important;
    font-style: normal !important;
    font-synthesis: none !important;
    -webkit-font-synthesis: none !important;
    letter-spacing: normal !important;
    font-variant-ligatures: normal !important;
    text-rendering: optimizeLegibility !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

.font-style-count {
    font-size: 1rem !important;
    color: var(--hub-text);
    line-height: 1;
}

.font-empty {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
    font-size: 1.125rem !important;
    color: var(--hub-text);
    padding: 60px 0;
    line-height: 1.5;
    background: var(--hub-soft);
    border-radius: var(--hub-radius);
}

@keyframes pureFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
    .font-controls-sticky-bar {
        flex-direction: column;
        gap: 8px;
    }

    .font-search-shell,
    .font-preview-shell {
        width: 100%;
        flex: none;
        height: 48px;
    }

    .font-grid {
        grid-template-columns: 1fr;
    }

    .font-card {
        padding: 18px 16px;
    }

    .font-sample-text {
        font-size: 1.5rem !important;
    }
}