/*
 * CataLord - the contact page layer.
 *
 * Loads on page-contact.php only, ON TOP of the KB layer, which is where the
 * panel (.rdk-sheet), the rail (.rdk-rail__*) and the mono label voice already
 * live. This file adds the one thing the system did not have yet: a FORM.
 *
 * ═══════════════════════════════════════════════════════════════════════
 * A FORM IS A RECORD BEING FILLED IN
 * ═══════════════════════════════════════════════════════════════════════
 * Which is the object this whole design is a drawing of, so almost nothing
 * here is invented. The field is `.rdl-find__input` from the knowledge base
 * search at a larger size: white, square, hairline-ruled, mono, and emerald
 * only while it is the thing being acted on. The labels are the page's
 * standing label voice. The button is `.rd-btn--primary`, unchanged.
 *
 * The rows are RULED rather than spaced. A stack of floating fields is the
 * convention this design exists to leave, and a ruled register is also the
 * more honest drawing: these fields are one record, not five widgets.
 *
 * ═══════════════════════════════════════════════════════════════════════
 * WHY THE LABELS ARE NOT PLACEHOLDERS
 * ═══════════════════════════════════════════════════════════════════════
 * A placeholder disappears the moment somebody types, so the one person who
 * most needs the label - somebody interrupted halfway through - is the one it
 * abandons. Every field here has a real <label> with a `for`, and the
 * placeholder is used only where it adds something the label cannot say.
 */

/* ------------------------------------------------------------ the columns */

.rdc-cols {
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
}

.rdc-formwrap {
    grid-column: 1 / span 7;
    min-width: 0;
    padding: calc(var(--row) * 0.85) 16px calc(var(--row) * 1.15);
}

/* Same single vertical rule the KB article's rail owns - see the note there.
   Repeated rather than shared because the two panels have different children
   and a joint selector would have to know about both. */
.rdc-rail {
    grid-column: 9 / span 4;
    min-width: 0;
    padding: calc(var(--row) * 0.85) 16px calc(var(--row) * 1.15);
    border-left: 1px solid var(--rule);
}

.rdc-rail__note {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--graphite);
}

/* ------------------------------------------------------------- the record */

.rdc-row {
    padding-block: 18px;
    border-top: 1px solid var(--rule);
}

/* The first row's rule would double the panel edge above it. */
.rdc-row:first-of-type { border-top: 0; padding-top: 0; }

.rdc-label {
    display: block;
    margin-bottom: 9px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--graphite);
}

/* "optional" is a fact about the field, so it rides in the label rather than
   below it - and it is set apart by WEIGHT, not by another colour. */
.rdc-opt {
    margin-inline-start: 8px;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--graphite);
    opacity: 0.75;
}

.rdc-input {
    width: 100%;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--rule-ink);
    border-radius: 0;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--ink);
    -webkit-appearance: none;
    appearance: none;
}

.rdc-input::placeholder { color: var(--graphite); opacity: 1; }

/* --signal-ink, not --signal: emerald against a white field measures 2.64:1
   and a focus indicator owes 3:1. Same hue, still reads as "being acted on".
   The inset shadow doubles the edge rather than growing the box, so nothing
   below the field moves when focus lands. */
.rdc-input:focus {
    outline: none;
    border-color: var(--signal-ink);
    box-shadow: inset 0 0 0 1px var(--signal-ink);
}

/* The browser's own invalid styling fires before anybody has finished typing.
   :user-invalid waits until the field has been interacted with and left. */
.rdc-input:user-invalid {
    border-color: #C4392C;
    box-shadow: inset 0 0 0 1px #C4392C;
}

.rdc-textarea {
    resize: vertical;
    min-height: 190px;
    font-family: var(--sans);
    font-size: 14.5px;
    line-height: 1.65;
}

/* A native select keeps the platform's own picker, which on a phone is far
   better than anything we would build. Only the chevron is ours. */
.rdc-select { position: relative; }

.rdc-select::after {
    content: "";
    position: absolute;
    inset-inline-end: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -6px;
    border-right: 1.5px solid var(--graphite);
    border-bottom: 1.5px solid var(--graphite);
    transform: rotate(45deg);
    pointer-events: none;
}

.rdc-select .rdc-input { padding-inline-end: 38px; }

.rdc-hint {
    margin: 8px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--graphite);
}

/* --------------------------------------------------------------- the send */

.rdc-send {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 20px;
    padding-top: 22px;
    border-top: 1px solid var(--rule);
}

.rdc-fine {
    margin: 0;
    font-size: 12.5px;
    color: var(--graphite);
}

.rdc-fine a { color: var(--signal-ink); }

/* -------------------------------------------------------------- the reply */
/*
 * The result of sending. A LEADING EDGE rather than a wash: the panel it sits
 * on is white and a full-bleed tint would read as a new surface. The word in
 * the tag carries the meaning on its own, so the colour is confirmation and
 * never the only signal.
 */
.rdc-note {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    margin: 0 0 26px;
    padding: 14px 16px;
    border: 1px solid var(--rule);
    border-inline-start: 3px solid var(--graphite);
    background: #F7F9F8;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--ink);
}

.rdc-note__tag {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--graphite);
}

.rdc-note--ok { border-inline-start-color: var(--signal); }
.rdc-note--ok .rdc-note__tag { color: var(--signal-ink); }

.rdc-note--bad { border-inline-start-color: #C4392C; }
.rdc-note--bad .rdc-note__tag { color: #9B2C21; }

/* ------------------------------------------------------------- the honeypot */
/*
 * Off-screen, not `display:none` and not `hidden`. A bot that parses the form
 * skips anything the CSS has removed from the flow and fills what is left, so
 * a field that is technically present and visually absent is the one that
 * catches it. `aria-hidden` on the wrapper keeps it out of the accessibility
 * tree, and `tabindex=-1` in the markup keeps it out of the tab order.
 */
.rdc-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ------------------------------------------------------- the legal page */
/*
 * page-legal.php reuses .rdk-prose wholesale. All it needs is the padding the
 * KB article gets from .rdk-main, which it does not use because it has no rail.
 */
.rdg-body {
    padding: calc(var(--row) * 0.85) 16px calc(var(--row) * 1.15);
}

.rdg-body .rdk-prose { max-width: 68ch; }

/* ------------------------------------------------------------------ narrow */

@media (max-width: 900px) {
    .rdc-formwrap,
    .rdc-rail {
        grid-column: 1 / -1;
    }

    /* The rule moves from the side to the top, because the columns have. */
    .rdc-rail {
        border-left: 0;
        border-top: 1px solid var(--rule);
    }

    /* iOS zooms the viewport in on focus for any field under 16px. Raising the
       size is the fix; disabling zoom is not. */
    .rdc-input { font-size: 16px; }
}

/* -------------------------------------------------------- the scroll target */
/*
 * The form posts to #contact-form, and the masthead is sticky - without this
 * the browser lands with the anchor tucked under the nav bar. The anchor is on
 * the WRAPPER rather than on the <form> so that a rejection message, which is a
 * sibling above the form, is inside the scrolled-to region rather than just
 * above it. That was the whole bug on the success path.
 */
#contact-form {
    scroll-margin-top: calc(var(--nav-h) + 20px);
}

/* ---------------------------------------------------------- the thank you */
/*
 * One short column, left on the same axis as every other page. Not centred:
 * centring is what a "success!" screen usually does and it is the one moment
 * this design would start to look like somebody else's.
 */
.rdt-wrap { padding-block: calc(var(--row) * 2) calc(var(--row) * 3); }

.rdt-card {
    grid-column: 1 / -1;
    max-width: 60ch;
    padding-inline: 16px;
}

/* A rule, not a tick in a green disc. The filled circle is reserved here for a
   status dot, and a page-sized one would be the loudest thing on the site. */
.rdt-mark {
    display: block;
    width: 46px;
    height: 3px;
    margin-bottom: calc(var(--row) * 0.7);
    background: var(--signal);
}

/* Same display treatment as every other page title - see the --h1-* tokens in
   redesign.css. This rule declared no font-stretch at all, which made it a
   third distinct headline on a site that should have one. */
.rdt-title {
    margin: 10px 0 14px;
    font-family: var(--sans);
    font-size: clamp(30px, 4.2vw, 44px);
    font-stretch: var(--h1-stretch);
    font-weight: var(--h1-weight);
    letter-spacing: var(--h1-tracking);
    line-height: var(--h1-leading);
    text-transform: var(--h1-transform);
    color: var(--ink);
}

.rdt-lede {
    margin: 0;
    font-size: 16px;
    line-height: 1.65;
    color: var(--graphite);
}

.rdt-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 24px;
    margin-top: calc(var(--row) * 1.1);
    padding-top: calc(var(--row) * 0.9);
    border-top: 1px solid var(--rule);
}

.rdt-back {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--graphite);
}

.rdt-back:hover { color: var(--ink); }
