:root {
    --oryqelis-canvas: #faf8f5;
    --oryqelis-white: #fff;
    --oryqelis-peach: #f7eee6;
    --oryqelis-line: #ede6dc;
    --oryqelis-ink: #1f2a37;
    --oryqelis-muted: #6b5f55;
    --oryqelis-navy-hover: #19344f;
    --oryqelis-copper: #c2703d;
    --oryqelis-copper-text: #924a25;
    --oryqelis-shadow: 0 4px 20px rgba(120, 80, 40, .06);
}

.joomla-page {
    background-color: var(--oryqelis-canvas);
}

:is(.mastery-portal, .mastery-ls, .mastery-content-preview-page, .mastery-legal,
    .mastery-public-program, .mastery-catalog-showcase, .ory-workspace, .ory-login) {
    color: var(--oryqelis-ink);
    min-inline-size: 0;
}

:is(.mastery-portal, .mastery-ls, .mastery-content-preview-page, .mastery-legal,
    .mastery-public-program, .ory-workspace) :is(
    .mastery-portal__hero, .ls-hero, .mastery-legal-hero, .mastery-public-program__hero,
    .mastery-checkout__hero, .ory-workspace-home__welcome, .lesson-reader-nav) {
    background: linear-gradient(115deg, var(--oryqelis-peach), var(--oryqelis-canvas) 76%);
    border: 1px solid var(--oryqelis-line);
    border-radius: 12px;
}

:is(.mastery-portal, .mastery-ls, .mastery-content-preview-page, .mastery-legal, .ory-workspace) :is(
    .mastery-portal__grid > article, .mastery-portal__empty, .mastery-portal__form,
    .mastery-portal__table-wrap, .mastery-pricing__card, .mastery-checkout__summary,
    .mastery-checkout__payment, .ls-next-card, .ls-assessment, .mastery-lesson-reader,
    .mastery-legal-doc, .ory-workspace-home__card) {
    background-color: var(--oryqelis-white);
    border-color: var(--oryqelis-line);
    border-radius: 12px;
}

.mastery-catalog-showcase .mastery-catalog-card {
    border-color: var(--oryqelis-line);
    background: var(--oryqelis-white);
    box-shadow: var(--oryqelis-shadow);
}

:is(.mastery-portal, .mastery-content-preview-page, .mastery-legal, .ory-workspace, .atlas-lab)
:is(.mastery-portal__hero, .mastery-legal-hero, .atlas-welcome, .ory-workspace-home__welcome)
:is(h1, h2) {
    color: var(--oryqelis-navy-hover);
    overflow-wrap: anywhere;
}

/* Existing contrast and branding rules use !important on controls. */
:is(.mastery-portal, .mastery-content-preview-page, .mastery-ls, .ory-workspace,
    .mastery-catalog-showcase, .mastery-public-program, .mastery-legal, .ory-login,
    .mastery-activation)
:is(button, .ls-button, .mastery-button, .mastery-action-link, .mastery-catalog-action,
    .mastery-pricing__cta, .mastery-activation__primary, .mastery-activation__secondary,
    .mastery-portal__actions a, .mastery-guide-card a, .mastery-progress-panel a):not(.ory-learning-nav a, .mastery-checkout__payment *, .mastery-editor-toolbar *,
    .mastery-checkout__paypal-button, .mastery-checkout__paypal-start) {
    background: var(--ory-control-bg, #fff) !important;
    color: var(--ory-control-ink, #244363) !important;
    -webkit-text-fill-color: currentColor !important;
    border: 1px solid var(--ory-control-line, #d6c4b4) !important;
    border-radius: 10px;
    box-shadow: none;
    text-shadow: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

:is(.mastery-portal, .mastery-content-preview-page, .mastery-ls, .ory-workspace,
    .mastery-catalog-showcase, .mastery-public-program, .mastery-legal, .ory-login,
    .mastery-activation)
:is(button, .ls-button, .mastery-button, .mastery-action-link, .mastery-catalog-action,
    .mastery-pricing__cta, .mastery-activation__primary, .mastery-activation__secondary,
    .mastery-portal__actions a, .mastery-guide-card a, .mastery-progress-panel a):not(.ory-learning-nav a, .mastery-checkout__payment *, .mastery-editor-toolbar *,
    .mastery-checkout__paypal-button, .mastery-checkout__paypal-start, :disabled):hover {
    background: var(--ory-control-hover, #f7eee6) !important;
    filter: none;
}

:is(.mastery-portal, .mastery-content-preview-page, .mastery-ls, .ory-workspace,
    .mastery-catalog-showcase, .mastery-public-program, .ory-login, .mastery-activation)
:is(.ls-button, .atlas-button, .mastery-guide-send, .mastery-catalog-action,
    .mastery-pricing__cta, .mastery-activation__primary, .ory-help form button[type="submit"],
    .ory-login__form button[type="submit"], .mastery-attempt-form button[type="submit"],
    .mastery-signup-form button[type="submit"], form[action*="guide.newconversation"] > button) {
    --ory-control-bg: #f3e3d5;
    --ory-control-line: #d8b69d;
    --ory-control-ink: #5b3020;
    --ory-control-hover: #ecd5c2;
    min-block-size: 44px;
}

.mastery-portal .mastery-guide-toolbar,
.mastery-portal .mastery-guide-actions {
    gap: .5rem;
}

.mastery-portal :is(.mastery-guide-toolbar, .mastery-guide-actions) button {
    min-block-size: 44px;
    padding: .52rem .85rem;
    font-weight: 600;
}

.mastery-portal .mastery-guide-history > summary {
    padding: .52rem .85rem;
    min-block-size: 44px;
    border: 1px solid #d6c4b4;
    border-radius: 10px;
    background: #fff;
    color: #244363;
}

:is(.mastery-portal, .mastery-ls, .mastery-content-preview-page, .mastery-catalog-showcase)
.ory-help button.ory-help-more {
    --ory-control-bg: transparent;
    --ory-control-line: transparent;
    --ory-control-ink: #924a25;
    --ory-control-hover: #fbf4ec;
    padding-inline: .6rem;
    text-decoration: none;
    font-weight: 600;
}

:is(.mastery-portal, .mastery-content-preview-page, .mastery-ls, .ory-workspace)
:is(.mastery-danger, .btn-danger, form[action*="guide.delete"] > button) {
    --ory-control-bg: #fff;
    --ory-control-line: #e3c3bc;
    --ory-control-ink: #843c34;
    --ory-control-hover: #fbefeb;
}

:is(.mastery-portal, .mastery-content-preview-page, .mastery-ls, .ory-workspace,
    .mastery-catalog-showcase, .mastery-public-program, .mastery-legal, .ory-login)
button:disabled:not(.mastery-checkout__payment *, .mastery-editor-toolbar *) {
    --ory-control-bg: #f1efec;
    --ory-control-line: #e2ddd7;
    --ory-control-ink: #68615b;
    opacity: 1 !important;
    cursor: not-allowed;
}

.atlas-lab .atlas-practice > summary {
    background: var(--oryqelis-peach);
    color: var(--oryqelis-navy-hover);
}

:is(.mastery-portal, .mastery-ls, .mastery-content-preview-page, .mastery-legal,
    .mastery-public-program, .mastery-catalog-showcase, .ory-workspace, .ory-login)
:is(a, button, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--oryqelis-copper);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    :is(.mastery-guide-toolbar, .mastery-guide-actions, .ory-workspace-home__utilities) {
        flex-wrap: wrap;
    }

    :is(.mastery-guide-toolbar, .mastery-guide-actions, .ory-workspace-home__utilities)
    :is(button, summary, a) {
        min-block-size: 44px;
        max-inline-size: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

