/* Shared HG-Hosting palette for the PetalUI storefront and client area. */
html:root {
    --theme-background: #f7f6f4;
    --theme-background-secondary: #ffffff;
    --theme-base: #212123;
    --theme-muted: #5f5e62;
    --theme-neutral: #d7d6d6;
    --theme-primary: #a63120;
    --theme-secondary: #7c2b1f;
    --theme-inverted: #fff;
    --theme-dark-background: #141415;
    --theme-dark-background-secondary: #19191b;
    --theme-dark-base: #ededee;
    --theme-dark-muted: #a9a9af;
    --theme-dark-neutral: #3c3c41;
    --theme-dark-primary: #ff8068;
    --theme-dark-secondary: #ffb09f;
    --theme-dark-inverted: #160b07;
}
html:root.dark,
html:root body[data-theme="dark"] {
    --theme-background: #141415;
    --theme-background-secondary: #19191b;
    --theme-base: #ededee;
    --theme-muted: #a9a9af;
    --theme-neutral: #3c3c41;
    --theme-primary: #ff8068;
    --theme-secondary: #ffb09f;
    --theme-inverted: #160b07;
}
html:root[data-theme="light"] {
    --theme-background: #fff;
    --theme-base: #211c19;
    --theme-muted: #5b5551;
    --theme-neutral: #d8d2cc;
    --hg-client-navigation: #fbf8f3;
}

html:root body {
    --hg-font-sans: Manrope, system-ui, sans-serif;
    --hg-font-display: var(--hg-font-sans);
    --theme-base-content: var(--theme-base);
    --font-sans: var(--hg-font-sans);
    --font-display: var(--hg-font-sans);
    --hg-store-width: 1280px;
    --hg-store-gutter: clamp(16px, 2.5vw, 32px);
    --hg-ui-ease: cubic-bezier(.22, 1, .36, 1);
    --petal-border: color-mix(in srgb, var(--theme-base) 12%, var(--theme-background-secondary));
    --petal-border-strong: var(--theme-neutral);
    --hg-surface-raised: color-mix(in srgb, var(--theme-background-secondary) 95%, var(--theme-base));
    --hg-banner-surface: var(--theme-background-secondary);
    --hg-banner-image: none;
    --hg-banner-ink: var(--theme-base);
    --hg-banner-action: var(--theme-primary);
    --hg-banner-action-ink: var(--theme-inverted);
    --petal-radius: 8px;
    --petal-radius-lg: 12px;
    --pf-radius: 12px;
    --petal-global-roundness: 8px;
    --pf-bg-light: #ffffff;
    --pf-bg-dark: #232325;
    --pf-text-light: #212123;
    --pf-text-dark: #ededee;
    --pf-label-light: #3f3f43;
    --pf-label-dark: #ededee;
    --pf-placeholder-light: #66666b;
    --pf-placeholder-dark: #a9a9af;
    --pf-border-light: #8e8e93;
    --pf-border-dark: #717177;
    --hg-control-border: var(--pf-border-light);
    --pf-focus-light: #a63120;
    --pf-focus-dark: #ff8068;
    --pf-checkbox-checked-light: #a63120;
    --pf-checkbox-checked-dark: #ff8068;
    --pf-toggle-on-light: #a63120;
    --pf-toggle-on-dark: #ff8068;
    background-color: var(--theme-background);
    color: var(--theme-base);
    font-family: var(--hg-font-sans);
}
html:root.dark body,
html:root body[data-theme="dark"] {
    --hg-control-border: var(--pf-border-dark);
    --theme-dark-background: #141415;
    --theme-dark-background-secondary: #19191b;
    --theme-dark-base: #ededee;
    --theme-dark-muted: #a9a9af;
    --theme-dark-neutral: #3c3c41;
    --theme-dark-primary: #ff8068;
    --theme-dark-secondary: #ffb09f;
    --theme-dark-inverted: #160b07;
}
html:root[data-hg-client-area][data-theme="dark"],
html:root body[data-hg-client-area][data-theme="dark"] {
    --theme-dark-background: var(--hg-client-dark-canvas, #131417);
    --theme-dark-background-secondary: #1b1c20;
    --theme-dark-base: #eff0f2;
    --theme-dark-muted: #b6b8c0;
    --theme-dark-neutral: #45474f;
    --theme-background: var(--theme-dark-background);
    --theme-background-secondary: var(--theme-dark-background-secondary);
    --theme-base: var(--theme-dark-base);
    --theme-muted: var(--theme-dark-muted);
    --theme-neutral: var(--theme-dark-neutral);
    --hg-client-navigation: #101113;
}
html:root body[data-hg-client-area][data-theme="dark"] {
    --petal-border: #33353c;
    --hg-surface-raised: #24262b;
    --pf-bg-dark: var(--hg-surface-raised);
    --pf-text-dark: var(--theme-base);
    --pf-label-dark: var(--theme-base);
    --pf-placeholder-dark: var(--theme-muted);
}
html body .hg-legal-footer { background: var(--theme-background); color: var(--theme-muted); }
html body .hg-legal-footer a { color: inherit; }

html body .petal-client-sidebar {
    background-color: var(--hg-client-navigation, var(--theme-background-secondary));
    border-color: var(--petal-border);
}

html:root[data-hg-client-area] .hgnav--mobile-only {
    --hgn-bg: var(--hg-client-navigation);
}

img[src$="/hgbox-cover.png"] { object-fit: contain; }

.hg-client-sidebar { display: none; }

@media (min-width: 1024px) {
    .hgnav.hgnav--mobile-only { display: none; }
    .petal-client-shell,
    body > .hg-legal-footer { margin-inline-start: var(--petal-sidebar-width, 0px); }
    .hg-client-sidebar {
        position: fixed;
        z-index: 30;
        inset-block: 0;
        inset-inline-start: 0;
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        width: var(--petal-sidebar-width);
        padding: 16px 12px;
        border-inline-end: 1px solid var(--petal-border);
    }
}

.hg-client-sidebar-header, .hg-client-sidebar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hg-client-sidebar-header {
    justify-content: space-between;
    flex-wrap: wrap;
    padding-bottom: 16px;
}
.hg-client-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: .875rem;
    font-weight: 600;
    color: var(--theme-base);
}
.hg-client-sidebar-brand img { max-width: 36px; object-fit: contain; }
.hg-client-sidebar-tools :is(.hg-client-sidebar-tool, .petal-nav-icon-button) {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--petal-border);
    border-radius: 8px;
    background: var(--hg-surface-raised);
    color: var(--theme-base);
    cursor: pointer;
    transition: background-color 150ms var(--hg-ui-ease), color 150ms var(--hg-ui-ease), border-color 150ms var(--hg-ui-ease);
}
.hg-client-sidebar-tools :is(.hg-client-sidebar-tool, .petal-nav-icon-button):hover,
.hg-client-sidebar-tools .petal-nav-icon-button[aria-expanded="true"] {
    border-color: var(--petal-border-strong);
    background: var(--hg-surface-raised);
    color: var(--theme-primary);
}
.hg-client-sidebar-tools button svg { width: 18px; height: 18px; fill: currentColor; }
.hg-client-sidebar-links {
    min-height: 0;
    display: grid;
    align-content: start;
    gap: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.hg-client-sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
    padding: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--theme-muted);
    font-size: .875rem;
    font-weight: 500;
    text-align: start;
    cursor: pointer;
    transition: background-color 150ms var(--hg-ui-ease), color 150ms var(--hg-ui-ease), border-color 150ms var(--hg-ui-ease);
}
.hg-client-sidebar-link > svg { flex: 0 0 18px; width: 18px; height: 18px; fill: currentColor; }
.hg-client-sidebar-link:hover { background: var(--hg-surface-raised); color: var(--theme-base); }
.hg-client-sidebar-link.is-active {
    border-color: var(--petal-border);
    background: var(--hg-surface-raised);
    color: var(--theme-primary);
}
html:root[data-theme="light"] .hg-client-sidebar-link.is-active {
    border-color: color-mix(in srgb, var(--theme-primary) 16%, var(--theme-background));
    background: color-mix(in srgb, var(--theme-primary) 7%, var(--theme-background));
}
.hg-client-sidebar :is(a, button, summary):focus-visible {
    outline: 2px solid var(--theme-primary);
    outline-offset: -2px;
}
.hg-client-sidebar-label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.hg-client-sidebar-children { padding-inline-start: 16px; }
.hg-client-sidebar-separator, .hg-client-sidebar-footer { border-top: 1px solid var(--petal-border); }
.hg-client-sidebar-separator { margin: 8px 0; }
.hg-client-sidebar-footer { display: grid; gap: 4px; padding-top: 8px; }
.hg-theme-toggle[aria-pressed="true"] {
    color: var(--theme-primary);
    border-color: var(--petal-border);
    background: var(--hg-surface-raised);
}
.hgnav .hg-theme-toggle { display: inline-grid; place-items: center; }
.hg-client-sidebar-account-panel { width: min(288px, calc(100vw - 24px)); }
.hg-client-sidebar-account-arrow { margin-inline-start: auto; }
.hg-client-sidebar-preferences { padding: 8px; border-block: 1px solid var(--petal-border); }
.hg-client-sidebar-preferences summary { cursor: pointer; color: var(--theme-muted); font-size: .8125rem; }
.hg-client-sidebar:not(.is-compact) .hg-client-sidebar-compact-label { display: none; }
.hg-client-sidebar.is-compact .hg-client-sidebar-label { display: none; }
.hg-client-sidebar.is-compact .hg-client-sidebar-header,
.hg-client-sidebar.is-compact .hg-client-sidebar-tools { justify-content: center; }
.hg-client-sidebar.is-compact .hg-client-sidebar-tools { flex-wrap: wrap; }
.hg-client-sidebar.is-compact .hg-client-sidebar-link { justify-content: center; padding-inline: 4px; }
