/* ===========================================================================
   "Request a demo" — the pop-up (built by js/demo.js) and the form on
   request-demo.html. Uses the tokens from base.css.
   =========================================================================== */

/* ---------- Form ---------- */
.dm-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.1em 3em;
    font-family: var(--serif);
}
.dm-field { display: flex; flex-direction: column; gap: .55em; min-width: 0; }
.dm-field--wide, .dm-error, .dm-actions { grid-column: 1 / -1; }

.dm-field label {
    font-size: clamp(14px, 1.1vw, 16px);
    font-weight: 500;
    letter-spacing: .2em;
    font-variant-caps: all-small-caps;
    color: var(--muted);
    transition: color 250ms ease;
}
.dm-field input,
.dm-field select {
    width: 100%;
    margin: 0;
    padding: .3em 0 .38em;
    border: 0;
    border-bottom: 1px solid rgba(74, 12, 18, .26);
    border-radius: 0;
    background: transparent;
    font-family: var(--serif);
    font-size: clamp(19px, 1.45vw, 23px);
    font-weight:500;
    line-height: 1.3;
    color: var(--ink);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    transition: border-color 250ms ease, box-shadow 250ms ease;
}
.dm-field input::placeholder { font-style: italic; color: rgba(125, 103, 107, .55); }
.dm-field input:focus,
.dm-field select:focus {
    border-bottom-color: var(--accent);
    box-shadow: 0 1px 0 var(--accent);
}
.dm-field:focus-within label { color: var(--ink); }
.dm-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 40px var(--paper) inset;
    -webkit-text-fill-color: var(--ink);
}
.dm-field select {
    padding-right: 1.6em;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%234a0c12' stroke-width='1.1'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .2em center;
    background-size: .6em auto;
}
.dm-field select:invalid { color: rgba(125, 103, 107, .55); }
.dm-field select option { color: var(--ink); }

/* Missing / invalid answers after "Request a demo" is pressed */
.dm-field.is-invalid label { color: var(--accent); }
.dm-field.is-invalid label::after { content: ' — required'; font-style: italic; letter-spacing: .12em; }
.dm-field.is-invalid input,
.dm-field.is-invalid select { border-bottom-color: var(--accent); }

/* Honeypot field for bots — never shown */
.dm-hp {
    position: absolute !important;
    width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    white-space: nowrap; margin: 0;
}

.dm-error {
    margin: 0;
    font-size: clamp(17px, 1.25vw, 20px);
    font-style: italic; line-height: 1.5;
    color: var(--accent);
}
.dm-actions {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 1.2em 2.2em;
    margin-top: .6em;
}
.dm-actions .v2-pill:disabled { opacity: .55; cursor: default; background: transparent; color: var(--button); }
.dm-note {
    flex: 1 1 16em;
    margin: 0;
    font-size: clamp(15px, 1.05vw, 17px); line-height: 1.5;
    color: var(--muted);
}

.dm-lede {
    margin: 0; max-width: 30em;
    font-size: clamp(17px, 1.3vw, 21px); line-height: 1.6;
    color: var(--body); text-wrap: pretty;
}

/* ---------- Pop-up ---------- */
html.dm-locked { overflow: hidden; }

.dm-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 4vh 4vw;
    opacity: 0;
    transition: opacity 320ms ease;
}
.dm-modal[hidden] { display: none; }
.dm-modal.is-open { opacity: 1; }

.dm-backdrop {
    position: absolute; inset: 0;
    background: rgba(248, 242, 232, .78);  /* cream, see --paper */
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.dm-panel {
    position: relative;
    width: min(100%, 1080px);
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(40px, 6vh, 72px) clamp(28px, 5vw, 80px) clamp(40px, 6vh, 64px);
    background: var(--paper);
    border: 1px solid var(--rule);
    box-shadow: 0 30px 80px -30px rgba(74, 12, 18, .18);
    font-family: var(--serif);
    color: var(--ink);
    transform: translateY(14px);
    transition: transform 420ms cubic-bezier(.2, .7, .2, 1);
    outline: none;
}
.dm-modal.is-open .dm-panel { transform: none; }

.dm-close {
    position: absolute; top: clamp(14px, 2.4vh, 26px); right: clamp(14px, 2vw, 28px);
    display: inline-flex; align-items: center; gap: .6em;
    padding: .5em .4em;
    border: 0; background: none; cursor: pointer;
    font-family: var(--serif);
    color: var(--muted);
    transition: color 250ms ease;
}
.dm-close:hover, .dm-close:focus-visible { color: var(--ink); }
.dm-close__word { font-size: clamp(11px, .95vw, 14px); font-weight: 500; letter-spacing: .3em; }
.dm-close__x { font-size: 26px; font-weight:400; line-height: 1; }

.dm-view { display: flex; flex-direction: column; gap: clamp(32px, 5vh, 52px); }
.dm-view[hidden] { display: none; }
.dm-head { display: flex; flex-direction: column; gap: 1.6em; }
.dm-head .v2-marker .glyph { font-size: clamp(22px, 1.8vw, 30px); }
.dm-title { font-size: clamp(38px, 4vw, 64px); outline: none; }

.dm-thanks { gap: 1.8em; padding: 4vh 0 1vh; }

/* Wide screens: heading on the left, form on the right */
@media (min-width: 900px) {
    .dm-view[data-dm-form-view] {
        display: grid;
        grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
        gap: 4vw;
        align-items: start;
    }
    .dm-view[data-dm-form-view][hidden] { display: none; }
    .dm-head { padding-top: .2em; }
    .dm-panel .dm-form { padding-top: 2.6em; }
}

/* ---------- Phones: the pop-up fills the screen ---------- */
@media (max-width: 640px) {
    .dm-modal { padding: 0; }
    .dm-panel {
        width: 100%; height: 100%; max-height: none;
        border: 0; box-shadow: none;
        padding: 72px 22px 48px;
    }
    .dm-form { grid-template-columns: 1fr; gap: 1.8em; }
}

@media (prefers-reduced-motion: reduce) {
    .dm-modal, .dm-panel { transition: none; }
    .dm-panel { transform: none; }
}

/* ---------- request-demo.html / request-demo-thanks.html ---------- */
.rd-main {
    position: relative; z-index: 1;
    padding: 14vh var(--gutter) 22vh;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
    gap: 8vh 6vw;
    align-items: start;
}
.rd-intro { display: flex; flex-direction: column; gap: 2.2em; }
.rd-intro .v2-h1 { font-size: clamp(44px, 5.4vw, 92px); }
.rd-form-wrap { padding-top: 1.9em; border-top: 1px solid var(--rule); }
.rd-form-wrap .dm-form { margin-top: 2em; }

.rd-thanks {
    position: relative; z-index: 1;
    min-height: 70vh;
    padding: 14vh var(--gutter) 18vh;
    display: flex; flex-direction: column; justify-content: center; gap: 2.4em;
}
.rd-thanks .v2-h1 { font-size: clamp(44px, 5.4vw, 92px); }
