/**
 * Admin Page Styles
 * Typography Stylist Plugin
 */

/* =========================================================================
   CSS CUSTOM PROPERTIES — Color & Typography Tokens
   ========================================================================= */
.typost-admin-wrap {
    /* --- Color tokens --- */
    --typost-color-primary: #2271b1;
    --typost-color-primary-dark: #135e96;
    --typost-color-primary-focus: rgba(34, 113, 177, 0.3);
    --typost-color-accent-alt: #0073aa;

    --typost-bg-page: #FAF9F6;
    --typost-bg-surface: #fff;
    --typost-bg-surface-alt: #fafafa;
    --typost-bg-section: #f9f9f9;
    --typost-bg-info: #f0f6fc;
    --typost-bg-header: #f0f0f1;
    --typost-bg-header-hover: #e8e8e9;
    --typost-bg-muted: #f6f7f7;
    --typost-bg-code: #f0f0f1;
    --typost-bg-adobe-card: #f8fbff;

    --typost-border-default: #ddd;
    --typost-border-strong: #c3c4c7;
    --typost-border-subtle: #dcdcde;
    --typost-border-input: #8c8f94;
    --typost-border-container: #ccd0d4;

    --typost-text-primary: #1d2327;
    --typost-text-secondary: #646970;
    --typost-text-muted: #666;
    --typost-text-on-primary: #fff;

    --typost-color-danger: #b32d2e;
    --typost-color-danger-hover: #d63638;
    --typost-color-danger-bright: #dc3232;

    --typost-color-warning-bg: #fcf9e8;
    --typost-color-warning-border: #dba617;
    --typost-color-warning-text: #996800;

    --typost-color-highlight-bg: #fff3cd;
    --typost-color-support-bg: #fffff0;

    /* --- Typography tokens (bumped +1px from original) --- */
    --typost-font-size-base: 16px;
    --typost-font-size-sm: 15px;
    --typost-font-size-xs: 14px;
    --typost-font-size-xxs: 13px;
    --typost-font-size-label-small: 12px;
    --typost-font-size-lg: 16px;
    --typost-font-size-xl: 16px;
    --typost-font-size-heading: 18px;

    /* --- Layout tokens --- */
    --typost-line-length: 45em;

    /* --- Base font size and color --- */
    font-size: var(--typost-font-size-base);
    color: var(--typost-text-primary);
}

/* Override WP common.css "h2, h3 { color: #1d2327 }" inside our admin wrap */
.typost-admin-wrap h2,
.typost-admin-wrap h3 {
    color: var(--typost-text-primary);
}

/* =========================================================================
   LAYOUT & CONTAINER
   ========================================================================= */
.typost-admin-container {
    background: transparent;
    border-bottom: 1px solid var(--typost-border-container);
    margin-top: 20px;
}

/* Override WP nav-tab float with flexbox for modern layout */
.typost-admin-tabs.nav-tab-wrapper {
    display: flex;
    padding-top: 0;
}

.typost-admin-tabs .nav-tab {
    float: none;
    min-height: 44px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.typost-tab-content {
    display: none;
    padding: 30px;
}

.typost-tab-content.active {
    display: block;
    background: var(--typost-bg-page);
    border-left: 1px solid var(--typost-border-container);
    border-right: 1px solid var(--typost-border-container);
}

/* Bringhurst line-length constraint for readable text (~66 characters) */
.typost-tab-content > p,
.typost-tab-content > .description,
.typost-help-section p,
.typost-help-section li,
.typost-font-help p,
.typost-font-help li,
.typost-adobe-help p,
.typost-adobe-help li,
.typost-manual-help p,
.typost-manual-help li,
.typost-developer-support p,
.typost-preset-controls .description,
.typost-preset-font-selector .description,
.form-table .description,
.typost-feature-demo-description,
.typost-accessibility-recommendations li {
    max-width: var(--typost-line-length);
}

/* =========================================================================
   TAB HELP PANELS
   ========================================================================= */
.typost-tab-help {
    background: var(--typost-bg-info);
    border: 1px solid var(--typost-border-strong);
    border-radius: 4px;
    margin-bottom: 20px;
}

.typost-tab-help summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--typost-font-size-sm);
    color: var(--typost-text-primary);
    list-style: none;
}

.typost-tab-help summary::-webkit-details-marker,
.typost-tab-help summary::marker {
    display: none;
}

.typost-tab-help summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    font-size: var(--typost-font-size-label-small);
    transition: transform 0.2s;
}

.typost-tab-help[open] > summary::before {
    transform: rotate(90deg);
}

.typost-tab-help summary:hover {
    color: var(--typost-text-primary);
}

.typost-tab-help summary:focus {
    outline: 2px solid var(--typost-color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.typost-tab-help-content {
    padding: 0 16px 16px;
    font-size: var(--typost-font-size-xs);
    line-height: 1.6;
    color: var(--typost-text-primary);
}

.typost-tab-help-content p {
    max-width: var(--typost-line-length);
}

.typost-tab-help-content ul,
.typost-tab-help-content ol {
    margin-left: 20px;
    max-width: var(--typost-line-length);
}

.typost-tab-help-content li {
    margin-bottom: 4px;
}

/* =========================================================================
   PRESET CONTROLS (Font Features Tab)
   ========================================================================= */
.typost-preset-controls {
    margin: 20px 0;
    padding: 20px;
    background: var(--typost-bg-info);
    border-left: 4px solid var(--typost-color-primary);
    border-radius: 4px;
}

.typost-preset-font-selector {
    margin: 0 15px 20px 15px;
}

.typost-preset-font-selector:last-child {
    margin-bottom: 0;
}

.typost-preset-font-selector label,
.typost-preset-size-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: var(--typost-font-size-sm);
}

.typost-font-select {
    max-width: 400px;
    padding: 8px;
    font-size: var(--typost-font-size-sm);
    border: 1px solid var(--typost-border-input);
    border-radius: 4px;
}

.typost-font-select:focus {
    outline: 2px solid var(--typost-color-primary);
    outline-offset: 0;
}

.typost-preset-font-selector .description,
.typost-preset-size-control .description {
    margin-top: 8px;
    color: var(--typost-text-secondary);
    font-size: var(--typost-font-size-xs);
}

.typost-preset-size-control {
    margin: 20px 15px 0 15px;
}

.typost-size-value {
    display: inline-block;
    min-width: 50px;
    text-align: right;
    color: var(--typost-color-primary);
    font-weight: 700;
    margin-left: 8px;
}

.typost-size-slider {
    width: 100%;
    max-width: 400px;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--typost-border-default);
    outline: none;
    border-radius: 4px;
    margin-bottom: 8px;
}

.typost-size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--typost-color-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.typost-size-slider::-webkit-slider-thumb:hover {
    background: var(--typost-color-primary-dark);
}

.typost-size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--typost-color-primary);
    cursor: pointer;
    border-radius: 50%;
    border: none;
    transition: background 0.2s;
}

.typost-size-slider::-moz-range-thumb:hover {
    background: var(--typost-color-primary-dark);
}

.typost-size-slider:focus {
    outline: 2px solid var(--typost-color-primary);
    outline-offset: 2px;
}

.typost-size-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px var(--typost-color-primary-focus);
}

.typost-size-slider:focus::-moz-range-thumb {
    box-shadow: 0 0 0 3px var(--typost-color-primary-focus);
}

.typost-preset-card-width-control {
    margin: 20px 15px 0 15px;
}

.typost-preset-card-width-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: var(--typost-font-size-sm);
}

/* =========================================================================
   BASELINE PREVIEW
   ========================================================================= */
.typost-baseline-preview-section {
    margin: 30px 0;
    padding: 20px;
    background: var(--typost-bg-section);
    border: 1px solid var(--typost-border-default);
    border-radius: 6px;
}

.typost-baseline-preview-section h3 {
    margin: 0 0 8px 0;
    font-size: var(--typost-font-size-xl);
    color: var(--typost-text-primary);
}

.typost-baseline-preview-section .description {
    margin: 0 0 20px 0;
    color: var(--typost-text-muted);
    font-size: var(--typost-font-size-xs);
}

.typost-baseline-preview-container {
    background: var(--typost-bg-surface);
    border: 2px solid var(--typost-color-primary);
    border-radius: 4px;
    padding: 30px;
    overflow: hidden;
}

.typost-baseline-preview {
    font-size: 50px;
    line-height: 1.4;
    text-align: center;
    font-family: Georgia, serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--typost-text-primary);
    hyphens: auto;
}

/* =========================================================================
   FEATURE CATEGORY SECTIONS
   ========================================================================= */
.typost-feature-category-section {
    border: 1px solid var(--typost-border-strong);
    margin-bottom: 20px;
    border-radius: 4px;
    background: var(--typost-bg-surface);
}

/* Collapsible summary styles */
.typost-feature-category-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    padding: 15px;
    padding-inline-start: 36px;
    gap: 10px;
    background: var(--typost-bg-header);
    border-bottom: 1px solid var(--typost-border-strong);
    position: relative;
}

/* Remove default marker/disclosure triangle */
.typost-feature-category-summary::-webkit-details-marker,
.typost-feature-category-summary::marker {
    display: none;
}

/* Custom arrow */
.typost-feature-category-summary::before {
    content: '\25B6';
    position: absolute;
    inset-inline-start: 15px;
    color: var(--typost-text-primary);
    transition: transform 0.2s;
    font-size: var(--typost-font-size-label-small);
}

.typost-feature-category-section[open] > .typost-feature-category-summary::before {
    transform: rotate(90deg);
}

.typost-feature-category-summary:hover {
    background: var(--typost-bg-header-hover);
}

.typost-feature-category-summary:focus {
    outline: 2px solid var(--typost-color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Category name in summary */
.typost-feature-category-title {
    color: var(--typost-text-primary);
    font-size: var(--typost-font-size-xl);
    font-weight: 600;
}

/* Feature count badge */
.typost-feature-category-count {
    font-size: var(--typost-font-size-xs);
    font-weight: 400;
    color: var(--typost-text-secondary);
    min-width: 60px;
    text-align: start;
}

/* =========================================================================
   FEATURE DEMO CARDS
   ========================================================================= */
.typost-feature-demos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(480px, 100%), 1fr));
    gap: 20px;
    padding: 15px;
}

@media (min-width: 1200px) {
    .typost-feature-demos-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(600px, 100%), 1fr));
    }
}

.typost-feature-demo-card {
    border: 1px solid var(--typost-border-default);
    padding: 20px;
    border-radius: 6px;
    background: var(--typost-bg-surface-alt);
    transition: box-shadow 0.2s;
}

.typost-feature-demo-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.typost-feature-demo-card.typost-feature-disabled {
    opacity: 0.45;
}

/* Feature visibility checkbox */
.typost-feature-visibility-control {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--typost-border-default);
}

.typost-feature-visibility-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--typost-font-size-xs);
    color: var(--typost-text-muted);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.typost-feature-visibility-label:hover {
    color: var(--typost-text-primary);
}

/* Master visibility controls (shown when a font is selected) */
.typost-visibility-master-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.typost-visibility-save-indicator {
    font-size: var(--typost-font-size-xs);
    color: var(--typost-color-success, #2ea44f);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}

.typost-visibility-save-indicator.typost-save-visible {
    opacity: 1;
}

.typost-feature-demo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.typost-feature-demo-header h4 {
    margin: 0;
    font-size: var(--typost-font-size-lg);
    color: var(--typost-text-primary);
}

.typost-feature-demo-header .typost-feature-code {
    background: var(--typost-color-primary);
    color: var(--typost-text-on-primary);
    padding: 4px 8px;
    border-radius: 3px;
    font-size: var(--typost-font-size-xxs);
    font-weight: 600;
}

.typost-feature-demo-description {
    color: var(--typost-text-muted);
    font-size: var(--typost-font-size-xs);
    margin: 0 0 15px 0;
    line-height: 1.5;
}

/* Feature Comparison */
.typost-feature-comparison {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.typost-feature-preview-container {
    background: var(--typost-bg-surface);
    border: 1px solid var(--typost-border-default);
    border-radius: 4px;
    padding: 12px;
    flex: 1 1 150px;
    min-width: 0;
}

.typost-feature-preview-label {
    font-size: var(--typost-font-size-label-small);
    font-weight: 600;
    text-transform: uppercase;
    color: var(--typost-text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.typost-feature-preview {
    font-size: 54px;
    line-height: 1.2;
    text-align: center;
    padding: 20px;
    font-family: Georgia, serif;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    hyphens: auto;
}

.typost-feature-preview-off {
    color: var(--typost-text-muted);
}

.typost-feature-preview-on {
    color: var(--typost-text-primary);
    font-weight: 500;
    width: 100%;
    background: var(--typost-bg-surface);
    border: 2px solid var(--typost-border-default);
    border-radius: 4px;
    position: relative;
    box-sizing: border-box;
}

/* =========================================================================
   USER PRESETS SECTION
   ========================================================================= */
.typost-user-presets-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 3px solid var(--typost-color-primary);
}

.typost-user-presets-section > h3 {
    color: var(--typost-color-primary);
    font-size: var(--typost-font-size-heading);
    margin-bottom: 15px;
}

.typost-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.typost-preset-card {
    border: 1px solid var(--typost-border-default);
    padding: 20px;
    border-radius: 4px;
    background: var(--typost-bg-surface-alt);
}

.typost-preset-card h4 {
    margin: 0 0 10px 0;
    font-size: var(--typost-font-size-xl);
}

.typost-preset-description {
    color: var(--typost-text-muted);
    font-size: var(--typost-font-size-xs);
    margin-bottom: 10px;
}

.typost-preset-features {
    font-size: var(--typost-font-size-xxs);
    margin-bottom: 15px;
    padding: 8px;
    background: var(--typost-bg-surface);
    border-radius: 3px;
}

.typost-preset-preview {
    font-size: 50px;
    padding: 15px;
    background: var(--typost-bg-surface);
    border-radius: 3px;
    text-align: center;
    font-family: Georgia, serif;
    line-height: 1.2;
}

.typost-features-list {
    margin-top: 20px;
}

.typost-feature-category {
    margin-bottom: 30px;
}

.typost-feature-category h3 {
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid var(--typost-color-primary);
}

.typost-feature-category table code {
    background: var(--typost-bg-code);
    padding: 3px 6px;
    border-radius: 3px;
    font-weight: 600;
}

/* =========================================================================
   HELP TAB
   ========================================================================= */
.typost-help-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--typost-border-default);
}

.typost-help-section:last-child {
    border-bottom: none;
}

.typost-help-section h3 {
    color: var(--typost-text-primary);
}

.typost-help-section ul, .typost-help-section ol {
    line-height: 1.8;
}

.typost-add-preset-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--typost-bg-info);
    border-left: 4px solid var(--typost-color-primary);
}

/* =========================================================================
   FONTS TAB
   ========================================================================= */
.typost-fonts-list {
    margin: 20px 0;
}

.typost-font-card {
    border: 1px solid var(--typost-border-default);
    padding: 15px;
    border-radius: 4px;
    background: var(--typost-bg-surface-alt);
}

/* Kit grouping styles - uses native <details>/<summary> */
details.typost-font-kit-card {
    border: 1px solid var(--typost-border-strong);
    margin-bottom: 20px;
    border-radius: 4px;
    background: var(--typost-bg-surface);
}

.typost-font-kit-header {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    padding: 15px;
    padding-inline-start: 36px;
    gap: 10px;
    background: var(--typost-bg-header);
    border-bottom: 1px solid var(--typost-border-strong);
    position: relative;
}

/* Remove browser default markers */
.typost-font-kit-header::-webkit-details-marker,
.typost-font-kit-header::marker {
    display: none;
}

/* Custom arrow */
.typost-font-kit-header::before {
    content: '\25B6';
    position: absolute;
    inset-inline-start: 15px;
    color: var(--typost-text-primary);
    transition: transform 0.2s;
    font-size: var(--typost-font-size-label-small);
}

details.typost-font-kit-card[open] > .typost-font-kit-header::before {
    transform: rotate(90deg);
}

.typost-font-kit-header:hover {
    background: var(--typost-bg-header-hover);
}

.typost-font-kit-header:focus {
    outline: 2px solid var(--typost-color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.typost-kit-name {
    font-size: var(--typost-font-size-xl);
    font-weight: 600;
    color: var(--typost-text-primary);
}

.typost-kit-font-count {
    font-size: var(--typost-font-size-xs);
    font-weight: 400;
    color: var(--typost-text-secondary);
    min-width: 60px;
    text-align: start;
}

.typost-kit-fonts {
    padding: 15px;
    background: var(--typost-bg-muted);
}

.typost-kit-fonts .typost-font-card {
    background: var(--typost-bg-surface);
    border: 1px solid var(--typost-border-default);
}

.typost-kit-font .typost-font-header h5 {
    margin: 0;
    font-size: var(--typost-font-size-lg);
    font-weight: 500;
}

/* .typost-font-header styles are defined in the unified font list section */

.typost-font-header h4 {
    margin: 0;
    font-size: var(--typost-font-size-xl);
}

.typost-font-families {
    padding: 10px;
    background: var(--typost-bg-surface);
    border-radius: 3px;
    margin-bottom: 10px;
    font-size: var(--typost-font-size-xs);
}

.typost-font-meta {
    color: var(--typost-text-muted);
    font-size: var(--typost-font-size-xxs);
    margin-left: auto;
}

/* =========================================================================
   UPLOAD FONT SECTION
   ========================================================================= */
.typost-upload-font-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--typost-bg-surface);
    border: 1px solid var(--typost-border-default);
    border-radius: 4px;
}

.typost-upload-form {
    margin: 20px 0;
}

.typost-form-field {
    margin-bottom: 15px;
}

.typost-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Fieldset/legend for weight checkbox groups (accessibility fix) */
.typost-weight-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.typost-weight-fieldset > legend {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: var(--typost-font-size-base);
}

/* Display-only field label (not associated with an input) */
.typost-field-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.typost-font-help {
    margin-top: 30px;
    padding: 15px;
    background: var(--typost-bg-info);
    border-left: 4px solid var(--typost-color-primary);
}

.typost-font-help h4 {
    margin-top: 0;
}

.typost-font-help ol {
    line-height: 1.8;
}

.typost-empty-state {
    padding: 40px;
    text-align: center;
    color: var(--typost-text-muted);
    background: var(--typost-bg-section);
    border: 1px dashed var(--typost-border-default);
    border-radius: 4px;
}

.typost-upload-method-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.typost-upload-method-buttons .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
}

.typost-upload-method-buttons .dashicons {
    font-size: var(--typost-font-size-xl);
    width: 16px;
    height: 16px;
}

.typost-or-separator {
    color: var(--typost-text-muted);
    font-style: italic;
    font-size: var(--typost-font-size-xs);
}

.typost-selected-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--typost-bg-info);
    border: 1px solid var(--typost-color-primary);
    border-radius: 3px;
    margin-bottom: 10px;
}

.typost-selected-file .dashicons-media-document {
    color: var(--typost-color-primary);
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.typost-selected-file #typost-file-name {
    flex: 1;
    font-weight: 500;
    color: var(--typost-color-primary);
}

.typost-selected-file .button-link {
    color: var(--typost-color-danger);
    text-decoration: none;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
}

.typost-selected-file .button-link .dashicons {
    font-size: var(--typost-font-size-xl);
    width: 16px;
    height: 16px;
}

.typost-selected-file .button-link:hover {
    color: var(--typost-color-danger-bright);
}

.typost-file-size {
    color: var(--typost-text-muted);
    font-size: var(--typost-font-size-xxs);
    margin-left: 8px;
}

.typost-upload-progress {
    margin-top: 15px;
}

.typost-progress-bar {
    width: 100%;
    height: 30px;
    background: var(--typost-bg-code);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.typost-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--typost-color-primary) 0%, var(--typost-color-primary-dark) 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typost-progress-text {
    text-align: center;
    margin-top: 8px;
    font-size: var(--typost-font-size-xs);
    color: var(--typost-text-muted);
}

.typost-selected-file .dashicons-media-archive {
    color: var(--typost-color-primary);
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* =========================================================================
   ACCESSIBILITY HELPERS
   ========================================================================= */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, .6);
    clip: auto !important;
    clip-path: none;
    color: var(--typost-color-accent-alt);
    display: block;
    font-size: var(--typost-font-size-sm);
    font-weight: 600;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

#typost-upload-font-btn,
#typost-select-file-btn,
#typost-clear-file-btn {
    min-height: 44px;
    min-width: 44px;
}

.typost-font-section, .typost-fontsize-section {
    margin: 0 1rem;
}

/* =========================================================================
   ADOBE FONTS SECTION
   ========================================================================= */
.typost-adobe-fonts-section {
    margin-top: 40px;
    padding: 20px;
    background: var(--typost-bg-surface);
    border: 1px solid var(--typost-border-default);
    border-radius: 4px;
}

.typost-adobe-fonts-section h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--typost-color-primary);
}

.typost-adobe-fonts-list {
    margin: 20px 0;
}

.typost-adobe-fonts-list h4 {
    font-size: var(--typost-font-size-lg);
    margin-bottom: 15px;
}

.typost-adobe-font-card {
    border: 1px solid var(--typost-border-default);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
    background: var(--typost-bg-adobe-card);
}

.typost-adobe-font-card h5 {
    margin: 0;
    font-size: var(--typost-font-size-lg);
}

.typost-add-adobe-font-form {
    margin: 20px 0;
    padding: 20px;
    background: var(--typost-bg-section);
    border-radius: 4px;
}

.typost-add-adobe-font-form h4 {
    margin-top: 0;
}

.typost-adobe-help {
    margin-top: 30px;
    padding: 15px;
    background: var(--typost-bg-info);
    border-left: 4px solid var(--typost-color-primary);
    border-radius: 4px;
}

.typost-adobe-help h4 {
    margin-top: 0;
}

.typost-adobe-help ol {
    line-height: 1.8;
}

.typost-delete-adobe-font {
    color: var(--typost-color-danger);
}

.typost-delete-adobe-font:hover {
    color: var(--typost-color-danger-hover);
}

/* =========================================================================
   MANUAL FONTS SECTION
   ========================================================================= */
.typost-manual-fonts-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--typost-border-subtle);
}

.typost-manual-fonts-list {
    margin: 20px 0;
}

.typost-manual-font-card {
    background: var(--typost-bg-surface);
    border: 1px solid var(--typost-border-subtle);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.typost-manual-font-card .typost-font-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.typost-manual-font-card h5 {
    margin: 0;
    font-size: var(--typost-font-size-xl);
}

.typost-manual-font-card .typost-font-families,
.typost-manual-font-card .typost-font-fallbacks {
    margin: 10px 0;
}

.typost-manual-font-card .typost-font-families code,
.typost-manual-font-card .typost-font-fallbacks code {
    background: var(--typost-bg-muted);
    padding: 4px 8px;
    border-radius: 3px;
}

.typost-add-manual-font-form {
    background: var(--typost-bg-muted);
    border: 1px solid var(--typost-border-subtle);
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.typost-manual-help {
    margin-top: 30px;
    padding: 20px;
    background: var(--typost-bg-info);
    border-left: 4px solid var(--typost-color-accent-alt);
    border-radius: 4px;
}

.typost-manual-help h4 {
    margin-top: 0;
}

.typost-manual-help ol {
    line-height: 1.8;
}

.typost-manual-help code {
    background: var(--typost-bg-surface);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: var(--typost-font-size-xs);
}

.typost-delete-manual-font {
    color: var(--typost-color-danger);
}

.typost-delete-manual-font:hover {
    color: var(--typost-color-danger-hover);
}

/* =========================================================================
   FONT DELETION MODAL & REPLACEMENT MANAGEMENT
   ========================================================================= */
.typost-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typost-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.typost-modal-content {
    position: relative;
    background: var(--typost-bg-surface);
    max-width: 500px;
    width: 90%;
    z-index: 2;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.typost-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--typost-border-subtle);
    position: relative;
}

.typost-modal-header h2 {
    margin: 0;
    font-size: var(--typost-font-size-heading);
}

.typost-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--typost-text-secondary);
    padding: 5px 10px;
}

.typost-modal-close:hover {
    color: var(--typost-color-primary-dark);
}

.typost-modal-body {
    padding: 20px;
}

.typost-modal-field {
    margin-bottom: 20px;
}

.typost-modal-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.typost-modal-field select {
    width: 100%;
}

.typost-modal-field .description {
    margin-top: 6px;
    font-size: var(--typost-font-size-xs);
    color: var(--typost-text-secondary);
}

.typost-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--typost-border-subtle);
    text-align: right;
}

.typost-modal-footer .button {
    margin-left: 10px;
}

/* Replacements table */
#typost-replacements-list table {
    margin-top: 20px;
}

#typost-replacements-list th {
    font-weight: 600;
}

.typost-no-replacements {
    padding: 40px 20px;
    text-align: center;
    color: var(--typost-text-secondary);
    background: var(--typost-bg-muted);
    border-radius: 4px;
}

#typost-unassigned-fonts {
    padding: 20px;
    background: var(--typost-color-warning-bg);
    border-left: 4px solid var(--typost-color-warning-border);
    border-radius: 4px;
}

#typost-unassigned-fonts h3 {
    margin-top: 0;
    color: var(--typost-color-warning-text);
}

/* =========================================================================
   DEVELOPER SUPPORT SECTION
   ========================================================================= */
.typost-developer-support {
    margin-top: 30px;
    background: var(--typost-color-support-bg);
    border: 1px solid var(--typost-border-strong);
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    padding: 20px;
    border-radius: 4px;
}

.typost-developer-support h3 {
    margin-top: 0;
    color: var(--typost-text-primary);
}

.typost-developer-support .typost-separator {
    margin: 0 10px;
}

/* =========================================================================
   WEIGHT CHECKBOXES
   ========================================================================= */
.typost-weight-checkboxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
    margin-top: 8px;
}

.typost-weight-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400 !important;
    cursor: pointer;
}

.typost-weight-checkbox-label input[type="checkbox"] {
    margin: 0;
}

/* =========================================================================
   FEATURE VISIBILITY — FONT EDIT FORM SECTION
   ========================================================================= */
.typost-feature-visibility-section {
    border: 1px solid var(--typost-border-default);
    border-radius: 4px;
    margin-top: 0;
    padding: 0;
}

.typost-feature-visibility-summary {
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    -webkit-user-select: none;
    user-select: none;
}

.typost-feature-visibility-summary::-webkit-details-marker,
.typost-feature-visibility-summary::marker {
    display: none;
}

.typost-feature-visibility-summary::before {
    content: '\25B6';
    display: inline-block;
    flex-shrink: 0;
    font-size: var(--typost-font-size-label-small);
    color: var(--typost-text-muted);
    transition: transform 0.2s;
}

.typost-feature-visibility-section[open] > .typost-feature-visibility-summary::before {
    transform: rotate(90deg);
}

.typost-feature-visibility-summary:hover::before {
    color: var(--typost-color-primary);
}

.typost-feature-visibility-summary-hint {
    font-weight: 400;
    font-size: var(--typost-font-size-xs);
    color: var(--typost-text-muted);
}

.typost-feature-visibility-form-controls {
    padding: 12px 14px 14px;
    border-top: 1px solid var(--typost-border-default);
}

.typost-form-visibility-master {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.typost-form-visibility-category {
    border: none;
    margin: 0 0 12px 0;
    padding: 0;
}

.typost-form-visibility-category > legend {
    font-weight: 600;
    font-size: var(--typost-font-size-xs);
    color: var(--typost-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}

.typost-form-visibility-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.typost-form-visibility-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 400;
    cursor: pointer;
    min-width: 160px;
}

.typost-form-visibility-label input[type="checkbox"] {
    margin: 0;
}

.typost-form-visibility-feature-name {
    font-size: var(--typost-font-size-xs);
}

.typost-form-visibility-feature-code {
    font-size: var(--typost-font-size-xxs);
    background: var(--typost-bg-surface);
    border: 1px solid var(--typost-border-default);
    border-radius: 2px;
    padding: 1px 4px;
    color: var(--typost-text-muted);
}

/* =========================================================================
   UNIFIED FONT LIST
   ========================================================================= */
.typost-unified-font-list {
    list-style: none;
    margin: 20px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.typost-unified-font-item {
    background: var(--typost-bg-surface-alt);
    border: 1px solid var(--typost-border-default);
    border-radius: 6px;
    padding: 0;
    transition: box-shadow 0.2s;
    overflow: hidden;
}

.typost-unified-font-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typost-unified-font-item.ui-sortable-helper {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    opacity: 0.95;
}

.typost-unified-font-item.ui-sortable-placeholder {
    background: var(--typost-color-primary-focus);
    border: 2px dashed var(--typost-color-primary);
    visibility: visible !important;
}

.typost-drag-handle {
    /* Sits inside .typost-font-header flex row — naturally matches header height */
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--typost-text-muted);
    cursor: grab;
    border-right: 1px solid var(--typost-border-default);
    padding: 20px 10px;
    font-size: 16px;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s;
}

.typost-drag-handle:hover {
    opacity: 1;
    color: var(--typost-color-primary);
    background: var(--typost-bg-surface);
}

.typost-drag-handle:active {
    cursor: grabbing;
    opacity: 1;
}

.typost-unified-font-item .typost-font-card {
    border: none;
    background: transparent;
    padding: 0;
    min-width: 0;
}

.typost-unified-font-item .typost-font-card:hover {
    box-shadow: none;
}

/* ── Expand toggle button ─────────────────────────────────────────────── */
.typost-font-header {
    display: flex;
    align-items: center;
    padding: 0;
}

.typost-font-expand-toggle {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    text-align: left;
    color: inherit;
    flex: 1;
    min-width: 0;
}

.typost-font-expand-toggle:focus {
    outline: 2px solid var(--typost-color-primary);
    border-radius: 3px;
}

/* ▶ arrow — matches tab-help and feature-category style */
.typost-font-expand-toggle::before {
    content: '\25B6';
    display: inline-block;
    flex-shrink: 0;
    margin-right: 8px;
    font-size: var(--typost-font-size-label-small);
    color: var(--typost-text-muted);
    transition: transform 0.2s, color 0.15s;
}

.typost-font-expand-toggle[aria-expanded="true"]::before {
    transform: rotate(90deg);
}

.typost-font-expand-toggle:hover::before,
.typost-font-expand-toggle:focus::before {
    color: var(--typost-color-primary);
}

.typost-font-expand-toggle h4 {
    margin: 0;
    font-size: 22px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Expanded details panel ───────────────────────────────────────────── */
/* Explicit rule needed: display:flex would override the [hidden] attribute's display:none */
.typost-font-details[hidden] {
    display: none;
}

.typost-font-details {
    padding: 30px 30px;
    border-top: 1px solid var(--typost-border-default);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.typost-font-details .typost-form-field {
    margin-bottom: 0;
}

.typost-font-families-display {
    border-radius: 3px;
    margin: 10px 0 8px;
}

/* WP Library inline info */
.typost-wpl-manage-btn {
    margin: 0 20px 0 auto;
    flex-shrink: 0;
}

.typost-wpl-family {
    font-size: var(--typost-font-size-xs);
    color: #666;
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 8px;
    margin-left: 10px;
    flex-shrink: 0;
    font-family: monospace;
}

/* ── Type badges ─────────────────────────────────────────────────────── */
.typost-font-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    white-space: nowrap;
}

.typost-badge-uploaded {
    background: #d4edda;
    color: #155724;
}

.typost-badge-adobe {
    background: #cce5ff;
    color: #004085;
}

.typost-badge-manual {
    background: #fff3cd;
    color: #856404;
}

.typost-badge-wplibrary {
    background: #e2d9f3;
    color: #4a235a;
}

/* Dark mode badge overrides */
@media (prefers-color-scheme: dark) {
    .typost-badge-uploaded  { background: #1a3d24; color: #a3d9b1; }
    .typost-badge-adobe     { background: #0a2d4d; color: #90c8f6; }
    .typost-badge-manual    { background: #3d2d00; color: #ffd980; }
    .typost-badge-wplibrary { background: #2d1a3d; color: #c5a8e8; }
}

/* .typost-font-kit-label removed — kit name is no longer shown in the unified list */

/* Type badge right padding */
.typost-font-header .typost-font-type-badge {
    margin-right: 10px;
}

/* WP Library read-only card — h4 sits directly in header without a toggle button */
.typost-wpl-card h4 {
    font-size: 22px;
    font-weight: 400;
    margin: 0;
    flex: 1;
    padding: 10px 6px 10px 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Add Font section ────────────────────────────────────────────────── */
.typost-add-font-section {
    border: 1px solid var(--typost-border-default);
    border-radius: 6px;
    margin-top: 20px;
}

.typost-add-font-summary {
    padding: 12px 16px;
    font-weight: 700;
    font-size: var(--typost-font-size-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    -webkit-user-select: none;
    user-select: none;
}

.typost-add-font-summary::-webkit-details-marker {
    color: var(--typost-color-primary);
}

.typost-add-font-content {
    border-top: 1px solid var(--typost-border-default);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.typost-add-font-subsection {
    border-bottom: 1px solid var(--typost-border-default);
}

.typost-add-font-subsection:last-child {
    border-bottom: none;
}

.typost-add-font-subsection > summary {
    padding: 10px 0;
    font-weight: 600;
    cursor: pointer;
    color: var(--typost-color-primary);
    -webkit-user-select: none;
    user-select: none;
}

.typost-add-font-subsection > summary::-webkit-details-marker {
    color: var(--typost-text-muted);
}

.typost-add-font-subsection-body {
    padding: 12px 0 16px;
}

/* =========================================================================
   DEEP-LINK HIGHLIGHT ANIMATION
   ========================================================================= */
.typost-highlight-row {
    animation: typost-highlight-fade 3s ease-out;
}

@keyframes typost-highlight-fade {
    0% { background-color: var(--typost-color-highlight-bg); }
    70% { background-color: var(--typost-color-highlight-bg); }
    100% { background-color: transparent; }
}

/* =========================================================================
   REPLACEMENT FONTS TAB
   ========================================================================= */
.typost-add-replacement-section {
    margin-top: 30px;
    padding: 20px;
    background: var(--typost-bg-info);
    border: 1px solid var(--typost-border-default);
    border-radius: 6px;
}

.typost-add-replacement-section .typost-form-field {
    margin-bottom: 15px;
}

.typost-add-replacement-section .typost-message {
    margin-top: 10px;
}

/* =========================================================================
   SCHEME-AWARE SUPPLEMENTAL OVERRIDES
   WordPress core nav-tabs use hardcoded colors; override them for all
   custom color schemes so tabs match the chosen palette.
   ========================================================================= */
[data-color-scheme="alice-blue"] .nav-tab,
[data-color-scheme="admin-colors"] .nav-tab,
[data-color-scheme="dark"] .nav-tab,
[data-color-scheme="high-contrast"] .nav-tab {
    color: var(--typost-text-primary);
    background: var(--typost-bg-header);
    border-color: var(--typost-border-default);
}

[data-color-scheme="alice-blue"] .nav-tab:hover,
[data-color-scheme="admin-colors"] .nav-tab:hover,
[data-color-scheme="dark"] .nav-tab:hover,
[data-color-scheme="high-contrast"] .nav-tab:hover {
    background: var(--typost-bg-header-hover);
}

[data-color-scheme="alice-blue"] .nav-tab-active,
[data-color-scheme="admin-colors"] .nav-tab-active,
[data-color-scheme="dark"] .nav-tab-active,
[data-color-scheme="high-contrast"] .nav-tab-active {
    background: var(--typost-bg-page);
    border-bottom-color: var(--typost-bg-page);
    color: var(--typost-text-primary);
}

[data-color-scheme="alice-blue"] .nav-tab-active:hover,
[data-color-scheme="admin-colors"] .nav-tab-active:hover,
[data-color-scheme="dark"] .nav-tab-active:hover,
[data-color-scheme="high-contrast"] .nav-tab-active:hover {
    background: var(--typost-bg-page);
}

[data-color-scheme="dark"] .button {
    color: var(--typost-text-primary);
    border-color: var(--typost-border-default);
    background: var(--typost-bg-surface-alt);
}

[data-color-scheme="dark"] .button:hover {
    background: var(--typost-bg-header);
    border-color: var(--typost-border-strong);
    color: var(--typost-text-primary);
}

[data-color-scheme="dark"] .button-primary {
    background: var(--typost-color-primary);
    color: #0f1729;
    border-color: var(--typost-color-primary);
}

[data-color-scheme="dark"] .button-primary:hover {
    background: var(--typost-color-primary-dark);
    color: #0f1729;
    border-color: var(--typost-color-primary-dark);
}

/* High contrast: override WP default #2271b1 buttons (~4.6:1) with #0050a0 (~7.85:1 AAA) */
[data-color-scheme="high-contrast"] .button {
    color: var(--typost-color-primary);
    border-color: var(--typost-color-primary);
}

[data-color-scheme="high-contrast"] .button:hover {
    color: var(--typost-color-primary-dark);
    border-color: var(--typost-color-primary-dark);
}

[data-color-scheme="high-contrast"] .button-primary {
    background: var(--typost-color-primary);
    color: #fff;
    border-color: var(--typost-color-primary);
}

[data-color-scheme="high-contrast"] .button-primary:hover {
    background: var(--typost-color-primary-dark);
    color: #fff;
    border-color: var(--typost-color-primary-dark);
}

/* High contrast: override WP .description #646970 (5.5:1) to meet AAA 7:1 */
[data-color-scheme="high-contrast"] .description {
    color: var(--typost-text-secondary);
}

/* High contrast: override WP input borders #949494 (~3:1) with #222 (~18:1) */
[data-color-scheme="high-contrast"] input[type="text"],
[data-color-scheme="high-contrast"] input[type="url"],
[data-color-scheme="high-contrast"] input[type="email"],
[data-color-scheme="high-contrast"] textarea,
[data-color-scheme="high-contrast"] select {
    border-color: var(--typost-border-input);
}

[data-color-scheme="dark"] input[type="text"],
[data-color-scheme="dark"] input[type="url"],
[data-color-scheme="dark"] input[type="email"],
[data-color-scheme="dark"] textarea,
[data-color-scheme="dark"] select {
    background: var(--typost-bg-surface-alt);
    color: var(--typost-text-primary);
    border-color: var(--typost-border-default);
}

[data-color-scheme="dark"] select option {
    background: var(--typost-bg-surface-alt);
    color: var(--typost-text-primary);
}

[data-color-scheme="dark"] select option:checked {
    background: var(--typost-color-primary);
    color: #0f1729;
}

/* Override WP .wp-core-ui select:focus { color: #1e1e1e } */
[data-color-scheme="dark"] select:focus {
    color: var(--typost-text-primary);
}

[data-color-scheme="dark"] .form-table th {
    color: var(--typost-text-primary);
}

[data-color-scheme="dark"] .notice,
[data-color-scheme="dark"] .notice p {
    background: var(--typost-bg-surface-alt);
    border-color: var(--typost-border-default);
    color: var(--typost-text-primary);
}

[data-color-scheme="dark"] .notice-info {
    border-left-color: var(--typost-color-primary);
}

[data-color-scheme="dark"] .notice-success {
    border-left-color: #46b450;
}

[data-color-scheme="dark"] code {
    background: var(--typost-bg-code);
    color: var(--typost-text-primary);
}

[data-color-scheme="dark"] .description {
    color: var(--typost-text-secondary);
}
