/* Fontify — Glyph Viewer frontend styles. */

.fontify-glyph-viewer {
        --font-size: 48px;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        background: var(--fontify-bg, #ffffff);
        color: var(--fontify-text, #1f2937);
        border-radius: 8px;
        padding: 20px;
        position: relative;
}

.fontify-glyph-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        align-items: flex-end;
        padding: 12px 16px;
        background: var(--fontify-card-bg, #f9fafb);
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        margin-bottom: 16px;
}

.fontify-glyph-controls label {
        display: flex;
        flex-direction: column;
        font-size: 11px;
        font-weight: 600;
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        gap: 4px;
}

.fontify-glyph-controls select,
.fontify-glyph-controls input[type="search"] {
        padding: 6px 10px;
        border: 1px solid #d1d5db;
        border-radius: 4px;
        background: #fff;
        color: #1f2937;
        font-size: 13px;
        min-width: 140px;
}

.fontify-glyph-controls input[type="range"] {
        width: 140px;
        accent-color: var(--fontify-accent, #6366f1);
}

.fontify-loading-status {
        margin-left: auto;
        font-size: 12px;
        font-weight: 500;
        color: var(--fontify-accent, #6366f1);
}

.fontify-glyph-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(calc(var(--font-size) * 1.6), 1fr));
        gap: 1px;
        background: #e5e7eb;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        overflow: hidden;
        max-height: 700px;
        overflow-y: auto;
}

.fontify-glyph-cell {
        background: var(--fontify-bg, #ffffff);
        border: 0;
        padding: 12px 8px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        cursor: pointer;
        min-height: calc(var(--font-size) * 2.2);
        transition: background 0.15s, transform 0.1s;
}

.fontify-glyph-cell:hover {
        background: var(--fontify-card-bg, #f9fafb);
        transform: scale(1.03);
        z-index: 1;
}

.fontify-glyph-cell.is-hidden { display: none; }

.fontify-glyph-char {
        font-size: var(--font-size);
        line-height: 1;
        color: var(--fontify-text, #1f2937);
}

.fontify-glyph-label {
        font-size: 10px;
        color: #6b7280;
        font-family: 'Courier New', monospace;
        text-transform: uppercase;
        letter-spacing: 0.04em;
}

.fontify-glyph-count {
        font-size: 12px;
        color: #6b7280;
        margin-top: 12px;
}

/* Info card popup.
   The card is created in JS and appended to <body> so it isn't affected
   by ancestor transform/filter (which would break position:fixed). */
.fontify-glyph-info-card {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: #fff;
        color: #1f2937;
        border-radius: 12px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
        max-width: 640px;
        width: calc(100% - 32px);
        max-height: 85vh;
        overflow-y: auto;
        z-index: 2147483647; /* max z-index — always on top */
        padding: 32px;
        box-sizing: border-box;
}

.fontify-glyph-info-card:not(.fontify-info-visible) {
        display: none;
}

.fontify-info-close {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        border: 0;
        background: #f3f4f6;
        color: #4b5563;
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
}

.fontify-info-close:hover { background: #e5e7eb; }

.fontify-info-grid {
        display: grid;
        grid-template-columns: 180px 1fr;
        gap: 24px;
        align-items: start;
}

@media (max-width: 600px) {
        .fontify-info-grid { grid-template-columns: 1fr; }
        .fontify-info-glyph { text-align: center; }
}

.fontify-info-glyph {
        background: var(--fontify-card-bg, #f9fafb);
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 160px;
}

.fontify-info-meta h3 {
        margin: 0 0 16px;
        font-size: 18px;
        font-weight: 700;
        color: var(--fontify-accent, #6366f1);
}

.fontify-info-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
        margin-bottom: 16px;
}

.fontify-info-table th {
        text-align: left;
        font-weight: 600;
        color: #6b7280;
        padding: 6px 8px;
        background: var(--fontify-card-bg, #f9fafb);
        border: 1px solid #e5e7eb;
        width: 40%;
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.04em;
}

.fontify-info-table td {
        padding: 6px 8px;
        border: 1px solid #e5e7eb;
        font-family: 'Courier New', monospace;
        font-size: 12px;
}

.fontify-info-table code {
        background: #f3f4f6;
        padding: 2px 6px;
        border-radius: 3px;
        font-size: 11px;
}

.fontify-modal-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        z-index: 2147483646; /* just below the card */
}
