/* ==========================================================================
   Contact page (/contact/)
   Inherits the site's panel, input and button language; adds topic pills,
   the self-hosted "I'm human" check and the sent state.
   ========================================================================== */

.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
}

/* The aside rides along with the form, like the privacy page's "On this page" */
.contact-aside {
    position: sticky;
    top: 24px;
}

.contact-layout ::selection {
    background: rgba(39, 170, 226, 0.35);
    color: #fff;
}

.contact-panel {
    padding: 28px 32px 30px;
    margin-bottom: 0;
}

.contact-intro,
.contact-intro h2 {
    text-align: left;
}

.contact-intro h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin: 0 0 22px;
}

.contact-intro p {
    color: var(--color-text-muted);
    max-width: 60ch;
    margin: 0 0 26px;
    line-height: 1.55;
}

/* --- Fields ------------------------------------------------------------ */

.contact-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.contact-field {
    margin-bottom: 22px;
}

.contact-required,
.contact-optional {
    margin-left: 6px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    color: var(--color-text-dark);
}

.contact-form input[type="email"],
.contact-form input[type="text"],
.contact-form textarea {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 0.95rem;
    caret-color: var(--color-primary);
}

.contact-form textarea {
    min-height: 170px;
    line-height: 1.55;
}

.contact-form [aria-invalid="true"] {
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.contact-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.contact-count {
    font-size: 0.75rem;
    color: var(--color-text-dark);
    font-variant-numeric: tabular-nums;
}

.contact-hint {
    margin: 7px 0 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.contact-error {
    margin: 7px 0 0;
    font-size: 0.82rem;
    color: #fca5a5;
}

/* --- Topic pills (real radios, restyled) -------------------------------- */

.contact-topics {
    border: 0;
    padding: 0;
    min-width: 0;
}

.contact-topics legend {
    display: block;
    padding: 0;
    margin-bottom: 8px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    color: var(--color-text-muted);
}

.contact-topic-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.contact-topic-options input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.contact-topic-options label {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    margin: 0;
    padding: 0 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-input);
    background: var(--color-bg-input);
    color: var(--color-text-light);
    font-size: 0.88rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.contact-topic-options label:hover {
    border-color: rgba(255, 255, 255, 0.32);
}

.contact-topic-options input:checked + label {
    border-color: var(--color-primary);
    background: rgba(39, 170, 226, 0.14);
    color: #fff;
}

.contact-topic-options input:focus-visible + label {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --- Honeypot (off-screen, not display:none, so naive bots still fill it) */

.contact-trap {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --- Submit row -------------------------------------------------------- */

.contact-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 22px;
    border-top: 1px solid var(--color-border-light);
}

.contact-send {
    gap: 9px;
    padding: 13px 24px;
    background: var(--color-primary);
    color: #04121b;
    font-weight: 700;
}

.contact-send svg {
    width: 16px;
    height: 16px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-send:hover,
.contact-send:focus {
    background: var(--color-primary-hover);
    box-shadow: 0 6px 20px rgba(39, 170, 226, 0.28);
}

.contact-send:hover svg,
.contact-send:focus svg {
    stroke: currentColor;
    transform: translate(2px, -2px);
}

.contact-send.is-sending {
    opacity: 0.75;
    cursor: progress;
}

.contact-signed-in {
    margin: 16px 0 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.contact-signed-in strong {
    color: var(--color-text-light);
    font-weight: 600;
}

.contact-form-status {
    margin: 16px 0 0;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.1);
    color: #fecaca;
    font-size: 0.88rem;
}

.contact-recent {
    margin: 0 0 22px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid rgba(39, 170, 226, 0.3);
    background: rgba(39, 170, 226, 0.08);
    color: var(--color-text-light);
    font-size: 0.88rem;
    line-height: 1.5;
}

.contact-noscript {
    margin: 0 0 20px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
    color: #fde68a;
    font-size: 0.9rem;
}

/* --- "I'm human" check -------------------------------------------------- */

.human-check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px 9px 10px;
    border-radius: 12px;
    border: 1px solid var(--color-border-input);
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 0.2s ease;
}

.human-check__box {
    position: relative;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    padding: 0;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: var(--color-bg-input);
    color: #06140a;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.human-check__box:hover {
    border-color: var(--color-primary);
}

.human-check__tick,
.human-check__spinner {
    grid-area: 1 / 1;
}

.human-check__tick {
    width: 18px;
    height: 18px;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.human-check__spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(39, 170, 226, 0.25);
    border-top-color: var(--color-primary);
    opacity: 0;
}

.human-check__text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.human-check__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-light);
}

.human-check__status {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.human-check[data-state="working"] .human-check__box {
    cursor: progress;
    border-color: rgba(39, 170, 226, 0.5);
}

.human-check[data-state="working"] .human-check__spinner {
    opacity: 1;
    animation: human-check-spin 0.8s linear infinite;
}

.human-check[data-state="done"] {
    border-color: rgba(128, 195, 66, 0.4);
}

.human-check[data-state="done"] .human-check__box {
    background: var(--color-success);
    border-color: var(--color-success);
    cursor: default;
}

.human-check[data-state="done"] .human-check__tick {
    opacity: 1;
    transform: scale(1);
}

.human-check[data-state="done"] .human-check__status {
    color: #a3d977;
}

.human-check[data-state="error"] {
    border-color: rgba(239, 68, 68, 0.45);
}

.human-check[data-state="error"] .human-check__box {
    border-color: rgba(239, 68, 68, 0.7);
}

.human-check[data-state="error"] .human-check__status {
    color: #fca5a5;
}

@keyframes human-check-spin {
    to { transform: rotate(360deg); }
}

/* --- Sent state (the page's one authored moment: the tick draws in) ----- */

.contact-success {
    text-align: center;
    padding: 36px 12px 12px;
    outline: none;
}

.contact-success__icon {
    width: 60px;
    height: 60px;
    color: var(--color-success);
    margin-bottom: 14px;
}

.contact-success__icon circle {
    stroke-dasharray: 64;
    stroke-dashoffset: 64;
    animation: contact-draw 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.contact-success__icon path {
    stroke-dasharray: 16;
    stroke-dashoffset: 16;
    animation: contact-draw 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

@keyframes contact-draw {
    to { stroke-dashoffset: 0; }
}

.contact-success h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin: 0 0 8px;
}

.contact-success p {
    color: var(--color-text-muted);
    max-width: 46ch;
    margin: 0 auto 22px;
    line-height: 1.55;
}

.contact-success strong {
    color: var(--color-text-light);
    word-break: break-all;
}

/* --- Aside -------------------------------------------------------------- */

.contact-note {
    padding: 18px 20px;
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid var(--color-border-light);
    background: rgba(255, 255, 255, 0.02);
}

.contact-note h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin: 0 0 6px;
}

.contact-note p {
    font-size: 0.86rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    margin: 0;
}

.contact-note a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(39, 170, 226, 0.45);
}

.contact-note a:hover {
    text-decoration-color: currentColor;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 860px) {
    .contact-aside {
        position: static;
    }
    .contact-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .contact-panel {
        padding: 22px 18px 24px;
    }
    .contact-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .contact-submit-row {
        flex-direction: column;
        align-items: stretch;
    }
    .contact-send {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .contact-success__icon circle,
    .contact-success__icon path {
        animation: none;
        stroke-dashoffset: 0;
    }
    .human-check[data-state="working"] .human-check__spinner {
        animation-duration: 2s;
    }
}
