/**
 * Frontend Styles for Headline Ligatures & Styles
 * Ensures OpenType features render correctly on the frontend
 */

/* Base styling for elements with typography features */
.typost-styled {
    /* Features are applied via inline styles */
    /* This class ensures proper rendering */
    font-variant-ligatures: normal;
    -webkit-font-feature-settings: inherit;
    -moz-font-feature-settings: inherit;
    font-feature-settings: inherit;
}

/* Ensure text rendering is optimal for OpenType features */
h1 .typost-styled,
h2 .typost-styled,
h3 .typost-styled,
h4 .typost-styled,
h5 .typost-styled,
h6 .typost-styled {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent features from being disabled by normalize/reset */
.typost-styled * {
    font-feature-settings: inherit;
}

/* Print styles - ensure features are preserved */
@media print {
    .typost-styled {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/**
 * Helper classes for common feature combinations
 * These can be used programmatically or in custom CSS
 */

/* Standard ligatures */
.typost-liga {
    font-feature-settings: "liga" 1;
}

/* Discretionary ligatures */
.typost-dlig {
    font-feature-settings: "dlig" 1;
}

/* Contextual alternates */
.typost-calt {
    font-feature-settings: "calt" 1;
}

/* Contextual alternates + standard ligatures */
.typost-liga-calt {
    font-feature-settings: "liga" 1, "calt" 1;
}

/* Swashes */
.typost-swsh {
    font-feature-settings: "swsh" 1;
}

/* Contextual swashes */
.typost-cswh {
    font-feature-settings: "cswh" 1;
}

/* Stylistic alternates */
.typost-salt {
    font-feature-settings: "salt" 1;
}

/* Titling forms */
.typost-titl {
    font-feature-settings: "titl" 1;
}

/* Ornaments */
.typost-ornm {
    font-feature-settings: "ornm" 1;
}

/* Stylistic sets */
.typost-ss01 { font-feature-settings: "ss01" 1; }
.typost-ss02 { font-feature-settings: "ss02" 1; }
.typost-ss03 { font-feature-settings: "ss03" 1; }
.typost-ss04 { font-feature-settings: "ss04" 1; }
.typost-ss05 { font-feature-settings: "ss05" 1; }
.typost-ss06 { font-feature-settings: "ss06" 1; }
.typost-ss07 { font-feature-settings: "ss07" 1; }
.typost-ss08 { font-feature-settings: "ss08" 1; }
.typost-ss09 { font-feature-settings: "ss09" 1; }
.typost-ss10 { font-feature-settings: "ss10" 1; }
.typost-ss11 { font-feature-settings: "ss11" 1; }
.typost-ss12 { font-feature-settings: "ss12" 1; }
.typost-ss13 { font-feature-settings: "ss13" 1; }
.typost-ss14 { font-feature-settings: "ss14" 1; }
.typost-ss15 { font-feature-settings: "ss15" 1; }
.typost-ss16 { font-feature-settings: "ss16" 1; }
.typost-ss17 { font-feature-settings: "ss17" 1; }
.typost-ss18 { font-feature-settings: "ss18" 1; }
.typost-ss19 { font-feature-settings: "ss19" 1; }
.typost-ss20 { font-feature-settings: "ss20" 1; }

/**
 * Preset combinations based on default presets
 */

/* Elegant Script: calt + ss02 */
.typost-preset-elegant-script {
    font-feature-settings: "calt" 1, "ss02" 1;
}

/* Wedding Style: calt + ss02 + swsh */
.typost-preset-wedding-style {
    font-feature-settings: "calt" 1, "ss02" 1, "swsh" 1;
}

/* Vintage Ornate: calt + dlig + ss01 */
.typost-preset-vintage-ornate {
    font-feature-settings: "calt" 1, "dlig" 1, "ss01" 1;
}

/* Modern Clean: liga + calt */
.typost-preset-modern-clean {
    font-feature-settings: "liga" 1, "calt" 1;
}

/* Full Swash: calt + swsh + cswh + salt */
.typost-preset-full-swash {
    font-feature-settings: "calt" 1, "swsh" 1, "cswh" 1, "salt" 1;
}

/**
 * Accessibility - ensure features don't break screen readers
 */
.typost-styled {
    /* Preserve text content for screen readers */
    speak: normal;
}

/**
 * Performance optimization
 * Use will-change for animated text with features
 */
.typost-styled.typost-animated {
    will-change: font-feature-settings;
}

/**
 * Browser-specific fixes
 */

/* Firefox */
@-moz-document url-prefix() {
    .typost-styled {
        -moz-font-feature-settings: inherit;
    }
}

/* Safari */
@supports (-webkit-appearance: none) {
    .typost-styled {
        -webkit-font-feature-settings: inherit;
    }
}

/* Edge legacy */
@supports (-ms-ime-align: auto) {
    .typost-styled {
        -ms-font-feature-settings: inherit;
    }
}
