/* static/css/request-demo.css
 *
 * (demo-form redesign 2026-08-26) Page-scoped skin for /request-demo. Every rule is gated on
 * `.bim-demo[data-skin="modern"]`, which comes from the one attribute on the wrapper div in
 * templates/request_demo.html -- delete that attribute and the page falls back to unstyled
 * markup with no CSS change. That is the home skin's contract (templates/home.html:6-8,
 * styles.css:8851-8856), and this is the second surface to adopt it.
 * `tests/test_request_demo_skin_scope.py` fails if any rule here escapes the gate.
 *
 * Deliberately a separate sheet, not another block on the end of styles.css: that file is
 * 9,088 lines / 261,938 bytes and is parsed on every page view, and asset_url() gives this one
 * the same mtime+size cache-bust as the rest. Precedent for a page-scoped sheet in
 * {% block head %}: templates/account.html:5-7, templates/business_domain_form.html:6-8.
 *
 * TOKENS, NOT LITERALS. Every colour that differs between themes is declared once on the gate
 * below and overridden once in the dark block beneath it. The first draft of this sheet carried
 * 70 colour literals and no custom property, which meant every dark value existed twice -- so a
 * future token change would update the home skin and silently leave this page behind. Values are
 * lifted from the home block in styles.css (radii :8952/:9011, the shadow pair :8954, the dark
 * card triple :8978-8980, #163B8E :8873) so the two pages are one design.
 *
 * Both dark-mode conventions are carried because the app really emits both:
 * static/js/theme-init.js adds `dark` to <html> AND `dark-mode` to <body>, and account.js's
 * toggle writes the same pair. Dropping either would be the defect.
 */

.bim-demo[data-skin="modern"] {
    --bim-demo-card-bg: #fff;
    --bim-demo-card-border: rgba(15, 23, 42, .09);
    --bim-demo-card-shadow: 0 1px 2px rgba(11, 26, 63, .05), 0 14px 34px rgba(11, 26, 63, .07);
    --bim-demo-field-bg: #fff;
    /* .34 rather than the .14 this sheet first shipped: at .14 the control boundary measured
       1.31:1 against the card, and WCAG 2.2 SC 1.4.11 wants 3:1 for the visual boundary of a
       user-interface component. */
    --bim-demo-field-border: rgba(15, 23, 42, .34);
    --bim-demo-field-text: #111827;
    --bim-demo-label: #374151;
    --bim-demo-muted: #6b7280;
    --bim-demo-error: #b91c1c;
    --bim-demo-notice: #4b5563;
    --bim-demo-accent: #4c7ae0;
    --bim-demo-accent-mid: #2f56b3;
    --bim-demo-chip-bg: #fff;
    --bim-demo-chip-on-bg: #dbeafe;
    --bim-demo-chip-on-text: #1d4ed8;
    --bim-demo-chip-on-border: #60a5fa;
    --bim-demo-panel-bg: #f9fafb;
    --bim-demo-panel-tint: linear-gradient(135deg, rgba(22, 59, 142, .05), rgba(143, 169, 232, .10));
    --bim-demo-popup-shadow: 0 18px 44px rgba(11, 26, 63, .18);
    --bim-demo-option-hover: rgba(76, 122, 224, .14);
}

.dark .bim-demo[data-skin="modern"],
body.dark-mode .bim-demo[data-skin="modern"] {
    --bim-demo-card-bg: #131c2e;
    --bim-demo-card-border: rgba(255, 255, 255, .10);
    --bim-demo-card-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .42);
    --bim-demo-field-bg: #0f172a;
    --bim-demo-field-border: rgba(255, 255, 255, .34);
    --bim-demo-field-text: #f3f4f6;
    --bim-demo-label: #d1d5db;
    --bim-demo-muted: #9ca3af;
    --bim-demo-error: #f87171;
    --bim-demo-notice: #9ca3af;
    --bim-demo-chip-bg: #0f172a;
    /* The light pair inverted rather than inherited: leaving --bim-demo-chip-on-text at #1d4ed8
       over a dark surface measured 1.21:1, a WCAG 1.4.3 failure, because the .dark option rule
       wins on specificity for `color` while the selected background survives. */
    --bim-demo-chip-on-bg: rgba(76, 122, 224, .22);
    --bim-demo-chip-on-text: #dbeafe;
    --bim-demo-chip-on-border: #4c7ae0;
    --bim-demo-panel-bg: #1f2937;
    --bim-demo-panel-tint: linear-gradient(135deg, rgba(47, 86, 179, .14), rgba(19, 28, 46, .6));
    --bim-demo-popup-shadow: 0 18px 44px rgba(0, 0, 0, .55);
}

.bim-demo[data-skin="modern"] .bim-demo__shell {
    /* A deliberate departure from --bim-page-shell-max (styles.css:448-463, "single source of
       truth for the body max width"): that token is min(1600px, ...) for full-bleed app pages,
       and this is a two-column form that reads badly wider than ~1120px. */
    max-width: 1120px;
    padding-top: clamp(24px, 3.4vw, 52px);
    padding-bottom: clamp(28px, 4vw, 60px);
}

.bim-demo[data-skin="modern"] .bim-demo__title {
    font-size: clamp(28px, 3.2vw, 40px);
    font-weight: 650;
    letter-spacing: -.022em;
    line-height: 1.08;
    text-align: center;
    margin-bottom: clamp(18px, 2.2vw, 28px);
}

.bim-demo[data-skin="modern"] .bim-demo__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(20px, 2.4vw, 34px);
    align-items: start;
}

/* One column until there is room for the panel to sit beside the form rather than under it.
   1024px matches Tailwind's `lg`, which the rest of the app breaks at (tailwind.config.js
   overrides only `colors`, so the default screens are in force). */
@media (min-width: 1024px) {
    .bim-demo[data-skin="modern"] .bim-demo__grid {
        grid-template-columns: 7fr 5fr;
    }
}

/* Form card ---------------------------------------------------------------- */
.bim-demo[data-skin="modern"] .bim-demo__card {
    background: var(--bim-demo-card-bg);
    border: 1px solid var(--bim-demo-card-border);
    border-radius: 16px;
    padding: clamp(20px, 2.3vw, 30px);
    box-shadow: var(--bim-demo-card-shadow);
}

.bim-demo[data-skin="modern"] .bim-demo__row {
    margin-bottom: 16px;
}

.bim-demo[data-skin="modern"] .bim-demo__row--split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 640px) {
    .bim-demo[data-skin="modern"] .bim-demo__row--split {
        grid-template-columns: 1fr 1fr;
    }
}

/* Fields ------------------------------------------------------------------- */
.bim-demo[data-skin="modern"] .bim-demo__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -.006em;
    margin-bottom: 6px;
    color: var(--bim-demo-label);
}

.bim-demo[data-skin="modern"] .bim-demo__label--sub {
    font-size: 12px;
    font-weight: 500;
    color: var(--bim-demo-muted);
}

/* No placeholders anywhere on this form: every field carries a visible label, and a grey hint
   inside the box is one more thing to read past. */
.bim-demo[data-skin="modern"] .bim-demo__input {
    width: 100%;
    padding: 11px 13px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--bim-demo-field-text);
    background: var(--bim-demo-field-bg);
    border: 1px solid var(--bim-demo-field-border);
    border-radius: 10px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

/* The ring is ADDED to the app-wide focus outline, never in place of it. An earlier draft set
   `outline: none` here, which deleted the indicator styles.css:367-383 scopes to this form via
   --request-demo-focus-color -- including on the submit control, which is an <input type=submit>
   and therefore still matches `.request-demo-form input:focus`. */
.bim-demo[data-skin="modern"] .bim-demo__input:focus {
    border-color: var(--bim-demo-accent);
    box-shadow: 0 0 0 3px rgba(76, 122, 224, .20);
}

.bim-demo[data-skin="modern"] .bim-demo__select {
    /* Keeps the native chevron: the old w-1/3 appearance-none selector read as a pre-filled
       text box, which is why visitors left it on the default and submitted undiallable
       numbers. Anything that replaces this control must keep an equivalent affordance. */
    padding-right: 10px;
}

/* The country filter sits BELOW the native <select> it narrows -- the control first, the aid
   under it -- so it needs a top margin rather than a bottom one, and a quieter size than the
   control itself. */
.bim-demo[data-skin="modern"] .bim-demo__country-filter {
    margin-top: 2px;
    font-size: 14px;
}

.bim-demo[data-skin="modern"] .bim-demo__textarea {
    min-height: 96px;
    line-height: 1.5;
    resize: vertical;
}

.bim-demo[data-skin="modern"] .bim-demo__phone {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

/* flex-basis rather than a media query: the two controls sit side by side while there is room
   for both and stack when there is not, at any container width. */
.bim-demo[data-skin="modern"] .bim-demo__country {
    position: relative;
    flex: 1 1 200px;
    min-width: 0;
}

.bim-demo[data-skin="modern"] .bim-demo__number {
    flex: 2 1 250px;
    min-width: 0;
}

.bim-demo[data-skin="modern"] .bim-demo__meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 6px;
}

.bim-demo[data-skin="modern"] .bim-demo__hint,
.bim-demo[data-skin="modern"] .bim-demo__count {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--bim-demo-muted);
}

/* The counter shares --bim-demo-muted rather than carrying its own lighter grey: at #9ca3af it
   measured 2.54:1 on the light card, below SC 1.4.3's 4.5:1 for body text. */
.bim-demo[data-skin="modern"] .bim-demo__count {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bim-demo[data-skin="modern"] #phone_number-preview:empty {
    display: none;
}

.bim-demo[data-skin="modern"] .bim-demo__error {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--bim-demo-error);
}

.bim-demo[data-skin="modern"] .bim-demo__input[aria-invalid="true"] {
    border-color: #dc2626;
}

/* Source chips ------------------------------------------------------------- */
.bim-demo[data-skin="modern"] .bim-demo__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

/* Without this the `hidden` attribute on the container is inert: `display: flex` above is
   specificity (0,3,0) and Tailwind preflight's `[hidden]` rule is (0,1,0), so a scripting-off
   visitor would get an empty flex box with a bottom margin. */
.bim-demo[data-skin="modern"] .bim-demo__chips[hidden] {
    display: none;
}

.bim-demo[data-skin="modern"] .bim-demo__chip {
    padding: 8px 13px;
    font-size: 13.5px;
    line-height: 1.15;
    border-radius: 999px;
    border: 1px solid var(--bim-demo-field-border);
    background: var(--bim-demo-chip-bg);
    color: var(--bim-demo-label);
    cursor: pointer;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.bim-demo[data-skin="modern"] .bim-demo__chip:hover {
    border-color: var(--bim-demo-accent);
}

.bim-demo[data-skin="modern"] .bim-demo__chip[aria-checked="true"],
.bim-demo[data-skin="modern"] .bim-demo__chip[aria-pressed="true"] {
    background: var(--bim-demo-chip-on-bg);
    border-color: var(--bim-demo-chip-on-border);
    color: var(--bim-demo-chip-on-text);
}

/* Country combobox --------------------------------------------------------- */
.bim-demo[data-skin="modern"] .bim-demo__listbox {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 264px;
    overflow-y: auto;
    background: var(--bim-demo-card-bg);
    border: 1px solid var(--bim-demo-card-border);
    border-radius: 12px;
    box-shadow: var(--bim-demo-popup-shadow);
}

.bim-demo[data-skin="modern"] .bim-demo__option {
    padding: 7px 9px;
    font-size: 13.5px;
    border-radius: 8px;
    color: var(--bim-demo-label);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bim-demo[data-skin="modern"] .bim-demo__option:hover,
.bim-demo[data-skin="modern"] .bim-demo__option[data-active="true"] {
    background: var(--bim-demo-option-hover);
}

/* Both properties come from the same token pair, so the selected row cannot end up with a light
   background and a light foreground the way an inherited-colour version did. */
.bim-demo[data-skin="modern"] .bim-demo__option[aria-selected="true"] {
    background: var(--bim-demo-chip-on-bg);
    color: var(--bim-demo-chip-on-text);
}

.bim-demo[data-skin="modern"] .bim-demo__option--empty {
    color: var(--bim-demo-muted);
    cursor: default;
}

/* Draft notice ------------------------------------------------------------- */
.bim-demo[data-skin="modern"] .bim-demo__draft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 14px;
    font-size: 13px;
    border: 1px solid var(--bim-demo-card-border);
    border-radius: 12px;
    color: var(--bim-demo-notice);
}

.bim-demo[data-skin="modern"] .bim-demo__draft button {
    background: transparent;
    border: 0;
    padding: 2px 4px;
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    color: inherit;
    cursor: pointer;
}

/* Submit ------------------------------------------------------------------- */
/* Geometry and type lifted verbatim from .bim-home__button (styles.css:8923-8933) so the parity
   claim in this file's header is true of the control a visitor actually clicks. `btn-primary`
   still supplies the background from --primary-color, so the colour pins are untouched. */
.bim-demo[data-skin="modern"] .bim-demo__submit {
    border: 0;
    border-radius: 12px;
    padding: 13px 22px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -.005em;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(4, 12, 34, .26);
    transition: transform .22s cubic-bezier(.16, 1, .3, 1),
                box-shadow .26s ease,
                background-color .26s ease;
}

.bim-demo[data-skin="modern"] .bim-demo__submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(4, 12, 34, .32);
}

.bim-demo[data-skin="modern"] .bim-demo__submit:active {
    transform: translateY(0);
}

.bim-demo[data-skin="modern"] .bim-demo__notice {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 18px;
    color: var(--bim-demo-notice);
    text-wrap: pretty;
}

.bim-demo[data-skin="modern"] .bim-demo__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Side panel --------------------------------------------------------------- */
/* Surface colour and tint are separate properties so the tint survives the dark surface,
   the same way the home tagline panel does it. */
.bim-demo[data-skin="modern"] .bim-demo__aside {
    background-color: var(--bim-demo-panel-bg);
    background-image: var(--bim-demo-panel-tint);
    border: 1px solid var(--bim-demo-card-border);
    border-radius: 18px;
    padding: clamp(22px, 2.4vw, 32px);
}

.bim-demo[data-skin="modern"] .bim-demo__aside-title {
    font-size: clamp(17px, 1.9vw, 20px);
    font-weight: 650;
    letter-spacing: -.018em;
    margin-bottom: 16px;
}

.bim-demo[data-skin="modern"] .bim-demo__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 17px;
}

.bim-demo[data-skin="modern"] .bim-demo__steps li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--bim-demo-label);
    text-wrap: pretty;
}

/* Solid fill + white numeral: one treatment that holds up on both the light and the dark
   surface, so the step markers never wash out. */
.bim-demo[data-skin="modern"] .bim-demo__step-num {
    flex: 0 0 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--bim-demo-accent-mid);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Deliberately NOT listing .bim-demo__input or .bim-demo__submit here.
   Every <input> on this form -- the submit control included, since SubmitField renders
   <input type="submit"> -- already receives the app-wide ring through
   `input:focus { outline: 2px solid var(--primary-color); outline-offset: 2px }` refined by
   `.request-demo-form input:focus { outline-color: var(--request-demo-focus-color) }`
   (styles.css:367-383), which is themed for this form's dark panel. Adding a competing
   :focus-visible rule here would out-specify that and give this one page a different focus
   colour and offset from the rest of the app for no gain.
   What this rule DOES cover is the elements that block has no reach over: the source chips and
   the draft's "Start over" control (<button>) and the privacy link (<a>). */
.bim-demo[data-skin="modern"] a:focus-visible,
.bim-demo[data-skin="modern"] button:focus-visible {
    outline: 2px solid var(--bim-demo-accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .bim-demo[data-skin="modern"] .bim-demo__submit,
    .bim-demo[data-skin="modern"] .bim-demo__chip,
    .bim-demo[data-skin="modern"] .bim-demo__input {
        transition: none;
    }
    .bim-demo[data-skin="modern"] .bim-demo__submit:hover {
        transform: none;
    }
}
